summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2018-06-10 08:20:56 +0300
committerPatrick Georgi <pgeorgi@google.com>2019-05-25 08:38:35 +0000
commite20d6095aee0c73e758199dfa214366104fc9a85 (patch)
tree3d44ee291e6f27446572750e1ae6ba87711e03e7 /src/drivers
parentd1d4f937ec7ecf8032911fbce2ff899b14199384 (diff)
downloadcoreboot-e20d6095aee0c73e758199dfa214366104fc9a85.tar.xz
AGESA binaryPI: Redo entrypoints namelist
Stop assuming the list is complete with no gaps, and use a lookup-table to match AGESA_STRUCT_NAME types of the entrypoints we use with names. Change-Id: Ibef4690d8aa76ff5b47c879f5ceb9d8fc4c4c4cd Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/amd/agesa/eventlog.c94
1 files changed, 62 insertions, 32 deletions
diff --git a/src/drivers/amd/agesa/eventlog.c b/src/drivers/amd/agesa/eventlog.c
index 03cb64a8ce..152011ed34 100644
--- a/src/drivers/amd/agesa/eventlog.c
+++ b/src/drivers/amd/agesa/eventlog.c
@@ -1,7 +1,7 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2016 Kyösti Mälkki
+ * Copyright (C) 2016-2019 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
@@ -26,45 +26,75 @@
static const char undefined[] = "undefined";
-/* Match order of enum AGESA_STRUCT_NAME. */
-static const char *AgesaFunctionNameStr[] = {
- "AmdInitRecovery", "AmdCreateStruct", "AmdInitEarly", "AmdInitEnv", "AmdInitLate",
- "AmdInitMid", "AmdInitPost", "AmdInitReset", "AmdInitResume", "AmdReleaseStruct",
- "AmdS3LateRestore", "AmdS3Save", "AmdGetApicId", "AmdGetPciAddress", "AmdIdentifyCore",
- "AmdReadEventLog", "AmdGetAvailableExeCacheSize", "AmdLateRunApTask", "AmdIdentifyDimm",
- "Amd2dDataEye", "AmdS3FinalRestore", "AmdInitRtb"
-};
-
-/* This function has to match with enumeration of AGESA_STRUCT_NAME defined
- * inside AMD.h header file. Unfortunately those are different across
- * different vendorcode subtrees.
- *
- * TBD: Fix said header or move this function together with the strings above
- * under vendorcode/ tree.
- */
-
-static const char *agesa_struct_name(AGESA_STRUCT_NAME state)
+struct agesa_mapping
{
-#if CONFIG(CPU_AMD_AGESA_OPENSOURCE)
- if ((state < AMD_INIT_RECOVERY) || (state > AMD_IDENTIFY_DIMMS))
- return undefined;
-
- int index = state - AMD_INIT_RECOVERY;
-#else
- state >>= 12;
- if ((state < AMD_INIT_RECOVERY >> 12) || (state > AMD_IDENTIFY_DIMMS >> 12))
- return undefined;
+ AGESA_STRUCT_NAME func;
+ const char *name;
+};
- int index = state - (AMD_INIT_RECOVERY >> 12);
+static const struct agesa_mapping entrypoint[] = {
+ {
+ .func = AMD_INIT_RESET,
+ .name = "AmdInitReset",
+ },
+ {
+ .func = AMD_INIT_EARLY,
+ .name = "AmdInitEarly",
+ },
+ {
+ .func = AMD_INIT_POST,
+ .name = "AmdInitPost",
+ },
+ {
+ .func = AMD_INIT_RESUME,
+ .name = "AmdInitResume",
+ },
+ {
+ .func = AMD_INIT_ENV,
+ .name = "AmdInitEnv",
+ },
+ {
+ .func = AMD_INIT_MID,
+ .name = "AmdInitMid",
+ },
+ {
+ .func = AMD_INIT_LATE,
+ .name = "AmdInitLate",
+ },
+ {
+ .func = AMD_S3LATE_RESTORE,
+ .name = "AmdS3LateRestore",
+ },
+#if !defined(AMD_S3_SAVE_REMOVED)
+ {
+ .func = AMD_S3_SAVE,
+ .name = "AmdS3Save",
+ },
#endif
- return AgesaFunctionNameStr[index];
-}
+ {
+ .func = AMD_S3FINAL_RESTORE,
+ .name = "AmdS3FinalRestore",
+ },
+ {
+ .func = AMD_INIT_RTB,
+ .name = "AmdInitRtb",
+ },
+};
void agesa_state_on_entry(struct agesa_state *task, AGESA_STRUCT_NAME func)
{
+ int i;
+
task->apic_id = (u8) (cpuid_ebx(1) >> 24);
task->func = func;
- task->function_name = agesa_struct_name(func);
+ task->function_name = undefined;
+
+ for (i = 0; i < ARRAY_SIZE(entrypoint); i++) {
+ if (task->func == entrypoint[i].func) {
+ task->function_name = entrypoint[i].name;
+ break;
+ }
+ }
printk(BIOS_DEBUG, "\nAPIC %02d: ** Enter %s [%08x]\n",
task->apic_id, task->function_name, task->func);