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