blob: 391345d4fed8b681e01216620710ce0546fd0acc [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
Kyösti Mälkki28c4d2f2016-11-25 11:21:02 +020017#include <northbridge/amd/agesa/state_machine.h>
Kyösti Mälkki0e01c482017-07-27 06:15:02 +030018#include <northbridge/amd/agesa/agesa_helper.h>
19
Elyes HAOUAS19f5ba82018-10-14 14:52:06 +020020#include <AGESA.h>
Kyösti Mälkki0e01c482017-07-27 06:15:02 +030021
22/* Fields were removed from the structure and we cannot add them back
23 * without new builds of the binaryPI blobs.
24 */
25#if !IS_ENABLED(CONFIG_CPU_AMD_AGESA_BINARY_PI) || \
26 IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00630F01) || \
27 IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00730F01)
28
Elyes HAOUAS0d8f1da2018-05-28 15:48:04 +020029#define HAS_ACPI_SRAT TRUE
30#define HAS_ACPI_SLIT TRUE
Kyösti Mälkki0e01c482017-07-27 06:15:02 +030031#else
Elyes HAOUAS0d8f1da2018-05-28 15:48:04 +020032#define HAS_ACPI_SRAT FALSE
33#define HAS_ACPI_SLIT FALSE
Kyösti Mälkki0e01c482017-07-27 06:15:02 +030034#endif
35
36/* We will reference AmdLateParams later to copy ACPI tables. */
37static AMD_LATE_PARAMS *AmdLateParams;
38
39void agesawrapper_setlateinitptr(void *Late)
40{
41 AmdLateParams = Late;
42}
43
Kyösti Mälkki28c4d2f2016-11-25 11:21:02 +020044void completion_InitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late)
45{
46 AmdLateParams = Late;
47}
48
Kyösti Mälkki0e01c482017-07-27 06:15:02 +030049void *agesawrapper_getlateinitptr(int pick)
50{
51 ASSERT(AmdLateParams != NULL);
52
53 switch (pick) {
54 case PICK_DMI:
55 return AmdLateParams->DmiTable;
56 case PICK_PSTATE:
57 return AmdLateParams->AcpiPState;
58#if HAS_ACPI_SRAT
59 case PICK_SRAT:
60 return AmdLateParams->AcpiSrat;
61#endif
62#if HAS_ACPI_SLIT
63 case PICK_SLIT:
64 return AmdLateParams->AcpiSlit;
65#endif
66 case PICK_WHEA_MCE:
67 return AmdLateParams->AcpiWheaMce;
68 case PICK_WHEA_CMC:
69 return AmdLateParams->AcpiWheaCmc;
70 case PICK_ALIB:
71 return AmdLateParams->AcpiAlib;
72 case PICK_IVRS:
73 return AmdLateParams->AcpiIvrs;
74 case PICK_CRAT:
75 return AmdLateParams->AcpiCrat;
76 case PICK_CDIT:
77 return AmdLateParams->AcpiCdit;
78 default:
79 return NULL;
80 }
81 return NULL;
82}