1 /**
2  * Functions for generating pseudo-random CPER AMPERE error sections.
3  *
4  **/
5 
6 #include <stdlib.h>
7 #include <string.h>
8 #include <stdio.h>
9 #include "../../edk/BaseTypes.h"
10 #include "../gen-utils.h"
11 #include "gen-section.h"
12 
13 //Generates a single pseudo-random Ampere error section, saving the resulting address to the given
14 //location. Returns the size of the newly created section.
generate_section_ampere(void ** location)15 size_t generate_section_ampere(void **location)
16 {
17 	//Create random bytes.
18 	size_t size = sizeof(EFI_AMPERE_ERROR_DATA);
19 	UINT8 *section = generate_random_bytes(size);
20 
21 	//Reserved byte.
22 	EFI_AMPERE_ERROR_DATA *ampere_error = (EFI_AMPERE_ERROR_DATA *)section;
23 	ampere_error->TypeId = 10;
24 	ampere_error->SubtypeId = 1;
25 	ampere_error->InstanceId = 0;
26 
27 	//Set return values, exit.
28 	*location = section;
29 	return size;
30 }
31