Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ben Tyner | 1b1915e | 2020-10-23 15:13:38 -0500 | [diff] [blame] | 3 | #include <util/ffdc_file.hpp> |
| 4 | |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 5 | #include <cstddef> // for size_t |
| 6 | #include <map> |
| 7 | #include <string> |
Ben Tyner | 1b1915e | 2020-10-23 15:13:38 -0500 | [diff] [blame] | 8 | #include <vector> |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 9 | |
| 10 | namespace attn |
| 11 | { |
| 12 | |
Ben Tyner | 6764d70 | 2021-02-12 09:17:23 -0600 | [diff] [blame] | 13 | constexpr int maxTraceLen = 64; // characters |
| 14 | |
Ben Tyner | 188f109 | 2021-02-01 09:33:06 -0600 | [diff] [blame] | 15 | constexpr auto pathLogging = "/xyz/openbmc_project/logging"; |
| 16 | constexpr auto levelPelError = "xyz.openbmc_project.Logging.Entry.Level.Error"; |
| 17 | constexpr auto eventPelTerminate = "xyz.open_power.Attn.Error.Terminate"; |
| 18 | |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 19 | /** @brief Logging level types */ |
| 20 | enum level |
| 21 | { |
Ben Tyner | d700609 | 2021-02-05 14:55:52 -0600 | [diff] [blame] | 22 | INFO, |
| 23 | ERROR |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | /** @brief Logging event types */ |
| 27 | enum class EventType |
| 28 | { |
| 29 | Checkstop = 0, |
| 30 | Terminate = 1, |
| 31 | Vital = 2, |
| 32 | HwDiagsFail = 3, |
| 33 | AttentionFail = 4 |
| 34 | }; |
| 35 | |
| 36 | /** @brief Maximum length of a single trace event message */ |
| 37 | static const size_t trace_msg_max_len = 255; |
| 38 | |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 39 | /** @brief Create trace message template */ |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 40 | template <level L> |
| 41 | void trace(const char* i_message); |
| 42 | |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 43 | /** @brief Commit special attention TI event to log */ |
| 44 | void eventTerminate(std::map<std::string, std::string> i_additionalData, |
| 45 | char* i_tiInfoData); |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 46 | |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 47 | /** @brief Commit SBE vital event to log */ |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 48 | void eventVital(); |
| 49 | |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 50 | /** @brief Commit attention handler failure event to log */ |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 51 | void eventAttentionFail(int i_error); |
| 52 | |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 53 | } // namespace attn |