xref: /aosp_15_r20/external/coreboot/src/drivers/amd/agesa/acpi_tables.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <northbridge/amd/agesa/state_machine.h>
4 #include <northbridge/amd/agesa/agesa_helper.h>
5 
6 #include <AGESA.h>
7 
8 /* Fields were removed from the structure and we cannot add them back
9  * without new builds of the binaryPI blobs.
10  */
11 #if CONFIG(NORTHBRIDGE_AMD_PI_00730F01)
12 
13 #define HAS_ACPI_SRAT	TRUE
14 #define HAS_ACPI_SLIT	TRUE
15 #else
16 #define HAS_ACPI_SRAT	FALSE
17 #define HAS_ACPI_SLIT	FALSE
18 #endif
19 
20 /* We will reference AmdLateParams later to copy ACPI tables. */
21 static AMD_LATE_PARAMS *AmdLateParams;
22 
agesawrapper_setlateinitptr(void * Late)23 void agesawrapper_setlateinitptr(void *Late)
24 {
25 	AmdLateParams = Late;
26 }
27 
completion_InitLate(struct sysinfo * cb,AMD_LATE_PARAMS * Late)28 void completion_InitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late)
29 {
30 	AmdLateParams = Late;
31 }
32 
agesawrapper_getlateinitptr(int pick)33 void *agesawrapper_getlateinitptr(int pick)
34 {
35 	ASSERT(AmdLateParams != NULL);
36 
37 	switch (pick) {
38 	case PICK_DMI:
39 		return AmdLateParams->DmiTable;
40 	case PICK_PSTATE:
41 		return AmdLateParams->AcpiPState;
42 #if HAS_ACPI_SRAT
43 	case PICK_SRAT:
44 		return AmdLateParams->AcpiSrat;
45 #endif
46 #if HAS_ACPI_SLIT
47 	case PICK_SLIT:
48 		return AmdLateParams->AcpiSlit;
49 #endif
50 	case PICK_WHEA_MCE:
51 		return AmdLateParams->AcpiWheaMce;
52 	case PICK_WHEA_CMC:
53 		return AmdLateParams->AcpiWheaCmc;
54 	case PICK_ALIB:
55 		return AmdLateParams->AcpiAlib;
56 	case PICK_IVRS:
57 		return AmdLateParams->AcpiIvrs;
58 	case PICK_CRAT:
59 		return AmdLateParams->AcpiCrat;
60 	case PICK_CDIT:
61 		return AmdLateParams->AcpiCdit;
62 	default:
63 		return NULL;
64 	}
65 	return NULL;
66 }
67