soc/amd/common/block/pi: Format files to standards

Files agesawrapper.c and heapmanager.c have several non-conformity with
coreboot standards, including lines longer than 80 characters, use of
"} else {" after a return and wrong comment block formatting. Fix all
such issues, so that it passes commit tests.

BUG=b:69262110
TEST=Build with no error gardenia and kahlee (no code change, just file
formatting).

Change-Id: Iefe741cd62bc41a7975c3dd10ac9355352de3abb
Signed-off-by: Richard Spiegel <richard.spiegel@silverbackltd.com>
Reviewed-on: https://review.coreboot.org/22823
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Richard Spiegel 2017-12-11 16:23:58 -07:00 committed by Martin Roth
parent 5abe2d1472
commit fc511277a5
2 changed files with 89 additions and 75 deletions

View File

@ -244,10 +244,11 @@ AGESA_STATUS agesawrapper_amdinitenv(void)
if (status != AGESA_SUCCESS)
agesawrapper_readeventlog(EnvParam->StdHeader.HeapStatus);
/* Initialize Subordinate Bus Number and Secondary Bus Number
/*
* 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;
}
@ -329,7 +330,10 @@ AGESA_STATUS agesawrapper_amdinitlate(void)
AmdParamStruct.StdHeader.Func = 0;
AmdParamStruct.StdHeader.ImageBasePtr = 0;
/* NOTE: if not call amdcreatestruct, the initializer(AmdInitLateInitializer) would not be called */
/*
* NOTE: if not call amdcreatestruct, the initializer
* (AmdInitLateInitializer) would not be called.
*/
AmdCreateStruct(&AmdParamStruct);
AmdLateParams = (AMD_LATE_PARAMS *)AmdParamStruct.NewStructPtr;
@ -354,8 +358,9 @@ AGESA_STATUS agesawrapper_amdinitlate(void)
printk(BIOS_DEBUG, "DmiTable:%x, AcpiPstatein: %x, AcpiSrat:%x,"
"AcpiSlit:%x, Mce:%x, Cmc:%x,"
"Alib:%x, AcpiIvrs:%x in %s\n",
(unsigned int)DmiTable, (unsigned int)AcpiPstate, (unsigned int)AcpiSrat,
(unsigned int)AcpiSlit, (unsigned int)AcpiWheaMce, (unsigned int)AcpiWheaCmc,
(unsigned int)DmiTable, (unsigned int)AcpiPstate,
(unsigned int)AcpiSrat, (unsigned int)AcpiSlit,
(unsigned int)AcpiWheaMce, (unsigned int)AcpiWheaCmc,
(unsigned int)AcpiAlib, (unsigned int)AcpiIvrs, __func__);
/* AmdReleaseStruct (&AmdParamStruct); */
@ -420,8 +425,8 @@ static int agesa_locate_stage_file(const char *name, struct region_device *rdev)
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;

View File

