blob: d04c95f85b7484b9aa738dc6fc12222df883e991 [file] [log] [blame]
Jayanth Othayoth5ba35c62025-06-07 03:55:11 -05001#include "watchdog_logging.hpp"
2
3#include "watchdog_common.hpp"
4#include "watchdog_dbus.hpp"
5#include "watchdog_handler.hpp"
6
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05007#include <unistd.h>
8
Shantappa Teekappanavarb64983f2022-02-01 09:28:10 -06009#include <phosphor-logging/log.hpp>
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050010
11namespace watchdog
12{
13namespace dump
14{
15
16/**
17 * @brief Log an event handled by the dump handler
18 *
19 * @param additional - Additional PEL data
20 * @param timeout - timeout interval in seconds
21 */
22void event(std::map<std::string, std::string>& additional,
23 const uint32_t timeout)
24{
deepakala-k4f4e36d2023-04-24 09:08:18 -050025 std::string eventName = "org.open_power.Host.Boot.Error.WatchdogTimedOut";
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050026
27 // CreatePELWithFFDCFiles requires a vector of FFDCTuple.
28 auto emptyFfdc = std::vector<FFDCTuple>{};
29
30 // Create PEL with additional data.
31 auto pelId = createPel(eventName, additional, emptyFfdc);
32
Shantappa Teekappanavar41d507e2021-10-05 12:17:55 -050033 // Collect Hostboot dump if auto reboot is enabled
34 DumpParameters dumpParameters;
35 dumpParameters.logId = pelId;
36 dumpParameters.unitId = 0; // Not used for Hostboot dump
37 dumpParameters.timeout = timeout;
38 dumpParameters.dumpType = DumpType::Hostboot;
39
40 // will not return until dump is complete or timeout
41 requestDump(dumpParameters);
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050042}
43
44void eventWatchdogTimeout(const uint32_t timeout)
45{
46 // Additional data to be added to PEL object
47 // Currently we don't have anything to add
48 // Keeping this for now in case if we have to add
49 // any data corresponding to watchdog timeout
50 std::map<std::string, std::string> additionalData;
51 event(additionalData, timeout);
52}
53
54} // namespace dump
55} // namespace watchdog