blob: 7edf43b1263f3191126d438a83fe68ecc3d9e893 [file] [log] [blame]
Kyösti Mälkki0e01c482017-07-27 06:15:02 +03001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011-2012 Advanced Micro Devices, Inc.
5 * Copyright (C) 2016 Kyösti Mälkki
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <northbridge/amd/agesa/agesa_helper.h>
18
19#include "AGESA.h"
20
21/* Fields were removed from the structure and we cannot add them back
22 * without new builds of the binaryPI blobs.
23 */
24#if !IS_ENABLED(CONFIG_CPU_AMD_AGESA_BINARY_PI) || \
25 IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00630F01) || \
26 IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00730F01)
27
28#define HAS_ACPI_SRAT TRUE
29#define HAS_ACPI_SLIT TRUE
30#else
31#define HAS_ACPI_SRAT FALSE
32#define HAS_ACPI_SLIT FALSE
33#endif
34
35/* We will reference AmdLateParams later to copy ACPI tables. */
36static AMD_LATE_PARAMS *AmdLateParams;
37
38void agesawrapper_setlateinitptr(void *Late)
39{
40 AmdLateParams = Late;
41}
42
43void *agesawrapper_getlateinitptr(int pick)
44{
45 ASSERT(AmdLateParams != NULL);
46
47 switch (pick) {
48 case PICK_DMI:
49 return AmdLateParams->DmiTable;
50 case PICK_PSTATE:
51 return AmdLateParams->AcpiPState;
52#if HAS_ACPI_SRAT
53 case PICK_SRAT:
54 return AmdLateParams->AcpiSrat;
55#endif
56#if HAS_ACPI_SLIT
57 case PICK_SLIT:
58 return AmdLateParams->AcpiSlit;
59#endif
60 case PICK_WHEA_MCE:
61 return AmdLateParams->AcpiWheaMce;
62 case PICK_WHEA_CMC:
63 return AmdLateParams->AcpiWheaCmc;
64 case PICK_ALIB:
65 return AmdLateParams->AcpiAlib;
66 case PICK_IVRS:
67 return AmdLateParams->AcpiIvrs;
68 case PICK_CRAT:
69 return AmdLateParams->AcpiCrat;
70 case PICK_CDIT:
71 return AmdLateParams->AcpiCdit;
72 default:
73 return NULL;
74 }
75 return NULL;
76}