Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 1 | #include <unistd.h> |
| 2 | |
Shantappa Teekappanavar | b64983f | 2022-02-01 09:28:10 -0600 | [diff] [blame^] | 3 | #include <phosphor-logging/log.hpp> |
Shantappa Teekappanavar | a1ea5e5 | 2021-08-24 16:30:30 -0500 | [diff] [blame] | 4 | #include <watchdog_common.hpp> |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 5 | #include <watchdog_dbus.hpp> |
| 6 | #include <watchdog_handler.hpp> |
| 7 | #include <watchdog_logging.hpp> |
| 8 | |
| 9 | namespace watchdog |
| 10 | { |
| 11 | namespace 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 | */ |
| 20 | void event(std::map<std::string, std::string>& additional, |
| 21 | const uint32_t timeout) |
| 22 | { |
| 23 | |
| 24 | std::string eventName = "org.open_power.Host.Boot.Error.WatchdogTimeout"; |
| 25 | |
| 26 | // CreatePELWithFFDCFiles requires a vector of FFDCTuple. |
| 27 | auto emptyFfdc = std::vector<FFDCTuple>{}; |
| 28 | |
| 29 | // Create PEL with additional data. |
| 30 | auto pelId = createPel(eventName, additional, emptyFfdc); |
| 31 | |
Shantappa Teekappanavar | 41d507e | 2021-10-05 12:17:55 -0500 | [diff] [blame] | 32 | // Collect Hostboot dump if auto reboot is enabled |
| 33 | DumpParameters dumpParameters; |
| 34 | dumpParameters.logId = pelId; |
| 35 | dumpParameters.unitId = 0; // Not used for Hostboot dump |
| 36 | dumpParameters.timeout = timeout; |
| 37 | dumpParameters.dumpType = DumpType::Hostboot; |
| 38 | |
| 39 | // will not return until dump is complete or timeout |
| 40 | requestDump(dumpParameters); |
Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | void eventWatchdogTimeout(const uint32_t timeout) |
| 44 | { |
| 45 | // Additional data to be added to PEL object |
| 46 | // Currently we don't have anything to add |
| 47 | // Keeping this for now in case if we have to add |
| 48 | // any data corresponding to watchdog timeout |
| 49 | std::map<std::string, std::string> additionalData; |
| 50 | event(additionalData, timeout); |
| 51 | } |
| 52 | |
| 53 | } // namespace dump |
| 54 | } // namespace watchdog |