Add generic DMAR record support.
diff --git a/cper-parse.c b/cper-parse.c
index 6ad7d2d..c357c7d 100644
--- a/cper-parse.c
+++ b/cper-parse.c
@@ -18,6 +18,7 @@
 #include "sections/cper-section-pci-bus.h"
 #include "sections/cper-section-pci-dev.h"
 #include "sections/cper-section-firmware.h"
+#include "sections/cper-section-dmar-generic.h"
 
 //Private pre-definitions.
 json_object* cper_header_to_ir(EFI_COMMON_ERROR_RECORD_HEADER* header);
@@ -323,8 +324,8 @@
         result = cper_section_pci_bus_to_ir(section, descriptor);
     else if (guid_equal(&descriptor->SectionType, &gEfiPciDevErrorSectionGuid))
         result = cper_section_pci_dev_to_ir(section, descriptor);
-    // if (guid_equal(&descriptor->SectionType, &gEfiDMArGenericErrorSectionGuid))
-    //     result = cper_section_dmar_generic_to_ir(section);
+    else if (guid_equal(&descriptor->SectionType, &gEfiDMArGenericErrorSectionGuid))
+        result = cper_section_dmar_generic_to_ir(section, descriptor);
     // if (guid_equal(&descriptor->SectionType, &gEfiDirectedIoDMArErrorSectionGuid))
     //     result = cper_section_intel_io_dma_to_ir(section);
     // if (guid_equal(&descriptor->SectionType, &gEfiIommuDMArErrorSectionGuid))
diff --git a/sections/cper-section-dmar-generic.c b/sections/cper-section-dmar-generic.c
new file mode 100644
index 0000000..26934f8
--- /dev/null
+++ b/sections/cper-section-dmar-generic.c
@@ -0,0 +1,56 @@
+/**
+ * Describes functions for converting generic DMAr CPER sections from binary and JSON format
+ * into an intermediate format.
+ * 
+ * Author: Lawrence.Tang@arm.com
+ **/
+#include <stdio.h>
+#include "json.h"
+#include "../edk/Cper.h"
+#include "../cper-utils.h"
+#include "cper-section-dmar-generic.h"
+
+//Converts a single generic DMAr CPER section into JSON IR.
+json_object* cper_section_dmar_generic_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+{
+    EFI_DMAR_GENERIC_ERROR_DATA* firmware_error = (EFI_DMAR_GENERIC_ERROR_DATA*)section;
+    json_object* section_ir = json_object_new_object();
+
+    //Requester ID, segment.
+    json_object_object_add(section_ir, "requesterID", json_object_new_int(firmware_error->RequesterId));
+    json_object_object_add(section_ir, "segmentNumber", json_object_new_int(firmware_error->SegmentNumber));
+
+    //Fault reason.
+    json_object* fault_reason = integer_to_readable_pair_with_desc(firmware_error->FaultReason, 11,
+        DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_KEYS,
+        DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_VALUES,
+        DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_DESCRIPTIONS,
+        "Unknown (Reserved)");
+    json_object_object_add(section_ir, "faultReason", fault_reason);
+
+    //Access type.
+    json_object* access_type = integer_to_readable_pair(firmware_error->AccessType, 2,
+        DMAR_GENERIC_ERROR_ACCESS_TYPES_KEYS,
+        DMAR_GENERIC_ERROR_ACCESS_TYPES_VALUES,
+        "Unknown (Reserved)");
+    json_object_object_add(section_ir, "accessType", access_type);
+
+    //Address type.
+    json_object* address_type = integer_to_readable_pair(firmware_error->AddressType, 2,
+        DMAR_GENERIC_ERROR_ADDRESS_TYPES_KEYS,
+        DMAR_GENERIC_ERROR_ADDRESS_TYPES_VALUES,
+        "Unknown (Reserved)");
+    json_object_object_add(section_ir, "addressType", address_type);
+
+    //Architecture type.
+    json_object* arch_type = integer_to_readable_pair(firmware_error->ArchType, 2,
+        DMAR_GENERIC_ERROR_ARCH_TYPES_KEYS,
+        DMAR_GENERIC_ERROR_ARCH_TYPES_VALUES,
+        "Unknown (Reserved)");
+    json_object_object_add(section_ir, "architectureType", arch_type);
+
+    //Device address.
+    json_object_object_add(section_ir, "deviceAddress", json_object_new_uint64(firmware_error->DeviceAddr));
+    
+    return section_ir;
+}
\ No newline at end of file
diff --git a/sections/cper-section-dmar-generic.h b/sections/cper-section-dmar-generic.h
new file mode 100644
index 0000000..682818f
--- /dev/null
+++ b/sections/cper-section-dmar-generic.h
@@ -0,0 +1,31 @@
+#ifndef CPER_SECTION_DMAR_GENERIC_H
+#define CPER_SECTION_DMAR_GENERIC_H
+
+#include "json.h"
+#include "../edk/Cper.h"
+
+#define DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_KEYS (int []){0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB}
+#define DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_VALUES (const char*[]){"DMT Entry Missing", "DMT Entry Invalid", \
+    "DMT Access Error", "DMT Reserved Bit Invalid", "DMA Address Out of Bounds", "Invalid Read/Write", \
+    "Invalid Device Request", "ATT Access Error", "ATT Reserved Bit Invalid", "Illegal Command", "Command Buffer Access Error"}
+#define DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_DESCRIPTIONS (const char*[]){ \
+    "Domain mapping table entry is not present.", \
+    "DMAr unit's attempt to access the domain mapping table resulted in an error." \
+    "Reserved bit set to non-zero value in the domain mapping table.", \
+    "DMA request to access an address beyond the device address width.", \
+    "Invalid read or write access.", \
+    "Invalid device request.", \
+    "DMAr unit's attempt to access the address translation table resulted in an error.", \
+    "Reserved bit set to non-zero value in the address translation table.", \
+    "Illegal command error.", \
+    "DMAr unit's attempt to access the command buffer resulted in an error."}
+#define DMAR_GENERIC_ERROR_ACCESS_TYPES_KEYS (int []){0x0, 0x1}
+#define DMAR_GENERIC_ERROR_ACCESS_TYPES_VALUES (const char*[]){"DMA Write", "DMA Read"}
+#define DMAR_GENERIC_ERROR_ADDRESS_TYPES_KEYS (int []){0x0, 0x1}
+#define DMAR_GENERIC_ERROR_ADDRESS_TYPES_VALUES (const char*[]){"Untranslated Request", "Translation Request"}
+#define DMAR_GENERIC_ERROR_ARCH_TYPES_KEYS (int []){0x0, 0x1}
+#define DMAR_GENERIC_ERROR_ARCH_TYPES_VALUES (const char*[]){"VT-d", "IOMMU"}
+
+json_object* cper_section_dmar_generic_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor);
+
+#endif
\ No newline at end of file