blob: cb6321c621a9cab961a8cb22853d29dae24dd053 [file] [log] [blame]
Lawrence Tanga416ec92022-07-06 14:34:40 +01001#ifndef CPER_SECTION_PCI_DEV_H
2#define CPER_SECTION_PCI_DEV_H
3
Karthik Rajagopalan255bd812024-09-06 14:36:34 -07004#ifdef __cplusplus
5extern "C" {
6#endif
7
Ed Tanousc97c0412025-02-04 11:31:31 -08008#include <stdio.h>
Lawrence Tang5202bbb2022-08-12 14:54:36 +01009#include <json.h>
Thu Nguyene42fb482024-10-15 14:43:11 +000010#include <libcper/Cper.h>
Lawrence Tanga416ec92022-07-06 14:34:40 +010011
John Chungf8fc7052024-05-03 20:05:29 +080012#define PCI_DEV_ERROR_VALID_BITFIELD_NAMES \
Patrick Williams30cd66a2024-12-18 11:23:15 -050013 (const char *[]){ "errorStatusValid", "idInfoValid", \
14 "memoryNumberValid", "ioNumberValid", \
15 "registerDataPairsValid" }
Lawrence Tanga416ec92022-07-06 14:34:40 +010016
17///
18/// PCI/PCI-X Device Error Section
19///
20typedef struct {
John Chungf8fc7052024-05-03 20:05:29 +080021 UINT64 VendorId : 16;
22 UINT64 DeviceId : 16;
23 UINT64 ClassCode : 24;
24 UINT64 FunctionNumber : 8;
25 UINT64 DeviceNumber : 8;
26 UINT64 BusNumber : 8;
27 UINT64 SegmentNumber : 8;
28 UINT64 Reserved : 40;
Lawrence Tanga416ec92022-07-06 14:34:40 +010029} EFI_PCI_PCIX_DEVICE_ID_INFO;
30
31typedef struct {
Ed Tanous12dbd4f2025-03-08 19:05:01 -080032 UINT64 Address;
33 UINT64 Value;
34} EFI_PCI_PCIX_DEVICE_ERROR_DATA_REGISTER;
35
36typedef struct {
John Chungf8fc7052024-05-03 20:05:29 +080037 UINT64 ValidFields;
38 EFI_GENERIC_ERROR_STATUS ErrorStatus;
39 EFI_PCI_PCIX_DEVICE_ID_INFO IdInfo;
40 UINT32 MemoryNumber;
41 UINT32 IoNumber;
Ed Tanous12dbd4f2025-03-08 19:05:01 -080042 // Keep this at the end of this struct
43 // and allocate based on NumberRegs
44#ifndef __cplusplus
45 EFI_PCI_PCIX_DEVICE_ERROR_DATA_REGISTER MemoryRegister[];
46#endif
47
Lawrence Tangefe17e22022-08-08 09:16:23 +010048} __attribute__((packed, aligned(1))) EFI_PCI_PCIX_DEVICE_ERROR_DATA;
Lawrence Tanga416ec92022-07-06 14:34:40 +010049
Ed Tanous12dbd4f2025-03-08 19:05:01 -080050json_object *cper_section_pci_dev_to_ir(const UINT8 *section, UINT32 size);
John Chungf8fc7052024-05-03 20:05:29 +080051void ir_section_pci_dev_to_cper(json_object *section, FILE *out);
Lawrence Tanga416ec92022-07-06 14:34:40 +010052
Karthik Rajagopalan255bd812024-09-06 14:36:34 -070053#ifdef __cplusplus
54}
55#endif
56
John Chungf8fc7052024-05-03 20:05:29 +080057#endif