AGESA: Split dispatcher to stages

Change-Id: Ide49e46c0b6aa5e1bf09354435a847a46bc797c9
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/20761
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Kyösti Mälkki 2017-07-25 11:34:43 +03:00
parent 21e609c1c9
commit a18f58b862
1 changed files with 24 additions and 6 deletions

View File

@ -79,14 +79,13 @@ static AGESA_STATUS amd_release_struct(AMD_INTERFACE_PARAMS *aip)
* can be evaluated to apply correct typecast based on Func field. * can be evaluated to apply correct typecast based on Func field.
*/ */
static AGESA_STATUS amd_dispatch(struct sysinfo *cb, static AGESA_STATUS romstage_dispatch(struct sysinfo *cb,
AGESA_STRUCT_NAME func, AMD_CONFIG_PARAMS *StdHeader) AGESA_STRUCT_NAME func, AMD_CONFIG_PARAMS *StdHeader)
{ {
AGESA_STATUS status = AGESA_UNSUPPORTED; AGESA_STATUS status = AGESA_UNSUPPORTED;
switch (func) switch (func)
{ {
#if ENV_ROMSTAGE
case AMD_INIT_RESET: case AMD_INIT_RESET:
{ {
AMD_RESET_PARAMS *param = (void *)StdHeader; AMD_RESET_PARAMS *param = (void *)StdHeader;
@ -123,9 +122,23 @@ static AGESA_STATUS amd_dispatch(struct sysinfo *cb,
platform_AfterInitResume(cb, param); platform_AfterInitResume(cb, param);
break; break;
} }
#endif
#if ENV_RAMSTAGE default:
{
break;
}
}
return status;
}
static AGESA_STATUS ramstage_dispatch(struct sysinfo *cb,
AGESA_STRUCT_NAME func, AMD_CONFIG_PARAMS *StdHeader)
{
AGESA_STATUS status = AGESA_UNSUPPORTED;
switch (func)
{
case AMD_INIT_ENV: case AMD_INIT_ENV:
{ {
AMD_ENV_PARAMS *param = (void *)StdHeader; AMD_ENV_PARAMS *param = (void *)StdHeader;
@ -161,6 +174,7 @@ static AGESA_STATUS amd_dispatch(struct sysinfo *cb,
platform_AfterS3Save(cb, param); platform_AfterS3Save(cb, param);
break; break;
} }
case AMD_INIT_LATE: case AMD_INIT_LATE:
{ {
AMD_LATE_PARAMS *param = (void *)StdHeader; AMD_LATE_PARAMS *param = (void *)StdHeader;
@ -169,7 +183,7 @@ static AGESA_STATUS amd_dispatch(struct sysinfo *cb,
completion_InitLate(cb, param); completion_InitLate(cb, param);
break; break;
} }
#endif
default: default:
{ {
break; break;
@ -244,7 +258,11 @@ int agesa_execute_state(struct sysinfo *cb, AGESA_STRUCT_NAME func)
AMD_CONFIG_PARAMS *StdHeader = aip.NewStructPtr; AMD_CONFIG_PARAMS *StdHeader = aip.NewStructPtr;
ASSERT(StdHeader->Func == func); ASSERT(StdHeader->Func == func);
final = amd_dispatch(cb, func, StdHeader); if (ENV_ROMSTAGE)
final = romstage_dispatch(cb, func, StdHeader);
if (ENV_RAMSTAGE)
final = ramstage_dispatch(cb, func, StdHeader);
agesawrapper_trace(final, StdHeader, state_name); agesawrapper_trace(final, StdHeader, state_name);
ASSERT(final < AGESA_FATAL); ASSERT(final < AGESA_FATAL);