Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 1 | #include <config.h> |
| 2 | |
| 3 | #include <CLI/CLI.hpp> |
| 4 | |
| 5 | #ifdef HOSTBOOT_DUMP_COLLECTION |
| 6 | #include <watchdog/watchdog_main.hpp> |
| 7 | #else |
Marri Devender Rao | 0947c65 | 2017-10-24 02:27:15 -0500 | [diff] [blame] | 8 | #include "org/open_power/Host/Boot/error.hpp" |
Jayanth Othayoth | b618ccb | 2018-10-22 21:55:29 -0500 | [diff] [blame] | 9 | #include "phosphor-logging/elog-errors.hpp" |
| 10 | |
| 11 | #include <phosphor-logging/elog.hpp> |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 12 | #endif |
Vishwanatha Subbanna | 0eff609 | 2017-06-12 21:03:36 +0530 | [diff] [blame] | 13 | |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 14 | int main(int argc, char* argv[]) |
Vishwanatha Subbanna | 0eff609 | 2017-06-12 21:03:36 +0530 | [diff] [blame] | 15 | { |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 16 | CLI::App app{"Hostboot dump collector for watchdog timeout"}; |
| 17 | |
| 18 | #ifdef HOSTBOOT_DUMP_COLLECTION |
| 19 | uint32_t timeoutInterval = 1500; // in seconds |
| 20 | app.add_option("-t,--timeout", timeoutInterval, |
| 21 | "Set timeout interval for watchdog timeout in seconds"); |
| 22 | #endif |
| 23 | |
| 24 | CLI11_PARSE(app, argc, argv); |
| 25 | |
| 26 | #ifdef HOSTBOOT_DUMP_COLLECTION |
| 27 | using namespace watchdog::dump; |
| 28 | // TODO: trigger SBE dump if in SBE window otherwise hostboot dump |
| 29 | triggerHostbootDump(timeoutInterval); |
| 30 | #else |
Vishwanatha Subbanna | 0eff609 | 2017-06-12 21:03:36 +0530 | [diff] [blame] | 31 | using namespace phosphor::logging; |
Jayanth Othayoth | b618ccb | 2018-10-22 21:55:29 -0500 | [diff] [blame] | 32 | using error = |
| 33 | sdbusplus::org::open_power::Host::Boot::Error::WatchdogTimedOut; |
Vishwanatha Subbanna | 0eff609 | 2017-06-12 21:03:36 +0530 | [diff] [blame] | 34 | report<error>(); |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 35 | #endif |
Vishwanatha Subbanna | 0eff609 | 2017-06-12 21:03:36 +0530 | [diff] [blame] | 36 | |
| 37 | return 0; |
| 38 | } |