1 #ifndef CPER_SECTION_PCI_DEV_H 2 #define CPER_SECTION_PCI_DEV_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include <stdio.h> 9 #include <json.h> 10 #include <libcper/Cper.h> 11 12 #define PCI_DEV_ERROR_VALID_BITFIELD_NAMES \ 13 (const char *[]){ "errorStatusValid", "idInfoValid", \ 14 "memoryNumberValid", "ioNumberValid", \ 15 "registerDataPairsValid" } 16 17 /// 18 /// PCI/PCI-X Device Error Section 19 /// 20 typedef struct { 21 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; 29 } EFI_PCI_PCIX_DEVICE_ID_INFO; 30 31 typedef struct { 32 UINT64 Address; 33 UINT64 Value; 34 } EFI_PCI_PCIX_DEVICE_ERROR_DATA_REGISTER; 35 36 typedef struct { 37 UINT64 ValidFields; 38 EFI_GENERIC_ERROR_STATUS ErrorStatus; 39 EFI_PCI_PCIX_DEVICE_ID_INFO IdInfo; 40 UINT32 MemoryNumber; 41 UINT32 IoNumber; 42 // 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 48 } __attribute__((packed, aligned(1))) EFI_PCI_PCIX_DEVICE_ERROR_DATA; 49 50 json_object *cper_section_pci_dev_to_ir(const UINT8 *section, UINT32 size); 51 void ir_section_pci_dev_to_cper(json_object *section, FILE *out); 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 #endif 58