xref: /openbmc/pldm/oem/ampere/event/cper.hpp (revision 72c8aa06)
1 #include "libcper/Cper.h"
2 
3 #include <stdint.h>
4 #include <stdio.h>
5 #include <unistd.h>
6 
7 #include <fstream>
8 #include <vector>
9 
10 namespace pldm
11 {
12 namespace oem_ampere
13 {
14 constexpr auto logBusName = "xyz.openbmc_project.Logging.IPMI";
15 constexpr auto logPath = "/xyz/openbmc_project/Logging/IPMI";
16 constexpr auto logIntf = "xyz.openbmc_project.Logging.IPMI";
17 #define SENSOR_TYPE_OEM 0xF0
18 
19 /* Memory definitions */
20 #define MEM_ERROR_TYPE_PARITY 8
21 #define ERROR_TYPE_ID_MCU 1
22 #define SUBTYPE_ID_PARITY 9
23 
24 /* PCIe definitions */
25 #define ERROR_SUBTYPE_PCIE_AER_ROOT_PORT 0
26 #define ERROR_SUBTYPE_PCIE_AER_DEVICE 1
27 #define CPER_PCIE_VALID_PORT_TYPE 0x0001
28 #define CPER_PCIE_PORT_TYPE_ROOT_PORT 4
29 
30 typedef struct
31 {
32     uint8_t formatVersion;
33     uint8_t formatType;
34     uint16_t length;
35 } __attribute__((packed)) CommonEventData;
36 
37 void decodeCperRecord(const uint8_t* data, size_t eventDataSize,
38                       EFI_AMPERE_ERROR_DATA* ampSpecHdr);
39 void addCperSELLog(uint8_t TID, uint16_t eventID, EFI_AMPERE_ERROR_DATA* p);
40 
41 } // namespace oem_ampere
42 } // namespace pldm
43