Lawrence Tang | a416ec9 | 2022-07-06 14:34:40 +0100 | [diff] [blame] | 1 | #ifndef CPER_SECTION_PCI_DEV_H |
| 2 | #define CPER_SECTION_PCI_DEV_H |
| 3 | |
Karthik Rajagopalan | 255bd81 | 2024-09-06 14:36:34 -0700 | [diff] [blame] | 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
Ed Tanous | c97c041 | 2025-02-04 11:31:31 -0800 | [diff] [blame] | 8 | #include <stdio.h> |
Lawrence Tang | 5202bbb | 2022-08-12 14:54:36 +0100 | [diff] [blame] | 9 | #include <json.h> |
Thu Nguyen | e42fb48 | 2024-10-15 14:43:11 +0000 | [diff] [blame] | 10 | #include <libcper/Cper.h> |
Lawrence Tang | a416ec9 | 2022-07-06 14:34:40 +0100 | [diff] [blame] | 11 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 12 | #define PCI_DEV_ERROR_VALID_BITFIELD_NAMES \ |
Patrick Williams | 30cd66a | 2024-12-18 11:23:15 -0500 | [diff] [blame] | 13 | (const char *[]){ "errorStatusValid", "idInfoValid", \ |
| 14 | "memoryNumberValid", "ioNumberValid", \ |
| 15 | "registerDataPairsValid" } |
Lawrence Tang | a416ec9 | 2022-07-06 14:34:40 +0100 | [diff] [blame] | 16 | |
| 17 | /// |
| 18 | /// PCI/PCI-X Device Error Section |
| 19 | /// |
| 20 | typedef struct { |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 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; |
Lawrence Tang | a416ec9 | 2022-07-06 14:34:40 +0100 | [diff] [blame] | 29 | } EFI_PCI_PCIX_DEVICE_ID_INFO; |
| 30 | |
| 31 | typedef struct { |
Ed Tanous | 12dbd4f | 2025-03-08 19:05:01 -0800 | [diff] [blame] | 32 | UINT64 Address; |
| 33 | UINT64 Value; |
| 34 | } EFI_PCI_PCIX_DEVICE_ERROR_DATA_REGISTER; |
| 35 | |
| 36 | typedef struct { |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 37 | UINT64 ValidFields; |
| 38 | EFI_GENERIC_ERROR_STATUS ErrorStatus; |
| 39 | EFI_PCI_PCIX_DEVICE_ID_INFO IdInfo; |
| 40 | UINT32 MemoryNumber; |
| 41 | UINT32 IoNumber; |
Ed Tanous | 12dbd4f | 2025-03-08 19:05:01 -0800 | [diff] [blame] | 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 | |
Lawrence Tang | efe17e2 | 2022-08-08 09:16:23 +0100 | [diff] [blame] | 48 | } __attribute__((packed, aligned(1))) EFI_PCI_PCIX_DEVICE_ERROR_DATA; |
Lawrence Tang | a416ec9 | 2022-07-06 14:34:40 +0100 | [diff] [blame] | 49 | |
Ed Tanous | 12dbd4f | 2025-03-08 19:05:01 -0800 | [diff] [blame] | 50 | json_object *cper_section_pci_dev_to_ir(const UINT8 *section, UINT32 size); |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 51 | void ir_section_pci_dev_to_cper(json_object *section, FILE *out); |
Lawrence Tang | a416ec9 | 2022-07-06 14:34:40 +0100 | [diff] [blame] | 52 | |
Karthik Rajagopalan | 255bd81 | 2024-09-06 14:36:34 -0700 | [diff] [blame] | 53 | #ifdef __cplusplus |
| 54 | } |
| 55 | #endif |
| 56 | |
John Chung | f8fc705 | 2024-05-03 20:05:29 +0800 | [diff] [blame] | 57 | #endif |