From e3f7d44d3b11d4a87b3eff3d9b3c6aa077fdf36c Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 3 Nov 2017 11:44:10 -0600 Subject: soc/amd/common: remove use of LibAmdMemFill() memset() exists for a reason. There's 0 reason to duplicate the functionality but add extraneous parameters that do nothing. This is just poor coding practices. Remove LibAmdMemFill() usage. BUG=b:62240746 Change-Id: I18028b38421efa9c4c7c0412a04479638cc9218b Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/22312 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Patrick Georgi Reviewed-by: Marshall Dawson --- src/soc/amd/common/agesawrapper.c | 47 +++++++++------------------------------ src/soc/amd/common/heapmanager.c | 5 ++--- 2 files changed, 12 insertions(+), 40 deletions(-) (limited to 'src/soc/amd/common') diff --git a/src/soc/amd/common/agesawrapper.c b/src/soc/amd/common/agesawrapper.c index 26c48f33b3..0ca47df154 100644 --- a/src/soc/amd/common/agesawrapper.c +++ b/src/soc/amd/common/agesawrapper.c @@ -22,6 +22,7 @@ #include #include #include +#include void __attribute__((weak)) OemPostParams(AMD_POST_PARAMS *PostParams) {} @@ -47,15 +48,8 @@ AGESA_STATUS agesawrapper_amdinitreset(void) AMD_INTERFACE_PARAMS AmdParamStruct; AMD_RESET_PARAMS AmdResetParams; - LibAmdMemFill (&AmdParamStruct, - 0, - sizeof(AMD_INTERFACE_PARAMS), - &(AmdParamStruct.StdHeader)); - - LibAmdMemFill (&AmdResetParams, - 0, - sizeof(AMD_RESET_PARAMS), - &(AmdResetParams.StdHeader)); + memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); + memset(&AmdResetParams, 0, sizeof(AmdResetParams)); AmdParamStruct.AgesaFunctionName = AMD_INIT_RESET; AmdParamStruct.AllocationMethod = ByHost; @@ -84,10 +78,7 @@ AGESA_STATUS agesawrapper_amdinitearly(void) AMD_INTERFACE_PARAMS AmdParamStruct; AMD_EARLY_PARAMS *AmdEarlyParamsPtr; - LibAmdMemFill (&AmdParamStruct, - 0, - sizeof(AMD_INTERFACE_PARAMS), - &(AmdParamStruct.StdHeader)); + memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); AmdParamStruct.AgesaFunctionName = AMD_INIT_EARLY; AmdParamStruct.AllocationMethod = PreMemHeap; @@ -115,10 +106,7 @@ AGESA_STATUS agesawrapper_amdinitpost(void) AMD_INTERFACE_PARAMS AmdParamStruct; AMD_POST_PARAMS *PostParams; - LibAmdMemFill (&AmdParamStruct, - 0, - sizeof(AMD_INTERFACE_PARAMS), - &(AmdParamStruct.StdHeader)); + memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); AmdParamStruct.AgesaFunctionName = AMD_INIT_POST; AmdParamStruct.AllocationMethod = PreMemHeap; @@ -183,10 +171,7 @@ AGESA_STATUS agesawrapper_amdinitenv(void) AMD_INTERFACE_PARAMS AmdParamStruct; AMD_ENV_PARAMS *EnvParam; - LibAmdMemFill (&AmdParamStruct, - 0, - sizeof(AMD_INTERFACE_PARAMS), - &(AmdParamStruct.StdHeader)); + memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); AmdParamStruct.AgesaFunctionName = AMD_INIT_ENV; AmdParamStruct.AllocationMethod = PostMemDram; @@ -251,10 +236,7 @@ AGESA_STATUS agesawrapper_amdinitmid(void) /* Enable MMIO on AMD CPU Address Map Controller */ amd_initcpuio (); - LibAmdMemFill (&AmdParamStruct, - 0, - sizeof(AMD_INTERFACE_PARAMS), - &(AmdParamStruct.StdHeader)); + memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); AmdParamStruct.AgesaFunctionName = AMD_INIT_MID; AmdParamStruct.AllocationMethod = PostMemDram; @@ -289,10 +271,7 @@ AGESA_STATUS agesawrapper_amdinitlate(void) AMD_INTERFACE_PARAMS AmdParamStruct; AMD_LATE_PARAMS *AmdLateParams; - LibAmdMemFill (&AmdParamStruct, - 0, - sizeof(AMD_INTERFACE_PARAMS), - &(AmdParamStruct.StdHeader)); + memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); AmdParamStruct.AgesaFunctionName = AMD_INIT_LATE; AmdParamStruct.AllocationMethod = PostMemDram; @@ -341,10 +320,7 @@ AGESA_STATUS agesawrapper_amdlaterunaptask ( AGESA_STATUS Status; AP_EXE_PARAMS ApExeParams; - LibAmdMemFill (&ApExeParams, - 0, - sizeof(AP_EXE_PARAMS), - &(ApExeParams.StdHeader)); + memset(&ApExeParams, 0, sizeof(ApExeParams)); ApExeParams.StdHeader.AltImageBasePtr = 0; ApExeParams.StdHeader.CalloutPtr = &GetBiosCallout; @@ -367,10 +343,7 @@ AGESA_STATUS agesawrapper_amdreadeventlog (UINT8 HeapStatus) AGESA_STATUS Status; EVENT_PARAMS AmdEventParams; - LibAmdMemFill (&AmdEventParams, - 0, - sizeof(EVENT_PARAMS), - &(AmdEventParams.StdHeader)); + memset(&AmdEventParams, 0, sizeof(AmdEventParams)); AmdEventParams.StdHeader.AltImageBasePtr = 0; AmdEventParams.StdHeader.CalloutPtr = &GetBiosCallout; diff --git a/src/soc/amd/common/heapmanager.c b/src/soc/amd/common/heapmanager.c index fdf7f65880..5e4fbb4166 100644 --- a/src/soc/amd/common/heapmanager.c +++ b/src/soc/amd/common/heapmanager.c @@ -239,9 +239,8 @@ AGESA_STATUS agesa_DeallocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr) PrevNodePtr->NextNodeOffset = AllocNodePtr->NextNodeOffset; /* Zero out the buffer, and clear the BufferHandle */ - LibAmdMemFill((UINT8 *)AllocNodePtr + sizeof(BIOS_BUFFER_NODE), 0, - AllocNodePtr->BufferSize, - &(AllocParams->StdHeader)); + memset((UINT8 *)AllocNodePtr + sizeof(BIOS_BUFFER_NODE), 0, + AllocNodePtr->BufferSize); AllocNodePtr->BufferHandle = 0; AllocNodePtr->BufferSize += sizeof(BIOS_BUFFER_NODE); -- cgit v1.2.3