VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;\r
+ EFI_STATUS Status;\r
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;\r
\r
Status = gBS->LocateProtocol (\r
&gEfiAcpiTableProtocolGuid,\r
NULL,\r
- (VOID**)&AcpiTable\r
+ (VOID **)&AcpiTable\r
);\r
ASSERT_EFI_ERROR (Status);\r
return AcpiTable;\r
EFI_STATUS\r
EFIAPI\r
InstallCloudHvAcpiTables (\r
- IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol\r
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol\r
)\r
{\r
- UINTN InstalledKey;\r
- UINTN TableSize;\r
- UINTN AcpiTableLength;\r
- UINT64 RsdpPtr;\r
- UINT64 XsdtPtr;\r
- UINT64 TableOffset;\r
- UINT64 AcpiTablePtr;\r
- UINT64 *DsdtPtr;\r
- EFI_STATUS Status;\r
+ UINTN InstalledKey;\r
+ UINTN TableSize;\r
+ UINTN AcpiTableLength;\r
+ UINT64 RsdpPtr;\r
+ UINT64 XsdtPtr;\r
+ UINT64 TableOffset;\r
+ UINT64 AcpiTablePtr;\r
+ UINT64 *DsdtPtr;\r
+ EFI_STATUS Status;\r
\r
if (AcpiProtocol == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- RsdpPtr = PcdGet64 (PcdCloudHvAcpiRsdpBaseAddress);\r
- XsdtPtr = ((EFI_ACPI_6_3_ROOT_SYSTEM_DESCRIPTION_POINTER *)RsdpPtr)->XsdtAddress;\r
+ RsdpPtr = PcdGet64 (PcdCloudHvAcpiRsdpBaseAddress);\r
+ XsdtPtr = ((EFI_ACPI_6_3_ROOT_SYSTEM_DESCRIPTION_POINTER *)RsdpPtr)->XsdtAddress;\r
AcpiTableLength = ((EFI_ACPI_COMMON_HEADER *)XsdtPtr)->Length;\r
- TableOffset = sizeof (EFI_ACPI_DESCRIPTION_HEADER);\r
- DsdtPtr = NULL;\r
+ TableOffset = sizeof (EFI_ACPI_DESCRIPTION_HEADER);\r
+ DsdtPtr = NULL;\r
\r
while (TableOffset < AcpiTableLength) {\r
AcpiTablePtr = *(UINT64 *)(XsdtPtr + TableOffset);\r
- TableSize = ((EFI_ACPI_COMMON_HEADER *)AcpiTablePtr)->Length;\r
+ TableSize = ((EFI_ACPI_COMMON_HEADER *)AcpiTablePtr)->Length;\r
\r
//\r
// Install ACPI tables from XSDT\r
&InstalledKey\r
);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ return Status;\r
}\r
\r
//\r
//\r
if ((DsdtPtr == NULL) &&\r
(EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE ==\r
- ((EFI_ACPI_COMMON_HEADER *)AcpiTablePtr)->Signature)) {\r
+ ((EFI_ACPI_COMMON_HEADER *)AcpiTablePtr)->Signature))\r
+ {\r
DsdtPtr = (UINT64 *)((EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE *)AcpiTablePtr)->XDsdt;\r
}\r
\r
// Install DSDT table\r
//\r
TableSize = ((EFI_ACPI_COMMON_HEADER *)DsdtPtr)->Length;\r
- Status = AcpiProtocol->InstallAcpiTable (\r
- AcpiProtocol,\r
- DsdtPtr,\r
- TableSize,\r
- &InstalledKey\r
- );\r
+ Status = AcpiProtocol->InstallAcpiTable (\r
+ AcpiProtocol,\r
+ DsdtPtr,\r
+ TableSize,\r
+ &InstalledKey\r
+ );\r
\r
return Status;\r
}\r
EFI_STATUS\r
EFIAPI\r
CloudHvAcpiPlatformEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = InstallCloudHvAcpiTables (FindAcpiTableProtocol ());\r
\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((\r
- DEBUG_ERROR,\r
- "%a: Fail to install Acpi table: %r\n",\r
- __FUNCTION__,\r
- Status\r
- ));\r
- CpuDeadLoop ();\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Fail to install Acpi table: %r\n",\r
+ __FUNCTION__,\r
+ Status\r
+ ));\r
+ CpuDeadLoop ();\r
}\r
\r
return EFI_SUCCESS;\r
EFI_STATUS\r
EFIAPI\r
PlatformHasAcpiDt (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
//\r
// If we fail to install any of the necessary protocols below, the OS will be\r
// unbootable anyway (due to lacking hardware description), so tolerate no\r
// errors here.\r
//\r
- if (MAX_UINTN == MAX_UINT64 &&\r
- !PcdGetBool (PcdForceNoAcpi)) {\r
+ if ((MAX_UINTN == MAX_UINT64) &&\r
+ !PcdGetBool (PcdForceNoAcpi))\r
+ {\r
Status = gBS->InstallProtocolInterface (\r
&ImageHandle,\r
&gEdkiiPlatformHasAcpiGuid,\r
#ifndef EARLY_16550_UART_BASE_ADDRESS_H__\r
#define EARLY_16550_UART_BASE_ADDRESS_H__\r
\r
-#define EARLY_16550_UART_BASE_ADDRESS_GUID { \\r
+#define EARLY_16550_UART_BASE_ADDRESS_GUID { \\r
0xea67ca3e, 0x1f54, 0x436b, { \\r
0x97, 0x88, 0xd4, 0xeb, 0x29, 0xc3, 0x42, 0x67 \\r
} \\r
}\r
\r
-extern EFI_GUID gEarly16550UartBaseAddressGuid;\r
+extern EFI_GUID gEarly16550UartBaseAddressGuid;\r
\r
#endif // EARLY_16550_UART_BASE_ADDRESS_H__\r
#ifndef __EARLY_PL011_BASE_ADDRESS_H__\r
#define __EARLY_PL011_BASE_ADDRESS_H__\r
\r
-#define EARLY_PL011_BASE_ADDRESS_GUID { \\r
+#define EARLY_PL011_BASE_ADDRESS_GUID {\\r
0xB199DEA9, 0xFD5C, 0x4A84, \\r
{ 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } \\r
}\r
\r
-extern EFI_GUID gEarlyPL011BaseAddressGuid;\r
+extern EFI_GUID gEarlyPL011BaseAddressGuid;\r
\r
#endif\r
VOID\r
EFIAPI\r
ArmVirtGetMemoryMap (\r
- OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
+ OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
);\r
\r
#endif\r
STATIC\r
EFI_STATUS\r
PlatformHasAcpiDt (\r
- IN EFI_HANDLE ImageHandle\r
+ IN EFI_HANDLE ImageHandle\r
)\r
{\r
if (!PcdGetBool (PcdForceNoAcpi)) {\r
EFI_STATUS\r
EFIAPI\r
KvmtoolPlatformDxeEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = PlatformHasAcpiDt (ImageHandle);\r
ASSERT_EFI_ERROR (Status);\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- UINTN Index;\r
+ UINTN Index;\r
\r
for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {\r
if (CompareGuid (&gEfiHobListGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) {\r
VOID *\r
EFIAPI\r
GetNextHob (\r
- IN UINT16 Type,\r
- IN CONST VOID *HobStart\r
+ IN UINT16 Type,\r
+ IN CONST VOID *HobStart\r
)\r
{\r
EFI_PEI_HOB_POINTERS Hob;\r
\r
ASSERT (HobStart != NULL);\r
\r
- Hob.Raw = (UINT8 *) HobStart;\r
+ Hob.Raw = (UINT8 *)HobStart;\r
//\r
// Parse the HOB list until end of list or matching type is found.\r
//\r
if (Hob.Header->HobType == Type) {\r
return Hob.Raw;\r
}\r
+\r
Hob.Raw = GET_NEXT_HOB (Hob);\r
}\r
+\r
return NULL;\r
}\r
\r
VOID *\r
EFIAPI\r
GetFirstHob (\r
- IN UINT16 Type\r
+ IN UINT16 Type\r
)\r
{\r
- VOID *HobList;\r
+ VOID *HobList;\r
\r
HobList = GetHobList ();\r
return GetNextHob (Type, HobList);\r
VOID *\r
EFIAPI\r
GetNextGuidHob (\r
- IN CONST EFI_GUID *Guid,\r
- IN CONST VOID *HobStart\r
+ IN CONST EFI_GUID *Guid,\r
+ IN CONST VOID *HobStart\r
)\r
{\r
EFI_PEI_HOB_POINTERS GuidHob;\r
\r
- GuidHob.Raw = (UINT8 *) HobStart;\r
+ GuidHob.Raw = (UINT8 *)HobStart;\r
while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {\r
if (CompareGuid (Guid, &GuidHob.Guid->Name)) {\r
break;\r
}\r
+\r
GuidHob.Raw = GET_NEXT_HOB (GuidHob);\r
}\r
+\r
return GuidHob.Raw;\r
}\r
\r
VOID *\r
EFIAPI\r
GetFirstGuidHob (\r
- IN CONST EFI_GUID *Guid\r
+ IN CONST EFI_GUID *Guid\r
)\r
{\r
- VOID *HobList;\r
+ VOID *HobList;\r
\r
HobList = GetHobList ();\r
return GetNextGuidHob (Guid, HobList);\r
VOID\r
)\r
{\r
- EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
+ EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
\r
- HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();\r
+ HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList ();\r
\r
- return HandOffHob->BootMode;\r
+ return HandOffHob->BootMode;\r
}\r
\r
/**\r
VOID\r
EFIAPI\r
BuildModuleHob (\r
- IN CONST EFI_GUID *ModuleName,\r
- IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r
- IN UINT64 ModuleLength,\r
- IN EFI_PHYSICAL_ADDRESS EntryPoint\r
+ IN CONST EFI_GUID *ModuleName,\r
+ IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r
+ IN UINT64 ModuleLength,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint\r
)\r
{\r
//\r
VOID *\r
EFIAPI\r
BuildGuidHob (\r
- IN CONST EFI_GUID *Guid,\r
- IN UINTN DataLength\r
+ IN CONST EFI_GUID *Guid,\r
+ IN UINTN DataLength\r
)\r
{\r
//\r
VOID *\r
EFIAPI\r
BuildGuidDataHob (\r
- IN CONST EFI_GUID *Guid,\r
- IN VOID *Data,\r
- IN UINTN DataLength\r
+ IN CONST EFI_GUID *Guid,\r
+ IN VOID *Data,\r
+ IN UINTN DataLength\r
)\r
{\r
//\r
VOID\r
EFIAPI\r
BuildFvHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
)\r
{\r
//\r
VOID\r
EFIAPI\r
BuildFv2Hob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN CONST EFI_GUID *FvName,\r
- IN CONST EFI_GUID *FileName\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN CONST EFI_GUID *FvName,\r
+ IN CONST EFI_GUID *FileName\r
)\r
{\r
ASSERT (FALSE);\r
VOID\r
EFIAPI\r
BuildFv3Hob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN UINT32 AuthenticationStatus,\r
- IN BOOLEAN ExtractedFv,\r
- IN CONST EFI_GUID *FvName OPTIONAL,\r
- IN CONST EFI_GUID *FileName OPTIONAL\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN UINT32 AuthenticationStatus,\r
+ IN BOOLEAN ExtractedFv,\r
+ IN CONST EFI_GUID *FvName OPTIONAL,\r
+ IN CONST EFI_GUID *FileName OPTIONAL\r
)\r
{\r
ASSERT (FALSE);\r
VOID\r
EFIAPI\r
BuildCvHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
)\r
{\r
//\r
VOID\r
EFIAPI\r
BuildCpuHob (\r
- IN UINT8 SizeOfMemorySpace,\r
- IN UINT8 SizeOfIoSpace\r
+ IN UINT8 SizeOfMemorySpace,\r
+ IN UINT8 SizeOfIoSpace\r
)\r
{\r
//\r
VOID\r
EFIAPI\r
BuildStackHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
)\r
{\r
//\r
VOID\r
EFIAPI\r
BuildBspStoreHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN EFI_MEMORY_TYPE MemoryType\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
)\r
{\r
//\r
VOID\r
EFIAPI\r
BuildMemoryAllocationHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN EFI_MEMORY_TYPE MemoryType\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
)\r
{\r
//\r
\r
#include <Protocol/FdtClient.h>\r
\r
-STATIC ARM_GIC_ARCH_REVISION mGicArchRevision;\r
+STATIC ARM_GIC_ARCH_REVISION mGicArchRevision;\r
\r
RETURN_STATUS\r
EFIAPI\r
VOID\r
)\r
{\r
- UINT32 IccSre;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- CONST UINT64 *Reg;\r
- UINT32 RegSize;\r
- UINTN AddressCells, SizeCells;\r
- UINTN GicRevision;\r
- EFI_STATUS Status;\r
- UINT64 DistBase, CpuBase, RedistBase;\r
- RETURN_STATUS PcdStatus;\r
-\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ UINT32 IccSre;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ CONST UINT64 *Reg;\r
+ UINT32 RegSize;\r
+ UINTN AddressCells, SizeCells;\r
+ UINTN GicRevision;\r
+ EFI_STATUS Status;\r
+ UINT64 DistBase, CpuBase, RedistBase;\r
+ RETURN_STATUS PcdStatus;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
GicRevision = 2;\r
- Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,cortex-a15-gic",\r
- (CONST VOID **)&Reg, &AddressCells, &SizeCells,\r
- &RegSize);\r
+ Status = FdtClient->FindCompatibleNodeReg (\r
+ FdtClient,\r
+ "arm,cortex-a15-gic",\r
+ (CONST VOID **)&Reg,\r
+ &AddressCells,\r
+ &SizeCells,\r
+ &RegSize\r
+ );\r
if (Status == EFI_NOT_FOUND) {\r
GicRevision = 3;\r
- Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,gic-v3",\r
- (CONST VOID **)&Reg, &AddressCells, &SizeCells,\r
- &RegSize);\r
+ Status = FdtClient->FindCompatibleNodeReg (\r
+ FdtClient,\r
+ "arm,gic-v3",\r
+ (CONST VOID **)&Reg,\r
+ &AddressCells,\r
+ &SizeCells,\r
+ &RegSize\r
+ );\r
}\r
+\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
switch (GicRevision) {\r
-\r
- case 3:\r
- //\r
- // The GIC v3 DT binding describes a series of at least 3 physical (base\r
- // addresses, size) pairs: the distributor interface (GICD), at least one\r
- // redistributor region (GICR) containing dedicated redistributor\r
- // interfaces for all individual CPUs, and the CPU interface (GICC).\r
- // Under virtualization, we assume that the first redistributor region\r
- // listed covers the boot CPU. Also, our GICv3 driver only supports the\r
- // system register CPU interface, so we can safely ignore the MMIO version\r
- // which is listed after the sequence of redistributor interfaces.\r
- // This means we are only interested in the first two memory regions\r
- // supplied, and ignore everything else.\r
- //\r
- ASSERT (RegSize >= 32);\r
-\r
- // RegProp[0..1] == { GICD base, GICD size }\r
- DistBase = SwapBytes64 (Reg[0]);\r
- ASSERT (DistBase < MAX_UINTN);\r
-\r
- // RegProp[2..3] == { GICR base, GICR size }\r
- RedistBase = SwapBytes64 (Reg[2]);\r
- ASSERT (RedistBase < MAX_UINTN);\r
-\r
- PcdStatus = PcdSet64S (PcdGicDistributorBase, DistBase);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
- PcdStatus = PcdSet64S (PcdGicRedistributorsBase, RedistBase);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
-\r
- DEBUG ((DEBUG_INFO, "Found GIC v3 (re)distributor @ 0x%Lx (0x%Lx)\n",\r
- DistBase, RedistBase));\r
-\r
- //\r
- // The default implementation of ArmGicArchLib is responsible for enabling\r
- // the system register interface on the GICv3 if one is found. So let's do\r
- // the same here.\r
- //\r
- IccSre = ArmGicV3GetControlSystemRegisterEnable ();\r
- if (!(IccSre & ICC_SRE_EL2_SRE)) {\r
- ArmGicV3SetControlSystemRegisterEnable (IccSre | ICC_SRE_EL2_SRE);\r
+ case 3:\r
+ //\r
+ // The GIC v3 DT binding describes a series of at least 3 physical (base\r
+ // addresses, size) pairs: the distributor interface (GICD), at least one\r
+ // redistributor region (GICR) containing dedicated redistributor\r
+ // interfaces for all individual CPUs, and the CPU interface (GICC).\r
+ // Under virtualization, we assume that the first redistributor region\r
+ // listed covers the boot CPU. Also, our GICv3 driver only supports the\r
+ // system register CPU interface, so we can safely ignore the MMIO version\r
+ // which is listed after the sequence of redistributor interfaces.\r
+ // This means we are only interested in the first two memory regions\r
+ // supplied, and ignore everything else.\r
+ //\r
+ ASSERT (RegSize >= 32);\r
+\r
+ // RegProp[0..1] == { GICD base, GICD size }\r
+ DistBase = SwapBytes64 (Reg[0]);\r
+ ASSERT (DistBase < MAX_UINTN);\r
+\r
+ // RegProp[2..3] == { GICR base, GICR size }\r
+ RedistBase = SwapBytes64 (Reg[2]);\r
+ ASSERT (RedistBase < MAX_UINTN);\r
+\r
+ PcdStatus = PcdSet64S (PcdGicDistributorBase, DistBase);\r
+ ASSERT_RETURN_ERROR (PcdStatus);\r
+ PcdStatus = PcdSet64S (PcdGicRedistributorsBase, RedistBase);\r
+ ASSERT_RETURN_ERROR (PcdStatus);\r
+\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "Found GIC v3 (re)distributor @ 0x%Lx (0x%Lx)\n",\r
+ DistBase,\r
+ RedistBase\r
+ ));\r
+\r
+ //\r
+ // The default implementation of ArmGicArchLib is responsible for enabling\r
+ // the system register interface on the GICv3 if one is found. So let's do\r
+ // the same here.\r
+ //\r
IccSre = ArmGicV3GetControlSystemRegisterEnable ();\r
- }\r
-\r
- //\r
- // Unlike the default implementation, there is no fall through to GICv2\r
- // mode if this GICv3 cannot be driven in native mode due to the fact\r
- // that the System Register interface is unavailable.\r
- //\r
- ASSERT (IccSre & ICC_SRE_EL2_SRE);\r
-\r
- mGicArchRevision = ARM_GIC_ARCH_REVISION_3;\r
- break;\r
-\r
- case 2:\r
- //\r
- // When the GICv2 is emulated with virtualization=on, it adds a virtual\r
- // set of control registers. This means the register property can be\r
- // either 32 or 64 bytes in size.\r
- //\r
- ASSERT ((RegSize == 32) || (RegSize == 64));\r
-\r
- DistBase = SwapBytes64 (Reg[0]);\r
- CpuBase = SwapBytes64 (Reg[2]);\r
- ASSERT (DistBase < MAX_UINTN);\r
- ASSERT (CpuBase < MAX_UINTN);\r
-\r
- PcdStatus = PcdSet64S (PcdGicDistributorBase, DistBase);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
- PcdStatus = PcdSet64S (PcdGicInterruptInterfaceBase, CpuBase);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
-\r
- DEBUG ((DEBUG_INFO, "Found GIC @ 0x%Lx/0x%Lx\n", DistBase, CpuBase));\r
-\r
- mGicArchRevision = ARM_GIC_ARCH_REVISION_2;\r
- break;\r
-\r
- default:\r
- DEBUG ((DEBUG_ERROR, "%a: No GIC revision specified!\n", __FUNCTION__));\r
- return RETURN_NOT_FOUND;\r
+ if (!(IccSre & ICC_SRE_EL2_SRE)) {\r
+ ArmGicV3SetControlSystemRegisterEnable (IccSre | ICC_SRE_EL2_SRE);\r
+ IccSre = ArmGicV3GetControlSystemRegisterEnable ();\r
+ }\r
+\r
+ //\r
+ // Unlike the default implementation, there is no fall through to GICv2\r
+ // mode if this GICv3 cannot be driven in native mode due to the fact\r
+ // that the System Register interface is unavailable.\r
+ //\r
+ ASSERT (IccSre & ICC_SRE_EL2_SRE);\r
+\r
+ mGicArchRevision = ARM_GIC_ARCH_REVISION_3;\r
+ break;\r
+\r
+ case 2:\r
+ //\r
+ // When the GICv2 is emulated with virtualization=on, it adds a virtual\r
+ // set of control registers. This means the register property can be\r
+ // either 32 or 64 bytes in size.\r
+ //\r
+ ASSERT ((RegSize == 32) || (RegSize == 64));\r
+\r
+ DistBase = SwapBytes64 (Reg[0]);\r
+ CpuBase = SwapBytes64 (Reg[2]);\r
+ ASSERT (DistBase < MAX_UINTN);\r
+ ASSERT (CpuBase < MAX_UINTN);\r
+\r
+ PcdStatus = PcdSet64S (PcdGicDistributorBase, DistBase);\r
+ ASSERT_RETURN_ERROR (PcdStatus);\r
+ PcdStatus = PcdSet64S (PcdGicInterruptInterfaceBase, CpuBase);\r
+ ASSERT_RETURN_ERROR (PcdStatus);\r
+\r
+ DEBUG ((DEBUG_INFO, "Found GIC @ 0x%Lx/0x%Lx\n", DistBase, CpuBase));\r
+\r
+ mGicArchRevision = ARM_GIC_ARCH_REVISION_2;\r
+ break;\r
+\r
+ default:\r
+ DEBUG ((DEBUG_ERROR, "%a: No GIC revision specified!\n", __FUNCTION__));\r
+ return RETURN_NOT_FOUND;\r
}\r
+\r
return RETURN_SUCCESS;\r
}\r
\r
// Get Virtual Memory Map from the Platform Library\r
ArmVirtGetMemoryMap (&MemoryTable);\r
\r
- //Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() the MMU Page Table resides in\r
+ // Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() the MMU Page Table resides in\r
// DRAM (even at the top of DRAM as it is the first permanent memory allocation)\r
Status = ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);\r
if (EFI_ERROR (Status)) {\r
EFI_STATUS\r
EFIAPI\r
MemoryPeim (\r
- IN EFI_PHYSICAL_ADDRESS UefiMemoryBase,\r
- IN UINT64 UefiMemorySize\r
+ IN EFI_PHYSICAL_ADDRESS UefiMemoryBase,\r
+ IN UINT64 UefiMemorySize\r
)\r
{\r
- EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;\r
- UINT64 SystemMemoryTop;\r
+ EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;\r
+ UINT64 SystemMemoryTop;\r
\r
// Ensure PcdSystemMemorySize has been set\r
ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);\r
// Now, the permanent memory has been installed, we can call AllocatePages()\r
//\r
ResourceAttributes = (\r
- EFI_RESOURCE_ATTRIBUTE_PRESENT |\r
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |\r
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |\r
- EFI_RESOURCE_ATTRIBUTE_TESTED\r
- );\r
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |\r
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |\r
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |\r
+ EFI_RESOURCE_ATTRIBUTE_TESTED\r
+ );\r
\r
SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) +\r
PcdGet64 (PcdSystemMemorySize);\r
\r
if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) {\r
BuildResourceDescriptorHob (\r
- EFI_RESOURCE_SYSTEM_MEMORY,\r
- ResourceAttributes,\r
- PcdGet64 (PcdSystemMemoryBase),\r
- (UINT64)MAX_ALLOC_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1\r
- );\r
+ EFI_RESOURCE_SYSTEM_MEMORY,\r
+ ResourceAttributes,\r
+ PcdGet64 (PcdSystemMemoryBase),\r
+ (UINT64)MAX_ALLOC_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1\r
+ );\r
BuildResourceDescriptorHob (\r
- EFI_RESOURCE_SYSTEM_MEMORY,\r
- ResourceAttributes,\r
- (UINT64)MAX_ALLOC_ADDRESS + 1,\r
- SystemMemoryTop - MAX_ALLOC_ADDRESS - 1\r
- );\r
+ EFI_RESOURCE_SYSTEM_MEMORY,\r
+ ResourceAttributes,\r
+ (UINT64)MAX_ALLOC_ADDRESS + 1,\r
+ SystemMemoryTop - MAX_ALLOC_ADDRESS - 1\r
+ );\r
} else {\r
BuildResourceDescriptorHob (\r
- EFI_RESOURCE_SYSTEM_MEMORY,\r
- ResourceAttributes,\r
- PcdGet64 (PcdSystemMemoryBase),\r
- PcdGet64 (PcdSystemMemorySize)\r
- );\r
+ EFI_RESOURCE_SYSTEM_MEMORY,\r
+ ResourceAttributes,\r
+ PcdGet64 (PcdSystemMemoryBase),\r
+ PcdGet64 (PcdSystemMemorySize)\r
+ );\r
}\r
\r
//\r
// that the contents we put there with the caches and MMU off will still\r
// be visible after turning them on.\r
//\r
- InvalidateDataCacheRange ((VOID*)(UINTN)UefiMemoryBase, UefiMemorySize);\r
+ InvalidateDataCacheRange ((VOID *)(UINTN)UefiMemoryBase, UefiMemorySize);\r
\r
// Build Memory Allocation Hob\r
InitMmu ();\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- INT32 Node;\r
- CONST UINT64 *Reg;\r
- UINT32 RegSize;\r
- UINT64 RegBase;\r
- RETURN_STATUS PcdStatus;\r
-\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ EFI_STATUS Status;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ INT32 Node;\r
+ CONST UINT64 *Reg;\r
+ UINT32 RegSize;\r
+ UINT64 RegBase;\r
+ RETURN_STATUS PcdStatus;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
Status = FdtClient->FindCompatibleNode (FdtClient, "arm,pl031", &Node);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_WARN, "%a: No 'arm,pl031' compatible DT node found\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_WARN,\r
+ "%a: No 'arm,pl031' compatible DT node found\n",\r
+ __FUNCTION__\r
+ ));\r
return EFI_SUCCESS;\r
}\r
\r
- Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",\r
- (CONST VOID **)&Reg, &RegSize);\r
+ Status = FdtClient->GetNodeProperty (\r
+ FdtClient,\r
+ Node,\r
+ "reg",\r
+ (CONST VOID **)&Reg,\r
+ &RegSize\r
+ );\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_WARN,\r
+ DEBUG ((\r
+ DEBUG_WARN,\r
"%a: No 'reg' property found in 'arm,pl031' compatible DT node\n",\r
- __FUNCTION__));\r
+ __FUNCTION__\r
+ ));\r
return EFI_SUCCESS;\r
}\r
\r
// need to disable it in the device tree to prevent the OS from attaching\r
// its device driver as well.\r
//\r
- Status = FdtClient->SetNodeProperty (FdtClient, Node, "status",\r
- "disabled", sizeof ("disabled"));\r
+ Status = FdtClient->SetNodeProperty (\r
+ FdtClient,\r
+ Node,\r
+ "status",\r
+ "disabled",\r
+ sizeof ("disabled")\r
+ );\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_WARN, "Failed to set PL031 status to 'disabled'\n"));\r
+ DEBUG ((DEBUG_WARN, "Failed to set PL031 status to 'disabled'\n"));\r
}\r
\r
return EFI_SUCCESS;\r
\r
#pragma pack(1)\r
typedef struct {\r
- ACPI_HID_DEVICE_PATH AcpiDevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;\r
+ ACPI_HID_DEVICE_PATH AcpiDevicePath;\r
+ EFI_DEVICE_PATH_PROTOCOL EndDevicePath;\r
} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;\r
#pragma pack ()\r
\r
GLOBAL_REMOVE_IF_UNREFERENCED\r
-CHAR16 *mPciHostBridgeAcpiAddressSpaceTypeStr[] = {\r
+CHAR16 *mPciHostBridgeAcpiAddressSpaceTypeStr[] = {\r
L"Mem",\r
L"I/O",\r
L"Bus"\r
};\r
\r
-STATIC CONST EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {\r
+STATIC CONST EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {\r
{\r
{\r
ACPI_DEVICE_PATH,\r
ACPI_DP,\r
{\r
- (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),\r
- (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)\r
+ (UINT8)(sizeof (ACPI_HID_DEVICE_PATH)),\r
+ (UINT8)((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)\r
}\r
},\r
EISA_PNP_ID (0x0A03), // HID\r
- 0 // UID\r
+ 0 // UID\r
},\r
\r
{\r
}\r
};\r
\r
-\r
GLOBAL_REMOVE_IF_UNREFERENCED\r
-CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {\r
+CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {\r
L"Mem", L"I/O", L"Bus"\r
};\r
\r
-STATIC PCI_ROOT_BRIDGE mRootBridge;\r
+STATIC PCI_ROOT_BRIDGE mRootBridge;\r
\r
/**\r
Utility function to return all the root bridge instances in an array.\r
PCI_ROOT_BRIDGE *\r
EFIAPI\r
PciHostBridgeUtilityGetRootBridges (\r
- OUT UINTN *Count,\r
- IN UINT64 Attributes,\r
- IN UINT64 AllocationAttributes,\r
- IN BOOLEAN DmaAbove4G,\r
- IN BOOLEAN NoExtendedConfigSpace,\r
- IN UINTN BusMin,\r
- IN UINTN BusMax,\r
- IN PCI_ROOT_BRIDGE_APERTURE *Io,\r
- IN PCI_ROOT_BRIDGE_APERTURE *Mem,\r
- IN PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,\r
- IN PCI_ROOT_BRIDGE_APERTURE *PMem,\r
- IN PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G\r
+ OUT UINTN *Count,\r
+ IN UINT64 Attributes,\r
+ IN UINT64 AllocationAttributes,\r
+ IN BOOLEAN DmaAbove4G,\r
+ IN BOOLEAN NoExtendedConfigSpace,\r
+ IN UINTN BusMin,\r
+ IN UINTN BusMax,\r
+ IN PCI_ROOT_BRIDGE_APERTURE *Io,\r
+ IN PCI_ROOT_BRIDGE_APERTURE *Mem,\r
+ IN PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,\r
+ IN PCI_ROOT_BRIDGE_APERTURE *PMem,\r
+ IN PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G\r
)\r
{\r
if ((Count == NULL) ||\r
(Mem == NULL) ||\r
(MemAbove4G == NULL) ||\r
(PMem == NULL) ||\r
- (PMemAbove4G == NULL)) {\r
+ (PMemAbove4G == NULL))\r
+ {\r
return NULL;\r
}\r
\r
-\r
*Count = 1;\r
\r
- mRootBridge.Segment = 0;\r
- mRootBridge.Supports = Attributes;\r
- mRootBridge.Attributes = Attributes;\r
+ mRootBridge.Segment = 0;\r
+ mRootBridge.Supports = Attributes;\r
+ mRootBridge.Attributes = Attributes;\r
\r
mRootBridge.DmaAbove4G = DmaAbove4G;\r
mRootBridge.NoExtendedConfigSpace = NoExtendedConfigSpace;\r
mRootBridge.ResourceAssigned = FALSE;\r
\r
- mRootBridge.AllocationAttributes = AllocationAttributes;\r
-\r
- mRootBridge.Bus.Base = BusMin;\r
- mRootBridge.Bus.Limit = BusMax;\r
- mRootBridge.Io.Base = Io->Base;\r
- mRootBridge.Io.Limit = Io->Limit;\r
- mRootBridge.Mem.Base = Mem->Base;\r
- mRootBridge.Mem.Limit = Mem->Limit;\r
- mRootBridge.MemAbove4G.Base = MemAbove4G->Base;\r
- mRootBridge.MemAbove4G.Limit = MemAbove4G->Limit;\r
- mRootBridge.PMem.Base = PMem->Base;\r
- mRootBridge.PMem.Limit = PMem->Limit;\r
- mRootBridge.PMemAbove4G.Base = PMemAbove4G->Base;\r
- mRootBridge.PMemAbove4G.Limit = PMemAbove4G->Limit;\r
+ mRootBridge.AllocationAttributes = AllocationAttributes;\r
+\r
+ mRootBridge.Bus.Base = BusMin;\r
+ mRootBridge.Bus.Limit = BusMax;\r
+ mRootBridge.Io.Base = Io->Base;\r
+ mRootBridge.Io.Limit = Io->Limit;\r
+ mRootBridge.Mem.Base = Mem->Base;\r
+ mRootBridge.Mem.Limit = Mem->Limit;\r
+ mRootBridge.MemAbove4G.Base = MemAbove4G->Base;\r
+ mRootBridge.MemAbove4G.Limit = MemAbove4G->Limit;\r
+ mRootBridge.PMem.Base = PMem->Base;\r
+ mRootBridge.PMem.Limit = PMem->Limit;\r
+ mRootBridge.PMemAbove4G.Base = PMemAbove4G->Base;\r
+ mRootBridge.PMemAbove4G.Limit = PMemAbove4G->Limit;\r
\r
mRootBridge.DevicePath =\r
- (EFI_DEVICE_PATH_PROTOCOL*)&mEfiPciRootBridgeDevicePath;\r
+ (EFI_DEVICE_PATH_PROTOCOL *)&mEfiPciRootBridgeDevicePath;\r
\r
return &mRootBridge;\r
}\r
VOID\r
EFIAPI\r
PciHostBridgeUtilityFreeRootBridges (\r
- IN PCI_ROOT_BRIDGE *Bridges,\r
- IN UINTN Count\r
+ IN PCI_ROOT_BRIDGE *Bridges,\r
+ IN UINTN Count\r
)\r
{\r
// Nothing to do here.\r
IN VOID *Configuration\r
)\r
{\r
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;\r
- UINTN RootBridgeIndex;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;\r
+ UINTN RootBridgeIndex;\r
+\r
DEBUG ((DEBUG_ERROR, "PciHostBridge: Resource conflict happens!\n"));\r
\r
RootBridgeIndex = 0;\r
- Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR*)Configuration;\r
+ Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Configuration;\r
while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {\r
DEBUG ((DEBUG_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));\r
- for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {\r
- ASSERT (Descriptor->ResType <\r
- ARRAY_SIZE (mPciHostBridgeAcpiAddressSpaceTypeStr)\r
- );\r
+ for ( ; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {\r
+ ASSERT (\r
+ Descriptor->ResType <\r
+ ARRAY_SIZE (mPciHostBridgeAcpiAddressSpaceTypeStr)\r
+ );\r
DEBUG ((\r
DEBUG_ERROR,\r
" %s: Length/Alignment = 0x%lx / 0x%lx\n",\r
));\r
}\r
}\r
+\r
//\r
// Skip the END descriptor for root bridge\r
//\r
ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR);\r
- Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR*)(\r
- (EFI_ACPI_END_TAG_DESCRIPTOR*)Descriptor + 1\r
- );\r
+ Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(\r
+ (EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1\r
+ );\r
}\r
}\r
\r
#include <Protocol/FdtClient.h>\r
\r
-STATIC UINT32 mArmPsciMethod;\r
+STATIC UINT32 mArmPsciMethod;\r
\r
RETURN_STATUS\r
EFIAPI\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- CONST VOID *Prop;\r
-\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ EFI_STATUS Status;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ CONST VOID *Prop;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
- Status = FdtClient->FindCompatibleNodeProperty (FdtClient, "arm,psci-0.2",\r
- "method", &Prop, NULL);\r
+ Status = FdtClient->FindCompatibleNodeProperty (\r
+ FdtClient,\r
+ "arm,psci-0.2",\r
+ "method",\r
+ &Prop,\r
+ NULL\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
} else if (AsciiStrnCmp (Prop, "smc", 3) == 0) {\r
mArmPsciMethod = 2;\r
} else {\r
- DEBUG ((DEBUG_ERROR, "%a: Unknown PSCI method \"%a\"\n", __FUNCTION__,\r
- Prop));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Unknown PSCI method \"%a\"\n",\r
+ __FUNCTION__,\r
+ Prop\r
+ ));\r
return EFI_NOT_FOUND;\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
VOID\r
)\r
{\r
- ARM_SMC_ARGS ArmSmcArgs;\r
- ARM_HVC_ARGS ArmHvcArgs;\r
+ ARM_SMC_ARGS ArmSmcArgs;\r
+ ARM_HVC_ARGS ArmHvcArgs;\r
\r
// Send a PSCI 0.2 SYSTEM_RESET command\r
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;\r
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;\r
\r
switch (mArmPsciMethod) {\r
- case 1:\r
- ArmCallHvc (&ArmHvcArgs);\r
- break;\r
+ case 1:\r
+ ArmCallHvc (&ArmHvcArgs);\r
+ break;\r
\r
- case 2:\r
- ArmCallSmc (&ArmSmcArgs);\r
- break;\r
+ case 2:\r
+ ArmCallSmc (&ArmSmcArgs);\r
+ break;\r
\r
- default:\r
- DEBUG ((DEBUG_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));\r
+ default:\r
+ DEBUG ((DEBUG_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));\r
}\r
}\r
\r
VOID\r
)\r
{\r
- ARM_SMC_ARGS ArmSmcArgs;\r
- ARM_HVC_ARGS ArmHvcArgs;\r
+ ARM_SMC_ARGS ArmSmcArgs;\r
+ ARM_HVC_ARGS ArmHvcArgs;\r
\r
// Send a PSCI 0.2 SYSTEM_OFF command\r
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;\r
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;\r
\r
switch (mArmPsciMethod) {\r
- case 1:\r
- ArmCallHvc (&ArmHvcArgs);\r
- break;\r
+ case 1:\r
+ ArmCallHvc (&ArmHvcArgs);\r
+ break;\r
\r
- case 2:\r
- ArmCallSmc (&ArmSmcArgs);\r
- break;\r
+ case 2:\r
+ ArmCallSmc (&ArmSmcArgs);\r
+ break;\r
\r
- default:\r
- DEBUG ((DEBUG_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));\r
+ default:\r
+ DEBUG ((DEBUG_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));\r
}\r
}\r
\r
VOID\r
EFIAPI\r
ResetPlatformSpecific (\r
- IN UINTN DataSize,\r
- IN VOID *ResetData\r
+ IN UINTN DataSize,\r
+ IN VOID *ResetData\r
)\r
{\r
// Map the platform specific reset as reboot\r
VOID\r
EFIAPI\r
ResetSystem (\r
- IN EFI_RESET_TYPE ResetType,\r
- IN EFI_STATUS ResetStatus,\r
- IN UINTN DataSize,\r
- IN VOID *ResetData OPTIONAL\r
+ IN EFI_RESET_TYPE ResetType,\r
+ IN EFI_STATUS ResetStatus,\r
+ IN UINTN DataSize,\r
+ IN VOID *ResetData OPTIONAL\r
)\r
{\r
switch (ResetType) {\r
- case EfiResetWarm:\r
- ResetWarm ();\r
- break;\r
+ case EfiResetWarm:\r
+ ResetWarm ();\r
+ break;\r
\r
- case EfiResetCold:\r
- ResetCold ();\r
- break;\r
+ case EfiResetCold:\r
+ ResetCold ();\r
+ break;\r
\r
- case EfiResetShutdown:\r
- ResetShutdown ();\r
- return;\r
+ case EfiResetShutdown:\r
+ ResetShutdown ();\r
+ return;\r
\r
- case EfiResetPlatformSpecific:\r
- ResetPlatformSpecific (DataSize, ResetData);\r
- return;\r
+ case EfiResetPlatformSpecific:\r
+ ResetPlatformSpecific (DataSize, ResetData);\r
+ return;\r
\r
- default:\r
- return;\r
+ default:\r
+ return;\r
}\r
}\r
VOID\r
)\r
{\r
- VOID *DeviceTreeBase;\r
- INT32 Node, Prev;\r
- INT32 Len;\r
- CONST CHAR8 *Compatible;\r
- CONST CHAR8 *CompatibleItem;\r
- CONST VOID *Prop;\r
-\r
- DeviceTreeBase = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
+ VOID *DeviceTreeBase;\r
+ INT32 Node, Prev;\r
+ INT32 Len;\r
+ CONST CHAR8 *Compatible;\r
+ CONST CHAR8 *CompatibleItem;\r
+ CONST VOID *Prop;\r
+\r
+ DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
ASSERT (fdt_check_header (DeviceTreeBase) == 0);\r
\r
//\r
// Enumerate all FDT nodes looking for the PSCI node and capture the method\r
//\r
- for (Prev = 0;; Prev = Node) {\r
+ for (Prev = 0; ; Prev = Node) {\r
Node = fdt_next_node (DeviceTreeBase, Prev, NULL);\r
if (Node < 0) {\r
break;\r
// Iterate over the NULL-separated items in the compatible string\r
//\r
for (CompatibleItem = Compatible; CompatibleItem < Compatible + Len;\r
- CompatibleItem += 1 + AsciiStrLen (CompatibleItem)) {\r
-\r
+ CompatibleItem += 1 + AsciiStrLen (CompatibleItem))\r
+ {\r
if (AsciiStrCmp (CompatibleItem, "arm,psci-0.2") != 0) {\r
continue;\r
}\r
\r
Prop = fdt_getprop (DeviceTreeBase, Node, "method", NULL);\r
if (!Prop) {\r
- DEBUG ((DEBUG_ERROR, "%a: Missing PSCI method property\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Missing PSCI method property\n",\r
+ __FUNCTION__\r
+ ));\r
return PsciMethodUnknown;\r
}\r
\r
} else if (AsciiStrnCmp (Prop, "smc", 3) == 0) {\r
return PsciMethodSmc;\r
} else {\r
- DEBUG ((DEBUG_ERROR, "%a: Unknown PSCI method \"%a\"\n", __FUNCTION__,\r
- Prop));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Unknown PSCI method \"%a\"\n",\r
+ __FUNCTION__,\r
+ Prop\r
+ ));\r
return PsciMethodUnknown;\r
}\r
}\r
}\r
+\r
return PsciMethodUnknown;\r
}\r
\r
STATIC\r
VOID\r
PerformPsciAction (\r
- IN UINTN Arg0\r
+ IN UINTN Arg0\r
)\r
{\r
- ARM_SMC_ARGS ArmSmcArgs;\r
- ARM_HVC_ARGS ArmHvcArgs;\r
+ ARM_SMC_ARGS ArmSmcArgs;\r
+ ARM_HVC_ARGS ArmHvcArgs;\r
\r
ArmSmcArgs.Arg0 = Arg0;\r
ArmHvcArgs.Arg0 = Arg0;\r
\r
switch (DiscoverPsciMethod ()) {\r
- case PsciMethodHvc:\r
- ArmCallHvc (&ArmHvcArgs);\r
- break;\r
+ case PsciMethodHvc:\r
+ ArmCallHvc (&ArmHvcArgs);\r
+ break;\r
\r
- case PsciMethodSmc:\r
- ArmCallSmc (&ArmSmcArgs);\r
- break;\r
+ case PsciMethodSmc:\r
+ ArmCallSmc (&ArmSmcArgs);\r
+ break;\r
\r
- default:\r
- DEBUG ((DEBUG_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));\r
- ASSERT (FALSE);\r
+ default:\r
+ DEBUG ((DEBUG_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));\r
+ ASSERT (FALSE);\r
}\r
}\r
\r
VOID\r
EFIAPI\r
ResetPlatformSpecific (\r
- IN UINTN DataSize,\r
- IN VOID *ResetData\r
+ IN UINTN DataSize,\r
+ IN VOID *ResetData\r
)\r
{\r
// Map the platform specific reset as reboot\r
VOID\r
EFIAPI\r
ResetSystem (\r
- IN EFI_RESET_TYPE ResetType,\r
- IN EFI_STATUS ResetStatus,\r
- IN UINTN DataSize,\r
- IN VOID *ResetData OPTIONAL\r
+ IN EFI_RESET_TYPE ResetType,\r
+ IN EFI_STATUS ResetStatus,\r
+ IN UINTN DataSize,\r
+ IN VOID *ResetData OPTIONAL\r
)\r
{\r
switch (ResetType) {\r
- case EfiResetWarm:\r
- ResetWarm ();\r
- break;\r
+ case EfiResetWarm:\r
+ ResetWarm ();\r
+ break;\r
\r
- case EfiResetCold:\r
- ResetCold ();\r
- break;\r
+ case EfiResetCold:\r
+ ResetCold ();\r
+ break;\r
\r
- case EfiResetShutdown:\r
- ResetShutdown ();\r
- return;\r
+ case EfiResetShutdown:\r
+ ResetShutdown ();\r
+ return;\r
\r
- case EfiResetPlatformSpecific:\r
- ResetPlatformSpecific (DataSize, ResetData);\r
- return;\r
+ case EfiResetPlatformSpecific:\r
+ ResetPlatformSpecific (DataSize, ResetData);\r
+ return;\r
\r
- default:\r
- return;\r
+ default:\r
+ return;\r
}\r
}\r
\r
#pragma pack (1)\r
typedef struct {\r
- UINT32 Type;\r
- UINT32 Number;\r
- UINT32 Flags;\r
+ UINT32 Type;\r
+ UINT32 Number;\r
+ UINT32 Flags;\r
} INTERRUPT_PROPERTY;\r
#pragma pack ()\r
\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- CONST INTERRUPT_PROPERTY *InterruptProp;\r
- UINT32 PropSize;\r
- INT32 SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;\r
- RETURN_STATUS PcdStatus;\r
-\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ EFI_STATUS Status;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ CONST INTERRUPT_PROPERTY *InterruptProp;\r
+ UINT32 PropSize;\r
+ INT32 SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;\r
+ RETURN_STATUS PcdStatus;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
- Status = FdtClient->FindCompatibleNodeProperty (FdtClient, "arm,armv7-timer",\r
- "interrupts", (CONST VOID **)&InterruptProp,\r
- &PropSize);\r
+ Status = FdtClient->FindCompatibleNodeProperty (\r
+ FdtClient,\r
+ "arm,armv7-timer",\r
+ "interrupts",\r
+ (CONST VOID **)&InterruptProp,\r
+ &PropSize\r
+ );\r
if (Status == EFI_NOT_FOUND) {\r
- Status = FdtClient->FindCompatibleNodeProperty (FdtClient,\r
- "arm,armv8-timer", "interrupts",\r
+ Status = FdtClient->FindCompatibleNodeProperty (\r
+ FdtClient,\r
+ "arm,armv8-timer",\r
+ "interrupts",\r
(CONST VOID **)&InterruptProp,\r
- &PropSize);\r
+ &PropSize\r
+ );\r
}\r
\r
if (EFI_ERROR (Status)) {\r
VirtIntrNum = SwapBytes32 (InterruptProp[2].Number)\r
+ (InterruptProp[2].Type ? 16 : 0);\r
HypIntrNum = PropSize < 48 ? 0 : SwapBytes32 (InterruptProp[3].Number)\r
- + (InterruptProp[3].Type ? 16 : 0);\r
-\r
- DEBUG ((DEBUG_INFO, "Found Timer interrupts %d, %d, %d, %d\n",\r
- SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum));\r
+ + (InterruptProp[3].Type ? 16 : 0);\r
+\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "Found Timer interrupts %d, %d, %d, %d\n",\r
+ SecIntrNum,\r
+ IntrNum,\r
+ VirtIntrNum,\r
+ HypIntrNum\r
+ ));\r
\r
PcdStatus = PcdSet32S (PcdArmArchTimerSecIntrNum, SecIntrNum);\r
ASSERT_RETURN_ERROR (PcdStatus);\r
\r
**/\r
\r
-\r
#include <Base.h>\r
\r
#include <Library/BaseLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/PcdLib.h>\r
\r
-\r
/**\r
Assert the validity of a PCI address. A valid PCI address should contain 1's\r
only in the low 28 bits.\r
return RETURN_UNSUPPORTED;\r
}\r
\r
-STATIC UINT64 mPciExpressBaseAddress;\r
+STATIC UINT64 mPciExpressBaseAddress;\r
\r
RETURN_STATUS\r
EFIAPI\r
return RETURN_SUCCESS;\r
}\r
\r
-\r
/**\r
Gets the base address of PCI Express.\r
\r
@return The base address of PCI Express.\r
\r
**/\r
-VOID*\r
+VOID *\r
GetPciExpressBaseAddress (\r
VOID\r
)\r
{\r
- return (VOID*)(UINTN) mPciExpressBaseAddress;\r
+ return (VOID *)(UINTN)mPciExpressBaseAddress;\r
}\r
\r
/**\r
UINT8\r
EFIAPI\r
PciExpressRead8 (\r
- IN UINTN Address\r
+ IN UINTN Address\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioRead8 ((UINTN) GetPciExpressBaseAddress () + Address);\r
+ return MmioRead8 ((UINTN)GetPciExpressBaseAddress () + Address);\r
}\r
\r
/**\r
UINT8\r
EFIAPI\r
PciExpressWrite8 (\r
- IN UINTN Address,\r
- IN UINT8 Value\r
+ IN UINTN Address,\r
+ IN UINT8 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioWrite8 ((UINTN) GetPciExpressBaseAddress () + Address, Value);\r
+ return MmioWrite8 ((UINTN)GetPciExpressBaseAddress () + Address, Value);\r
}\r
\r
/**\r
UINT8\r
EFIAPI\r
PciExpressOr8 (\r
- IN UINTN Address,\r
- IN UINT8 OrData\r
+ IN UINTN Address,\r
+ IN UINT8 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioOr8 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);\r
+ return MmioOr8 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);\r
}\r
\r
/**\r
UINT8\r
EFIAPI\r
PciExpressAnd8 (\r
- IN UINTN Address,\r
- IN UINT8 AndData\r
+ IN UINTN Address,\r
+ IN UINT8 AndData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioAnd8 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);\r
+ return MmioAnd8 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);\r
}\r
\r
/**\r
UINT8\r
EFIAPI\r
PciExpressAndThenOr8 (\r
- IN UINTN Address,\r
- IN UINT8 AndData,\r
- IN UINT8 OrData\r
+ IN UINTN Address,\r
+ IN UINT8 AndData,\r
+ IN UINT8 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioAndThenOr8 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
AndData,\r
OrData\r
);\r
UINT8\r
EFIAPI\r
PciExpressBitFieldRead8 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldRead8 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit\r
);\r
UINT8\r
EFIAPI\r
PciExpressBitFieldWrite8 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT8 Value\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT8 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldWrite8 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
Value\r
UINT8\r
EFIAPI\r
PciExpressBitFieldOr8 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT8 OrData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT8 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldOr8 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
OrData\r
UINT8\r
EFIAPI\r
PciExpressBitFieldAnd8 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT8 AndData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT8 AndData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldAnd8 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
AndData\r
UINT8\r
EFIAPI\r
PciExpressBitFieldAndThenOr8 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT8 AndData,\r
- IN UINT8 OrData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT8 AndData,\r
+ IN UINT8 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldAndThenOr8 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
AndData,\r
UINT16\r
EFIAPI\r
PciExpressRead16 (\r
- IN UINTN Address\r
+ IN UINTN Address\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioRead16 ((UINTN) GetPciExpressBaseAddress () + Address);\r
+ return MmioRead16 ((UINTN)GetPciExpressBaseAddress () + Address);\r
}\r
\r
/**\r
UINT16\r
EFIAPI\r
PciExpressWrite16 (\r
- IN UINTN Address,\r
- IN UINT16 Value\r
+ IN UINTN Address,\r
+ IN UINT16 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioWrite16 ((UINTN) GetPciExpressBaseAddress () + Address, Value);\r
+ return MmioWrite16 ((UINTN)GetPciExpressBaseAddress () + Address, Value);\r
}\r
\r
/**\r
UINT16\r
EFIAPI\r
PciExpressOr16 (\r
- IN UINTN Address,\r
- IN UINT16 OrData\r
+ IN UINTN Address,\r
+ IN UINT16 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioOr16 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);\r
+ return MmioOr16 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);\r
}\r
\r
/**\r
UINT16\r
EFIAPI\r
PciExpressAnd16 (\r
- IN UINTN Address,\r
- IN UINT16 AndData\r
+ IN UINTN Address,\r
+ IN UINT16 AndData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioAnd16 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);\r
+ return MmioAnd16 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);\r
}\r
\r
/**\r
UINT16\r
EFIAPI\r
PciExpressAndThenOr16 (\r
- IN UINTN Address,\r
- IN UINT16 AndData,\r
- IN UINT16 OrData\r
+ IN UINTN Address,\r
+ IN UINT16 AndData,\r
+ IN UINT16 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioAndThenOr16 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
AndData,\r
OrData\r
);\r
UINT16\r
EFIAPI\r
PciExpressBitFieldRead16 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldRead16 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit\r
);\r
UINT16\r
EFIAPI\r
PciExpressBitFieldWrite16 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT16 Value\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT16 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldWrite16 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
Value\r
UINT16\r
EFIAPI\r
PciExpressBitFieldOr16 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT16 OrData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT16 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldOr16 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
OrData\r
UINT16\r
EFIAPI\r
PciExpressBitFieldAnd16 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT16 AndData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT16 AndData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldAnd16 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
AndData\r
UINT16\r
EFIAPI\r
PciExpressBitFieldAndThenOr16 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT16 AndData,\r
- IN UINT16 OrData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT16 AndData,\r
+ IN UINT16 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldAndThenOr16 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
AndData,\r
UINT32\r
EFIAPI\r
PciExpressRead32 (\r
- IN UINTN Address\r
+ IN UINTN Address\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioRead32 ((UINTN) GetPciExpressBaseAddress () + Address);\r
+ return MmioRead32 ((UINTN)GetPciExpressBaseAddress () + Address);\r
}\r
\r
/**\r
UINT32\r
EFIAPI\r
PciExpressWrite32 (\r
- IN UINTN Address,\r
- IN UINT32 Value\r
+ IN UINTN Address,\r
+ IN UINT32 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioWrite32 ((UINTN) GetPciExpressBaseAddress () + Address, Value);\r
+ return MmioWrite32 ((UINTN)GetPciExpressBaseAddress () + Address, Value);\r
}\r
\r
/**\r
UINT32\r
EFIAPI\r
PciExpressOr32 (\r
- IN UINTN Address,\r
- IN UINT32 OrData\r
+ IN UINTN Address,\r
+ IN UINT32 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioOr32 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);\r
+ return MmioOr32 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);\r
}\r
\r
/**\r
UINT32\r
EFIAPI\r
PciExpressAnd32 (\r
- IN UINTN Address,\r
- IN UINT32 AndData\r
+ IN UINTN Address,\r
+ IN UINT32 AndData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
- return MmioAnd32 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);\r
+ return MmioAnd32 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);\r
}\r
\r
/**\r
UINT32\r
EFIAPI\r
PciExpressAndThenOr32 (\r
- IN UINTN Address,\r
- IN UINT32 AndData,\r
- IN UINT32 OrData\r
+ IN UINTN Address,\r
+ IN UINT32 AndData,\r
+ IN UINT32 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioAndThenOr32 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
AndData,\r
OrData\r
);\r
UINT32\r
EFIAPI\r
PciExpressBitFieldRead32 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldRead32 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit\r
);\r
UINT32\r
EFIAPI\r
PciExpressBitFieldWrite32 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT32 Value\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT32 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldWrite32 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
Value\r
UINT32\r
EFIAPI\r
PciExpressBitFieldOr32 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT32 OrData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT32 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldOr32 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
OrData\r
UINT32\r
EFIAPI\r
PciExpressBitFieldAnd32 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT32 AndData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT32 AndData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldAnd32 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
AndData\r
UINT32\r
EFIAPI\r
PciExpressBitFieldAndThenOr32 (\r
- IN UINTN Address,\r
- IN UINTN StartBit,\r
- IN UINTN EndBit,\r
- IN UINT32 AndData,\r
- IN UINT32 OrData\r
+ IN UINTN Address,\r
+ IN UINTN StartBit,\r
+ IN UINTN EndBit,\r
+ IN UINT32 AndData,\r
+ IN UINT32 OrData\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address);\r
return MmioBitFieldAndThenOr32 (\r
- (UINTN) GetPciExpressBaseAddress () + Address,\r
+ (UINTN)GetPciExpressBaseAddress () + Address,\r
StartBit,\r
EndBit,\r
AndData,\r
UINTN\r
EFIAPI\r
PciExpressReadBuffer (\r
- IN UINTN StartAddress,\r
- IN UINTN Size,\r
- OUT VOID *Buffer\r
+ IN UINTN StartAddress,\r
+ IN UINTN Size,\r
+ OUT VOID *Buffer\r
)\r
{\r
- UINTN ReturnValue;\r
+ UINTN ReturnValue;\r
\r
ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
// Read a byte if StartAddress is byte aligned\r
//\r
*(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);\r
- StartAddress += sizeof (UINT8);\r
- Size -= sizeof (UINT8);\r
- Buffer = (UINT8*)Buffer + 1;\r
+ StartAddress += sizeof (UINT8);\r
+ Size -= sizeof (UINT8);\r
+ Buffer = (UINT8 *)Buffer + 1;\r
}\r
\r
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {\r
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {\r
//\r
// Read a word if StartAddress is word aligned\r
//\r
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));\r
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));\r
\r
StartAddress += sizeof (UINT16);\r
- Size -= sizeof (UINT16);\r
- Buffer = (UINT16*)Buffer + 1;\r
+ Size -= sizeof (UINT16);\r
+ Buffer = (UINT16 *)Buffer + 1;\r
}\r
\r
while (Size >= sizeof (UINT32)) {\r
//\r
// Read as many double words as possible\r
//\r
- WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) PciExpressRead32 (StartAddress));\r
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)PciExpressRead32 (StartAddress));\r
\r
StartAddress += sizeof (UINT32);\r
- Size -= sizeof (UINT32);\r
- Buffer = (UINT32*)Buffer + 1;\r
+ Size -= sizeof (UINT32);\r
+ Buffer = (UINT32 *)Buffer + 1;\r
}\r
\r
if (Size >= sizeof (UINT16)) {\r
//\r
// Read the last remaining word if exist\r
//\r
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));\r
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));\r
StartAddress += sizeof (UINT16);\r
- Size -= sizeof (UINT16);\r
- Buffer = (UINT16*)Buffer + 1;\r
+ Size -= sizeof (UINT16);\r
+ Buffer = (UINT16 *)Buffer + 1;\r
}\r
\r
if (Size >= sizeof (UINT8)) {\r
UINTN\r
EFIAPI\r
PciExpressWriteBuffer (\r
- IN UINTN StartAddress,\r
- IN UINTN Size,\r
- IN VOID *Buffer\r
+ IN UINTN StartAddress,\r
+ IN UINTN Size,\r
+ IN VOID *Buffer\r
)\r
{\r
- UINTN ReturnValue;\r
+ UINTN ReturnValue;\r
\r
ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
//\r
// Write a byte if StartAddress is byte aligned\r
//\r
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);\r
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);\r
StartAddress += sizeof (UINT8);\r
- Size -= sizeof (UINT8);\r
- Buffer = (UINT8*)Buffer + 1;\r
+ Size -= sizeof (UINT8);\r
+ Buffer = (UINT8 *)Buffer + 1;\r
}\r
\r
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {\r
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {\r
//\r
// Write a word if StartAddress is word aligned\r
//\r
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));\r
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));\r
StartAddress += sizeof (UINT16);\r
- Size -= sizeof (UINT16);\r
- Buffer = (UINT16*)Buffer + 1;\r
+ Size -= sizeof (UINT16);\r
+ Buffer = (UINT16 *)Buffer + 1;\r
}\r
\r
while (Size >= sizeof (UINT32)) {\r
//\r
// Write as many double words as possible\r
//\r
- PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer));\r
+ PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32 *)Buffer));\r
StartAddress += sizeof (UINT32);\r
- Size -= sizeof (UINT32);\r
- Buffer = (UINT32*)Buffer + 1;\r
+ Size -= sizeof (UINT32);\r
+ Buffer = (UINT32 *)Buffer + 1;\r
}\r
\r
if (Size >= sizeof (UINT16)) {\r
//\r
// Write the last remaining word if exist\r
//\r
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));\r
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));\r
StartAddress += sizeof (UINT16);\r
- Size -= sizeof (UINT16);\r
- Buffer = (UINT16*)Buffer + 1;\r
+ Size -= sizeof (UINT16);\r
+ Buffer = (UINT16 *)Buffer + 1;\r
}\r
\r
if (Size >= sizeof (UINT8)) {\r
//\r
// Write the last remaining byte if exist\r
//\r
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);\r
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);\r
}\r
\r
return ReturnValue;\r
if (Path == NULL) {\r
return EFI_NOT_FOUND;\r
}\r
+\r
SerialConsoleNode = fdt_path_offset (Fdt, Path);\r
}\r
\r
VOID\r
)\r
{\r
- RETURN_STATUS Status;\r
- VOID *DeviceTreeBase;\r
- UINT64 SerialConsoleAddress;\r
+ RETURN_STATUS Status;\r
+ VOID *DeviceTreeBase;\r
+ UINT64 SerialConsoleAddress;\r
\r
if (PcdGet64 (PcdSerialRegisterBase) != 0) {\r
return RETURN_SUCCESS;\r
VOID\r
)\r
{\r
- VOID *Hob;\r
- UINT64 *UartBase;\r
+ VOID *Hob;\r
+ UINT64 *UartBase;\r
\r
if (PcdGet64 (PcdSerialRegisterBase) != 0) {\r
return RETURN_SUCCESS;\r
//\r
// Enumerate all FDT nodes looking for a PL011 and capture its base address\r
//\r
- for (Prev = 0;; Prev = Node) {\r
+ for (Prev = 0; ; Prev = Node) {\r
Node = fdt_next_node (DeviceTreeBase, Prev, NULL);\r
if (Node < 0) {\r
break;\r
// Iterate over the NULL-separated items in the compatible string\r
//\r
for (CompatibleItem = Compatible; CompatibleItem < Compatible + Len;\r
- CompatibleItem += 1 + AsciiStrLen (CompatibleItem)) {\r
-\r
+ CompatibleItem += 1 + AsciiStrLen (CompatibleItem))\r
+ {\r
if (AsciiStrCmp (CompatibleItem, "arm,pl011") == 0) {\r
NodeStatus = fdt_getprop (DeviceTreeBase, Node, "status", &Len);\r
- if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {\r
+ if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {\r
continue;\r
}\r
\r
if (Len != 16) {\r
return 0;\r
}\r
+\r
UartBase = (UINTN)fdt64_to_cpu (ReadUnaligned64 (RegProperty));\r
\r
- BaudRate = (UINTN)FixedPcdGet64 (PcdUartDefaultBaudRate);\r
+ BaudRate = (UINTN)FixedPcdGet64 (PcdUartDefaultBaudRate);\r
ReceiveFifoDepth = 0; // Use the default value for Fifo depth\r
- Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity);\r
- DataBits = FixedPcdGet8 (PcdUartDefaultDataBits);\r
- StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);\r
+ Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity);\r
+ DataBits = FixedPcdGet8 (PcdUartDefaultDataBits);\r
+ StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits);\r
\r
Status = PL011UartInitializePort (\r
UartBase,\r
}\r
}\r
}\r
+\r
return 0;\r
}\r
\r
UINTN\r
EFIAPI\r
SerialPortWrite (\r
- IN UINT8 *Buffer,\r
- IN UINTN NumberOfBytes\r
+ IN UINT8 *Buffer,\r
+ IN UINTN NumberOfBytes\r
)\r
{\r
- UINT64 SerialRegisterBase;\r
+ UINT64 SerialRegisterBase;\r
\r
SerialRegisterBase = SerialPortGetBaseAddress ();\r
if (SerialRegisterBase != 0) {\r
return PL011UartWrite ((UINTN)SerialRegisterBase, Buffer, NumberOfBytes);\r
}\r
+\r
return 0;\r
}\r
\r
UINTN\r
EFIAPI\r
SerialPortRead (\r
- OUT UINT8 *Buffer,\r
- IN UINTN NumberOfBytes\r
-)\r
+ OUT UINT8 *Buffer,\r
+ IN UINTN NumberOfBytes\r
+ )\r
{\r
return 0;\r
}\r
RETURN_STATUS\r
EFIAPI\r
SerialPortSetControl (\r
- IN UINT32 Control\r
+ IN UINT32 Control\r
)\r
{\r
return RETURN_UNSUPPORTED;\r
RETURN_STATUS\r
EFIAPI\r
SerialPortGetControl (\r
- OUT UINT32 *Control\r
+ OUT UINT32 *Control\r
)\r
{\r
return RETURN_UNSUPPORTED;\r
RETURN_STATUS\r
EFIAPI\r
SerialPortSetAttributes (\r
- IN OUT UINT64 *BaudRate,\r
- IN OUT UINT32 *ReceiveFifoDepth,\r
- IN OUT UINT32 *Timeout,\r
- IN OUT EFI_PARITY_TYPE *Parity,\r
- IN OUT UINT8 *DataBits,\r
- IN OUT EFI_STOP_BITS_TYPE *StopBits\r
+ IN OUT UINT64 *BaudRate,\r
+ IN OUT UINT32 *ReceiveFifoDepth,\r
+ IN OUT UINT32 *Timeout,\r
+ IN OUT EFI_PARITY_TYPE *Parity,\r
+ IN OUT UINT8 *DataBits,\r
+ IN OUT EFI_STOP_BITS_TYPE *StopBits\r
)\r
{\r
return RETURN_UNSUPPORTED;\r
}\r
-\r
#include <Library/HobLib.h>\r
#include <Guid/EarlyPL011BaseAddress.h>\r
\r
-STATIC UINTN mSerialBaseAddress;\r
+STATIC UINTN mSerialBaseAddress;\r
\r
RETURN_STATUS\r
EFIAPI\r
EFI_STOP_BITS_TYPE StopBits;\r
\r
Hob = GetFirstGuidHob (&gEarlyPL011BaseAddressGuid);\r
- if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof *UartBase) {\r
+ if ((Hob == NULL) || (GET_GUID_HOB_DATA_SIZE (Hob) != sizeof *UartBase)) {\r
return RETURN_NOT_FOUND;\r
}\r
+\r
UartBase = GET_GUID_HOB_DATA (Hob);\r
\r
mSerialBaseAddress = (UINTN)*UartBase;\r
return RETURN_NOT_FOUND;\r
}\r
\r
- BaudRate = (UINTN)PcdGet64 (PcdUartDefaultBaudRate);\r
+ BaudRate = (UINTN)PcdGet64 (PcdUartDefaultBaudRate);\r
ReceiveFifoDepth = 0; // Use the default value for Fifo depth\r
- Parity = (EFI_PARITY_TYPE)PcdGet8 (PcdUartDefaultParity);\r
- DataBits = PcdGet8 (PcdUartDefaultDataBits);\r
- StopBits = (EFI_STOP_BITS_TYPE) PcdGet8 (PcdUartDefaultStopBits);\r
+ Parity = (EFI_PARITY_TYPE)PcdGet8 (PcdUartDefaultParity);\r
+ DataBits = PcdGet8 (PcdUartDefaultDataBits);\r
+ StopBits = (EFI_STOP_BITS_TYPE)PcdGet8 (PcdUartDefaultStopBits);\r
\r
return PL011UartInitializePort (\r
mSerialBaseAddress,\r
UINTN\r
EFIAPI\r
SerialPortWrite (\r
- IN UINT8 *Buffer,\r
- IN UINTN NumberOfBytes\r
+ IN UINT8 *Buffer,\r
+ IN UINTN NumberOfBytes\r
)\r
{\r
if (mSerialBaseAddress != 0) {\r
return PL011UartWrite (mSerialBaseAddress, Buffer, NumberOfBytes);\r
}\r
+\r
return 0;\r
}\r
\r
UINTN\r
EFIAPI\r
SerialPortRead (\r
- OUT UINT8 *Buffer,\r
- IN UINTN NumberOfBytes\r
-)\r
+ OUT UINT8 *Buffer,\r
+ IN UINTN NumberOfBytes\r
+ )\r
{\r
if (mSerialBaseAddress != 0) {\r
return PL011UartRead (mSerialBaseAddress, Buffer, NumberOfBytes);\r
}\r
+\r
return 0;\r
}\r
\r
if (mSerialBaseAddress != 0) {\r
return PL011UartPoll (mSerialBaseAddress);\r
}\r
+\r
return FALSE;\r
}\r
\r
RETURN_STATUS\r
EFIAPI\r
SerialPortSetAttributes (\r
- IN OUT UINT64 *BaudRate,\r
- IN OUT UINT32 *ReceiveFifoDepth,\r
- IN OUT UINT32 *Timeout,\r
- IN OUT EFI_PARITY_TYPE *Parity,\r
- IN OUT UINT8 *DataBits,\r
- IN OUT EFI_STOP_BITS_TYPE *StopBits\r
+ IN OUT UINT64 *BaudRate,\r
+ IN OUT UINT32 *ReceiveFifoDepth,\r
+ IN OUT UINT32 *Timeout,\r
+ IN OUT EFI_PARITY_TYPE *Parity,\r
+ IN OUT UINT8 *DataBits,\r
+ IN OUT EFI_STOP_BITS_TYPE *StopBits\r
)\r
{\r
- RETURN_STATUS Status;\r
+ RETURN_STATUS Status;\r
\r
if (mSerialBaseAddress == 0) {\r
Status = RETURN_UNSUPPORTED;\r
RETURN_STATUS\r
EFIAPI\r
SerialPortSetControl (\r
- IN UINT32 Control\r
+ IN UINT32 Control\r
)\r
{\r
- RETURN_STATUS Status;\r
+ RETURN_STATUS Status;\r
\r
if (mSerialBaseAddress == 0) {\r
Status = RETURN_UNSUPPORTED;\r
RETURN_STATUS\r
EFIAPI\r
SerialPortGetControl (\r
- OUT UINT32 *Control\r
+ OUT UINT32 *Control\r
)\r
{\r
- RETURN_STATUS Status;\r
+ RETURN_STATUS Status;\r
\r
if (mSerialBaseAddress == 0) {\r
Status = RETURN_UNSUPPORTED;\r
\r
return Status;\r
}\r
-\r
UINT64 *FdtHobData;\r
UINT64 *UartHobData;\r
\r
- Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
+ Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
if ((Base == NULL) || (fdt_check_header (Base) != 0)) {\r
ASSERT (0);\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);\r
+ FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);\r
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);\r
- NewBase = AllocatePages (FdtPages);\r
+ NewBase = AllocatePages (FdtPages);\r
if (NewBase == NULL) {\r
ASSERT (0);\r
return EFI_OUT_OF_RESOURCES;\r
\r
/** RTC Index register is at offset 0x0\r
*/\r
-#define RTC_INDEX_REG_OFFSET 0x0ULL\r
+#define RTC_INDEX_REG_OFFSET 0x0ULL\r
\r
/** RTC Target register is at offset 0x1\r
*/\r
-#define RTC_TARGET_REG_OFFSET 0x1ULL\r
+#define RTC_TARGET_REG_OFFSET 0x1ULL\r
\r
/** Add the RTC controller address range to the memory map.\r
\r
STATIC\r
EFI_STATUS\r
KvmtoolRtcMapMemory (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_PHYSICAL_ADDRESS RtcPageBase\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_PHYSICAL_ADDRESS RtcPageBase\r
)\r
{\r
EFI_STATUS Status;\r
);\r
if (EFI_ERROR (Status)) {\r
DEBUG ((\r
- DEBUG_ERROR, "Failed to add memory space. Status = %r\n",\r
+ DEBUG_ERROR,\r
+ "Failed to add memory space. Status = %r\n",\r
Status\r
));\r
return Status;\r
EFI_STATUS\r
EFIAPI\r
KvmtoolRtcFdtClientLibConstructor (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- INT32 Node;\r
- CONST UINT32 *Reg;\r
- UINT32 RegSize;\r
- UINT64 RegBase;\r
- UINT64 Range;\r
- RETURN_STATUS PcdStatus;\r
+ EFI_STATUS Status;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ INT32 Node;\r
+ CONST UINT32 *Reg;\r
+ UINT32 RegSize;\r
+ UINT64 RegBase;\r
+ UINT64 Range;\r
+ RETURN_STATUS PcdStatus;\r
\r
Status = gBS->LocateProtocol (\r
&gFdtClientProtocolGuid,\r
ASSERT (RegSize == 16);\r
\r
RegBase = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[0]));\r
- Range = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));\r
+ Range = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));\r
DEBUG ((\r
DEBUG_INFO,\r
"Found motorola,mc146818 RTC @ 0x%Lx Range = 0x%x\n",\r
#include <Library/MemoryAllocationLib.h>\r
\r
// Number of Virtual Memory Map Descriptors\r
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5\r
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5\r
\r
/**\r
Return the Virtual Memory Map of your platform\r
**/\r
VOID\r
ArmVirtGetMemoryMap (\r
- OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
+ OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
)\r
{\r
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;\r
- UINTN Idx;\r
- EFI_PHYSICAL_ADDRESS TopOfAddressSpace;\r
+ UINTN Idx;\r
+ EFI_PHYSICAL_ADDRESS TopOfAddressSpace;\r
\r
ASSERT (VirtualMemoryMap != NULL);\r
\r
TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());\r
\r
- VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)\r
- AllocatePages (\r
- EFI_SIZE_TO_PAGES (\r
- sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *\r
- MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS\r
- )\r
- );\r
+ VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR *)\r
+ AllocatePages (\r
+ EFI_SIZE_TO_PAGES (\r
+ sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *\r
+ MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS\r
+ )\r
+ );\r
if (VirtualMemoryTable == NULL) {\r
DEBUG ((\r
DEBUG_ERROR,\r
// Peripheral space after DRAM\r
VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdSystemMemoryBase) +\r
PcdGet64 (PcdSystemMemorySize);\r
- VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;\r
- VirtualMemoryTable[Idx].Length = TopOfAddressSpace -\r
- VirtualMemoryTable[Idx].PhysicalBase;\r
- VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
+ VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;\r
+ VirtualMemoryTable[Idx].Length = TopOfAddressSpace -\r
+ VirtualMemoryTable[Idx].PhysicalBase;\r
+ VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
\r
// Map the FV region as normal executable memory\r
VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdFvBaseAddress);\r
- VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;\r
- VirtualMemoryTable[Idx].Length = FixedPcdGet32 (PcdFvSize);\r
- VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
+ VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;\r
+ VirtualMemoryTable[Idx].Length = FixedPcdGet32 (PcdFvSize);\r
+ VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
\r
// End of Table\r
- VirtualMemoryTable[++Idx].PhysicalBase = 0;\r
- VirtualMemoryTable[Idx].VirtualBase = 0;\r
- VirtualMemoryTable[Idx].Length = 0;\r
- VirtualMemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;\r
+ VirtualMemoryTable[++Idx].PhysicalBase = 0;\r
+ VirtualMemoryTable[Idx].VirtualBase = 0;\r
+ VirtualMemoryTable[Idx].Length = 0;\r
+ VirtualMemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;\r
\r
- ASSERT((Idx + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);\r
+ ASSERT ((Idx + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);\r
\r
*VirtualMemoryMap = VirtualMemoryTable;\r
}\r
\r
/** Macro defining the maximum number of Flash devices.\r
*/\r
-#define MAX_FLASH_DEVICES 4\r
+#define MAX_FLASH_DEVICES 4\r
\r
/** Macro defining the cfi-flash label describing the UEFI variable store.\r
*/\r
-#define LABEL_UEFI_VAR_STORE "System-firmware"\r
+#define LABEL_UEFI_VAR_STORE "System-firmware"\r
\r
STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[MAX_FLASH_DEVICES];\r
STATIC UINTN mNorFlashDeviceCount = 0;\r
-STATIC INT32 mUefiVarStoreNode = MAX_INT32;\r
+STATIC INT32 mUefiVarStoreNode = MAX_INT32;\r
STATIC FDT_CLIENT_PROTOCOL *mFdtClient;\r
\r
/** This function performs platform specific actions to initialise\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
DEBUG ((DEBUG_INFO, "NorFlashPlatformInitialization\n"));\r
\r
STATIC\r
EFI_STATUS\r
SetupVariableStore (\r
- IN NOR_FLASH_DESCRIPTION * FlashDevice\r
+ IN NOR_FLASH_DESCRIPTION *FlashDevice\r
)\r
{\r
- UINTN FlashRegion;\r
- UINTN FlashNvStorageVariableBase;\r
- UINTN FlashNvStorageFtwWorkingBase;\r
- UINTN FlashNvStorageFtwSpareBase;\r
- UINTN FlashNvStorageVariableSize;\r
- UINTN FlashNvStorageFtwWorkingSize;\r
- UINTN FlashNvStorageFtwSpareSize;\r
-\r
- FlashNvStorageVariableSize = PcdGet32 (PcdFlashNvStorageVariableSize);\r
+ UINTN FlashRegion;\r
+ UINTN FlashNvStorageVariableBase;\r
+ UINTN FlashNvStorageFtwWorkingBase;\r
+ UINTN FlashNvStorageFtwSpareBase;\r
+ UINTN FlashNvStorageVariableSize;\r
+ UINTN FlashNvStorageFtwWorkingSize;\r
+ UINTN FlashNvStorageFtwSpareSize;\r
+\r
+ FlashNvStorageVariableSize = PcdGet32 (PcdFlashNvStorageVariableSize);\r
FlashNvStorageFtwWorkingSize = PcdGet32 (PcdFlashNvStorageFtwWorkingSize);\r
- FlashNvStorageFtwSpareSize = PcdGet32 (PcdFlashNvStorageFtwSpareSize);\r
+ FlashNvStorageFtwSpareSize = PcdGet32 (PcdFlashNvStorageFtwSpareSize);\r
\r
if ((FlashNvStorageVariableSize == 0) ||\r
(FlashNvStorageFtwWorkingSize == 0) ||\r
- (FlashNvStorageFtwSpareSize == 0)) {\r
+ (FlashNvStorageFtwSpareSize == 0))\r
+ {\r
DEBUG ((DEBUG_ERROR, "FlashNvStorage size not defined\n"));\r
return EFI_INVALID_PARAMETER;\r
}\r
FlashRegion = FlashDevice->DeviceBaseAddress;\r
\r
FlashNvStorageVariableBase = FlashRegion;\r
- FlashRegion += PcdGet32 (PcdFlashNvStorageVariableSize);\r
+ FlashRegion += PcdGet32 (PcdFlashNvStorageVariableSize);\r
\r
FlashNvStorageFtwWorkingBase = FlashRegion;\r
- FlashRegion += PcdGet32 (PcdFlashNvStorageFtwWorkingSize);\r
+ FlashRegion += PcdGet32 (PcdFlashNvStorageFtwWorkingSize);\r
\r
FlashNvStorageFtwSpareBase = FlashRegion;\r
- FlashRegion += PcdGet32 (PcdFlashNvStorageFtwSpareSize);\r
+ FlashRegion += PcdGet32 (PcdFlashNvStorageFtwSpareSize);\r
\r
if (FlashRegion > (FlashDevice->DeviceBaseAddress + FlashDevice->Size)) {\r
DEBUG ((DEBUG_ERROR, "Insufficient flash storage size\n"));\r
**/\r
EFI_STATUS\r
NorFlashPlatformGetDevices (\r
- OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions,\r
- OUT UINT32 *Count\r
+ OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions,\r
+ OUT UINT32 *Count\r
)\r
{\r
if (mNorFlashDeviceCount > 0) {\r
*NorFlashDescriptions = mNorFlashDevices;\r
- *Count = mNorFlashDeviceCount;\r
+ *Count = mNorFlashDeviceCount;\r
return EFI_SUCCESS;\r
}\r
+\r
return EFI_NOT_FOUND;\r
}\r
\r
EFI_STATUS\r
EFIAPI\r
NorFlashPlatformLibConstructor (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE * SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- INT32 Node;\r
- EFI_STATUS Status;\r
- EFI_STATUS FindNodeStatus;\r
- CONST UINT32 *Reg;\r
- UINT32 PropSize;\r
- UINT64 Base;\r
- UINT64 Size;\r
- UINTN UefiVarStoreIndex;\r
- CONST CHAR8 *Label;\r
- UINT32 LabelLen;\r
+ INT32 Node;\r
+ EFI_STATUS Status;\r
+ EFI_STATUS FindNodeStatus;\r
+ CONST UINT32 *Reg;\r
+ UINT32 PropSize;\r
+ UINT64 Base;\r
+ UINT64 Size;\r
+ UINTN UefiVarStoreIndex;\r
+ CONST CHAR8 *Label;\r
+ UINT32 LabelLen;\r
\r
if (mNorFlashDeviceCount != 0) {\r
return EFI_SUCCESS;\r
&Node\r
);\r
!EFI_ERROR (FindNodeStatus) &&\r
- (mNorFlashDeviceCount < MAX_FLASH_DEVICES);\r
+ (mNorFlashDeviceCount < MAX_FLASH_DEVICES);\r
FindNodeStatus = mFdtClient->FindNextCompatibleNode (\r
mFdtClient,\r
"cfi-flash",\r
Node,\r
&Node\r
- )) {\r
+ ))\r
+ {\r
Status = mFdtClient->GetNodeProperty (\r
mFdtClient,\r
Node,\r
&PropSize\r
);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",\r
- __FUNCTION__, Status));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: GetNodeProperty () failed (Status == %r)\n",\r
+ __FUNCTION__,\r
+ Status\r
+ ));\r
continue;\r
}\r
\r
ASSERT ((PropSize % (4 * sizeof (UINT32))) == 0);\r
\r
while ((PropSize >= (4 * sizeof (UINT32))) &&\r
- (mNorFlashDeviceCount < MAX_FLASH_DEVICES)) {\r
+ (mNorFlashDeviceCount < MAX_FLASH_DEVICES))\r
+ {\r
Base = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[0]));\r
Size = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));\r
Reg += 4;\r
// The firmware is not updatable from inside the guest anyway.\r
//\r
if ((PcdGet64 (PcdFvBaseAddress) + PcdGet32 (PcdFvSize) > Base) &&\r
- (Base + Size) > PcdGet64 (PcdFvBaseAddress)) {\r
+ ((Base + Size) > PcdGet64 (PcdFvBaseAddress)))\r
+ {\r
continue;\r
}\r
\r
\r
mNorFlashDevices[mNorFlashDeviceCount].DeviceBaseAddress = (UINTN)Base;\r
mNorFlashDevices[mNorFlashDeviceCount].RegionBaseAddress = (UINTN)Base;\r
- mNorFlashDevices[mNorFlashDeviceCount].Size = (UINTN)Size;\r
- mNorFlashDevices[mNorFlashDeviceCount].BlockSize = KVMTOOL_NOR_BLOCK_SIZE;\r
+ mNorFlashDevices[mNorFlashDeviceCount].Size = (UINTN)Size;\r
+ mNorFlashDevices[mNorFlashDeviceCount].BlockSize = KVMTOOL_NOR_BLOCK_SIZE;\r
mNorFlashDeviceCount++;\r
}\r
} // for\r
UefiVarStoreIndex = mNorFlashDeviceCount - 1;\r
mUefiVarStoreNode = Node;\r
}\r
+\r
if (mNorFlashDevices[UefiVarStoreIndex].DeviceBaseAddress != 0) {\r
return SetupVariableStore (&mNorFlashDevices[UefiVarStoreIndex]);\r
}\r
\r
#include <Protocol/FdtClient.h>\r
\r
-#define QEMU_NOR_BLOCK_SIZE SIZE_256KB\r
+#define QEMU_NOR_BLOCK_SIZE SIZE_256KB\r
\r
-#define MAX_FLASH_BANKS 4\r
+#define MAX_FLASH_BANKS 4\r
\r
EFI_STATUS\r
NorFlashPlatformInitialization (\r
return EFI_SUCCESS;\r
}\r
\r
-NOR_FLASH_DESCRIPTION mNorFlashDevices[MAX_FLASH_BANKS];\r
+NOR_FLASH_DESCRIPTION mNorFlashDevices[MAX_FLASH_BANKS];\r
\r
EFI_STATUS\r
NorFlashPlatformGetDevices (\r
- OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions,\r
- OUT UINT32 *Count\r
+ OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions,\r
+ OUT UINT32 *Count\r
)\r
{\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- INT32 Node;\r
- EFI_STATUS Status;\r
- EFI_STATUS FindNodeStatus;\r
- CONST UINT32 *Reg;\r
- UINT32 PropSize;\r
- UINT32 Num;\r
- UINT64 Base;\r
- UINT64 Size;\r
-\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ INT32 Node;\r
+ EFI_STATUS Status;\r
+ EFI_STATUS FindNodeStatus;\r
+ CONST UINT32 *Reg;\r
+ UINT32 PropSize;\r
+ UINT32 Num;\r
+ UINT64 Base;\r
+ UINT64 Size;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
Num = 0;\r
- for (FindNodeStatus = FdtClient->FindCompatibleNode (FdtClient,\r
- "cfi-flash", &Node);\r
+ for (FindNodeStatus = FdtClient->FindCompatibleNode (\r
+ FdtClient,\r
+ "cfi-flash",\r
+ &Node\r
+ );\r
!EFI_ERROR (FindNodeStatus) && Num < MAX_FLASH_BANKS;\r
- FindNodeStatus = FdtClient->FindNextCompatibleNode (FdtClient,\r
- "cfi-flash", Node, &Node)) {\r
-\r
- Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",\r
- (CONST VOID **)&Reg, &PropSize);\r
+ FindNodeStatus = FdtClient->FindNextCompatibleNode (\r
+ FdtClient,\r
+ "cfi-flash",\r
+ Node,\r
+ &Node\r
+ ))\r
+ {\r
+ Status = FdtClient->GetNodeProperty (\r
+ FdtClient,\r
+ Node,\r
+ "reg",\r
+ (CONST VOID **)&Reg,\r
+ &PropSize\r
+ );\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",\r
- __FUNCTION__, Status));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: GetNodeProperty () failed (Status == %r)\n",\r
+ __FUNCTION__,\r
+ Status\r
+ ));\r
continue;\r
}\r
\r
// The firmware is not updatable from inside the guest anyway.\r
//\r
if ((PcdGet64 (PcdFvBaseAddress) + PcdGet32 (PcdFvSize) > Base) &&\r
- (Base + Size) > PcdGet64 (PcdFvBaseAddress)) {\r
+ ((Base + Size) > PcdGet64 (PcdFvBaseAddress)))\r
+ {\r
continue;\r
}\r
\r
// code, which is not intended to be guest updatable, and is usually backed\r
// in a readonly manner by QEMU anyway.\r
//\r
- Status = FdtClient->SetNodeProperty (FdtClient, Node, "status",\r
- "disabled", sizeof ("disabled"));\r
+ Status = FdtClient->SetNodeProperty (\r
+ FdtClient,\r
+ Node,\r
+ "status",\r
+ "disabled",\r
+ sizeof ("disabled")\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_WARN, "Failed to set NOR flash status to 'disabled'\n"));\r
}\r
}\r
\r
*NorFlashDescriptions = mNorFlashDevices;\r
- *Count = Num;\r
+ *Count = Num;\r
\r
return EFI_SUCCESS;\r
}\r
\r
#include "PlatformBm.h"\r
\r
-#define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }\r
-\r
+#define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }\r
\r
#pragma pack (1)\r
typedef struct {\r
- VENDOR_DEVICE_PATH SerialDxe;\r
- UART_DEVICE_PATH Uart;\r
- VENDOR_DEFINED_DEVICE_PATH TermType;\r
- EFI_DEVICE_PATH_PROTOCOL End;\r
+ VENDOR_DEVICE_PATH SerialDxe;\r
+ UART_DEVICE_PATH Uart;\r
+ VENDOR_DEFINED_DEVICE_PATH TermType;\r
+ EFI_DEVICE_PATH_PROTOCOL End;\r
} PLATFORM_SERIAL_CONSOLE;\r
#pragma pack ()\r
\r
-STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {\r
+STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {\r
//\r
// VENDOR_DEVICE_PATH SerialDxe\r
//\r
{\r
- { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },\r
+ { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },\r
EDKII_SERIAL_PORT_LIB_VENDOR_GUID\r
},\r
\r
// UART_DEVICE_PATH Uart\r
//\r
{\r
- { MESSAGING_DEVICE_PATH, MSG_UART_DP, DP_NODE_LEN (UART_DEVICE_PATH) },\r
+ { MESSAGING_DEVICE_PATH, MSG_UART_DP, DP_NODE_LEN (UART_DEVICE_PATH) },\r
0, // Reserved\r
FixedPcdGet64 (PcdUartDefaultBaudRate), // BaudRate\r
FixedPcdGet8 (PcdUartDefaultDataBits), // DataBits\r
}\r
};\r
\r
-\r
#pragma pack (1)\r
typedef struct {\r
- USB_CLASS_DEVICE_PATH Keyboard;\r
- EFI_DEVICE_PATH_PROTOCOL End;\r
+ USB_CLASS_DEVICE_PATH Keyboard;\r
+ EFI_DEVICE_PATH_PROTOCOL End;\r
} PLATFORM_USB_KEYBOARD;\r
#pragma pack ()\r
\r
-STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = {\r
+STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = {\r
//\r
// USB_CLASS_DEVICE_PATH Keyboard\r
//\r
}\r
};\r
\r
-\r
/**\r
Check if the handle satisfies a particular condition.\r
\r
**/\r
typedef\r
BOOLEAN\r
-(EFIAPI *FILTER_FUNCTION) (\r
+(EFIAPI *FILTER_FUNCTION)(\r
IN EFI_HANDLE Handle,\r
IN CONST CHAR16 *ReportText\r
);\r
\r
-\r
/**\r
Process a handle.\r
\r
**/\r
typedef\r
VOID\r
-(EFIAPI *CALLBACK_FUNCTION) (\r
+(EFIAPI *CALLBACK_FUNCTION)(\r
IN EFI_HANDLE Handle,\r
IN CONST CHAR16 *ReportText\r
);\r
STATIC\r
VOID\r
FilterAndProcess (\r
- IN EFI_GUID *ProtocolGuid,\r
- IN FILTER_FUNCTION Filter OPTIONAL,\r
- IN CALLBACK_FUNCTION Process\r
+ IN EFI_GUID *ProtocolGuid,\r
+ IN FILTER_FUNCTION Filter OPTIONAL,\r
+ IN CALLBACK_FUNCTION Process\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_HANDLE *Handles;\r
- UINTN NoHandles;\r
- UINTN Idx;\r
-\r
- Status = gBS->LocateHandleBuffer (ByProtocol, ProtocolGuid,\r
- NULL /* SearchKey */, &NoHandles, &Handles);\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE *Handles;\r
+ UINTN NoHandles;\r
+ UINTN Idx;\r
+\r
+ Status = gBS->LocateHandleBuffer (\r
+ ByProtocol,\r
+ ProtocolGuid,\r
+ NULL /* SearchKey */,\r
+ &NoHandles,\r
+ &Handles\r
+ );\r
if (EFI_ERROR (Status)) {\r
//\r
// This is not an error, just an informative condition.\r
//\r
- DEBUG ((DEBUG_VERBOSE, "%a: %g: %r\n", __FUNCTION__, ProtocolGuid,\r
- Status));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: %g: %r\n",\r
+ __FUNCTION__,\r
+ ProtocolGuid,\r
+ Status\r
+ ));\r
return;\r
}\r
\r
ASSERT (NoHandles > 0);\r
for (Idx = 0; Idx < NoHandles; ++Idx) {\r
- CHAR16 *DevicePathText;\r
- STATIC CHAR16 Fallback[] = L"<device path unavailable>";\r
+ CHAR16 *DevicePathText;\r
+ STATIC CHAR16 Fallback[] = L"<device path unavailable>";\r
\r
//\r
// The ConvertDevicePathToText() function handles NULL input transparently.\r
DevicePathText = Fallback;\r
}\r
\r
- if (Filter == NULL || Filter (Handles[Idx], DevicePathText)) {\r
+ if ((Filter == NULL) || Filter (Handles[Idx], DevicePathText)) {\r
Process (Handles[Idx], DevicePathText);\r
}\r
\r
FreePool (DevicePathText);\r
}\r
}\r
+\r
gBS->FreePool (Handles);\r
}\r
\r
-\r
/**\r
This FILTER_FUNCTION checks if a handle corresponds to a PCI display device.\r
**/\r
BOOLEAN\r
EFIAPI\r
IsPciDisplay (\r
- IN EFI_HANDLE Handle,\r
- IN CONST CHAR16 *ReportText\r
+ IN EFI_HANDLE Handle,\r
+ IN CONST CHAR16 *ReportText\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_PCI_IO_PROTOCOL *PciIo;\r
- PCI_TYPE00 Pci;\r
+ EFI_STATUS Status;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+ PCI_TYPE00 Pci;\r
\r
- Status = gBS->HandleProtocol (Handle, &gEfiPciIoProtocolGuid,\r
- (VOID**)&PciIo);\r
+ Status = gBS->HandleProtocol (\r
+ Handle,\r
+ &gEfiPciIoProtocolGuid,\r
+ (VOID **)&PciIo\r
+ );\r
if (EFI_ERROR (Status)) {\r
//\r
// This is not an error worth reporting.\r
return FALSE;\r
}\r
\r
- Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0 /* Offset */,\r
- sizeof Pci / sizeof (UINT32), &Pci);\r
+ Status = PciIo->Pci.Read (\r
+ PciIo,\r
+ EfiPciIoWidthUint32,\r
+ 0 /* Offset */,\r
+ sizeof Pci / sizeof (UINT32),\r
+ &Pci\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "%a: %s: %r\n", __FUNCTION__, ReportText, Status));\r
return FALSE;\r
return IS_PCI_DISPLAY (&Pci);\r
}\r
\r
-\r
/**\r
This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at\r
the VIRTIO_DEVICE_PROTOCOL level.\r
BOOLEAN\r
EFIAPI\r
IsVirtioRng (\r
- IN EFI_HANDLE Handle,\r
- IN CONST CHAR16 *ReportText\r
+ IN EFI_HANDLE Handle,\r
+ IN CONST CHAR16 *ReportText\r
)\r
{\r
- EFI_STATUS Status;\r
- VIRTIO_DEVICE_PROTOCOL *VirtIo;\r
+ EFI_STATUS Status;\r
+ VIRTIO_DEVICE_PROTOCOL *VirtIo;\r
\r
- Status = gBS->HandleProtocol (Handle, &gVirtioDeviceProtocolGuid,\r
- (VOID**)&VirtIo);\r
+ Status = gBS->HandleProtocol (\r
+ Handle,\r
+ &gVirtioDeviceProtocolGuid,\r
+ (VOID **)&VirtIo\r
+ );\r
if (EFI_ERROR (Status)) {\r
return FALSE;\r
}\r
+\r
return (BOOLEAN)(VirtIo->SubSystemDeviceId ==\r
VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);\r
}\r
\r
-\r
/**\r
This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at\r
the EFI_PCI_IO_PROTOCOL level.\r
BOOLEAN\r
EFIAPI\r
IsVirtioPciRng (\r
- IN EFI_HANDLE Handle,\r
- IN CONST CHAR16 *ReportText\r
+ IN EFI_HANDLE Handle,\r
+ IN CONST CHAR16 *ReportText\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_PCI_IO_PROTOCOL *PciIo;\r
- UINT16 VendorId;\r
- UINT16 DeviceId;\r
- UINT8 RevisionId;\r
- BOOLEAN Virtio10;\r
- UINT16 SubsystemId;\r
-\r
- Status = gBS->HandleProtocol (Handle, &gEfiPciIoProtocolGuid,\r
- (VOID**)&PciIo);\r
+ EFI_STATUS Status;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+ UINT16 VendorId;\r
+ UINT16 DeviceId;\r
+ UINT8 RevisionId;\r
+ BOOLEAN Virtio10;\r
+ UINT16 SubsystemId;\r
+\r
+ Status = gBS->HandleProtocol (\r
+ Handle,\r
+ &gEfiPciIoProtocolGuid,\r
+ (VOID **)&PciIo\r
+ );\r
if (EFI_ERROR (Status)) {\r
return FALSE;\r
}\r
//\r
// Read and check VendorId.\r
//\r
- Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_VENDOR_ID_OFFSET,\r
- 1, &VendorId);\r
+ Status = PciIo->Pci.Read (\r
+ PciIo,\r
+ EfiPciIoWidthUint16,\r
+ PCI_VENDOR_ID_OFFSET,\r
+ 1,\r
+ &VendorId\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto PciError;\r
}\r
+\r
if (VendorId != VIRTIO_VENDOR_ID) {\r
return FALSE;\r
}\r
//\r
// Read DeviceId and RevisionId.\r
//\r
- Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_DEVICE_ID_OFFSET,\r
- 1, &DeviceId);\r
+ Status = PciIo->Pci.Read (\r
+ PciIo,\r
+ EfiPciIoWidthUint16,\r
+ PCI_DEVICE_ID_OFFSET,\r
+ 1,\r
+ &DeviceId\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto PciError;\r
}\r
- Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, PCI_REVISION_ID_OFFSET,\r
- 1, &RevisionId);\r
+\r
+ Status = PciIo->Pci.Read (\r
+ PciIo,\r
+ EfiPciIoWidthUint8,\r
+ PCI_REVISION_ID_OFFSET,\r
+ 1,\r
+ &RevisionId\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto PciError;\r
}\r
// SubsystemId will only play a sanity-check role. Otherwise, DeviceId can\r
// only be sanity-checked, and SubsystemId will decide.\r
//\r
- if (DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE &&\r
- RevisionId >= 0x01) {\r
+ if ((DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) &&\r
+ (RevisionId >= 0x01))\r
+ {\r
Virtio10 = TRUE;\r
- } else if (DeviceId >= 0x1000 && DeviceId <= 0x103F && RevisionId == 0x00) {\r
+ } else if ((DeviceId >= 0x1000) && (DeviceId <= 0x103F) && (RevisionId == 0x00)) {\r
Virtio10 = FALSE;\r
} else {\r
return FALSE;\r
//\r
// Read and check SubsystemId as dictated by Virtio10.\r
//\r
- Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16,\r
- PCI_SUBSYSTEM_ID_OFFSET, 1, &SubsystemId);\r
+ Status = PciIo->Pci.Read (\r
+ PciIo,\r
+ EfiPciIoWidthUint16,\r
+ PCI_SUBSYSTEM_ID_OFFSET,\r
+ 1,\r
+ &SubsystemId\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto PciError;\r
}\r
- if (Virtio10 && SubsystemId >= 0x40) {\r
+\r
+ if (Virtio10 && (SubsystemId >= 0x40)) {\r
return TRUE;\r
}\r
- if (!Virtio10 && SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) {\r
+\r
+ if (!Virtio10 && (SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {\r
return TRUE;\r
}\r
+\r
return FALSE;\r
\r
PciError:\r
return FALSE;\r
}\r
\r
-\r
/**\r
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking\r
the matching driver to produce all first-level child handles.\r
VOID\r
EFIAPI\r
Connect (\r
- IN EFI_HANDLE Handle,\r
- IN CONST CHAR16 *ReportText\r
+ IN EFI_HANDLE Handle,\r
+ IN CONST CHAR16 *ReportText\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = gBS->ConnectController (\r
Handle, // ControllerHandle\r
NULL, // RemainingDevicePath -- produce all children\r
FALSE // Recursive\r
);\r
- DEBUG ((EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE, "%a: %s: %r\n",\r
- __FUNCTION__, ReportText, Status));\r
+ DEBUG ((\r
+ EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,\r
+ "%a: %s: %r\n",\r
+ __FUNCTION__,\r
+ ReportText,\r
+ Status\r
+ ));\r
}\r
\r
-\r
/**\r
This CALLBACK_FUNCTION retrieves the EFI_DEVICE_PATH_PROTOCOL from the\r
handle, and adds it to ConOut and ErrOut.\r
VOID\r
EFIAPI\r
AddOutput (\r
- IN EFI_HANDLE Handle,\r
- IN CONST CHAR16 *ReportText\r
+ IN EFI_HANDLE Handle,\r
+ IN CONST CHAR16 *ReportText\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+ EFI_STATUS Status;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
\r
DevicePath = DevicePathFromHandle (Handle);\r
if (DevicePath == NULL) {\r
- DEBUG ((DEBUG_ERROR, "%a: %s: handle %p: device path not found\n",\r
- __FUNCTION__, ReportText, Handle));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: %s: handle %p: device path not found\n",\r
+ __FUNCTION__,\r
+ ReportText,\r
+ Handle\r
+ ));\r
return;\r
}\r
\r
Status = EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: %s: adding to ConOut: %r\n", __FUNCTION__,\r
- ReportText, Status));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: %s: adding to ConOut: %r\n",\r
+ __FUNCTION__,\r
+ ReportText,\r
+ Status\r
+ ));\r
return;\r
}\r
\r
Status = EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: %s: adding to ErrOut: %r\n", __FUNCTION__,\r
- ReportText, Status));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: %s: adding to ErrOut: %r\n",\r
+ __FUNCTION__,\r
+ ReportText,\r
+ Status\r
+ ));\r
return;\r
}\r
\r
- DEBUG ((DEBUG_VERBOSE, "%a: %s: added to ConOut and ErrOut\n", __FUNCTION__,\r
- ReportText));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: %s: added to ConOut and ErrOut\n",\r
+ __FUNCTION__,\r
+ ReportText\r
+ ));\r
}\r
\r
STATIC\r
VOID\r
PlatformRegisterFvBootOption (\r
- EFI_GUID *FileGuid,\r
- CHAR16 *Description,\r
- UINT32 Attributes\r
+ EFI_GUID *FileGuid,\r
+ CHAR16 *Description,\r
+ UINT32 Attributes\r
)\r
{\r
- EFI_STATUS Status;\r
- INTN OptionIndex;\r
- EFI_BOOT_MANAGER_LOAD_OPTION NewOption;\r
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
- UINTN BootOptionCount;\r
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;\r
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+ EFI_STATUS Status;\r
+ INTN OptionIndex;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION NewOption;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
+ UINTN BootOptionCount;\r
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;\r
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
\r
Status = gBS->HandleProtocol (\r
gImageHandle,\r
&gEfiLoadedImageProtocolGuid,\r
- (VOID **) &LoadedImage\r
+ (VOID **)&LoadedImage\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
ASSERT (DevicePath != NULL);\r
DevicePath = AppendDevicePathNode (\r
DevicePath,\r
- (EFI_DEVICE_PATH_PROTOCOL *) &FileNode\r
+ (EFI_DEVICE_PATH_PROTOCOL *)&FileNode\r
);\r
ASSERT (DevicePath != NULL);\r
\r
FreePool (DevicePath);\r
\r
BootOptions = EfiBootManagerGetLoadOptions (\r
- &BootOptionCount, LoadOptionTypeBoot\r
+ &BootOptionCount,\r
+ LoadOptionTypeBoot\r
);\r
\r
OptionIndex = EfiBootManagerFindLoadOption (\r
- &NewOption, BootOptions, BootOptionCount\r
+ &NewOption,\r
+ BootOptions,\r
+ BootOptionCount\r
);\r
\r
if (OptionIndex == -1) {\r
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);\r
ASSERT_EFI_ERROR (Status);\r
}\r
+\r
EfiBootManagerFreeLoadOption (&NewOption);\r
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);\r
}\r
\r
-\r
/**\r
Remove all MemoryMapped(...)/FvFile(...) and Fv(...)/FvFile(...) boot options\r
whose device paths do not resolve exactly to an FvFile in the system.\r
VOID\r
)\r
{\r
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
- UINTN BootOptionCount;\r
- UINTN Index;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
+ UINTN BootOptionCount;\r
+ UINTN Index;\r
\r
- BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount,\r
- LoadOptionTypeBoot);\r
+ BootOptions = EfiBootManagerGetLoadOptions (\r
+ &BootOptionCount,\r
+ LoadOptionTypeBoot\r
+ );\r
\r
for (Index = 0; Index < BootOptionCount; ++Index) {\r
- EFI_DEVICE_PATH_PROTOCOL *Node1, *Node2, *SearchNode;\r
- EFI_STATUS Status;\r
- EFI_HANDLE FvHandle;\r
+ EFI_DEVICE_PATH_PROTOCOL *Node1, *Node2, *SearchNode;\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE FvHandle;\r
\r
//\r
// If the device path starts with neither MemoryMapped(...) nor Fv(...),\r
// then keep the boot option.\r
//\r
Node1 = BootOptions[Index].FilePath;\r
- if (!(DevicePathType (Node1) == HARDWARE_DEVICE_PATH &&\r
- DevicePathSubType (Node1) == HW_MEMMAP_DP) &&\r
- !(DevicePathType (Node1) == MEDIA_DEVICE_PATH &&\r
- DevicePathSubType (Node1) == MEDIA_PIWG_FW_VOL_DP)) {\r
+ if (!((DevicePathType (Node1) == HARDWARE_DEVICE_PATH) &&\r
+ (DevicePathSubType (Node1) == HW_MEMMAP_DP)) &&\r
+ !((DevicePathType (Node1) == MEDIA_DEVICE_PATH) &&\r
+ (DevicePathSubType (Node1) == MEDIA_PIWG_FW_VOL_DP)))\r
+ {\r
continue;\r
}\r
\r
// option.\r
//\r
Node2 = NextDevicePathNode (Node1);\r
- if (DevicePathType (Node2) != MEDIA_DEVICE_PATH ||\r
- DevicePathSubType (Node2) != MEDIA_PIWG_FW_FILE_DP) {\r
+ if ((DevicePathType (Node2) != MEDIA_DEVICE_PATH) ||\r
+ (DevicePathSubType (Node2) != MEDIA_PIWG_FW_FILE_DP))\r
+ {\r
continue;\r
}\r
\r
// boot option.\r
//\r
SearchNode = Node1;\r
- Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid,\r
- &SearchNode, &FvHandle);\r
+ Status = gBS->LocateDevicePath (\r
+ &gEfiFirmwareVolume2ProtocolGuid,\r
+ &SearchNode,\r
+ &FvHandle\r
+ );\r
\r
if (!EFI_ERROR (Status)) {\r
//\r
// The firmware volume was found; now let's see if it contains the FvFile\r
// identified by GUID.\r
//\r
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;\r
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFileNode;\r
- UINTN BufferSize;\r
- EFI_FV_FILETYPE FoundType;\r
- EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
- UINT32 AuthenticationStatus;\r
-\r
- Status = gBS->HandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid,\r
- (VOID **)&FvProtocol);\r
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;\r
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFileNode;\r
+ UINTN BufferSize;\r
+ EFI_FV_FILETYPE FoundType;\r
+ EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
+ UINT32 AuthenticationStatus;\r
+\r
+ Status = gBS->HandleProtocol (\r
+ FvHandle,\r
+ &gEfiFirmwareVolume2ProtocolGuid,\r
+ (VOID **)&FvProtocol\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
FvFileNode = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)Node2;\r
// Delete the boot option.\r
//\r
Status = EfiBootManagerDeleteLoadOptionVariable (\r
- BootOptions[Index].OptionNumber, LoadOptionTypeBoot);\r
+ BootOptions[Index].OptionNumber,\r
+ LoadOptionTypeBoot\r
+ );\r
DEBUG_CODE_BEGIN ();\r
- CHAR16 *DevicePathString;\r
-\r
- DevicePathString = ConvertDevicePathToText(BootOptions[Index].FilePath,\r
- FALSE, FALSE);\r
- DEBUG ((\r
- EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,\r
- "%a: removing stale Boot#%04x %s: %r\n",\r
- __FUNCTION__,\r
- (UINT32)BootOptions[Index].OptionNumber,\r
- DevicePathString == NULL ? L"<unavailable>" : DevicePathString,\r
- Status\r
- ));\r
- if (DevicePathString != NULL) {\r
- FreePool (DevicePathString);\r
- }\r
+ CHAR16 *DevicePathString;\r
+\r
+ DevicePathString = ConvertDevicePathToText (\r
+ BootOptions[Index].FilePath,\r
+ FALSE,\r
+ FALSE\r
+ );\r
+ DEBUG ((\r
+ EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,\r
+ "%a: removing stale Boot#%04x %s: %r\n",\r
+ __FUNCTION__,\r
+ (UINT32)BootOptions[Index].OptionNumber,\r
+ DevicePathString == NULL ? L"<unavailable>" : DevicePathString,\r
+ Status\r
+ ));\r
+ if (DevicePathString != NULL) {\r
+ FreePool (DevicePathString);\r
+ }\r
+\r
DEBUG_CODE_END ();\r
}\r
\r
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);\r
}\r
\r
-\r
STATIC\r
VOID\r
PlatformRegisterOptionsAndKeys (\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_INPUT_KEY Enter;\r
- EFI_INPUT_KEY F2;\r
- EFI_INPUT_KEY Esc;\r
- EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
+ EFI_STATUS Status;\r
+ EFI_INPUT_KEY Enter;\r
+ EFI_INPUT_KEY F2;\r
+ EFI_INPUT_KEY Esc;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
\r
//\r
// Register ENTER as CONTINUE key\r
//\r
Enter.ScanCode = SCAN_NULL;\r
Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;\r
- Status = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);\r
+ Status = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
F2.UnicodeChar = CHAR_NULL;\r
Esc.ScanCode = SCAN_ESC;\r
Esc.UnicodeChar = CHAR_NULL;\r
- Status = EfiBootManagerGetBootManagerMenu (&BootOption);\r
+ Status = EfiBootManagerGetBootManagerMenu (&BootOption);\r
ASSERT_EFI_ERROR (Status);\r
Status = EfiBootManagerAddKeyOptionVariable (\r
- NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL\r
+ NULL,\r
+ (UINT16)BootOption.OptionNumber,\r
+ 0,\r
+ &F2,\r
+ NULL\r
);\r
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);\r
Status = EfiBootManagerAddKeyOptionVariable (\r
- NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL\r
+ NULL,\r
+ (UINT16)BootOption.OptionNumber,\r
+ 0,\r
+ &Esc,\r
+ NULL\r
);\r
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);\r
}\r
\r
-\r
//\r
// BDS Platform Functions\r
//\r
+\r
/**\r
Do the platform init, can be customized by OEM/IBV\r
Possible things that can be done in PlatformBootManagerBeforeConsole:\r
VOID\r
)\r
{\r
- UINT16 FrontPageTimeout;\r
- RETURN_STATUS PcdStatus;\r
- EFI_STATUS Status;\r
+ UINT16 FrontPageTimeout;\r
+ RETURN_STATUS PcdStatus;\r
+ EFI_STATUS Status;\r
\r
//\r
// Signal EndOfDxe PI Event\r
//\r
// Add the hardcoded short-form USB keyboard device path to ConIn.\r
//\r
- EfiBootManagerUpdateConsoleVariable (ConIn,\r
- (EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard, NULL);\r
+ EfiBootManagerUpdateConsoleVariable (\r
+ ConIn,\r
+ (EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard,\r
+ NULL\r
+ );\r
\r
//\r
// Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.\r
//\r
- CopyGuid (&mSerialConsole.TermType.Guid,\r
- PcdGetPtr (PcdTerminalTypeGuidBuffer));\r
- EfiBootManagerUpdateConsoleVariable (ConIn,\r
- (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);\r
- EfiBootManagerUpdateConsoleVariable (ConOut,\r
- (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);\r
- EfiBootManagerUpdateConsoleVariable (ErrOut,\r
- (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);\r
+ CopyGuid (\r
+ &mSerialConsole.TermType.Guid,\r
+ PcdGetPtr (PcdTerminalTypeGuidBuffer)\r
+ );\r
+ EfiBootManagerUpdateConsoleVariable (\r
+ ConIn,\r
+ (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole,\r
+ NULL\r
+ );\r
+ EfiBootManagerUpdateConsoleVariable (\r
+ ConOut,\r
+ (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole,\r
+ NULL\r
+ );\r
+ EfiBootManagerUpdateConsoleVariable (\r
+ ErrOut,\r
+ (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole,\r
+ NULL\r
+ );\r
\r
//\r
// Set the front page timeout from the QEMU configuration.\r
//\r
FrontPageTimeout = GetFrontPageTimeoutFromQemu ();\r
- PcdStatus = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);\r
+ PcdStatus = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);\r
ASSERT_RETURN_ERROR (PcdStatus);\r
//\r
// Reflect the PCD in the standard Timeout variable.\r
VOID\r
)\r
{\r
- RETURN_STATUS Status;\r
+ RETURN_STATUS Status;\r
\r
//\r
// Show the splash screen.\r
// Register UEFI Shell\r
//\r
PlatformRegisterFvBootOption (\r
- &gUefiShellFileGuid, L"EFI Internal Shell", LOAD_OPTION_ACTIVE\r
+ &gUefiShellFileGuid,\r
+ L"EFI Internal Shell",\r
+ LOAD_OPTION_ACTIVE\r
);\r
\r
RemoveStaleFvFileOptions ();\r
VOID\r
EFIAPI\r
PlatformBootManagerWaitCallback (\r
- UINT16 TimeoutRemain\r
+ UINT16 TimeoutRemain\r
)\r
{\r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;\r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;\r
- UINT16 TimeoutInitial;\r
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;\r
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;\r
+ UINT16 TimeoutInitial;\r
\r
TimeoutInitial = PcdGet16 (PcdPlatformBootTimeOut);\r
\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_INPUT_KEY Key;\r
- EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;\r
- UINTN Index;\r
+ EFI_STATUS Status;\r
+ EFI_INPUT_KEY Key;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;\r
+ UINTN Index;\r
\r
//\r
// BootManagerMenu doesn't contain the correct information when return status\r
if (EFI_ERROR (Status)) {\r
return;\r
}\r
+\r
//\r
// Normally BdsDxe does not print anything to the system console, but this is\r
// a last resort -- the end-user will likely not see any DEBUG messages\r
}\r
}\r
\r
- for (;;) {\r
+ for ( ; ;) {\r
EfiBootManagerBoot (&BootManagerMenu);\r
}\r
}\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_HANDLE KernelImageHandle;\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE KernelImageHandle;\r
\r
Status = QemuLoadKernelImage (&KernelImageHandle);\r
if (EFI_ERROR (Status)) {\r
//\r
// Signal the EFI_EVENT_GROUP_READY_TO_BOOT event.\r
//\r
- EfiSignalEventReadyToBoot();\r
+ EfiSignalEventReadyToBoot ();\r
\r
- REPORT_STATUS_CODE (EFI_PROGRESS_CODE,\r
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));\r
+ REPORT_STATUS_CODE (\r
+ EFI_PROGRESS_CODE,\r
+ (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)\r
+ );\r
\r
//\r
// Start the image.\r
//\r
Status = QemuStartKernelImage (&KernelImageHandle);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: QemuStartKernelImage(): %r\n", __FUNCTION__,\r
- Status));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: QemuStartKernelImage(): %r\n",\r
+ __FUNCTION__,\r
+ Status\r
+ ));\r
}\r
\r
QemuUnloadKernelImage (KernelImageHandle);\r
#include <Guid/EarlyPL011BaseAddress.h>\r
#include <Guid/FdtHob.h>\r
\r
-STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2DiscoveredPpi = {\r
+STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2DiscoveredPpi = {\r
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
&gOvmfTpmDiscoveredPpiGuid,\r
NULL\r
};\r
\r
-STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2InitializationDonePpi = {\r
+STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpm2InitializationDonePpi = {\r
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
&gPeiTpmInitializationDonePpiGuid,\r
NULL\r
VOID\r
)\r
{\r
- VOID *Base;\r
- VOID *NewBase;\r
- UINTN FdtSize;\r
- UINTN FdtPages;\r
- UINT64 *FdtHobData;\r
- UINT64 *UartHobData;\r
- INT32 Node, Prev;\r
- INT32 Parent, Depth;\r
- CONST CHAR8 *Compatible;\r
- CONST CHAR8 *CompItem;\r
- CONST CHAR8 *NodeStatus;\r
- INT32 Len;\r
- INT32 RangesLen;\r
- INT32 StatusLen;\r
- CONST UINT64 *RegProp;\r
- CONST UINT32 *RangesProp;\r
- UINT64 UartBase;\r
- UINT64 TpmBase;\r
- EFI_STATUS Status;\r
-\r
- Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
+ VOID *Base;\r
+ VOID *NewBase;\r
+ UINTN FdtSize;\r
+ UINTN FdtPages;\r
+ UINT64 *FdtHobData;\r
+ UINT64 *UartHobData;\r
+ INT32 Node, Prev;\r
+ INT32 Parent, Depth;\r
+ CONST CHAR8 *Compatible;\r
+ CONST CHAR8 *CompItem;\r
+ CONST CHAR8 *NodeStatus;\r
+ INT32 Len;\r
+ INT32 RangesLen;\r
+ INT32 StatusLen;\r
+ CONST UINT64 *RegProp;\r
+ CONST UINT32 *RangesProp;\r
+ UINT64 UartBase;\r
+ UINT64 TpmBase;\r
+ EFI_STATUS Status;\r
+\r
+ Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
ASSERT (Base != NULL);\r
ASSERT (fdt_check_header (Base) == 0);\r
\r
- FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);\r
+ FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);\r
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);\r
- NewBase = AllocatePages (FdtPages);\r
+ NewBase = AllocatePages (FdtPages);\r
ASSERT (NewBase != NULL);\r
fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));\r
\r
//\r
Parent = 0;\r
\r
- for (Prev = Depth = 0;; Prev = Node) {\r
+ for (Prev = Depth = 0; ; Prev = Node) {\r
Node = fdt_next_node (Base, Prev, &Depth);\r
if (Node < 0) {\r
break;\r
// Iterate over the NULL-separated items in the compatible string\r
//\r
for (CompItem = Compatible; CompItem != NULL && CompItem < Compatible + Len;\r
- CompItem += 1 + AsciiStrLen (CompItem)) {\r
-\r
+ CompItem += 1 + AsciiStrLen (CompItem))\r
+ {\r
if (AsciiStrCmp (CompItem, "arm,pl011") == 0) {\r
NodeStatus = fdt_getprop (Base, Node, "status", &StatusLen);\r
- if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {\r
+ if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {\r
continue;\r
}\r
\r
*UartHobData = UartBase;\r
break;\r
} else if (FeaturePcdGet (PcdTpm2SupportEnabled) &&\r
- AsciiStrCmp (CompItem, "tcg,tpm-tis-mmio") == 0) {\r
-\r
+ (AsciiStrCmp (CompItem, "tcg,tpm-tis-mmio") == 0))\r
+ {\r
RegProp = fdt_getprop (Base, Node, "reg", &Len);\r
ASSERT (Len == 8 || Len == 16);\r
if (Len == 8) {\r
// assume a single translated range with 2 cells for the parent base\r
//\r
if (RangesLen != Len + 2 * sizeof (UINT32)) {\r
- DEBUG ((DEBUG_WARN,\r
+ DEBUG ((\r
+ DEBUG_WARN,\r
"%a: 'ranges' property has unexpected size %d\n",\r
- __FUNCTION__, RangesLen));\r
+ __FUNCTION__,\r
+ RangesLen\r
+ ));\r
break;\r
}\r
\r
// advance RangesProp to the parent bus address\r
//\r
RangesProp = (UINT32 *)((UINT8 *)RangesProp + Len / 2);\r
- TpmBase += fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RangesProp));\r
+ TpmBase += fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RangesProp));\r
}\r
}\r
+\r
break;\r
}\r
}\r
} else {\r
Status = PeiServicesInstallPpi (&mTpm2InitializationDonePpi);\r
}\r
+\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
#include <Library/MemoryAllocationLib.h>\r
\r
// Number of Virtual Memory Map Descriptors\r
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5\r
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5\r
\r
//\r
// mach-virt's core peripherals such as the UART, the GIC and the RTC are\r
// in its entirety rather than device by device. Note that it does not\r
// cover any of the NOR flash banks or PCI resource windows.\r
//\r
-#define MACH_VIRT_PERIPH_BASE 0x08000000\r
-#define MACH_VIRT_PERIPH_SIZE SIZE_128MB\r
+#define MACH_VIRT_PERIPH_BASE 0x08000000\r
+#define MACH_VIRT_PERIPH_SIZE SIZE_128MB\r
\r
/**\r
Return the Virtual Memory Map of your platform\r
**/\r
VOID\r
ArmVirtGetMemoryMap (\r
- OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
+ OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
)\r
{\r
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;\r
\r
ASSERT (VirtualMemoryMap != NULL);\r
\r
- VirtualMemoryTable = AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *\r
- MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);\r
+ VirtualMemoryTable = AllocatePool (\r
+ sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *\r
+ MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS\r
+ );\r
\r
if (VirtualMemoryTable == NULL) {\r
DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__));\r
VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize);\r
VirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
\r
- DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"\r
- "\tPhysicalBase: 0x%lX\n"\r
- "\tVirtualBase: 0x%lX\n"\r
- "\tLength: 0x%lX\n",\r
- __FUNCTION__,\r
- VirtualMemoryTable[0].PhysicalBase,\r
- VirtualMemoryTable[0].VirtualBase,\r
- VirtualMemoryTable[0].Length));\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "%a: Dumping System DRAM Memory Map:\n"\r
+ "\tPhysicalBase: 0x%lX\n"\r
+ "\tVirtualBase: 0x%lX\n"\r
+ "\tLength: 0x%lX\n",\r
+ __FUNCTION__,\r
+ VirtualMemoryTable[0].PhysicalBase,\r
+ VirtualMemoryTable[0].VirtualBase,\r
+ VirtualMemoryTable[0].Length\r
+ ));\r
\r
// Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)\r
VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;\r
VOID\r
)\r
{\r
- VOID *DeviceTreeBase;\r
- INT32 Node, Prev;\r
- UINT64 NewBase, CurBase;\r
- UINT64 NewSize, CurSize;\r
- CONST CHAR8 *Type;\r
- INT32 Len;\r
- CONST UINT64 *RegProp;\r
- RETURN_STATUS PcdStatus;\r
+ VOID *DeviceTreeBase;\r
+ INT32 Node, Prev;\r
+ UINT64 NewBase, CurBase;\r
+ UINT64 NewSize, CurSize;\r
+ CONST CHAR8 *Type;\r
+ INT32 Len;\r
+ CONST UINT64 *RegProp;\r
+ RETURN_STATUS PcdStatus;\r
\r
NewBase = 0;\r
NewSize = 0;\r
//\r
// Look for the lowest memory node\r
//\r
- for (Prev = 0;; Prev = Node) {\r
+ for (Prev = 0; ; Prev = Node) {\r
Node = fdt_next_node (DeviceTreeBase, Prev, NULL);\r
if (Node < 0) {\r
break;\r
// Check for memory node\r
//\r
Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);\r
- if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {\r
+ if (Type && (AsciiStrnCmp (Type, "memory", Len) == 0)) {\r
//\r
// Get the 'reg' property of this node. For now, we will assume\r
// two 8 byte quantities for base and size, respectively.\r
//\r
RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);\r
- if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {\r
-\r
+ if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) {\r
CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));\r
CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));\r
\r
- DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",\r
- __FUNCTION__, CurBase, CurBase + CurSize - 1));\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "%a: System RAM @ 0x%lx - 0x%lx\n",\r
+ __FUNCTION__,\r
+ CurBase,\r
+ CurBase + CurSize - 1\r
+ ));\r
\r
- if (NewBase > CurBase || NewBase == 0) {\r
+ if ((NewBase > CurBase) || (NewBase == 0)) {\r
NewBase = CurBase;\r
NewSize = CurSize;\r
}\r
} else {\r
- DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: Failed to parse FDT memory node\n",\r
+ __FUNCTION__\r
+ ));\r
}\r
}\r
}\r
ASSERT (\r
(((UINT64)PcdGet64 (PcdFdBaseAddress) +\r
(UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||\r
- ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));\r
+ ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize))\r
+ );\r
\r
return RETURN_SUCCESS;\r
}\r
VOID\r
)\r
{\r
- UINTN TimerCtrlReg;\r
+ UINTN TimerCtrlReg;\r
\r
- TimerCtrlReg = ArmReadCntvCtl ();\r
+ TimerCtrlReg = ArmReadCntvCtl ();\r
TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;\r
ArmWriteCntvCtl (TimerCtrlReg);\r
}\r
VOID\r
)\r
{\r
- UINTN TimerCtrlReg;\r
+ UINTN TimerCtrlReg;\r
\r
- TimerCtrlReg = ArmReadCntvCtl ();\r
+ TimerCtrlReg = ArmReadCntvCtl ();\r
TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;\r
\r
//\r
VOID\r
)\r
{\r
- UINTN TimerCtrlReg;\r
+ UINTN TimerCtrlReg;\r
\r
- TimerCtrlReg = ArmReadCntvCtl ();\r
+ TimerCtrlReg = ArmReadCntvCtl ();\r
TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;\r
ArmWriteCntvCtl (TimerCtrlReg);\r
}\r
return ArmReadCntvTval ();\r
}\r
\r
-\r
VOID\r
EFIAPI\r
ArmGenericTimerSetTimerVal (\r
- IN UINTN Value\r
+ IN UINTN Value\r
)\r
{\r
ArmWriteCntvTval (Value);\r
VOID\r
EFIAPI\r
ArmGenericTimerSetTimerCtrlReg (\r
- UINTN Value\r
+ UINTN Value\r
)\r
{\r
ArmWriteCntvCtl (Value);\r
VOID\r
EFIAPI\r
ArmGenericTimerSetCompareVal (\r
- IN UINT64 Value\r
+ IN UINT64 Value\r
)\r
{\r
ArmWriteCntvCval (Value);\r
VOID\r
EFIAPI\r
ArmVirtGetMemoryMap (\r
- OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
+ OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
)\r
{\r
- EFI_PHYSICAL_ADDRESS TopOfAddressSpace;\r
+ EFI_PHYSICAL_ADDRESS TopOfAddressSpace;\r
\r
ASSERT (VirtualMemoryMap != NULL);\r
\r
EFI_STATUS\r
EFIAPI\r
PlatformHasAcpiDt (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
- FIRMWARE_CONFIG_ITEM FwCfgItem;\r
- UINTN FwCfgSize;\r
+ EFI_STATUS Status;\r
+ FIRMWARE_CONFIG_ITEM FwCfgItem;\r
+ UINTN FwCfgSize;\r
\r
//\r
// If we fail to install any of the necessary protocols below, the OS will be\r
// unbootable anyway (due to lacking hardware description), so tolerate no\r
// errors here.\r
//\r
- if (MAX_UINTN == MAX_UINT64 &&\r
+ if ((MAX_UINTN == MAX_UINT64) &&\r
!PcdGetBool (PcdForceNoAcpi) &&\r
!EFI_ERROR (\r
QemuFwCfgFindFile (\r
&FwCfgItem,\r
&FwCfgSize\r
)\r
- )) {\r
+ ))\r
+ {\r
//\r
// Only make ACPI available on 64-bit systems, and only if QEMU generates\r
// (a subset of) the ACPI tables.\r
OUT UINT64 *SystemMemorySize\r
)\r
{\r
- INT32 MemoryNode;\r
- INT32 AddressCells;\r
- INT32 SizeCells;\r
- INT32 Length;\r
- CONST INT32 *Prop;\r
+ INT32 MemoryNode;\r
+ INT32 AddressCells;\r
+ INT32 SizeCells;\r
+ INT32 Length;\r
+ CONST INT32 *Prop;\r
\r
if (fdt_check_header (DeviceTreeBlob) != 0) {\r
return FALSE;\r
// from the root node, or use the default if not provided.\r
//\r
AddressCells = 1;\r
- SizeCells = 1;\r
+ SizeCells = 1;\r
\r
Prop = fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length);\r
if (Length == 4) {\r
if (AddressCells > 1) {\r
*SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]);\r
}\r
+\r
Prop += AddressCells;\r
\r
*SystemMemorySize = fdt32_to_cpu (Prop[0]);\r
\r
VOID\r
CopyFdt (\r
- IN VOID *FdtDest,\r
- IN VOID *FdtSource\r
+ IN VOID *FdtDest,\r
+ IN VOID *FdtSource\r
)\r
{\r
- fdt_pack(FdtSource);\r
+ fdt_pack (FdtSource);\r
CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource));\r
}\r
\r
VOID\r
PrePiMain (\r
- IN UINTN UefiMemoryBase,\r
- IN UINTN StacksBase,\r
- IN UINT64 StartTimeStamp\r
+ IN UINTN UefiMemoryBase,\r
+ IN UINTN StacksBase,\r
+ IN UINT64 StartTimeStamp\r
)\r
{\r
- EFI_HOB_HANDOFF_INFO_TABLE* HobList;\r
- EFI_STATUS Status;\r
- CHAR8 Buffer[100];\r
- UINTN CharCount;\r
- UINTN StacksSize;\r
+ EFI_HOB_HANDOFF_INFO_TABLE *HobList;\r
+ EFI_STATUS Status;\r
+ CHAR8 Buffer[100];\r
+ UINTN CharCount;\r
+ UINTN StacksSize;\r
\r
// Initialize the architecture specific bits\r
ArchInitialize ();\r
\r
// Declare the PI/UEFI memory region\r
HobList = HobConstructor (\r
- (VOID*)UefiMemoryBase,\r
- FixedPcdGet32 (PcdSystemMemoryUefiRegionSize),\r
- (VOID*)UefiMemoryBase,\r
- (VOID*)StacksBase // The top of the UEFI Memory is reserved for the stacks\r
- );\r
+ (VOID *)UefiMemoryBase,\r
+ FixedPcdGet32 (PcdSystemMemoryUefiRegionSize),\r
+ (VOID *)UefiMemoryBase,\r
+ (VOID *)StacksBase // The top of the UEFI Memory is reserved for the stacks\r
+ );\r
PrePeiSetHobList (HobList);\r
\r
//\r
// modifications we made with the caches and MMU off (such as the applied\r
// relocations) don't become invisible once we turn them on.\r
//\r
- InvalidateDataCacheRange((VOID *)(UINTN)PcdGet64 (PcdFdBaseAddress), PcdGet32 (PcdFdSize));\r
+ InvalidateDataCacheRange ((VOID *)(UINTN)PcdGet64 (PcdFdBaseAddress), PcdGet32 (PcdFdSize));\r
\r
// Initialize MMU and Memory HOBs (Resource Descriptor HOBs)\r
Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize));\r
\r
// Initialize the Serial Port\r
SerialPortInitialize ();\r
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r",\r
- (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__);\r
- SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
+ CharCount = AsciiSPrint (\r
+ Buffer,\r
+ sizeof (Buffer),\r
+ "UEFI firmware (version %s built at %a on %a)\n\r",\r
+ (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString),\r
+ __TIME__,\r
+ __DATE__\r
+ );\r
+ SerialPortWrite ((UINT8 *)Buffer, CharCount);\r
\r
// Create the Stacks HOB (reserve the memory for all stacks)\r
StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize);\r
BuildStackHob (StacksBase, StacksSize);\r
\r
- //TODO: Call CpuPei as a library\r
+ // TODO: Call CpuPei as a library\r
BuildCpuHob (ArmGetPhysicalAddressBits (), PcdGet8 (PcdPrePiCpuIoSize));\r
\r
// Set the Boot Mode\r
\r
VOID\r
CEntryPoint (\r
- IN UINTN MpId,\r
- IN UINTN UefiMemoryBase,\r
- IN UINTN StacksBase\r
+ IN UINTN MpId,\r
+ IN UINTN UefiMemoryBase,\r
+ IN UINTN StacksBase\r
)\r
{\r
- UINT64 StartTimeStamp;\r
+ UINT64 StartTimeStamp;\r
\r
if (PerformanceMeasurementEnabled ()) {\r
// Initialize the Timer Library to setup the Timer HW controller\r
\r
VOID\r
RelocatePeCoffImage (\r
- IN EFI_PEI_FV_HANDLE FwVolHeader,\r
- IN PE_COFF_LOADER_READ_FILE ImageRead\r
+ IN EFI_PEI_FV_HANDLE FwVolHeader,\r
+ IN PE_COFF_LOADER_READ_FILE ImageRead\r
)\r
{\r
EFI_PEI_FILE_HANDLE FileHandle;\r
EFI_STATUS Status;\r
\r
FileHandle = NULL;\r
- Status = FfsFindNextFile (EFI_FV_FILETYPE_SECURITY_CORE, FwVolHeader,\r
- &FileHandle);\r
+ Status = FfsFindNextFile (\r
+ EFI_FV_FILETYPE_SECURITY_CORE,\r
+ FwVolHeader,\r
+ &FileHandle\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
Status = FfsFindSectionData (EFI_SECTION_PE32, FileHandle, &SectionData);\r
if (EFI_ERROR (Status)) {\r
Status = FfsFindSectionData (EFI_SECTION_TE, FileHandle, &SectionData);\r
}\r
+\r
ASSERT_EFI_ERROR (Status);\r
\r
ZeroMem (&ImageContext, sizeof ImageContext);\r
\r
- ImageContext.Handle = (EFI_HANDLE)SectionData;\r
- ImageContext.ImageRead = ImageRead;\r
+ ImageContext.Handle = (EFI_HANDLE)SectionData;\r
+ ImageContext.ImageRead = ImageRead;\r
PeCoffLoaderGetImageInfo (&ImageContext);\r
\r
if (ImageContext.ImageAddress != (UINTN)SectionData) {\r
\r
VOID\r
PrePiMain (\r
- IN UINTN UefiMemoryBase,\r
- IN UINTN StacksBase,\r
- IN UINT64 StartTimeStamp\r
+ IN UINTN UefiMemoryBase,\r
+ IN UINTN StacksBase,\r
+ IN UINT64 StartTimeStamp\r
);\r
\r
EFI_STATUS\r
EFIAPI\r
MemoryPeim (\r
- IN EFI_PHYSICAL_ADDRESS UefiMemoryBase,\r
- IN UINT64 UefiMemorySize\r
+ IN EFI_PHYSICAL_ADDRESS UefiMemoryBase,\r
+ IN UINT64 UefiMemorySize\r
);\r
\r
EFI_STATUS\r
EFI_STATUS\r
EFIAPI\r
GetXenArmAcpiRsdp (\r
- OUT EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER **RsdpPtr\r
+ OUT EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER **RsdpPtr\r
)\r
{\r
- EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdpStructurePtr;\r
- EFI_STATUS Status;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- CONST UINT64 *Reg;\r
- UINT32 RegSize;\r
- UINTN AddressCells, SizeCells;\r
- UINT64 RegBase;\r
- UINT8 Sum;\r
+ EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdpStructurePtr;\r
+ EFI_STATUS Status;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ CONST UINT64 *Reg;\r
+ UINT32 RegSize;\r
+ UINTN AddressCells, SizeCells;\r
+ UINT64 RegBase;\r
+ UINT8 Sum;\r
\r
RsdpStructurePtr = NULL;\r
- FdtClient = NULL;\r
+ FdtClient = NULL;\r
//\r
// Get the RSDP structure address from DeviceTree\r
//\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
- Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,guest-acpi",\r
- (CONST VOID **)&Reg, &AddressCells, &SizeCells,\r
- &RegSize);\r
+ Status = FdtClient->FindCompatibleNodeReg (\r
+ FdtClient,\r
+ "xen,guest-acpi",\r
+ (CONST VOID **)&Reg,\r
+ &AddressCells,\r
+ &SizeCells,\r
+ &RegSize\r
+ );\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_WARN, "%a: No 'xen,guest-acpi' compatible DT node found\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_WARN,\r
+ "%a: No 'xen,guest-acpi' compatible DT node found\n",\r
+ __FUNCTION__\r
+ ));\r
return EFI_NOT_FOUND;\r
}\r
\r
ASSERT (SizeCells == 2);\r
ASSERT (RegSize == 2 * sizeof (UINT64));\r
\r
- RegBase = SwapBytes64(Reg[0]);\r
+ RegBase = SwapBytes64 (Reg[0]);\r
RsdpStructurePtr =\r
(EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)RegBase;\r
\r
- if (RsdpStructurePtr && RsdpStructurePtr->Revision >= 2) {\r
- Sum = CalculateSum8 ((CONST UINT8 *)RsdpStructurePtr,\r
- sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER));\r
+ if (RsdpStructurePtr && (RsdpStructurePtr->Revision >= 2)) {\r
+ Sum = CalculateSum8 (\r
+ (CONST UINT8 *)RsdpStructurePtr,\r
+ sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)\r
+ );\r
if (Sum != 0) {\r
return EFI_ABORTED;\r
}\r
EFI_STATUS\r
EFIAPI\r
InstallXenArmTables (\r
- IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol\r
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol\r
)\r
{\r
- EFI_STATUS Status;\r
- UINTN TableHandle;\r
- VOID *CurrentTableEntry;\r
- UINTN CurrentTablePointer;\r
- EFI_ACPI_DESCRIPTION_HEADER *CurrentTable;\r
- UINTN Index;\r
- UINTN NumberOfTableEntries;\r
- EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *XenAcpiRsdpStructurePtr;\r
- EFI_ACPI_DESCRIPTION_HEADER *Xsdt;\r
- EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtTable;\r
- EFI_ACPI_DESCRIPTION_HEADER *DsdtTable;\r
+ EFI_STATUS Status;\r
+ UINTN TableHandle;\r
+ VOID *CurrentTableEntry;\r
+ UINTN CurrentTablePointer;\r
+ EFI_ACPI_DESCRIPTION_HEADER *CurrentTable;\r
+ UINTN Index;\r
+ UINTN NumberOfTableEntries;\r
+ EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *XenAcpiRsdpStructurePtr;\r
+ EFI_ACPI_DESCRIPTION_HEADER *Xsdt;\r
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtTable;\r
+ EFI_ACPI_DESCRIPTION_HEADER *DsdtTable;\r
\r
XenAcpiRsdpStructurePtr = NULL;\r
- FadtTable = NULL;\r
- DsdtTable = NULL;\r
- TableHandle = 0;\r
- NumberOfTableEntries = 0;\r
+ FadtTable = NULL;\r
+ DsdtTable = NULL;\r
+ TableHandle = 0;\r
+ NumberOfTableEntries = 0;\r
\r
//\r
// Try to find Xen ARM ACPI tables\r
// Retrieve the addresses of XSDT and\r
// calculate the number of its table entries.\r
//\r
- Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN)\r
- XenAcpiRsdpStructurePtr->XsdtAddress;\r
+ Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)\r
+ XenAcpiRsdpStructurePtr->XsdtAddress;\r
NumberOfTableEntries = (Xsdt->Length -\r
- sizeof (EFI_ACPI_DESCRIPTION_HEADER)) /\r
- sizeof (UINT64);\r
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER)) /\r
+ sizeof (UINT64);\r
//\r
// Install ACPI tables found in XSDT.\r
//\r
//\r
// Get the table entry from XSDT\r
//\r
- CurrentTableEntry = (VOID *) ((UINT8 *) Xsdt +\r
- sizeof (EFI_ACPI_DESCRIPTION_HEADER) +\r
- Index * sizeof (UINT64));\r
- CurrentTablePointer = (UINTN) *(UINT64 *)CurrentTableEntry;\r
- CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;\r
+ CurrentTableEntry = (VOID *)((UINT8 *)Xsdt +\r
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER) +\r
+ Index * sizeof (UINT64));\r
+ CurrentTablePointer = (UINTN)*(UINT64 *)CurrentTableEntry;\r
+ CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *)CurrentTablePointer;\r
\r
//\r
// Install the XSDT tables\r
//\r
Status = AcpiProtocol->InstallAcpiTable (\r
- AcpiProtocol,\r
- CurrentTable,\r
- CurrentTable->Length,\r
- &TableHandle\r
- );\r
+ AcpiProtocol,\r
+ CurrentTable,\r
+ CurrentTable->Length,\r
+ &TableHandle\r
+ );\r
\r
if (EFI_ERROR (Status)) {\r
return Status;\r
//\r
// Get the FACS and DSDT table address from the table FADT\r
//\r
- if (!AsciiStrnCmp ((CHAR8 *) &CurrentTable->Signature, "FACP", 4)) {\r
+ if (!AsciiStrnCmp ((CHAR8 *)&CurrentTable->Signature, "FACP", 4)) {\r
FadtTable = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)\r
- (UINTN) CurrentTablePointer;\r
- DsdtTable = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) FadtTable->Dsdt;\r
+ (UINTN)CurrentTablePointer;\r
+ DsdtTable = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)FadtTable->Dsdt;\r
}\r
}\r
}\r
// Install DSDT table.\r
//\r
Status = AcpiProtocol->InstallAcpiTable (\r
- AcpiProtocol,\r
- DsdtTable,\r
- DsdtTable->Length,\r
- &TableHandle\r
- );\r
+ AcpiProtocol,\r
+ DsdtTable,\r
+ DsdtTable->Length,\r
+ &TableHandle\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;\r
+ EFI_STATUS Status;\r
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;\r
\r
AcpiTable = NULL;\r
- Status = gBS->LocateProtocol (\r
- &gEfiAcpiTableProtocolGuid,\r
- NULL,\r
- (VOID**)&AcpiTable\r
- );\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiAcpiTableProtocolGuid,\r
+ NULL,\r
+ (VOID **)&AcpiTable\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
return AcpiTable;\r
}\r
@return EFI_OUT_OF_RESOURCES\r
\r
**/\r
-\r
EFI_STATUS\r
EFIAPI\r
XenAcpiPlatformEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = InstallXenArmTables (FindAcpiTableProtocol ());\r
return Status;\r
EFI_STATUS\r
EFIAPI\r
XenPlatformHasAcpiDt (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
//\r
// If we fail to install any of the necessary protocols below, the OS will be\r
EFI_STATUS\r
EFIAPI\r
InitializeXenioFdtDxe (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- CONST UINT64 *Reg;\r
- UINT32 RegSize;\r
- UINTN AddressCells, SizeCells;\r
- EFI_HANDLE Handle;\r
- UINT64 RegBase;\r
+ EFI_STATUS Status;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ CONST UINT64 *Reg;\r
+ UINT32 RegSize;\r
+ UINTN AddressCells, SizeCells;\r
+ EFI_HANDLE Handle;\r
+ UINT64 RegBase;\r
\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
+ Status = gBS->LocateProtocol (\r
+ &gFdtClientProtocolGuid,\r
+ NULL,\r
+ (VOID **)&FdtClient\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
- Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,xen",\r
- (CONST VOID **)&Reg, &AddressCells, &SizeCells,\r
- &RegSize);\r
+ Status = FdtClient->FindCompatibleNodeReg (\r
+ FdtClient,\r
+ "xen,xen",\r
+ (CONST VOID **)&Reg,\r
+ &AddressCells,\r
+ &SizeCells,\r
+ &RegSize\r
+ );\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_WARN, "%a: No 'xen,xen' compatible DT node found\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_WARN,\r
+ "%a: No 'xen,xen' compatible DT node found\n",\r
+ __FUNCTION__\r
+ ));\r
return EFI_UNSUPPORTED;\r
}\r
\r
// MMIO flavor of the XenBus root device I/O protocol\r
//\r
RegBase = SwapBytes64 (Reg[0]);\r
- Handle = NULL;\r
- Status = XenIoMmioInstall (&Handle, RegBase);\r
+ Handle = NULL;\r
+ Status = XenIoMmioInstall (&Handle, RegBase);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "%a: XenIoMmioInstall () failed on a new handle "\r
- "(Status == %r)\n", __FUNCTION__, Status));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: XenIoMmioInstall () failed on a new handle "\r
+ "(Status == %r)\n",\r
+ __FUNCTION__,\r
+ Status\r
+ ));\r
return Status;\r
}\r
\r