Angel Pons | 8a3453f | 2020-04-02 23:48:19 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 2 | |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 3 | #include <northbridge/amd/agesa/state_machine.h> |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 4 | #include <northbridge/amd/agesa/agesa_helper.h> |
| 5 | |
Elyes HAOUAS | 19f5ba8 | 2018-10-14 14:52:06 +0200 | [diff] [blame] | 6 | #include <AGESA.h> |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 7 | |
| 8 | /* Fields were removed from the structure and we cannot add them back |
| 9 | * without new builds of the binaryPI blobs. |
| 10 | */ |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 11 | #if !CONFIG(CPU_AMD_AGESA_BINARY_PI) || \ |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 12 | CONFIG(NORTHBRIDGE_AMD_PI_00730F01) |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 13 | |
Elyes HAOUAS | 0d8f1da | 2018-05-28 15:48:04 +0200 | [diff] [blame] | 14 | #define HAS_ACPI_SRAT TRUE |
| 15 | #define HAS_ACPI_SLIT TRUE |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 16 | #else |
Elyes HAOUAS | 0d8f1da | 2018-05-28 15:48:04 +0200 | [diff] [blame] | 17 | #define HAS_ACPI_SRAT FALSE |
| 18 | #define HAS_ACPI_SLIT FALSE |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 19 | #endif |
| 20 | |
| 21 | /* We will reference AmdLateParams later to copy ACPI tables. */ |
| 22 | static AMD_LATE_PARAMS *AmdLateParams; |
| 23 | |
| 24 | void agesawrapper_setlateinitptr(void *Late) |
| 25 | { |
| 26 | AmdLateParams = Late; |
| 27 | } |
| 28 | |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 29 | void completion_InitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late) |
| 30 | { |
| 31 | AmdLateParams = Late; |
| 32 | } |
| 33 | |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 34 | void *agesawrapper_getlateinitptr(int pick) |
| 35 | { |
| 36 | ASSERT(AmdLateParams != NULL); |
| 37 | |
| 38 | switch (pick) { |
| 39 | case PICK_DMI: |
| 40 | return AmdLateParams->DmiTable; |
| 41 | case PICK_PSTATE: |
| 42 | return AmdLateParams->AcpiPState; |
| 43 | #if HAS_ACPI_SRAT |
| 44 | case PICK_SRAT: |
| 45 | return AmdLateParams->AcpiSrat; |
| 46 | #endif |
| 47 | #if HAS_ACPI_SLIT |
| 48 | case PICK_SLIT: |
| 49 | return AmdLateParams->AcpiSlit; |
| 50 | #endif |
| 51 | case PICK_WHEA_MCE: |
| 52 | return AmdLateParams->AcpiWheaMce; |
| 53 | case PICK_WHEA_CMC: |
| 54 | return AmdLateParams->AcpiWheaCmc; |
| 55 | case PICK_ALIB: |
| 56 | return AmdLateParams->AcpiAlib; |
| 57 | case PICK_IVRS: |
| 58 | return AmdLateParams->AcpiIvrs; |
| 59 | case PICK_CRAT: |
| 60 | return AmdLateParams->AcpiCrat; |
| 61 | case PICK_CDIT: |
| 62 | return AmdLateParams->AcpiCdit; |
| 63 | default: |
| 64 | return NULL; |
| 65 | } |
| 66 | return NULL; |
| 67 | } |