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>
This commit is contained in:
parent
af32770755
commit
a78319ba26
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "agesawrapper.h"
|
#include "agesawrapper.h"
|
||||||
|
#include <arch/early_variables.h>
|
||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
#include <delay.h>
|
#include <delay.h>
|
||||||
|
@ -378,3 +379,24 @@ const void *agesawrapper_locate_module (const CHAR8 name[8])
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MODULE_ENTRY agesa_dispatcher CAR_GLOBAL;
|
||||||
|
|
||||||
|
MODULE_ENTRY agesa_get_dispatcher(void)
|
||||||
|
{
|
||||||
|
const AMD_MODULE_HEADER *module;
|
||||||
|
static const CHAR8 id[8] = AGESA_ID;
|
||||||
|
MODULE_ENTRY val = car_get_var(agesa_dispatcher);
|
||||||
|
|
||||||
|
if (val != NULL)
|
||||||
|
return val;
|
||||||
|
|
||||||
|
module = agesawrapper_locate_module(id);
|
||||||
|
if (!module)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
val = module->ModuleDispatcher;
|
||||||
|
car_set_var(agesa_dispatcher, val);
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ enum {
|
||||||
PICK_CRAT,
|
PICK_CRAT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Return current dispatcher or NULL on error. */
|
||||||
|
MODULE_ENTRY agesa_get_dispatcher(void);
|
||||||
|
|
||||||
AGESA_STATUS agesawrapper_amdinitreset(void);
|
AGESA_STATUS agesawrapper_amdinitreset(void);
|
||||||
AGESA_STATUS agesawrapper_amdinitearly(void);
|
AGESA_STATUS agesawrapper_amdinitearly(void);
|
||||||
AGESA_STATUS agesawrapper_amdinitenv(void);
|
AGESA_STATUS agesawrapper_amdinitenv(void);
|
||||||
|
|
|
@ -63,11 +63,9 @@ AmdCreateStruct (
|
||||||
IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
|
IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
InterfaceParams->StdHeader.Func = AMD_CREATE_STRUCT;
|
InterfaceParams->StdHeader.Func = AMD_CREATE_STRUCT;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(InterfaceParams);
|
return Dispatcher(InterfaceParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +77,9 @@ AmdReleaseStruct (
|
||||||
IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
|
IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
InterfaceParams->StdHeader.Func = AMD_RELEASE_STRUCT;
|
InterfaceParams->StdHeader.Func = AMD_RELEASE_STRUCT;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(InterfaceParams);
|
return Dispatcher(InterfaceParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,11 +91,9 @@ AmdInitReset (
|
||||||
IN OUT AMD_RESET_PARAMS *ResetParams
|
IN OUT AMD_RESET_PARAMS *ResetParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
ResetParams->StdHeader.Func = AMD_INIT_RESET;
|
ResetParams->StdHeader.Func = AMD_INIT_RESET;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(ResetParams);
|
return Dispatcher(ResetParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,11 +105,9 @@ AmdInitEarly (
|
||||||
IN OUT AMD_EARLY_PARAMS *EarlyParams
|
IN OUT AMD_EARLY_PARAMS *EarlyParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
EarlyParams->StdHeader.Func = AMD_INIT_EARLY;
|
EarlyParams->StdHeader.Func = AMD_INIT_EARLY;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(EarlyParams);
|
return Dispatcher(EarlyParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,11 +119,9 @@ AmdInitPost (
|
||||||
IN OUT AMD_POST_PARAMS *PostParams ///< Amd Cpu init param
|
IN OUT AMD_POST_PARAMS *PostParams ///< Amd Cpu init param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
PostParams->StdHeader.Func = AMD_INIT_POST;
|
PostParams->StdHeader.Func = AMD_INIT_POST;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(PostParams);
|
return Dispatcher(PostParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,11 +133,9 @@ AmdInitEnv (
|
||||||
IN OUT AMD_ENV_PARAMS *EnvParams
|
IN OUT AMD_ENV_PARAMS *EnvParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
EnvParams->StdHeader.Func = AMD_INIT_ENV;
|
EnvParams->StdHeader.Func = AMD_INIT_ENV;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(EnvParams);
|
return Dispatcher(EnvParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,11 +147,9 @@ AmdInitMid (
|
||||||
IN OUT AMD_MID_PARAMS *MidParams
|
IN OUT AMD_MID_PARAMS *MidParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
MidParams->StdHeader.Func = AMD_INIT_MID;
|
MidParams->StdHeader.Func = AMD_INIT_MID;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(MidParams);
|
return Dispatcher(MidParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,11 +161,9 @@ AmdInitLate (
|
||||||
IN OUT AMD_LATE_PARAMS *LateParams
|
IN OUT AMD_LATE_PARAMS *LateParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
LateParams->StdHeader.Func = AMD_INIT_LATE;
|
LateParams->StdHeader.Func = AMD_INIT_LATE;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(LateParams);
|
return Dispatcher(LateParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,11 +175,9 @@ AmdInitRecovery (
|
||||||
IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
|
IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
RecoveryParams->StdHeader.Func = AMD_INIT_RECOVERY;
|
RecoveryParams->StdHeader.Func = AMD_INIT_RECOVERY;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(RecoveryParams);
|
return Dispatcher(RecoveryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,11 +189,9 @@ AmdInitResume (
|
||||||
IN AMD_RESUME_PARAMS *ResumeParams
|
IN AMD_RESUME_PARAMS *ResumeParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
ResumeParams->StdHeader.Func = AMD_INIT_RESUME;
|
ResumeParams->StdHeader.Func = AMD_INIT_RESUME;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(ResumeParams);
|
return Dispatcher(ResumeParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,11 +203,9 @@ AmdS3LateRestore (
|
||||||
IN OUT AMD_S3LATE_PARAMS *S3LateParams
|
IN OUT AMD_S3LATE_PARAMS *S3LateParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
S3LateParams->StdHeader.Func = AMD_S3LATE_RESTORE;
|
S3LateParams->StdHeader.Func = AMD_S3LATE_RESTORE;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(S3LateParams);
|
return Dispatcher(S3LateParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,11 +217,9 @@ AmdInitRtb (
|
||||||
IN OUT AMD_RTB_PARAMS *AmdInitRtbParams
|
IN OUT AMD_RTB_PARAMS *AmdInitRtbParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
AmdInitRtbParams->StdHeader.Func = AMD_INIT_RTB;
|
AmdInitRtbParams->StdHeader.Func = AMD_INIT_RTB;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(AmdInitRtbParams);
|
return Dispatcher(AmdInitRtbParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,11 +231,9 @@ AmdLateRunApTask (
|
||||||
IN AP_EXE_PARAMS *AmdApExeParams
|
IN AP_EXE_PARAMS *AmdApExeParams
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
AmdApExeParams->StdHeader.Func = AMD_LATE_RUN_AP_TASK;
|
AmdApExeParams->StdHeader.Func = AMD_LATE_RUN_AP_TASK;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(AmdApExeParams);
|
return Dispatcher(AmdApExeParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,11 +245,9 @@ AmdGetApicId (
|
||||||
IN OUT AMD_APIC_PARAMS *AmdParamApic
|
IN OUT AMD_APIC_PARAMS *AmdParamApic
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
AmdParamApic->StdHeader.Func = AMD_GET_APIC_ID;
|
AmdParamApic->StdHeader.Func = AMD_GET_APIC_ID;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(AmdParamApic);
|
return Dispatcher(AmdParamApic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,11 +259,9 @@ AmdGetPciAddress (
|
||||||
IN OUT AMD_GET_PCI_PARAMS *AmdParamGetPci
|
IN OUT AMD_GET_PCI_PARAMS *AmdParamGetPci
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
AmdParamGetPci->StdHeader.Func = AMD_GET_PCI_ADDRESS;
|
AmdParamGetPci->StdHeader.Func = AMD_GET_PCI_ADDRESS;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(AmdParamGetPci);
|
return Dispatcher(AmdParamGetPci);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,11 +273,9 @@ AmdIdentifyCore (
|
||||||
IN OUT AMD_IDENTIFY_PARAMS *AmdParamIdentify
|
IN OUT AMD_IDENTIFY_PARAMS *AmdParamIdentify
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
AmdParamIdentify->StdHeader.Func = AMD_IDENTIFY_CORE;
|
AmdParamIdentify->StdHeader.Func = AMD_IDENTIFY_CORE;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(AmdParamIdentify);
|
return Dispatcher(AmdParamIdentify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,11 +287,9 @@ AmdReadEventLog (
|
||||||
IN EVENT_PARAMS *Event
|
IN EVENT_PARAMS *Event
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
Event->StdHeader.Func = AMD_READ_EVENT_LOG;
|
Event->StdHeader.Func = AMD_READ_EVENT_LOG;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(Event);
|
return Dispatcher(Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,11 +301,9 @@ AmdIdentifyDimm (
|
||||||
IN OUT AMD_IDENTIFY_DIMM *AmdDimmIdentify
|
IN OUT AMD_IDENTIFY_DIMM *AmdDimmIdentify
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
AmdDimmIdentify->StdHeader.Func = AMD_IDENTIFY_DIMMS;
|
AmdDimmIdentify->StdHeader.Func = AMD_IDENTIFY_DIMMS;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(AmdDimmIdentify);
|
return Dispatcher(AmdDimmIdentify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,10 +324,8 @@ AmdGet2DDataEye (
|
||||||
IN OUT AMD_GET_DATAEYE *AmdGetDataEye
|
IN OUT AMD_GET_DATAEYE *AmdGetDataEye
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MODULE_ENTRY Dispatcher = NULL;
|
MODULE_ENTRY Dispatcher = agesa_get_dispatcher();
|
||||||
const AMD_MODULE_HEADER* module = agesawrapper_locate_module(ModuleIdentifier);
|
|
||||||
AmdGetDataEye->StdHeader.Func = AMD_GET_2D_DATA_EYE;
|
AmdGetDataEye->StdHeader.Func = AMD_GET_2D_DATA_EYE;
|
||||||
if (!module) return AGESA_UNSUPPORTED;
|
if (!Dispatcher) return AGESA_UNSUPPORTED;
|
||||||
Dispatcher = module->ModuleDispatcher;
|
|
||||||
return Dispatcher(AmdGetDataEye);
|
return Dispatcher(AmdGetDataEye);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue