summaryrefslogtreecommitdiffstats
path: root/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c')
-rw-r--r--ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c73
1 files changed, 39 insertions, 34 deletions
diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
index 83f346157f..bb71fee649 100644
--- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
+++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
@@ -19,13 +19,13 @@
#include <Guid/EarlyPL011BaseAddress.h>
#include <Guid/FdtHob.h>
-STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2DiscoveredPpi = {
+STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2DiscoveredPpi = {
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gOvmfTpmDiscoveredPpiGuid,
NULL
};
-STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2InitializationDonePpi = {
+STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2InitializationDonePpi = {
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gPeiTpmInitializationDonePpiGuid,
NULL
@@ -37,33 +37,33 @@ PlatformPeim (
VOID
)
{
- VOID *Base;
- VOID *NewBase;
- UINTN FdtSize;
- UINTN FdtPages;
- UINT64 *FdtHobData;
- UINT64 *UartHobData;
- INT32 Node, Prev;
- INT32 Parent, Depth;
- CONST CHAR8 *Compatible;
- CONST CHAR8 *CompItem;
- CONST CHAR8 *NodeStatus;
- INT32 Len;
- INT32 RangesLen;
- INT32 StatusLen;
- CONST UINT64 *RegProp;
- CONST UINT32 *RangesProp;
- UINT64 UartBase;
- UINT64 TpmBase;
- EFI_STATUS Status;
-
- Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
+ VOID *Base;
+ VOID *NewBase;
+ UINTN FdtSize;
+ UINTN FdtPages;
+ UINT64 *FdtHobData;
+ UINT64 *UartHobData;
+ INT32 Node, Prev;
+ INT32 Parent, Depth;
+ CONST CHAR8 *Compatible;
+ CONST CHAR8 *CompItem;
+ CONST CHAR8 *NodeStatus;
+ INT32 Len;
+ INT32 RangesLen;
+ INT32 StatusLen;
+ CONST UINT64 *RegProp;
+ CONST UINT32 *RangesProp;
+ UINT64 UartBase;
+ UINT64 TpmBase;
+ EFI_STATUS Status;
+
+ Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
ASSERT (Base != NULL);
ASSERT (fdt_check_header (Base) == 0);
- FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
+ FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
- NewBase = AllocatePages (FdtPages);
+ NewBase = AllocatePages (FdtPages);
ASSERT (NewBase != NULL);
fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
@@ -82,7 +82,7 @@ PlatformPeim (
//
Parent = 0;
- for (Prev = Depth = 0;; Prev = Node) {
+ for (Prev = Depth = 0; ; Prev = Node) {
Node = fdt_next_node (Base, Prev, &Depth);
if (Node < 0) {
break;
@@ -98,11 +98,11 @@ PlatformPeim (
// Iterate over the NULL-separated items in the compatible string
//
for (CompItem = Compatible; CompItem != NULL && CompItem < Compatible + Len;
- CompItem += 1 + AsciiStrLen (CompItem)) {
-
+ CompItem += 1 + AsciiStrLen (CompItem))
+ {
if (AsciiStrCmp (CompItem, "arm,pl011") == 0) {
NodeStatus = fdt_getprop (Base, Node, "status", &StatusLen);
- if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {
+ if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {
continue;
}
@@ -116,8 +116,8 @@ PlatformPeim (
*UartHobData = UartBase;
break;
} else if (FeaturePcdGet (PcdTpm2SupportEnabled) &&
- AsciiStrCmp (CompItem, "tcg,tpm-tis-mmio") == 0) {
-
+ (AsciiStrCmp (CompItem, "tcg,tpm-tis-mmio") == 0))
+ {
RegProp = fdt_getprop (Base, Node, "reg", &Len);
ASSERT (Len == 8 || Len == 16);
if (Len == 8) {
@@ -145,9 +145,12 @@ PlatformPeim (
// assume a single translated range with 2 cells for the parent base
//
if (RangesLen != Len + 2 * sizeof (UINT32)) {
- DEBUG ((DEBUG_WARN,
+ DEBUG ((
+ DEBUG_WARN,
"%a: 'ranges' property has unexpected size %d\n",
- __FUNCTION__, RangesLen));
+ __FUNCTION__,
+ RangesLen
+ ));
break;
}
@@ -161,9 +164,10 @@ PlatformPeim (
// advance RangesProp to the parent bus address
//
RangesProp = (UINT32 *)((UINT8 *)RangesProp + Len / 2);
- TpmBase += fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RangesProp));
+ TpmBase += fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RangesProp));
}
}
+
break;
}
}
@@ -180,6 +184,7 @@ PlatformPeim (
} else {
Status = PeiServicesInstallPpi (&mTpm2InitializationDonePpi);
}
+
ASSERT_EFI_ERROR (Status);
}