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>
This commit is contained in:
parent
d1d4f937ec
commit
e20d6095ae
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the coreboot project.
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -26,45 +26,75 @@
|
||||||
|
|
||||||
static const char undefined[] = "undefined";
|
static const char undefined[] = "undefined";
|
||||||
|
|
||||||
/* Match order of enum AGESA_STRUCT_NAME. */
|
struct agesa_mapping
|
||||||
static const char *AgesaFunctionNameStr[] = {
|
{
|
||||||
"AmdInitRecovery", "AmdCreateStruct", "AmdInitEarly", "AmdInitEnv", "AmdInitLate",
|
AGESA_STRUCT_NAME func;
|
||||||
"AmdInitMid", "AmdInitPost", "AmdInitReset", "AmdInitResume", "AmdReleaseStruct",
|
const char *name;
|
||||||
"AmdS3LateRestore", "AmdS3Save", "AmdGetApicId", "AmdGetPciAddress", "AmdIdentifyCore",
|
|
||||||
"AmdReadEventLog", "AmdGetAvailableExeCacheSize", "AmdLateRunApTask", "AmdIdentifyDimm",
|
|
||||||
"Amd2dDataEye", "AmdS3FinalRestore", "AmdInitRtb"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This function has to match with enumeration of AGESA_STRUCT_NAME defined
|
static const struct agesa_mapping entrypoint[] = {
|
||||||
* inside AMD.h header file. Unfortunately those are different across
|
{
|
||||||
* different vendorcode subtrees.
|
.func = AMD_INIT_RESET,
|
||||||
*
|
.name = "AmdInitReset",
|
||||||
* TBD: Fix said header or move this function together with the strings above
|
},
|
||||||
* under vendorcode/ tree.
|
{
|
||||||
*/
|
.func = AMD_INIT_EARLY,
|
||||||
|
.name = "AmdInitEarly",
|
||||||
static const char *agesa_struct_name(AGESA_STRUCT_NAME state)
|
},
|
||||||
{
|
{
|
||||||
#if CONFIG(CPU_AMD_AGESA_OPENSOURCE)
|
.func = AMD_INIT_POST,
|
||||||
if ((state < AMD_INIT_RECOVERY) || (state > AMD_IDENTIFY_DIMMS))
|
.name = "AmdInitPost",
|
||||||
return undefined;
|
},
|
||||||
|
{
|
||||||
int index = state - AMD_INIT_RECOVERY;
|
.func = AMD_INIT_RESUME,
|
||||||
#else
|
.name = "AmdInitResume",
|
||||||
state >>= 12;
|
},
|
||||||
if ((state < AMD_INIT_RECOVERY >> 12) || (state > AMD_IDENTIFY_DIMMS >> 12))
|
{
|
||||||
return undefined;
|
.func = AMD_INIT_ENV,
|
||||||
|
.name = "AmdInitEnv",
|
||||||
int index = state - (AMD_INIT_RECOVERY >> 12);
|
},
|
||||||
|
{
|
||||||
|
.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
|
#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)
|
void agesa_state_on_entry(struct agesa_state *task, AGESA_STRUCT_NAME func)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
task->apic_id = (u8) (cpuid_ebx(1) >> 24);
|
task->apic_id = (u8) (cpuid_ebx(1) >> 24);
|
||||||
task->func = func;
|
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",
|
printk(BIOS_DEBUG, "\nAPIC %02d: ** Enter %s [%08x]\n",
|
||||||
task->apic_id, task->function_name, task->func);
|
task->apic_id, task->function_name, task->func);
|
||||||
|
|
Loading…
Reference in New Issue