1 #include <config.h>
2 
3 #include <CLI/CLI.hpp>
4 
5 #ifdef HOSTBOOT_DUMP_COLLECTION
6 #include <watchdog/watchdog_main.hpp>
7 #else
8 #include "org/open_power/Host/Boot/error.hpp"
9 #include "phosphor-logging/elog-errors.hpp"
10 
11 #include <phosphor-logging/elog.hpp>
12 #endif
13 
14 int main(int argc, char* argv[])
15 {
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
31     using namespace phosphor::logging;
32     using error =
33         sdbusplus::org::open_power::Host::Boot::Error::WatchdogTimedOut;
34     report<error>();
35 #endif
36 
37     return 0;
38 }
39