Lines Matching +full:- +full:encoded
11 #include <libcper/cper-utils.h>
12 #include <libcper/sections/cper-section-cxl-protocol.h>
23 bitfield_to_ir(cxl_protocol_error->ValidBits, 7, in cper_section_cxl_protocol_to_ir()
29 cxl_protocol_error->CxlAgentType, 2, in cper_section_cxl_protocol_to_ir()
36 if (cxl_protocol_error->CxlAgentType == in cper_section_cxl_protocol_to_ir()
42 cxl_protocol_error->CxlAgentAddress in cper_section_cxl_protocol_to_ir()
47 cxl_protocol_error->CxlAgentAddress in cper_section_cxl_protocol_to_ir()
52 cxl_protocol_error->CxlAgentAddress in cper_section_cxl_protocol_to_ir()
57 cxl_protocol_error->CxlAgentAddress in cper_section_cxl_protocol_to_ir()
59 } else if (cxl_protocol_error->CxlAgentType == in cper_section_cxl_protocol_to_ir()
65 cxl_protocol_error->CxlAgentAddress in cper_section_cxl_protocol_to_ir()
74 json_object_new_uint64(cxl_protocol_error->DeviceId.VendorId)); in cper_section_cxl_protocol_to_ir()
77 json_object_new_uint64(cxl_protocol_error->DeviceId.DeviceId)); in cper_section_cxl_protocol_to_ir()
81 cxl_protocol_error->DeviceId.SubsystemVendorId)); in cper_section_cxl_protocol_to_ir()
85 cxl_protocol_error->DeviceId.SubsystemDeviceId)); in cper_section_cxl_protocol_to_ir()
88 json_object_new_uint64(cxl_protocol_error->DeviceId.ClassCode)); in cper_section_cxl_protocol_to_ir()
92 cxl_protocol_error->DeviceId.SlotNumber)); in cper_section_cxl_protocol_to_ir()
95 char *encoded; in cper_section_cxl_protocol_to_ir() local
97 if (cxl_protocol_error->CxlAgentType == in cper_section_cxl_protocol_to_ir()
102 cxl_protocol_error->DeviceSerial)); in cper_section_cxl_protocol_to_ir()
105 //(36-byte, padded to 60 bytes) or PCIe 2.0 Capability Structure (60-byte). There does not seem in cper_section_cxl_protocol_to_ir()
110 encoded = base64_encode( in cper_section_cxl_protocol_to_ir()
111 (UINT8 *)cxl_protocol_error->CapabilityStructure.PcieCap, in cper_section_cxl_protocol_to_ir()
113 if (encoded == NULL) { in cper_section_cxl_protocol_to_ir()
118 json_object_new_string_len(encoded, in cper_section_cxl_protocol_to_ir()
120 free(encoded); in cper_section_cxl_protocol_to_ir()
126 json_object_new_int(cxl_protocol_error->CxlDvsecLength)); in cper_section_cxl_protocol_to_ir()
129 json_object_new_int(cxl_protocol_error->CxlErrorLogLength)); in cper_section_cxl_protocol_to_ir()
137 encoded = base64_encode((UINT8 *)cur_pos, in cper_section_cxl_protocol_to_ir()
138 cxl_protocol_error->CxlDvsecLength, in cper_section_cxl_protocol_to_ir()
140 if (encoded == NULL) { in cper_section_cxl_protocol_to_ir()
144 json_object_new_string_len(encoded, in cper_section_cxl_protocol_to_ir()
147 free(encoded); in cper_section_cxl_protocol_to_ir()
149 cur_pos += cxl_protocol_error->CxlDvsecLength; in cper_section_cxl_protocol_to_ir()
155 encoded = base64_encode((UINT8 *)cur_pos, in cper_section_cxl_protocol_to_ir()
156 cxl_protocol_error->CxlErrorLogLength, in cper_section_cxl_protocol_to_ir()
159 if (encoded == NULL) { in cper_section_cxl_protocol_to_ir()
164 json_object_new_string_len(encoded, in cper_section_cxl_protocol_to_ir()
166 free(encoded); in cper_section_cxl_protocol_to_ir()
171 //Converts a single CXL protocol CPER-JSON section into CPER binary, outputting to the given stream.
179 section_cper->ValidBits = ir_to_bitfield( in ir_section_cxl_protocol_to_cper()
184 section_cper->CxlAgentType = readable_pair_to_integer( in ir_section_cxl_protocol_to_cper()
190 if (section_cper->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT) { in ir_section_cxl_protocol_to_cper()
200 section_cper->CxlAgentAddress.DeviceAddress.FunctionNumber = in ir_section_cxl_protocol_to_cper()
202 section_cper->CxlAgentAddress.DeviceAddress.DeviceNumber = in ir_section_cxl_protocol_to_cper()
204 section_cper->CxlAgentAddress.DeviceAddress.BusNumber = bus; in ir_section_cxl_protocol_to_cper()
205 section_cper->CxlAgentAddress.DeviceAddress.SegmentNumber = in ir_section_cxl_protocol_to_cper()
207 } else if (section_cper->CxlAgentType == in ir_section_cxl_protocol_to_cper()
210 section_cper->CxlAgentAddress.PortRcrbBaseAddress = in ir_section_cxl_protocol_to_cper()
217 section_cper->DeviceId.VendorId = json_object_get_uint64( in ir_section_cxl_protocol_to_cper()
219 section_cper->DeviceId.DeviceId = json_object_get_uint64( in ir_section_cxl_protocol_to_cper()
221 section_cper->DeviceId.SubsystemVendorId = json_object_get_uint64( in ir_section_cxl_protocol_to_cper()
223 section_cper->DeviceId.SubsystemDeviceId = json_object_get_uint64( in ir_section_cxl_protocol_to_cper()
225 section_cper->DeviceId.ClassCode = json_object_get_uint64( in ir_section_cxl_protocol_to_cper()
227 section_cper->DeviceId.SlotNumber = json_object_get_uint64( in ir_section_cxl_protocol_to_cper()
232 if (section_cper->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT) { in ir_section_cxl_protocol_to_cper()
233 section_cper->DeviceSerial = json_object_get_uint64( in ir_section_cxl_protocol_to_cper()
236 json_object *encoded = in ir_section_cxl_protocol_to_cper() local
241 decoded = base64_decode(json_object_get_string(encoded), in ir_section_cxl_protocol_to_cper()
242 json_object_get_string_len(encoded), in ir_section_cxl_protocol_to_cper()
248 memcpy(section_cper->CapabilityStructure.PcieCap, in ir_section_cxl_protocol_to_cper()
255 section_cper->CxlDvsecLength = (UINT16)json_object_get_int( in ir_section_cxl_protocol_to_cper()
257 section_cper->CxlErrorLogLength = (UINT16)json_object_get_int( in ir_section_cxl_protocol_to_cper()
265 json_object *encoded = json_object_object_get(section, "cxlDVSEC"); in ir_section_cxl_protocol_to_cper() local
269 decoded = base64_decode(json_object_get_string(encoded), in ir_section_cxl_protocol_to_cper()
270 json_object_get_string_len(encoded), in ir_section_cxl_protocol_to_cper()
281 encoded = json_object_object_get(section, "cxlErrorLog"); in ir_section_cxl_protocol_to_cper()
284 decoded = base64_decode(json_object_get_string(encoded), in ir_section_cxl_protocol_to_cper()
285 json_object_get_string_len(encoded), in ir_section_cxl_protocol_to_cper()