blob: ca22ba3ef891f4f35465de870b1a202e0f6ebe73 [file] [log] [blame]
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05001#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 Rao0947c652017-10-24 02:27:15 -05008#include "org/open_power/Host/Boot/error.hpp"
Jayanth Othayothb618ccb2018-10-22 21:55:29 -05009#include "phosphor-logging/elog-errors.hpp"
10
11#include <phosphor-logging/elog.hpp>
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050012#endif
Vishwanatha Subbanna0eff6092017-06-12 21:03:36 +053013
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050014int main(int argc, char* argv[])
Vishwanatha Subbanna0eff6092017-06-12 21:03:36 +053015{
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050016 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 Subbanna0eff6092017-06-12 21:03:36 +053031 using namespace phosphor::logging;
Jayanth Othayothb618ccb2018-10-22 21:55:29 -050032 using error =
33 sdbusplus::org::open_power::Host::Boot::Error::WatchdogTimedOut;
Vishwanatha Subbanna0eff6092017-06-12 21:03:36 +053034 report<error>();
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050035#endif
Vishwanatha Subbanna0eff6092017-06-12 21:03:36 +053036
37 return 0;
38}