@ -113,17 +113,31 @@ AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
while (FreedNodeOffset != 0) { /* todo: simplify this */
FreedNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr
+ FreedNodeOffset);
if (FreedNodePtr->BufferSize >= (AllocParams->BufferLength + sizeof(BIOS_BUFFER_NODE))) {
if (FreedNodePtr->BufferSize >=
(AllocParams->BufferLength +
sizeof(BIOS_BUFFER_NODE))) {
if (BestFitNodeOffset == 0) {
/* First node that fits the requested buffer size */
/*
* First node that fits the requested
* buffer size
*/
BestFitNodeOffset = FreedNodeOffset;
BestFitPrevNodeOffset = PrevNodeOffset;
} else {
/* Find out whether current node is a better fit than the previous nodes */
BestFitNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr + BestFitNodeOffset);
if (BestFitNodePtr->BufferSize > FreedNodePtr->BufferSize) {
BestFitNodeOffset = FreedNodeOffset;
BestFitPrevNodeOffset = PrevNodeOffset;
/*
* Find out whether current node is a
* betterfit than the previous nodes
*/
BestFitNodePtr = (BIOS_BUFFER_NODE *)
(BiosHeapBaseAddr +
BestFitNodeOffset);
if (BestFitNodePtr->BufferSize >
FreedNodePtr->BufferSize) {
BestFitNodeOffset =
FreedNodeOffset;
BestFitPrevNodeOffset =
PrevNodeOffset;
}
}
}
@ -132,65 +146,60 @@ AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
} /* end of while loop */
if (BestFitNodeOffset == 0) {
/* If we could not find a node that fits the requested
/*
* If we could not find a node that fits the requested
* buffer size, return AGESA_BOUNDS_CHK.
*/
return AGESA_BOUNDS_CHK;
} else {
BestFitNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr
+ BestFitNodeOffset);
BestFitPrevNodePtr = (BIOS_BUFFER_NODE *)
(BiosHeapBaseAddr
+ BestFitPrevNodeOffset);
/* If BestFitNode is larger than the requested buffer,
* fragment the node further
*/
if (BestFitNodePtr->BufferSize >
(AllocParams->BufferLength
+ sizeof(BIOS_BUFFER_NODE))) {
NextFreeOffset = BestFitNodeOffset
+ AllocParams->BufferLength
+ sizeof(BIOS_BUFFER_NODE);
NextFreePtr = (BIOS_BUFFER_NODE *)
(BiosHeapBaseAddr
+ NextFreeOffset);
NextFreePtr->BufferSize =
BestFitNodePtr->BufferSize
- (AllocParams->BufferLength
+ sizeof(BIOS_BUFFER_NODE));
NextFreePtr->NextNodeOffset =
BestFitNodePtr->NextNodeOffset;
} else {
/* Otherwise, next free node is
* NextNodeOffset of BestFitNode
*/
NextFreeOffset = BestFitNodePtr->NextNodeOffset;
}
/* If BestFitNode is the first buffer in the list, then
* update StartOfFreedNodes to reflect new free node.
*/
if (BestFitNodeOffset ==
BiosHeapBasePtr->StartOfFreedNodes)
BiosHeapBasePtr->StartOfFreedNodes =
NextFreeOffset;
else
BestFitPrevNodePtr->NextNodeOffset =
NextFreeOffset;
/* Add BestFitNode to the list of Allocated nodes */
CurrNodePtr->NextNodeOffset = BestFitNodeOffset;
BestFitNodePtr->BufferSize = AllocParams->BufferLength;
BestFitNodePtr->BufferHandle =
AllocParams->BufferHandle;
BestFitNodePtr->NextNodeOffset = 0;
/* Remove BestFitNode from list of Freed nodes */
AllocParams->BufferPointer = (UINT8 *)BestFitNodePtr
+ sizeof(BIOS_BUFFER_NODE);
}
BestFitNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr
+ BestFitNodeOffset);
BestFitPrevNodePtr = (BIOS_BUFFER_NODE *) (BiosHeapBaseAddr +
BestFitPrevNodeOffset);
/*
* If BestFitNode is larger than the requested buffer,
* fragment the node further
*/
if (BestFitNodePtr->BufferSize >
(AllocParams->BufferLength + sizeof(BIOS_BUFFER_NODE))) {
NextFreeOffset = BestFitNodeOffset +
AllocParams->BufferLength +
sizeof(BIOS_BUFFER_NODE);
NextFreePtr = (BIOS_BUFFER_NODE *) (BiosHeapBaseAddr +
NextFreeOffset);
NextFreePtr->BufferSize = BestFitNodePtr->BufferSize -
(AllocParams->BufferLength +
sizeof(BIOS_BUFFER_NODE));
NextFreePtr->NextNodeOffset =
BestFitNodePtr->NextNodeOffset;
} else {
/*
* Otherwise, next free node is
* NextNodeOffset of BestFitNode
*/
NextFreeOffset = BestFitNodePtr->NextNodeOffset;
}
/*
* If BestFitNode is the first buffer in the list, then
* update StartOfFreedNodes to reflect new free node.
*/
if (BestFitNodeOffset == BiosHeapBasePtr->StartOfFreedNodes)
BiosHeapBasePtr->StartOfFreedNodes = NextFreeOffset;
else
BestFitPrevNodePtr->NextNodeOffset = NextFreeOffset;
/* Add BestFitNode to the list of Allocated nodes */
CurrNodePtr->NextNodeOffset = BestFitNodeOffset;
BestFitNodePtr->BufferSize = AllocParams->BufferLength;
BestFitNodePtr->BufferHandle = AllocParams->BufferHandle;
BestFitNodePtr->NextNodeOffset = 0;
/* Remove BestFitNode from list of Freed nodes */
AllocParams->BufferPointer = (UINT8 *)BestFitNodePtr +
sizeof(BIOS_BUFFER_NODE);
}
return AGESA_SUCCESS;
@ -306,7 +315,8 @@ AGESA_STATUS agesa_DeallocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
* FreedNodePtr->NextNodeOffset; */
AllocNodePtr->NextNodeOffset = NextNodeOffset;
}
/* If deallocated node is adjacent to the previous node,
/*
* If deallocated node is adjacent to the previous node,
* concatenate both nodes.
*/
PrevNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr
@ -347,11 +357,10 @@ AGESA_STATUS agesa_LocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
AllocParams->BufferPointer = NULL;
AllocParams->BufferLength = 0;
return AGESA_BOUNDS_CHK;
} else {
AllocNodeOffset = AllocNodePtr->NextNodeOffset;
AllocNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr
+ AllocNodeOffset);
}
AllocNodeOffset = AllocNodePtr->NextNodeOffset;
AllocNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr +
AllocNodeOffset);
}
AllocParams->BufferPointer = (UINT8 *)((UINT8 *)AllocNodePtr