diff options
author | Marshall Dawson <marshalldawson3rd@gmail.com> | 2018-01-25 11:13:35 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2018-02-07 16:39:50 +0000 |
commit | 4c5a3b67e0767c59e9db27fa84e09effcb57209e (patch) | |
tree | ac1eeaa90f86f5e8c2afa9729d7a478a7caff68d /src/soc/amd/common/block | |
parent | c8fcc460252ca3470ba5857ca19754672e2d5b4c (diff) |
soc/amd/common: Add generic create_struct call to wrapper
Create a generic function that reports an unsuccessful call to
AmdCreateStruct().
Change-Id: I2654b4f21de5a2621086142681181a687be2c8e3
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/23440
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src/soc/amd/common/block')
-rw-r--r-- | src/soc/amd/common/block/pi/agesawrapper.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c index 976412778a..d454e32289 100644 --- a/src/soc/amd/common/block/pi/agesawrapper.c +++ b/src/soc/amd/common/block/pi/agesawrapper.c @@ -69,6 +69,22 @@ static AGESA_STATUS agesawrapper_readeventlog(UINT8 HeapStatus) return Status; } +static AGESA_STATUS create_struct(AMD_INTERFACE_PARAMS *interface_struct) +{ + AGESA_STATUS status = AmdCreateStruct(interface_struct); + if (status == AGESA_SUCCESS) + return status; + + printk(BIOS_ERR, "Error: AmdCreateStruct() for 0x%x returned 0x%x. " + "Proper system initialization may not be possible.\n", + interface_struct->AgesaFunctionName, status); + + if (!interface_struct->NewStructPtr) /* Avoid NULL pointer usage */ + die("No AGESA structure created"); + + return status; +} + AGESA_STATUS agesawrapper_amdinitreset(void) { AGESA_STATUS status; @@ -80,7 +96,7 @@ AGESA_STATUS agesawrapper_amdinitreset(void) .NewStructPtr = &ResetParams, .StdHeader.CalloutPtr = &GetBiosCallout }; - AmdCreateStruct(&AmdParamStruct); + create_struct(&AmdParamStruct); SetFchResetParams(&ResetParams.FchInterface); timestamp_add_now(TS_AGESA_INIT_RESET_START); @@ -103,7 +119,7 @@ AGESA_STATUS agesawrapper_amdinitearly(void) .StdHeader.CalloutPtr = &GetBiosCallout, }; - AmdCreateStruct(&AmdParamStruct); + create_struct(&AmdParamStruct); EarlyParams = (AMD_EARLY_PARAMS *)AmdParamStruct.NewStructPtr; OemCustomizeInitEarly(EarlyParams); @@ -164,7 +180,7 @@ AGESA_STATUS agesawrapper_amdinitpost(void) }; AMD_POST_PARAMS *PostParams; - AmdCreateStruct(&AmdParamStruct); + create_struct(&AmdParamStruct); PostParams = (AMD_POST_PARAMS *)AmdParamStruct.NewStructPtr; PostParams->MemConfig.UmaMode = CONFIG_GFXUMA ? UMA_AUTO : UMA_NONE; @@ -215,7 +231,7 @@ AGESA_STATUS agesawrapper_amdinitenv(void) }; AMD_ENV_PARAMS *EnvParams; - status = AmdCreateStruct(&AmdParamStruct); + status = create_struct(&AmdParamStruct); EnvParams = (AMD_ENV_PARAMS *)AmdParamStruct.NewStructPtr; SetFchEnvParams(&EnvParams->FchInterface); @@ -270,7 +286,7 @@ AGESA_STATUS agesawrapper_amdinitmid(void) /* Enable MMIO on AMD CPU Address Map Controller */ amd_initcpuio(); - AmdCreateStruct(&AmdParamStruct); + create_struct(&AmdParamStruct); MidParams = (AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr; SetFchMidParams(&MidParams->FchInterface); @@ -301,7 +317,7 @@ AGESA_STATUS agesawrapper_amdinitlate(void) * NOTE: if not call amdcreatestruct, the initializer * (AmdInitLateInitializer) would not be called. */ - AmdCreateStruct(&AmdParamStruct); + create_struct(&AmdParamStruct); LateParams = (AMD_LATE_PARAMS *)AmdParamStruct.NewStructPtr; timestamp_add_now(TS_AGESA_INIT_LATE_START); |