mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 08:04:07 +02:00
ArmVirtPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the ArmVirtPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
parent
40b0b23ed3
commit
2b16a4fb91
@ -32,7 +32,7 @@ FindAcpiTableProtocol (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiAcpiTableProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&AcpiTable
|
||||
(VOID **)&AcpiTable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return AcpiTable;
|
||||
@ -97,7 +97,8 @@ InstallCloudHvAcpiTables (
|
||||
//
|
||||
if ((DsdtPtr == NULL) &&
|
||||
(EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE ==
|
||||
((EFI_ACPI_COMMON_HEADER *)AcpiTablePtr)->Signature)) {
|
||||
((EFI_ACPI_COMMON_HEADER *)AcpiTablePtr)->Signature))
|
||||
{
|
||||
DsdtPtr = (UINT64 *)((EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE *)AcpiTablePtr)->XDsdt;
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,9 @@ PlatformHasAcpiDt (
|
||||
// unbootable anyway (due to lacking hardware description), so tolerate no
|
||||
// errors here.
|
||||
//
|
||||
if (MAX_UINTN == MAX_UINT64 &&
|
||||
!PcdGetBool (PcdForceNoAcpi)) {
|
||||
if ((MAX_UINTN == MAX_UINT64) &&
|
||||
!PcdGetBool (PcdForceNoAcpi))
|
||||
{
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&ImageHandle,
|
||||
&gEdkiiPlatformHasAcpiGuid,
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef __EARLY_PL011_BASE_ADDRESS_H__
|
||||
#define __EARLY_PL011_BASE_ADDRESS_H__
|
||||
|
||||
#define EARLY_PL011_BASE_ADDRESS_GUID { \
|
||||
#define EARLY_PL011_BASE_ADDRESS_GUID {\
|
||||
0xB199DEA9, 0xFD5C, 0x4A84, \
|
||||
{ 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } \
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ GetNextHob (
|
||||
|
||||
ASSERT (HobStart != NULL);
|
||||
|
||||
Hob.Raw = (UINT8 *) HobStart;
|
||||
Hob.Raw = (UINT8 *)HobStart;
|
||||
//
|
||||
// Parse the HOB list until end of list or matching type is found.
|
||||
//
|
||||
@ -117,8 +117,10 @@ GetNextHob (
|
||||
if (Hob.Header->HobType == Type) {
|
||||
return Hob.Raw;
|
||||
}
|
||||
|
||||
Hob.Raw = GET_NEXT_HOB (Hob);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -178,13 +180,15 @@ GetNextGuidHob (
|
||||
{
|
||||
EFI_PEI_HOB_POINTERS GuidHob;
|
||||
|
||||
GuidHob.Raw = (UINT8 *) HobStart;
|
||||
GuidHob.Raw = (UINT8 *)HobStart;
|
||||
while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
|
||||
if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
|
||||
break;
|
||||
}
|
||||
|
||||
GuidHob.Raw = GET_NEXT_HOB (GuidHob);
|
||||
}
|
||||
|
||||
return GuidHob.Raw;
|
||||
}
|
||||
|
||||
@ -239,7 +243,7 @@ GetBootModeHob (
|
||||
{
|
||||
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
||||
|
||||
HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
|
||||
HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList ();
|
||||
|
||||
return HandOffHob->BootMode;
|
||||
}
|
||||
|
@ -37,26 +37,39 @@ ArmVirtGicArchLibConstructor (
|
||||
UINT64 DistBase, CpuBase, RedistBase;
|
||||
RETURN_STATUS PcdStatus;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
GicRevision = 2;
|
||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,cortex-a15-gic",
|
||||
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||
&RegSize);
|
||||
Status = FdtClient->FindCompatibleNodeReg (
|
||||
FdtClient,
|
||||
"arm,cortex-a15-gic",
|
||||
(CONST VOID **)&Reg,
|
||||
&AddressCells,
|
||||
&SizeCells,
|
||||
&RegSize
|
||||
);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
GicRevision = 3;
|
||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,gic-v3",
|
||||
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||
&RegSize);
|
||||
Status = FdtClient->FindCompatibleNodeReg (
|
||||
FdtClient,
|
||||
"arm,gic-v3",
|
||||
(CONST VOID **)&Reg,
|
||||
&AddressCells,
|
||||
&SizeCells,
|
||||
&RegSize
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
switch (GicRevision) {
|
||||
|
||||
case 3:
|
||||
//
|
||||
// The GIC v3 DT binding describes a series of at least 3 physical (base
|
||||
@ -85,8 +98,12 @@ ArmVirtGicArchLibConstructor (
|
||||
PcdStatus = PcdSet64S (PcdGicRedistributorsBase, RedistBase);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Found GIC v3 (re)distributor @ 0x%Lx (0x%Lx)\n",
|
||||
DistBase, RedistBase));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"Found GIC v3 (re)distributor @ 0x%Lx (0x%Lx)\n",
|
||||
DistBase,
|
||||
RedistBase
|
||||
));
|
||||
|
||||
//
|
||||
// The default implementation of ArmGicArchLib is responsible for enabling
|
||||
@ -136,6 +153,7 @@ ArmVirtGicArchLibConstructor (
|
||||
DEBUG ((DEBUG_ERROR, "%a: No GIC revision specified!\n", __FUNCTION__));
|
||||
return RETURN_NOT_FOUND;
|
||||
}
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ InitMmu (
|
||||
// Get Virtual Memory Map from the Platform Library
|
||||
ArmVirtGetMemoryMap (&MemoryTable);
|
||||
|
||||
//Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() the MMU Page Table resides in
|
||||
// Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() the MMU Page Table resides in
|
||||
// DRAM (even at the top of DRAM as it is the first permanent memory allocation)
|
||||
Status = ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -98,7 +98,7 @@ MemoryPeim (
|
||||
// that the contents we put there with the caches and MMU off will still
|
||||
// be visible after turning them on.
|
||||
//
|
||||
InvalidateDataCacheRange ((VOID*)(UINTN)UefiMemoryBase, UefiMemorySize);
|
||||
InvalidateDataCacheRange ((VOID *)(UINTN)UefiMemoryBase, UefiMemorySize);
|
||||
|
||||
// Build Memory Allocation Hob
|
||||
InitMmu ();
|
||||
|
@ -30,23 +30,36 @@ ArmVirtPL031FdtClientLibConstructor (
|
||||
UINT64 RegBase;
|
||||
RETURN_STATUS PcdStatus;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNode (FdtClient, "arm,pl031", &Node);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: No 'arm,pl031' compatible DT node found\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: No 'arm,pl031' compatible DT node found\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",
|
||||
(CONST VOID **)&Reg, &RegSize);
|
||||
Status = FdtClient->GetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"reg",
|
||||
(CONST VOID **)&Reg,
|
||||
&RegSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN,
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: No 'reg' property found in 'arm,pl031' compatible DT node\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -66,8 +79,13 @@ ArmVirtPL031FdtClientLibConstructor (
|
||||
// need to disable it in the device tree to prevent the OS from attaching
|
||||
// its device driver as well.
|
||||
//
|
||||
Status = FdtClient->SetNodeProperty (FdtClient, Node, "status",
|
||||
"disabled", sizeof ("disabled"));
|
||||
Status = FdtClient->SetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"status",
|
||||
"disabled",
|
||||
sizeof ("disabled")
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "Failed to set PL031 status to 'disabled'\n"));
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ STATIC CONST EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
|
||||
ACPI_DEVICE_PATH,
|
||||
ACPI_DP,
|
||||
{
|
||||
(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
|
||||
(UINT8)(sizeof (ACPI_HID_DEVICE_PATH)),
|
||||
(UINT8)((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
|
||||
}
|
||||
},
|
||||
EISA_PNP_ID (0x0A03), // HID
|
||||
@ -55,7 +55,6 @@ STATIC CONST EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED
|
||||
CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
|
||||
L"Mem", L"I/O", L"Bus"
|
||||
@ -103,11 +102,11 @@ PciHostBridgeUtilityGetRootBridges (
|
||||
(Mem == NULL) ||
|
||||
(MemAbove4G == NULL) ||
|
||||
(PMem == NULL) ||
|
||||
(PMemAbove4G == NULL)) {
|
||||
(PMemAbove4G == NULL))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
*Count = 1;
|
||||
|
||||
mRootBridge.Segment = 0;
|
||||
@ -134,7 +133,7 @@ PciHostBridgeUtilityGetRootBridges (
|
||||
mRootBridge.PMemAbove4G.Limit = PMemAbove4G->Limit;
|
||||
|
||||
mRootBridge.DevicePath =
|
||||
(EFI_DEVICE_PATH_PROTOCOL*)&mEfiPciRootBridgeDevicePath;
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mEfiPciRootBridgeDevicePath;
|
||||
|
||||
return &mRootBridge;
|
||||
}
|
||||
@ -178,14 +177,16 @@ PciHostBridgeUtilityResourceConflict (
|
||||
{
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;
|
||||
UINTN RootBridgeIndex;
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "PciHostBridge: Resource conflict happens!\n"));
|
||||
|
||||
RootBridgeIndex = 0;
|
||||
Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR*)Configuration;
|
||||
Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Configuration;
|
||||
while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
|
||||
DEBUG ((DEBUG_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));
|
||||
for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {
|
||||
ASSERT (Descriptor->ResType <
|
||||
for ( ; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {
|
||||
ASSERT (
|
||||
Descriptor->ResType <
|
||||
ARRAY_SIZE (mPciHostBridgeAcpiAddressSpaceTypeStr)
|
||||
);
|
||||
DEBUG ((
|
||||
@ -207,12 +208,13 @@ PciHostBridgeUtilityResourceConflict (
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Skip the END descriptor for root bridge
|
||||
//
|
||||
ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR);
|
||||
Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR*)(
|
||||
(EFI_ACPI_END_TAG_DESCRIPTOR*)Descriptor + 1
|
||||
Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(
|
||||
(EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -39,12 +39,20 @@ ArmPsciResetSystemLibConstructor (
|
||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
||||
CONST VOID *Prop;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNodeProperty (FdtClient, "arm,psci-0.2",
|
||||
"method", &Prop, NULL);
|
||||
Status = FdtClient->FindCompatibleNodeProperty (
|
||||
FdtClient,
|
||||
"arm,psci-0.2",
|
||||
"method",
|
||||
&Prop,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@ -54,10 +62,15 @@ ArmPsciResetSystemLibConstructor (
|
||||
} else if (AsciiStrnCmp (Prop, "smc", 3) == 0) {
|
||||
mArmPsciMethod = 2;
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Unknown PSCI method \"%a\"\n", __FUNCTION__,
|
||||
Prop));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Unknown PSCI method \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
Prop
|
||||
));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -41,13 +41,13 @@ DiscoverPsciMethod (
|
||||
CONST CHAR8 *CompatibleItem;
|
||||
CONST VOID *Prop;
|
||||
|
||||
DeviceTreeBase = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
ASSERT (fdt_check_header (DeviceTreeBase) == 0);
|
||||
|
||||
//
|
||||
// Enumerate all FDT nodes looking for the PSCI node and capture the method
|
||||
//
|
||||
for (Prev = 0;; Prev = Node) {
|
||||
for (Prev = 0; ; Prev = Node) {
|
||||
Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
|
||||
if (Node < 0) {
|
||||
break;
|
||||
@ -62,16 +62,19 @@ DiscoverPsciMethod (
|
||||
// Iterate over the NULL-separated items in the compatible string
|
||||
//
|
||||
for (CompatibleItem = Compatible; CompatibleItem < Compatible + Len;
|
||||
CompatibleItem += 1 + AsciiStrLen (CompatibleItem)) {
|
||||
|
||||
CompatibleItem += 1 + AsciiStrLen (CompatibleItem))
|
||||
{
|
||||
if (AsciiStrCmp (CompatibleItem, "arm,psci-0.2") != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Prop = fdt_getprop (DeviceTreeBase, Node, "method", NULL);
|
||||
if (!Prop) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Missing PSCI method property\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Missing PSCI method property\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return PsciMethodUnknown;
|
||||
}
|
||||
|
||||
@ -80,12 +83,17 @@ DiscoverPsciMethod (
|
||||
} else if (AsciiStrnCmp (Prop, "smc", 3) == 0) {
|
||||
return PsciMethodSmc;
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Unknown PSCI method \"%a\"\n", __FUNCTION__,
|
||||
Prop));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Unknown PSCI method \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
Prop
|
||||
));
|
||||
return PsciMethodUnknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PsciMethodUnknown;
|
||||
}
|
||||
|
||||
|
@ -37,18 +37,28 @@ ArmVirtTimerFdtClientLibConstructor (
|
||||
INT32 SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;
|
||||
RETURN_STATUS PcdStatus;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNodeProperty (FdtClient, "arm,armv7-timer",
|
||||
"interrupts", (CONST VOID **)&InterruptProp,
|
||||
&PropSize);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
Status = FdtClient->FindCompatibleNodeProperty (FdtClient,
|
||||
"arm,armv8-timer", "interrupts",
|
||||
Status = FdtClient->FindCompatibleNodeProperty (
|
||||
FdtClient,
|
||||
"arm,armv7-timer",
|
||||
"interrupts",
|
||||
(CONST VOID **)&InterruptProp,
|
||||
&PropSize);
|
||||
&PropSize
|
||||
);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
Status = FdtClient->FindCompatibleNodeProperty (
|
||||
FdtClient,
|
||||
"arm,armv8-timer",
|
||||
"interrupts",
|
||||
(CONST VOID **)&InterruptProp,
|
||||
&PropSize
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -70,8 +80,14 @@ ArmVirtTimerFdtClientLibConstructor (
|
||||
HypIntrNum = PropSize < 48 ? 0 : SwapBytes32 (InterruptProp[3].Number)
|
||||
+ (InterruptProp[3].Type ? 16 : 0);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Found Timer interrupts %d, %d, %d, %d\n",
|
||||
SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"Found Timer interrupts %d, %d, %d, %d\n",
|
||||
SecIntrNum,
|
||||
IntrNum,
|
||||
VirtIntrNum,
|
||||
HypIntrNum
|
||||
));
|
||||
|
||||
PcdStatus = PcdSet32S (PcdArmArchTimerSecIntrNum, SecIntrNum);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <Base.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
@ -19,7 +18,6 @@
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
|
||||
/**
|
||||
Assert the validity of a PCI address. A valid PCI address should contain 1's
|
||||
only in the low 28 bits.
|
||||
@ -74,19 +72,18 @@ PciExpressLibInitialize (
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Gets the base address of PCI Express.
|
||||
|
||||
@return The base address of PCI Express.
|
||||
|
||||
**/
|
||||
VOID*
|
||||
VOID *
|
||||
GetPciExpressBaseAddress (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return (VOID*)(UINTN) mPciExpressBaseAddress;
|
||||
return (VOID *)(UINTN)mPciExpressBaseAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,7 +108,7 @@ PciExpressRead8 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioRead8 ((UINTN) GetPciExpressBaseAddress () + Address);
|
||||
return MmioRead8 ((UINTN)GetPciExpressBaseAddress () + Address);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,7 +135,7 @@ PciExpressWrite8 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioWrite8 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
|
||||
return MmioWrite8 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +166,7 @@ PciExpressOr8 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioOr8 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
|
||||
return MmioOr8 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,7 +197,7 @@ PciExpressAnd8 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioAnd8 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
|
||||
return MmioAnd8 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,7 +232,7 @@ PciExpressAndThenOr8 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioAndThenOr8 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
AndData,
|
||||
OrData
|
||||
);
|
||||
@ -272,7 +269,7 @@ PciExpressBitFieldRead8 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldRead8 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit
|
||||
);
|
||||
@ -313,7 +310,7 @@ PciExpressBitFieldWrite8 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldWrite8 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
Value
|
||||
@ -358,7 +355,7 @@ PciExpressBitFieldOr8 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldOr8 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
OrData
|
||||
@ -403,7 +400,7 @@ PciExpressBitFieldAnd8 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldAnd8 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
AndData
|
||||
@ -453,7 +450,7 @@ PciExpressBitFieldAndThenOr8 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldAndThenOr8 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
AndData,
|
||||
@ -484,7 +481,7 @@ PciExpressRead16 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioRead16 ((UINTN) GetPciExpressBaseAddress () + Address);
|
||||
return MmioRead16 ((UINTN)GetPciExpressBaseAddress () + Address);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -512,7 +509,7 @@ PciExpressWrite16 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioWrite16 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
|
||||
return MmioWrite16 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,7 +541,7 @@ PciExpressOr16 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioOr16 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
|
||||
return MmioOr16 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -576,7 +573,7 @@ PciExpressAnd16 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioAnd16 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
|
||||
return MmioAnd16 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -612,7 +609,7 @@ PciExpressAndThenOr16 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioAndThenOr16 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
AndData,
|
||||
OrData
|
||||
);
|
||||
@ -650,7 +647,7 @@ PciExpressBitFieldRead16 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldRead16 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit
|
||||
);
|
||||
@ -692,7 +689,7 @@ PciExpressBitFieldWrite16 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldWrite16 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
Value
|
||||
@ -738,7 +735,7 @@ PciExpressBitFieldOr16 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldOr16 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
OrData
|
||||
@ -784,7 +781,7 @@ PciExpressBitFieldAnd16 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldAnd16 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
AndData
|
||||
@ -835,7 +832,7 @@ PciExpressBitFieldAndThenOr16 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldAndThenOr16 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
AndData,
|
||||
@ -866,7 +863,7 @@ PciExpressRead32 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioRead32 ((UINTN) GetPciExpressBaseAddress () + Address);
|
||||
return MmioRead32 ((UINTN)GetPciExpressBaseAddress () + Address);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -894,7 +891,7 @@ PciExpressWrite32 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioWrite32 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
|
||||
return MmioWrite32 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -926,7 +923,7 @@ PciExpressOr32 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioOr32 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
|
||||
return MmioOr32 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -958,7 +955,7 @@ PciExpressAnd32 (
|
||||
)
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioAnd32 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
|
||||
return MmioAnd32 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -994,7 +991,7 @@ PciExpressAndThenOr32 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioAndThenOr32 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
AndData,
|
||||
OrData
|
||||
);
|
||||
@ -1032,7 +1029,7 @@ PciExpressBitFieldRead32 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldRead32 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit
|
||||
);
|
||||
@ -1074,7 +1071,7 @@ PciExpressBitFieldWrite32 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldWrite32 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
Value
|
||||
@ -1120,7 +1117,7 @@ PciExpressBitFieldOr32 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldOr32 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
OrData
|
||||
@ -1166,7 +1163,7 @@ PciExpressBitFieldAnd32 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldAnd32 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
AndData
|
||||
@ -1217,7 +1214,7 @@ PciExpressBitFieldAndThenOr32 (
|
||||
{
|
||||
ASSERT_INVALID_PCI_ADDRESS (Address);
|
||||
return MmioBitFieldAndThenOr32 (
|
||||
(UINTN) GetPciExpressBaseAddress () + Address,
|
||||
(UINTN)GetPciExpressBaseAddress () + Address,
|
||||
StartBit,
|
||||
EndBit,
|
||||
AndData,
|
||||
@ -1279,39 +1276,39 @@ PciExpressReadBuffer (
|
||||
*(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
|
||||
StartAddress += sizeof (UINT8);
|
||||
Size -= sizeof (UINT8);
|
||||
Buffer = (UINT8*)Buffer + 1;
|
||||
Buffer = (UINT8 *)Buffer + 1;
|
||||
}
|
||||
|
||||
if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
|
||||
if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
|
||||
//
|
||||
// Read a word if StartAddress is word aligned
|
||||
//
|
||||
WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
|
||||
WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
|
||||
|
||||
StartAddress += sizeof (UINT16);
|
||||
Size -= sizeof (UINT16);
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
Buffer = (UINT16 *)Buffer + 1;
|
||||
}
|
||||
|
||||
while (Size >= sizeof (UINT32)) {
|
||||
//
|
||||
// Read as many double words as possible
|
||||
//
|
||||
WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) PciExpressRead32 (StartAddress));
|
||||
WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)PciExpressRead32 (StartAddress));
|
||||
|
||||
StartAddress += sizeof (UINT32);
|
||||
Size -= sizeof (UINT32);
|
||||
Buffer = (UINT32*)Buffer + 1;
|
||||
Buffer = (UINT32 *)Buffer + 1;
|
||||
}
|
||||
|
||||
if (Size >= sizeof (UINT16)) {
|
||||
//
|
||||
// Read the last remaining word if exist
|
||||
//
|
||||
WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
|
||||
WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
|
||||
StartAddress += sizeof (UINT16);
|
||||
Size -= sizeof (UINT16);
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
Buffer = (UINT16 *)Buffer + 1;
|
||||
}
|
||||
|
||||
if (Size >= sizeof (UINT8)) {
|
||||
@ -1376,47 +1373,47 @@ PciExpressWriteBuffer (
|
||||
//
|
||||
// Write a byte if StartAddress is byte aligned
|
||||
//
|
||||
PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
|
||||
PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
|
||||
StartAddress += sizeof (UINT8);
|
||||
Size -= sizeof (UINT8);
|
||||
Buffer = (UINT8*)Buffer + 1;
|
||||
Buffer = (UINT8 *)Buffer + 1;
|
||||
}
|
||||
|
||||
if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
|
||||
if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
|
||||
//
|
||||
// Write a word if StartAddress is word aligned
|
||||
//
|
||||
PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
|
||||
PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
|
||||
StartAddress += sizeof (UINT16);
|
||||
Size -= sizeof (UINT16);
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
Buffer = (UINT16 *)Buffer + 1;
|
||||
}
|
||||
|
||||
while (Size >= sizeof (UINT32)) {
|
||||
//
|
||||
// Write as many double words as possible
|
||||
//
|
||||
PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer));
|
||||
PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32 *)Buffer));
|
||||
StartAddress += sizeof (UINT32);
|
||||
Size -= sizeof (UINT32);
|
||||
Buffer = (UINT32*)Buffer + 1;
|
||||
Buffer = (UINT32 *)Buffer + 1;
|
||||
}
|
||||
|
||||
if (Size >= sizeof (UINT16)) {
|
||||
//
|
||||
// Write the last remaining word if exist
|
||||
//
|
||||
PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
|
||||
PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
|
||||
StartAddress += sizeof (UINT16);
|
||||
Size -= sizeof (UINT16);
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
Buffer = (UINT16 *)Buffer + 1;
|
||||
}
|
||||
|
||||
if (Size >= sizeof (UINT8)) {
|
||||
//
|
||||
// Write the last remaining byte if exist
|
||||
//
|
||||
PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
|
||||
PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
|
||||
}
|
||||
|
||||
return ReturnValue;
|
||||
|
@ -83,6 +83,7 @@ GetSerialConsolePortAddress (
|
||||
if (Path == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
SerialConsoleNode = fdt_path_offset (Fdt, Path);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ SerialPortGetBaseAddress (
|
||||
//
|
||||
// Enumerate all FDT nodes looking for a PL011 and capture its base address
|
||||
//
|
||||
for (Prev = 0;; Prev = Node) {
|
||||
for (Prev = 0; ; Prev = Node) {
|
||||
Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
|
||||
if (Node < 0) {
|
||||
break;
|
||||
@ -89,11 +89,11 @@ SerialPortGetBaseAddress (
|
||||
// Iterate over the NULL-separated items in the compatible string
|
||||
//
|
||||
for (CompatibleItem = Compatible; CompatibleItem < Compatible + Len;
|
||||
CompatibleItem += 1 + AsciiStrLen (CompatibleItem)) {
|
||||
|
||||
CompatibleItem += 1 + AsciiStrLen (CompatibleItem))
|
||||
{
|
||||
if (AsciiStrCmp (CompatibleItem, "arm,pl011") == 0) {
|
||||
NodeStatus = fdt_getprop (DeviceTreeBase, Node, "status", &Len);
|
||||
if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {
|
||||
if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -101,13 +101,14 @@ SerialPortGetBaseAddress (
|
||||
if (Len != 16) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
UartBase = (UINTN)fdt64_to_cpu (ReadUnaligned64 (RegProperty));
|
||||
|
||||
BaudRate = (UINTN)FixedPcdGet64 (PcdUartDefaultBaudRate);
|
||||
ReceiveFifoDepth = 0; // Use the default value for Fifo depth
|
||||
Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity);
|
||||
DataBits = FixedPcdGet8 (PcdUartDefaultDataBits);
|
||||
StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);
|
||||
StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits);
|
||||
|
||||
Status = PL011UartInitializePort (
|
||||
UartBase,
|
||||
@ -124,6 +125,7 @@ SerialPortGetBaseAddress (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -150,6 +152,7 @@ SerialPortWrite (
|
||||
if (SerialRegisterBase != 0) {
|
||||
return PL011UartWrite ((UINTN)SerialRegisterBase, Buffer, NumberOfBytes);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -168,7 +171,7 @@ EFIAPI
|
||||
SerialPortRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -273,4 +276,3 @@ SerialPortSetAttributes (
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,10 @@ FdtPL011SerialPortLibInitialize (
|
||||
EFI_STOP_BITS_TYPE StopBits;
|
||||
|
||||
Hob = GetFirstGuidHob (&gEarlyPL011BaseAddressGuid);
|
||||
if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof *UartBase) {
|
||||
if ((Hob == NULL) || (GET_GUID_HOB_DATA_SIZE (Hob) != sizeof *UartBase)) {
|
||||
return RETURN_NOT_FOUND;
|
||||
}
|
||||
|
||||
UartBase = GET_GUID_HOB_DATA (Hob);
|
||||
|
||||
mSerialBaseAddress = (UINTN)*UartBase;
|
||||
@ -71,7 +72,7 @@ FdtPL011SerialPortLibInitialize (
|
||||
ReceiveFifoDepth = 0; // Use the default value for Fifo depth
|
||||
Parity = (EFI_PARITY_TYPE)PcdGet8 (PcdUartDefaultParity);
|
||||
DataBits = PcdGet8 (PcdUartDefaultDataBits);
|
||||
StopBits = (EFI_STOP_BITS_TYPE) PcdGet8 (PcdUartDefaultStopBits);
|
||||
StopBits = (EFI_STOP_BITS_TYPE)PcdGet8 (PcdUartDefaultStopBits);
|
||||
|
||||
return PL011UartInitializePort (
|
||||
mSerialBaseAddress,
|
||||
@ -104,6 +105,7 @@ SerialPortWrite (
|
||||
if (mSerialBaseAddress != 0) {
|
||||
return PL011UartWrite (mSerialBaseAddress, Buffer, NumberOfBytes);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -122,11 +124,12 @@ EFIAPI
|
||||
SerialPortRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
)
|
||||
{
|
||||
if (mSerialBaseAddress != 0) {
|
||||
return PL011UartRead (mSerialBaseAddress, Buffer, NumberOfBytes);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -146,6 +149,7 @@ SerialPortPoll (
|
||||
if (mSerialBaseAddress != 0) {
|
||||
return PL011UartPoll (mSerialBaseAddress);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -265,4 +269,3 @@ SerialPortGetControl (
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ PlatformPeim (
|
||||
UINT64 *FdtHobData;
|
||||
UINT64 *UartHobData;
|
||||
|
||||
Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
if ((Base == NULL) || (fdt_check_header (Base) != 0)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@ -48,7 +48,8 @@ KvmtoolRtcMapMemory (
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR, "Failed to add memory space. Status = %r\n",
|
||||
DEBUG_ERROR,
|
||||
"Failed to add memory space. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
|
@ -43,7 +43,7 @@ ArmVirtGetMemoryMap (
|
||||
|
||||
TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());
|
||||
|
||||
VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)
|
||||
VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR *)
|
||||
AllocatePages (
|
||||
EFI_SIZE_TO_PAGES (
|
||||
sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
|
||||
@ -92,7 +92,7 @@ ArmVirtGetMemoryMap (
|
||||
VirtualMemoryTable[Idx].Length = 0;
|
||||
VirtualMemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
|
||||
|
||||
ASSERT((Idx + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
|
||||
ASSERT ((Idx + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
|
||||
|
||||
*VirtualMemoryMap = VirtualMemoryTable;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ NorFlashPlatformInitialization (
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
SetupVariableStore (
|
||||
IN NOR_FLASH_DESCRIPTION * FlashDevice
|
||||
IN NOR_FLASH_DESCRIPTION *FlashDevice
|
||||
)
|
||||
{
|
||||
UINTN FlashRegion;
|
||||
@ -106,7 +106,8 @@ SetupVariableStore (
|
||||
|
||||
if ((FlashNvStorageVariableSize == 0) ||
|
||||
(FlashNvStorageFtwWorkingSize == 0) ||
|
||||
(FlashNvStorageFtwSpareSize == 0)) {
|
||||
(FlashNvStorageFtwSpareSize == 0))
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "FlashNvStorage size not defined\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@ -196,6 +197,7 @@ NorFlashPlatformGetDevices (
|
||||
*Count = mNorFlashDeviceCount;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -212,7 +214,7 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
NorFlashPlatformLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE * SystemTable
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
INT32 Node;
|
||||
@ -250,7 +252,8 @@ NorFlashPlatformLibConstructor (
|
||||
"cfi-flash",
|
||||
Node,
|
||||
&Node
|
||||
)) {
|
||||
))
|
||||
{
|
||||
Status = mFdtClient->GetNodeProperty (
|
||||
mFdtClient,
|
||||
Node,
|
||||
@ -278,15 +281,20 @@ NorFlashPlatformLibConstructor (
|
||||
&PropSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: GetNodeProperty () failed (Status == %r)\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
ASSERT ((PropSize % (4 * sizeof (UINT32))) == 0);
|
||||
|
||||
while ((PropSize >= (4 * sizeof (UINT32))) &&
|
||||
(mNorFlashDeviceCount < MAX_FLASH_DEVICES)) {
|
||||
(mNorFlashDeviceCount < MAX_FLASH_DEVICES))
|
||||
{
|
||||
Base = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[0]));
|
||||
Size = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));
|
||||
Reg += 4;
|
||||
@ -298,7 +306,8 @@ NorFlashPlatformLibConstructor (
|
||||
// The firmware is not updatable from inside the guest anyway.
|
||||
//
|
||||
if ((PcdGet64 (PcdFvBaseAddress) + PcdGet32 (PcdFvSize) > Base) &&
|
||||
(Base + Size) > PcdGet64 (PcdFvBaseAddress)) {
|
||||
((Base + Size) > PcdGet64 (PcdFvBaseAddress)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -326,6 +335,7 @@ NorFlashPlatformLibConstructor (
|
||||
UefiVarStoreIndex = mNorFlashDeviceCount - 1;
|
||||
mUefiVarStoreNode = Node;
|
||||
}
|
||||
|
||||
if (mNorFlashDevices[UefiVarStoreIndex].DeviceBaseAddress != 0) {
|
||||
return SetupVariableStore (&mNorFlashDevices[UefiVarStoreIndex]);
|
||||
}
|
||||
|
@ -43,22 +43,41 @@ NorFlashPlatformGetDevices (
|
||||
UINT64 Base;
|
||||
UINT64 Size;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Num = 0;
|
||||
for (FindNodeStatus = FdtClient->FindCompatibleNode (FdtClient,
|
||||
"cfi-flash", &Node);
|
||||
for (FindNodeStatus = FdtClient->FindCompatibleNode (
|
||||
FdtClient,
|
||||
"cfi-flash",
|
||||
&Node
|
||||
);
|
||||
!EFI_ERROR (FindNodeStatus) && Num < MAX_FLASH_BANKS;
|
||||
FindNodeStatus = FdtClient->FindNextCompatibleNode (FdtClient,
|
||||
"cfi-flash", Node, &Node)) {
|
||||
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",
|
||||
(CONST VOID **)&Reg, &PropSize);
|
||||
FindNodeStatus = FdtClient->FindNextCompatibleNode (
|
||||
FdtClient,
|
||||
"cfi-flash",
|
||||
Node,
|
||||
&Node
|
||||
))
|
||||
{
|
||||
Status = FdtClient->GetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"reg",
|
||||
(CONST VOID **)&Reg,
|
||||
&PropSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: GetNodeProperty () failed (Status == %r)\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -76,7 +95,8 @@ NorFlashPlatformGetDevices (
|
||||
// The firmware is not updatable from inside the guest anyway.
|
||||
//
|
||||
if ((PcdGet64 (PcdFvBaseAddress) + PcdGet32 (PcdFvSize) > Base) &&
|
||||
(Base + Size) > PcdGet64 (PcdFvBaseAddress)) {
|
||||
((Base + Size) > PcdGet64 (PcdFvBaseAddress)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -97,8 +117,13 @@ NorFlashPlatformGetDevices (
|
||||
// code, which is not intended to be guest updatable, and is usually backed
|
||||
// in a readonly manner by QEMU anyway.
|
||||
//
|
||||
Status = FdtClient->SetNodeProperty (FdtClient, Node, "status",
|
||||
"disabled", sizeof ("disabled"));
|
||||
Status = FdtClient->SetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"status",
|
||||
"disabled",
|
||||
sizeof ("disabled")
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "Failed to set NOR flash status to 'disabled'\n"));
|
||||
}
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
#define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }
|
||||
|
||||
|
||||
#pragma pack (1)
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH SerialDxe;
|
||||
@ -87,7 +86,6 @@ STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#pragma pack (1)
|
||||
typedef struct {
|
||||
USB_CLASS_DEVICE_PATH Keyboard;
|
||||
@ -120,7 +118,6 @@ STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Check if the handle satisfies a particular condition.
|
||||
|
||||
@ -134,12 +131,11 @@ STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = {
|
||||
**/
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *FILTER_FUNCTION) (
|
||||
(EFIAPI *FILTER_FUNCTION)(
|
||||
IN EFI_HANDLE Handle,
|
||||
IN CONST CHAR16 *ReportText
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Process a handle.
|
||||
|
||||
@ -149,7 +145,7 @@ BOOLEAN
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *CALLBACK_FUNCTION) (
|
||||
(EFIAPI *CALLBACK_FUNCTION)(
|
||||
IN EFI_HANDLE Handle,
|
||||
IN CONST CHAR16 *ReportText
|
||||
);
|
||||
@ -180,14 +176,24 @@ FilterAndProcess (
|
||||
UINTN NoHandles;
|
||||
UINTN Idx;
|
||||
|
||||
Status = gBS->LocateHandleBuffer (ByProtocol, ProtocolGuid,
|
||||
NULL /* SearchKey */, &NoHandles, &Handles);
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
ProtocolGuid,
|
||||
NULL /* SearchKey */,
|
||||
&NoHandles,
|
||||
&Handles
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// This is not an error, just an informative condition.
|
||||
//
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: %g: %r\n", __FUNCTION__, ProtocolGuid,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: %g: %r\n",
|
||||
__FUNCTION__,
|
||||
ProtocolGuid,
|
||||
Status
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -208,7 +214,7 @@ FilterAndProcess (
|
||||
DevicePathText = Fallback;
|
||||
}
|
||||
|
||||
if (Filter == NULL || Filter (Handles[Idx], DevicePathText)) {
|
||||
if ((Filter == NULL) || Filter (Handles[Idx], DevicePathText)) {
|
||||
Process (Handles[Idx], DevicePathText);
|
||||
}
|
||||
|
||||
@ -216,10 +222,10 @@ FilterAndProcess (
|
||||
FreePool (DevicePathText);
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (Handles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This FILTER_FUNCTION checks if a handle corresponds to a PCI display device.
|
||||
**/
|
||||
@ -235,8 +241,11 @@ IsPciDisplay (
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
PCI_TYPE00 Pci;
|
||||
|
||||
Status = gBS->HandleProtocol (Handle, &gEfiPciIoProtocolGuid,
|
||||
(VOID**)&PciIo);
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// This is not an error worth reporting.
|
||||
@ -244,8 +253,13 @@ IsPciDisplay (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0 /* Offset */,
|
||||
sizeof Pci / sizeof (UINT32), &Pci);
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint32,
|
||||
0 /* Offset */,
|
||||
sizeof Pci / sizeof (UINT32),
|
||||
&Pci
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: %s: %r\n", __FUNCTION__, ReportText, Status));
|
||||
return FALSE;
|
||||
@ -254,7 +268,6 @@ IsPciDisplay (
|
||||
return IS_PCI_DISPLAY (&Pci);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
|
||||
the VIRTIO_DEVICE_PROTOCOL level.
|
||||
@ -270,16 +283,19 @@ IsVirtioRng (
|
||||
EFI_STATUS Status;
|
||||
VIRTIO_DEVICE_PROTOCOL *VirtIo;
|
||||
|
||||
Status = gBS->HandleProtocol (Handle, &gVirtioDeviceProtocolGuid,
|
||||
(VOID**)&VirtIo);
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gVirtioDeviceProtocolGuid,
|
||||
(VOID **)&VirtIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return (BOOLEAN)(VirtIo->SubSystemDeviceId ==
|
||||
VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
|
||||
the EFI_PCI_IO_PROTOCOL level.
|
||||
@ -300,8 +316,11 @@ IsVirtioPciRng (
|
||||
BOOLEAN Virtio10;
|
||||
UINT16 SubsystemId;
|
||||
|
||||
Status = gBS->HandleProtocol (Handle, &gEfiPciIoProtocolGuid,
|
||||
(VOID**)&PciIo);
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -309,11 +328,17 @@ IsVirtioPciRng (
|
||||
//
|
||||
// Read and check VendorId.
|
||||
//
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_VENDOR_ID_OFFSET,
|
||||
1, &VendorId);
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
PCI_VENDOR_ID_OFFSET,
|
||||
1,
|
||||
&VendorId
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto PciError;
|
||||
}
|
||||
|
||||
if (VendorId != VIRTIO_VENDOR_ID) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -321,13 +346,24 @@ IsVirtioPciRng (
|
||||
//
|
||||
// Read DeviceId and RevisionId.
|
||||
//
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_DEVICE_ID_OFFSET,
|
||||
1, &DeviceId);
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
PCI_DEVICE_ID_OFFSET,
|
||||
1,
|
||||
&DeviceId
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto PciError;
|
||||
}
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, PCI_REVISION_ID_OFFSET,
|
||||
1, &RevisionId);
|
||||
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint8,
|
||||
PCI_REVISION_ID_OFFSET,
|
||||
1,
|
||||
&RevisionId
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto PciError;
|
||||
}
|
||||
@ -339,10 +375,11 @@ IsVirtioPciRng (
|
||||
// SubsystemId will only play a sanity-check role. Otherwise, DeviceId can
|
||||
// only be sanity-checked, and SubsystemId will decide.
|
||||
//
|
||||
if (DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE &&
|
||||
RevisionId >= 0x01) {
|
||||
if ((DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) &&
|
||||
(RevisionId >= 0x01))
|
||||
{
|
||||
Virtio10 = TRUE;
|
||||
} else if (DeviceId >= 0x1000 && DeviceId <= 0x103F && RevisionId == 0x00) {
|
||||
} else if ((DeviceId >= 0x1000) && (DeviceId <= 0x103F) && (RevisionId == 0x00)) {
|
||||
Virtio10 = FALSE;
|
||||
} else {
|
||||
return FALSE;
|
||||
@ -351,17 +388,25 @@ IsVirtioPciRng (
|
||||
//
|
||||
// Read and check SubsystemId as dictated by Virtio10.
|
||||
//
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16,
|
||||
PCI_SUBSYSTEM_ID_OFFSET, 1, &SubsystemId);
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
PCI_SUBSYSTEM_ID_OFFSET,
|
||||
1,
|
||||
&SubsystemId
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto PciError;
|
||||
}
|
||||
if (Virtio10 && SubsystemId >= 0x40) {
|
||||
|
||||
if (Virtio10 && (SubsystemId >= 0x40)) {
|
||||
return TRUE;
|
||||
}
|
||||
if (!Virtio10 && SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) {
|
||||
|
||||
if (!Virtio10 && (SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
PciError:
|
||||
@ -369,7 +414,6 @@ PciError:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking
|
||||
the matching driver to produce all first-level child handles.
|
||||
@ -390,11 +434,15 @@ Connect (
|
||||
NULL, // RemainingDevicePath -- produce all children
|
||||
FALSE // Recursive
|
||||
);
|
||||
DEBUG ((EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE, "%a: %s: %r\n",
|
||||
__FUNCTION__, ReportText, Status));
|
||||
DEBUG ((
|
||||
EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,
|
||||
"%a: %s: %r\n",
|
||||
__FUNCTION__,
|
||||
ReportText,
|
||||
Status
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This CALLBACK_FUNCTION retrieves the EFI_DEVICE_PATH_PROTOCOL from the
|
||||
handle, and adds it to ConOut and ErrOut.
|
||||
@ -412,27 +460,46 @@ AddOutput (
|
||||
|
||||
DevicePath = DevicePathFromHandle (Handle);
|
||||
if (DevicePath == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: %s: handle %p: device path not found\n",
|
||||
__FUNCTION__, ReportText, Handle));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: %s: handle %p: device path not found\n",
|
||||
__FUNCTION__,
|
||||
ReportText,
|
||||
Handle
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
Status = EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: %s: adding to ConOut: %r\n", __FUNCTION__,
|
||||
ReportText, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: %s: adding to ConOut: %r\n",
|
||||
__FUNCTION__,
|
||||
ReportText,
|
||||
Status
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
Status = EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: %s: adding to ErrOut: %r\n", __FUNCTION__,
|
||||
ReportText, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: %s: adding to ErrOut: %r\n",
|
||||
__FUNCTION__,
|
||||
ReportText,
|
||||
Status
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: %s: added to ConOut and ErrOut\n", __FUNCTION__,
|
||||
ReportText));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: %s: added to ConOut and ErrOut\n",
|
||||
__FUNCTION__,
|
||||
ReportText
|
||||
));
|
||||
}
|
||||
|
||||
STATIC
|
||||
@ -455,7 +522,7 @@ PlatformRegisterFvBootOption (
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &LoadedImage
|
||||
(VOID **)&LoadedImage
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -464,7 +531,7 @@ PlatformRegisterFvBootOption (
|
||||
ASSERT (DevicePath != NULL);
|
||||
DevicePath = AppendDevicePathNode (
|
||||
DevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &FileNode
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&FileNode
|
||||
);
|
||||
ASSERT (DevicePath != NULL);
|
||||
|
||||
@ -482,22 +549,25 @@ PlatformRegisterFvBootOption (
|
||||
FreePool (DevicePath);
|
||||
|
||||
BootOptions = EfiBootManagerGetLoadOptions (
|
||||
&BootOptionCount, LoadOptionTypeBoot
|
||||
&BootOptionCount,
|
||||
LoadOptionTypeBoot
|
||||
);
|
||||
|
||||
OptionIndex = EfiBootManagerFindLoadOption (
|
||||
&NewOption, BootOptions, BootOptionCount
|
||||
&NewOption,
|
||||
BootOptions,
|
||||
BootOptionCount
|
||||
);
|
||||
|
||||
if (OptionIndex == -1) {
|
||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
EfiBootManagerFreeLoadOption (&NewOption);
|
||||
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Remove all MemoryMapped(...)/FvFile(...) and Fv(...)/FvFile(...) boot options
|
||||
whose device paths do not resolve exactly to an FvFile in the system.
|
||||
@ -522,8 +592,10 @@ RemoveStaleFvFileOptions (
|
||||
UINTN BootOptionCount;
|
||||
UINTN Index;
|
||||
|
||||
BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount,
|
||||
LoadOptionTypeBoot);
|
||||
BootOptions = EfiBootManagerGetLoadOptions (
|
||||
&BootOptionCount,
|
||||
LoadOptionTypeBoot
|
||||
);
|
||||
|
||||
for (Index = 0; Index < BootOptionCount; ++Index) {
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node1, *Node2, *SearchNode;
|
||||
@ -535,10 +607,11 @@ RemoveStaleFvFileOptions (
|
||||
// then keep the boot option.
|
||||
//
|
||||
Node1 = BootOptions[Index].FilePath;
|
||||
if (!(DevicePathType (Node1) == HARDWARE_DEVICE_PATH &&
|
||||
DevicePathSubType (Node1) == HW_MEMMAP_DP) &&
|
||||
!(DevicePathType (Node1) == MEDIA_DEVICE_PATH &&
|
||||
DevicePathSubType (Node1) == MEDIA_PIWG_FW_VOL_DP)) {
|
||||
if (!((DevicePathType (Node1) == HARDWARE_DEVICE_PATH) &&
|
||||
(DevicePathSubType (Node1) == HW_MEMMAP_DP)) &&
|
||||
!((DevicePathType (Node1) == MEDIA_DEVICE_PATH) &&
|
||||
(DevicePathSubType (Node1) == MEDIA_PIWG_FW_VOL_DP)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -547,8 +620,9 @@ RemoveStaleFvFileOptions (
|
||||
// option.
|
||||
//
|
||||
Node2 = NextDevicePathNode (Node1);
|
||||
if (DevicePathType (Node2) != MEDIA_DEVICE_PATH ||
|
||||
DevicePathSubType (Node2) != MEDIA_PIWG_FW_FILE_DP) {
|
||||
if ((DevicePathType (Node2) != MEDIA_DEVICE_PATH) ||
|
||||
(DevicePathSubType (Node2) != MEDIA_PIWG_FW_FILE_DP))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -559,8 +633,11 @@ RemoveStaleFvFileOptions (
|
||||
// boot option.
|
||||
//
|
||||
SearchNode = Node1;
|
||||
Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid,
|
||||
&SearchNode, &FvHandle);
|
||||
Status = gBS->LocateDevicePath (
|
||||
&gEfiFirmwareVolume2ProtocolGuid,
|
||||
&SearchNode,
|
||||
&FvHandle
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
@ -574,8 +651,11 @@ RemoveStaleFvFileOptions (
|
||||
EFI_FV_FILE_ATTRIBUTES FileAttributes;
|
||||
UINT32 AuthenticationStatus;
|
||||
|
||||
Status = gBS->HandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid,
|
||||
(VOID **)&FvProtocol);
|
||||
Status = gBS->HandleProtocol (
|
||||
FvHandle,
|
||||
&gEfiFirmwareVolume2ProtocolGuid,
|
||||
(VOID **)&FvProtocol
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FvFileNode = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)Node2;
|
||||
@ -604,12 +684,17 @@ RemoveStaleFvFileOptions (
|
||||
// Delete the boot option.
|
||||
//
|
||||
Status = EfiBootManagerDeleteLoadOptionVariable (
|
||||
BootOptions[Index].OptionNumber, LoadOptionTypeBoot);
|
||||
BootOptions[Index].OptionNumber,
|
||||
LoadOptionTypeBoot
|
||||
);
|
||||
DEBUG_CODE_BEGIN ();
|
||||
CHAR16 *DevicePathString;
|
||||
|
||||
DevicePathString = ConvertDevicePathToText(BootOptions[Index].FilePath,
|
||||
FALSE, FALSE);
|
||||
DevicePathString = ConvertDevicePathToText (
|
||||
BootOptions[Index].FilePath,
|
||||
FALSE,
|
||||
FALSE
|
||||
);
|
||||
DEBUG ((
|
||||
EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,
|
||||
"%a: removing stale Boot#%04x %s: %r\n",
|
||||
@ -621,13 +706,13 @@ RemoveStaleFvFileOptions (
|
||||
if (DevicePathString != NULL) {
|
||||
FreePool (DevicePathString);
|
||||
}
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
}
|
||||
|
||||
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
PlatformRegisterOptionsAndKeys (
|
||||
@ -658,19 +743,27 @@ PlatformRegisterOptionsAndKeys (
|
||||
Status = EfiBootManagerGetBootManagerMenu (&BootOption);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
Status = EfiBootManagerAddKeyOptionVariable (
|
||||
NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL
|
||||
NULL,
|
||||
(UINT16)BootOption.OptionNumber,
|
||||
0,
|
||||
&F2,
|
||||
NULL
|
||||
);
|
||||
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
|
||||
Status = EfiBootManagerAddKeyOptionVariable (
|
||||
NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
|
||||
NULL,
|
||||
(UINT16)BootOption.OptionNumber,
|
||||
0,
|
||||
&Esc,
|
||||
NULL
|
||||
);
|
||||
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// BDS Platform Functions
|
||||
//
|
||||
|
||||
/**
|
||||
Do the platform init, can be customized by OEM/IBV
|
||||
Possible things that can be done in PlatformBootManagerBeforeConsole:
|
||||
@ -735,20 +828,34 @@ PlatformBootManagerBeforeConsole (
|
||||
//
|
||||
// Add the hardcoded short-form USB keyboard device path to ConIn.
|
||||
//
|
||||
EfiBootManagerUpdateConsoleVariable (ConIn,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard, NULL);
|
||||
EfiBootManagerUpdateConsoleVariable (
|
||||
ConIn,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
|
||||
//
|
||||
CopyGuid (&mSerialConsole.TermType.Guid,
|
||||
PcdGetPtr (PcdTerminalTypeGuidBuffer));
|
||||
EfiBootManagerUpdateConsoleVariable (ConIn,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
|
||||
EfiBootManagerUpdateConsoleVariable (ConOut,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
|
||||
EfiBootManagerUpdateConsoleVariable (ErrOut,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
|
||||
CopyGuid (
|
||||
&mSerialConsole.TermType.Guid,
|
||||
PcdGetPtr (PcdTerminalTypeGuidBuffer)
|
||||
);
|
||||
EfiBootManagerUpdateConsoleVariable (
|
||||
ConIn,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole,
|
||||
NULL
|
||||
);
|
||||
EfiBootManagerUpdateConsoleVariable (
|
||||
ConOut,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole,
|
||||
NULL
|
||||
);
|
||||
EfiBootManagerUpdateConsoleVariable (
|
||||
ErrOut,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// Set the front page timeout from the QEMU configuration.
|
||||
@ -848,7 +955,9 @@ PlatformBootManagerAfterConsole (
|
||||
// Register UEFI Shell
|
||||
//
|
||||
PlatformRegisterFvBootOption (
|
||||
&gUefiShellFileGuid, L"EFI Internal Shell", LOAD_OPTION_ACTIVE
|
||||
&gUefiShellFileGuid,
|
||||
L"EFI Internal Shell",
|
||||
LOAD_OPTION_ACTIVE
|
||||
);
|
||||
|
||||
RemoveStaleFvFileOptions ();
|
||||
@ -922,6 +1031,7 @@ PlatformBootManagerUnableToBoot (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Normally BdsDxe does not print anything to the system console, but this is
|
||||
// a last resort -- the end-user will likely not see any DEBUG messages
|
||||
@ -951,7 +1061,7 @@ PlatformBootManagerUnableToBoot (
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
for ( ; ;) {
|
||||
EfiBootManagerBoot (&BootManagerMenu);
|
||||
}
|
||||
}
|
||||
|
@ -51,18 +51,24 @@ TryRunningQemuKernel (
|
||||
//
|
||||
// Signal the EFI_EVENT_GROUP_READY_TO_BOOT event.
|
||||
//
|
||||
EfiSignalEventReadyToBoot();
|
||||
EfiSignalEventReadyToBoot ();
|
||||
|
||||
REPORT_STATUS_CODE (EFI_PROGRESS_CODE,
|
||||
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_PROGRESS_CODE,
|
||||
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)
|
||||
);
|
||||
|
||||
//
|
||||
// Start the image.
|
||||
//
|
||||
Status = QemuStartKernelImage (&KernelImageHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: QemuStartKernelImage(): %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: QemuStartKernelImage(): %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
}
|
||||
|
||||
QemuUnloadKernelImage (KernelImageHandle);
|
||||
|
@ -57,7 +57,7 @@ PlatformPeim (
|
||||
UINT64 TpmBase;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
ASSERT (Base != NULL);
|
||||
ASSERT (fdt_check_header (Base) == 0);
|
||||
|
||||
@ -82,7 +82,7 @@ PlatformPeim (
|
||||
//
|
||||
Parent = 0;
|
||||
|
||||
for (Prev = Depth = 0;; Prev = Node) {
|
||||
for (Prev = Depth = 0; ; Prev = Node) {
|
||||
Node = fdt_next_node (Base, Prev, &Depth);
|
||||
if (Node < 0) {
|
||||
break;
|
||||
@ -98,11 +98,11 @@ PlatformPeim (
|
||||
// Iterate over the NULL-separated items in the compatible string
|
||||
//
|
||||
for (CompItem = Compatible; CompItem != NULL && CompItem < Compatible + Len;
|
||||
CompItem += 1 + AsciiStrLen (CompItem)) {
|
||||
|
||||
CompItem += 1 + AsciiStrLen (CompItem))
|
||||
{
|
||||
if (AsciiStrCmp (CompItem, "arm,pl011") == 0) {
|
||||
NodeStatus = fdt_getprop (Base, Node, "status", &StatusLen);
|
||||
if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {
|
||||
if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -116,8 +116,8 @@ PlatformPeim (
|
||||
*UartHobData = UartBase;
|
||||
break;
|
||||
} else if (FeaturePcdGet (PcdTpm2SupportEnabled) &&
|
||||
AsciiStrCmp (CompItem, "tcg,tpm-tis-mmio") == 0) {
|
||||
|
||||
(AsciiStrCmp (CompItem, "tcg,tpm-tis-mmio") == 0))
|
||||
{
|
||||
RegProp = fdt_getprop (Base, Node, "reg", &Len);
|
||||
ASSERT (Len == 8 || Len == 16);
|
||||
if (Len == 8) {
|
||||
@ -145,9 +145,12 @@ PlatformPeim (
|
||||
// assume a single translated range with 2 cells for the parent base
|
||||
//
|
||||
if (RangesLen != Len + 2 * sizeof (UINT32)) {
|
||||
DEBUG ((DEBUG_WARN,
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: 'ranges' property has unexpected size %d\n",
|
||||
__FUNCTION__, RangesLen));
|
||||
__FUNCTION__,
|
||||
RangesLen
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -164,6 +167,7 @@ PlatformPeim (
|
||||
TpmBase += fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RangesProp));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -180,6 +184,7 @@ PlatformPeim (
|
||||
} else {
|
||||
Status = PeiServicesInstallPpi (&mTpm2InitializationDonePpi);
|
||||
}
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,10 @@ ArmVirtGetMemoryMap (
|
||||
|
||||
ASSERT (VirtualMemoryMap != NULL);
|
||||
|
||||
VirtualMemoryTable = AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
|
||||
MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
|
||||
VirtualMemoryTable = AllocatePool (
|
||||
sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
|
||||
MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS
|
||||
);
|
||||
|
||||
if (VirtualMemoryTable == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__));
|
||||
@ -60,14 +62,17 @@ ArmVirtGetMemoryMap (
|
||||
VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize);
|
||||
VirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Dumping System DRAM Memory Map:\n"
|
||||
"\tPhysicalBase: 0x%lX\n"
|
||||
"\tVirtualBase: 0x%lX\n"
|
||||
"\tLength: 0x%lX\n",
|
||||
__FUNCTION__,
|
||||
VirtualMemoryTable[0].PhysicalBase,
|
||||
VirtualMemoryTable[0].VirtualBase,
|
||||
VirtualMemoryTable[0].Length));
|
||||
VirtualMemoryTable[0].Length
|
||||
));
|
||||
|
||||
// Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
|
||||
VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
|
||||
|
@ -40,7 +40,7 @@ QemuVirtMemInfoPeiLibConstructor (
|
||||
//
|
||||
// Look for the lowest memory node
|
||||
//
|
||||
for (Prev = 0;; Prev = Node) {
|
||||
for (Prev = 0; ; Prev = Node) {
|
||||
Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
|
||||
if (Node < 0) {
|
||||
break;
|
||||
@ -50,27 +50,34 @@ QemuVirtMemInfoPeiLibConstructor (
|
||||
// Check for memory node
|
||||
//
|
||||
Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
|
||||
if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {
|
||||
if (Type && (AsciiStrnCmp (Type, "memory", Len) == 0)) {
|
||||
//
|
||||
// Get the 'reg' property of this node. For now, we will assume
|
||||
// two 8 byte quantities for base and size, respectively.
|
||||
//
|
||||
RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
|
||||
if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
|
||||
|
||||
if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) {
|
||||
CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
|
||||
CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
|
||||
__FUNCTION__, CurBase, CurBase + CurSize - 1));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: System RAM @ 0x%lx - 0x%lx\n",
|
||||
__FUNCTION__,
|
||||
CurBase,
|
||||
CurBase + CurSize - 1
|
||||
));
|
||||
|
||||
if (NewBase > CurBase || NewBase == 0) {
|
||||
if ((NewBase > CurBase) || (NewBase == 0)) {
|
||||
NewBase = CurBase;
|
||||
NewSize = CurSize;
|
||||
}
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Failed to parse FDT memory node\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,7 +101,8 @@ QemuVirtMemInfoPeiLibConstructor (
|
||||
ASSERT (
|
||||
(((UINT64)PcdGet64 (PcdFdBaseAddress) +
|
||||
(UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||
|
||||
((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));
|
||||
((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize))
|
||||
);
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ ArmGenericTimerGetTimerVal (
|
||||
return ArmReadCntvTval ();
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmGenericTimerSetTimerVal (
|
||||
|
@ -31,7 +31,7 @@ PlatformHasAcpiDt (
|
||||
// unbootable anyway (due to lacking hardware description), so tolerate no
|
||||
// errors here.
|
||||
//
|
||||
if (MAX_UINTN == MAX_UINT64 &&
|
||||
if ((MAX_UINTN == MAX_UINT64) &&
|
||||
!PcdGetBool (PcdForceNoAcpi) &&
|
||||
!EFI_ERROR (
|
||||
QemuFwCfgFindFile (
|
||||
@ -39,7 +39,8 @@ PlatformHasAcpiDt (
|
||||
&FwCfgItem,
|
||||
&FwCfgSize
|
||||
)
|
||||
)) {
|
||||
))
|
||||
{
|
||||
//
|
||||
// Only make ACPI available on 64-bit systems, and only if QEMU generates
|
||||
// (a subset of) the ACPI tables.
|
||||
|
@ -63,6 +63,7 @@ FindMemnode (
|
||||
if (AddressCells > 1) {
|
||||
*SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]);
|
||||
}
|
||||
|
||||
Prop += AddressCells;
|
||||
|
||||
*SystemMemorySize = fdt32_to_cpu (Prop[0]);
|
||||
@ -79,6 +80,6 @@ CopyFdt (
|
||||
IN VOID *FdtSource
|
||||
)
|
||||
{
|
||||
fdt_pack(FdtSource);
|
||||
fdt_pack (FdtSource);
|
||||
CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource));
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ PrePiMain (
|
||||
IN UINT64 StartTimeStamp
|
||||
)
|
||||
{
|
||||
EFI_HOB_HANDOFF_INFO_TABLE* HobList;
|
||||
EFI_HOB_HANDOFF_INFO_TABLE *HobList;
|
||||
EFI_STATUS Status;
|
||||
CHAR8 Buffer[100];
|
||||
UINTN CharCount;
|
||||
@ -46,10 +46,10 @@ PrePiMain (
|
||||
|
||||
// Declare the PI/UEFI memory region
|
||||
HobList = HobConstructor (
|
||||
(VOID*)UefiMemoryBase,
|
||||
(VOID *)UefiMemoryBase,
|
||||
FixedPcdGet32 (PcdSystemMemoryUefiRegionSize),
|
||||
(VOID*)UefiMemoryBase,
|
||||
(VOID*)StacksBase // The top of the UEFI Memory is reserved for the stacks
|
||||
(VOID *)UefiMemoryBase,
|
||||
(VOID *)StacksBase // The top of the UEFI Memory is reserved for the stacks
|
||||
);
|
||||
PrePeiSetHobList (HobList);
|
||||
|
||||
@ -58,7 +58,7 @@ PrePiMain (
|
||||
// modifications we made with the caches and MMU off (such as the applied
|
||||
// relocations) don't become invisible once we turn them on.
|
||||
//
|
||||
InvalidateDataCacheRange((VOID *)(UINTN)PcdGet64 (PcdFdBaseAddress), PcdGet32 (PcdFdSize));
|
||||
InvalidateDataCacheRange ((VOID *)(UINTN)PcdGet64 (PcdFdBaseAddress), PcdGet32 (PcdFdSize));
|
||||
|
||||
// Initialize MMU and Memory HOBs (Resource Descriptor HOBs)
|
||||
Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize));
|
||||
@ -66,15 +66,21 @@ PrePiMain (
|
||||
|
||||
// Initialize the Serial Port
|
||||
SerialPortInitialize ();
|
||||
CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r",
|
||||
(CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__);
|
||||
SerialPortWrite ((UINT8 *) Buffer, CharCount);
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"UEFI firmware (version %s built at %a on %a)\n\r",
|
||||
(CHAR16 *)PcdGetPtr (PcdFirmwareVersionString),
|
||||
__TIME__,
|
||||
__DATE__
|
||||
);
|
||||
SerialPortWrite ((UINT8 *)Buffer, CharCount);
|
||||
|
||||
// Create the Stacks HOB (reserve the memory for all stacks)
|
||||
StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize);
|
||||
BuildStackHob (StacksBase, StacksSize);
|
||||
|
||||
//TODO: Call CpuPei as a library
|
||||
// TODO: Call CpuPei as a library
|
||||
BuildCpuHob (ArmGetPhysicalAddressBits (), PcdGet8 (PcdPrePiCpuIoSize));
|
||||
|
||||
// Set the Boot Mode
|
||||
@ -142,14 +148,18 @@ RelocatePeCoffImage (
|
||||
EFI_STATUS Status;
|
||||
|
||||
FileHandle = NULL;
|
||||
Status = FfsFindNextFile (EFI_FV_FILETYPE_SECURITY_CORE, FwVolHeader,
|
||||
&FileHandle);
|
||||
Status = FfsFindNextFile (
|
||||
EFI_FV_FILETYPE_SECURITY_CORE,
|
||||
FwVolHeader,
|
||||
&FileHandle
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FfsFindSectionData (EFI_SECTION_PE32, FileHandle, &SectionData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = FfsFindSectionData (EFI_SECTION_TE, FileHandle, &SectionData);
|
||||
}
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
ZeroMem (&ImageContext, sizeof ImageContext);
|
||||
|
@ -49,16 +49,27 @@ GetXenArmAcpiRsdp (
|
||||
//
|
||||
// Get the RSDP structure address from DeviceTree
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,guest-acpi",
|
||||
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||
&RegSize);
|
||||
Status = FdtClient->FindCompatibleNodeReg (
|
||||
FdtClient,
|
||||
"xen,guest-acpi",
|
||||
(CONST VOID **)&Reg,
|
||||
&AddressCells,
|
||||
&SizeCells,
|
||||
&RegSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: No 'xen,guest-acpi' compatible DT node found\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: No 'xen,guest-acpi' compatible DT node found\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -66,13 +77,15 @@ GetXenArmAcpiRsdp (
|
||||
ASSERT (SizeCells == 2);
|
||||
ASSERT (RegSize == 2 * sizeof (UINT64));
|
||||
|
||||
RegBase = SwapBytes64(Reg[0]);
|
||||
RegBase = SwapBytes64 (Reg[0]);
|
||||
RsdpStructurePtr =
|
||||
(EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)RegBase;
|
||||
|
||||
if (RsdpStructurePtr && RsdpStructurePtr->Revision >= 2) {
|
||||
Sum = CalculateSum8 ((CONST UINT8 *)RsdpStructurePtr,
|
||||
sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER));
|
||||
if (RsdpStructurePtr && (RsdpStructurePtr->Revision >= 2)) {
|
||||
Sum = CalculateSum8 (
|
||||
(CONST UINT8 *)RsdpStructurePtr,
|
||||
sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
|
||||
);
|
||||
if (Sum != 0) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
@ -139,7 +152,7 @@ InstallXenArmTables (
|
||||
// Retrieve the addresses of XSDT and
|
||||
// calculate the number of its table entries.
|
||||
//
|
||||
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN)
|
||||
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)
|
||||
XenAcpiRsdpStructurePtr->XsdtAddress;
|
||||
NumberOfTableEntries = (Xsdt->Length -
|
||||
sizeof (EFI_ACPI_DESCRIPTION_HEADER)) /
|
||||
@ -151,11 +164,11 @@ InstallXenArmTables (
|
||||
//
|
||||
// Get the table entry from XSDT
|
||||
//
|
||||
CurrentTableEntry = (VOID *) ((UINT8 *) Xsdt +
|
||||
CurrentTableEntry = (VOID *)((UINT8 *)Xsdt +
|
||||
sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
|
||||
Index * sizeof (UINT64));
|
||||
CurrentTablePointer = (UINTN) *(UINT64 *)CurrentTableEntry;
|
||||
CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;
|
||||
CurrentTablePointer = (UINTN)*(UINT64 *)CurrentTableEntry;
|
||||
CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *)CurrentTablePointer;
|
||||
|
||||
//
|
||||
// Install the XSDT tables
|
||||
@ -174,10 +187,10 @@ InstallXenArmTables (
|
||||
//
|
||||
// Get the FACS and DSDT table address from the table FADT
|
||||
//
|
||||
if (!AsciiStrnCmp ((CHAR8 *) &CurrentTable->Signature, "FACP", 4)) {
|
||||
if (!AsciiStrnCmp ((CHAR8 *)&CurrentTable->Signature, "FACP", 4)) {
|
||||
FadtTable = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)
|
||||
(UINTN) CurrentTablePointer;
|
||||
DsdtTable = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) FadtTable->Dsdt;
|
||||
(UINTN)CurrentTablePointer;
|
||||
DsdtTable = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)FadtTable->Dsdt;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,7 +224,7 @@ FindAcpiTableProtocol (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiAcpiTableProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&AcpiTable
|
||||
(VOID **)&AcpiTable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return AcpiTable;
|
||||
@ -228,7 +241,6 @@ FindAcpiTableProtocol (
|
||||
@return EFI_OUT_OF_RESOURCES
|
||||
|
||||
**/
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XenAcpiPlatformEntryPoint (
|
||||
|
@ -30,16 +30,27 @@ InitializeXenioFdtDxe (
|
||||
EFI_HANDLE Handle;
|
||||
UINT64 RegBase;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,xen",
|
||||
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||
&RegSize);
|
||||
Status = FdtClient->FindCompatibleNodeReg (
|
||||
FdtClient,
|
||||
"xen,xen",
|
||||
(CONST VOID **)&Reg,
|
||||
&AddressCells,
|
||||
&SizeCells,
|
||||
&RegSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: No 'xen,xen' compatible DT node found\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: No 'xen,xen' compatible DT node found\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@ -55,8 +66,13 @@ InitializeXenioFdtDxe (
|
||||
Handle = NULL;
|
||||
Status = XenIoMmioInstall (&Handle, RegBase);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: XenIoMmioInstall () failed on a new handle "
|
||||
"(Status == %r)\n", __FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: XenIoMmioInstall () failed on a new handle "
|
||||
"(Status == %r)\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user