summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2017-07-25 11:34:43 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2017-08-02 04:49:59 +0000
commita18f58b862061cb68fd1c6afc862d31dd6ac69e3 (patch)
treed62a8fb055863133e1f3335cb33c09e10def7aec
parent21e609c1c92c47bd8990c2ce25adf5987b5dd1b2 (diff)
downloadcoreboot-a18f58b862061cb68fd1c6afc862d31dd6ac69e3.tar.xz
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>
-rw-r--r--src/northbridge/amd/agesa/state_machine.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/northbridge/amd/agesa/state_machine.c b/src/northbridge/amd/agesa/state_machine.c
index 6892990409..d16e9adbae 100644
--- a/src/northbridge/amd/agesa/state_machine.c
+++ b/src/northbridge/amd/agesa/state_machine.c
@@ -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.
*/
-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_STATUS status = AGESA_UNSUPPORTED;
switch (func)
{
-#if ENV_ROMSTAGE
case AMD_INIT_RESET:
{
AMD_RESET_PARAMS *param = (void *)StdHeader;
@@ -123,9 +122,23 @@ static AGESA_STATUS amd_dispatch(struct sysinfo *cb,
platform_AfterInitResume(cb, param);
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:
{
AMD_ENV_PARAMS *param = (void *)StdHeader;
@@ -161,6 +174,7 @@ static AGESA_STATUS amd_dispatch(struct sysinfo *cb,
platform_AfterS3Save(cb, param);
break;
}
+
case AMD_INIT_LATE:
{
AMD_LATE_PARAMS *param = (void *)StdHeader;
@@ -169,7 +183,7 @@ static AGESA_STATUS amd_dispatch(struct sysinfo *cb,
completion_InitLate(cb, param);
break;
}
-#endif
+
default:
{
break;
@@ -244,7 +258,11 @@ int agesa_execute_state(struct sysinfo *cb, AGESA_STRUCT_NAME func)
AMD_CONFIG_PARAMS *StdHeader = aip.NewStructPtr;
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);
ASSERT(final < AGESA_FATAL);