1 #pragma once
2 
3 #include <util/ffdc_file.hpp>
4 
5 #include <cstddef> // for size_t
6 #include <map>
7 #include <string>
8 #include <vector>
9 
10 namespace attn
11 {
12 
13 constexpr int maxTraceLen = 64; // characters
14 
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 
19 /** @brief Logging level types */
20 enum level
21 {
22     INFO,
23     ERROR
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     PhalSbeChipop = 5
35 };
36 
37 /** @brief Maximum length of a single trace event message */
38 static const size_t trace_msg_max_len = 255;
39 
40 /** @brief Create trace message template */
41 template <level L>
42 void trace(const char* i_message);
43 
44 /** @brief Commit special attention TI event to log */
45 void eventTerminate(std::map<std::string, std::string> i_additionalData,
46                     char* i_tiInfoData);
47 
48 /** @brief Commit SBE vital event to log, returns event log Id */
49 uint32_t eventVital();
50 
51 /** @brief Commit attention handler failure event to log */
52 void eventAttentionFail(int i_error);
53 
54 /** @brief Commit sbe chipop event to log */
55 void eventPhalSbeChipop(uint32_t proc);
56 
57 } // namespace attn
58