summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorRichard Spiegel <richard.spiegel@silverbackltd.com>2017-12-11 16:23:58 -0700
committerMartin Roth <martinroth@google.com>2018-01-02 20:43:07 +0000
commitfc511277a57857fe5fd41bf0d877d1dd17f3b92f (patch)
tree2891ae152f7bd1be34c0e12e4bd80d005167d020 /src/soc
parent5abe2d14721f1a2292b330fb9c6d52d405e092bf (diff)
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>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/amd/common/block/pi/agesawrapper.c21
-rw-r--r--src/soc/amd/common/block/pi/heapmanager.c137
2 files changed, 86 insertions, 72 deletions
diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c
index 7fb5485fe5..f2327f1679 100644
--- a/src/soc/amd/common/block/pi/agesawrapper.c
+++ b/src/soc/amd/common/block/pi/agesawrapper.c
@@ -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;
diff --git a/src/soc/amd/common/block/pi/heapmanager.c b/src/soc/amd/common/block/pi/heapmanager.c
index bda521f07f..cea3171aa5 100644
--- a/src/soc/amd/common/block/pi/heapmanager.c
+++ b/src/soc/amd/common/block/pi/heapmanager.c
@@ -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;
- }
+ BestFitNodePtr = (BIOS_BUFFER_NODE *)(BiosHeapBaseAddr
+ + BestFitNodeOffset);
+ BestFitPrevNodePtr = (BIOS_BUFFER_NODE *) (BiosHeapBaseAddr +
+ BestFitPrevNodeOffset);
- /* If BestFitNode is the first buffer in the list, then
- * update StartOfFreedNodes to reflect new free node.
+ /*
+ * 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
*/
- 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);
+ 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