Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/22889
Change subject: soc/amd/common: Improve misc. formatting in AGESA wrapper ......................................................................
soc/amd/common: Improve misc. formatting in AGESA wrapper
Improve the file with: * C99 inializations for structures * reorder include files for aesthetics * remove extraneous whitespace * update comments
This change clears up all remaining checkpatch issues with the wrapper with the exception of errors created with AMD definitions, e.g. ERROR: need consistent spacing around '*' (ctx:WxV) #32: FILE: src/soc/amd/common/block/pi/agesawrapper.c:32: void __attribute__((weak)) SetFchMidParams(FCH_INTERFACE *params) {}
BUG=b:62240746 TEST=Build and boot Kahlee
Change-Id: I40985e0cf50df6aa4d830937e7f6b6e7908f72fe Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/soc/amd/common/block/pi/agesawrapper.c 1 file changed, 69 insertions(+), 98 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/22889/1
diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c index 87dfd56..5e07939 100644 --- a/src/soc/amd/common/block/pi/agesawrapper.c +++ b/src/soc/amd/common/block/pi/agesawrapper.c @@ -13,15 +13,16 @@ * GNU General Public License for more details. */
-#include <amdblocks/agesawrapper.h> #include <arch/early_variables.h> #include <cbfs.h> #include <cbmem.h> #include <delay.h> -#include <cpu/x86/mtrr.h> -#include <amdblocks/BiosCallOuts.h> #include <string.h> #include <timestamp.h> +#include <cpu/x86/mtrr.h> +#include <soc/iomap.h> +#include <amdblocks/agesawrapper.h> +#include <amdblocks/BiosCallOuts.h>
void __attribute__((weak)) SetFchResetParams(FCH_RESET_INTERFACE *params) {} void __attribute__((weak)) SetMemParams(AMD_POST_PARAMS *PostParams) {} @@ -73,22 +74,15 @@ AGESA_STATUS agesawrapper_amdinitreset(void) { AGESA_STATUS status; - AMD_INTERFACE_PARAMS AmdParamStruct; AMD_RESET_PARAMS AmdResetParams; - - memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); - memset(&AmdResetParams, 0, sizeof(AmdResetParams)); - - AmdParamStruct.AgesaFunctionName = AMD_INIT_RESET; - AmdParamStruct.AllocationMethod = ByHost; - AmdParamStruct.NewStructSize = sizeof(AMD_RESET_PARAMS); - AmdParamStruct.NewStructPtr = &AmdResetParams; - AmdParamStruct.StdHeader.AltImageBasePtr = 0; - AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; - AmdParamStruct.StdHeader.Func = 0; - AmdParamStruct.StdHeader.ImageBasePtr = 0; - AmdCreateStruct (&AmdParamStruct); - + AMD_INTERFACE_PARAMS AmdParamStruct = { + .AgesaFunctionName = AMD_INIT_RESET, + .AllocationMethod = ByHost, + .NewStructSize = sizeof(AMD_RESET_PARAMS), + .NewStructPtr = &AmdResetParams, + .StdHeader.CalloutPtr = &GetBiosCallout + }; + AmdCreateStruct(&AmdParamStruct); SetFchResetParams(&AmdResetParams.FchInterface);
timestamp_add_now(TS_AGESA_INIT_RESET_START); @@ -97,38 +91,34 @@
if (status != AGESA_SUCCESS) agesawrapper_readeventlog(AmdParamStruct.StdHeader.HeapStatus); - AmdReleaseStruct (&AmdParamStruct); + AmdReleaseStruct(&AmdParamStruct); return status; }
AGESA_STATUS agesawrapper_amdinitearly(void) { AGESA_STATUS status; - AMD_INTERFACE_PARAMS AmdParamStruct; - AMD_EARLY_PARAMS *AmdEarlyParamsPtr; + AMD_EARLY_PARAMS *AmdEarlyParamsPtr; + AMD_INTERFACE_PARAMS AmdParamStruct = { + .AgesaFunctionName = AMD_INIT_EARLY, + .AllocationMethod = PreMemHeap, + .StdHeader.CalloutPtr = &GetBiosCallout, + };
- memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); - - AmdParamStruct.AgesaFunctionName = AMD_INIT_EARLY; - AmdParamStruct.AllocationMethod = PreMemHeap; - AmdParamStruct.StdHeader.AltImageBasePtr = 0; - AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; - AmdParamStruct.StdHeader.Func = 0; - AmdParamStruct.StdHeader.ImageBasePtr = 0; - AmdCreateStruct (&AmdParamStruct); + AmdCreateStruct(&AmdParamStruct);
AmdEarlyParamsPtr = (AMD_EARLY_PARAMS *)AmdParamStruct.NewStructPtr; - OemCustomizeInitEarly (AmdEarlyParamsPtr); + OemCustomizeInitEarly(AmdEarlyParamsPtr);
AmdEarlyParamsPtr->GnbConfig.PsppPolicy = PsppDisabled;
timestamp_add_now(TS_AGESA_INIT_EARLY_START); - status = AmdInitEarly ((AMD_EARLY_PARAMS *)AmdParamStruct.NewStructPtr); + status = AmdInitEarly((AMD_EARLY_PARAMS *)AmdParamStruct.NewStructPtr); timestamp_add_now(TS_AGESA_INIT_EARLY_DONE);
if (status != AGESA_SUCCESS) agesawrapper_readeventlog(AmdParamStruct.StdHeader.HeapStatus); - AmdReleaseStruct (&AmdParamStruct); + AmdReleaseStruct(&AmdParamStruct);
return status; } @@ -173,21 +163,16 @@ AGESA_STATUS agesawrapper_amdinitpost(void) { AGESA_STATUS status; - AMD_INTERFACE_PARAMS AmdParamStruct; - AMD_POST_PARAMS *PostParams; + AMD_INTERFACE_PARAMS AmdParamStruct = { + .AgesaFunctionName = AMD_INIT_POST, + .AllocationMethod = PreMemHeap, + .StdHeader.CalloutPtr = &GetBiosCallout, + }; + AMD_POST_PARAMS *PostParams;
- memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); + AmdCreateStruct(&AmdParamStruct);
- AmdParamStruct.AgesaFunctionName = AMD_INIT_POST; - AmdParamStruct.AllocationMethod = PreMemHeap; - AmdParamStruct.StdHeader.AltImageBasePtr = 0; - AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; - AmdParamStruct.StdHeader.Func = 0; - AmdParamStruct.StdHeader.ImageBasePtr = 0; - - AmdCreateStruct (&AmdParamStruct); PostParams = (AMD_POST_PARAMS *)AmdParamStruct.NewStructPtr; - PostParams->MemConfig.UmaMode = CONFIG_GFXUMA ? UMA_AUTO : UMA_NONE; PostParams->MemConfig.UmaSize = 0; PostParams->MemConfig.BottomIo = (UINT16) @@ -202,7 +187,7 @@ );
timestamp_add_now(TS_AGESA_INIT_POST_START); - status = AmdInitPost (PostParams); + status = AmdInitPost(PostParams); timestamp_add_now(TS_AGESA_INIT_POST_DONE);
/* @@ -221,7 +206,7 @@
if (status != AGESA_SUCCESS) agesawrapper_readeventlog(PostParams->StdHeader.HeapStatus); - AmdReleaseStruct (&AmdParamStruct); + AmdReleaseStruct(&AmdParamStruct);
return status; } @@ -229,38 +214,37 @@ AGESA_STATUS agesawrapper_amdinitenv(void) { AGESA_STATUS status; - AMD_INTERFACE_PARAMS AmdParamStruct; - AMD_ENV_PARAMS *EnvParam; + AMD_INTERFACE_PARAMS AmdParamStruct = { + .AgesaFunctionName = AMD_INIT_ENV, + .AllocationMethod = PostMemDram, + .StdHeader.CalloutPtr = &GetBiosCallout, + }; + AMD_ENV_PARAMS *EnvParam;
- memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); - - AmdParamStruct.AgesaFunctionName = AMD_INIT_ENV; - AmdParamStruct.AllocationMethod = PostMemDram; - AmdParamStruct.StdHeader.AltImageBasePtr = 0; - AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; - AmdParamStruct.StdHeader.Func = 0; - AmdParamStruct.StdHeader.ImageBasePtr = 0; - status = AmdCreateStruct (&AmdParamStruct); + status = AmdCreateStruct(&AmdParamStruct);
EnvParam = (AMD_ENV_PARAMS *)AmdParamStruct.NewStructPtr; SetFchEnvParams(&EnvParam->FchInterface); SetNbEnvParams(&EnvParam->GnbEnvConfiguration);
timestamp_add_now(TS_AGESA_INIT_ENV_START); - status = AmdInitEnv (EnvParam); + status = AmdInitEnv(EnvParam); timestamp_add_now(TS_AGESA_INIT_ENV_DONE);
if (status != AGESA_SUCCESS) agesawrapper_readeventlog(EnvParam->StdHeader.HeapStatus); - /* Initialize Subordinate Bus Number and Secondary Bus Number + /* + * FIXME: what is this old comment? D18F0x18 is the Graphics Doorbell + * Base Address + * Initialize Subordinate Bus Number and Secondary Bus Number * In platform BIOS this address is allocated by PCI enumeration code - Modify D1F0x18 - */ + * Modify D1F0x18 + */
return status; }
-VOID* agesawrapper_getlateinitptr (int pick) +VOID *agesawrapper_getlateinitptr(int pick) { switch (pick) { case PICK_DMI: @@ -289,34 +273,29 @@ AGESA_STATUS agesawrapper_amdinitmid(void) { AGESA_STATUS status; - AMD_INTERFACE_PARAMS AmdParamStruct; + AMD_INTERFACE_PARAMS AmdParamStruct = { + .AgesaFunctionName = AMD_INIT_MID, + .AllocationMethod = PostMemDram, + .StdHeader.CalloutPtr = &GetBiosCallout, + }; AMD_MID_PARAMS *MidParam;
/* Enable MMIO on AMD CPU Address Map Controller */ - amd_initcpuio (); + amd_initcpuio();
- memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); - - AmdParamStruct.AgesaFunctionName = AMD_INIT_MID; - AmdParamStruct.AllocationMethod = PostMemDram; - AmdParamStruct.StdHeader.AltImageBasePtr = 0; - AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; - AmdParamStruct.StdHeader.Func = 0; - AmdParamStruct.StdHeader.ImageBasePtr = 0; - - AmdCreateStruct (&AmdParamStruct); + AmdCreateStruct(&AmdParamStruct);
MidParam = (AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr; SetFchMidParams(&MidParam->FchInterface); SetNbMidParams(&MidParam->GnbMidConfiguration);
timestamp_add_now(TS_AGESA_INIT_MID_START); - status = AmdInitMid ((AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr); + status = AmdInitMid((AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr); timestamp_add_now(TS_AGESA_INIT_MID_DONE);
if (status != AGESA_SUCCESS) agesawrapper_readeventlog(AmdParamStruct.StdHeader.HeapStatus); - AmdReleaseStruct (&AmdParamStruct); + AmdReleaseStruct(&AmdParamStruct);
return status; } @@ -324,21 +303,16 @@ AGESA_STATUS agesawrapper_amdinitlate(void) { AGESA_STATUS Status; - AMD_INTERFACE_PARAMS AmdParamStruct; + AMD_INTERFACE_PARAMS AmdParamStruct = { + .AgesaFunctionName = AMD_INIT_LATE, + .AllocationMethod = PostMemDram, + .StdHeader.CalloutPtr = &GetBiosCallout, + .StdHeader.HeapStatus = HEAP_SYSTEM_MEM, + }; AMD_LATE_PARAMS *AmdLateParams;
- memset(&AmdParamStruct, 0, sizeof(AmdParamStruct)); - - AmdParamStruct.AgesaFunctionName = AMD_INIT_LATE; - AmdParamStruct.AllocationMethod = PostMemDram; - AmdParamStruct.StdHeader.AltImageBasePtr = 0; - AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; - AmdParamStruct.StdHeader.HeapStatus = HEAP_SYSTEM_MEM; - AmdParamStruct.StdHeader.Func = 0; - AmdParamStruct.StdHeader.ImageBasePtr = 0; - - /* NOTE: if not call amdcreatestruct, the initializer(AmdInitLateInitializer) would not be called */ AmdCreateStruct(&AmdParamStruct); + AmdLateParams = (AMD_LATE_PARAMS *)AmdParamStruct.NewStructPtr;
timestamp_add_now(TS_AGESA_INIT_LATE_START); @@ -369,11 +343,8 @@ return Status; }
-AGESA_STATUS agesawrapper_amdlaterunaptask ( - UINT32 Func, - UINTN Data, - VOID *ConfigPtr - ) +AGESA_STATUS agesawrapper_amdlaterunaptask(UINT32 Func, UINTN Data, + VOID *ConfigPtr) { AGESA_STATUS Status; AP_EXE_PARAMS ApExeParams; @@ -387,7 +358,7 @@ ApExeParams.FunctionNumber = Func; ApExeParams.RelatedDataBlock = ConfigPtr;
- Status = AmdLateRunApTask (&ApExeParams); + Status = AmdLateRunApTask(&ApExeParams); if (Status != AGESA_SUCCESS) { /* agesawrapper_readeventlog(); */ ASSERT(Status == AGESA_SUCCESS); @@ -425,10 +396,10 @@ region_device_sz(rdev) - metadata_sz); }
-const void *agesawrapper_locate_module (const CHAR8 name[8]) +const void *agesawrapper_locate_module(const CHAR8 name[8]) { - const void* agesa; - const AMD_IMAGE_HEADER* image; + const void *agesa; + const AMD_IMAGE_HEADER *image; struct region_device rdev; size_t file_size; const char *fname = CONFIG_AGESA_CBFS_NAME;