blob: 72a39e5aaa1c97649e8bb00c96fd8dde5b5a6902 [file] [log] [blame]
Dung Cao72c8aa02023-11-22 02:31:41 +00001#include "libcper/Cper.h"
2
Dung Cao72c8aa02023-11-22 02:31:41 +00003#include <unistd.h>
4
Pavithra Barithaya9b71a562025-01-30 17:01:45 +05305#include <cstdint>
6#include <cstdio>
Dung Cao72c8aa02023-11-22 02:31:41 +00007#include <fstream>
8#include <vector>
9
10namespace pldm
11{
12namespace oem_ampere
13{
14constexpr auto logBusName = "xyz.openbmc_project.Logging.IPMI";
15constexpr auto logPath = "/xyz/openbmc_project/Logging/IPMI";
16constexpr 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
30typedef struct
31{
32 uint8_t formatVersion;
33 uint8_t formatType;
34 uint16_t length;
35} __attribute__((packed)) CommonEventData;
36
37void decodeCperRecord(const uint8_t* data, size_t eventDataSize,
38 EFI_AMPERE_ERROR_DATA* ampSpecHdr);
39void addCperSELLog(uint8_t TID, uint16_t eventID, EFI_AMPERE_ERROR_DATA* p);
40
41} // namespace oem_ampere
42} // namespace pldm