Add support for AMPERE CPERs
Support Ampere CPER entries
Change-Id: I607a89209138fa53914c55c07aba8b7d6f382e5e
Signed-off-by: Dung Cao <dung@os.amperecomputing.com>
diff --git a/generator/sections/gen-section-ampere.c b/generator/sections/gen-section-ampere.c
new file mode 100644
index 0000000..85fa765
--- /dev/null
+++ b/generator/sections/gen-section-ampere.c
@@ -0,0 +1,30 @@
+/**
+ * Functions for generating pseudo-random CPER AMPERE error sections.
+ *
+ **/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "../../edk/BaseTypes.h"
+#include "../gen-utils.h"
+#include "gen-section.h"
+
+//Generates a single pseudo-random Ampere error section, saving the resulting address to the given
+//location. Returns the size of the newly created section.
+size_t generate_section_ampere(void **location)
+{
+ //Create random bytes.
+ size_t size = sizeof(EFI_AMPERE_ERROR_DATA);
+ UINT8 *section = generate_random_bytes(size);
+
+ //Reserved byte.
+ EFI_AMPERE_ERROR_DATA *ampere_error = (EFI_AMPERE_ERROR_DATA *)section;
+ ampere_error->TypeId = 10;
+ ampere_error->SubtypeId = 1;
+ ampere_error->InstanceId = 0;
+
+ //Set return values, exit.
+ *location = section;
+ return size;
+}