summaryrefslogtreecommitdiff
path: root/src/drivers/amd/agesa/acpi_tables.c
blob: 06c566e6e7343b06acf7e20b6c451aba748bc609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* SPDX-License-Identifier: GPL-2.0-only */

#include <northbridge/amd/agesa/state_machine.h>
#include <northbridge/amd/agesa/agesa_helper.h>

#include <AGESA.h>

/* Fields were removed from the structure and we cannot add them back
 * without new builds of the binaryPI blobs.
 */
#if !CONFIG(CPU_AMD_AGESA_BINARY_PI) || \
	CONFIG(NORTHBRIDGE_AMD_PI_00630F01) || \
	CONFIG(NORTHBRIDGE_AMD_PI_00730F01)

#define HAS_ACPI_SRAT	TRUE
#define HAS_ACPI_SLIT	TRUE
#else
#define HAS_ACPI_SRAT	FALSE
#define HAS_ACPI_SLIT	FALSE
#endif

/* We will reference AmdLateParams later to copy ACPI tables. */
static AMD_LATE_PARAMS *AmdLateParams;

void agesawrapper_setlateinitptr(void *Late)
{
	AmdLateParams = Late;
}

void completion_InitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late)
{
	AmdLateParams = Late;
}

void *agesawrapper_getlateinitptr(int pick)
{
	ASSERT(AmdLateParams != NULL);

	switch (pick) {
	case PICK_DMI:
		return AmdLateParams->DmiTable;
	case PICK_PSTATE:
		return AmdLateParams->AcpiPState;
#if HAS_ACPI_SRAT
	case PICK_SRAT:
		return AmdLateParams->AcpiSrat;
#endif
#if HAS_ACPI_SLIT
	case PICK_SLIT:
		return AmdLateParams->AcpiSlit;
#endif
	case PICK_WHEA_MCE:
		return AmdLateParams->AcpiWheaMce;
	case PICK_WHEA_CMC:
		return AmdLateParams->AcpiWheaCmc;
	case PICK_ALIB:
		return AmdLateParams->AcpiAlib;
	case PICK_IVRS:
		return AmdLateParams->AcpiIvrs;
	case PICK_CRAT:
		return AmdLateParams->AcpiCrat;
	case PICK_CDIT:
		return AmdLateParams->AcpiCdit;
	default:
		return NULL;
	}
	return NULL;
}