1 /** 2 * Describes functions for converting CCIX PER log CPER sections from binary and JSON format 3 * into an intermediate format. 4 * 5 * Author: Lawrence.Tang@arm.com 6 **/ 7 #include <stdio.h> 8 #include "json.h" 9 #include "../edk/Cper.h" 10 #include "../cper-utils.h" 11 #include "cper-section-ccix-per.h" 12 13 //Converts a single CCIX PER log CPER section into JSON IR. 14 json_object* cper_section_ccix_per_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor) 15 { 16 EFI_CCIX_PER_LOG_DATA* ccix_error = (EFI_CCIX_PER_LOG_DATA*)section; 17 json_object* section_ir = json_object_new_object(); 18 19 //Length (bytes) for the entire structure. 20 json_object_object_add(section_ir, "length", json_object_new_uint64(ccix_error->Length)); 21 22 //Validation bits. 23 json_object* validation = bitfield_to_ir(ccix_error->ValidBits, 3, CCIX_PER_ERROR_VALID_BITFIELD_NAMES); 24 json_object_object_add(section_ir, "validationBits", validation); 25 26 //CCIX source/port IDs. 27 json_object_object_add(section_ir, "ccixSourceID", json_object_new_int(ccix_error->CcixSourceId)); 28 json_object_object_add(section_ir, "ccixPortID", json_object_new_int(ccix_error->CcixPortId)); 29 30 //CCIX PER Log. 31 //todo: implement as described in Section 7.3.2 of CCIX Base Specification (Rev 1.0) 32 //the PER Log structure notes the number of DWORDs in the record. 33 34 return section_ir; 35 }