Add all DMAR, CCIX, PCI, firmware conversions.
diff --git a/sections/cper-section-firmware.c b/sections/cper-section-firmware.c
index 03ce456..02795dd 100644
--- a/sections/cper-section-firmware.c
+++ b/sections/cper-section-firmware.c
@@ -33,4 +33,23 @@
json_object_object_add(section_ir, "recordIDGUID", json_object_new_string(record_id_guid));
return section_ir;
+}
+
+//Converts a single firmware CPER-JSON section into CPER binary, outputting to the given stream.
+void ir_section_firmware_to_cper(json_object* section, FILE* out)
+{
+ EFI_FIRMWARE_ERROR_DATA* section_cper =
+ (EFI_FIRMWARE_ERROR_DATA*)calloc(1, sizeof(EFI_FIRMWARE_ERROR_DATA));
+
+ //Record fields.
+ section_cper->ErrorType = readable_pair_to_integer(json_object_object_get(section, "errorRecordType"));
+ section_cper->Revision = json_object_get_int(json_object_object_get(section, "revision"));
+ section_cper->RecordId = json_object_get_uint64(json_object_object_get(section, "revision"));
+ string_to_guid(§ion_cper->RecordIdGuid,
+ json_object_get_string(json_object_object_get(section, "recordIDGUID")));
+
+ //Write to stream, free resources.
+ fwrite(§ion_cper, sizeof(section_cper), 1, out);
+ fflush(out);
+ free(section_cper);
}
\ No newline at end of file