blob: 52ec7c714b358811e1940204248fbd3a9267e275 [file] [log] [blame]
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05001#include <unistd.h>
2
Shantappa Teekappanavara1ea5e52021-08-24 16:30:30 -05003#include <watchdog_common.hpp>
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05004#include <watchdog_dbus.hpp>
5#include <watchdog_handler.hpp>
6#include <watchdog_logging.hpp>
7
8namespace watchdog
9{
10namespace dump
11{
12
13/**
14 * @brief Log an event handled by the dump handler
15 *
16 * @param additional - Additional PEL data
17 * @param timeout - timeout interval in seconds
18 */
19void event(std::map<std::string, std::string>& additional,
20 const uint32_t timeout)
21{
22
23 std::string eventName = "org.open_power.Host.Boot.Error.WatchdogTimeout";
24
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 Teekappanavara1ea5e52021-08-24 16:30:30 -050031 // Collect Hostboot dump if auto reboot is enabled
32 if (isAutoRebootEnabled())
33 {
34 requestDump(pelId, timeout); // will not return until dump is complete
35 }
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050036}
37
38void eventWatchdogTimeout(const uint32_t timeout)
39{
40 // Additional data to be added to PEL object
41 // Currently we don't have anything to add
42 // Keeping this for now in case if we have to add
43 // any data corresponding to watchdog timeout
44 std::map<std::string, std::string> additionalData;
45 event(additionalData, timeout);
46}
47
48} // namespace dump
49} // namespace watchdog