summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/PlatformBootManagerLibBhyve
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:09 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commitac0a286f4d747a4c6c603a7b225917293cbe1e9f (patch)
tree32654f2b35755afc961e2c97296b2dec5762da75 /OvmfPkg/Library/PlatformBootManagerLibBhyve
parentd1050b9dff1cace252aff86630bfdb59dff5f507 (diff)
downloadedk2-ac0a286f4d747a4c6c603a7b225917293cbe1e9f.tar.gz
edk2-ac0a286f4d747a4c6c603a7b225917293cbe1e9f.tar.bz2
edk2-ac0a286f4d747a4c6c603a7b225917293cbe1e9f.zip
OvmfPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the OvmfPkg 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: Andrew Fish <afish@apple.com>
Diffstat (limited to 'OvmfPkg/Library/PlatformBootManagerLibBhyve')
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c744
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.h33
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLibBhyve/PlatformData.c56
3 files changed, 471 insertions, 362 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
index 32b70a46d0..119f24b330 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
@@ -19,17 +19,17 @@
// Global data
//
-VOID *mEfiDevPathNotifyReg;
-EFI_EVENT mEfiDevPathEvent;
-VOID *mEmuVariableEventReg;
-EFI_EVENT mEmuVariableEvent;
-UINT16 mHostBridgeDevId;
+VOID *mEfiDevPathNotifyReg;
+EFI_EVENT mEfiDevPathEvent;
+VOID *mEmuVariableEventReg;
+EFI_EVENT mEmuVariableEvent;
+UINT16 mHostBridgeDevId;
//
// Table of host IRQs matching PCI IRQs A-D
// (for configuring PCI Interrupt Line register)
//
-CONST UINT8 PciHostIrqs[] = {
+CONST UINT8 PciHostIrqs[] = {
0x0a, 0x0a, 0x0b, 0x0b
};
@@ -58,7 +58,6 @@ EFI_STATUS
IN PCI_TYPE00 *Pci
);
-
//
// Function prototypes
//
@@ -72,7 +71,7 @@ VisitAllInstancesOfProtocol (
EFI_STATUS
VisitAllPciInstancesOfProtocol (
- IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction
+ IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction
);
VOID
@@ -82,24 +81,24 @@ InstallDevicePathCallback (
VOID
PlatformRegisterFvBootOption (
- EFI_GUID *FileGuid,
- CHAR16 *Description,
- UINT32 Attributes
+ EFI_GUID *FileGuid,
+ CHAR16 *Description,
+ UINT32 Attributes
)
{
- EFI_STATUS Status;
- INTN OptionIndex;
- EFI_BOOT_MANAGER_LOAD_OPTION NewOption;
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
- UINTN BootOptionCount;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_STATUS Status;
+ INTN OptionIndex;
+ EFI_BOOT_MANAGER_LOAD_OPTION NewOption;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN BootOptionCount;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
Status = gBS->HandleProtocol (
gImageHandle,
&gEfiLoadedImageProtocolGuid,
- (VOID **) &LoadedImage
+ (VOID **)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
@@ -108,7 +107,7 @@ PlatformRegisterFvBootOption (
ASSERT (DevicePath != NULL);
DevicePath = AppendDevicePathNode (
DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &FileNode
+ (EFI_DEVICE_PATH_PROTOCOL *)&FileNode
);
ASSERT (DevicePath != NULL);
@@ -126,17 +125,21 @@ 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);
}
@@ -160,27 +163,30 @@ RemoveStaleFvFileOptions (
VOID
)
{
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
- UINTN BootOptionCount;
- UINTN Index;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ 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;
- EFI_STATUS Status;
- EFI_HANDLE FvHandle;
+ EFI_DEVICE_PATH_PROTOCOL *Node1, *Node2, *SearchNode;
+ EFI_STATUS Status;
+ EFI_HANDLE FvHandle;
//
// If the device path starts with neither MemoryMapped(...) nor Fv(...),
// 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;
}
@@ -189,8 +195,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;
}
@@ -201,23 +208,29 @@ RemoveStaleFvFileOptions (
// boot option.
//
SearchNode = Node1;
- Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid,
- &SearchNode, &FvHandle);
+ Status = gBS->LocateDevicePath (
+ &gEfiFirmwareVolume2ProtocolGuid,
+ &SearchNode,
+ &FvHandle
+ );
if (!EFI_ERROR (Status)) {
//
// The firmware volume was found; now let's see if it contains the FvFile
// identified by GUID.
//
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFileNode;
- UINTN BufferSize;
- EFI_FV_FILETYPE FoundType;
- EFI_FV_FILE_ATTRIBUTES FileAttributes;
- UINT32 AuthenticationStatus;
-
- Status = gBS->HandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid,
- (VOID **)&FvProtocol);
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFileNode;
+ UINTN BufferSize;
+ EFI_FV_FILETYPE FoundType;
+ EFI_FV_FILE_ATTRIBUTES FileAttributes;
+ UINT32 AuthenticationStatus;
+
+ Status = gBS->HandleProtocol (
+ FvHandle,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ (VOID **)&FvProtocol
+ );
ASSERT_EFI_ERROR (Status);
FvFileNode = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)Node2;
@@ -246,23 +259,29 @@ RemoveStaleFvFileOptions (
// Delete the boot option.
//
Status = EfiBootManagerDeleteLoadOptionVariable (
- BootOptions[Index].OptionNumber, LoadOptionTypeBoot);
+ BootOptions[Index].OptionNumber,
+ LoadOptionTypeBoot
+ );
DEBUG_CODE_BEGIN ();
- CHAR16 *DevicePathString;
+ CHAR16 *DevicePathString;
+
+ DevicePathString = ConvertDevicePathToText (
+ BootOptions[Index].FilePath,
+ FALSE,
+ FALSE
+ );
+ DEBUG ((
+ EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,
+ "%a: removing stale Boot#%04x %s: %r\n",
+ __FUNCTION__,
+ (UINT32)BootOptions[Index].OptionNumber,
+ DevicePathString == NULL ? L"<unavailable>" : DevicePathString,
+ Status
+ ));
+ if (DevicePathString != NULL) {
+ FreePool (DevicePathString);
+ }
- DevicePathString = ConvertDevicePathToText(BootOptions[Index].FilePath,
- FALSE, FALSE);
- DEBUG ((
- EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,
- "%a: removing stale Boot#%04x %s: %r\n",
- __FUNCTION__,
- (UINT32)BootOptions[Index].OptionNumber,
- DevicePathString == NULL ? L"<unavailable>" : DevicePathString,
- Status
- ));
- if (DevicePathString != NULL) {
- FreePool (DevicePathString);
- }
DEBUG_CODE_END ();
}
@@ -274,18 +293,18 @@ PlatformRegisterOptionsAndKeys (
VOID
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY Enter;
- EFI_INPUT_KEY F2;
- EFI_INPUT_KEY Esc;
- EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Enter;
+ EFI_INPUT_KEY F2;
+ EFI_INPUT_KEY Esc;
+ EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
//
// Register ENTER as CONTINUE key
//
Enter.ScanCode = SCAN_NULL;
Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
- Status = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
+ Status = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
ASSERT_EFI_ERROR (Status);
//
@@ -295,14 +314,22 @@ PlatformRegisterOptionsAndKeys (
F2.UnicodeChar = CHAR_NULL;
Esc.ScanCode = SCAN_ESC;
Esc.UnicodeChar = CHAR_NULL;
- Status = EfiBootManagerGetBootManagerMenu (&BootOption);
+ 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);
}
@@ -319,9 +346,9 @@ STATIC
EFI_STATUS
EFIAPI
ConnectVirtioPciRng (
- IN EFI_HANDLE Handle,
- IN VOID *Instance,
- IN VOID *Context
+ IN EFI_HANDLE Handle,
+ IN VOID *Instance,
+ IN VOID *Context
);
STATIC
@@ -333,6 +360,7 @@ SaveS3BootScript (
//
// BDS Platform Functions
//
+
/**
Do the platform init, can be customized by OEM/IBV
@@ -352,14 +380,17 @@ PlatformBootManagerBeforeConsole (
VOID
)
{
- EFI_HANDLE Handle;
- EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
DEBUG ((DEBUG_INFO, "PlatformBootManagerBeforeConsole\n"));
InstallDevicePathCallback ();
- VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,
- ConnectRootBridge, NULL);
+ VisitAllInstancesOfProtocol (
+ &gEfiPciRootBridgeIoProtocolGuid,
+ ConnectRootBridge,
+ NULL
+ );
//
// Signal the ACPI platform driver that it can download QEMU ACPI tables.
@@ -389,9 +420,12 @@ PlatformBootManagerBeforeConsole (
// Any TPM 2 Physical Presence Interface opcode must be handled before.
//
Handle = NULL;
- Status = gBS->InstallProtocolInterface (&Handle,
- &gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE,
- NULL);
+ Status = gBS->InstallProtocolInterface (
+ &Handle,
+ &gEfiDxeSmmReadyToLockProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
ASSERT_EFI_ERROR (Status);
//
@@ -406,11 +440,13 @@ PlatformBootManagerBeforeConsole (
// Install both VIRTIO_DEVICE_PROTOCOL and (dependent) EFI_RNG_PROTOCOL
// instances on Virtio PCI RNG devices.
//
- VisitAllInstancesOfProtocol (&gEfiPciIoProtocolGuid, ConnectVirtioPciRng,
- NULL);
+ VisitAllInstancesOfProtocol (
+ &gEfiPciIoProtocolGuid,
+ ConnectVirtioPciRng,
+ NULL
+ );
}
-
EFI_STATUS
EFIAPI
ConnectRootBridge (
@@ -419,7 +455,7 @@ ConnectRootBridge (
IN VOID *Context
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// Make the PCI bus driver connect the root bridge, non-recursively. This
@@ -435,34 +471,39 @@ ConnectRootBridge (
return Status;
}
-
STATIC
EFI_STATUS
EFIAPI
ConnectVirtioPciRng (
- IN EFI_HANDLE Handle,
- IN VOID *Instance,
- IN VOID *Context
+ IN EFI_HANDLE Handle,
+ IN VOID *Instance,
+ IN VOID *Context
)
{
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_STATUS Status;
- UINT16 VendorId;
- UINT16 DeviceId;
- UINT8 RevisionId;
- BOOLEAN Virtio10;
- UINT16 SubsystemId;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_STATUS Status;
+ UINT16 VendorId;
+ UINT16 DeviceId;
+ UINT8 RevisionId;
+ BOOLEAN Virtio10;
+ UINT16 SubsystemId;
PciIo = Instance;
//
// 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 Error;
}
+
if (VendorId != VIRTIO_VENDOR_ID) {
return EFI_SUCCESS;
}
@@ -470,13 +511,24 @@ ConnectVirtioPciRng (
//
// 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 Error;
}
- 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 Error;
}
@@ -488,10 +540,11 @@ ConnectVirtioPciRng (
// 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 EFI_SUCCESS;
@@ -500,13 +553,20 @@ ConnectVirtioPciRng (
//
// 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 Error;
}
- if ((Virtio10 && SubsystemId >= 0x40) ||
- (!Virtio10 && SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {
+
+ if ((Virtio10 && (SubsystemId >= 0x40)) ||
+ (!Virtio10 && (SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)))
+ {
Status = gBS->ConnectController (
Handle, // ControllerHandle
NULL, // DriverImageHandle -- connect all drivers
@@ -517,6 +577,7 @@ ConnectVirtioPciRng (
goto Error;
}
}
+
return EFI_SUCCESS;
Error:
@@ -524,7 +585,6 @@ Error:
return Status;
}
-
/**
Add IsaKeyboard to ConIn; add IsaSerial to ConOut, ConIn, ErrOut.
@@ -538,7 +598,7 @@ Error:
**/
EFI_STATUS
PrepareLpcBridgeDevicePath (
- IN EFI_HANDLE DeviceHandle
+ IN EFI_HANDLE DeviceHandle
)
{
EFI_STATUS Status;
@@ -547,50 +607,59 @@ PrepareLpcBridgeDevicePath (
CHAR16 *DevPathStr;
DevicePath = NULL;
- Status = gBS->HandleProtocol (
- DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID*)&DevicePath
- );
+ Status = gBS->HandleProtocol (
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&DevicePath
+ );
if (EFI_ERROR (Status)) {
return Status;
}
+
TempDevicePath = DevicePath;
//
// Register Keyboard
//
- DevicePath = AppendDevicePathNode (DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode);
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode
+ );
EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
//
// Register COM1
//
- DevicePath = TempDevicePath;
+ DevicePath = TempDevicePath;
gPnp16550ComPortDeviceNode.UID = 0;
- DevicePath = AppendDevicePathNode (DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);
- DevicePath = AppendDevicePathNode (DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);
- DevicePath = AppendDevicePathNode (DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode
+ );
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode
+ );
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode
+ );
//
// Print Device Path
//
DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
if (DevPathStr != NULL) {
- DEBUG((
+ DEBUG ((
DEBUG_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
DEBUG_LINE_NUMBER,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
- FreePool(DevPathStr);
+ FreePool (DevPathStr);
}
EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
@@ -604,19 +673,19 @@ PrepareLpcBridgeDevicePath (
EFI_STATUS
GetGopDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *PciDevicePath,
- OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath
- )
+ IN EFI_DEVICE_PATH_PROTOCOL *PciDevicePath,
+ OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath
+ )
{
- UINTN Index;
- EFI_STATUS Status;
- EFI_HANDLE PciDeviceHandle;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *TempPciDevicePath;
- UINTN GopHandleCount;
- EFI_HANDLE *GopHandleBuffer;
-
- if (PciDevicePath == NULL || GopDevicePath == NULL) {
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_HANDLE PciDeviceHandle;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *TempPciDevicePath;
+ UINTN GopHandleCount;
+ EFI_HANDLE *GopHandleBuffer;
+
+ if ((PciDevicePath == NULL) || (GopDevicePath == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -655,16 +724,21 @@ GetGopDevicePath (
// Add all the child handles as possible Console Device
//
for (Index = 0; Index < GopHandleCount; Index++) {
- Status = gBS->HandleProtocol (GopHandleBuffer[Index],
- &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath);
+ Status = gBS->HandleProtocol (
+ GopHandleBuffer[Index],
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&TempDevicePath
+ );
if (EFI_ERROR (Status)) {
continue;
}
+
if (CompareMem (
PciDevicePath,
TempDevicePath,
GetDevicePathSize (PciDevicePath) - END_DEVICE_PATH_LENGTH
- ) == 0) {
+ ) == 0)
+ {
//
// In current implementation, we only enable one of the child handles
// as console device, i.e. sotre one of the child handle's device
@@ -682,6 +756,7 @@ GetGopDevicePath (
EfiBootManagerUpdateConsoleVariable (ConOutDev, TempDevicePath, NULL);
}
}
+
gBS->FreePool (GopHandleBuffer);
}
@@ -700,7 +775,7 @@ GetGopDevicePath (
**/
EFI_STATUS
PreparePciDisplayDevicePath (
- IN EFI_HANDLE DeviceHandle
+ IN EFI_HANDLE DeviceHandle
)
{
EFI_STATUS Status;
@@ -709,11 +784,11 @@ PreparePciDisplayDevicePath (
DevicePath = NULL;
GopDevicePath = NULL;
- Status = gBS->HandleProtocol (
- DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID*)&DevicePath
- );
+ Status = gBS->HandleProtocol (
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&DevicePath
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -739,26 +814,30 @@ PreparePciDisplayDevicePath (
**/
EFI_STATUS
PreparePciSerialDevicePath (
- IN EFI_HANDLE DeviceHandle
+ IN EFI_HANDLE DeviceHandle
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
DevicePath = NULL;
- Status = gBS->HandleProtocol (
- DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID*)&DevicePath
- );
+ Status = gBS->HandleProtocol (
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&DevicePath
+ );
if (EFI_ERROR (Status)) {
return Status;
}
- DevicePath = AppendDevicePathNode (DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);
- DevicePath = AppendDevicePathNode (DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode
+ );
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode
+ );
EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
@@ -774,24 +853,24 @@ VisitAllInstancesOfProtocol (
IN VOID *Context
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- VOID *Instance;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ VOID *Instance;
//
// Start to check all the PciIo to find all possible device
//
- HandleCount = 0;
+ HandleCount = 0;
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- Id,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ Id,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -802,11 +881,11 @@ VisitAllInstancesOfProtocol (
continue;
}
- Status = (*CallBackFunction) (
- HandleBuffer[Index],
- Instance,
- Context
- );
+ Status = (*CallBackFunction)(
+ HandleBuffer[Index],
+ Instance,
+ Context
+ );
}
gBS->FreePool (HandleBuffer);
@@ -814,7 +893,6 @@ VisitAllInstancesOfProtocol (
return EFI_SUCCESS;
}
-
EFI_STATUS
EFIAPI
VisitingAPciInstance (
@@ -823,49 +901,45 @@ VisitingAPciInstance (
IN VOID *Context
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 Pci;
- PciIo = (EFI_PCI_IO_PROTOCOL*) Instance;
+ PciIo = (EFI_PCI_IO_PROTOCOL *)Instance;
//
// Check for all PCI device
//
Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint32,
- 0,
- sizeof (Pci) / sizeof (UINT32),
- &Pci
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ 0,
+ sizeof (Pci) / sizeof (UINT32),
+ &Pci
+ );
if (EFI_ERROR (Status)) {
return Status;
}
- return (*(VISIT_PCI_INSTANCE_CALLBACK)(UINTN) Context) (
- Handle,
- PciIo,
- &Pci
- );
-
+ return (*(VISIT_PCI_INSTANCE_CALLBACK)(UINTN)Context)(
+ Handle,
+ PciIo,
+ &Pci
+ );
}
-
-
EFI_STATUS
VisitAllPciInstances (
- IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction
+ IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction
)
{
return VisitAllInstancesOfProtocol (
&gEfiPciIoProtocolGuid,
VisitingAPciInstance,
- (VOID*)(UINTN) CallBackFunction
+ (VOID *)(UINTN)CallBackFunction
);
}
-
/**
Do platform specific PCI Device check and add them to
ConOut, ConIn, ErrOut.
@@ -887,14 +961,14 @@ DetectAndPreparePlatformPciDevicePath (
IN PCI_TYPE00 *Pci
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- EFI_PCI_DEVICE_ENABLE,
- NULL
- );
+ PciIo,
+ EfiPciIoAttributeOperationEnable,
+ EFI_PCI_DEVICE_ENABLE,
+ NULL
+ );
ASSERT_EFI_ERROR (Status);
//
@@ -905,7 +979,8 @@ DetectAndPreparePlatformPciDevicePath (
(Pci->Hdr.VendorId == 0x8086) &&
(Pci->Hdr.DeviceId == 0x7000)
)
- ) {
+ )
+ {
//
// Add IsaKeyboard to ConIn,
// add IsaSerial to ConOut, ConIn, ErrOut
@@ -914,6 +989,7 @@ DetectAndPreparePlatformPciDevicePath (
PrepareLpcBridgeDevicePath (Handle);
return EFI_SUCCESS;
}
+
//
// Here we decide which Serial device to enable in PCI bus
//
@@ -941,7 +1017,6 @@ DetectAndPreparePlatformPciDevicePath (
return Status;
}
-
/**
Connect the predefined platform default console device.
@@ -951,10 +1026,10 @@ DetectAndPreparePlatformPciDevicePath (
**/
VOID
PlatformInitializeConsole (
- IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole
+ IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole
)
{
- UINTN Index;
+ UINTN Index;
//
// Do platform specific PCI Device check and add them to ConOut, ConIn,
@@ -972,21 +1047,31 @@ PlatformInitializeConsole (
// Update the console variable with the connect type
//
if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
- EfiBootManagerUpdateConsoleVariable (ConIn,
- PlatformConsole[Index].DevicePath, NULL);
+ EfiBootManagerUpdateConsoleVariable (
+ ConIn,
+ PlatformConsole[Index].DevicePath,
+ NULL
+ );
}
+
if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
- EfiBootManagerUpdateConsoleVariable (ConOut,
- PlatformConsole[Index].DevicePath, NULL);
+ EfiBootManagerUpdateConsoleVariable (
+ ConOut,
+ PlatformConsole[Index].DevicePath,
+ NULL
+ );
}
+
if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
- EfiBootManagerUpdateConsoleVariable (ErrOut,
- PlatformConsole[Index].DevicePath, NULL);
+ EfiBootManagerUpdateConsoleVariable (
+ ErrOut,
+ PlatformConsole[Index].DevicePath,
+ NULL
+ );
}
}
}
-
/**
Configure PCI Interrupt Line register for applicable devices
Ported from SeaBIOS, src/fw/pciinit.c, *_pci_slot_get_irq()
@@ -1017,15 +1102,15 @@ SetPciIntLine (
Status = EFI_SUCCESS;
if (PciHdr->Device.InterruptPin != 0) {
-
DevPathNode = DevicePathFromHandle (Handle);
ASSERT (DevPathNode != NULL);
DevPath = DevPathNode;
RootBusNumber = 0;
- if (DevicePathType (DevPathNode) == ACPI_DEVICE_PATH &&
- DevicePathSubType (DevPathNode) == ACPI_DP &&
- ((ACPI_HID_DEVICE_PATH *)DevPathNode)->HID == EISA_PNP_ID(0x0A03)) {
+ if ((DevicePathType (DevPathNode) == ACPI_DEVICE_PATH) &&
+ (DevicePathSubType (DevPathNode) == ACPI_DP) &&
+ (((ACPI_HID_DEVICE_PATH *)DevPathNode)->HID == EISA_PNP_ID (0x0A03)))
+ {
RootBusNumber = ((ACPI_HID_DEVICE_PATH *)DevPathNode)->UID;
}
@@ -1033,13 +1118,13 @@ SetPciIntLine (
// Compute index into PciHostIrqs[] table by walking
// the device path and adding up all device numbers
//
- Status = EFI_NOT_FOUND;
+ Status = EFI_NOT_FOUND;
RootSlot = 0;
- Idx = PciHdr->Device.InterruptPin - 1;
+ Idx = PciHdr->Device.InterruptPin - 1;
while (!IsDevicePathEnd (DevPathNode)) {
- if (DevicePathType (DevPathNode) == HARDWARE_DEVICE_PATH &&
- DevicePathSubType (DevPathNode) == HW_PCI_DP) {
-
+ if ((DevicePathType (DevPathNode) == HARDWARE_DEVICE_PATH) &&
+ (DevicePathSubType (DevPathNode) == HW_PCI_DP))
+ {
Idx += ((PCI_DEVICE_PATH *)DevPathNode)->Device;
//
@@ -1050,18 +1135,20 @@ SetPciIntLine (
// Q35 cases with more than 24 slots on the root bus.
//
if (Status != EFI_SUCCESS) {
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
RootSlot = ((PCI_DEVICE_PATH *)DevPathNode)->Device;
}
}
DevPathNode = NextDevicePathNode (DevPathNode);
}
+
if (EFI_ERROR (Status)) {
return Status;
}
- if (RootBusNumber == 0 && RootSlot == 0) {
- DEBUG((
+
+ if ((RootBusNumber == 0) && (RootSlot == 0)) {
+ DEBUG ((
DEBUG_ERROR,
"%a: PCI host bridge (00:00.0) should have no interrupts!\n",
__FUNCTION__
@@ -1095,29 +1182,39 @@ SetPciIntLine (
//
Idx -= RootSlot;
}
+
break;
default:
ASSERT (FALSE); // should never get here
}
- Idx %= ARRAY_SIZE (PciHostIrqs);
+
+ Idx %= ARRAY_SIZE (PciHostIrqs);
IrqLine = PciHostIrqs[Idx];
DEBUG_CODE_BEGIN ();
{
- CHAR16 *DevPathString;
- STATIC CHAR16 Fallback[] = L"<failed to convert>";
- UINTN Segment, Bus, Device, Function;
+ CHAR16 *DevPathString;
+ STATIC CHAR16 Fallback[] = L"<failed to convert>";
+ UINTN Segment, Bus, Device, Function;
DevPathString = ConvertDevicePathToText (DevPath, FALSE, FALSE);
if (DevPathString == NULL) {
DevPathString = Fallback;
}
+
Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
ASSERT_EFI_ERROR (Status);
- DEBUG ((DEBUG_VERBOSE, "%a: [%02x:%02x.%x] %s -> 0x%02x\n", __FUNCTION__,
- (UINT32)Bus, (UINT32)Device, (UINT32)Function, DevPathString,
- IrqLine));
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "%a: [%02x:%02x.%x] %s -> 0x%02x\n",
+ __FUNCTION__,
+ (UINT32)Bus,
+ (UINT32)Device,
+ (UINT32)Function,
+ DevPathString,
+ IrqLine
+ ));
if (DevPathString != Fallback) {
FreePool (DevPathString);
@@ -1129,18 +1226,17 @@ SetPciIntLine (
// Set PCI Interrupt Line register for this device to PciHostIrqs[Idx]
//
Status = PciIo->Pci.Write (
- PciIo,
- EfiPciIoWidthUint8,
- PCI_INT_LINE_OFFSET,
- 1,
- &IrqLine
- );
+ PciIo,
+ EfiPciIoWidthUint8,
+ PCI_INT_LINE_OFFSET,
+ 1,
+ &IrqLine
+ );
}
return Status;
}
-
VOID
PciAcpiInitialization (
)
@@ -1179,8 +1275,12 @@ PciAcpiInitialization (
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6b), 0x0b); // H
break;
default:
- DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
- __FUNCTION__, mHostBridgeDevId));
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Unknown Host Bridge Device ID: 0x%04x\n",
+ __FUNCTION__,
+ mHostBridgeDevId
+ ));
ASSERT (FALSE);
return;
}
@@ -1213,11 +1313,11 @@ ConnectRecursivelyIfPciMassStorage (
//
if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {
DevicePath = NULL;
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID*)&DevicePath
- );
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&DevicePath
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1227,29 +1327,27 @@ ConnectRecursivelyIfPciMassStorage (
//
DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
if (DevPathStr != NULL) {
- DEBUG((
+ DEBUG ((
DEBUG_INFO,
"Found %s device: %s\n",
(IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE) ?
L"Mass Storage" :
L"Xen"
- ),
+ ),
DevPathStr
));
- FreePool(DevPathStr);
+ FreePool (DevPathStr);
}
Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);
if (EFI_ERROR (Status)) {
return Status;
}
-
}
return EFI_SUCCESS;
}
-
/**
This notification function is invoked when the
EMU Variable FVB has been changed.
@@ -1261,15 +1359,14 @@ ConnectRecursivelyIfPciMassStorage (
VOID
EFIAPI
EmuVariablesUpdatedCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
DEBUG ((DEBUG_INFO, "EmuVariablesUpdatedCallback\n"));
UpdateNvVarsOnFileSystem ();
}
-
EFI_STATUS
EFIAPI
VisitingFileSystemInstance (
@@ -1292,7 +1389,7 @@ VisitingFileSystemInstance (
}
ConnectedToFileSystem = TRUE;
- mEmuVariableEvent =
+ mEmuVariableEvent =
EfiCreateProtocolNotifyEvent (
&gEfiDevicePathProtocolGuid,
TPL_CALLBACK,
@@ -1300,14 +1397,15 @@ VisitingFileSystemInstance (
NULL,
&mEmuVariableEventReg
);
- PcdStatus = PcdSet64S (PcdEmuVariableEvent,
- (UINT64)(UINTN) mEmuVariableEvent);
+ PcdStatus = PcdSet64S (
+ PcdEmuVariableEvent,
+ (UINT64)(UINTN)mEmuVariableEvent
+ );
ASSERT_RETURN_ERROR (PcdStatus);
return EFI_SUCCESS;
}
-
VOID
PlatformBdsRestoreNvVarsFromHardDisk (
)
@@ -1318,7 +1416,6 @@ PlatformBdsRestoreNvVarsFromHardDisk (
VisitingFileSystemInstance,
NULL
);
-
}
/**
@@ -1331,7 +1428,7 @@ PlatformBdsConnectSequence (
VOID
)
{
- UINTN Index;
+ UINTN Index;
DEBUG ((DEBUG_INFO, "PlatformBdsConnectSequence\n"));
@@ -1363,8 +1460,8 @@ PlatformBdsConnectSequence (
Note that DxeSmmReadyToLock must be signaled after this function returns;
otherwise the script wouldn't be saved actually.
**/
-#if defined(__GNUC__)
-__attribute__((unused))
+#if defined (__GNUC__)
+__attribute__ ((unused))
#endif
STATIC
VOID
@@ -1372,12 +1469,15 @@ SaveS3BootScript (
VOID
)
{
- EFI_STATUS Status;
- EFI_S3_SAVE_STATE_PROTOCOL *BootScript;
- STATIC CONST UINT8 Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };
+ EFI_STATUS Status;
+ EFI_S3_SAVE_STATE_PROTOCOL *BootScript;
+ STATIC CONST UINT8 Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };
- Status = gBS->LocateProtocol (&gEfiS3SaveStateProtocolGuid, NULL,
- (VOID **) &BootScript);
+ Status = gBS->LocateProtocol (
+ &gEfiS3SaveStateProtocolGuid,
+ NULL,
+ (VOID **)&BootScript
+ );
ASSERT_EFI_ERROR (Status);
//
@@ -1385,13 +1485,15 @@ SaveS3BootScript (
// implementation embeds a deep copy of the info in the boot script, rather
// than storing just a pointer to runtime or NVS storage.
//
- Status = BootScript->Write(BootScript, EFI_BOOT_SCRIPT_INFORMATION_OPCODE,
- (UINT32) sizeof Info,
- (EFI_PHYSICAL_ADDRESS)(UINTN) &Info);
+ Status = BootScript->Write (
+ BootScript,
+ EFI_BOOT_SCRIPT_INFORMATION_OPCODE,
+ (UINT32)sizeof Info,
+ (EFI_PHYSICAL_ADDRESS)(UINTN)&Info
+ );
ASSERT_EFI_ERROR (Status);
}
-
/**
Do the platform specific action after the console is ready
@@ -1411,18 +1513,22 @@ PlatformBootManagerAfterConsole (
VOID
)
{
- EFI_BOOT_MODE BootMode;
+ EFI_BOOT_MODE BootMode;
DEBUG ((DEBUG_INFO, "PlatformBootManagerAfterConsole\n"));
if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {
- DEBUG ((DEBUG_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "
- "from disk since flash variables appear to be supported.\n"));
+ DEBUG ((
+ DEBUG_INFO,
+ "PlatformBdsPolicyBehavior: not restoring NvVars "
+ "from disk since flash variables appear to be supported.\n"
+ ));
} else {
//
// Try to restore variables from the hard disk early so
// they can be used for the other BDS connect operations.
//
+
/* XXX Calling this causes Keyboard to be removed from ConIn which
results in unresponsive guest boot loaders in the GUI. Restore it
when we figure out what is needed to get NvVars storage done
@@ -1464,7 +1570,9 @@ PlatformBootManagerAfterConsole (
// Register UEFI Shell
//
PlatformRegisterFvBootOption (
- &gUefiShellFileGuid, L"EFI Internal Shell", LOAD_OPTION_ACTIVE
+ &gUefiShellFileGuid,
+ L"EFI Internal Shell",
+ LOAD_OPTION_ACTIVE
);
RemoveStaleFvFileOptions ();
@@ -1483,31 +1591,31 @@ PlatformBootManagerAfterConsole (
VOID
EFIAPI
NotifyDevPath (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_HANDLE Handle;
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
- ATAPI_DEVICE_PATH *Atapi;
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
+ ATAPI_DEVICE_PATH *Atapi;
//
// Examine all new handles
//
- for (;;) {
+ for ( ; ;) {
//
// Get the next handle
//
BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- NULL,
- mEfiDevPathNotifyReg,
- &BufferSize,
- &Handle
- );
+ Status = gBS->LocateHandle (
+ ByRegisterNotify,
+ NULL,
+ mEfiDevPathNotifyReg,
+ &BufferSize,
+ &Handle
+ );
//
// If not found, we're done
@@ -1523,8 +1631,11 @@ NotifyDevPath (
//
// Get the DevicePath protocol on that handle
//
- Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid,
- (VOID **)&DevPathNode);
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&DevPathNode
+ );
ASSERT_EFI_ERROR (Status);
while (!IsDevicePathEnd (DevPathNode)) {
@@ -1532,16 +1643,17 @@ NotifyDevPath (
// Find the handler to dump this device path node
//
if (
- (DevicePathType(DevPathNode) == MESSAGING_DEVICE_PATH) &&
- (DevicePathSubType(DevPathNode) == MSG_ATAPI_DP)
- ) {
- Atapi = (ATAPI_DEVICE_PATH*) DevPathNode;
+ (DevicePathType (DevPathNode) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType (DevPathNode) == MSG_ATAPI_DP)
+ )
+ {
+ Atapi = (ATAPI_DEVICE_PATH *)DevPathNode;
PciOr16 (
PCI_LIB_ADDRESS (
0,
1,
1,
- (Atapi->PrimarySecondary == 1) ? 0x42: 0x40
+ (Atapi->PrimarySecondary == 1) ? 0x42 : 0x40
),
BIT15
);
@@ -1557,7 +1669,6 @@ NotifyDevPath (
return;
}
-
VOID
InstallDevicePathCallback (
VOID
@@ -1565,12 +1676,12 @@ InstallDevicePathCallback (
{
DEBUG ((DEBUG_INFO, "Registered NotifyDevPath Event\n"));
mEfiDevPathEvent = EfiCreateProtocolNotifyEvent (
- &gEfiDevicePathProtocolGuid,
- TPL_CALLBACK,
- NotifyDevPath,
- NULL,
- &mEfiDevPathNotifyReg
- );
+ &gEfiDevicePathProtocolGuid,
+ TPL_CALLBACK,
+ NotifyDevPath,
+ NULL,
+ &mEfiDevPathNotifyReg
+ );
}
/**
@@ -1582,12 +1693,12 @@ InstallDevicePathCallback (
VOID
EFIAPI
PlatformBootManagerWaitCallback (
- UINT16 TimeoutRemain
+ UINT16 TimeoutRemain
)
{
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;
- UINT16 Timeout;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;
+ UINT16 Timeout;
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
@@ -1617,10 +1728,10 @@ PlatformBootManagerUnableToBoot (
VOID
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
- UINTN Index;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
+ UINTN Index;
//
// BootManagerMenu doesn't contain the correct information when return status
@@ -1630,6 +1741,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
@@ -1659,7 +1771,7 @@ PlatformBootManagerUnableToBoot (
}
}
- for (;;) {
+ for ( ; ;) {
EfiBootManagerBoot (&BootManagerMenu);
}
}
diff --git a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.h b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.h
index 382fe191a9..9be184cb64 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.h
@@ -18,7 +18,6 @@ Abstract:
#ifndef _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
#define _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
-
#include <PiDxe.h>
#include <IndustryStandard/Pci.h>
@@ -65,11 +64,11 @@ Abstract:
#include <OvmfPlatforms.h>
-extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
-extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode;
-extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode;
-extern UART_DEVICE_PATH gUartDeviceNode;
-extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;
+extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
+extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode;
+extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode;
+extern UART_DEVICE_PATH gUartDeviceNode;
+extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;
#define PCI_DEVICE_PATH_NODE(Func, Dev) \
{ \
@@ -151,20 +150,20 @@ extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;
} \
}
-#define PCI_CLASS_SCC 0x07
-#define PCI_SUBCLASS_SERIAL 0x00
-#define PCI_IF_16550 0x02
-#define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
-#define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
+#define PCI_CLASS_SCC 0x07
+#define PCI_SUBCLASS_SERIAL 0x00
+#define PCI_IF_16550 0x02
+#define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
+#define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
typedef struct {
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINTN ConnectType;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINTN ConnectType;
} PLATFORM_CONSOLE_CONNECT_ENTRY;
-#define CONSOLE_OUT BIT0
-#define CONSOLE_IN BIT1
-#define STD_ERROR BIT2
+#define CONSOLE_OUT BIT0
+#define CONSOLE_IN BIT1
+#define STD_ERROR BIT2
extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
//
@@ -173,7 +172,7 @@ extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
VOID
PlatformInitializeConsole (
- IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole
+ IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole
);
/**
diff --git a/OvmfPkg/Library/PlatformBootManagerLibBhyve/PlatformData.c b/OvmfPkg/Library/PlatformBootManagerLibBhyve/PlatformData.c
index 73674d536d..b57789b73d 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibBhyve/PlatformData.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibBhyve/PlatformData.c
@@ -16,10 +16,10 @@
//
#pragma pack(1)
typedef struct {
- VENDOR_DEVICE_PATH VendorHardware;
- UART_DEVICE_PATH Uart;
- VENDOR_DEVICE_PATH TerminalType;
- EFI_DEVICE_PATH_PROTOCOL End;
+ VENDOR_DEVICE_PATH VendorHardware;
+ UART_DEVICE_PATH Uart;
+ VENDOR_DEVICE_PATH TerminalType;
+ EFI_DEVICE_PATH_PROTOCOL End;
} VENDOR_UART_DEVICE_PATH;
#pragma pack()
@@ -28,8 +28,8 @@ typedef struct {
//
#pragma pack (1)
typedef struct {
- USB_CLASS_DEVICE_PATH Keyboard;
- EFI_DEVICE_PATH_PROTOCOL End;
+ USB_CLASS_DEVICE_PATH Keyboard;
+ EFI_DEVICE_PATH_PROTOCOL End;
} USB_KEYBOARD_DEVICE_PATH;
#pragma pack ()
@@ -38,33 +38,32 @@ typedef struct {
//
#pragma pack (1)
typedef struct {
- VENDOR_DEVICE_PATH Vendor;
- ACPI_ADR_DEVICE_PATH AcpiAdr;
- EFI_DEVICE_PATH_PROTOCOL End;
+ VENDOR_DEVICE_PATH Vendor;
+ ACPI_ADR_DEVICE_PATH AcpiAdr;
+ EFI_DEVICE_PATH_PROTOCOL End;
} VENDOR_RAMFB_DEVICE_PATH;
#pragma pack ()
-ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode = gPnpPs2Keyboard;
-ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode = gPnp16550ComPort;
-UART_DEVICE_PATH gUartDeviceNode = gUart;
-VENDOR_DEVICE_PATH gTerminalTypeDeviceNode = gPcAnsiTerminal;
+ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode = gPnpPs2Keyboard;
+ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode = gPnp16550ComPort;
+UART_DEVICE_PATH gUartDeviceNode = gUart;
+VENDOR_DEVICE_PATH gTerminalTypeDeviceNode = gPcAnsiTerminal;
//
// Platform specific keyboard device path
//
-
//
// Debug Agent UART Device Path
//
-VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath = {
+VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath = {
{
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
EFI_DEBUG_AGENT_GUID,
@@ -74,8 +73,8 @@ VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath = {
MESSAGING_DEVICE_PATH,
MSG_UART_DP,
{
- (UINT8) (sizeof (UART_DEVICE_PATH)),
- (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8)
+ (UINT8)(sizeof (UART_DEVICE_PATH)),
+ (UINT8)((sizeof (UART_DEVICE_PATH)) >> 8)
}
},
0, // Reserved
@@ -88,7 +87,7 @@ VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath = {
gEndEntire
};
-STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath = {
+STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath = {
{
{
MESSAGING_DEVICE_PATH,
@@ -107,14 +106,14 @@ STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath = {
gEndEntire
};
-STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath = {
+STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath = {
{
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
QEMU_RAMFB_GUID,
@@ -124,8 +123,8 @@ STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath = {
ACPI_DEVICE_PATH,
ACPI_ADR_DP,
{
- (UINT8) (sizeof (ACPI_ADR_DEVICE_PATH)),
- (UINT8) ((sizeof (ACPI_ADR_DEVICE_PATH)) >> 8)
+ (UINT8)(sizeof (ACPI_ADR_DEVICE_PATH)),
+ (UINT8)((sizeof (ACPI_ADR_DEVICE_PATH)) >> 8)
}
},
ACPI_DISPLAY_ADR (
@@ -145,9 +144,9 @@ STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath = {
//
// Predefined platform default console device path
//
-PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
+PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
{
- (EFI_DEVICE_PATH_PROTOCOL *) &gDebugAgentUartDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gDebugAgentUartDevicePath,
(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
},
{
@@ -167,5 +166,4 @@ PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
//
// Predefined platform connect sequence
//
-EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[] = { NULL };
-
+EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[] = { NULL };