blob: 5551fb7872766dd8c7a3253fadc2b973db4ca9cb [file] [log] [blame]
Lawrence Tang1b0b00e2022-07-05 10:33:10 +01001/**
Lawrence Tang2800cd82022-07-05 16:08:20 +01002 * Describes high level functions for converting an entire CPER log, and functions for parsing
3 * CPER headers and section descriptions into an intermediate JSON format.
Lawrence Tang1b0b00e2022-07-05 10:33:10 +01004 *
5 * Author: Lawrence.Tang@arm.com
6 **/
7
8#include <stdio.h>
9#include "json.h"
10#include "edk/Cper.h"
11#include "cper-parse.h"
12#include "cper-utils.h"
13#include "sections/cper-section-generic.h"
Lawrence Tang794312c2022-07-05 14:46:10 +010014#include "sections/cper-section-ia32x64.h"
Lawrence Tang2800cd82022-07-05 16:08:20 +010015#include "sections/cper-section-arm.h"
Lawrence Tanga0865e32022-07-06 11:59:52 +010016#include "sections/cper-section-memory.h"
Lawrence Tang4dbe3d72022-07-06 13:51:01 +010017#include "sections/cper-section-pcie.h"
Lawrence Tang214a1542022-07-06 14:11:28 +010018#include "sections/cper-section-pci-bus.h"
Lawrence Tanga416ec92022-07-06 14:34:40 +010019#include "sections/cper-section-pci-dev.h"
Lawrence Tangc60a2432022-07-06 14:58:33 +010020#include "sections/cper-section-firmware.h"
Lawrence Tang4795d4a2022-07-06 15:19:31 +010021#include "sections/cper-section-dmar-generic.h"
Lawrence Tangdb1b7ce2022-07-06 15:40:26 +010022#include "sections/cper-section-dmar-vtd.h"
23#include "sections/cper-section-dmar-iommu.h"
Lawrence Tang864c0da2022-07-06 15:55:40 +010024#include "sections/cper-section-ccix-per.h"
Lawrence Tangb98ec662022-07-06 16:50:21 +010025#include "sections/cper-section-cxl-protocol.h"
Lawrence Tang1b0b00e2022-07-05 10:33:10 +010026
27//Private pre-definitions.
28json_object* cper_header_to_ir(EFI_COMMON_ERROR_RECORD_HEADER* header);
29json_object* cper_section_descriptor_to_ir(EFI_ERROR_SECTION_DESCRIPTOR* section_descriptor);
30json_object* cper_section_to_ir(FILE* handle, EFI_ERROR_SECTION_DESCRIPTOR* descriptor);
31
32//Reads a CPER log file at the given file location, and returns an intermediate
33//JSON representation of this CPER record.
34json_object* cper_to_ir(const char* filename)
35{
36 //Get a handle for the log file.
37 FILE* cper_file = fopen(filename, "r");
38 if (cper_file == NULL) {
39 printf("Could not open CPER record, file handle returned null.");
40 return NULL;
41 }
42
43 //Ensure this is really a CPER log.
44 EFI_COMMON_ERROR_RECORD_HEADER header;
45 fseek(cper_file, 0, SEEK_SET);
46 if (fread(&header, sizeof(EFI_COMMON_ERROR_RECORD_HEADER), 1, cper_file) != 1)
47 {
48 printf("Invalid CPER file: Invalid length (log too short).");
49 return NULL;
50 }
51
52 //Check if the header contains the magic bytes ("CPER").
53 if (header.SignatureStart != EFI_ERROR_RECORD_SIGNATURE_START) {
54 printf("Invalid CPER file: Invalid header (incorrect signature).");
55 return NULL;
56 }
57
58 // //Print struct contents (debug).
59 // fpos_t file_pos;
60 // fgetpos(cper_file, &file_pos);
61 // printf("Stream is at position %d.\n", file_pos);
62 // printf("SignatureStart: %s\n", (char*)&header.SignatureStart);
63 // printf("Revision: %u\n", header.Revision);
64 // printf("SectionCount: %u\n", header.SectionCount);
65 // printf("Severity: %d\n", header.ErrorSeverity);
66 // printf("RecordLength: %d\n", header.RecordLength);
67
68 //Create the header JSON object from the read bytes.
69 json_object* header_ir = cper_header_to_ir(&header);
70
71 //Read the appropriate number of section descriptors & sections, and convert them into IR format.
72 json_object* section_descriptors_ir = json_object_new_array();
73 json_object* sections_ir = json_object_new_array();
74 for (int i=0; i<header.SectionCount; i++)
75 {
76 //Create the section descriptor.
77 EFI_ERROR_SECTION_DESCRIPTOR section_descriptor;
78 if (fread(&section_descriptor, sizeof(EFI_ERROR_SECTION_DESCRIPTOR), 1, cper_file) != 1)
79 {
80 printf("Invalid number of section headers: Header states %d sections, could not read section %d.", header.SectionCount, i+1);
81 return NULL;
82 }
83 json_object_array_add(section_descriptors_ir, cper_section_descriptor_to_ir(&section_descriptor));
84
85 //Read the section itself.
86 json_object_array_add(sections_ir, cper_section_to_ir(cper_file, &section_descriptor));
87 }
88
89 //Add the header, section descriptors, and sections to a parent object.
90 json_object* parent = json_object_new_object();
91 json_object_object_add(parent, "header", header_ir);
92 json_object_object_add(parent, "sectionDescriptors", section_descriptors_ir);
Lawrence Tang2800cd82022-07-05 16:08:20 +010093 json_object_object_add(parent, "sections", sections_ir);
Lawrence Tang1b0b00e2022-07-05 10:33:10 +010094
95 //...
96 return parent;
97}
98
99//Converts a parsed CPER record header into intermediate JSON object format.
100json_object* cper_header_to_ir(EFI_COMMON_ERROR_RECORD_HEADER* header)
101{
102 json_object* header_ir = json_object_new_object();
103
104 //Revision/version information.
105 json_object_object_add(header_ir, "revision", revision_to_ir(header->Revision));
106
107 //Section count.
108 json_object_object_add(header_ir, "sectionCount", json_object_new_int(header->SectionCount));
109
110 //Error severity (with interpreted string version).
111 json_object* error_severity = json_object_new_object();
112 json_object_object_add(error_severity, "code", json_object_new_int(header->ErrorSeverity));
113 json_object_object_add(error_severity, "name", json_object_new_string(severity_to_string(header->ErrorSeverity)));
114 json_object_object_add(header_ir, "severity", error_severity);
115
116 //The validation bits for each section.
Lawrence Tang2800cd82022-07-05 16:08:20 +0100117 json_object* validation_bits = bitfield_to_ir(header->ValidationBits, 3, CPER_HEADER_VALID_BITFIELD_NAMES);
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100118 json_object_object_add(header_ir, "validationBits", validation_bits);
119
120 //Total length of the record (including headers) in bytes.
121 json_object_object_add(header_ir, "recordLength", json_object_new_int(header->RecordLength));
122
123 //If a timestamp exists according to validation bits, then add it.
124 if (header->ValidationBits & 0b10)
125 {
126 char timestamp_string[TIMESTAMP_LENGTH];
127 sprintf(timestamp_string, "%02d%02d-%02d-%02dT%02d:%02d:%02d.000",
128 header->TimeStamp.Century,
129 header->TimeStamp.Year,
130 header->TimeStamp.Month,
131 header->TimeStamp.Day,
132 header->TimeStamp.Hours,
133 header->TimeStamp.Minutes,
134 header->TimeStamp.Seconds);
135
136 json_object_object_add(header_ir, "timestamp", json_object_new_string(timestamp_string));
137 json_object_object_add(header_ir, "timestampIsPrecise", json_object_new_boolean(header->TimeStamp.Flag));
138 }
139
140 //If a platform ID exists according to the validation bits, then add it.
141 if (header->ValidationBits & 0b1)
142 {
143 char platform_string[GUID_STRING_LENGTH];
144 guid_to_string(platform_string, &header->PlatformID);
145 json_object_object_add(header_ir, "platformID", json_object_new_string(platform_string));
146 }
147
148 //If a partition ID exists according to the validation bits, then add it.
149 if (header->ValidationBits & 0b100)
150 {
151 char partition_string[GUID_STRING_LENGTH];
152 guid_to_string(partition_string, &header->PartitionID);
153 json_object_object_add(header_ir, "partitionID", json_object_new_string(partition_string));
154 }
155
156 //Creator ID of the header.
157 char creator_string[GUID_STRING_LENGTH];
158 guid_to_string(creator_string, &header->CreatorID);
159 json_object_object_add(header_ir, "creatorID", json_object_new_string(creator_string));
160
161 //Notification type for the header. Some defined types are available.
162 json_object* notification_type = json_object_new_object();
163 char notification_type_string[GUID_STRING_LENGTH];
164 guid_to_string(notification_type_string, &header->NotificationType);
165 json_object_object_add(notification_type, "guid", json_object_new_string(notification_type_string));
166
167 //Add the human readable notification type if possible.
168 char* notification_type_readable = "Unknown";
169 if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeCmcGuid))
170 notification_type_readable = "CMC";
Lawrence Tang794312c2022-07-05 14:46:10 +0100171 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeCpeGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100172 notification_type_readable = "CPE";
Lawrence Tang794312c2022-07-05 14:46:10 +0100173 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeMceGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100174 notification_type_readable = "MCE";
Lawrence Tang794312c2022-07-05 14:46:10 +0100175 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypePcieGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100176 notification_type_readable = "PCIe";
Lawrence Tang794312c2022-07-05 14:46:10 +0100177 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeInitGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100178 notification_type_readable = "INIT";
Lawrence Tang794312c2022-07-05 14:46:10 +0100179 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeNmiGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100180 notification_type_readable = "NMI";
Lawrence Tang794312c2022-07-05 14:46:10 +0100181 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeBootGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100182 notification_type_readable = "Boot";
Lawrence Tang794312c2022-07-05 14:46:10 +0100183 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeDmarGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100184 notification_type_readable = "DMAr";
Lawrence Tang794312c2022-07-05 14:46:10 +0100185 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeSeaGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100186 notification_type_readable = "SEA";
Lawrence Tang794312c2022-07-05 14:46:10 +0100187 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeSeiGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100188 notification_type_readable = "SEI";
Lawrence Tang794312c2022-07-05 14:46:10 +0100189 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypePeiGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100190 notification_type_readable = "PEI";
Lawrence Tang794312c2022-07-05 14:46:10 +0100191 else if (guid_equal(&header->NotificationType, &gEfiEventNotificationTypeCxlGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100192 notification_type_readable = "CXL Component";
193 json_object_object_add(notification_type, "type", json_object_new_string(notification_type_readable));
194 json_object_object_add(header_ir, "notificationType", notification_type);
195
196 //The record ID for this record, unique on a given system.
197 json_object_object_add(header_ir, "recordID", json_object_new_uint64(header->RecordID));
198
199 //Flag for the record, and a human readable form.
Lawrence Tang3c43f742022-07-05 11:37:17 +0100200 json_object* flags = integer_to_readable_pair(header->Flags,
201 sizeof(CPER_HEADER_FLAG_TYPES_KEYS) / sizeof(int),
202 CPER_HEADER_FLAG_TYPES_KEYS,
203 CPER_HEADER_FLAG_TYPES_VALUES,
204 "Unknown");
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100205 json_object_object_add(header_ir, "flags", flags);
206
207 //Persistence information. Outside the scope of specification, so just a uint32 here.
208 json_object_object_add(header_ir, "persistenceInformation", json_object_new_uint64(header->PersistenceInfo));
209 return header_ir;
210}
211
212//Converts the given EFI section descriptor into JSON IR format.
213json_object* cper_section_descriptor_to_ir(EFI_ERROR_SECTION_DESCRIPTOR* section_descriptor)
214{
215 json_object* section_descriptor_ir = json_object_new_object();
216
217 //The offset of the section from the base of the record header, length.
218 json_object_object_add(section_descriptor_ir, "sectionOffset", json_object_new_int(section_descriptor->SectionOffset));
219 json_object_object_add(section_descriptor_ir, "sectionLength", json_object_new_int(section_descriptor->SectionLength));
220
221 //Revision.
222 json_object_object_add(section_descriptor_ir, "revision", revision_to_ir(section_descriptor->Revision));
223
224 //Validation bits.
225 json_object* validation_bits = json_object_new_object();
226 json_object_object_add(validation_bits, "fruID", json_object_new_boolean(section_descriptor->SecValidMask & 0b1));
227 json_object_object_add(validation_bits, "fruString", json_object_new_boolean((section_descriptor->SecValidMask & 0b10) >> 1));
228 json_object_object_add(section_descriptor_ir, "validationBits", validation_bits);
229
230 //Flag bits.
Lawrence Tang2800cd82022-07-05 16:08:20 +0100231 json_object* flags = bitfield_to_ir(section_descriptor->SectionFlags, 8, CPER_SECTION_DESCRIPTOR_FLAGS_BITFIELD_NAMES);
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100232 json_object_object_add(section_descriptor_ir, "flags", flags);
233
234 //Section type (GUID).
235 json_object* section_type = json_object_new_object();
236 char section_type_string[GUID_STRING_LENGTH];
237 guid_to_string(section_type_string, &section_descriptor->SectionType);
238 json_object_object_add(section_type, "data", json_object_new_string(section_type_string));
239
240 //Readable section type, if possible.
241 char* section_type_readable = "Unknown";
242 if (guid_equal(&section_descriptor->SectionType, &gEfiProcessorGenericErrorSectionGuid))
243 section_type_readable = "Processor Generic";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100244 else if (guid_equal(&section_descriptor->SectionType, &gEfiIa32X64ProcessorErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100245 section_type_readable = "IA32/X64";
246 //todo: Why does IPF have an overly long GUID?
247 // if (guid_equal(&section_descriptor->SectionType, &gEfiIpfProcessorErrorSectionGuid))
248 // section_type_readable = "IPF";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100249 else if (guid_equal(&section_descriptor->SectionType, &gEfiArmProcessorErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100250 section_type_readable = "ARM";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100251 else if (guid_equal(&section_descriptor->SectionType, &gEfiPlatformMemoryErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100252 section_type_readable = "Platform Memory";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100253 else if (guid_equal(&section_descriptor->SectionType, &gEfiPcieErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100254 section_type_readable = "PCIe";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100255 else if (guid_equal(&section_descriptor->SectionType, &gEfiFirmwareErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100256 section_type_readable = "Firmware Error Record Reference";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100257 else if (guid_equal(&section_descriptor->SectionType, &gEfiPciBusErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100258 section_type_readable = "PCI/PCI-X Bus";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100259 else if (guid_equal(&section_descriptor->SectionType, &gEfiPciDevErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100260 section_type_readable = "PCI Component/Device";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100261 else if (guid_equal(&section_descriptor->SectionType, &gEfiDMArGenericErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100262 section_type_readable = "DMAr Generic";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100263 else if (guid_equal(&section_descriptor->SectionType, &gEfiDirectedIoDMArErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100264 section_type_readable = "Intel VT for Directed I/O specific DMAr section";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100265 else if (guid_equal(&section_descriptor->SectionType, &gEfiIommuDMArErrorSectionGuid))
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100266 section_type_readable = "IOMMU specific DMAr section";
Lawrence Tang864c0da2022-07-06 15:55:40 +0100267 else if (guid_equal(&section_descriptor->SectionType, &gEfiCcixPerLogErrorSectionGuid))
268 section_type_readable = "CCIX PER Log Error";
Lawrence Tangb98ec662022-07-06 16:50:21 +0100269 else if (guid_equal(&section_descriptor->SectionType, &gEfiCxlProtocolErrorSectionGuid))
270 section_type_readable = "CXL Protocol Error";
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100271
272 //todo: How do you determine if this is a CXL component event?
Lawrence Tangb98ec662022-07-06 16:50:21 +0100273 //perhaps refer to CXL Specification, Rev 2.0
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100274 // if (guid_equal(&section_descriptor->SectionType, &gEfiProcessorGenericErrorSectionGuid))
275 // section_type_readable = "CXL Component Event";
276
277 json_object_object_add(section_type, "type", json_object_new_string(section_type_readable));
278 json_object_object_add(section_descriptor_ir, "sectionType", section_type);
279
280 //If validation bits indicate it exists, add FRU ID.
281 if (section_descriptor->SecValidMask & 0b1)
282 {
283 char fru_id_string[GUID_STRING_LENGTH];
284 guid_to_string(fru_id_string, &section_descriptor->FruId);
285 json_object_object_add(section_descriptor_ir, "fruID", json_object_new_string(fru_id_string));
286 }
287
288 //If validation bits indicate it exists, add FRU text.
289 if ((section_descriptor->SecValidMask & 0b10) >> 1)
290 json_object_object_add(section_descriptor_ir, "fruText", json_object_new_string(section_descriptor->FruString));
291
292 //Section severity.
293 json_object* section_severity = json_object_new_object();
294 json_object_object_add(section_severity, "code", json_object_new_int(section_descriptor->Severity));
295 json_object_object_add(section_severity, "name", json_object_new_string(severity_to_string(section_descriptor->Severity)));
296 json_object_object_add(section_descriptor_ir, "severity", section_severity);
297
298 return section_descriptor_ir;
299}
300
301
302//Converts the section described by a single given section descriptor.
303json_object* cper_section_to_ir(FILE* handle, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
304{
305 //Read section as described by the section descriptor.
306 fseek(handle, descriptor->SectionOffset, SEEK_SET);
Lawrence Tang2800cd82022-07-05 16:08:20 +0100307 void* section = calloc(1, descriptor->SectionLength);
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100308 if (fread(section, descriptor->SectionLength, 1, handle) != 1)
309 {
310 printf("Section read failed: Could not read %d bytes from global offset %d.",
311 descriptor->SectionLength,
312 descriptor->SectionOffset);
313 }
314
Lawrence Tangdb1b7ce2022-07-06 15:40:26 +0100315 //Parse section to IR based on GUID.
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100316 json_object* result = NULL;
317 if (guid_equal(&descriptor->SectionType, &gEfiProcessorGenericErrorSectionGuid))
Lawrence Tang2800cd82022-07-05 16:08:20 +0100318 result = cper_section_generic_to_ir(section, descriptor);
319 else if (guid_equal(&descriptor->SectionType, &gEfiIa32X64ProcessorErrorSectionGuid))
320 result = cper_section_ia32x64_to_ir(section, descriptor);
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100321 // //todo: Why does IPF have an overly long GUID?
322 // // if (guid_equal(&descriptor->SectionType, &gEfiIpfProcessorErrorSectionGuid))
Lawrence Tang2800cd82022-07-05 16:08:20 +0100323 else if (guid_equal(&descriptor->SectionType, &gEfiArmProcessorErrorSectionGuid))
324 result = cper_section_arm_to_ir(section, descriptor);
Lawrence Tanga0865e32022-07-06 11:59:52 +0100325 else if (guid_equal(&descriptor->SectionType, &gEfiPlatformMemoryErrorSectionGuid))
326 result = cper_section_platform_memory_to_ir(section, descriptor);
Lawrence Tang54da4412022-07-06 13:14:58 +0100327 else if (guid_equal(&descriptor->SectionType, &gEfiPlatformMemoryError2SectionGuid))
328 result = cper_section_platform_memory2_to_ir(section, descriptor);
Lawrence Tang4dbe3d72022-07-06 13:51:01 +0100329 else if (guid_equal(&descriptor->SectionType, &gEfiPcieErrorSectionGuid))
330 result = cper_section_pcie_to_ir(section, descriptor);
Lawrence Tangc60a2432022-07-06 14:58:33 +0100331 else if (guid_equal(&descriptor->SectionType, &gEfiFirmwareErrorSectionGuid))
332 result = cper_section_firmware_to_ir(section, descriptor);
Lawrence Tang214a1542022-07-06 14:11:28 +0100333 else if (guid_equal(&descriptor->SectionType, &gEfiPciBusErrorSectionGuid))
334 result = cper_section_pci_bus_to_ir(section, descriptor);
Lawrence Tanga416ec92022-07-06 14:34:40 +0100335 else if (guid_equal(&descriptor->SectionType, &gEfiPciDevErrorSectionGuid))
336 result = cper_section_pci_dev_to_ir(section, descriptor);
Lawrence Tang4795d4a2022-07-06 15:19:31 +0100337 else if (guid_equal(&descriptor->SectionType, &gEfiDMArGenericErrorSectionGuid))
338 result = cper_section_dmar_generic_to_ir(section, descriptor);
Lawrence Tangdb1b7ce2022-07-06 15:40:26 +0100339 else if (guid_equal(&descriptor->SectionType, &gEfiDirectedIoDMArErrorSectionGuid))
340 result = cper_section_dmar_vtd_to_ir(section, descriptor);
341 else if (guid_equal(&descriptor->SectionType, &gEfiIommuDMArErrorSectionGuid))
342 result = cper_section_dmar_iommu_to_ir(section, descriptor);
Lawrence Tang864c0da2022-07-06 15:55:40 +0100343 else if (guid_equal(&descriptor->SectionType, &gEfiCcixPerLogErrorSectionGuid))
344 result = cper_section_ccix_per_to_ir(section, descriptor);
Lawrence Tangb98ec662022-07-06 16:50:21 +0100345 else if (guid_equal(&descriptor->SectionType, &gEfiCxlProtocolErrorSectionGuid))
346 result = cper_section_cxl_protocol_to_ir(section, descriptor);
Lawrence Tangdb1b7ce2022-07-06 15:40:26 +0100347 else
348 {
349 //Failed read, unknown GUID.
350 //todo: dump the binary data out to b64.
351 }
Lawrence Tang1b0b00e2022-07-05 10:33:10 +0100352
353 //Free section memory, return result.
354 free(section);
355 return result;
356}