Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 1 | /* |
| 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älkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame^] | 17 | #include <northbridge/amd/agesa/state_machine.h> |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 18 | #include <northbridge/amd/agesa/agesa_helper.h> |
| 19 | |
| 20 | #include "AGESA.h" |
| 21 | |
| 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 | |
| 29 | #define HAS_ACPI_SRAT TRUE |
| 30 | #define HAS_ACPI_SLIT TRUE |
| 31 | #else |
| 32 | #define HAS_ACPI_SRAT FALSE |
| 33 | #define HAS_ACPI_SLIT FALSE |
| 34 | #endif |
| 35 | |
| 36 | /* We will reference AmdLateParams later to copy ACPI tables. */ |
| 37 | static AMD_LATE_PARAMS *AmdLateParams; |
| 38 | |
| 39 | void agesawrapper_setlateinitptr(void *Late) |
| 40 | { |
| 41 | AmdLateParams = Late; |
| 42 | } |
| 43 | |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame^] | 44 | void completion_InitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late) |
| 45 | { |
| 46 | AmdLateParams = Late; |
| 47 | } |
| 48 | |
Kyösti Mälkki | 0e01c48 | 2017-07-27 06:15:02 +0300 | [diff] [blame] | 49 | void *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 | } |