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 | */ |
Arthur Heymans | 81a4fef | 2022-11-01 23:33:45 +0100 | [diff] [blame] | 11 | #if CONFIG(NORTHBRIDGE_AMD_PI_00730F01) |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 12 | |
Elyes HAOUAS | 0d8f1da | 2018-05-28 15:48:04 +0200 | [diff] [blame] | 13 | #define HAS_ACPI_SRAT TRUE |
| 14 | #define HAS_ACPI_SLIT TRUE |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 15 | #else |
Elyes HAOUAS | 0d8f1da | 2018-05-28 15:48:04 +0200 | [diff] [blame] | 16 | #define HAS_ACPI_SRAT FALSE |
| 17 | #define HAS_ACPI_SLIT FALSE |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 18 | #endif |
| 19 | |
| 20 | /* We will reference AmdLateParams later to copy ACPI tables. */ |
| 21 | static AMD_LATE_PARAMS *AmdLateParams; |
| 22 | |
| 23 | void agesawrapper_setlateinitptr(void *Late) |
| 24 | { |
| 25 | AmdLateParams = Late; |
| 26 | } |
| 27 | |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 28 | void completion_InitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late) |
| 29 | { |
| 30 | AmdLateParams = Late; |
| 31 | } |
| 32 | |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 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 | } |