blob: e790d946f36810cd5fcd0340672265ccc4fca88c [file] [log] [blame]
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05001#pragma once
2
Ben Tyner1b1915e2020-10-23 15:13:38 -05003#include <util/ffdc_file.hpp>
4
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05005#include <cstddef> // for size_t
6#include <map>
7#include <string>
Ben Tyner1b1915e2020-10-23 15:13:38 -05008#include <vector>
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05009
10namespace attn
11{
12
Ben Tyner6764d702021-02-12 09:17:23 -060013constexpr int maxTraceLen = 64; // characters
14
Ben Tyner188f1092021-02-01 09:33:06 -060015constexpr auto pathLogging = "/xyz/openbmc_project/logging";
16constexpr auto levelPelError = "xyz.openbmc_project.Logging.Entry.Level.Error";
17constexpr auto eventPelTerminate = "xyz.open_power.Attn.Error.Terminate";
18
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050019/** @brief Logging level types */
20enum level
21{
Ben Tynerd7006092021-02-05 14:55:52 -060022 INFO,
23 ERROR
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050024};
25
26/** @brief Logging event types */
27enum 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 */
37static const size_t trace_msg_max_len = 255;
38
Ben Tynerf5210bb2021-01-05 12:58:10 -060039/** @brief Create trace message template */
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050040template <level L>
41void trace(const char* i_message);
42
Ben Tynerf5210bb2021-01-05 12:58:10 -060043/** @brief Commit special attention TI event to log */
44void eventTerminate(std::map<std::string, std::string> i_additionalData,
45 char* i_tiInfoData);
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050046
Ben Tyner7f6ce6a2021-08-17 19:40:00 -050047/** @brief Commit SBE vital event to log, returns event log Id */
48uint32_t eventVital();
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050049
Ben Tynerf5210bb2021-01-05 12:58:10 -060050/** @brief Commit attention handler failure event to log */
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050051void eventAttentionFail(int i_error);
52
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050053} // namespace attn