blob: 84c986bc5ff24835474b93292c1dc46f7c610efe [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,
Ben Tynerb9715172021-09-29 08:46:19 -050033 AttentionFail = 4,
34 PhalSbeChipop = 5
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050035};
36
37/** @brief Maximum length of a single trace event message */
38static const size_t trace_msg_max_len = 255;
39
Ben Tynerf5210bb2021-01-05 12:58:10 -060040/** @brief Create trace message template */
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050041template <level L>
42void trace(const char* i_message);
43
Ben Tynerf5210bb2021-01-05 12:58:10 -060044/** @brief Commit special attention TI event to log */
45void eventTerminate(std::map<std::string, std::string> i_additionalData,
46 char* i_tiInfoData);
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050047
Ben Tyner7f6ce6a2021-08-17 19:40:00 -050048/** @brief Commit SBE vital event to log, returns event log Id */
49uint32_t eventVital();
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050050
Ben Tynerf5210bb2021-01-05 12:58:10 -060051/** @brief Commit attention handler failure event to log */
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050052void eventAttentionFail(int i_error);
53
Ben Tynerb9715172021-09-29 08:46:19 -050054/** @brief Commit sbe chipop event to log */
55void eventPhalSbeChipop(uint32_t proc);
56
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050057} // namespace attn