Lines Matching +full:- +full:encoded
2 * Describes functions for converting VT-d specific DMAr CPER sections from binary and JSON format
12 #include <libcper/cper-utils.h>
13 #include <libcper/sections/cper-section-dmar-vtd.h>
16 //Converts a single VT-d specific DMAr CPER section into JSON IR.
27 //Version, revision and OEM ID, as defined in the VT-d architecture. in cper_section_dmar_vtd_to_ir()
30 oem_id |= (UINT64)vtd_error->OemId[i] << (i * 8); in cper_section_dmar_vtd_to_ir()
33 json_object_new_int(vtd_error->Version)); in cper_section_dmar_vtd_to_ir()
35 json_object_new_int(vtd_error->Revision)); in cper_section_dmar_vtd_to_ir()
41 json_object_new_uint64(vtd_error->Capability)); in cper_section_dmar_vtd_to_ir()
43 json_object_new_uint64(vtd_error->CapabilityEx)); in cper_section_dmar_vtd_to_ir()
46 json_object_new_uint64(vtd_error->GlobalCommand)); in cper_section_dmar_vtd_to_ir()
48 json_object_new_uint64(vtd_error->GlobalStatus)); in cper_section_dmar_vtd_to_ir()
50 json_object_new_uint64(vtd_error->FaultStatus)); in cper_section_dmar_vtd_to_ir()
55 (EFI_VTD_FAULT_RECORD *)vtd_error->FaultRecord; in cper_section_dmar_vtd_to_ir()
58 json_object_new_uint64(fault_record->FaultInformation)); in cper_section_dmar_vtd_to_ir()
61 json_object_new_uint64(fault_record->SourceIdentifier)); in cper_section_dmar_vtd_to_ir()
64 json_object_new_boolean(fault_record->PrivelegeModeRequested)); in cper_section_dmar_vtd_to_ir()
68 fault_record->ExecutePermissionRequested)); in cper_section_dmar_vtd_to_ir()
71 json_object_new_boolean(fault_record->PasidPresent)); in cper_section_dmar_vtd_to_ir()
74 json_object_new_uint64(fault_record->FaultReason)); in cper_section_dmar_vtd_to_ir()
77 json_object_new_uint64(fault_record->PasidValue)); in cper_section_dmar_vtd_to_ir()
80 json_object_new_uint64(fault_record->AddressType)); in cper_section_dmar_vtd_to_ir()
84 fault_record->Type, 2, VTD_FAULT_RECORD_TYPES_KEYS, in cper_section_dmar_vtd_to_ir()
92 char *encoded = in cper_section_dmar_vtd_to_ir() local
93 base64_encode((UINT8 *)vtd_error->RootEntry, 16, &encoded_len); in cper_section_dmar_vtd_to_ir()
95 json_object_new_string_len(encoded, in cper_section_dmar_vtd_to_ir()
97 free(encoded); in cper_section_dmar_vtd_to_ir()
101 encoded = base64_encode((UINT8 *)vtd_error->ContextEntry, 16, in cper_section_dmar_vtd_to_ir()
103 if (encoded == NULL) { in cper_section_dmar_vtd_to_ir()
107 json_object_new_string_len(encoded, in cper_section_dmar_vtd_to_ir()
109 free(encoded); in cper_section_dmar_vtd_to_ir()
114 json_object_new_uint64(vtd_error->PteL6)); in cper_section_dmar_vtd_to_ir()
116 json_object_new_uint64(vtd_error->PteL5)); in cper_section_dmar_vtd_to_ir()
118 json_object_new_uint64(vtd_error->PteL4)); in cper_section_dmar_vtd_to_ir()
120 json_object_new_uint64(vtd_error->PteL3)); in cper_section_dmar_vtd_to_ir()
122 json_object_new_uint64(vtd_error->PteL2)); in cper_section_dmar_vtd_to_ir()
124 json_object_new_uint64(vtd_error->PteL1)); in cper_section_dmar_vtd_to_ir()
129 //Converts a single VT-d DMAR CPER-JSON segment into CPER binary, outputting to the given stream.
140 section_cper->OemId[i] = (oem_id >> (i * 8)) & 0xFF; in ir_section_dmar_vtd_to_cper()
144 section_cper->Version = (UINT8)json_object_get_int( in ir_section_dmar_vtd_to_cper()
146 section_cper->Revision = (UINT8)json_object_get_int( in ir_section_dmar_vtd_to_cper()
148 section_cper->Capability = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
150 section_cper->CapabilityEx = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
152 section_cper->GlobalCommand = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
154 section_cper->GlobalStatus = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
156 section_cper->FaultStatus = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
163 (EFI_VTD_FAULT_RECORD *)section_cper->FaultRecord; in ir_section_dmar_vtd_to_cper()
164 fault_record_cper->FaultInformation = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
166 fault_record_cper->SourceIdentifier = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
168 fault_record_cper->PrivelegeModeRequested = json_object_get_boolean( in ir_section_dmar_vtd_to_cper()
170 fault_record_cper->ExecutePermissionRequested = json_object_get_boolean( in ir_section_dmar_vtd_to_cper()
173 fault_record_cper->PasidPresent = json_object_get_boolean( in ir_section_dmar_vtd_to_cper()
175 fault_record_cper->FaultReason = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
177 fault_record_cper->PasidValue = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
179 fault_record_cper->AddressType = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
181 fault_record_cper->Type = readable_pair_to_integer( in ir_section_dmar_vtd_to_cper()
185 json_object *encoded = json_object_object_get(section, "rootEntry"); in ir_section_dmar_vtd_to_cper() local
188 UINT8 *decoded = base64_decode(json_object_get_string(encoded), in ir_section_dmar_vtd_to_cper()
189 json_object_get_string_len(encoded), in ir_section_dmar_vtd_to_cper()
194 memcpy(section_cper->RootEntry, decoded, decoded_len); in ir_section_dmar_vtd_to_cper()
199 encoded = json_object_object_get(section, "contextEntry"); in ir_section_dmar_vtd_to_cper()
202 decoded = base64_decode(json_object_get_string(encoded), in ir_section_dmar_vtd_to_cper()
203 json_object_get_string_len(encoded), in ir_section_dmar_vtd_to_cper()
209 memcpy(section_cper->ContextEntry, decoded, decoded_len); in ir_section_dmar_vtd_to_cper()
214 section_cper->PteL1 = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
216 section_cper->PteL2 = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
218 section_cper->PteL3 = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
220 section_cper->PteL4 = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
222 section_cper->PteL5 = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()
224 section_cper->PteL6 = json_object_get_uint64( in ir_section_dmar_vtd_to_cper()