xref: /openbmc/libcper/include/libcper/sections/cper-section-pci-dev.h (revision c97c041e571841f0ce67292208e083f6d858cf5c)
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 ValidFields;
33 	EFI_GENERIC_ERROR_STATUS ErrorStatus;
34 	EFI_PCI_PCIX_DEVICE_ID_INFO IdInfo;
35 	UINT32 MemoryNumber;
36 	UINT32 IoNumber;
37 } __attribute__((packed, aligned(1))) EFI_PCI_PCIX_DEVICE_ERROR_DATA;
38 
39 json_object *cper_section_pci_dev_to_ir(void *section);
40 void ir_section_pci_dev_to_cper(json_object *section, FILE *out);
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
46 #endif
47