1a416ec93SLawrence Tang #ifndef CPER_SECTION_PCI_DEV_H
2a416ec93SLawrence Tang #define CPER_SECTION_PCI_DEV_H
3a416ec93SLawrence Tang 
4*255bd81aSKarthik Rajagopalan #ifdef __cplusplus
5*255bd81aSKarthik Rajagopalan extern "C" {
6*255bd81aSKarthik Rajagopalan #endif
7*255bd81aSKarthik Rajagopalan 
85202bbb4SLawrence Tang #include <json.h>
9a416ec93SLawrence Tang #include "../edk/Cper.h"
10a416ec93SLawrence Tang 
11f8fc7052SJohn Chung #define PCI_DEV_ERROR_VALID_BITFIELD_NAMES                                     \
12f8fc7052SJohn Chung 	(const char *[])                                                       \
13f8fc7052SJohn Chung 	{                                                                      \
14f8fc7052SJohn Chung 		"errorStatusValid", "idInfoValid", "memoryNumberValid",        \
15f8fc7052SJohn Chung 			"ioNumberValid", "registerDataPairsValid"              \
16f8fc7052SJohn Chung 	}
17a416ec93SLawrence Tang 
18a416ec93SLawrence Tang ///
19a416ec93SLawrence Tang /// PCI/PCI-X Device Error Section
20a416ec93SLawrence Tang ///
21a416ec93SLawrence Tang typedef struct {
22d7e8ca34SLawrence Tang 	UINT64 VendorId : 16;
23d7e8ca34SLawrence Tang 	UINT64 DeviceId : 16;
24d7e8ca34SLawrence Tang 	UINT64 ClassCode : 24;
25d7e8ca34SLawrence Tang 	UINT64 FunctionNumber : 8;
26d7e8ca34SLawrence Tang 	UINT64 DeviceNumber : 8;
27d7e8ca34SLawrence Tang 	UINT64 BusNumber : 8;
28d7e8ca34SLawrence Tang 	UINT64 SegmentNumber : 8;
29d7e8ca34SLawrence Tang 	UINT64 Reserved : 40;
30a416ec93SLawrence Tang } EFI_PCI_PCIX_DEVICE_ID_INFO;
31a416ec93SLawrence Tang 
32a416ec93SLawrence Tang typedef struct {
33a416ec93SLawrence Tang 	UINT64 ValidFields;
34a416ec93SLawrence Tang 	EFI_GENERIC_ERROR_STATUS ErrorStatus;
35a416ec93SLawrence Tang 	EFI_PCI_PCIX_DEVICE_ID_INFO IdInfo;
36a416ec93SLawrence Tang 	UINT32 MemoryNumber;
37a416ec93SLawrence Tang 	UINT32 IoNumber;
38efe17e2cSLawrence Tang } __attribute__((packed, aligned(1))) EFI_PCI_PCIX_DEVICE_ERROR_DATA;
39a416ec93SLawrence Tang 
40f8fc7052SJohn Chung json_object *cper_section_pci_dev_to_ir(void *section);
41205dd1d7SLawrence Tang void ir_section_pci_dev_to_cper(json_object *section, FILE *out);
42a416ec93SLawrence Tang 
43*255bd81aSKarthik Rajagopalan #ifdef __cplusplus
44*255bd81aSKarthik Rajagopalan }
45*255bd81aSKarthik Rajagopalan #endif
46*255bd81aSKarthik Rajagopalan 
47a416ec93SLawrence Tang #endif
48