summaryrefslogtreecommitdiff
path: root/src/drivers/amd/agesa/acpi_tables.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2017-09-08 07:14:17 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2017-09-26 10:07:07 +0000
commitd4955f0ade18cafde4a3ea20885eb9fbdc5b4514 (patch)
tree71b6e96cc01fbb58d6bfdd50b6c55e431634724d /src/drivers/amd/agesa/acpi_tables.c
parent0f6c0b1a6f062be702fd0b10a6c591c42f982b63 (diff)
downloadcoreboot-d4955f0ade18cafde4a3ea20885eb9fbdc5b4514.tar.xz
AGESA: Move API interface under drivers/
New AGESA support files will be used for binaryPI platforms as well. Furthermore, some of those should move from split nb/ sb/ directories to soc/, so move support files for the API under drivers/. Change-Id: I549788091de91f61de8b9adc223d52ffb5732235 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/21455 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/amd/agesa/acpi_tables.c')
-rw-r--r--src/drivers/amd/agesa/acpi_tables.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/drivers/amd/agesa/acpi_tables.c b/src/drivers/amd/agesa/acpi_tables.c
new file mode 100644
index 0000000000..5335c02f5b
--- /dev/null
+++ b/src/drivers/amd/agesa/acpi_tables.c
@@ -0,0 +1,82 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011-2012 Advanced Micro Devices, Inc.
+ * Copyright (C) 2016 Kyösti Mälkki
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <northbridge/amd/agesa/state_machine.h>
+#include <northbridge/amd/agesa/agesa_helper.h>
+
+#include "AGESA.h"
+
+/* Fields were removed from the structure and we cannot add them back
+ * without new builds of the binaryPI blobs.
+ */
+#if !IS_ENABLED(CONFIG_CPU_AMD_AGESA_BINARY_PI) || \
+ IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00630F01) || \
+ IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00730F01)
+
+#define HAS_ACPI_SRAT TRUE
+#define HAS_ACPI_SLIT TRUE
+#else
+#define HAS_ACPI_SRAT FALSE
+#define HAS_ACPI_SLIT FALSE
+#endif
+
+/* We will reference AmdLateParams later to copy ACPI tables. */
+static AMD_LATE_PARAMS *AmdLateParams;
+
+void agesawrapper_setlateinitptr(void *Late)
+{
+ AmdLateParams = Late;
+}
+
+void completion_InitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late)
+{
+ AmdLateParams = Late;
+}
+
+void *agesawrapper_getlateinitptr(int pick)
+{
+ ASSERT(AmdLateParams != NULL);
+
+ switch (pick) {
+ case PICK_DMI:
+ return AmdLateParams->DmiTable;
+ case PICK_PSTATE:
+ return AmdLateParams->AcpiPState;
+#if HAS_ACPI_SRAT
+ case PICK_SRAT:
+ return AmdLateParams->AcpiSrat;
+#endif
+#if HAS_ACPI_SLIT
+ case PICK_SLIT:
+ return AmdLateParams->AcpiSlit;
+#endif
+ case PICK_WHEA_MCE:
+ return AmdLateParams->AcpiWheaMce;
+ case PICK_WHEA_CMC:
+ return AmdLateParams->AcpiWheaCmc;
+ case PICK_ALIB:
+ return AmdLateParams->AcpiAlib;
+ case PICK_IVRS:
+ return AmdLateParams->AcpiIvrs;
+ case PICK_CRAT:
+ return AmdLateParams->AcpiCrat;
+ case PICK_CDIT:
+ return AmdLateParams->AcpiCdit;
+ default:
+ return NULL;
+ }
+ return NULL;
+}