summaryrefslogtreecommitdiff
path: root/src/vendorcode/amd/pi
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-12-08 15:38:59 -0700
committerMartin Roth <martinroth@google.com>2017-12-11 01:07:31 +0000
commita78319ba26c01c3bd5a3573c448ea39394d81eaf (patch)
treef79159a266185a52c8c20b68a7e1b093f3af0483 /src/vendorcode/amd/pi
parentaf32770755211aadcc4e9f578bae38592b61f1cd (diff)
vc/amd/pi/00670F00/binaryPI: cache the AGESA dispatcher
Instead of repeatedly walking cbfs for the AGESA blob and parsing it cache the resulting dispatcher value. There's only one dispatcher table so use it. The resulting change is that this work is done one time per stage. BUG=b:70401101 TEST=Booted and noted only one lookup per stage. Change-Id: Iaa4aecc384108d66d7c68fc5fb9ac1c3f40da905 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/22789 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'src/vendorcode/amd/pi')
-rw-r--r--src/vendorcode/amd/pi/00670F00/binaryPI/AGESA.c114
1 files changed, 38 insertions, 76 deletions
diff --git a/src/vendorcode/amd/pi/00670F00/binaryPI/AGESA.c b/src/vendorcode/amd/pi/00670F00/binaryPI/AGESA.c
index ec414b4724..cc93424870 100644
--- a/src/vendorcode/amd/pi/00670F00/binaryPI/AGESA.c
+++ b/src/vendorcode/amd/pi/00670F00/binaryPI/AGESA.c
@@ -63,11 +63,9 @@ AmdCreateStruct (
IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
InterfaceParams->StdHeader.Func = AMD_CREATE_STRUCT;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(InterfaceParams);
}
@@ -79,11 +77,9 @@ AmdReleaseStruct (
IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
InterfaceParams->StdHeader.Func = AMD_RELEASE_STRUCT;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(InterfaceParams);
}
@@ -95,11 +91,9 @@ AmdInitReset (
IN OUT AMD_RESET_PARAMS *ResetParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
ResetParams->StdHeader.Func = AMD_INIT_RESET;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(ResetParams);
}
@@ -111,11 +105,9 @@ AmdInitEarly (
IN OUT AMD_EARLY_PARAMS *EarlyParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
EarlyParams->StdHeader.Func = AMD_INIT_EARLY;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(EarlyParams);
}
@@ -127,11 +119,9 @@ AmdInitPost (
IN OUT AMD_POST_PARAMS *PostParams ///< Amd Cpu init param
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
PostParams->StdHeader.Func = AMD_INIT_POST;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(PostParams);
}
@@ -143,11 +133,9 @@ AmdInitEnv (
IN OUT AMD_ENV_PARAMS *EnvParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
EnvParams->StdHeader.Func = AMD_INIT_ENV;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(EnvParams);
}
@@ -159,11 +147,9 @@ AmdInitMid (
IN OUT AMD_MID_PARAMS *MidParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
MidParams->StdHeader.Func = AMD_INIT_MID;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(MidParams);
}
@@ -175,11 +161,9 @@ AmdInitLate (
IN OUT AMD_LATE_PARAMS *LateParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
LateParams->StdHeader.Func = AMD_INIT_LATE;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(LateParams);
}
@@ -191,11 +175,9 @@ AmdInitRecovery (
IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
RecoveryParams->StdHeader.Func = AMD_INIT_RECOVERY;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(RecoveryParams);
}
@@ -207,11 +189,9 @@ AmdInitResume (
IN AMD_RESUME_PARAMS *ResumeParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
ResumeParams->StdHeader.Func = AMD_INIT_RESUME;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(ResumeParams);
}
@@ -223,11 +203,9 @@ AmdS3LateRestore (
IN OUT AMD_S3LATE_PARAMS *S3LateParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
S3LateParams->StdHeader.Func = AMD_S3LATE_RESTORE;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(S3LateParams);
}
@@ -239,11 +217,9 @@ AmdInitRtb (
IN OUT AMD_RTB_PARAMS *AmdInitRtbParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
AmdInitRtbParams->StdHeader.Func = AMD_INIT_RTB;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(AmdInitRtbParams);
}
@@ -255,11 +231,9 @@ AmdLateRunApTask (
IN AP_EXE_PARAMS *AmdApExeParams
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
AmdApExeParams->StdHeader.Func = AMD_LATE_RUN_AP_TASK;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(AmdApExeParams);
}
@@ -271,11 +245,9 @@ AmdGetApicId (
IN OUT AMD_APIC_PARAMS *AmdParamApic
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
AmdParamApic->StdHeader.Func = AMD_GET_APIC_ID;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(AmdParamApic);
}
@@ -287,11 +259,9 @@ AmdGetPciAddress (
IN OUT AMD_GET_PCI_PARAMS *AmdParamGetPci
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
AmdParamGetPci->StdHeader.Func = AMD_GET_PCI_ADDRESS;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(AmdParamGetPci);
}
@@ -303,11 +273,9 @@ AmdIdentifyCore (
IN OUT AMD_IDENTIFY_PARAMS *AmdParamIdentify
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
AmdParamIdentify->StdHeader.Func = AMD_IDENTIFY_CORE;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(AmdParamIdentify);
}
@@ -319,11 +287,9 @@ AmdReadEventLog (
IN EVENT_PARAMS *Event
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
Event->StdHeader.Func = AMD_READ_EVENT_LOG;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(Event);
}
@@ -335,11 +301,9 @@ AmdIdentifyDimm (
IN OUT AMD_IDENTIFY_DIMM *AmdDimmIdentify
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
AmdDimmIdentify->StdHeader.Func = AMD_IDENTIFY_DIMMS;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(AmdDimmIdentify);
}
@@ -360,10 +324,8 @@ AmdGet2DDataEye (
IN OUT AMD_GET_DATAEYE *AmdGetDataEye
)
{
- MODULE_ENTRY Dispatcher = NULL;
- const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
+ MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
AmdGetDataEye->StdHeader.Func = AMD_GET_2D_DATA_EYE;
- if (!module) return AGESA_UNSUPPORTED;
- Dispatcher = module->ModuleDispatcher;
+ if (!Dispatcher) return AGESA_UNSUPPORTED;
return Dispatcher(AmdGetDataEye);
}