summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Csm
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/Csm
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/Csm')
-rw-r--r--OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c1799
-rw-r--r--OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.h164
-rw-r--r--OvmfPkg/Csm/BiosThunk/VideoDxe/ComponentName.c32
-rw-r--r--OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h264
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c1
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h1
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c40
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h26
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c553
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h51
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c192
-rw-r--r--OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h31
-rw-r--r--OvmfPkg/Csm/Include/Framework/BootScript.h11
-rw-r--r--OvmfPkg/Csm/Include/Framework/DxeCis.h115
-rw-r--r--OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h56
-rw-r--r--OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h20
-rw-r--r--OvmfPkg/Csm/Include/Framework/FrameworkInternalFormRepresentation.h409
-rw-r--r--OvmfPkg/Csm/Include/Framework/Hob.h8
-rw-r--r--OvmfPkg/Csm/Include/Framework/StatusCode.h60
-rw-r--r--OvmfPkg/Csm/Include/Guid/LegacyBios.h2
-rw-r--r--OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h10
-rw-r--r--OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h87
-rw-r--r--OvmfPkg/Csm/Include/Protocol/IsaAcpi.h54
-rw-r--r--OvmfPkg/Csm/Include/Protocol/IsaIo.h28
-rw-r--r--OvmfPkg/Csm/Include/Protocol/LegacyBios.h652
-rw-r--r--OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h194
-rw-r--r--OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h11
-rw-r--r--OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h20
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c190
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyBda.c26
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c518
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h779
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c1190
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyCmos.c6
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c119
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c1220
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c308
-rw-r--r--OvmfPkg/Csm/LegacyBiosDxe/Thunk.c175
-rw-r--r--OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c851
-rw-r--r--OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h115
-rw-r--r--OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h42
-rw-r--r--OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h4
-rw-r--r--OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c801
43 files changed, 5709 insertions, 5526 deletions
diff --git a/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c b/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c
index 24d945b2eb..35a4a24f34 100644
--- a/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c
+++ b/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c
@@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// EFI Driver Binding Protocol Instance
//
-EFI_DRIVER_BINDING_PROTOCOL gBiosVideoDriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gBiosVideoDriverBinding = {
BiosVideoDriverBindingSupported,
BiosVideoDriverBindingStart,
BiosVideoDriverBindingStop,
@@ -24,17 +24,17 @@ EFI_DRIVER_BINDING_PROTOCOL gBiosVideoDriverBinding = {
//
// Global lookup tables for VGA graphics modes
//
-UINT8 mVgaLeftMaskTable[] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 };
+UINT8 mVgaLeftMaskTable[] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 };
-UINT8 mVgaRightMaskTable[] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
+UINT8 mVgaRightMaskTable[] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
-UINT8 mVgaBitMaskTable[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
+UINT8 mVgaBitMaskTable[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
//
// Save controller attributes during first start
//
-UINT64 mOriginalPciAttributes;
-BOOLEAN mPciAttributesSaved = FALSE;
+UINT64 mOriginalPciAttributes;
+BOOLEAN mPciAttributesSaved = FALSE;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL mVgaColorToGraphicsOutputColor[] = {
{ 0x00, 0x00, 0x00, 0x00 },
@@ -58,33 +58,33 @@ EFI_GRAPHICS_OUTPUT_BLT_PIXEL mVgaColorToGraphicsOutputColor[] = {
//
// Standard timing defined by VESA EDID
//
-VESA_BIOS_EXTENSIONS_EDID_TIMING mEstablishedEdidTiming[] = {
+VESA_BIOS_EXTENSIONS_EDID_TIMING mEstablishedEdidTiming[] = {
//
// Established Timing I
//
- {800, 600, 60},
- {800, 600, 56},
- {640, 480, 75},
- {640, 480, 72},
- {640, 480, 67},
- {640, 480, 60},
- {720, 400, 88},
- {720, 400, 70},
+ { 800, 600, 60 },
+ { 800, 600, 56 },
+ { 640, 480, 75 },
+ { 640, 480, 72 },
+ { 640, 480, 67 },
+ { 640, 480, 60 },
+ { 720, 400, 88 },
+ { 720, 400, 70 },
//
// Established Timing II
//
- {1280, 1024, 75},
- {1024, 768, 75},
- {1024, 768, 70},
- {1024, 768, 60},
- {1024, 768, 87},
- {832, 624, 75},
- {800, 600, 75},
- {800, 600, 72},
+ { 1280, 1024, 75 },
+ { 1024, 768, 75 },
+ { 1024, 768, 70 },
+ { 1024, 768, 60 },
+ { 1024, 768, 87 },
+ { 832, 624, 75 },
+ { 800, 600, 75 },
+ { 800, 600, 72 },
//
// Established Timing III
//
- {1152, 870, 75}
+ { 1152, 870, 75 }
};
/**
@@ -117,7 +117,7 @@ BiosVideoDriverBindingSupported (
//
// See if the Legacy BIOS Protocol is available
//
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -128,7 +128,7 @@ BiosVideoDriverBindingSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
+ (VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -154,6 +154,7 @@ BiosVideoDriverBindingSupported (
return EFI_ALREADY_STARTED;
}
}
+
//
// See if this is a PCI Graphics Controller by looking at the Command register and
// Class Code Register
@@ -171,15 +172,14 @@ BiosVideoDriverBindingSupported (
}
Status = EFI_UNSUPPORTED;
- if (Pci.Hdr.ClassCode[2] == 0x03 || (Pci.Hdr.ClassCode[2] == 0x00 && Pci.Hdr.ClassCode[1] == 0x01)) {
-
+ if ((Pci.Hdr.ClassCode[2] == 0x03) || ((Pci.Hdr.ClassCode[2] == 0x00) && (Pci.Hdr.ClassCode[1] == 0x01))) {
Status = EFI_SUCCESS;
//
// If this is a graphics controller,
// go further check RemainingDevicePath validation
//
if (RemainingDevicePath != NULL) {
- Node = (EFI_DEV_PATH *) RemainingDevicePath;
+ Node = (EFI_DEV_PATH *)RemainingDevicePath;
//
// Check if RemainingDevicePath is the End of Device Path Node,
// if yes, return EFI_SUCCESS
@@ -189,9 +189,10 @@ BiosVideoDriverBindingSupported (
// If RemainingDevicePath isn't the End of Device Path Node,
// check its validation
//
- if (Node->DevPath.Type != ACPI_DEVICE_PATH ||
- Node->DevPath.SubType != ACPI_ADR_DP ||
- DevicePathNodeLength(&Node->DevPath) < sizeof(ACPI_ADR_DEVICE_PATH)) {
+ if ((Node->DevPath.Type != ACPI_DEVICE_PATH) ||
+ (Node->DevPath.SubType != ACPI_ADR_DP) ||
+ (DevicePathNodeLength (&Node->DevPath) < sizeof (ACPI_ADR_DEVICE_PATH)))
+ {
Status = EFI_UNSUPPORTED;
}
}
@@ -209,7 +210,6 @@ Done:
return Status;
}
-
/**
Install Graphics Output Protocol onto VGA device handles.
@@ -246,7 +246,7 @@ BiosVideoDriverBindingStart (
//
// See if the Legacy BIOS Protocol is available
//
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -257,7 +257,7 @@ BiosVideoDriverBindingStart (
Status = gBS->HandleProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath
+ (VOID **)&ParentDevicePath
);
if (EFI_ERROR (Status)) {
return Status;
@@ -269,7 +269,7 @@ BiosVideoDriverBindingStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
+ (VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -292,6 +292,7 @@ BiosVideoDriverBindingStart (
if (EFI_ERROR (Status)) {
goto Done;
}
+
mPciAttributesSaved = TRUE;
}
@@ -309,7 +310,7 @@ BiosVideoDriverBindingStart (
}
Supports &= (UINT64)(EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16);
- if (Supports == 0 || Supports == (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) {
+ if ((Supports == 0) || (Supports == (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16))) {
Status = EFI_UNSUPPORTED;
goto Done;
}
@@ -323,11 +324,11 @@ BiosVideoDriverBindingStart (
// Enable the device and make sure VGA cycles are being forwarded to this VGA device
//
Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | Supports,
- NULL
- );
+ PciIo,
+ EfiPciIoAttributeOperationEnable,
+ EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | Supports,
+ NULL
+ );
if (EFI_ERROR (Status)) {
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
EFI_ERROR_CODE | EFI_ERROR_MINOR,
@@ -336,6 +337,7 @@ BiosVideoDriverBindingStart (
);
goto Done;
}
+
//
// Check to see if there is a legacy option ROM image associated with this PCI device
//
@@ -349,6 +351,7 @@ BiosVideoDriverBindingStart (
if (EFI_ERROR (Status)) {
goto Done;
}
+
//
// Post the legacy option ROM if it is available.
//
@@ -378,7 +381,8 @@ BiosVideoDriverBindingStart (
if (RemainingDevicePath != NULL) {
if (IsDevicePathEnd (RemainingDevicePath) &&
- (FeaturePcdGet (PcdBiosVideoCheckVbeEnable) || FeaturePcdGet (PcdBiosVideoCheckVgaEnable))) {
+ (FeaturePcdGet (PcdBiosVideoCheckVbeEnable) || FeaturePcdGet (PcdBiosVideoCheckVgaEnable)))
+ {
//
// If RemainingDevicePath is the End of Device Path Node,
// don't create any child device and return EFI_SUCCESS
@@ -418,13 +422,14 @@ Done:
// Restore original PCI attributes
//
PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationSet,
- mOriginalPciAttributes,
- NULL
- );
+ PciIo,
+ EfiPciIoAttributeOperationSet,
+ mOriginalPciAttributes,
+ NULL
+ );
}
}
+
//
// Release PCI I/O Protocols on the controller handle.
//
@@ -439,7 +444,6 @@ Done:
return Status;
}
-
/**
Stop.
@@ -455,16 +459,16 @@ Done:
EFI_STATUS
EFIAPI
BiosVideoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
)
{
- EFI_STATUS Status;
- BOOLEAN AllChildrenStopped;
- UINTN Index;
- EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_STATUS Status;
+ BOOLEAN AllChildrenStopped;
+ UINTN Index;
+ EFI_PCI_IO_PROTOCOL *PciIo;
AllChildrenStopped = TRUE;
@@ -499,7 +503,7 @@ BiosVideoDriverBindingStop (
Status = gBS->HandleProtocol (
Controller,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
ASSERT_EFI_ERROR (Status);
@@ -516,11 +520,9 @@ BiosVideoDriverBindingStop (
}
}
-
return EFI_SUCCESS;
}
-
/**
Install child handles if the Handle supports MBR format.
@@ -545,18 +547,18 @@ BiosVideoChildHandleInstall (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- BIOS_VIDEO_DEV *BiosVideoPrivate;
- PCI_TYPE00 Pci;
- ACPI_ADR_DEVICE_PATH AcpiDeviceNode;
- BOOLEAN ProtocolInstalled;
+ EFI_STATUS Status;
+ BIOS_VIDEO_DEV *BiosVideoPrivate;
+ PCI_TYPE00 Pci;
+ ACPI_ADR_DEVICE_PATH AcpiDeviceNode;
+ BOOLEAN ProtocolInstalled;
//
// Allocate the private device structure for video device
//
- BiosVideoPrivate = (BIOS_VIDEO_DEV *) AllocateZeroPool (
- sizeof (BIOS_VIDEO_DEV)
- );
+ BiosVideoPrivate = (BIOS_VIDEO_DEV *)AllocateZeroPool (
+ sizeof (BIOS_VIDEO_DEV)
+ );
if (NULL == BiosVideoPrivate) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
@@ -566,12 +568,12 @@ BiosVideoChildHandleInstall (
// See if this is a VGA compatible controller or not
//
Status = ParentPciIo->Pci.Read (
- ParentPciIo,
- EfiPciIoWidthUint32,
- 0,
- sizeof (Pci) / sizeof (UINT32),
- &Pci
- );
+ ParentPciIo,
+ EfiPciIoWidthUint32,
+ 0,
+ sizeof (Pci) / sizeof (UINT32),
+ &Pci
+ );
if (EFI_ERROR (Status)) {
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
EFI_ERROR_CODE | EFI_ERROR_MINOR,
@@ -580,16 +582,17 @@ BiosVideoChildHandleInstall (
);
goto Done;
}
+
BiosVideoPrivate->VgaCompatible = FALSE;
- if (Pci.Hdr.ClassCode[2] == 0x00 && Pci.Hdr.ClassCode[1] == 0x01) {
+ if ((Pci.Hdr.ClassCode[2] == 0x00) && (Pci.Hdr.ClassCode[1] == 0x01)) {
BiosVideoPrivate->VgaCompatible = TRUE;
}
- if (Pci.Hdr.ClassCode[2] == 0x03 && Pci.Hdr.ClassCode[1] == 0x00 && Pci.Hdr.ClassCode[0] == 0x00) {
+ if ((Pci.Hdr.ClassCode[2] == 0x03) && (Pci.Hdr.ClassCode[1] == 0x00) && (Pci.Hdr.ClassCode[0] == 0x00)) {
BiosVideoPrivate->VgaCompatible = TRUE;
}
- if (PcdGetBool (PcdBiosVideoSetTextVgaModeEnable)) {
+ if (PcdGetBool (PcdBiosVideoSetTextVgaModeEnable)) {
//
// Create EXIT_BOOT_SERIVES Event
//
@@ -626,21 +629,20 @@ BiosVideoChildHandleInstall (
BiosVideoPrivate->GraphicsOutput.QueryMode = BiosVideoGraphicsOutputQueryMode;
BiosVideoPrivate->GraphicsOutput.SetMode = BiosVideoGraphicsOutputSetMode;
-
//
// Allocate buffer for Graphics Output Protocol mode information
//
- BiosVideoPrivate->GraphicsOutput.Mode = (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *) AllocatePool (
- sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE)
- );
+ BiosVideoPrivate->GraphicsOutput.Mode = (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *)AllocatePool (
+ sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE)
+ );
if (NULL == BiosVideoPrivate->GraphicsOutput.Mode) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
- BiosVideoPrivate->GraphicsOutput.Mode->Info = (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) AllocatePool (
- sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)
- );
+ BiosVideoPrivate->GraphicsOutput.Mode->Info = (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *)AllocatePool (
+ sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)
+ );
if (NULL == BiosVideoPrivate->GraphicsOutput.Mode->Info) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
@@ -657,14 +659,14 @@ BiosVideoChildHandleInstall (
if ((RemainingDevicePath == NULL) || (!IsDevicePathEnd (RemainingDevicePath))) {
if (RemainingDevicePath == NULL) {
ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH));
- AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;
+ AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;
AcpiDeviceNode.Header.SubType = ACPI_ADR_DP;
- AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);
+ AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);
SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE_PATH));
BiosVideoPrivate->GopDevicePath = AppendDevicePathNode (
ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode
+ (EFI_DEVICE_PATH_PROTOCOL *)&AcpiDeviceNode
);
} else {
BiosVideoPrivate->GopDevicePath = AppendDevicePathNode (ParentDevicePath, RemainingDevicePath);
@@ -674,12 +676,12 @@ BiosVideoChildHandleInstall (
// Creat child handle and device path protocol firstly
//
BiosVideoPrivate->Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &BiosVideoPrivate->Handle,
- &gEfiDevicePathProtocolGuid,
- BiosVideoPrivate->GopDevicePath,
- NULL
- );
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &BiosVideoPrivate->Handle,
+ &gEfiDevicePathProtocolGuid,
+ BiosVideoPrivate->GopDevicePath,
+ NULL
+ );
if (EFI_ERROR (Status)) {
goto Done;
}
@@ -704,7 +706,7 @@ BiosVideoChildHandleInstall (
//
// When check for VBE, PCI I/O protocol is needed, so use parent's protocol interface temporally
//
- BiosVideoPrivate->PciIo = ParentPciIo;
+ BiosVideoPrivate->PciIo = ParentPciIo;
//
// Check for VESA BIOS Extensions for modes that are compatible with Graphics Output
@@ -715,6 +717,7 @@ BiosVideoChildHandleInstall (
} else {
Status = EFI_UNSUPPORTED;
}
+
if (EFI_ERROR (Status)) {
//
// The VESA BIOS Extensions are not compatible with Graphics Output, so check for support
@@ -740,6 +743,7 @@ BiosVideoChildHandleInstall (
FreePool (BiosVideoPrivate->GraphicsOutput.Mode->Info);
BiosVideoPrivate->GraphicsOutput.Mode->Info = NULL;
}
+
FreePool (BiosVideoPrivate->GraphicsOutput.Mode);
BiosVideoPrivate->GraphicsOutput.Mode = NULL;
}
@@ -781,7 +785,7 @@ BiosVideoChildHandleInstall (
Status = gBS->OpenProtocol (
ParentHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &BiosVideoPrivate->PciIo,
+ (VOID **)&BiosVideoPrivate->PciIo,
This->DriverBindingHandle,
BiosVideoPrivate->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -789,6 +793,7 @@ BiosVideoChildHandleInstall (
if (EFI_ERROR (Status)) {
goto Done;
}
+
ProtocolInstalled = TRUE;
}
}
@@ -810,6 +815,7 @@ Done:
if ((BiosVideoPrivate != NULL) && (BiosVideoPrivate->ExitBootServicesEvent != NULL)) {
gBS->CloseEvent (BiosVideoPrivate->ExitBootServicesEvent);
}
+
//
// Free private data structure
//
@@ -819,7 +825,6 @@ Done:
return Status;
}
-
/**
Deregister an video child handle and free resources.
@@ -832,17 +837,17 @@ Done:
**/
EFI_STATUS
BiosVideoChildHandleUninstall (
- EFI_DRIVER_BINDING_PROTOCOL *This,
- EFI_HANDLE Controller,
- EFI_HANDLE Handle
+ EFI_DRIVER_BINDING_PROTOCOL *This,
+ EFI_HANDLE Controller,
+ EFI_HANDLE Handle
)
{
- EFI_STATUS Status;
- EFI_IA32_REGISTER_SET Regs;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort;
- BIOS_VIDEO_DEV *BiosVideoPrivate;
- EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_STATUS Status;
+ EFI_IA32_REGISTER_SET Regs;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort;
+ BIOS_VIDEO_DEV *BiosVideoPrivate;
+ EFI_PCI_IO_PROTOCOL *PciIo;
BiosVideoPrivate = NULL;
GraphicsOutput = NULL;
@@ -852,24 +857,24 @@ BiosVideoChildHandleUninstall (
Status = gBS->OpenProtocol (
Handle,
&gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput,
+ (VOID **)&GraphicsOutput,
This->DriverBindingHandle,
Handle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
- BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (GraphicsOutput);
+ BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (GraphicsOutput);
}
if (EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
- Handle,
- &gEfiVgaMiniPortProtocolGuid,
- (VOID **) &VgaMiniPort,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ Handle,
+ &gEfiVgaMiniPortProtocolGuid,
+ (VOID **)&VgaMiniPort,
+ This->DriverBindingHandle,
+ Handle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_VGA_MINI_PORT_THIS (VgaMiniPort);
}
@@ -918,6 +923,7 @@ BiosVideoChildHandleUninstall (
NULL
);
}
+
if (!BiosVideoPrivate->ProduceGraphicsOutput) {
Status = gBS->UninstallMultipleProtocolInterfaces (
Controller,
@@ -931,7 +937,7 @@ BiosVideoChildHandleUninstall (
gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
+ (VOID **)&PciIo,
This->DriverBindingHandle,
Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -954,7 +960,6 @@ BiosVideoChildHandleUninstall (
return EFI_SUCCESS;
}
-
/**
Release resource for biso video instance.
@@ -967,7 +972,7 @@ BiosVideoDeviceReleaseResource (
)
{
if (BiosVideoPrivate == NULL) {
- return ;
+ return;
}
//
@@ -980,24 +985,28 @@ BiosVideoDeviceReleaseResource (
if (BiosVideoPrivate->VgaFrameBuffer != NULL) {
FreePool (BiosVideoPrivate->VgaFrameBuffer);
}
+
//
// Free VBE Frame Buffer
//
if (BiosVideoPrivate->VbeFrameBuffer != NULL) {
FreePool (BiosVideoPrivate->VbeFrameBuffer);
}
+
//
// Free line buffer
//
if (BiosVideoPrivate->LineBuffer != NULL) {
FreePool (BiosVideoPrivate->LineBuffer);
}
+
//
// Free mode data
//
if (BiosVideoPrivate->ModeData != NULL) {
FreePool (BiosVideoPrivate->ModeData);
}
+
//
// Free memory allocated below 1MB
//
@@ -1014,18 +1023,21 @@ BiosVideoDeviceReleaseResource (
//
if (BiosVideoPrivate->GraphicsOutput.Mode != NULL) {
if (BiosVideoPrivate->GraphicsOutput.Mode->Info != NULL) {
- FreePool (BiosVideoPrivate->GraphicsOutput.Mode->Info);
- BiosVideoPrivate->GraphicsOutput.Mode->Info = NULL;
+ FreePool (BiosVideoPrivate->GraphicsOutput.Mode->Info);
+ BiosVideoPrivate->GraphicsOutput.Mode->Info = NULL;
}
+
FreePool (BiosVideoPrivate->GraphicsOutput.Mode);
BiosVideoPrivate->GraphicsOutput.Mode = NULL;
}
+
//
// Free EDID discovered protocol occupied resource
//
if (BiosVideoPrivate->EdidDiscovered.Edid != NULL) {
FreePool (BiosVideoPrivate->EdidDiscovered.Edid);
}
+
//
// Free EDID active protocol occupied resource
//
@@ -1033,16 +1045,15 @@ BiosVideoDeviceReleaseResource (
FreePool (BiosVideoPrivate->EdidActive.Edid);
}
- if (BiosVideoPrivate->GopDevicePath!= NULL) {
+ if (BiosVideoPrivate->GopDevicePath != NULL) {
FreePool (BiosVideoPrivate->GopDevicePath);
}
FreePool (BiosVideoPrivate);
- return ;
+ return;
}
-
/**
Generate a search key for a specified timing data.
@@ -1053,10 +1064,10 @@ BiosVideoDeviceReleaseResource (
**/
UINT32
CalculateEdidKey (
- VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming
+ VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming
)
{
- UINT32 Key;
+ UINT32 Key;
//
// Be sure no conflicts for all standard timing defined by VESA.
@@ -1065,7 +1076,6 @@ CalculateEdidKey (
return Key;
}
-
/**
Parse the Established Timing and Standard Timing in EDID data block.
@@ -1078,31 +1088,32 @@ CalculateEdidKey (
**/
BOOLEAN
ParseEdidData (
- UINT8 *EdidBuffer,
- VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming
+ UINT8 *EdidBuffer,
+ VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming
)
{
- UINT8 CheckSum;
- UINT32 Index;
- UINT32 ValidNumber;
- UINT32 TimingBits;
- UINT8 *BufferIndex;
- UINT16 HorizontalResolution;
- UINT16 VerticalResolution;
- UINT8 AspectRatio;
- UINT8 RefreshRate;
- VESA_BIOS_EXTENSIONS_EDID_TIMING TempTiming;
- VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *EdidDataBlock;
+ UINT8 CheckSum;
+ UINT32 Index;
+ UINT32 ValidNumber;
+ UINT32 TimingBits;
+ UINT8 *BufferIndex;
+ UINT16 HorizontalResolution;
+ UINT16 VerticalResolution;
+ UINT8 AspectRatio;
+ UINT8 RefreshRate;
+ VESA_BIOS_EXTENSIONS_EDID_TIMING TempTiming;
+ VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *EdidDataBlock;
- EdidDataBlock = (VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *) EdidBuffer;
+ EdidDataBlock = (VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *)EdidBuffer;
//
// Check the checksum of EDID data
//
CheckSum = 0;
- for (Index = 0; Index < VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE; Index ++) {
- CheckSum = (UINT8) (CheckSum + EdidBuffer[Index]);
+ for (Index = 0; Index < VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE; Index++) {
+ CheckSum = (UINT8)(CheckSum + EdidBuffer[Index]);
}
+
if (CheckSum != 0) {
return FALSE;
}
@@ -1113,20 +1124,26 @@ ParseEdidData (
if ((EdidDataBlock->EstablishedTimings[0] != 0) ||
(EdidDataBlock->EstablishedTimings[1] != 0) ||
(EdidDataBlock->EstablishedTimings[2] != 0)
- ) {
+ )
+ {
//
// Established timing data
//
TimingBits = EdidDataBlock->EstablishedTimings[0] |
(EdidDataBlock->EstablishedTimings[1] << 8) |
- ((EdidDataBlock->EstablishedTimings[2] & 0x80) << 9) ;
- for (Index = 0; Index < VESA_BIOS_EXTENSIONS_EDID_ESTABLISHED_TIMING_MAX_NUMBER; Index ++) {
+ ((EdidDataBlock->EstablishedTimings[2] & 0x80) << 9);
+ for (Index = 0; Index < VESA_BIOS_EXTENSIONS_EDID_ESTABLISHED_TIMING_MAX_NUMBER; Index++) {
if ((TimingBits & 0x1) != 0) {
- DEBUG ((DEBUG_INFO, "Established Timing: %d x %d\n",
- mEstablishedEdidTiming[Index].HorizontalResolution, mEstablishedEdidTiming[Index].VerticalResolution));
+ DEBUG ((
+ DEBUG_INFO,
+ "Established Timing: %d x %d\n",
+ mEstablishedEdidTiming[Index].HorizontalResolution,
+ mEstablishedEdidTiming[Index].VerticalResolution
+ ));
ValidEdidTiming->Key[ValidNumber] = CalculateEdidKey (&mEstablishedEdidTiming[Index]);
- ValidNumber ++;
+ ValidNumber++;
}
+
TimingBits = TimingBits >> 1;
}
}
@@ -1135,42 +1152,44 @@ ParseEdidData (
// Parse the standard timing data
//
BufferIndex = &EdidDataBlock->StandardTimingIdentification[0];
- for (Index = 0; Index < 8; Index ++) {
+ for (Index = 0; Index < 8; Index++) {
//
// Check if this is a valid Standard Timing entry
// VESA documents unused fields should be set to 01h
//
- if ((BufferIndex[0] != 0x1) && (BufferIndex[1] != 0x1)){
+ if ((BufferIndex[0] != 0x1) && (BufferIndex[1] != 0x1)) {
//
// A valid Standard Timing
//
- HorizontalResolution = (UINT16) (BufferIndex[0] * 8 + 248);
- AspectRatio = (UINT8) (BufferIndex[1] >> 6);
+ HorizontalResolution = (UINT16)(BufferIndex[0] * 8 + 248);
+ AspectRatio = (UINT8)(BufferIndex[1] >> 6);
switch (AspectRatio) {
case 0:
- VerticalResolution = (UINT16) (HorizontalResolution / 16 * 10);
+ VerticalResolution = (UINT16)(HorizontalResolution / 16 * 10);
break;
case 1:
- VerticalResolution = (UINT16) (HorizontalResolution / 4 * 3);
+ VerticalResolution = (UINT16)(HorizontalResolution / 4 * 3);
break;
case 2:
- VerticalResolution = (UINT16) (HorizontalResolution / 5 * 4);
+ VerticalResolution = (UINT16)(HorizontalResolution / 5 * 4);
break;
case 3:
- VerticalResolution = (UINT16) (HorizontalResolution / 16 * 9);
+ VerticalResolution = (UINT16)(HorizontalResolution / 16 * 9);
break;
default:
- VerticalResolution = (UINT16) (HorizontalResolution / 4 * 3);
+ VerticalResolution = (UINT16)(HorizontalResolution / 4 * 3);
break;
}
- RefreshRate = (UINT8) ((BufferIndex[1] & 0x1f) + 60);
+
+ RefreshRate = (UINT8)((BufferIndex[1] & 0x1f) + 60);
DEBUG ((DEBUG_INFO, "Standard Timing: %d x %d\n", HorizontalResolution, VerticalResolution));
- TempTiming.HorizontalResolution = HorizontalResolution;
- TempTiming.VerticalResolution = VerticalResolution;
- TempTiming.RefreshRate = RefreshRate;
+ TempTiming.HorizontalResolution = HorizontalResolution;
+ TempTiming.VerticalResolution = VerticalResolution;
+ TempTiming.RefreshRate = RefreshRate;
ValidEdidTiming->Key[ValidNumber] = CalculateEdidKey (&TempTiming);
- ValidNumber ++;
+ ValidNumber++;
}
+
BufferIndex += 2;
}
@@ -1178,7 +1197,7 @@ ParseEdidData (
// Parse the Detailed Timing data
//
BufferIndex = &EdidDataBlock->DetailedTimingDescriptions[0];
- for (Index = 0; Index < 4; Index ++, BufferIndex += VESA_BIOS_EXTENSIONS_DETAILED_TIMING_EACH_DESCRIPTOR_SIZE) {
+ for (Index = 0; Index < 4; Index++, BufferIndex += VESA_BIOS_EXTENSIONS_DETAILED_TIMING_EACH_DESCRIPTOR_SIZE) {
if ((BufferIndex[0] == 0x0) && (BufferIndex[1] == 0x0)) {
//
// Check if this is a valid Detailed Timing Descriptor
@@ -1186,22 +1205,27 @@ ParseEdidData (
//
continue;
}
+
//
// Calculate Horizontal and Vertical resolution
//
TempTiming.HorizontalResolution = ((UINT16)(BufferIndex[4] & 0xF0) << 4) | (BufferIndex[2]);
- TempTiming.VerticalResolution = ((UINT16)(BufferIndex[7] & 0xF0) << 4) | (BufferIndex[5]);
- DEBUG ((DEBUG_INFO, "Detailed Timing %d: %d x %d\n",
- Index, TempTiming.HorizontalResolution, TempTiming.VerticalResolution));
+ TempTiming.VerticalResolution = ((UINT16)(BufferIndex[7] & 0xF0) << 4) | (BufferIndex[5]);
+ DEBUG ((
+ DEBUG_INFO,
+ "Detailed Timing %d: %d x %d\n",
+ Index,
+ TempTiming.HorizontalResolution,
+ TempTiming.VerticalResolution
+ ));
ValidEdidTiming->Key[ValidNumber] = CalculateEdidKey (&TempTiming);
- ValidNumber ++;
+ ValidNumber++;
}
ValidEdidTiming->ValidNumber = ValidNumber;
return TRUE;
}
-
/**
Search a specified Timing in all the valid EDID timings.
@@ -1214,16 +1238,16 @@ ParseEdidData (
**/
BOOLEAN
SearchEdidTiming (
- VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming,
- VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming
+ VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming,
+ VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming
)
{
- UINT32 Index;
- UINT32 Key;
+ UINT32 Index;
+ UINT32 Key;
Key = CalculateEdidKey (EdidTiming);
- for (Index = 0; Index < ValidEdidTiming->ValidNumber; Index ++) {
+ for (Index = 0; Index < ValidEdidTiming->ValidNumber; Index++) {
if (Key == ValidEdidTiming->Key[Index]) {
return TRUE;
}
@@ -1281,34 +1305,34 @@ BiosVideoCheckForVbe (
IN OUT BIOS_VIDEO_DEV *BiosVideoPrivate
)
{
- EFI_STATUS Status;
- EFI_IA32_REGISTER_SET Regs;
- UINT16 *ModeNumberPtr;
- UINT16 VbeModeNumber;
- BOOLEAN ModeFound;
- BOOLEAN EdidFound;
- BIOS_VIDEO_MODE_DATA *ModeBuffer;
- BIOS_VIDEO_MODE_DATA *CurrentModeData;
- UINTN PreferMode;
- UINTN ModeNumber;
- VESA_BIOS_EXTENSIONS_EDID_TIMING Timing;
- VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING ValidEdidTiming;
- EFI_EDID_OVERRIDE_PROTOCOL *EdidOverride;
- UINT32 EdidAttributes;
- BOOLEAN EdidOverrideFound;
- UINTN EdidOverrideDataSize;
- UINT8 *EdidOverrideDataBlock;
- UINTN EdidActiveDataSize;
- UINT8 *EdidActiveDataBlock;
- UINT32 HighestHorizontalResolution;
- UINT32 HighestVerticalResolution;
- UINTN HighestResolutionMode;
-
- EdidFound = TRUE;
- EdidOverrideFound = FALSE;
- EdidOverrideDataBlock = NULL;
- EdidActiveDataSize = 0;
- EdidActiveDataBlock = NULL;
+ EFI_STATUS Status;
+ EFI_IA32_REGISTER_SET Regs;
+ UINT16 *ModeNumberPtr;
+ UINT16 VbeModeNumber;
+ BOOLEAN ModeFound;
+ BOOLEAN EdidFound;
+ BIOS_VIDEO_MODE_DATA *ModeBuffer;
+ BIOS_VIDEO_MODE_DATA *CurrentModeData;
+ UINTN PreferMode;
+ UINTN ModeNumber;
+ VESA_BIOS_EXTENSIONS_EDID_TIMING Timing;
+ VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING ValidEdidTiming;
+ EFI_EDID_OVERRIDE_PROTOCOL *EdidOverride;
+ UINT32 EdidAttributes;
+ BOOLEAN EdidOverrideFound;
+ UINTN EdidOverrideDataSize;
+ UINT8 *EdidOverrideDataBlock;
+ UINTN EdidActiveDataSize;
+ UINT8 *EdidActiveDataBlock;
+ UINT32 HighestHorizontalResolution;
+ UINT32 HighestVerticalResolution;
+ UINTN HighestResolutionMode;
+
+ EdidFound = TRUE;
+ EdidOverrideFound = FALSE;
+ EdidOverrideDataBlock = NULL;
+ EdidActiveDataSize = 0;
+ EdidActiveDataBlock = NULL;
HighestHorizontalResolution = 0;
HighestVerticalResolution = 0;
HighestResolutionMode = 0;
@@ -1340,12 +1364,12 @@ BiosVideoCheckForVbe (
//
// Fill in the VBE related data structures
//
- BiosVideoPrivate->VbeInformationBlock = (VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK *) (UINTN) (BiosVideoPrivate->PagesBelow1MB);
- BiosVideoPrivate->VbeModeInformationBlock = (VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK *) (BiosVideoPrivate->VbeInformationBlock + 1);
- BiosVideoPrivate->VbeEdidDataBlock = (VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *) (BiosVideoPrivate->VbeModeInformationBlock + 1);
- BiosVideoPrivate->VbeCrtcInformationBlock = (VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK *) (BiosVideoPrivate->VbeEdidDataBlock + 1);
- BiosVideoPrivate->VbeSaveRestorePages = 0;
- BiosVideoPrivate->VbeSaveRestoreBuffer = 0;
+ BiosVideoPrivate->VbeInformationBlock = (VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK *)(UINTN)(BiosVideoPrivate->PagesBelow1MB);
+ BiosVideoPrivate->VbeModeInformationBlock = (VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK *)(BiosVideoPrivate->VbeInformationBlock + 1);
+ BiosVideoPrivate->VbeEdidDataBlock = (VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *)(BiosVideoPrivate->VbeModeInformationBlock + 1);
+ BiosVideoPrivate->VbeCrtcInformationBlock = (VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK *)(BiosVideoPrivate->VbeEdidDataBlock + 1);
+ BiosVideoPrivate->VbeSaveRestorePages = 0;
+ BiosVideoPrivate->VbeSaveRestoreBuffer = 0;
//
// Test to see if the Video Adapter is compliant with VBE 3.0
@@ -1353,9 +1377,9 @@ BiosVideoCheckForVbe (
gBS->SetMem (&Regs, sizeof (Regs), 0);
Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_CONTROLLER_INFORMATION;
gBS->SetMem (BiosVideoPrivate->VbeInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK), 0);
- BiosVideoPrivate->VbeInformationBlock->VESASignature = VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE;
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeInformationBlock);
- Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeInformationBlock);
+ BiosVideoPrivate->VbeInformationBlock->VESASignature = VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE;
+ Regs.X.ES = EFI_SEGMENT ((UINTN)BiosVideoPrivate->VbeInformationBlock);
+ Regs.X.DI = EFI_OFFSET ((UINTN)BiosVideoPrivate->VbeInformationBlock);
BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
@@ -1367,12 +1391,14 @@ BiosVideoCheckForVbe (
if (Regs.X.AX != VESA_BIOS_EXTENSIONS_STATUS_SUCCESS) {
return Status;
}
+
//
// Check for 'VESA' signature
//
if (BiosVideoPrivate->VbeInformationBlock->VESASignature != VESA_BIOS_EXTENSIONS_VESA_SIGNATURE) {
return Status;
}
+
//
// Check to see if this is VBE 2.0 or higher
//
@@ -1388,10 +1414,10 @@ BiosVideoCheckForVbe (
// Find EDID Override protocol firstly, this protocol is installed by platform if needed.
//
Status = gBS->LocateProtocol (
- &gEfiEdidOverrideProtocolGuid,
- NULL,
- (VOID **) &EdidOverride
- );
+ &gEfiEdidOverrideProtocolGuid,
+ NULL,
+ (VOID **)&EdidOverride
+ );
if (!EFI_ERROR (Status)) {
//
// Allocate double size of VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE to avoid overflow
@@ -1407,11 +1433,12 @@ BiosVideoCheckForVbe (
BiosVideoPrivate->Handle,
&EdidAttributes,
&EdidOverrideDataSize,
- (UINT8 **) &EdidOverrideDataBlock
+ (UINT8 **)&EdidOverrideDataBlock
);
if (!EFI_ERROR (Status) &&
- EdidAttributes == 0 &&
- EdidOverrideDataSize != 0) {
+ (EdidAttributes == 0) &&
+ (EdidOverrideDataSize != 0))
+ {
//
// Succeeded to get EDID Override Data
//
@@ -1419,7 +1446,7 @@ BiosVideoCheckForVbe (
}
}
- if (!EdidOverrideFound || EdidAttributes == EFI_EDID_OVERRIDE_DONT_OVERRIDE) {
+ if (!EdidOverrideFound || (EdidAttributes == EFI_EDID_OVERRIDE_DONT_OVERRIDE)) {
//
// If EDID Override data doesn't exist or EFI_EDID_OVERRIDE_DONT_OVERRIDE returned,
// read EDID information through INT10 call
@@ -1430,8 +1457,8 @@ BiosVideoCheckForVbe (
Regs.X.BX = 1;
Regs.X.CX = 0;
Regs.X.DX = 0;
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeEdidDataBlock);
- Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeEdidDataBlock);
+ Regs.X.ES = EFI_SEGMENT ((UINTN)BiosVideoPrivate->VbeEdidDataBlock);
+ Regs.X.DI = EFI_OFFSET ((UINTN)BiosVideoPrivate->VbeEdidDataBlock);
BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
//
@@ -1442,13 +1469,13 @@ BiosVideoCheckForVbe (
// Set EDID Discovered Data
//
BiosVideoPrivate->EdidDiscovered.SizeOfEdid = VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE;
- BiosVideoPrivate->EdidDiscovered.Edid = (UINT8 *) AllocateCopyPool (
- VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE,
- BiosVideoPrivate->VbeEdidDataBlock
- );
+ BiosVideoPrivate->EdidDiscovered.Edid = (UINT8 *)AllocateCopyPool (
+ VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE,
+ BiosVideoPrivate->VbeEdidDataBlock
+ );
if (NULL == BiosVideoPrivate->EdidDiscovered.Edid) {
- Status = EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -1462,41 +1489,41 @@ BiosVideoCheckForVbe (
} else if (EdidOverrideFound) {
EdidActiveDataSize = EdidOverrideDataSize;
EdidActiveDataBlock = EdidOverrideDataBlock;
- EdidFound = TRUE;
- }
+ EdidFound = TRUE;
+ }
- if (EdidFound) {
+ if (EdidFound) {
//
// Parse EDID data structure to retrieve modes supported by monitor
//
- if (ParseEdidData ((UINT8 *) EdidActiveDataBlock, &ValidEdidTiming)) {
+ if (ParseEdidData ((UINT8 *)EdidActiveDataBlock, &ValidEdidTiming)) {
//
// Copy EDID Override Data to EDID Active Data
//
- BiosVideoPrivate->EdidActive.SizeOfEdid = (UINT32) EdidActiveDataSize;
- BiosVideoPrivate->EdidActive.Edid = (UINT8 *) AllocateCopyPool (
- EdidActiveDataSize,
- EdidActiveDataBlock
- );
+ BiosVideoPrivate->EdidActive.SizeOfEdid = (UINT32)EdidActiveDataSize;
+ BiosVideoPrivate->EdidActive.Edid = (UINT8 *)AllocateCopyPool (
+ EdidActiveDataSize,
+ EdidActiveDataBlock
+ );
if (NULL == BiosVideoPrivate->EdidActive.Edid) {
- Status = EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
}
} else {
BiosVideoPrivate->EdidActive.SizeOfEdid = 0;
- BiosVideoPrivate->EdidActive.Edid = NULL;
- EdidFound = FALSE;
+ BiosVideoPrivate->EdidActive.Edid = NULL;
+ EdidFound = FALSE;
}
//
// Walk through the mode list to see if there is at least one mode the is compatible with the EDID mode
//
ModeNumberPtr = (UINT16 *)
- (
- (((UINTN) BiosVideoPrivate->VbeInformationBlock->VideoModePtr & 0xffff0000) >> 12) |
- ((UINTN) BiosVideoPrivate->VbeInformationBlock->VideoModePtr & 0x0000ffff)
- );
+ (
+ (((UINTN)BiosVideoPrivate->VbeInformationBlock->VideoModePtr & 0xffff0000) >> 12) |
+ ((UINTN)BiosVideoPrivate->VbeInformationBlock->VideoModePtr & 0x0000ffff)
+ );
PreferMode = 0;
ModeNumber = 0;
@@ -1506,13 +1533,15 @@ BiosVideoCheckForVbe (
//
for (VbeModeNumber = ReadUnaligned16 (ModeNumberPtr);
VbeModeNumber != VESA_BIOS_EXTENSIONS_END_OF_MODE_LIST;
- VbeModeNumber = ReadUnaligned16 (++ModeNumberPtr)) {
+ VbeModeNumber = ReadUnaligned16 (++ModeNumberPtr))
+ {
//
// Make sure this is a mode number defined by the VESA VBE specification. If it isn'tm then skip this mode number.
//
if ((VbeModeNumber & VESA_BIOS_EXTENSIONS_MODE_NUMBER_VESA) == 0) {
continue;
}
+
//
// Get the information about the mode
//
@@ -1520,8 +1549,8 @@ BiosVideoCheckForVbe (
Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_MODE_INFORMATION;
Regs.X.CX = VbeModeNumber;
gBS->SetMem (BiosVideoPrivate->VbeModeInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK), 0);
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeModeInformationBlock);
- Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeModeInformationBlock);
+ Regs.X.ES = EFI_SEGMENT ((UINTN)BiosVideoPrivate->VbeModeInformationBlock);
+ Regs.X.DI = EFI_OFFSET ((UINTN)BiosVideoPrivate->VbeModeInformationBlock);
BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
@@ -1531,24 +1560,28 @@ BiosVideoCheckForVbe (
if (Regs.X.AX != VESA_BIOS_EXTENSIONS_STATUS_SUCCESS) {
continue;
}
+
//
// See if the mode supports color. If it doesn't then try the next mode.
//
if ((BiosVideoPrivate->VbeModeInformationBlock->ModeAttributes & VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_COLOR) == 0) {
continue;
}
+
//
// See if the mode supports graphics. If it doesn't then try the next mode.
//
if ((BiosVideoPrivate->VbeModeInformationBlock->ModeAttributes & VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_GRAPHICS) == 0) {
continue;
}
+
//
// See if the mode supports a linear frame buffer. If it doesn't then try the next mode.
//
if ((BiosVideoPrivate->VbeModeInformationBlock->ModeAttributes & VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER) == 0) {
continue;
}
+
//
// See if the mode supports 32 bit color. If it doesn't then try the next mode.
// 32 bit mode can be implemented by 24 Bits Per Pixels. Also make sure the
@@ -1565,6 +1598,7 @@ BiosVideoCheckForVbe (
if ((BiosVideoPrivate->VbeModeInformationBlock->BitsPerPixel % 8) != 0) {
continue;
}
+
//
// See if the physical base pointer for the linear mode is valid. If it isn't then try the next mode.
//
@@ -1572,25 +1606,31 @@ BiosVideoCheckForVbe (
continue;
}
- DEBUG ((DEBUG_INFO, "Video Controller Mode 0x%x: %d x %d\n",
- VbeModeNumber, BiosVideoPrivate->VbeModeInformationBlock->XResolution, BiosVideoPrivate->VbeModeInformationBlock->YResolution));
+ DEBUG ((
+ DEBUG_INFO,
+ "Video Controller Mode 0x%x: %d x %d\n",
+ VbeModeNumber,
+ BiosVideoPrivate->VbeModeInformationBlock->XResolution,
+ BiosVideoPrivate->VbeModeInformationBlock->YResolution
+ ));
if (EdidFound && (ValidEdidTiming.ValidNumber > 0)) {
//
// EDID exist, check whether this mode match with any mode in EDID
//
Timing.HorizontalResolution = BiosVideoPrivate->VbeModeInformationBlock->XResolution;
- Timing.VerticalResolution = BiosVideoPrivate->VbeModeInformationBlock->YResolution;
+ Timing.VerticalResolution = BiosVideoPrivate->VbeModeInformationBlock->YResolution;
if (!SearchEdidTiming (&ValidEdidTiming, &Timing)) {
//
// When EDID comes from INT10 call, EDID does not include 800x600, 640x480 and 1024x768,
// but INT10 can support these modes, we add them into GOP mode.
//
if ((BiosVideoPrivate->EdidDiscovered.SizeOfEdid != 0) &&
- !((Timing.HorizontalResolution) == 1024 && (Timing.VerticalResolution == 768)) &&
- !((Timing.HorizontalResolution) == 800 && (Timing.VerticalResolution == 600)) &&
- !((Timing.HorizontalResolution) == 640 && (Timing.VerticalResolution == 480))) {
- continue;
+ !(((Timing.HorizontalResolution) == 1024) && (Timing.VerticalResolution == 768)) &&
+ !(((Timing.HorizontalResolution) == 800) && (Timing.VerticalResolution == 600)) &&
+ !(((Timing.HorizontalResolution) == 640) && (Timing.VerticalResolution == 480)))
+ {
+ continue;
}
}
}
@@ -1600,20 +1640,25 @@ BiosVideoCheckForVbe (
//
ModeFound = FALSE;
- if (BiosVideoPrivate->VbeModeInformationBlock->XResolution == 1024 &&
- BiosVideoPrivate->VbeModeInformationBlock->YResolution == 768
- ) {
+ if ((BiosVideoPrivate->VbeModeInformationBlock->XResolution == 1024) &&
+ (BiosVideoPrivate->VbeModeInformationBlock->YResolution == 768)
+ )
+ {
ModeFound = TRUE;
}
- if (BiosVideoPrivate->VbeModeInformationBlock->XResolution == 800 &&
- BiosVideoPrivate->VbeModeInformationBlock->YResolution == 600
- ) {
- ModeFound = TRUE;
+
+ if ((BiosVideoPrivate->VbeModeInformationBlock->XResolution == 800) &&
+ (BiosVideoPrivate->VbeModeInformationBlock->YResolution == 600)
+ )
+ {
+ ModeFound = TRUE;
PreferMode = ModeNumber;
}
- if (BiosVideoPrivate->VbeModeInformationBlock->XResolution == 640 &&
- BiosVideoPrivate->VbeModeInformationBlock->YResolution == 480
- ) {
+
+ if ((BiosVideoPrivate->VbeModeInformationBlock->XResolution == 640) &&
+ (BiosVideoPrivate->VbeModeInformationBlock->YResolution == 480)
+ )
+ {
ModeFound = TRUE;
}
@@ -1629,19 +1674,20 @@ BiosVideoCheckForVbe (
//
if ((BiosVideoPrivate->VbeModeInformationBlock->XResolution > HighestHorizontalResolution) ||
((BiosVideoPrivate->VbeModeInformationBlock->XResolution == HighestHorizontalResolution) &&
- (BiosVideoPrivate->VbeModeInformationBlock->YResolution > HighestVerticalResolution))) {
+ (BiosVideoPrivate->VbeModeInformationBlock->YResolution > HighestVerticalResolution)))
+ {
HighestHorizontalResolution = BiosVideoPrivate->VbeModeInformationBlock->XResolution;
- HighestVerticalResolution = BiosVideoPrivate->VbeModeInformationBlock->YResolution;
- HighestResolutionMode = ModeNumber;
+ HighestVerticalResolution = BiosVideoPrivate->VbeModeInformationBlock->YResolution;
+ HighestResolutionMode = ModeNumber;
}
//
// Add mode to the list of available modes
//
- ModeNumber ++;
- ModeBuffer = (BIOS_VIDEO_MODE_DATA *) AllocatePool (
- ModeNumber * sizeof (BIOS_VIDEO_MODE_DATA)
- );
+ ModeNumber++;
+ ModeBuffer = (BIOS_VIDEO_MODE_DATA *)AllocatePool (
+ ModeNumber * sizeof (BIOS_VIDEO_MODE_DATA)
+ );
if (NULL == ModeBuffer) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
@@ -1659,33 +1705,34 @@ BiosVideoCheckForVbe (
FreePool (BiosVideoPrivate->ModeData);
}
- CurrentModeData = &ModeBuffer[ModeNumber - 1];
+ CurrentModeData = &ModeBuffer[ModeNumber - 1];
CurrentModeData->VbeModeNumber = VbeModeNumber;
if (BiosVideoPrivate->VbeInformationBlock->VESAVersion >= VESA_BIOS_EXTENSIONS_VERSION_3_0) {
- CurrentModeData->BytesPerScanLine = BiosVideoPrivate->VbeModeInformationBlock->LinBytesPerScanLine;
- CurrentModeData->Red.Position = BiosVideoPrivate->VbeModeInformationBlock->LinRedFieldPosition;
- CurrentModeData->Red.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->LinRedMaskSize) - 1);
- CurrentModeData->Blue.Position = BiosVideoPrivate->VbeModeInformationBlock->LinBlueFieldPosition;
- CurrentModeData->Blue.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->LinBlueMaskSize) - 1);
- CurrentModeData->Green.Position = BiosVideoPrivate->VbeModeInformationBlock->LinGreenFieldPosition;
- CurrentModeData->Green.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->LinGreenMaskSize) - 1);
+ CurrentModeData->BytesPerScanLine = BiosVideoPrivate->VbeModeInformationBlock->LinBytesPerScanLine;
+ CurrentModeData->Red.Position = BiosVideoPrivate->VbeModeInformationBlock->LinRedFieldPosition;
+ CurrentModeData->Red.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->LinRedMaskSize) - 1);
+ CurrentModeData->Blue.Position = BiosVideoPrivate->VbeModeInformationBlock->LinBlueFieldPosition;
+ CurrentModeData->Blue.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->LinBlueMaskSize) - 1);
+ CurrentModeData->Green.Position = BiosVideoPrivate->VbeModeInformationBlock->LinGreenFieldPosition;
+ CurrentModeData->Green.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->LinGreenMaskSize) - 1);
CurrentModeData->Reserved.Position = BiosVideoPrivate->VbeModeInformationBlock->LinRsvdFieldPosition;
- CurrentModeData->Reserved.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->LinRsvdMaskSize) - 1);
+ CurrentModeData->Reserved.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->LinRsvdMaskSize) - 1);
} else {
- CurrentModeData->BytesPerScanLine = BiosVideoPrivate->VbeModeInformationBlock->BytesPerScanLine;
- CurrentModeData->Red.Position = BiosVideoPrivate->VbeModeInformationBlock->RedFieldPosition;
- CurrentModeData->Red.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->RedMaskSize) - 1);
- CurrentModeData->Blue.Position = BiosVideoPrivate->VbeModeInformationBlock->BlueFieldPosition;
- CurrentModeData->Blue.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->BlueMaskSize) - 1);
- CurrentModeData->Green.Position = BiosVideoPrivate->VbeModeInformationBlock->GreenFieldPosition;
- CurrentModeData->Green.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->GreenMaskSize) - 1);
+ CurrentModeData->BytesPerScanLine = BiosVideoPrivate->VbeModeInformationBlock->BytesPerScanLine;
+ CurrentModeData->Red.Position = BiosVideoPrivate->VbeModeInformationBlock->RedFieldPosition;
+ CurrentModeData->Red.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->RedMaskSize) - 1);
+ CurrentModeData->Blue.Position = BiosVideoPrivate->VbeModeInformationBlock->BlueFieldPosition;
+ CurrentModeData->Blue.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->BlueMaskSize) - 1);
+ CurrentModeData->Green.Position = BiosVideoPrivate->VbeModeInformationBlock->GreenFieldPosition;
+ CurrentModeData->Green.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->GreenMaskSize) - 1);
CurrentModeData->Reserved.Position = BiosVideoPrivate->VbeModeInformationBlock->RsvdFieldPosition;
- CurrentModeData->Reserved.Mask = (UINT8) ((1 << BiosVideoPrivate->VbeModeInformationBlock->RsvdMaskSize) - 1);
+ CurrentModeData->Reserved.Mask = (UINT8)((1 << BiosVideoPrivate->VbeModeInformationBlock->RsvdMaskSize) - 1);
}
CurrentModeData->PixelFormat = PixelBitMask;
if ((BiosVideoPrivate->VbeModeInformationBlock->BitsPerPixel == 32) &&
- (CurrentModeData->Red.Mask == 0xff) && (CurrentModeData->Green.Mask == 0xff) && (CurrentModeData->Blue.Mask == 0xff)) {
+ (CurrentModeData->Red.Mask == 0xff) && (CurrentModeData->Green.Mask == 0xff) && (CurrentModeData->Blue.Mask == 0xff))
+ {
if ((CurrentModeData->Red.Position == 0) && (CurrentModeData->Green.Position == 8) && (CurrentModeData->Blue.Position == 16)) {
CurrentModeData->PixelFormat = PixelRedGreenBlueReserved8BitPerColor;
} else if ((CurrentModeData->Blue.Position == 0) && (CurrentModeData->Green.Position == 8) && (CurrentModeData->Red.Position == 16)) {
@@ -1693,16 +1740,16 @@ BiosVideoCheckForVbe (
}
}
- CurrentModeData->PixelBitMask.RedMask = ((UINT32) CurrentModeData->Red.Mask) << CurrentModeData->Red.Position;
- CurrentModeData->PixelBitMask.GreenMask = ((UINT32) CurrentModeData->Green.Mask) << CurrentModeData->Green.Position;
- CurrentModeData->PixelBitMask.BlueMask = ((UINT32) CurrentModeData->Blue.Mask) << CurrentModeData->Blue.Position;
- CurrentModeData->PixelBitMask.ReservedMask = ((UINT32) CurrentModeData->Reserved.Mask) << CurrentModeData->Reserved.Position;
+ CurrentModeData->PixelBitMask.RedMask = ((UINT32)CurrentModeData->Red.Mask) << CurrentModeData->Red.Position;
+ CurrentModeData->PixelBitMask.GreenMask = ((UINT32)CurrentModeData->Green.Mask) << CurrentModeData->Green.Position;
+ CurrentModeData->PixelBitMask.BlueMask = ((UINT32)CurrentModeData->Blue.Mask) << CurrentModeData->Blue.Position;
+ CurrentModeData->PixelBitMask.ReservedMask = ((UINT32)CurrentModeData->Reserved.Mask) << CurrentModeData->Reserved.Position;
- CurrentModeData->LinearFrameBuffer = (VOID *) (UINTN)BiosVideoPrivate->VbeModeInformationBlock->PhysBasePtr;
+ CurrentModeData->LinearFrameBuffer = (VOID *)(UINTN)BiosVideoPrivate->VbeModeInformationBlock->PhysBasePtr;
CurrentModeData->HorizontalResolution = BiosVideoPrivate->VbeModeInformationBlock->XResolution;
- CurrentModeData->VerticalResolution = BiosVideoPrivate->VbeModeInformationBlock->YResolution;
+ CurrentModeData->VerticalResolution = BiosVideoPrivate->VbeModeInformationBlock->YResolution;
- CurrentModeData->BitsPerPixel = BiosVideoPrivate->VbeModeInformationBlock->BitsPerPixel;
+ CurrentModeData->BitsPerPixel = BiosVideoPrivate->VbeModeInformationBlock->BitsPerPixel;
CurrentModeData->FrameBufferSize = CurrentModeData->BytesPerScanLine * CurrentModeData->VerticalResolution;
//
// Make sure the FrameBufferSize does not exceed the max available frame buffer size reported by VEB.
@@ -1711,6 +1758,7 @@ BiosVideoCheckForVbe (
BiosVideoPrivate->ModeData = ModeBuffer;
}
+
//
// Check to see if we found any modes that are compatible with GRAPHICS OUTPUT
//
@@ -1722,9 +1770,9 @@ BiosVideoCheckForVbe (
//
// Assign Gop's Blt function
//
- BiosVideoPrivate->GraphicsOutput.Blt = BiosVideoGraphicsOutputVbeBlt;
+ BiosVideoPrivate->GraphicsOutput.Blt = BiosVideoGraphicsOutputVbeBlt;
- BiosVideoPrivate->GraphicsOutput.Mode->MaxMode = (UINT32) ModeNumber;
+ BiosVideoPrivate->GraphicsOutput.Mode->MaxMode = (UINT32)ModeNumber;
//
// Current mode is unknow till now, set it to an invalid mode.
//
@@ -1737,22 +1785,28 @@ BiosVideoCheckForVbe (
DEBUG_CODE (
BIOS_VIDEO_MODE_DATA *ModeData;
ModeData = &BiosVideoPrivate->ModeData[HighestResolutionMode];
- DEBUG ((DEBUG_INFO, "BiosVideo set highest resolution %d x %d\n",
- ModeData->HorizontalResolution, ModeData->VerticalResolution));
- );
+ DEBUG ((
+ DEBUG_INFO,
+ "BiosVideo set highest resolution %d x %d\n",
+ ModeData->HorizontalResolution,
+ ModeData->VerticalResolution
+ ));
+ );
PreferMode = HighestResolutionMode;
}
- Status = BiosVideoGraphicsOutputSetMode (&BiosVideoPrivate->GraphicsOutput, (UINT32) PreferMode);
+
+ Status = BiosVideoGraphicsOutputSetMode (&BiosVideoPrivate->GraphicsOutput, (UINT32)PreferMode);
if (EFI_ERROR (Status)) {
- for (PreferMode = 0; PreferMode < ModeNumber; PreferMode ++) {
+ for (PreferMode = 0; PreferMode < ModeNumber; PreferMode++) {
Status = BiosVideoGraphicsOutputSetMode (
- &BiosVideoPrivate->GraphicsOutput,
- (UINT32) PreferMode
- );
+ &BiosVideoPrivate->GraphicsOutput,
+ (UINT32)PreferMode
+ );
if (!EFI_ERROR (Status)) {
break;
}
}
+
if (PreferMode == ModeNumber) {
//
// None mode is set successfully.
@@ -1768,9 +1822,10 @@ Done:
if (EFI_ERROR (Status)) {
if (BiosVideoPrivate->ModeData != NULL) {
FreePool (BiosVideoPrivate->ModeData);
- BiosVideoPrivate->ModeData = NULL;
- BiosVideoPrivate->MaxMode = 0;
+ BiosVideoPrivate->ModeData = NULL;
+ BiosVideoPrivate->MaxMode = 0;
}
+
if (EdidOverrideDataBlock != NULL) {
FreePool (EdidOverrideDataBlock);
}
@@ -1779,7 +1834,6 @@ Done:
return Status;
}
-
/**
Check for VGA device.
@@ -1801,7 +1855,7 @@ BiosVideoCheckForVga (
//
// Assign Gop's Blt function
//
- BiosVideoPrivate->GraphicsOutput.Blt = BiosVideoGraphicsOutputVgaBlt;
+ BiosVideoPrivate->GraphicsOutput.Blt = BiosVideoGraphicsOutputVgaBlt;
//
// Add mode to the list of available modes
@@ -1810,23 +1864,23 @@ BiosVideoCheckForVga (
ASSERT (BiosVideoPrivate->GraphicsOutput.Mode != NULL);
BiosVideoPrivate->GraphicsOutput.Mode->MaxMode = 1;
- ModeBuffer = (BIOS_VIDEO_MODE_DATA *) AllocatePool (
- sizeof (BIOS_VIDEO_MODE_DATA)
- );
+ ModeBuffer = (BIOS_VIDEO_MODE_DATA *)AllocatePool (
+ sizeof (BIOS_VIDEO_MODE_DATA)
+ );
if (NULL == ModeBuffer) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
- ModeBuffer->VbeModeNumber = 0x0012;
- ModeBuffer->BytesPerScanLine = 640;
- ModeBuffer->LinearFrameBuffer = (VOID *) (UINTN) (0xa0000);
- ModeBuffer->HorizontalResolution = 640;
- ModeBuffer->VerticalResolution = 480;
- ModeBuffer->PixelFormat = PixelBltOnly;
- ModeBuffer->BitsPerPixel = 8;
- ModeBuffer->ColorDepth = 32;
- ModeBuffer->RefreshRate = 60;
+ ModeBuffer->VbeModeNumber = 0x0012;
+ ModeBuffer->BytesPerScanLine = 640;
+ ModeBuffer->LinearFrameBuffer = (VOID *)(UINTN)(0xa0000);
+ ModeBuffer->HorizontalResolution = 640;
+ ModeBuffer->VerticalResolution = 480;
+ ModeBuffer->PixelFormat = PixelBltOnly;
+ ModeBuffer->BitsPerPixel = 8;
+ ModeBuffer->ColorDepth = 32;
+ ModeBuffer->RefreshRate = 60;
BiosVideoPrivate->ModeData = ModeBuffer;
@@ -1834,7 +1888,7 @@ BiosVideoCheckForVga (
// Test to see if the Video Adapter support the 640x480 16 color mode
//
BiosVideoPrivate->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
- Status = BiosVideoGraphicsOutputSetMode (&BiosVideoPrivate->GraphicsOutput, 0);
+ Status = BiosVideoGraphicsOutputSetMode (&BiosVideoPrivate->GraphicsOutput, 0);
Done:
//
@@ -1845,15 +1899,18 @@ Done:
FreePool (BiosVideoPrivate->ModeData);
BiosVideoPrivate->ModeData = NULL;
}
+
if (BiosVideoPrivate->GraphicsOutput.Mode != NULL) {
if (BiosVideoPrivate->GraphicsOutput.Mode->Info != NULL) {
FreePool (BiosVideoPrivate->GraphicsOutput.Mode->Info);
BiosVideoPrivate->GraphicsOutput.Mode->Info = NULL;
}
+
FreePool (BiosVideoPrivate->GraphicsOutput.Mode);
BiosVideoPrivate->GraphicsOutput.Mode = NULL;
}
}
+
return Status;
}
@@ -1901,11 +1958,11 @@ BiosVideoGraphicsOutputQueryMode (
return EFI_NOT_STARTED;
}
- if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
+ if ((This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode)) {
return EFI_INVALID_PARAMETER;
}
- *Info = (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) AllocatePool (
+ *Info = (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *)AllocatePool (
sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)
);
if (NULL == *Info) {
@@ -1914,12 +1971,12 @@ BiosVideoGraphicsOutputQueryMode (
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- ModeData = &BiosVideoPrivate->ModeData[ModeNumber];
- (*Info)->Version = 0;
+ ModeData = &BiosVideoPrivate->ModeData[ModeNumber];
+ (*Info)->Version = 0;
(*Info)->HorizontalResolution = ModeData->HorizontalResolution;
(*Info)->VerticalResolution = ModeData->VerticalResolution;
- (*Info)->PixelFormat = ModeData->PixelFormat;
- CopyMem (&((*Info)->PixelInformation), &(ModeData->PixelBitMask), sizeof(ModeData->PixelBitMask));
+ (*Info)->PixelFormat = ModeData->PixelFormat;
+ CopyMem (&((*Info)->PixelInformation), &(ModeData->PixelBitMask), sizeof (ModeData->PixelBitMask));
(*Info)->PixelsPerScanLine = (ModeData->BytesPerScanLine * 8) / ModeData->BitsPerPixel;
@@ -1941,13 +1998,13 @@ BiosVideoGraphicsOutputQueryMode (
**/
EFI_STATUS
BiosVideoSetModeWorker (
- IN BIOS_VIDEO_DEV *BiosVideoPrivate,
- IN BIOS_VIDEO_MODE_DATA *ModeData,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ IN BIOS_VIDEO_DEV *BiosVideoPrivate,
+ IN BIOS_VIDEO_MODE_DATA *ModeData,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- EFI_STATUS Status;
- EFI_IA32_REGISTER_SET Regs;
+ EFI_STATUS Status;
+ EFI_IA32_REGISTER_SET Regs;
if (BiosVideoPrivate->LineBuffer != NULL) {
FreePool (BiosVideoPrivate->LineBuffer);
@@ -1961,12 +2018,13 @@ BiosVideoSetModeWorker (
FreePool (BiosVideoPrivate->VbeFrameBuffer);
}
- BiosVideoPrivate->LineBuffer = (UINT8 *) AllocatePool (
- ModeData->BytesPerScanLine
- );
+ BiosVideoPrivate->LineBuffer = (UINT8 *)AllocatePool (
+ ModeData->BytesPerScanLine
+ );
if (NULL == BiosVideoPrivate->LineBuffer) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// Clear all registers
//
@@ -1976,35 +2034,36 @@ BiosVideoSetModeWorker (
//
// Allocate a working buffer for BLT operations to the VGA frame buffer
//
- BiosVideoPrivate->VgaFrameBuffer = (UINT8 *) AllocatePool (4 * 480 * 80);
+ BiosVideoPrivate->VgaFrameBuffer = (UINT8 *)AllocatePool (4 * 480 * 80);
if (NULL == BiosVideoPrivate->VgaFrameBuffer) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// Set VGA Mode
//
Regs.X.AX = ModeData->VbeModeNumber;
BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
-
} else {
//
// Allocate a working buffer for BLT operations to the VBE frame buffer
//
BiosVideoPrivate->VbeFrameBuffer =
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) AllocatePool (
- ModeData->BytesPerScanLine * ModeData->VerticalResolution
- );
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)AllocatePool (
+ ModeData->BytesPerScanLine * ModeData->VerticalResolution
+ );
if (NULL == BiosVideoPrivate->VbeFrameBuffer) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// Set VBE mode
//
Regs.X.AX = VESA_BIOS_EXTENSIONS_SET_MODE;
- Regs.X.BX = (UINT16) (ModeData->VbeModeNumber | VESA_BIOS_EXTENSIONS_MODE_NUMBER_LINEAR_FRAME_BUFFER);
+ Regs.X.BX = (UINT16)(ModeData->VbeModeNumber | VESA_BIOS_EXTENSIONS_MODE_NUMBER_LINEAR_FRAME_BUFFER);
ZeroMem (BiosVideoPrivate->VbeCrtcInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK));
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock);
- Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock);
+ Regs.X.ES = EFI_SEGMENT ((UINTN)BiosVideoPrivate->VbeCrtcInformationBlock);
+ Regs.X.DI = EFI_OFFSET ((UINTN)BiosVideoPrivate->VbeCrtcInformationBlock);
BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
//
@@ -2018,6 +2077,7 @@ BiosVideoSetModeWorker (
);
return EFI_DEVICE_ERROR;
}
+
//
// Initialize the state of the VbeFrameBuffer
//
@@ -2025,7 +2085,7 @@ BiosVideoSetModeWorker (
BiosVideoPrivate->PciIo,
EfiPciIoWidthUint32,
EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) ModeData->LinearFrameBuffer,
+ (UINT64)(UINTN)ModeData->LinearFrameBuffer,
(ModeData->BytesPerScanLine * ModeData->VerticalResolution) >> 2,
BiosVideoPrivate->VbeFrameBuffer
);
@@ -2052,14 +2112,14 @@ BiosVideoSetModeWorker (
EFI_STATUS
EFIAPI
BiosVideoGraphicsOutputSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
- IN UINT32 ModeNumber
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN UINT32 ModeNumber
)
{
- EFI_STATUS Status;
- BIOS_VIDEO_DEV *BiosVideoPrivate;
- BIOS_VIDEO_MODE_DATA *ModeData;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
+ EFI_STATUS Status;
+ BIOS_VIDEO_DEV *BiosVideoPrivate;
+ BIOS_VIDEO_MODE_DATA *ModeData;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -2079,17 +2139,17 @@ BiosVideoGraphicsOutputSetMode (
//
ZeroMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
BiosVideoGraphicsOutputVbeBlt (
- This,
- &Background,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->HorizontalResolution,
- ModeData->VerticalResolution,
- 0
- );
+ This,
+ &Background,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ ModeData->HorizontalResolution,
+ ModeData->VerticalResolution,
+ 0
+ );
return EFI_SUCCESS;
}
@@ -2098,16 +2158,16 @@ BiosVideoGraphicsOutputSetMode (
return Status;
}
- This->Mode->Mode = ModeNumber;
- This->Mode->Info->Version = 0;
+ This->Mode->Mode = ModeNumber;
+ This->Mode->Info->Version = 0;
This->Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;
- This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;
- This->Mode->Info->PixelFormat = ModeData->PixelFormat;
+ This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;
+ This->Mode->Info->PixelFormat = ModeData->PixelFormat;
CopyMem (&(This->Mode->Info->PixelInformation), &(ModeData->PixelBitMask), sizeof (ModeData->PixelBitMask));
This->Mode->Info->PixelsPerScanLine = (ModeData->BytesPerScanLine * 8) / ModeData->BitsPerPixel;
- This->Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- This->Mode->FrameBufferSize = ModeData->FrameBufferSize;
- This->Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) ModeData->LinearFrameBuffer;
+ This->Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+ This->Mode->FrameBufferSize = ModeData->FrameBufferSize;
+ This->Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS)(UINTN)ModeData->LinearFrameBuffer;
BiosVideoPrivate->HardwareNeedsStarting = FALSE;
@@ -2129,36 +2189,36 @@ BiosVideoGraphicsOutputSetMode (
**/
VOID
CopyVideoBuffer (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT8 *VbeBuffer,
- IN VOID *MemAddress,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN TotalBytes,
- IN UINT32 VbePixelWidth,
- IN UINTN BytesPerScanLine
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT8 *VbeBuffer,
+ IN VOID *MemAddress,
+ IN UINTN DestinationX,
+ IN UINTN DestinationY,
+ IN UINTN TotalBytes,
+ IN UINT32 VbePixelWidth,
+ IN UINTN BytesPerScanLine
)
{
- UINTN FrameBufferAddr;
- UINTN CopyBlockNum;
- UINTN RemainingBytes;
- UINTN UnalignedBytes;
- EFI_STATUS Status;
+ UINTN FrameBufferAddr;
+ UINTN CopyBlockNum;
+ UINTN RemainingBytes;
+ UINTN UnalignedBytes;
+ EFI_STATUS Status;
- FrameBufferAddr = (UINTN) MemAddress + (DestinationY * BytesPerScanLine) + DestinationX * VbePixelWidth;
+ FrameBufferAddr = (UINTN)MemAddress + (DestinationY * BytesPerScanLine) + DestinationX * VbePixelWidth;
//
// If TotalBytes is less than 4 bytes, only start byte copy.
//
if (TotalBytes < 4) {
Status = PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) FrameBufferAddr,
- TotalBytes,
- VbeBuffer
- );
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)FrameBufferAddr,
+ TotalBytes,
+ VbeBuffer
+ );
ASSERT_EFI_ERROR (Status);
return;
}
@@ -2166,17 +2226,17 @@ CopyVideoBuffer (
//
// If VbeBuffer is not 4-byte aligned, start byte copy.
//
- UnalignedBytes = (4 - ((UINTN) VbeBuffer & 0x3)) & 0x3;
+ UnalignedBytes = (4 - ((UINTN)VbeBuffer & 0x3)) & 0x3;
if (UnalignedBytes != 0) {
Status = PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) FrameBufferAddr,
- UnalignedBytes,
- VbeBuffer
- );
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)FrameBufferAddr,
+ UnalignedBytes,
+ VbeBuffer
+ );
ASSERT_EFI_ERROR (Status);
FrameBufferAddr += UnalignedBytes;
VbeBuffer += UnalignedBytes;
@@ -2193,27 +2253,27 @@ CopyVideoBuffer (
//
if (CopyBlockNum != 0) {
Status = PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthUint32,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) FrameBufferAddr,
- CopyBlockNum,
- VbeBuffer
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)FrameBufferAddr,
+ CopyBlockNum,
+ VbeBuffer
+ );
ASSERT_EFI_ERROR (Status);
}
if (RemainingBytes != 0) {
FrameBufferAddr += (CopyBlockNum << 2);
VbeBuffer += (CopyBlockNum << 2);
- Status = PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) FrameBufferAddr,
- RemainingBytes,
- VbeBuffer
- );
+ Status = PciIo->Mem.Write (
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)FrameBufferAddr,
+ RemainingBytes,
+ VbeBuffer
+ );
ASSERT_EFI_ERROR (Status);
}
}
@@ -2278,22 +2338,23 @@ BiosVideoVbeBltWorker (
UINT32 Pixel;
UINTN TotalBytes;
- PciIo = BiosVideoPrivate->PciIo;
+ PciIo = BiosVideoPrivate->PciIo;
- VbeFrameBuffer = BiosVideoPrivate->VbeFrameBuffer;
- MemAddress = Mode->LinearFrameBuffer;
- BytesPerScanLine = Mode->BytesPerScanLine;
- VbePixelWidth = Mode->BitsPerPixel / 8;
- BltUint8 = (UINT8 *) BltBuffer;
- TotalBytes = Width * VbePixelWidth;
+ VbeFrameBuffer = BiosVideoPrivate->VbeFrameBuffer;
+ MemAddress = Mode->LinearFrameBuffer;
+ BytesPerScanLine = Mode->BytesPerScanLine;
+ VbePixelWidth = Mode->BitsPerPixel / 8;
+ BltUint8 = (UINT8 *)BltBuffer;
+ TotalBytes = Width * VbePixelWidth;
- if (((UINTN) BltOperation) >= EfiGraphicsOutputBltOperationMax) {
+ if (((UINTN)BltOperation) >= EfiGraphicsOutputBltOperationMax) {
return EFI_INVALID_PARAMETER;
}
- if (Width == 0 || Height == 0) {
+ if ((Width == 0) || (Height == 0)) {
return EFI_INVALID_PARAMETER;
}
+
//
// We need to fill the Virtual Screen buffer with the blt data.
// The virtual screen is upside down, as the first row is the bootom row of
@@ -2322,6 +2383,7 @@ BiosVideoVbeBltWorker (
return EFI_INVALID_PARAMETER;
}
}
+
//
// If Delta is zero, then the entire BltBuffer is being used, so Delta
// is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
@@ -2330,6 +2392,7 @@ BiosVideoVbeBltWorker (
if (Delta == 0) {
Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
}
+
//
// We have to raise to TPL Notify, so we make an atomic write the frame buffer.
// We would not want a timer based event (Cursor, ...) to come in while we are
@@ -2338,148 +2401,151 @@ BiosVideoVbeBltWorker (
OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
switch (BltOperation) {
- case EfiBltVideoToBltBuffer:
- for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
- Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) (BltUint8 + DstY * Delta + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- //
- // Shuffle the packed bytes in the hardware buffer to match EFI_GRAPHICS_OUTPUT_BLT_PIXEL
- //
- VbeBuffer = ((UINT8 *) VbeFrameBuffer + (SrcY * BytesPerScanLine + SourceX * VbePixelWidth));
- for (DstX = DestinationX; DstX < (Width + DestinationX); DstX++) {
- Pixel = VbeBuffer[0] | VbeBuffer[1] << 8 | VbeBuffer[2] << 16 | VbeBuffer[3] << 24;
- Blt->Red = (UINT8) ((Pixel >> Mode->Red.Position) & Mode->Red.Mask);
- Blt->Blue = (UINT8) ((Pixel >> Mode->Blue.Position) & Mode->Blue.Mask);
- Blt->Green = (UINT8) ((Pixel >> Mode->Green.Position) & Mode->Green.Mask);
- Blt->Reserved = 0;
- Blt++;
- VbeBuffer += VbePixelWidth;
+ case EfiBltVideoToBltBuffer:
+ for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
+ Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)(BltUint8 + DstY * Delta + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ //
+ // Shuffle the packed bytes in the hardware buffer to match EFI_GRAPHICS_OUTPUT_BLT_PIXEL
+ //
+ VbeBuffer = ((UINT8 *)VbeFrameBuffer + (SrcY * BytesPerScanLine + SourceX * VbePixelWidth));
+ for (DstX = DestinationX; DstX < (Width + DestinationX); DstX++) {
+ Pixel = VbeBuffer[0] | VbeBuffer[1] << 8 | VbeBuffer[2] << 16 | VbeBuffer[3] << 24;
+ Blt->Red = (UINT8)((Pixel >> Mode->Red.Position) & Mode->Red.Mask);
+ Blt->Blue = (UINT8)((Pixel >> Mode->Blue.Position) & Mode->Blue.Mask);
+ Blt->Green = (UINT8)((Pixel >> Mode->Green.Position) & Mode->Green.Mask);
+ Blt->Reserved = 0;
+ Blt++;
+ VbeBuffer += VbePixelWidth;
+ }
}
- }
- break;
+ break;
- case EfiBltVideoToVideo:
- for (Index = 0; Index < Height; Index++) {
- if (DestinationY <= SourceY) {
- SrcY = SourceY + Index;
- DstY = DestinationY + Index;
- } else {
- SrcY = SourceY + Height - Index - 1;
- DstY = DestinationY + Height - Index - 1;
- }
+ case EfiBltVideoToVideo:
+ for (Index = 0; Index < Height; Index++) {
+ if (DestinationY <= SourceY) {
+ SrcY = SourceY + Index;
+ DstY = DestinationY + Index;
+ } else {
+ SrcY = SourceY + Height - Index - 1;
+ DstY = DestinationY + Height - Index - 1;
+ }
- VbeBuffer = ((UINT8 *) VbeFrameBuffer + DstY * BytesPerScanLine + DestinationX * VbePixelWidth);
- VbeBuffer1 = ((UINT8 *) VbeFrameBuffer + SrcY * BytesPerScanLine + SourceX * VbePixelWidth);
+ VbeBuffer = ((UINT8 *)VbeFrameBuffer + DstY * BytesPerScanLine + DestinationX * VbePixelWidth);
+ VbeBuffer1 = ((UINT8 *)VbeFrameBuffer + SrcY * BytesPerScanLine + SourceX * VbePixelWidth);
- gBS->CopyMem (
- VbeBuffer,
- VbeBuffer1,
- TotalBytes
- );
+ gBS->CopyMem (
+ VbeBuffer,
+ VbeBuffer1,
+ TotalBytes
+ );
+
+ //
+ // Update physical frame buffer.
+ //
+ CopyVideoBuffer (
+ PciIo,
+ VbeBuffer,
+ MemAddress,
+ DestinationX,
+ DstY,
+ TotalBytes,
+ VbePixelWidth,
+ BytesPerScanLine
+ );
+ }
+
+ break;
+ case EfiBltVideoFill:
+ VbeBuffer = (UINT8 *)((UINTN)VbeFrameBuffer + (DestinationY * BytesPerScanLine) + DestinationX * VbePixelWidth);
+ Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)BltUint8;
//
- // Update physical frame buffer.
+ // Shuffle the RGB fields in EFI_GRAPHICS_OUTPUT_BLT_PIXEL to match the hardware buffer
//
- CopyVideoBuffer (
- PciIo,
- VbeBuffer,
- MemAddress,
- DestinationX,
- DstY,
- TotalBytes,
- VbePixelWidth,
- BytesPerScanLine
- );
- }
- break;
+ Pixel = ((Blt->Red & Mode->Red.Mask) << Mode->Red.Position) |
+ (
+ (Blt->Green & Mode->Green.Mask) <<
+ Mode->Green.Position
+ ) |
+ ((Blt->Blue & Mode->Blue.Mask) << Mode->Blue.Position);
+
+ for (Index = 0; Index < Width; Index++) {
+ gBS->CopyMem (
+ VbeBuffer,
+ &Pixel,
+ VbePixelWidth
+ );
+ VbeBuffer += VbePixelWidth;
+ }
- case EfiBltVideoFill:
- VbeBuffer = (UINT8 *) ((UINTN) VbeFrameBuffer + (DestinationY * BytesPerScanLine) + DestinationX * VbePixelWidth);
- Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltUint8;
- //
- // Shuffle the RGB fields in EFI_GRAPHICS_OUTPUT_BLT_PIXEL to match the hardware buffer
- //
- Pixel = ((Blt->Red & Mode->Red.Mask) << Mode->Red.Position) |
- (
- (Blt->Green & Mode->Green.Mask) <<
- Mode->Green.Position
- ) |
- ((Blt->Blue & Mode->Blue.Mask) << Mode->Blue.Position);
+ VbeBuffer = (UINT8 *)((UINTN)VbeFrameBuffer + (DestinationY * BytesPerScanLine) + DestinationX * VbePixelWidth);
+ for (DstY = DestinationY + 1; DstY < (Height + DestinationY); DstY++) {
+ gBS->CopyMem (
+ (VOID *)((UINTN)VbeFrameBuffer + (DstY * BytesPerScanLine) + DestinationX * VbePixelWidth),
+ VbeBuffer,
+ TotalBytes
+ );
+ }
- for (Index = 0; Index < Width; Index++) {
- gBS->CopyMem (
- VbeBuffer,
- &Pixel,
- VbePixelWidth
- );
- VbeBuffer += VbePixelWidth;
- }
+ for (DstY = DestinationY; DstY < (Height + DestinationY); DstY++) {
+ //
+ // Update physical frame buffer.
+ //
+ CopyVideoBuffer (
+ PciIo,
+ VbeBuffer,
+ MemAddress,
+ DestinationX,
+ DstY,
+ TotalBytes,
+ VbePixelWidth,
+ BytesPerScanLine
+ );
+ }
- VbeBuffer = (UINT8 *) ((UINTN) VbeFrameBuffer + (DestinationY * BytesPerScanLine) + DestinationX * VbePixelWidth);
- for (DstY = DestinationY + 1; DstY < (Height + DestinationY); DstY++) {
- gBS->CopyMem (
- (VOID *) ((UINTN) VbeFrameBuffer + (DstY * BytesPerScanLine) + DestinationX * VbePixelWidth),
- VbeBuffer,
- TotalBytes
- );
- }
+ break;
- for (DstY = DestinationY; DstY < (Height + DestinationY); DstY++) {
- //
- // Update physical frame buffer.
- //
- CopyVideoBuffer (
- PciIo,
- VbeBuffer,
- MemAddress,
- DestinationX,
- DstY,
- TotalBytes,
- VbePixelWidth,
- BytesPerScanLine
- );
- }
- break;
+ case EfiBltBufferToVideo:
+ for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {
+ Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)(BltUint8 + (SrcY * Delta) + (SourceX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ VbeBuffer = ((UINT8 *)VbeFrameBuffer + (DstY * BytesPerScanLine + DestinationX * VbePixelWidth));
+ for (DstX = DestinationX; DstX < (Width + DestinationX); DstX++) {
+ //
+ // Shuffle the RGB fields in EFI_GRAPHICS_OUTPUT_BLT_PIXEL to match the hardware buffer
+ //
+ Pixel = ((Blt->Red & Mode->Red.Mask) << Mode->Red.Position) |
+ ((Blt->Green & Mode->Green.Mask) << Mode->Green.Position) |
+ ((Blt->Blue & Mode->Blue.Mask) << Mode->Blue.Position);
+ gBS->CopyMem (
+ VbeBuffer,
+ &Pixel,
+ VbePixelWidth
+ );
+ Blt++;
+ VbeBuffer += VbePixelWidth;
+ }
+
+ VbeBuffer = ((UINT8 *)VbeFrameBuffer + (DstY * BytesPerScanLine + DestinationX * VbePixelWidth));
- case EfiBltBufferToVideo:
- for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {
- Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) (BltUint8 + (SrcY * Delta) + (SourceX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- VbeBuffer = ((UINT8 *) VbeFrameBuffer + (DstY * BytesPerScanLine + DestinationX * VbePixelWidth));
- for (DstX = DestinationX; DstX < (Width + DestinationX); DstX++) {
//
- // Shuffle the RGB fields in EFI_GRAPHICS_OUTPUT_BLT_PIXEL to match the hardware buffer
+ // Update physical frame buffer.
//
- Pixel = ((Blt->Red & Mode->Red.Mask) << Mode->Red.Position) |
- ((Blt->Green & Mode->Green.Mask) << Mode->Green.Position) |
- ((Blt->Blue & Mode->Blue.Mask) << Mode->Blue.Position);
- gBS->CopyMem (
- VbeBuffer,
- &Pixel,
- VbePixelWidth
- );
- Blt++;
- VbeBuffer += VbePixelWidth;
+ CopyVideoBuffer (
+ PciIo,
+ VbeBuffer,
+ MemAddress,
+ DestinationX,
+ DstY,
+ TotalBytes,
+ VbePixelWidth,
+ BytesPerScanLine
+ );
}
- VbeBuffer = ((UINT8 *) VbeFrameBuffer + (DstY * BytesPerScanLine + DestinationX * VbePixelWidth));
+ break;
- //
- // Update physical frame buffer.
- //
- CopyVideoBuffer (
- PciIo,
- VbeBuffer,
- MemAddress,
- DestinationX,
- DstY,
- TotalBytes,
- VbePixelWidth,
- BytesPerScanLine
- );
- }
- break;
-
- default: ;
+ default:;
}
gBS->RestoreTPL (OriginalTPL);
@@ -2529,15 +2595,15 @@ BiosVideoGraphicsOutputVbeBlt (
IN UINTN Delta
)
{
- BIOS_VIDEO_DEV *BiosVideoPrivate;
- BIOS_VIDEO_MODE_DATA *Mode;
+ BIOS_VIDEO_DEV *BiosVideoPrivate;
+ BIOS_VIDEO_MODE_DATA *Mode;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
- BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (This);
- Mode = &BiosVideoPrivate->ModeData[This->Mode->Mode];
+ BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (This);
+ Mode = &BiosVideoPrivate->ModeData[This->Mode->Mode];
return BiosVideoVbeBltWorker (
BiosVideoPrivate,
@@ -2583,7 +2649,6 @@ WriteGraphicsController (
);
}
-
/**
Read the four bit plane of VGA frame buffer.
@@ -2606,11 +2671,11 @@ VgaReadBitPlanes (
UINTN Height
)
{
- UINTN BitPlane;
- UINTN Rows;
- UINTN FrameBufferOffset;
- UINT8 *Source;
- UINT8 *Destination;
+ UINTN BitPlane;
+ UINTN Rows;
+ UINTN FrameBufferOffset;
+ UINT8 *Source;
+ UINT8 *Destination;
//
// Program the Mode Register Write mode 0, Read mode 0
@@ -2624,7 +2689,8 @@ VgaReadBitPlanes (
for (BitPlane = 0, FrameBufferOffset = 0;
BitPlane < VGA_NUMBER_OF_BIT_PLANES;
BitPlane++, FrameBufferOffset += VGA_BYTES_PER_BIT_PLANE
- ) {
+ )
+ {
//
// Program the Read Map Select Register to select the correct bit plane
//
@@ -2639,18 +2705,17 @@ VgaReadBitPlanes (
for (Rows = 0; Rows < Height; Rows++, Source += VGA_BYTES_PER_SCAN_LINE, Destination += VGA_BYTES_PER_SCAN_LINE) {
PciIo->Mem.Read (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Source,
- WidthInBytes,
- (VOID *) Destination
- );
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Source,
+ WidthInBytes,
+ (VOID *)Destination
+ );
}
}
}
-
/**
Internal routine to convert VGA color to Grahpics Output color.
@@ -2670,12 +2735,12 @@ VgaConvertToGraphicsOutputColor (
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
)
{
- UINTN Mask;
- UINTN Bit;
- UINTN Color;
+ UINTN Mask;
+ UINTN Bit;
+ UINTN Color;
MemoryBuffer += ((CoordinateY << 6) + (CoordinateY << 4) + (CoordinateX >> 3));
- Mask = mVgaBitMaskTable[CoordinateX & 0x07];
+ Mask = mVgaBitMaskTable[CoordinateX & 0x07];
for (Bit = 0x01, Color = 0; Bit < 0x10; Bit <<= 1, MemoryBuffer += VGA_BYTES_PER_BIT_PLANE) {
if ((*MemoryBuffer & Mask) != 0) {
Color |= Bit;
@@ -2695,12 +2760,12 @@ VgaConvertToGraphicsOutputColor (
**/
UINT8
VgaConvertColor (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
)
{
- UINT8 Color;
+ UINT8 Color;
- Color = (UINT8) ((BltBuffer->Blue >> 7) | ((BltBuffer->Green >> 6) & 0x02) | ((BltBuffer->Red >> 5) & 0x04));
+ Color = (UINT8)((BltBuffer->Blue >> 7) | ((BltBuffer->Green >> 6) & 0x02) | ((BltBuffer->Red >> 5) & 0x04));
if ((BltBuffer->Red + BltBuffer->Green + BltBuffer->Blue) > 0x180) {
Color |= 0x08;
}
@@ -2708,7 +2773,6 @@ VgaConvertColor (
return Color;
}
-
/**
Grahpics Output protocol instance to block transfer for VGA device.
@@ -2751,51 +2815,51 @@ BiosVideoGraphicsOutputVgaBlt (
IN UINTN Delta
)
{
- BIOS_VIDEO_DEV *BiosVideoPrivate;
- EFI_TPL OriginalTPL;
- UINT8 *MemAddress;
- UINTN BytesPerScanLine;
- UINTN Bit;
- UINTN Index;
- UINTN Index1;
- UINTN StartAddress;
- UINTN Bytes;
- UINTN Offset;
- UINT8 LeftMask;
- UINT8 RightMask;
- UINTN Address;
- UINTN AddressFix;
- UINT8 *Address1;
- UINT8 *SourceAddress;
- UINT8 *DestinationAddress;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 Data;
- UINT8 PixelColor;
- UINT8 *VgaFrameBuffer;
- UINTN SourceOffset;
- UINTN SourceWidth;
- UINTN Rows;
- UINTN Columns;
- UINTN CoordinateX;
- UINTN CoordinateY;
- UINTN CurrentMode;
-
- if (This == NULL || ((UINTN) BltOperation) >= EfiGraphicsOutputBltOperationMax) {
+ BIOS_VIDEO_DEV *BiosVideoPrivate;
+ EFI_TPL OriginalTPL;
+ UINT8 *MemAddress;
+ UINTN BytesPerScanLine;
+ UINTN Bit;
+ UINTN Index;
+ UINTN Index1;
+ UINTN StartAddress;
+ UINTN Bytes;
+ UINTN Offset;
+ UINT8 LeftMask;
+ UINT8 RightMask;
+ UINTN Address;
+ UINTN AddressFix;
+ UINT8 *Address1;
+ UINT8 *SourceAddress;
+ UINT8 *DestinationAddress;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINT8 Data;
+ UINT8 PixelColor;
+ UINT8 *VgaFrameBuffer;
+ UINTN SourceOffset;
+ UINTN SourceWidth;
+ UINTN Rows;
+ UINTN Columns;
+ UINTN CoordinateX;
+ UINTN CoordinateY;
+ UINTN CurrentMode;
+
+ if ((This == NULL) || (((UINTN)BltOperation) >= EfiGraphicsOutputBltOperationMax)) {
return EFI_INVALID_PARAMETER;
}
- BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (This);
-
- CurrentMode = This->Mode->Mode;
- PciIo = BiosVideoPrivate->PciIo;
- MemAddress = BiosVideoPrivate->ModeData[CurrentMode].LinearFrameBuffer;
- BytesPerScanLine = BiosVideoPrivate->ModeData[CurrentMode].BytesPerScanLine >> 3;
- VgaFrameBuffer = BiosVideoPrivate->VgaFrameBuffer;
+ BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (This);
+ CurrentMode = This->Mode->Mode;
+ PciIo = BiosVideoPrivate->PciIo;
+ MemAddress = BiosVideoPrivate->ModeData[CurrentMode].LinearFrameBuffer;
+ BytesPerScanLine = BiosVideoPrivate->ModeData[CurrentMode].BytesPerScanLine >> 3;
+ VgaFrameBuffer = BiosVideoPrivate->VgaFrameBuffer;
- if (Width == 0 || Height == 0) {
+ if ((Width == 0) || (Height == 0)) {
return EFI_INVALID_PARAMETER;
}
+
//
// We need to fill the Virtual Screen buffer with the blt data.
// The virtual screen is upside down, as the first row is the bootom row of
@@ -2824,6 +2888,7 @@ BiosVideoGraphicsOutputVgaBlt (
return EFI_INVALID_PARAMETER;
}
}
+
//
// If Delta is zero, then the entire BltBuffer is being used, so Delta
// is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
@@ -2832,6 +2897,7 @@ BiosVideoGraphicsOutputVgaBlt (
if (Delta == 0) {
Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
}
+
//
// We have to raise to TPL Notify, so we make an atomic write the frame buffer.
// We would not want a timer based event (Cursor, ...) to come in while we are
@@ -2843,67 +2909,10 @@ BiosVideoGraphicsOutputVgaBlt (
// Compute some values we need for VGA
//
switch (BltOperation) {
- case EfiBltVideoToBltBuffer:
-
- SourceOffset = (SourceY << 6) + (SourceY << 4) + (SourceX >> 3);
- SourceWidth = ((SourceX + Width - 1) >> 3) - (SourceX >> 3) + 1;
-
- //
- // Read all the pixels in the 4 bit planes into a memory buffer that looks like the VGA buffer
- //
- VgaReadBitPlanes (
- PciIo,
- MemAddress + SourceOffset,
- VgaFrameBuffer + SourceOffset,
- SourceWidth,
- Height
- );
-
- //
- // Convert VGA Bit Planes to a Graphics Output 32-bit color value
- //
- BltBuffer += (DestinationY * (Delta >> 2) + DestinationX);
- for (Rows = 0, CoordinateY = SourceY; Rows < Height; Rows++, CoordinateY++, BltBuffer += (Delta >> 2)) {
- for (Columns = 0, CoordinateX = SourceX; Columns < Width; Columns++, CoordinateX++, BltBuffer++) {
- VgaConvertToGraphicsOutputColor (VgaFrameBuffer, CoordinateX, CoordinateY, BltBuffer);
- }
-
- BltBuffer -= Width;
- }
+ case EfiBltVideoToBltBuffer:
- break;
-
- case EfiBltVideoToVideo:
- //
- // Check for an aligned Video to Video operation
- //
- if ((SourceX & 0x07) == 0x00 && (DestinationX & 0x07) == 0x00 && (Width & 0x07) == 0x00) {
- //
- // Program the Mode Register Write mode 1, Read mode 0
- //
- WriteGraphicsController (
- PciIo,
- VGA_GRAPHICS_CONTROLLER_MODE_REGISTER,
- VGA_GRAPHICS_CONTROLLER_READ_MODE_0 | VGA_GRAPHICS_CONTROLLER_WRITE_MODE_1
- );
-
- SourceAddress = (UINT8 *) (MemAddress + (SourceY << 6) + (SourceY << 4) + (SourceX >> 3));
- DestinationAddress = (UINT8 *) (MemAddress + (DestinationY << 6) + (DestinationY << 4) + (DestinationX >> 3));
- Bytes = Width >> 3;
- for (Index = 0, Offset = 0; Index < Height; Index++, Offset += BytesPerScanLine) {
- PciIo->CopyMem (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) (DestinationAddress + Offset),
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) (SourceAddress + Offset),
- Bytes
- );
- }
- } else {
- SourceOffset = (SourceY << 6) + (SourceY << 4) + (SourceX >> 3);
- SourceWidth = ((SourceX + Width - 1) >> 3) - (SourceX >> 3) + 1;
+ SourceOffset = (SourceY << 6) + (SourceY << 4) + (SourceX >> 3);
+ SourceWidth = ((SourceX + Width - 1) >> 3) - (SourceX >> 3) + 1;
//
// Read all the pixels in the 4 bit planes into a memory buffer that looks like the VGA buffer
@@ -2915,218 +2924,277 @@ BiosVideoGraphicsOutputVgaBlt (
SourceWidth,
Height
);
- }
- break;
-
- case EfiBltVideoFill:
- StartAddress = (UINTN) (MemAddress + (DestinationY << 6) + (DestinationY << 4) + (DestinationX >> 3));
- Bytes = ((DestinationX + Width - 1) >> 3) - (DestinationX >> 3);
- LeftMask = mVgaLeftMaskTable[DestinationX & 0x07];
- RightMask = mVgaRightMaskTable[(DestinationX + Width - 1) & 0x07];
- if (Bytes == 0) {
- LeftMask = (UINT8) (LeftMask & RightMask);
- RightMask = 0;
- }
-
- if (LeftMask == 0xff) {
- StartAddress--;
- Bytes++;
- LeftMask = 0;
- }
-
- if (RightMask == 0xff) {
- Bytes++;
- RightMask = 0;
- }
-
- PixelColor = VgaConvertColor (BltBuffer);
+ //
+ // Convert VGA Bit Planes to a Graphics Output 32-bit color value
+ //
+ BltBuffer += (DestinationY * (Delta >> 2) + DestinationX);
+ for (Rows = 0, CoordinateY = SourceY; Rows < Height; Rows++, CoordinateY++, BltBuffer += (Delta >> 2)) {
+ for (Columns = 0, CoordinateX = SourceX; Columns < Width; Columns++, CoordinateX++, BltBuffer++) {
+ VgaConvertToGraphicsOutputColor (VgaFrameBuffer, CoordinateX, CoordinateY, BltBuffer);
+ }
- //
- // Program the Mode Register Write mode 2, Read mode 0
- //
- WriteGraphicsController (
- PciIo,
- VGA_GRAPHICS_CONTROLLER_MODE_REGISTER,
- VGA_GRAPHICS_CONTROLLER_READ_MODE_0 | VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2
- );
+ BltBuffer -= Width;
+ }
- //
- // Program the Data Rotate/Function Select Register to replace
- //
- WriteGraphicsController (
- PciIo,
- VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER,
- VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE
- );
+ break;
- if (LeftMask != 0) {
+ case EfiBltVideoToVideo:
//
- // Program the BitMask register with the Left column mask
+ // Check for an aligned Video to Video operation
//
- WriteGraphicsController (
- PciIo,
- VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER,
- LeftMask
- );
-
- for (Index = 0, Address = StartAddress; Index < Height; Index++, Address += BytesPerScanLine) {
+ if (((SourceX & 0x07) == 0x00) && ((DestinationX & 0x07) == 0x00) && ((Width & 0x07) == 0x00)) {
//
- // Read data from the bit planes into the latches
+ // Program the Mode Register Write mode 1, Read mode 0
//
- PciIo->Mem.Read (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Address,
- 1,
- &Data
- );
+ WriteGraphicsController (
+ PciIo,
+ VGA_GRAPHICS_CONTROLLER_MODE_REGISTER,
+ VGA_GRAPHICS_CONTROLLER_READ_MODE_0 | VGA_GRAPHICS_CONTROLLER_WRITE_MODE_1
+ );
+
+ SourceAddress = (UINT8 *)(MemAddress + (SourceY << 6) + (SourceY << 4) + (SourceX >> 3));
+ DestinationAddress = (UINT8 *)(MemAddress + (DestinationY << 6) + (DestinationY << 4) + (DestinationX >> 3));
+ Bytes = Width >> 3;
+ for (Index = 0, Offset = 0; Index < Height; Index++, Offset += BytesPerScanLine) {
+ PciIo->CopyMem (
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)(DestinationAddress + Offset),
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)(SourceAddress + Offset),
+ Bytes
+ );
+ }
+ } else {
+ SourceOffset = (SourceY << 6) + (SourceY << 4) + (SourceX >> 3);
+ SourceWidth = ((SourceX + Width - 1) >> 3) - (SourceX >> 3) + 1;
+
//
- // Write the lower 4 bits of PixelColor to the bit planes in the pixels enabled by BitMask
+ // Read all the pixels in the 4 bit planes into a memory buffer that looks like the VGA buffer
//
- PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Address,
- 1,
- &PixelColor
- );
+ VgaReadBitPlanes (
+ PciIo,
+ MemAddress + SourceOffset,
+ VgaFrameBuffer + SourceOffset,
+ SourceWidth,
+ Height
+ );
}
- }
- if (Bytes > 1) {
+ break;
+
+ case EfiBltVideoFill:
+ StartAddress = (UINTN)(MemAddress + (DestinationY << 6) + (DestinationY << 4) + (DestinationX >> 3));
+ Bytes = ((DestinationX + Width - 1) >> 3) - (DestinationX >> 3);
+ LeftMask = mVgaLeftMaskTable[DestinationX & 0x07];
+ RightMask = mVgaRightMaskTable[(DestinationX + Width - 1) & 0x07];
+ if (Bytes == 0) {
+ LeftMask = (UINT8)(LeftMask & RightMask);
+ RightMask = 0;
+ }
+
+ if (LeftMask == 0xff) {
+ StartAddress--;
+ Bytes++;
+ LeftMask = 0;
+ }
+
+ if (RightMask == 0xff) {
+ Bytes++;
+ RightMask = 0;
+ }
+
+ PixelColor = VgaConvertColor (BltBuffer);
+
//
- // Program the BitMask register with the middle column mask of 0xff
+ // Program the Mode Register Write mode 2, Read mode 0
//
WriteGraphicsController (
PciIo,
- VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER,
- 0xff
+ VGA_GRAPHICS_CONTROLLER_MODE_REGISTER,
+ VGA_GRAPHICS_CONTROLLER_READ_MODE_0 | VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2
);
- for (Index = 0, Address = StartAddress + 1; Index < Height; Index++, Address += BytesPerScanLine) {
- PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthFillUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Address,
- Bytes - 1,
- &PixelColor
- );
- }
- }
-
- if (RightMask != 0) {
//
- // Program the BitMask register with the Right column mask
+ // Program the Data Rotate/Function Select Register to replace
//
WriteGraphicsController (
PciIo,
- VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER,
- RightMask
+ VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER,
+ VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE
);
- for (Index = 0, Address = StartAddress + Bytes; Index < Height; Index++, Address += BytesPerScanLine) {
- //
- // Read data from the bit planes into the latches
- //
- PciIo->Mem.Read (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Address,
- 1,
- &Data
- );
+ if (LeftMask != 0) {
//
- // Write the lower 4 bits of PixelColor to the bit planes in the pixels enabled by BitMask
+ // Program the BitMask register with the Left column mask
//
- PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Address,
- 1,
- &PixelColor
- );
- }
- }
- break;
-
- case EfiBltBufferToVideo:
- StartAddress = (UINTN) (MemAddress + (DestinationY << 6) + (DestinationY << 4) + (DestinationX >> 3));
- LeftMask = mVgaBitMaskTable[DestinationX & 0x07];
+ WriteGraphicsController (
+ PciIo,
+ VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER,
+ LeftMask
+ );
- //
- // Program the Mode Register Write mode 2, Read mode 0
- //
- WriteGraphicsController (
- PciIo,
- VGA_GRAPHICS_CONTROLLER_MODE_REGISTER,
- VGA_GRAPHICS_CONTROLLER_READ_MODE_0 | VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2
- );
+ for (Index = 0, Address = StartAddress; Index < Height; Index++, Address += BytesPerScanLine) {
+ //
+ // Read data from the bit planes into the latches
+ //
+ PciIo->Mem.Read (
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Address,
+ 1,
+ &Data
+ );
+ //
+ // Write the lower 4 bits of PixelColor to the bit planes in the pixels enabled by BitMask
+ //
+ PciIo->Mem.Write (
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Address,
+ 1,
+ &PixelColor
+ );
+ }
+ }
- //
- // Program the Data Rotate/Function Select Register to replace
- //
- WriteGraphicsController (
- PciIo,
- VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER,
- VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE
- );
+ if (Bytes > 1) {
+ //
+ // Program the BitMask register with the middle column mask of 0xff
+ //
+ WriteGraphicsController (
+ PciIo,
+ VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER,
+ 0xff
+ );
- for (Index = 0, Address = StartAddress; Index < Height; Index++, Address += BytesPerScanLine) {
- for (Index1 = 0; Index1 < Width; Index1++) {
- BiosVideoPrivate->LineBuffer[Index1] = VgaConvertColor (&BltBuffer[(SourceY + Index) * (Delta >> 2) + SourceX + Index1]);
+ for (Index = 0, Address = StartAddress + 1; Index < Height; Index++, Address += BytesPerScanLine) {
+ PciIo->Mem.Write (
+ PciIo,
+ EfiPciIoWidthFillUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Address,
+ Bytes - 1,
+ &PixelColor
+ );
+ }
}
- AddressFix = Address;
- for (Bit = 0; Bit < 8; Bit++) {
+ if (RightMask != 0) {
//
- // Program the BitMask register with the Left column mask
+ // Program the BitMask register with the Right column mask
//
WriteGraphicsController (
PciIo,
VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER,
- LeftMask
+ RightMask
);
- for (Index1 = Bit, Address1 = (UINT8 *) AddressFix; Index1 < Width; Index1 += 8, Address1++) {
+ for (Index = 0, Address = StartAddress + Bytes; Index < Height; Index++, Address += BytesPerScanLine) {
//
// Read data from the bit planes into the latches
//
PciIo->Mem.Read (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Address1,
- 1,
- &Data
- );
-
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Address,
+ 1,
+ &Data
+ );
+ //
+ // Write the lower 4 bits of PixelColor to the bit planes in the pixels enabled by BitMask
+ //
PciIo->Mem.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) (UINTN) Address1,
- 1,
- &BiosVideoPrivate->LineBuffer[Index1]
- );
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Address,
+ 1,
+ &PixelColor
+ );
}
+ }
+
+ break;
+
+ case EfiBltBufferToVideo:
+ StartAddress = (UINTN)(MemAddress + (DestinationY << 6) + (DestinationY << 4) + (DestinationX >> 3));
+ LeftMask = mVgaBitMaskTable[DestinationX & 0x07];
+
+ //
+ // Program the Mode Register Write mode 2, Read mode 0
+ //
+ WriteGraphicsController (
+ PciIo,
+ VGA_GRAPHICS_CONTROLLER_MODE_REGISTER,
+ VGA_GRAPHICS_CONTROLLER_READ_MODE_0 | VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2
+ );
+
+ //
+ // Program the Data Rotate/Function Select Register to replace
+ //
+ WriteGraphicsController (
+ PciIo,
+ VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER,
+ VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE
+ );
- LeftMask = (UINT8) (LeftMask >> 1);
- if (LeftMask == 0) {
- LeftMask = 0x80;
- AddressFix++;
+ for (Index = 0, Address = StartAddress; Index < Height; Index++, Address += BytesPerScanLine) {
+ for (Index1 = 0; Index1 < Width; Index1++) {
+ BiosVideoPrivate->LineBuffer[Index1] = VgaConvertColor (&BltBuffer[(SourceY + Index) * (Delta >> 2) + SourceX + Index1]);
+ }
+
+ AddressFix = Address;
+
+ for (Bit = 0; Bit < 8; Bit++) {
+ //
+ // Program the BitMask register with the Left column mask
+ //
+ WriteGraphicsController (
+ PciIo,
+ VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER,
+ LeftMask
+ );
+
+ for (Index1 = Bit, Address1 = (UINT8 *)AddressFix; Index1 < Width; Index1 += 8, Address1++) {
+ //
+ // Read data from the bit planes into the latches
+ //
+ PciIo->Mem.Read (
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Address1,
+ 1,
+ &Data
+ );
+
+ PciIo->Mem.Write (
+ PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_IO_PASS_THROUGH_BAR,
+ (UINT64)(UINTN)Address1,
+ 1,
+ &BiosVideoPrivate->LineBuffer[Index1]
+ );
+ }
+
+ LeftMask = (UINT8)(LeftMask >> 1);
+ if (LeftMask == 0) {
+ LeftMask = 0x80;
+ AddressFix++;
+ }
}
}
- }
- break;
+ break;
- default: ;
+ default:;
}
gBS->RestoreTPL (OriginalTPL);
@@ -3155,8 +3223,8 @@ BiosVideoVgaMiniPortSetMode (
IN UINTN ModeNumber
)
{
- BIOS_VIDEO_DEV *BiosVideoPrivate;
- EFI_IA32_REGISTER_SET Regs;
+ BIOS_VIDEO_DEV *BiosVideoPrivate;
+ EFI_IA32_REGISTER_SET Regs;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -3168,41 +3236,42 @@ BiosVideoVgaMiniPortSetMode (
if (ModeNumber >= This->MaxMode) {
return EFI_UNSUPPORTED;
}
+
//
// Get the device structure for this device
//
BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_VGA_MINI_PORT_THIS (This);
switch (ModeNumber) {
- case 0:
- //
- // Set the 80x25 Text VGA Mode
- //
- Regs.H.AH = 0x00;
- Regs.H.AL = 0x83;
- BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
+ case 0:
+ //
+ // Set the 80x25 Text VGA Mode
+ //
+ Regs.H.AH = 0x00;
+ Regs.H.AL = 0x83;
+ BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
- Regs.H.AH = 0x11;
- Regs.H.AL = 0x14;
- Regs.H.BL = 0;
- BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
- break;
+ Regs.H.AH = 0x11;
+ Regs.H.AL = 0x14;
+ Regs.H.BL = 0;
+ BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
+ break;
- case 1:
- //
- // Set the 80x50 Text VGA Mode
- //
- Regs.H.AH = 0x00;
- Regs.H.AL = 0x83;
- BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
- Regs.H.AH = 0x11;
- Regs.H.AL = 0x12;
- Regs.H.BL = 0;
- BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
- break;
+ case 1:
+ //
+ // Set the 80x50 Text VGA Mode
+ //
+ Regs.H.AH = 0x00;
+ Regs.H.AL = 0x83;
+ BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
+ Regs.H.AH = 0x11;
+ Regs.H.AL = 0x12;
+ Regs.H.BL = 0;
+ BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);
+ break;
- default:
- return EFI_UNSUPPORTED;
+ default:
+ return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
@@ -3218,14 +3287,14 @@ BiosVideoVgaMiniPortSetMode (
VOID
EFIAPI
BiosVideoNotifyExitBootServices (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
BIOS_VIDEO_DEV *BiosVideoPrivate;
EFI_IA32_REGISTER_SET Regs;
- BiosVideoPrivate = (BIOS_VIDEO_DEV *)Context;
+ BiosVideoPrivate = (BIOS_VIDEO_DEV *)Context;
//
// Set the 80x25 Text VGA Mode
@@ -3256,9 +3325,9 @@ BiosVideoNotifyExitBootServices (
**/
EFI_STATUS
EFIAPI
-BiosVideoEntryPoint(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+BiosVideoEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
diff --git a/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.h b/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.h
index fb4cc65fd9..a2cb624d5a 100644
--- a/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.h
+++ b/OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.h
@@ -42,88 +42,88 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// position of RGB in the frame buffer is specified in the VBE Mode information
//
typedef struct {
- UINT8 Position; // Position of the color
- UINT8 Mask; // The number of bits expressed as a mask
+ UINT8 Position; // Position of the color
+ UINT8 Mask; // The number of bits expressed as a mask
} BIOS_VIDEO_COLOR_PLACEMENT;
//
// BIOS Graphics Output Graphical Mode Data
//
typedef struct {
- UINT16 VbeModeNumber;
- UINT16 BytesPerScanLine;
- VOID *LinearFrameBuffer;
- UINTN FrameBufferSize;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- UINT32 BitsPerPixel;
- BIOS_VIDEO_COLOR_PLACEMENT Red;
- BIOS_VIDEO_COLOR_PLACEMENT Green;
- BIOS_VIDEO_COLOR_PLACEMENT Blue;
- BIOS_VIDEO_COLOR_PLACEMENT Reserved;
- EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
- EFI_PIXEL_BITMASK PixelBitMask;
+ UINT16 VbeModeNumber;
+ UINT16 BytesPerScanLine;
+ VOID *LinearFrameBuffer;
+ UINTN FrameBufferSize;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ UINT32 ColorDepth;
+ UINT32 RefreshRate;
+ UINT32 BitsPerPixel;
+ BIOS_VIDEO_COLOR_PLACEMENT Red;
+ BIOS_VIDEO_COLOR_PLACEMENT Green;
+ BIOS_VIDEO_COLOR_PLACEMENT Blue;
+ BIOS_VIDEO_COLOR_PLACEMENT Reserved;
+ EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
+ EFI_PIXEL_BITMASK PixelBitMask;
} BIOS_VIDEO_MODE_DATA;
//
// BIOS video child handle private data Structure
//
-#define BIOS_VIDEO_DEV_SIGNATURE SIGNATURE_32 ('B', 'V', 'M', 'p')
+#define BIOS_VIDEO_DEV_SIGNATURE SIGNATURE_32 ('B', 'V', 'M', 'p')
typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
+ UINTN Signature;
+ EFI_HANDLE Handle;
//
// Consumed Protocols
//
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
//
// Produced Protocols
//
- EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
- EFI_EDID_DISCOVERED_PROTOCOL EdidDiscovered;
- EFI_EDID_ACTIVE_PROTOCOL EdidActive;
- EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
+ EFI_EDID_DISCOVERED_PROTOCOL EdidDiscovered;
+ EFI_EDID_ACTIVE_PROTOCOL EdidActive;
+ EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort;
//
// General fields
//
- BOOLEAN VgaCompatible;
- BOOLEAN ProduceGraphicsOutput;
+ BOOLEAN VgaCompatible;
+ BOOLEAN ProduceGraphicsOutput;
//
// Graphics Output Protocol related fields
//
- BOOLEAN HardwareNeedsStarting;
- UINTN CurrentMode;
- UINTN MaxMode;
- BIOS_VIDEO_MODE_DATA *ModeData;
- UINT8 *LineBuffer;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *VbeFrameBuffer;
- UINT8 *VgaFrameBuffer;
+ BOOLEAN HardwareNeedsStarting;
+ UINTN CurrentMode;
+ UINTN MaxMode;
+ BIOS_VIDEO_MODE_DATA *ModeData;
+ UINT8 *LineBuffer;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *VbeFrameBuffer;
+ UINT8 *VgaFrameBuffer;
//
// VESA Bios Extensions related fields
//
- UINTN NumberOfPagesBelow1MB; // Number of 4KB pages in PagesBelow1MB
- EFI_PHYSICAL_ADDRESS PagesBelow1MB; // Buffer for all VBE Information Blocks
- VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK *VbeInformationBlock; // 0x200 bytes. Must be allocated below 1MB
- VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK *VbeModeInformationBlock; // 0x100 bytes. Must be allocated below 1MB
- VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *VbeEdidDataBlock; // 0x80 bytes. Must be allocated below 1MB
- VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK *VbeCrtcInformationBlock; // 59 bytes. Must be allocated below 1MB
- UINTN VbeSaveRestorePages; // Number of 4KB pages in VbeSaveRestoreBuffer
- EFI_PHYSICAL_ADDRESS VbeSaveRestoreBuffer; // Must be allocated below 1MB
+ UINTN NumberOfPagesBelow1MB; // Number of 4KB pages in PagesBelow1MB
+ EFI_PHYSICAL_ADDRESS PagesBelow1MB; // Buffer for all VBE Information Blocks
+ VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK *VbeInformationBlock; // 0x200 bytes. Must be allocated below 1MB
+ VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK *VbeModeInformationBlock; // 0x100 bytes. Must be allocated below 1MB
+ VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *VbeEdidDataBlock; // 0x80 bytes. Must be allocated below 1MB
+ VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK *VbeCrtcInformationBlock; // 59 bytes. Must be allocated below 1MB
+ UINTN VbeSaveRestorePages; // Number of 4KB pages in VbeSaveRestoreBuffer
+ EFI_PHYSICAL_ADDRESS VbeSaveRestoreBuffer; // Must be allocated below 1MB
//
// Status code
//
- EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;
- EFI_EVENT ExitBootServicesEvent;
+ EFI_EVENT ExitBootServicesEvent;
} BIOS_VIDEO_DEV;
#define BIOS_VIDEO_DEV_FROM_PCI_IO_THIS(a) CR (a, BIOS_VIDEO_DEV, PciIo, BIOS_VIDEO_DEV_SIGNATURE)
@@ -164,7 +164,6 @@ BiosVideoDriverBindingSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
-
/**
Install Graphics Output Protocol onto VGA device handles.
@@ -184,7 +183,6 @@ BiosVideoDriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
-
/**
Stop.
@@ -223,7 +221,6 @@ BiosVideoCheckForVbe (
IN OUT BIOS_VIDEO_DEV *BiosVideoPrivate
);
-
/**
Check for VGA device.
@@ -237,9 +234,6 @@ BiosVideoCheckForVga (
IN OUT BIOS_VIDEO_DEV *BiosVideoPrivate
);
-
-
-
/**
Release resource for BIOS video instance.
@@ -282,7 +276,6 @@ BiosVideoGraphicsOutputQueryMode (
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
);
-
/**
Graphics Output protocol interface to set video mode.
@@ -298,11 +291,10 @@ BiosVideoGraphicsOutputQueryMode (
EFI_STATUS
EFIAPI
BiosVideoGraphicsOutputSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
- IN UINT32 ModeNumber
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN UINT32 ModeNumber
);
-
/**
Graphics Output protocol instance to block transfer for VBE device.
@@ -345,7 +337,6 @@ BiosVideoGraphicsOutputVbeBlt (
IN UINTN Delta
);
-
/**
Graphics Output protocol instance to block transfer for VGA device.
@@ -419,50 +410,50 @@ BiosVideoVgaMiniPortSetMode (
VOID
EFIAPI
BiosVideoNotifyExitBootServices (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
);
//
// Standard VGA Definitions
//
-#define VGA_HORIZONTAL_RESOLUTION 640
-#define VGA_VERTICAL_RESOLUTION 480
-#define VGA_NUMBER_OF_BIT_PLANES 4
-#define VGA_PIXELS_PER_BYTE 8
-#define VGA_BYTES_PER_SCAN_LINE (VGA_HORIZONTAL_RESOLUTION / VGA_PIXELS_PER_BYTE)
-#define VGA_BYTES_PER_BIT_PLANE (VGA_VERTICAL_RESOLUTION * VGA_BYTES_PER_SCAN_LINE)
+#define VGA_HORIZONTAL_RESOLUTION 640
+#define VGA_VERTICAL_RESOLUTION 480
+#define VGA_NUMBER_OF_BIT_PLANES 4
+#define VGA_PIXELS_PER_BYTE 8
+#define VGA_BYTES_PER_SCAN_LINE (VGA_HORIZONTAL_RESOLUTION / VGA_PIXELS_PER_BYTE)
+#define VGA_BYTES_PER_BIT_PLANE (VGA_VERTICAL_RESOLUTION * VGA_BYTES_PER_SCAN_LINE)
-#define VGA_GRAPHICS_CONTROLLER_ADDRESS_REGISTER 0x3ce
-#define VGA_GRAPHICS_CONTROLLER_DATA_REGISTER 0x3cf
+#define VGA_GRAPHICS_CONTROLLER_ADDRESS_REGISTER 0x3ce
+#define VGA_GRAPHICS_CONTROLLER_DATA_REGISTER 0x3cf
-#define VGA_GRAPHICS_CONTROLLER_SET_RESET_REGISTER 0x00
+#define VGA_GRAPHICS_CONTROLLER_SET_RESET_REGISTER 0x00
-#define VGA_GRAPHICS_CONTROLLER_ENABLE_SET_RESET_REGISTER 0x01
+#define VGA_GRAPHICS_CONTROLLER_ENABLE_SET_RESET_REGISTER 0x01
-#define VGA_GRAPHICS_CONTROLLER_COLOR_COMPARE_REGISTER 0x02
+#define VGA_GRAPHICS_CONTROLLER_COLOR_COMPARE_REGISTER 0x02
-#define VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER 0x03
-#define VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE 0x00
-#define VGA_GRAPHICS_CONTROLLER_FUNCTION_AND 0x08
-#define VGA_GRAPHICS_CONTROLLER_FUNCTION_OR 0x10
-#define VGA_GRAPHICS_CONTROLLER_FUNCTION_XOR 0x18
+#define VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER 0x03
+#define VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE 0x00
+#define VGA_GRAPHICS_CONTROLLER_FUNCTION_AND 0x08
+#define VGA_GRAPHICS_CONTROLLER_FUNCTION_OR 0x10
+#define VGA_GRAPHICS_CONTROLLER_FUNCTION_XOR 0x18
#define VGA_GRAPHICS_CONTROLLER_READ_MAP_SELECT_REGISTER 0x04
-#define VGA_GRAPHICS_CONTROLLER_MODE_REGISTER 0x05
-#define VGA_GRAPHICS_CONTROLLER_READ_MODE_0 0x00
-#define VGA_GRAPHICS_CONTROLLER_READ_MODE_1 0x08
-#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_0 0x00
-#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_1 0x01
-#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2 0x02
-#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_3 0x03
+#define VGA_GRAPHICS_CONTROLLER_MODE_REGISTER 0x05
+#define VGA_GRAPHICS_CONTROLLER_READ_MODE_0 0x00
+#define VGA_GRAPHICS_CONTROLLER_READ_MODE_1 0x08
+#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_0 0x00
+#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_1 0x01
+#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2 0x02
+#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_3 0x03
-#define VGA_GRAPHICS_CONTROLLER_MISCELLANEOUS_REGISTER 0x06
+#define VGA_GRAPHICS_CONTROLLER_MISCELLANEOUS_REGISTER 0x06
#define VGA_GRAPHICS_CONTROLLER_COLOR_DONT_CARE_REGISTER 0x07
-#define VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER 0x08
+#define VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER 0x08
/**
Install child handles if the Handle supports MBR format.
@@ -500,9 +491,9 @@ BiosVideoChildHandleInstall (
**/
EFI_STATUS
BiosVideoChildHandleUninstall (
- EFI_DRIVER_BINDING_PROTOCOL *This,
- EFI_HANDLE Controller,
- EFI_HANDLE Handle
+ EFI_DRIVER_BINDING_PROTOCOL *This,
+ EFI_HANDLE Controller,
+ EFI_HANDLE Handle
);
/**
@@ -529,4 +520,5 @@ BOOLEAN
HasChildHandle (
IN EFI_HANDLE Controller
);
+
#endif
diff --git a/OvmfPkg/Csm/BiosThunk/VideoDxe/ComponentName.c b/OvmfPkg/Csm/BiosThunk/VideoDxe/ComponentName.c
index dc914aa2f3..c401ed943b 100644
--- a/OvmfPkg/Csm/BiosThunk/VideoDxe/ComponentName.c
+++ b/OvmfPkg/Csm/BiosThunk/VideoDxe/ComponentName.c
@@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// EFI Component Name Functions
//
+
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -58,7 +59,6 @@ BiosVideoComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
-
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -130,14 +130,13 @@ BiosVideoComponentNameGetDriverName (
EFI_STATUS
EFIAPI
BiosVideoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
-
//
// EFI Component Name Protocol
//
@@ -150,14 +149,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gBiosVideoComponentNa
//
// EFI Component Name 2 Protocol
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBiosVideoComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) BiosVideoComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) BiosVideoComponentNameGetControllerName,
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBiosVideoComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)BiosVideoComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)BiosVideoComponentNameGetControllerName,
"en"
};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mBiosVideoDriverNameTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mBiosVideoDriverNameTable[] = {
{
"eng;en",
L"BIOS[INT10] Video Driver"
@@ -295,11 +293,11 @@ BiosVideoComponentNameGetDriverName (
EFI_STATUS
EFIAPI
BiosVideoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;
diff --git a/OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h b/OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h
index 88065f15c6..0c8e62c064 100644
--- a/OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h
+++ b/OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h
@@ -16,7 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// VESA BIOS Extensions status codes
//
-#define VESA_BIOS_EXTENSIONS_STATUS_SUCCESS 0x004f
+#define VESA_BIOS_EXTENSIONS_STATUS_SUCCESS 0x004f
//
// VESA BIOS Extensions Services
@@ -52,7 +52,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
AX = Return Status
--*/
-#define VESA_BIOS_EXTENSIONS_SET_MODE 0x4f02
+#define VESA_BIOS_EXTENSIONS_SET_MODE 0x4f02
/*++
@@ -97,7 +97,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
= 1 - Memory not cleared at last mode set
--*/
-#define VESA_BIOS_EXTENSIONS_SAVE_RESTORE_STATE 0x4f04
+#define VESA_BIOS_EXTENSIONS_SAVE_RESTORE_STATE 0x4f04
/*++
@@ -158,89 +158,89 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Timing data from EDID data block
//
-#define VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE 128
-#define VESA_BIOS_EXTENSIONS_EDID_ESTABLISHED_TIMING_MAX_NUMBER 17
+#define VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE 128
+#define VESA_BIOS_EXTENSIONS_EDID_ESTABLISHED_TIMING_MAX_NUMBER 17
//
// Established Timings: 24 possible resolutions
// Standard Timings: 8 possible resolutions
// Detailed Timings: 4 possible resolutions
//
-#define VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER 36
+#define VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER 36
//
// Timing data size for Established Timings, Standard Timings and Detailed Timings
//
-#define VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE 3
-#define VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE 16
-#define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_EACH_DESCRIPTOR_SIZE 18
-#define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE 72
+#define VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE 3
+#define VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE 16
+#define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_EACH_DESCRIPTOR_SIZE 18
+#define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE 72
typedef struct {
- UINT16 HorizontalResolution;
- UINT16 VerticalResolution;
- UINT16 RefreshRate;
+ UINT16 HorizontalResolution;
+ UINT16 VerticalResolution;
+ UINT16 RefreshRate;
} VESA_BIOS_EXTENSIONS_EDID_TIMING;
typedef struct {
- UINT32 ValidNumber;
- UINT32 Key[VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER];
+ UINT32 ValidNumber;
+ UINT32 Key[VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER];
} VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING;
typedef struct {
- UINT8 Header[8]; //EDID header "00 FF FF FF FF FF FF 00"
- UINT16 ManufactureName; //EISA 3-character ID
- UINT16 ProductCode; //Vendor assigned code
- UINT32 SerialNumber; //32-bit serial number
- UINT8 WeekOfManufacture; //Week number
- UINT8 YearOfManufacture; //Year
- UINT8 EdidVersion; //EDID Structure Version
- UINT8 EdidRevision; //EDID Structure Revision
- UINT8 VideoInputDefinition;
- UINT8 MaxHorizontalImageSize; //cm
- UINT8 MaxVerticalImageSize; //cm
- UINT8 DisplayTransferCharacteristic;
- UINT8 FeatureSupport;
- UINT8 RedGreenLowBits; //Rx1 Rx0 Ry1 Ry0 Gx1 Gx0 Gy1Gy0
- UINT8 BlueWhiteLowBits; //Bx1 Bx0 By1 By0 Wx1 Wx0 Wy1 Wy0
- UINT8 RedX; //Red-x Bits 9 - 2
- UINT8 RedY; //Red-y Bits 9 - 2
- UINT8 GreenX; //Green-x Bits 9 - 2
- UINT8 GreenY; //Green-y Bits 9 - 2
- UINT8 BlueX; //Blue-x Bits 9 - 2
- UINT8 BlueY; //Blue-y Bits 9 - 2
- UINT8 WhiteX; //White-x Bits 9 - 2
- UINT8 WhiteY; //White-x Bits 9 - 2
- UINT8 EstablishedTimings[VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE];
- UINT8 StandardTimingIdentification[VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE];
- UINT8 DetailedTimingDescriptions[VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE];
- UINT8 ExtensionFlag; //Number of (optional) 128-byte EDID extension blocks to follow
- UINT8 Checksum;
+ UINT8 Header[8]; // EDID header "00 FF FF FF FF FF FF 00"
+ UINT16 ManufactureName; // EISA 3-character ID
+ UINT16 ProductCode; // Vendor assigned code
+ UINT32 SerialNumber; // 32-bit serial number
+ UINT8 WeekOfManufacture; // Week number
+ UINT8 YearOfManufacture; // Year
+ UINT8 EdidVersion; // EDID Structure Version
+ UINT8 EdidRevision; // EDID Structure Revision
+ UINT8 VideoInputDefinition;
+ UINT8 MaxHorizontalImageSize; // cm
+ UINT8 MaxVerticalImageSize; // cm
+ UINT8 DisplayTransferCharacteristic;
+ UINT8 FeatureSupport;
+ UINT8 RedGreenLowBits; // Rx1 Rx0 Ry1 Ry0 Gx1 Gx0 Gy1Gy0
+ UINT8 BlueWhiteLowBits; // Bx1 Bx0 By1 By0 Wx1 Wx0 Wy1 Wy0
+ UINT8 RedX; // Red-x Bits 9 - 2
+ UINT8 RedY; // Red-y Bits 9 - 2
+ UINT8 GreenX; // Green-x Bits 9 - 2
+ UINT8 GreenY; // Green-y Bits 9 - 2
+ UINT8 BlueX; // Blue-x Bits 9 - 2
+ UINT8 BlueY; // Blue-y Bits 9 - 2
+ UINT8 WhiteX; // White-x Bits 9 - 2
+ UINT8 WhiteY; // White-x Bits 9 - 2
+ UINT8 EstablishedTimings[VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE];
+ UINT8 StandardTimingIdentification[VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE];
+ UINT8 DetailedTimingDescriptions[VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE];
+ UINT8 ExtensionFlag; // Number of (optional) 128-byte EDID extension blocks to follow
+ UINT8 Checksum;
} VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK;
//
// Super VGA Information Block
//
typedef struct {
- UINT32 VESASignature; // 'VESA' 4 byte signature
- UINT16 VESAVersion; // VBE version number
- UINT32 OEMStringPtr; // Pointer to OEM string
- UINT32 Capabilities; // Capabilities of video card
- UINT32 VideoModePtr; // Pointer to an array of 16-bit supported modes values terminated by 0xFFFF
- UINT16 TotalMemory; // Number of 64kb memory blocks
- UINT16 OemSoftwareRev; // VBE implementation Software revision
- UINT32 OemVendorNamePtr; // VbeFarPtr to Vendor Name String
- UINT32 OemProductNamePtr; // VbeFarPtr to Product Name String
- UINT32 OemProductRevPtr; // VbeFarPtr to Product Revision String
- UINT8 Reserved[222]; // Reserved for VBE implementation scratch area
- UINT8 OemData[256]; // Data area for OEM strings. Pad to 512 byte block size
+ UINT32 VESASignature; // 'VESA' 4 byte signature
+ UINT16 VESAVersion; // VBE version number
+ UINT32 OEMStringPtr; // Pointer to OEM string
+ UINT32 Capabilities; // Capabilities of video card
+ UINT32 VideoModePtr; // Pointer to an array of 16-bit supported modes values terminated by 0xFFFF
+ UINT16 TotalMemory; // Number of 64kb memory blocks
+ UINT16 OemSoftwareRev; // VBE implementation Software revision
+ UINT32 OemVendorNamePtr; // VbeFarPtr to Vendor Name String
+ UINT32 OemProductNamePtr; // VbeFarPtr to Product Name String
+ UINT32 OemProductRevPtr; // VbeFarPtr to Product Revision String
+ UINT8 Reserved[222]; // Reserved for VBE implementation scratch area
+ UINT8 OemData[256]; // Data area for OEM strings. Pad to 512 byte block size
} VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK;
//
// Super VGA Information Block VESASignature values
//
-#define VESA_BIOS_EXTENSIONS_VESA_SIGNATURE SIGNATURE_32 ('V', 'E', 'S', 'A')
-#define VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE SIGNATURE_32 ('V', 'B', 'E', '2')
+#define VESA_BIOS_EXTENSIONS_VESA_SIGNATURE SIGNATURE_32 ('V', 'E', 'S', 'A')
+#define VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE SIGNATURE_32 ('V', 'B', 'E', '2')
//
// Super VGA Information Block VESAVersion values
@@ -252,13 +252,13 @@ typedef struct {
//
// Super VGA Information Block Capabilities field bit definitions
//
-#define VESA_BIOS_EXTENSIONS_CAPABILITY_8_BIT_DAC 0x01 // 0: DAC width is fixed at 6 bits/color
+#define VESA_BIOS_EXTENSIONS_CAPABILITY_8_BIT_DAC 0x01 // 0: DAC width is fixed at 6 bits/color
// 1: DAC width switchable to 8 bits/color
//
-#define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_VGA 0x02 // 0: Controller is VGA compatible
+#define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_VGA 0x02 // 0: Controller is VGA compatible
// 1: Controller is not VGA compatible
//
-#define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_NORMAL_RAMDAC 0x04 // 0: Normal RAMDAC operation
+#define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_NORMAL_RAMDAC 0x04 // 0: Normal RAMDAC operation
// 1: Use blank bit in function 9 to program RAMDAC
//
#define VESA_BIOS_EXTENSIONS_CAPABILITY_STEREOSCOPIC 0x08 // 0: No hardware stereoscopic signal support
@@ -269,10 +269,10 @@ typedef struct {
//
// Super VGA mode number bite field definitions
//
-#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_VESA 0x0100 // 0: Not a VESA defined VBE mode
+#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_VESA 0x0100 // 0: Not a VESA defined VBE mode
// 1: A VESA defined VBE mode
//
-#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_REFRESH_CONTROL_USER 0x0800 // 0: Use current BIOS default referesh rate
+#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_REFRESH_CONTROL_USER 0x0800 // 0: Use current BIOS default referesh rate
// 1: Use the user specified CRTC values for refresh rate
//
#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_LINEAR_FRAME_BUFFER 0x4000 // 0: Use a banked/windowed frame buffer
@@ -283,7 +283,7 @@ typedef struct {
//
// Super VGA Information Block mode list terminator value
//
-#define VESA_BIOS_EXTENSIONS_END_OF_MODE_LIST 0xffff
+#define VESA_BIOS_EXTENSIONS_END_OF_MODE_LIST 0xffff
//
// Window Function
@@ -301,60 +301,60 @@ typedef struct {
//
// Manadory fields for all VESA Bios Extensions revisions
//
- UINT16 ModeAttributes; // Mode attributes
- UINT8 WinAAttributes; // Window A attributes
- UINT8 WinBAttributes; // Window B attributes
- UINT16 WinGranularity; // Window granularity in k
- UINT16 WinSize; // Window size in k
- UINT16 WinASegment; // Window A segment
- UINT16 WinBSegment; // Window B segment
- UINT32 WindowFunction; // Pointer to window function
- UINT16 BytesPerScanLine; // Bytes per scanline
+ UINT16 ModeAttributes; // Mode attributes
+ UINT8 WinAAttributes; // Window A attributes
+ UINT8 WinBAttributes; // Window B attributes
+ UINT16 WinGranularity; // Window granularity in k
+ UINT16 WinSize; // Window size in k
+ UINT16 WinASegment; // Window A segment
+ UINT16 WinBSegment; // Window B segment
+ UINT32 WindowFunction; // Pointer to window function
+ UINT16 BytesPerScanLine; // Bytes per scanline
//
// Manadory fields for VESA Bios Extensions 1.2 and above
//
- UINT16 XResolution; // Horizontal resolution
- UINT16 YResolution; // Vertical resolution
- UINT8 XCharSize; // Character cell width
- UINT8 YCharSize; // Character cell height
- UINT8 NumberOfPlanes; // Number of memory planes
- UINT8 BitsPerPixel; // Bits per pixel
- UINT8 NumberOfBanks; // Number of CGA style banks
- UINT8 MemoryModel; // Memory model type
- UINT8 BankSize; // Size of CGA style banks
- UINT8 NumberOfImagePages; // Number of images pages
- UINT8 Reserved1; // Reserved
- UINT8 RedMaskSize; // Size of direct color red mask
- UINT8 RedFieldPosition; // Bit posn of lsb of red mask
- UINT8 GreenMaskSize; // Size of direct color green mask
- UINT8 GreenFieldPosition; // Bit posn of lsb of green mask
- UINT8 BlueMaskSize; // Size of direct color blue mask
- UINT8 BlueFieldPosition; // Bit posn of lsb of blue mask
- UINT8 RsvdMaskSize; // Size of direct color res mask
- UINT8 RsvdFieldPosition; // Bit posn of lsb of res mask
- UINT8 DirectColorModeInfo; // Direct color mode attributes
+ UINT16 XResolution; // Horizontal resolution
+ UINT16 YResolution; // Vertical resolution
+ UINT8 XCharSize; // Character cell width
+ UINT8 YCharSize; // Character cell height
+ UINT8 NumberOfPlanes; // Number of memory planes
+ UINT8 BitsPerPixel; // Bits per pixel
+ UINT8 NumberOfBanks; // Number of CGA style banks
+ UINT8 MemoryModel; // Memory model type
+ UINT8 BankSize; // Size of CGA style banks
+ UINT8 NumberOfImagePages; // Number of images pages
+ UINT8 Reserved1; // Reserved
+ UINT8 RedMaskSize; // Size of direct color red mask
+ UINT8 RedFieldPosition; // Bit posn of lsb of red mask
+ UINT8 GreenMaskSize; // Size of direct color green mask
+ UINT8 GreenFieldPosition; // Bit posn of lsb of green mask
+ UINT8 BlueMaskSize; // Size of direct color blue mask
+ UINT8 BlueFieldPosition; // Bit posn of lsb of blue mask
+ UINT8 RsvdMaskSize; // Size of direct color res mask
+ UINT8 RsvdFieldPosition; // Bit posn of lsb of res mask
+ UINT8 DirectColorModeInfo; // Direct color mode attributes
//
// Manadory fields for VESA Bios Extensions 2.0 and above
//
- UINT32 PhysBasePtr; // Physical Address for flat memory frame buffer
- UINT32 Reserved2; // Reserved
- UINT16 Reserved3; // Reserved
+ UINT32 PhysBasePtr; // Physical Address for flat memory frame buffer
+ UINT32 Reserved2; // Reserved
+ UINT16 Reserved3; // Reserved
//
// Manadory fields for VESA Bios Extensions 3.0 and above
//
- UINT16 LinBytesPerScanLine; // Bytes/scan line for linear modes
- UINT8 BnkNumberOfImagePages; // Number of images for banked modes
- UINT8 LinNumberOfImagePages; // Number of images for linear modes
- UINT8 LinRedMaskSize; // Size of direct color red mask (linear mode)
- UINT8 LinRedFieldPosition; // Bit posiiton of lsb of red mask (linear modes)
- UINT8 LinGreenMaskSize; // Size of direct color green mask (linear mode)
- UINT8 LinGreenFieldPosition; // Bit posiiton of lsb of green mask (linear modes)
- UINT8 LinBlueMaskSize; // Size of direct color blue mask (linear mode)
- UINT8 LinBlueFieldPosition; // Bit posiiton of lsb of blue mask (linear modes)
- UINT8 LinRsvdMaskSize; // Size of direct color reserved mask (linear mode)
- UINT8 LinRsvdFieldPosition; // Bit posiiton of lsb of reserved mask (linear modes)
- UINT32 MaxPixelClock; // Maximum pixel clock (in Hz) for graphics mode
- UINT8 Pad[190]; // Pad to 256 byte block size
+ UINT16 LinBytesPerScanLine; // Bytes/scan line for linear modes
+ UINT8 BnkNumberOfImagePages; // Number of images for banked modes
+ UINT8 LinNumberOfImagePages; // Number of images for linear modes
+ UINT8 LinRedMaskSize; // Size of direct color red mask (linear mode)
+ UINT8 LinRedFieldPosition; // Bit posiiton of lsb of red mask (linear modes)
+ UINT8 LinGreenMaskSize; // Size of direct color green mask (linear mode)
+ UINT8 LinGreenFieldPosition; // Bit posiiton of lsb of green mask (linear modes)
+ UINT8 LinBlueMaskSize; // Size of direct color blue mask (linear mode)
+ UINT8 LinBlueFieldPosition; // Bit posiiton of lsb of blue mask (linear modes)
+ UINT8 LinRsvdMaskSize; // Size of direct color reserved mask (linear mode)
+ UINT8 LinRsvdFieldPosition; // Bit posiiton of lsb of reserved mask (linear modes)
+ UINT32 MaxPixelClock; // Maximum pixel clock (in Hz) for graphics mode
+ UINT8 Pad[190]; // Pad to 256 byte block size
} VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK;
//
@@ -363,31 +363,31 @@ typedef struct {
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_HARDWARE 0x0001 // 0: Mode not supported in handware
// 1: Mode supported in handware
//
-#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_TTY 0x0004 // 0: TTY Output functions not supported by BIOS
+#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_TTY 0x0004 // 0: TTY Output functions not supported by BIOS
// 1: TTY Output functions supported by BIOS
//
-#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_COLOR 0x0008 // 0: Monochrome mode
+#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_COLOR 0x0008 // 0: Monochrome mode
// 1: Color mode
//
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_GRAPHICS 0x0010 // 0: Text mode
// 1: Graphics mode
//
-#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NOT_VGA 0x0020 // 0: VGA compatible mode
+#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NOT_VGA 0x0020 // 0: VGA compatible mode
// 1: Not a VGA compatible mode
//
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NOT_WINDOWED 0x0040 // 0: VGA compatible windowed memory mode
// 1: Not a VGA compatible windowed memory mode
//
-#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER 0x0080 // 0: No linear fram buffer mode available
+#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER 0x0080 // 0: No linear fram buffer mode available
// 1: Linear frame buffer mode available
//
-#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_DOUBLE_SCAN 0x0100 // 0: No double scan mode available
+#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_DOUBLE_SCAN 0x0100 // 0: No double scan mode available
// 1: Double scan mode available
//
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_INTERLACED 0x0200 // 0: No interlaced mode is available
// 1: Interlaced mode is available
//
-#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NO_TRIPPLE_BUFFER 0x0400 // 0: No hardware triple buffer mode support available
+#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NO_TRIPPLE_BUFFER 0x0400 // 0: No hardware triple buffer mode support available
// 1: Hardware triple buffer mode support available
//
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_STEREOSCOPIC 0x0800 // 0: No hardware steroscopic display support
@@ -398,7 +398,7 @@ typedef struct {
//
// Super VGA Mode Information Block WinAAttribite/WinBAttributes field bit definitions
//
-#define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_RELOCATABLE 0x01 // 0: Single non-relocatable window only
+#define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_RELOCATABLE 0x01 // 0: Single non-relocatable window only
// 1: Relocatable window(s) are supported
//
#define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_READABLE 0x02 // 0: Window is not readable
@@ -418,38 +418,38 @@ typedef struct {
// Super VGA Memory Models
//
typedef enum {
- MemPL = 3, // Planar memory model
- MemPK = 4, // Packed pixel memory model
- MemRGB= 6, // Direct color RGB memory model
- MemYUV= 7 // Direct color YUV memory model
+ MemPL = 3, // Planar memory model
+ MemPK = 4, // Packed pixel memory model
+ MemRGB = 6, // Direct color RGB memory model
+ MemYUV = 7 // Direct color YUV memory model
} VESA_BIOS_EXTENSIONS_MEMORY_MODELS;
//
// Super VGA CRTC Information Block
//
typedef struct {
- UINT16 HorizontalTotal; // Horizontal total in pixels
- UINT16 HorizontalSyncStart; // Horizontal sync start in pixels
- UINT16 HorizontalSyncEnd; // Horizontal sync end in pixels
- UINT16 VericalTotal; // Vertical total in pixels
- UINT16 VericalSyncStart; // Vertical sync start in pixels
- UINT16 VericalSyncEnd; // Vertical sync end in pixels
- UINT8 Flags; // Flags (Interlaced/DoubleScan/etc).
- UINT32 PixelClock; // Pixel clock in units of Hz
- UINT16 RefreshRate; // Refresh rate in units of 0.01 Hz
- UINT8 Reserved[40]; // Pad
+ UINT16 HorizontalTotal; // Horizontal total in pixels
+ UINT16 HorizontalSyncStart; // Horizontal sync start in pixels
+ UINT16 HorizontalSyncEnd; // Horizontal sync end in pixels
+ UINT16 VericalTotal; // Vertical total in pixels
+ UINT16 VericalSyncStart; // Vertical sync start in pixels
+ UINT16 VericalSyncEnd; // Vertical sync end in pixels
+ UINT8 Flags; // Flags (Interlaced/DoubleScan/etc).
+ UINT32 PixelClock; // Pixel clock in units of Hz
+ UINT16 RefreshRate; // Refresh rate in units of 0.01 Hz
+ UINT8 Reserved[40]; // Pad
} VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK;
-#define VESA_BIOS_EXTENSIONS_CRTC_FLAGS_DOUBLE_SCAN 0x01 // 0: Graphics mode is not souble scanned
+#define VESA_BIOS_EXTENSIONS_CRTC_FLAGS_DOUBLE_SCAN 0x01 // 0: Graphics mode is not souble scanned
// 1: Graphics mode is double scanned
//
-#define VESA_BIOS_EXTENSIONS_CRTC_FLAGSINTERLACED 0x02 // 0: Graphics mode is not interlaced
+#define VESA_BIOS_EXTENSIONS_CRTC_FLAGSINTERLACED 0x02 // 0: Graphics mode is not interlaced
// 1: Graphics mode is interlaced
//
#define VESA_BIOS_EXTENSIONS_CRTC_HORIZONTAL_SYNC_NEGATIVE 0x04 // 0: Horizontal sync polarity is positive(+)
// 0: Horizontal sync polarity is negative(-)
//
-#define VESA_BIOS_EXTENSIONS_CRTC_VERITICAL_SYNC_NEGATIVE 0x08 // 0: Verical sync polarity is positive(+)
+#define VESA_BIOS_EXTENSIONS_CRTC_VERITICAL_SYNC_NEGATIVE 0x08 // 0: Verical sync polarity is positive(+)
// 0: Verical sync polarity is negative(-)
//
// Turn off byte packing of data structures
diff --git a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c b/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c
index 533b078593..3ffd6e92b2 100644
--- a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c
+++ b/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c
@@ -29,4 +29,3 @@ CsmSupportLibConstructor (
return EFI_SUCCESS;
}
-
diff --git a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h b/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h
index 922a6aba2c..a6ee93f167 100644
--- a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h
+++ b/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h
@@ -46,4 +46,3 @@ LegacyBiosPlatformInstall (
);
#endif
-
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c b/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
index 97ca21945f..5bed2e2b51 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
@@ -12,25 +12,24 @@
//
// Handle for the Legacy Interrupt Protocol instance produced by this driver
//
-STATIC EFI_HANDLE mLegacyInterruptHandle = NULL;
+STATIC EFI_HANDLE mLegacyInterruptHandle = NULL;
//
// Legacy Interrupt Device number (0x01 on piix4, 0x1f on q35/mch)
//
-STATIC UINT8 mLegacyInterruptDevice;
+STATIC UINT8 mLegacyInterruptDevice;
//
// The Legacy Interrupt Protocol instance produced by this driver
//
-STATIC EFI_LEGACY_INTERRUPT_PROTOCOL mLegacyInterrupt = {
+STATIC EFI_LEGACY_INTERRUPT_PROTOCOL mLegacyInterrupt = {
GetNumberPirqs,
GetLocation,
ReadPirq,
WritePirq
};
-STATIC UINT8 PirqReg[MAX_PIRQ_NUMBER] = { PIRQA, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH };
-
+STATIC UINT8 PirqReg[MAX_PIRQ_NUMBER] = { PIRQA, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH };
/**
Return the number of PIRQs supported by this chipset.
@@ -53,7 +52,6 @@ GetNumberPirqs (
return EFI_SUCCESS;
}
-
/**
Return PCI location of this device.
$PIR table requires this info.
@@ -82,7 +80,6 @@ GetLocation (
return EFI_SUCCESS;
}
-
/**
Builds the PCI configuration address for the register specified by PirqNumber
@@ -95,12 +92,12 @@ GetAddress (
UINT8 PirqNumber
)
{
- return PCI_LIB_ADDRESS(
- LEGACY_INT_BUS,
- mLegacyInterruptDevice,
- LEGACY_INT_FUNC,
- PirqReg[PirqNumber]
- );
+ return PCI_LIB_ADDRESS (
+ LEGACY_INT_BUS,
+ mLegacyInterruptDevice,
+ LEGACY_INT_FUNC,
+ PirqReg[PirqNumber]
+ );
}
/**
@@ -127,12 +124,11 @@ ReadPirq (
}
*PirqData = PciRead8 (GetAddress (PirqNumber));
- *PirqData = (UINT8) (*PirqData & 0x7f);
+ *PirqData = (UINT8)(*PirqData & 0x7f);
return EFI_SUCCESS;
}
-
/**
Write the given PIRQ register
@@ -160,7 +156,6 @@ WritePirq (
return EFI_SUCCESS;
}
-
/**
Initialize Legacy Interrupt support
@@ -178,7 +173,7 @@ LegacyInterruptInstall (
//
// Make sure the Legacy Interrupt Protocol is not already installed in the system
//
- ASSERT_PROTOCOL_ALREADY_INSTALLED(NULL, &gEfiLegacyInterruptProtocolGuid);
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiLegacyInterruptProtocolGuid);
//
// Query Host Bridge DID to determine platform type, then set device number
@@ -192,8 +187,12 @@ LegacyInterruptInstall (
mLegacyInterruptDevice = LEGACY_INT_DEV_Q35;
break;
default:
- DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
- __FUNCTION__, HostBridgeDevId));
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Unknown Host Bridge Device ID: 0x%04x\n",
+ __FUNCTION__,
+ HostBridgeDevId
+ ));
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
@@ -207,8 +206,7 @@ LegacyInterruptInstall (
&mLegacyInterrupt,
NULL
);
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
return Status;
}
-
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h b/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
index 1e37a41a57..132365b9cc 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
@@ -20,23 +20,22 @@
#include <Library/UefiBootServicesTableLib.h>
#include <OvmfPlatforms.h>
-
-#define LEGACY_INT_BUS 0
+#define LEGACY_INT_BUS 0
#define LEGACY_INT_DEV_PIIX4 0x01
#define LEGACY_INT_DEV_Q35 0x1f
-#define LEGACY_INT_FUNC 0
+#define LEGACY_INT_FUNC 0
-#define PIRQN 0x00 // PIRQ Null
-#define PIRQA 0x60
-#define PIRQB 0x61
-#define PIRQC 0x62
-#define PIRQD 0x63
-#define PIRQE 0x68
-#define PIRQF 0x69
-#define PIRQG 0x6A
-#define PIRQH 0x6B
+#define PIRQN 0x00 // PIRQ Null
+#define PIRQA 0x60
+#define PIRQB 0x61
+#define PIRQC 0x62
+#define PIRQD 0x63
+#define PIRQE 0x68
+#define PIRQF 0x69
+#define PIRQG 0x6A
+#define PIRQH 0x6B
-#define MAX_PIRQ_NUMBER 8
+#define MAX_PIRQ_NUMBER 8
/**
Return the number of PIRQs supported by this chipset.
@@ -114,4 +113,3 @@ WritePirq (
);
#endif
-
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c b/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c
index 4bd6d70a1a..491897adbd 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c
@@ -9,15 +9,15 @@
#include "LegacyPlatform.h"
-EFI_SETUP_BBS_MAP mSetupBbsMap[] = {
- { 1, 2, 1, 1 }, // ATA HardDrive
- { 2, 3, 1, 1 }, // ATAPI CDROM
- { 3, 0x80, 2, 0 }, // PXE
- { 4, 1, 0, 6 }, // USB Floppy
- { 4, 2, 0, 6 }, // USB HDD
- { 4, 3, 0, 6 }, // USB CD
- { 4, 1, 0, 0 }, // USB ZIP Bugbug since Class/SubClass code is uninitialized
- { 4, 2, 0, 0 } // USB ZIP Bugbug since Class/SubClass code is uninitialized
+EFI_SETUP_BBS_MAP mSetupBbsMap[] = {
+ { 1, 2, 1, 1 }, // ATA HardDrive
+ { 2, 3, 1, 1 }, // ATAPI CDROM
+ { 3, 0x80, 2, 0 }, // PXE
+ { 4, 1, 0, 6 }, // USB Floppy
+ { 4, 2, 0, 6 }, // USB HDD
+ { 4, 3, 0, 6 }, // USB CD
+ { 4, 1, 0, 0 }, // USB ZIP Bugbug since Class/SubClass code is uninitialized
+ { 4, 2, 0, 0 } // USB ZIP Bugbug since Class/SubClass code is uninitialized
};
//
@@ -29,23 +29,23 @@ EFI_SETUP_BBS_MAP mSetupBbsMap[] = {
#define NULL_ROM_FILE_GUID \
{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
-SYSTEM_ROM_TABLE mSystemRomTable[] = {
- { SYSTEM_ROM_FILE_GUID, 1 },
- { NULL_ROM_FILE_GUID, 0 }
+SYSTEM_ROM_TABLE mSystemRomTable[] = {
+ { SYSTEM_ROM_FILE_GUID, 1 },
+ { NULL_ROM_FILE_GUID, 0 }
};
EFI_HANDLE mVgaHandles[0x20];
EFI_HANDLE mDiskHandles[0x20];
EFI_HANDLE mIsaHandles[0x20];
-EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY IrqPriorityTable[MAX_IRQ_PRIORITY_ENTRIES] = {
- {0x0B,0},
- {0x09,0},
- {0x0A,0},
- {0x05,0},
- {0x07,0},
- {0x00,0},
- {0x00,0}
+EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY IrqPriorityTable[MAX_IRQ_PRIORITY_ENTRIES] = {
+ { 0x0B, 0 },
+ { 0x09, 0 },
+ { 0x0A, 0 },
+ { 0x05, 0 },
+ { 0x07, 0 },
+ { 0x00, 0 },
+ { 0x00, 0 }
};
//
@@ -54,18 +54,18 @@ EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY IrqPriorityTable[MAX_IRQ_PRIORITY_ENTRIES] =
// to check to get bus number. The Slot number - 1 is an index into a decode
// table to get the bridge information.
//
-EFI_LEGACY_PIRQ_TABLE PirqTableHead = {
+EFI_LEGACY_PIRQ_TABLE PirqTableHead = {
{
EFI_LEGACY_PIRQ_TABLE_SIGNATURE, // UINT32 Signature
- 0x00, // UINT8 MinorVersion
- 0x01, // UINT8 MajorVersion
- 0x0000, // UINT16 TableSize
- 0x00, // UINT8 Bus
- 0x08, // UINT8 DevFun
- 0x0000, // UINT16 PciOnlyIrq
- 0x8086, // UINT16 CompatibleVid
- 0x122e, // UINT16 CompatibleDid
- 0x00000000, // UINT32 Miniport
+ 0x00, // UINT8 MinorVersion
+ 0x01, // UINT8 MajorVersion
+ 0x0000, // UINT16 TableSize
+ 0x00, // UINT8 Bus
+ 0x08, // UINT8 DevFun
+ 0x0000, // UINT16 PciOnlyIrq
+ 0x8086, // UINT16 CompatibleVid
+ 0x122e, // UINT16 CompatibleDid
+ 0x00000000, // UINT32 Miniport
{ // UINT8 Reserved[11]
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00
@@ -76,17 +76,29 @@ EFI_LEGACY_PIRQ_TABLE PirqTableHead = {
// -- Pin 1 -- -- Pin 2 -- -- Pin 3 -- -- Pin 4 --
// Bus Dev Reg Map Reg Map Reg Map Reg Map
//
- {0x00,0x08,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0x00,0x00},
- {0x00,0x10,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0x01,0x00},
- {0x00,0x18,{{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8}},0x02,0x00},
- {0x00,0x20,{{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8}},0x03,0x00},
- {0x00,0x28,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0x04,0x00},
- {0x00,0x30,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0x05,0x00},
+ { 0x00, 0x08, {
+ { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }
+ }, 0x00, 0x00 },
+ { 0x00, 0x10, {
+ { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }
+ }, 0x01, 0x00 },
+ { 0x00, 0x18, {
+ { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }
+ }, 0x02, 0x00 },
+ { 0x00, 0x20, {
+ { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }
+ }, 0x03, 0x00 },
+ { 0x00, 0x28, {
+ { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }
+ }, 0x04, 0x00 },
+ { 0x00, 0x30, {
+ { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }
+ }, 0x05, 0x00 },
}
};
-LEGACY_BIOS_PLATFORM_INSTANCE mPrivateData;
-EFI_HANDLE mImageHandle = NULL;
+LEGACY_BIOS_PLATFORM_INSTANCE mPrivateData;
+EFI_HANDLE mImageHandle = NULL;
/**
Return the handles and assorted information for the specified PCI Class code
@@ -102,32 +114,32 @@ EFI_HANDLE mImageHandle = NULL;
**/
EFI_STATUS
FindAllDeviceTypes (
- IN PCI_CLASS_RECORD *PciClasses,
- IN OUT DEVICE_STRUCTURE *DeviceTable,
- IN OUT UINT16 *DeviceIndex,
- IN BOOLEAN DeviceFlags
+ IN PCI_CLASS_RECORD *PciClasses,
+ IN OUT DEVICE_STRUCTURE *DeviceTable,
+ IN OUT UINT16 *DeviceIndex,
+ IN BOOLEAN DeviceFlags
)
{
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- UINTN StartIndex;
- PCI_TYPE00 PciConfigHeader;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN Flags;
- EFI_STATUS Status;
- UINTN Index2;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ UINTN StartIndex;
+ PCI_TYPE00 PciConfigHeader;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ UINTN Flags;
+ EFI_STATUS Status;
+ UINTN Index2;
//
// Get legacy BIOS protocol as it is required to deal with Option ROMs.
//
StartIndex = *DeviceIndex;
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- (VOID**)&LegacyBios
- );
+ Status = gBS->LocateProtocol (
+ &gEfiLegacyBiosProtocolGuid,
+ NULL,
+ (VOID **)&LegacyBios
+ );
ASSERT_EFI_ERROR (Status);
//
@@ -144,7 +156,7 @@ FindAllDeviceTypes (
gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciIoProtocolGuid,
- (VOID**)&PciIo
+ (VOID **)&PciIo
);
PciIo->Pci.Read (
PciIo,
@@ -154,8 +166,9 @@ FindAllDeviceTypes (
&PciConfigHeader
);
for (Index2 = 0; PciClasses[Index2].Class != 0xff; Index2++) {
- if ((PciConfigHeader.Hdr.ClassCode[2] == PciClasses[Index2].Class) &&
- (PciConfigHeader.Hdr.ClassCode[1] == PciClasses[Index2].SubClass)) {
+ if ((PciConfigHeader.Hdr.ClassCode[2] == PciClasses[Index2].Class) &&
+ (PciConfigHeader.Hdr.ClassCode[1] == PciClasses[Index2].SubClass))
+ {
LegacyBios->CheckPciRom (
LegacyBios,
HandleBuffer[Index],
@@ -173,13 +186,14 @@ FindAllDeviceTypes (
if (
((DeviceFlags != 0) && (Flags == NO_ROM)) ||
((Flags & (ROM_FOUND | VALID_LEGACY_ROM)) == (ROM_FOUND | VALID_LEGACY_ROM))
- ) {
+ )
+ {
DeviceTable->Handle = HandleBuffer[Index];
DeviceTable->Vid = PciConfigHeader.Hdr.VendorId;
DeviceTable->Did = PciConfigHeader.Hdr.DeviceId;
DeviceTable->SvId = PciConfigHeader.Device.SubsystemVendorID;
DeviceTable->SysId = PciConfigHeader.Device.SubsystemID;
- ++ *DeviceIndex;
+ ++*DeviceIndex;
DeviceTable++;
}
}
@@ -211,8 +225,8 @@ FindAllDeviceTypes (
EFI_STATUS
EFIAPI
SmmInit (
- IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
- IN VOID *EfiToLegacy16BootTable
+ IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
+ IN VOID *EfiToLegacy16BootTable
)
{
return EFI_SUCCESS;
@@ -226,23 +240,23 @@ SmmInit (
**/
VOID
GetSelectedVgaDeviceInfo (
- OUT EFI_HANDLE *VgaHandle
+ OUT EFI_HANDLE *VgaHandle
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
- UINT8 MinBus;
- UINT8 MaxBus;
- UINTN Segment;
- UINTN Bus;
- UINTN Device;
- UINTN Function;
- UINTN SelectedAddress;
- UINTN CurrentAddress;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 Pci;
+ UINT8 MinBus;
+ UINT8 MaxBus;
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
+ UINTN SelectedAddress;
+ UINTN CurrentAddress;
//
// Initialize return to 'not found' state
@@ -253,9 +267,9 @@ GetSelectedVgaDeviceInfo (
// Initialize variable states. This is important for selecting the VGA
// device if multiple devices exist behind a single bridge.
//
- HandleCount = 0;
- HandleBuffer = NULL;
- SelectedAddress = PCI_LIB_ADDRESS(0xff, 0x1f, 0x7, 0);
+ HandleCount = 0;
+ HandleBuffer = NULL;
+ SelectedAddress = PCI_LIB_ADDRESS (0xff, 0x1f, 0x7, 0);
//
// The bus range to search for a VGA device in.
@@ -265,27 +279,27 @@ GetSelectedVgaDeviceInfo (
//
// Start to check all the pci io to find all possible VGA device
//
- HandleCount = 0;
+ HandleCount = 0;
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiPciIoProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status)) {
return;
}
for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID**)&PciIo);
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
if (!EFI_ERROR (Status)) {
//
// Determine if this is in the correct bus range.
//
Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
- if (EFI_ERROR(Status) || (Bus < MinBus || Bus > MaxBus)) {
+ if (EFI_ERROR (Status) || ((Bus < MinBus) || (Bus > MaxBus))) {
continue;
}
@@ -293,12 +307,12 @@ GetSelectedVgaDeviceInfo (
// Read device information.
//
Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint32,
- 0,
- sizeof (Pci) / sizeof (UINT32),
- &Pci
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ 0,
+ sizeof (Pci) / sizeof (UINT32),
+ &Pci
+ );
if (EFI_ERROR (Status)) {
continue;
}
@@ -309,7 +323,9 @@ GetSelectedVgaDeviceInfo (
if (!IS_PCI_VGA (&Pci)) {
continue;
}
- DEBUG ((DEBUG_INFO,
+
+ DEBUG ((
+ DEBUG_INFO,
"PCI VGA: 0x%04x:0x%04x\n",
Pci.Hdr.VendorId,
Pci.Hdr.DeviceId
@@ -319,10 +335,10 @@ GetSelectedVgaDeviceInfo (
// Currently we use the lowest numbered bus/device/function if multiple
// devices are found in the target bus range.
//
- CurrentAddress = PCI_LIB_ADDRESS(Bus, Device, Function, 0);
+ CurrentAddress = PCI_LIB_ADDRESS (Bus, Device, Function, 0);
if (CurrentAddress < SelectedAddress) {
SelectedAddress = CurrentAddress;
- *VgaHandle = HandleBuffer[Index];
+ *VgaHandle = HandleBuffer[Index];
}
}
}
@@ -330,7 +346,6 @@ GetSelectedVgaDeviceInfo (
FreePool (HandleBuffer);
}
-
/**
Returns a buffer of handles for the requested subfunction.
@@ -349,42 +364,42 @@ GetSelectedVgaDeviceInfo (
EFI_STATUS
EFIAPI
GetPlatformHandle (
- IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
- IN EFI_GET_PLATFORM_HANDLE_MODE Mode,
- IN UINT16 Type,
- OUT EFI_HANDLE **HandleBuffer,
- OUT UINTN *HandleCount,
- OUT VOID **AdditionalData OPTIONAL
+ IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
+ IN EFI_GET_PLATFORM_HANDLE_MODE Mode,
+ IN UINT16 Type,
+ OUT EFI_HANDLE **HandleBuffer,
+ OUT UINTN *HandleCount,
+ OUT VOID **AdditionalData OPTIONAL
)
{
- DEVICE_STRUCTURE LocalDevice[0x40];
- UINT32 LocalIndex;
- UINT32 Index;
- DEVICE_STRUCTURE TempDevice;
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINTN Segment;
- UINTN Bus;
- UINTN Device;
- UINTN Function;
- HDD_INFO *HddInfo;
- PCI_TYPE00 PciConfigHeader;
- UINT32 HddIndex;
- EFI_HANDLE IdeHandle;
+ DEVICE_STRUCTURE LocalDevice[0x40];
+ UINT32 LocalIndex;
+ UINT32 Index;
+ DEVICE_STRUCTURE TempDevice;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
+ HDD_INFO *HddInfo;
+ PCI_TYPE00 PciConfigHeader;
+ UINT32 HddIndex;
+ EFI_HANDLE IdeHandle;
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- PCI_CLASS_RECORD ClassLists[10];
- UINTN PriorityIndex;
+ PCI_CLASS_RECORD ClassLists[10];
+ UINTN PriorityIndex;
- static BOOLEAN bConnected = FALSE;
+ static BOOLEAN bConnected = FALSE;
- LocalIndex = 0x00;
- HddInfo = NULL;
- HddIndex = 0;
+ LocalIndex = 0x00;
+ HddInfo = NULL;
+ HddIndex = 0;
Status = gBS->LocateProtocol (
&gEfiLegacyBiosProtocolGuid,
NULL,
- (VOID**)&LegacyBios
+ (VOID **)&LegacyBios
);
//
@@ -400,9 +415,9 @@ GetPlatformHandle (
*HandleCount = (mVgaHandles[0] != NULL) ? 1 : 0;
return EFI_SUCCESS;
case EfiGetPlatformIdeHandle:
- IdeHandle = NULL;
+ IdeHandle = NULL;
if (AdditionalData != NULL) {
- HddInfo = (HDD_INFO *) *AdditionalData;
+ HddInfo = (HDD_INFO *)*AdditionalData;
}
//
@@ -417,7 +432,7 @@ GetPlatformHandle (
ClassLists[3].Class = PCI_CLASS_MASS_STORAGE;
ClassLists[3].SubClass = PCI_CLASS_MASS_STORAGE_SATADPA;
ClassLists[4].Class = 0xff;
- FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *) &LocalIndex, TRUE);
+ FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *)&LocalIndex, TRUE);
if (LocalIndex == 0) {
return EFI_NOT_FOUND;
}
@@ -449,10 +464,10 @@ GetPlatformHandle (
//
PriorityIndex = 0;
for (Index = 0; Index < LocalIndex; Index++) {
- if (LocalDevice[Index].Handle == IdeHandle && PriorityIndex == 0) {
- TempDevice = LocalDevice[PriorityIndex];
+ if ((LocalDevice[Index].Handle == IdeHandle) && (PriorityIndex == 0)) {
+ TempDevice = LocalDevice[PriorityIndex];
LocalDevice[PriorityIndex] = LocalDevice[Index];
- LocalDevice[Index] = TempDevice;
+ LocalDevice[Index] = TempDevice;
PriorityIndex++;
break;
}
@@ -464,6 +479,7 @@ GetPlatformHandle (
for (Index = 0; Index < LocalIndex; Index++) {
mDiskHandles[Index] = LocalDevice[Index].Handle;
}
+
*HandleBuffer = &mDiskHandles[0];
*HandleCount = LocalIndex;
@@ -477,11 +493,12 @@ GetPlatformHandle (
//
for (Index = 0; (Index < LocalIndex) && (AdditionalData != NULL); Index++) {
if ((LocalDevice[Index].Handle != NULL) &&
- (LocalDevice[Index].Handle == IdeHandle)) {
+ (LocalDevice[Index].Handle == IdeHandle))
+ {
Status = gBS->HandleProtocol (
LocalDevice[Index].Handle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
PciIo->Pci.Read (
PciIo,
@@ -503,14 +520,14 @@ GetPlatformHandle (
// Be sure to only fill out correct information based on platform
// configuration.
//
- HddInfo[HddIndex].Status |= HDD_PRIMARY;
- HddInfo[HddIndex].Bus = (UINT32)Bus;
- HddInfo[HddIndex].Device = (UINT32)Device;
- HddInfo[HddIndex].Function = (UINT32)Function;
- HddInfo[HddIndex + 1].Status |= HDD_SECONDARY;
- HddInfo[HddIndex + 1].Bus = (UINT32)Bus;
- HddInfo[HddIndex + 1].Device = (UINT32)Device;
- HddInfo[HddIndex + 1].Function = (UINT32)Function;
+ HddInfo[HddIndex].Status |= HDD_PRIMARY;
+ HddInfo[HddIndex].Bus = (UINT32)Bus;
+ HddInfo[HddIndex].Device = (UINT32)Device;
+ HddInfo[HddIndex].Function = (UINT32)Function;
+ HddInfo[HddIndex + 1].Status |= HDD_SECONDARY;
+ HddInfo[HddIndex + 1].Bus = (UINT32)Bus;
+ HddInfo[HddIndex + 1].Device = (UINT32)Device;
+ HddInfo[HddIndex + 1].Function = (UINT32)Function;
//
// Primary controller data
@@ -524,11 +541,12 @@ GetPlatformHandle (
(UINT16)(PciConfigHeader.Device.Bar[4] & 0xfffc);
HddInfo[HddIndex].HddIrq = PciConfigHeader.Device.InterruptLine;
} else {
- HddInfo[HddIndex].HddIrq = 14;
+ HddInfo[HddIndex].HddIrq = 14;
HddInfo[HddIndex].CommandBaseAddress = 0x1f0;
HddInfo[HddIndex].ControlBaseAddress = 0x3f6;
- HddInfo[HddIndex].BusMasterAddress = 0;
+ HddInfo[HddIndex].BusMasterAddress = 0;
}
+
HddIndex++;
//
@@ -543,27 +561,29 @@ GetPlatformHandle (
(UINT16)(HddInfo[HddIndex].BusMasterAddress + 8);
HddInfo[HddIndex].HddIrq = PciConfigHeader.Device.InterruptLine;
} else {
- HddInfo[HddIndex].HddIrq = 15;
+ HddInfo[HddIndex].HddIrq = 15;
HddInfo[HddIndex].CommandBaseAddress = 0x170;
HddInfo[HddIndex].ControlBaseAddress = 0x376;
- HddInfo[HddIndex].BusMasterAddress = 0;
+ HddInfo[HddIndex].BusMasterAddress = 0;
}
+
HddIndex++;
}
}
}
+
return EFI_SUCCESS;
case EfiGetPlatformIsaBusHandle:
- ClassLists[0].Class = (UINT8) PCI_CLASS_BRIDGE;
- ClassLists[0].SubClass = (UINT8) PCI_CLASS_BRIDGE_ISA_PDECODE;
- ClassLists[1].Class = (UINT8) PCI_CLASS_BRIDGE;
- ClassLists[1].SubClass = (UINT8) PCI_CLASS_BRIDGE_ISA;
+ ClassLists[0].Class = (UINT8)PCI_CLASS_BRIDGE;
+ ClassLists[0].SubClass = (UINT8)PCI_CLASS_BRIDGE_ISA_PDECODE;
+ ClassLists[1].Class = (UINT8)PCI_CLASS_BRIDGE;
+ ClassLists[1].SubClass = (UINT8)PCI_CLASS_BRIDGE_ISA;
ClassLists[2].Class = 0xff;
//
// Locate all found block io devices
//
- FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *) (&LocalIndex), TRUE);
+ FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *)(&LocalIndex), TRUE);
if (LocalIndex == 0) {
return EFI_NOT_FOUND;
}
@@ -573,9 +593,9 @@ GetPlatformHandle (
//
for (Index = 0; Index < LocalIndex; Index++) {
if (LocalDevice[Index].Vid == V_INTEL_VENDOR_ID) {
- TempDevice = LocalDevice[0];
- LocalDevice[0] = LocalDevice[Index];
- LocalDevice[Index] = TempDevice;
+ TempDevice = LocalDevice[0];
+ LocalDevice[0] = LocalDevice[Index];
+ LocalDevice[Index] = TempDevice;
}
}
@@ -585,13 +605,14 @@ GetPlatformHandle (
for (Index = 0; Index < LocalIndex; Index++) {
mIsaHandles[Index] = LocalDevice[Index].Handle;
}
+
*HandleBuffer = &mIsaHandles[0];
*HandleCount = LocalIndex;
return EFI_SUCCESS;
case EfiGetPlatformUsbHandle:
default:
return EFI_UNSUPPORTED;
- };
+ }
}
/**
@@ -613,13 +634,13 @@ GetPlatformHandle (
EFI_STATUS
EFIAPI
PlatformHooks (
- IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
- IN EFI_GET_PLATFORM_HOOK_MODE Mode,
- IN UINT16 Type,
- OUT EFI_HANDLE DeviceHandle OPTIONAL,
- IN OUT UINTN *Shadowaddress OPTIONAL,
- IN EFI_COMPATIBILITY16_TABLE *Compatibility16Table OPTIONAL,
- OUT VOID **AdditionalData OPTIONAL
+ IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
+ IN EFI_GET_PLATFORM_HOOK_MODE Mode,
+ IN UINT16 Type,
+ OUT EFI_HANDLE DeviceHandle OPTIONAL,
+ IN OUT UINTN *Shadowaddress OPTIONAL,
+ IN EFI_COMPATIBILITY16_TABLE *Compatibility16Table OPTIONAL,
+ OUT VOID **AdditionalData OPTIONAL
)
{
EFI_IA32_REGISTER_SET Regs;
@@ -631,7 +652,7 @@ PlatformHooks (
Status = gBS->LocateProtocol (
&gEfiLegacyBiosProtocolGuid,
NULL,
- (VOID**)&LegacyBios
+ (VOID **)&LegacyBios
);
//
@@ -639,14 +660,14 @@ PlatformHooks (
//
Regs.H.AH = 0x00;
Regs.H.AL = 0x03;
- Status = LegacyBios->Int86 (LegacyBios, 0x10, &Regs);
+ Status = LegacyBios->Int86 (LegacyBios, 0x10, &Regs);
return Status;
case EfiPlatformHookShadowServiceRoms:
return EFI_SUCCESS;
case EfiPlatformHookAfterRomInit:
default:
return EFI_UNSUPPORTED;
- };
+ }
}
/**
@@ -671,24 +692,24 @@ PlatformHooks (
EFI_STATUS
EFIAPI
GetRoutingTable (
- IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
- OUT VOID **RoutingTable,
- OUT UINTN *RoutingTableEntries,
- OUT VOID **LocalPirqTable OPTIONAL,
- OUT UINTN *PirqTableSize OPTIONAL,
- OUT VOID **LocalIrqPriorityTable OPTIONAL,
- OUT UINTN *IrqPriorityTableEntries OPTIONAL
+ IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
+ OUT VOID **RoutingTable,
+ OUT UINTN *RoutingTableEntries,
+ OUT VOID **LocalPirqTable OPTIONAL,
+ OUT UINTN *PirqTableSize OPTIONAL,
+ OUT VOID **LocalIrqPriorityTable OPTIONAL,
+ OUT UINTN *IrqPriorityTableEntries OPTIONAL
)
{
- UINT16 PTableSize;
- UINT32 Index;
- UINT8 Bus;
- UINT8 Device;
- UINT8 Function;
- UINT8 Checksum;
- UINT8 *Ptr;
- EFI_STATUS Status;
- EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
+ UINT16 PTableSize;
+ UINT32 Index;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT8 Checksum;
+ UINT8 *Ptr;
+ EFI_STATUS Status;
+ EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
Checksum = 0;
@@ -699,7 +720,7 @@ GetRoutingTable (
Status = gBS->LocateProtocol (
&gEfiLegacyInterruptProtocolGuid,
NULL,
- (VOID**)&LegacyInterrupt
+ (VOID **)&LegacyInterrupt
);
ASSERT_EFI_ERROR (Status);
LegacyInterrupt->GetLocation (
@@ -714,34 +735,35 @@ GetRoutingTable (
//
PirqTableHead.PirqTable.TableSize = PTableSize;
PirqTableHead.PirqTable.Bus = Bus;
- PirqTableHead.PirqTable.DevFun = (UINT8) ((Device << 3) + Function);
- Ptr = (UINT8 *) (&PirqTableHead);
+ PirqTableHead.PirqTable.DevFun = (UINT8)((Device << 3) + Function);
+ Ptr = (UINT8 *)(&PirqTableHead);
//
// Calculate checksum.
//
for (Index = 0; Index < PTableSize; Index++) {
- Checksum = (UINT8) (Checksum + (UINT8) *Ptr);
- Ptr += 1;
+ Checksum = (UINT8)(Checksum + (UINT8)*Ptr);
+ Ptr += 1;
}
- Checksum = (UINT8) (0x00 - Checksum);
- PirqTableHead.PirqTable.Checksum = Checksum;
+
+ Checksum = (UINT8)(0x00 - Checksum);
+ PirqTableHead.PirqTable.Checksum = Checksum;
//
// Update return values.
//
- *LocalPirqTable = (VOID *) (&PirqTableHead);
- *PirqTableSize = PTableSize;
+ *LocalPirqTable = (VOID *)(&PirqTableHead);
+ *PirqTableSize = PTableSize;
}
//
// More items to return.
//
- *RoutingTable = PirqTableHead.IrqRoutingEntry;
- *RoutingTableEntries = MAX_IRQ_ROUTING_ENTRIES;
+ *RoutingTable = PirqTableHead.IrqRoutingEntry;
+ *RoutingTableEntries = MAX_IRQ_ROUTING_ENTRIES;
if (LocalIrqPriorityTable != NULL) {
- *LocalIrqPriorityTable = IrqPriorityTable;
- *IrqPriorityTableEntries = MAX_IRQ_PRIORITY_ENTRIES;
+ *LocalIrqPriorityTable = IrqPriorityTable;
+ *IrqPriorityTableEntries = MAX_IRQ_PRIORITY_ENTRIES;
}
return EFI_SUCCESS;
@@ -767,18 +789,18 @@ GetRoutingTable (
EFI_STATUS
EFIAPI
GetPlatformInfo (
- IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
- IN EFI_GET_PLATFORM_INFO_MODE Mode,
- OUT VOID **Table,
- OUT UINTN *TableSize,
- OUT UINTN *Location,
- OUT UINTN *Alignment,
- IN UINT16 LegacySegment,
- IN UINT16 LegacyOffset
+ IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
+ IN EFI_GET_PLATFORM_INFO_MODE Mode,
+ OUT VOID **Table,
+ OUT UINTN *TableSize,
+ OUT UINTN *Location,
+ OUT UINTN *Alignment,
+ IN UINT16 LegacySegment,
+ IN UINT16 LegacyOffset
)
{
- EFI_STATUS Status;
- UINTN Index;
+ EFI_STATUS Status;
+ UINTN Index;
switch (Mode) {
case EfiGetPlatformBinarySystemRom:
@@ -791,11 +813,12 @@ GetPlatformInfo (
EFI_SECTION_RAW,
0,
Table,
- (UINTN *) TableSize
+ (UINTN *)TableSize
);
if (EFI_ERROR (Status)) {
continue;
}
+
return EFI_SUCCESS;
}
@@ -808,7 +831,7 @@ GetPlatformInfo (
case EfiGetPlatformPciExpressBase:
default:
return EFI_UNSUPPORTED;
- };
+ }
}
/**
@@ -830,34 +853,35 @@ GetPlatformInfo (
EFI_STATUS
EFIAPI
TranslatePirq (
- IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
- IN UINTN PciBus,
- IN UINTN PciDevice,
- IN UINTN PciFunction,
- IN OUT UINT8 *Pirq,
- OUT UINT8 *PciIrq
+ IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
+ IN UINTN PciBus,
+ IN UINTN PciDevice,
+ IN UINTN PciFunction,
+ IN OUT UINT8 *Pirq,
+ OUT UINT8 *PciIrq
)
{
- EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index1;
- UINT8 LocalPirq;
- UINT8 PirqData;
- UINT8 MatchData;
+ EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN Index1;
+ UINT8 LocalPirq;
+ UINT8 PirqData;
+ UINT8 MatchData;
Status = gBS->LocateProtocol (
&gEfiLegacyInterruptProtocolGuid,
NULL,
- (VOID**)&LegacyInterrupt
+ (VOID **)&LegacyInterrupt
);
ASSERT_EFI_ERROR (Status);
- LocalPirq = (UINT8) (*Pirq);
+ LocalPirq = (UINT8)(*Pirq);
for (Index = 0; Index < MAX_IRQ_ROUTING_ENTRIES; Index++) {
if ((PirqTableHead.IrqRoutingEntry[Index].Bus == PciBus) &&
- (PirqTableHead.IrqRoutingEntry[Index].Device == PciDevice)) {
- LocalPirq = (UINT8) (PirqTableHead.IrqRoutingEntry[Index].PirqEntry[LocalPirq].Pirq & 0x0f);
+ (PirqTableHead.IrqRoutingEntry[Index].Device == PciDevice))
+ {
+ LocalPirq = (UINT8)(PirqTableHead.IrqRoutingEntry[Index].PirqEntry[LocalPirq].Pirq & 0x0f);
if (LocalPirq > 4) {
LocalPirq -= 4;
}
@@ -867,8 +891,9 @@ TranslatePirq (
while (PirqData == 0) {
for (Index1 = 0; Index1 < MAX_IRQ_PRIORITY_ENTRIES; Index1++) {
if ((IrqPriorityTable[Index1].Used == MatchData) &&
- (IrqPriorityTable[Index1].Irq != 0)) {
- PirqData = IrqPriorityTable[Index1].Irq;
+ (IrqPriorityTable[Index1].Irq != 0))
+ {
+ PirqData = IrqPriorityTable[Index1].Irq;
IrqPriorityTable[Index1].Used = 0xff;
LegacyInterrupt->WritePirq (
LegacyInterrupt,
@@ -880,11 +905,10 @@ TranslatePirq (
}
if (PirqData == 0) {
-
//
// No unused interrupts, so start reusing them.
//
- MatchData = (UINT8) (~MatchData);
+ MatchData = (UINT8)(~MatchData);
}
}
@@ -896,7 +920,6 @@ TranslatePirq (
return EFI_SUCCESS;
}
-
/**
Attempt to legacy boot the BootOption. If the EFI contexted has been
compromised this function will not return.
@@ -914,26 +937,26 @@ TranslatePirq (
EFI_STATUS
EFIAPI
PrepareToBoot (
- IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
- IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
- IN VOID *BbsTable,
- IN UINT32 LoadOptionsSize,
- IN VOID *LoadOptions,
- IN VOID *EfiToLegacy16BootTable
+ IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
+ IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
+ IN VOID *BbsTable,
+ IN UINT32 LoadOptionsSize,
+ IN VOID *LoadOptions,
+ IN VOID *EfiToLegacy16BootTable
)
{
- BBS_TABLE *LocalBbsTable;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE *Legacy16BootTable;
- DEVICE_PRODUCER_DATA_HEADER *SioPtr;
- UINT16 DevicePathType;
- UINT16 Index;
- UINT16 Priority;
+ BBS_TABLE *LocalBbsTable;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE *Legacy16BootTable;
+ DEVICE_PRODUCER_DATA_HEADER *SioPtr;
+ UINT16 DevicePathType;
+ UINT16 Index;
+ UINT16 Priority;
//
// Initialize values
//
- Priority = 0;
- Legacy16BootTable = (EFI_TO_COMPATIBILITY16_BOOT_TABLE*) EfiToLegacy16BootTable;
+ Priority = 0;
+ Legacy16BootTable = (EFI_TO_COMPATIBILITY16_BOOT_TABLE *)EfiToLegacy16BootTable;
//
// Set how Gate A20 is gated by hardware
@@ -943,7 +966,7 @@ PrepareToBoot (
SioPtr->Flags.A20Port90 = 1;
SioPtr->MousePresent = 1;
- LocalBbsTable = BbsTable;
+ LocalBbsTable = BbsTable;
//
// There are 2 cases that must be covered.
@@ -966,8 +989,9 @@ PrepareToBoot (
if ((LocalBbsTable[Index].BootPriority != BBS_UNPRIORITIZED_ENTRY) &&
(LocalBbsTable[Index].BootPriority != BBS_IGNORE_ENTRY) &&
(LocalBbsTable[Index].BootPriority != BBS_LOWEST_PRIORITY) &&
- (Priority <= LocalBbsTable[Index].BootPriority)) {
- Priority = (UINT16) (LocalBbsTable[Index].BootPriority + 1);
+ (Priority <= LocalBbsTable[Index].BootPriority))
+ {
+ Priority = (UINT16)(LocalBbsTable[Index].BootPriority + 1);
}
}
@@ -978,28 +1002,32 @@ PrepareToBoot (
case BBS_EMBED_NETWORK:
for (Index = 0; Index < Legacy16BootTable->NumberBbsEntries; Index++) {
if ((LocalBbsTable[Index].BootPriority == BBS_UNPRIORITIZED_ENTRY) &&
- (LocalBbsTable[Index].DeviceType == DevicePathType)) {
+ (LocalBbsTable[Index].DeviceType == DevicePathType))
+ {
LocalBbsTable[Index].BootPriority = Priority;
++Priority;
}
}
+
break;
case BBS_BEV_DEVICE:
for (Index = 0; Index < Legacy16BootTable->NumberBbsEntries; Index++) {
if ((LocalBbsTable[Index].BootPriority == BBS_UNPRIORITIZED_ENTRY) &&
(LocalBbsTable[Index].Class == 01) &&
- (LocalBbsTable[Index].SubClass == 01)) {
+ (LocalBbsTable[Index].SubClass == 01))
+ {
LocalBbsTable[Index].BootPriority = Priority;
++Priority;
}
}
+
break;
case BBS_USB:
case BBS_PCMCIA:
case BBS_UNKNOWN:
default:
break;
- };
+ }
//
// Set priority for rest of devices
@@ -1014,7 +1042,6 @@ PrepareToBoot (
return EFI_SUCCESS;
}
-
/**
Initialize Legacy Platform support
@@ -1026,16 +1053,16 @@ LegacyBiosPlatformInstall (
VOID
)
{
- EFI_STATUS Status;
- LEGACY_BIOS_PLATFORM_INSTANCE *Private;
+ EFI_STATUS Status;
+ LEGACY_BIOS_PLATFORM_INSTANCE *Private;
mImageHandle = gImageHandle;
- Private = &mPrivateData;
+ Private = &mPrivateData;
//
// Grab a copy of all the protocols we depend on.
//
- Private->Signature = LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE;
+ Private->Signature = LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE;
Private->LegacyBiosPlatform.GetPlatformInfo = GetPlatformInfo;
Private->LegacyBiosPlatform.GetPlatformHandle = GetPlatformHandle;
Private->LegacyBiosPlatform.SmmInit = SmmInit;
@@ -1043,17 +1070,17 @@ LegacyBiosPlatformInstall (
Private->LegacyBiosPlatform.GetRoutingTable = GetRoutingTable;
Private->LegacyBiosPlatform.TranslatePirq = TranslatePirq;
Private->LegacyBiosPlatform.PrepareToBoot = PrepareToBoot;
- Private->ImageHandle = gImageHandle;
+ Private->ImageHandle = gImageHandle;
//
// Make a new handle and install the protocol
//
Private->Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Private->Handle,
- &gEfiLegacyBiosPlatformProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Private->LegacyBiosPlatform
- );
+ Status = gBS->InstallProtocolInterface (
+ &Private->Handle,
+ &gEfiLegacyBiosPlatformProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &Private->LegacyBiosPlatform
+ );
return Status;
}
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h b/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h
index 1479efc749..7dddd5200f 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h
@@ -38,54 +38,54 @@
//
// PIRQ information constants.
//
-#define MAX_IRQ_ROUTING_ENTRIES 6
-#define MAX_IRQ_PRIORITY_ENTRIES 7
+#define MAX_IRQ_ROUTING_ENTRIES 6
+#define MAX_IRQ_PRIORITY_ENTRIES 7
-#define V_INTEL_VENDOR_ID 0x8086
-#define V_PIIX4_IDE_DEVICE_ID 0x7010
+#define V_INTEL_VENDOR_ID 0x8086
+#define V_PIIX4_IDE_DEVICE_ID 0x7010
//
// Type declarations
//
typedef struct {
- UINT8 SetupValue;
- UINT16 DeviceType;
- UINT8 Class;
- UINT8 SubClass;
+ UINT8 SetupValue;
+ UINT16 DeviceType;
+ UINT8 Class;
+ UINT8 SubClass;
} EFI_SETUP_BBS_MAP;
typedef struct {
- UINT8 Class;
- UINT8 SubClass;
+ UINT8 Class;
+ UINT8 SubClass;
} PCI_CLASS_RECORD;
typedef struct {
- EFI_LEGACY_PIRQ_TABLE_HEADER PirqTable;
- EFI_LEGACY_IRQ_ROUTING_ENTRY IrqRoutingEntry[MAX_IRQ_ROUTING_ENTRIES];
+ EFI_LEGACY_PIRQ_TABLE_HEADER PirqTable;
+ EFI_LEGACY_IRQ_ROUTING_ENTRY IrqRoutingEntry[MAX_IRQ_ROUTING_ENTRIES];
} EFI_LEGACY_PIRQ_TABLE;
typedef struct {
- EFI_HANDLE Handle;
- UINT16 Vid;
- UINT16 Did;
- UINT16 SvId;
- UINT16 SysId;
+ EFI_HANDLE Handle;
+ UINT16 Vid;
+ UINT16 Did;
+ UINT16 SvId;
+ UINT16 SysId;
} DEVICE_STRUCTURE;
typedef struct {
- EFI_GUID FileName;
- UINTN Valid;
+ EFI_GUID FileName;
+ UINTN Valid;
} SYSTEM_ROM_TABLE;
typedef struct {
- UINT32 Signature;
- EFI_HANDLE Handle;
- EFI_LEGACY_BIOS_PLATFORM_PROTOCOL LegacyBiosPlatform;
- EFI_HANDLE ImageHandle;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ UINT32 Signature;
+ EFI_HANDLE Handle;
+ EFI_LEGACY_BIOS_PLATFORM_PROTOCOL LegacyBiosPlatform;
+ EFI_HANDLE ImageHandle;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
} LEGACY_BIOS_PLATFORM_INSTANCE;
-#define LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE SIGNATURE_32('P','B','I','O')
+#define LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE SIGNATURE_32('P','B','I','O')
#define LEGACY_BIOS_PLATFORM_INSTANCE_FROM_THIS(this) \
CR (this, \
@@ -95,4 +95,3 @@ typedef struct {
)
#endif
-
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
index fe9ae27c9d..4969c88dc3 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
@@ -29,55 +29,55 @@
// 0xEC000-0xEFFFF 0x5f 0x96 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal
// 0xF0000-0xFFFFF 0x59 0x90 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal
//
-STATIC LEGACY_MEMORY_SECTION_INFO mSectionArray[] = {
- {0xC0000, SIZE_16KB, FALSE, FALSE},
- {0xC4000, SIZE_16KB, FALSE, FALSE},
- {0xC8000, SIZE_16KB, FALSE, FALSE},
- {0xCC000, SIZE_16KB, FALSE, FALSE},
- {0xD0000, SIZE_16KB, FALSE, FALSE},
- {0xD4000, SIZE_16KB, FALSE, FALSE},
- {0xD8000, SIZE_16KB, FALSE, FALSE},
- {0xDC000, SIZE_16KB, FALSE, FALSE},
- {0xE0000, SIZE_16KB, FALSE, FALSE},
- {0xE4000, SIZE_16KB, FALSE, FALSE},
- {0xE8000, SIZE_16KB, FALSE, FALSE},
- {0xEC000, SIZE_16KB, FALSE, FALSE},
- {0xF0000, SIZE_64KB, FALSE, FALSE}
+STATIC LEGACY_MEMORY_SECTION_INFO mSectionArray[] = {
+ { 0xC0000, SIZE_16KB, FALSE, FALSE },
+ { 0xC4000, SIZE_16KB, FALSE, FALSE },
+ { 0xC8000, SIZE_16KB, FALSE, FALSE },
+ { 0xCC000, SIZE_16KB, FALSE, FALSE },
+ { 0xD0000, SIZE_16KB, FALSE, FALSE },
+ { 0xD4000, SIZE_16KB, FALSE, FALSE },
+ { 0xD8000, SIZE_16KB, FALSE, FALSE },
+ { 0xDC000, SIZE_16KB, FALSE, FALSE },
+ { 0xE0000, SIZE_16KB, FALSE, FALSE },
+ { 0xE4000, SIZE_16KB, FALSE, FALSE },
+ { 0xE8000, SIZE_16KB, FALSE, FALSE },
+ { 0xEC000, SIZE_16KB, FALSE, FALSE },
+ { 0xF0000, SIZE_64KB, FALSE, FALSE }
};
STATIC PAM_REGISTER_VALUE mRegisterValues440[] = {
- {PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x01, 0x02},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x10, 0x20},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x01, 0x02},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x10, 0x20},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x01, 0x02},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x10, 0x20},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x01, 0x02},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x10, 0x20},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x01, 0x02},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x10, 0x20},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x01, 0x02},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x10, 0x20},
- {PMC_REGISTER_PIIX4 (PIIX4_PAM0), 0x10, 0x20}
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x01, 0x02 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x10, 0x20 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x01, 0x02 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x10, 0x20 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x01, 0x02 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x10, 0x20 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x01, 0x02 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x10, 0x20 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x01, 0x02 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x10, 0x20 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x01, 0x02 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x10, 0x20 },
+ { PMC_REGISTER_PIIX4 (PIIX4_PAM0), 0x10, 0x20 }
};
STATIC PAM_REGISTER_VALUE mRegisterValuesQ35[] = {
- {DRAMC_REGISTER_Q35 (MCH_PAM1), 0x01, 0x02},
- {DRAMC_REGISTER_Q35 (MCH_PAM1), 0x10, 0x20},
- {DRAMC_REGISTER_Q35 (MCH_PAM2), 0x01, 0x02},
- {DRAMC_REGISTER_Q35 (MCH_PAM2), 0x10, 0x20},
- {DRAMC_REGISTER_Q35 (MCH_PAM3), 0x01, 0x02},
- {DRAMC_REGISTER_Q35 (MCH_PAM3), 0x10, 0x20},
- {DRAMC_REGISTER_Q35 (MCH_PAM4), 0x01, 0x02},
- {DRAMC_REGISTER_Q35 (MCH_PAM4), 0x10, 0x20},
- {DRAMC_REGISTER_Q35 (MCH_PAM5), 0x01, 0x02},
- {DRAMC_REGISTER_Q35 (MCH_PAM5), 0x10, 0x20},
- {DRAMC_REGISTER_Q35 (MCH_PAM6), 0x01, 0x02},
- {DRAMC_REGISTER_Q35 (MCH_PAM6), 0x10, 0x20},
- {DRAMC_REGISTER_Q35 (MCH_PAM0), 0x10, 0x20}
+ { DRAMC_REGISTER_Q35 (MCH_PAM1), 0x01, 0x02 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM1), 0x10, 0x20 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM2), 0x01, 0x02 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM2), 0x10, 0x20 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM3), 0x01, 0x02 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM3), 0x10, 0x20 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM4), 0x01, 0x02 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM4), 0x10, 0x20 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM5), 0x01, 0x02 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM5), 0x10, 0x20 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM6), 0x01, 0x02 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM6), 0x10, 0x20 },
+ { DRAMC_REGISTER_Q35 (MCH_PAM0), 0x10, 0x20 }
};
-STATIC PAM_REGISTER_VALUE *mRegisterValues;
+STATIC PAM_REGISTER_VALUE *mRegisterValues;
//
// Handle used to install the Legacy Region Protocol
@@ -98,25 +98,26 @@ STATIC EFI_LEGACY_REGION2_PROTOCOL mLegacyRegion2 = {
STATIC
EFI_STATUS
LegacyRegionManipulationInternal (
- IN UINT32 Start,
- IN UINT32 Length,
- IN BOOLEAN *ReadEnable,
- IN BOOLEAN *WriteEnable,
- OUT UINT32 *Granularity
+ IN UINT32 Start,
+ IN UINT32 Length,
+ IN BOOLEAN *ReadEnable,
+ IN BOOLEAN *WriteEnable,
+ OUT UINT32 *Granularity
)
{
- UINT32 EndAddress;
- UINTN Index;
- UINTN StartIndex;
+ UINT32 EndAddress;
+ UINTN Index;
+ UINTN StartIndex;
//
// Validate input parameters.
//
- if (Length == 0 || Granularity == NULL) {
+ if ((Length == 0) || (Granularity == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
EndAddress = Start + Length - 1;
- if ((Start < PAM_BASE_ADDRESS) || EndAddress > PAM_LIMIT_ADDRESS) {
+ if ((Start < PAM_BASE_ADDRESS) || (EndAddress > PAM_LIMIT_ADDRESS)) {
return EFI_INVALID_PARAMETER;
}
@@ -130,6 +131,7 @@ LegacyRegionManipulationInternal (
break;
}
}
+
ASSERT (Index < ARRAY_SIZE (mSectionArray));
//
@@ -145,10 +147,11 @@ LegacyRegionManipulationInternal (
} else {
PciAnd8 (
mRegisterValues[Index].PAMRegPciLibAddress,
- (UINT8) (~mRegisterValues[Index].ReadEnableData)
+ (UINT8)(~mRegisterValues[Index].ReadEnableData)
);
}
}
+
if (WriteEnable != NULL) {
if (*WriteEnable) {
PciOr8 (
@@ -158,7 +161,7 @@ LegacyRegionManipulationInternal (
} else {
PciAnd8 (
mRegisterValues[Index].PAMRegPciLibAddress,
- (UINT8) (~mRegisterValues[Index].WriteEnableData)
+ (UINT8)(~mRegisterValues[Index].WriteEnableData)
);
}
}
@@ -171,6 +174,7 @@ LegacyRegionManipulationInternal (
break;
}
}
+
ASSERT (Index < ARRAY_SIZE (mSectionArray));
return EFI_SUCCESS;
@@ -179,30 +183,31 @@ LegacyRegionManipulationInternal (
STATIC
EFI_STATUS
LegacyRegionGetInfoInternal (
- OUT UINT32 *DescriptorCount,
- OUT LEGACY_MEMORY_SECTION_INFO **Descriptor
+ OUT UINT32 *DescriptorCount,
+ OUT LEGACY_MEMORY_SECTION_INFO **Descriptor
)
{
- UINTN Index;
- UINT8 PamValue;
+ UINTN Index;
+ UINT8 PamValue;
//
// Check input parameters
//
- if (DescriptorCount == NULL || Descriptor == NULL) {
+ if ((DescriptorCount == NULL) || (Descriptor == NULL)) {
return EFI_INVALID_PARAMETER;
}
//
// Fill in current status of legacy region.
//
- *DescriptorCount = sizeof(mSectionArray) / sizeof (mSectionArray[0]);
+ *DescriptorCount = sizeof (mSectionArray) / sizeof (mSectionArray[0]);
for (Index = 0; Index < *DescriptorCount; Index++) {
- PamValue = PciRead8 (mRegisterValues[Index].PAMRegPciLibAddress);
+ PamValue = PciRead8 (mRegisterValues[Index].PAMRegPciLibAddress);
mSectionArray[Index].ReadEnabled = FALSE;
if ((PamValue & mRegisterValues[Index].ReadEnableData) != 0) {
mSectionArray[Index].ReadEnabled = TRUE;
}
+
mSectionArray[Index].WriteEnabled = FALSE;
if ((PamValue & mRegisterValues[Index].WriteEnableData) != 0) {
mSectionArray[Index].WriteEnabled = TRUE;
@@ -250,7 +255,6 @@ LegacyRegion2Decode (
return LegacyRegionManipulationInternal (Start, Length, On, NULL, Granularity);
}
-
/**
Modify the hardware to disallow memory attribute changes in a region.
@@ -279,10 +283,10 @@ LegacyRegion2Decode (
EFI_STATUS
EFIAPI
LegacyRegion2BootLock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity
)
{
if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
@@ -292,7 +296,6 @@ LegacyRegion2BootLock (
return EFI_UNSUPPORTED;
}
-
/**
Modify the hardware to disallow memory writes in a region.
@@ -316,10 +319,10 @@ LegacyRegion2BootLock (
EFI_STATUS
EFIAPI
LegacyRegion2Lock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity
)
{
BOOLEAN WriteEnable;
@@ -328,7 +331,6 @@ LegacyRegion2Lock (
return LegacyRegionManipulationInternal (Start, Length, NULL, &WriteEnable, Granularity);
}
-
/**
Modify the hardware to allow memory writes in a region.
@@ -391,11 +393,11 @@ LegacyRegionGetInfo (
OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor
)
{
- LEGACY_MEMORY_SECTION_INFO *SectionInfo;
- UINT32 SectionCount;
- EFI_LEGACY_REGION_DESCRIPTOR *DescriptorArray;
- UINTN Index;
- UINTN DescriptorIndex;
+ LEGACY_MEMORY_SECTION_INFO *SectionInfo;
+ UINT32 SectionCount;
+ EFI_LEGACY_REGION_DESCRIPTOR *DescriptorArray;
+ UINTN Index;
+ UINTN DescriptorIndex;
//
// Get section numbers and information
@@ -416,10 +418,11 @@ LegacyRegionGetInfo (
DescriptorArray[DescriptorIndex].Length = SectionInfo[Index].Length;
DescriptorArray[DescriptorIndex].Granularity = SectionInfo[Index].Length;
if (SectionInfo[Index].ReadEnabled) {
- DescriptorArray[DescriptorIndex].Attribute = LegacyRegionDecoded;
+ DescriptorArray[DescriptorIndex].Attribute = LegacyRegionDecoded;
} else {
- DescriptorArray[DescriptorIndex].Attribute = LegacyRegionNotDecoded;
+ DescriptorArray[DescriptorIndex].Attribute = LegacyRegionNotDecoded;
}
+
DescriptorIndex++;
//
@@ -433,6 +436,7 @@ LegacyRegionGetInfo (
} else {
DescriptorArray[DescriptorIndex].Attribute = LegacyRegionWriteDisabled;
}
+
DescriptorIndex++;
//
@@ -445,7 +449,7 @@ LegacyRegionGetInfo (
DescriptorIndex++;
}
- *DescriptorCount = (UINT32) DescriptorIndex;
+ *DescriptorCount = (UINT32)DescriptorIndex;
*Descriptor = DescriptorArray;
return EFI_SUCCESS;
@@ -470,17 +474,21 @@ LegacyRegionInit (
//
HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);
switch (HostBridgeDevId) {
- case INTEL_82441_DEVICE_ID:
- mRegisterValues = mRegisterValues440;
- break;
- case INTEL_Q35_MCH_DEVICE_ID:
- mRegisterValues = mRegisterValuesQ35;
- break;
- default:
- DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
- __FUNCTION__, HostBridgeDevId));
- ASSERT (FALSE);
- return RETURN_UNSUPPORTED;
+ case INTEL_82441_DEVICE_ID:
+ mRegisterValues = mRegisterValues440;
+ break;
+ case INTEL_Q35_MCH_DEVICE_ID:
+ mRegisterValues = mRegisterValuesQ35;
+ break;
+ default:
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Unknown Host Bridge Device ID: 0x%04x\n",
+ __FUNCTION__,
+ HostBridgeDevId
+ ));
+ ASSERT (FALSE);
+ return RETURN_UNSUPPORTED;
}
//
@@ -488,11 +496,11 @@ LegacyRegionInit (
//
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
- &gEfiLegacyRegion2ProtocolGuid, &mLegacyRegion2,
+ &gEfiLegacyRegion2ProtocolGuid,
+ &mLegacyRegion2,
NULL
);
ASSERT_EFI_ERROR (Status);
return Status;
}
-
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h
index e18cb97949..8ffe42a6a5 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h
@@ -31,19 +31,19 @@
// Describes Legacy Region blocks and status.
//
typedef struct {
- UINT32 Start;
- UINT32 Length;
- BOOLEAN ReadEnabled;
- BOOLEAN WriteEnabled;
+ UINT32 Start;
+ UINT32 Length;
+ BOOLEAN ReadEnabled;
+ BOOLEAN WriteEnabled;
} LEGACY_MEMORY_SECTION_INFO;
//
// Provides a map of the PAM registers and bits used to set Read/Write access.
//
typedef struct {
- UINTN PAMRegPciLibAddress;
- UINT8 ReadEnableData;
- UINT8 WriteEnableData;
+ UINTN PAMRegPciLibAddress;
+ UINT8 ReadEnableData;
+ UINT8 WriteEnableData;
} PAM_REGISTER_VALUE;
/**
@@ -103,10 +103,10 @@ LegacyRegion2Decode (
EFI_STATUS
EFIAPI
LegacyRegion2Lock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity
);
/**
@@ -137,10 +137,10 @@ LegacyRegion2Lock (
EFI_STATUS
EFIAPI
LegacyRegion2BootLock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity
);
/**
@@ -200,4 +200,3 @@ LegacyRegionGetInfo (
);
#endif
-
diff --git a/OvmfPkg/Csm/Include/Framework/BootScript.h b/OvmfPkg/Csm/Include/Framework/BootScript.h
index a3518ea837..ea1d03cf47 100644
--- a/OvmfPkg/Csm/Include/Framework/BootScript.h
+++ b/OvmfPkg/Csm/Include/Framework/BootScript.h
@@ -17,25 +17,24 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// S3 Boot Script Table identifier.
///
-#define FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE 0x00
+#define FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE 0x00
///
/// The opcode is used to add a record for memory reads of the memory location and continues when the
/// exit criteria is satisfied, or after a defined duration.
///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_MEM_POLL_OPCODE 0x09
+#define FRAMEWORK_EFI_BOOT_SCRIPT_MEM_POLL_OPCODE 0x09
///
/// The opcode is used to add a record for dispatching specified arbitrary code into a specified
/// boot script table.
///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE 0x0D
+#define FRAMEWORK_EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE 0x0D
///
/// The opcode indicates the start of the boot script table.
///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_TABLE_OPCODE 0xAA
+#define FRAMEWORK_EFI_BOOT_SCRIPT_TABLE_OPCODE 0xAA
///
/// The opcode indicates the end of the boot script table.
///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_TERMINATE_OPCODE 0xFF
-
+#define FRAMEWORK_EFI_BOOT_SCRIPT_TERMINATE_OPCODE 0xFF
#endif
diff --git a/OvmfPkg/Csm/Include/Framework/DxeCis.h b/OvmfPkg/Csm/Include/Framework/DxeCis.h
index 98a947e420..d2ee61d681 100644
--- a/OvmfPkg/Csm/Include/Framework/DxeCis.h
+++ b/OvmfPkg/Csm/Include/Framework/DxeCis.h
@@ -33,35 +33,35 @@ typedef struct {
//
// Table header for the Framework EFI Runtime Services Table
//
- EFI_TABLE_HEADER Hdr;
+ EFI_TABLE_HEADER Hdr;
//
// Time services
//
- EFI_GET_TIME GetTime;
- EFI_SET_TIME SetTime;
- EFI_GET_WAKEUP_TIME GetWakeupTime;
- EFI_SET_WAKEUP_TIME SetWakeupTime;
+ EFI_GET_TIME GetTime;
+ EFI_SET_TIME SetTime;
+ EFI_GET_WAKEUP_TIME GetWakeupTime;
+ EFI_SET_WAKEUP_TIME SetWakeupTime;
//
// Virtual memory services
//
- EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
- EFI_CONVERT_POINTER ConvertPointer;
+ EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
+ EFI_CONVERT_POINTER ConvertPointer;
//
// Variable services
//
- EFI_GET_VARIABLE GetVariable;
- EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
- EFI_SET_VARIABLE SetVariable;
+ EFI_GET_VARIABLE GetVariable;
+ EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
+ EFI_SET_VARIABLE SetVariable;
//
// Misc
//
- EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
- EFI_RESET_SYSTEM ResetSystem;
+ EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
+ EFI_RESET_SYSTEM ResetSystem;
///
/// A Framework extension to the EFI 1.10 runtime table.
/// It was moved to a protocol to avoid conflict with UEFI 2.0.
///
- EFI_REPORT_STATUS_CODE ReportStatusCode;
+ EFI_REPORT_STATUS_CODE ReportStatusCode;
} FRAMEWORK_EFI_RUNTIME_SERVICES;
///
@@ -71,94 +71,94 @@ typedef struct {
///
/// The table header for the EFI Boot Services Table.
///
- EFI_TABLE_HEADER Hdr;
+ EFI_TABLE_HEADER Hdr;
//
// Task Priority Services
//
- EFI_RAISE_TPL RaiseTPL;
- EFI_RESTORE_TPL RestoreTPL;
+ EFI_RAISE_TPL RaiseTPL;
+ EFI_RESTORE_TPL RestoreTPL;
//
// Memory Services
//
- EFI_ALLOCATE_PAGES AllocatePages;
- EFI_FREE_PAGES FreePages;
- EFI_GET_MEMORY_MAP GetMemoryMap;
- EFI_ALLOCATE_POOL AllocatePool;
- EFI_FREE_POOL FreePool;
+ EFI_ALLOCATE_PAGES AllocatePages;
+ EFI_FREE_PAGES FreePages;
+ EFI_GET_MEMORY_MAP GetMemoryMap;
+ EFI_ALLOCATE_POOL AllocatePool;
+ EFI_FREE_POOL FreePool;
//
// Event & Timer Services
//
- EFI_CREATE_EVENT CreateEvent;
- EFI_SET_TIMER SetTimer;
- EFI_WAIT_FOR_EVENT WaitForEvent;
- EFI_SIGNAL_EVENT SignalEvent;
- EFI_CLOSE_EVENT CloseEvent;
- EFI_CHECK_EVENT CheckEvent;
+ EFI_CREATE_EVENT CreateEvent;
+ EFI_SET_TIMER SetTimer;
+ EFI_WAIT_FOR_EVENT WaitForEvent;
+ EFI_SIGNAL_EVENT SignalEvent;
+ EFI_CLOSE_EVENT CloseEvent;
+ EFI_CHECK_EVENT CheckEvent;
//
// Protocol Handler Services
//
- EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
- EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
- EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
- EFI_HANDLE_PROTOCOL HandleProtocol;
- EFI_HANDLE_PROTOCOL PcHandleProtocol;
- EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
- EFI_LOCATE_HANDLE LocateHandle;
- EFI_LOCATE_DEVICE_PATH LocateDevicePath;
- EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
+ EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
+ EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
+ EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
+ EFI_HANDLE_PROTOCOL HandleProtocol;
+ EFI_HANDLE_PROTOCOL PcHandleProtocol;
+ EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
+ EFI_LOCATE_HANDLE LocateHandle;
+ EFI_LOCATE_DEVICE_PATH LocateDevicePath;
+ EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
//
// Image Services
//
- EFI_IMAGE_LOAD LoadImage;
- EFI_IMAGE_START StartImage;
- EFI_EXIT Exit;
- EFI_IMAGE_UNLOAD UnloadImage;
- EFI_EXIT_BOOT_SERVICES ExitBootServices;
+ EFI_IMAGE_LOAD LoadImage;
+ EFI_IMAGE_START StartImage;
+ EFI_EXIT Exit;
+ EFI_IMAGE_UNLOAD UnloadImage;
+ EFI_EXIT_BOOT_SERVICES ExitBootServices;
//
// Miscellaneous Services
//
- EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
- EFI_STALL Stall;
- EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
+ EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
+ EFI_STALL Stall;
+ EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
//
// DriverSupport Services
//
- EFI_CONNECT_CONTROLLER ConnectController;
- EFI_DISCONNECT_CONTROLLER DisconnectController;
+ EFI_CONNECT_CONTROLLER ConnectController;
+ EFI_DISCONNECT_CONTROLLER DisconnectController;
//
// Open and Close Protocol Services
//
- EFI_OPEN_PROTOCOL OpenProtocol;
- EFI_CLOSE_PROTOCOL CloseProtocol;
- EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
+ EFI_OPEN_PROTOCOL OpenProtocol;
+ EFI_CLOSE_PROTOCOL CloseProtocol;
+ EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
//
// Library Services
//
- EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
- EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
- EFI_LOCATE_PROTOCOL LocateProtocol;
- EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
- EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
+ EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
+ EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
+ EFI_LOCATE_PROTOCOL LocateProtocol;
+ EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
+ EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
//
// 32-bit CRC Services
//
- EFI_CALCULATE_CRC32 CalculateCrc32;
+ EFI_CALCULATE_CRC32 CalculateCrc32;
//
// Miscellaneous Services
//
- EFI_COPY_MEM CopyMem;
- EFI_SET_MEM SetMem;
+ EFI_COPY_MEM CopyMem;
+ EFI_SET_MEM SetMem;
} FRAMEWORK_EFI_BOOT_SERVICES;
#define EFI_EVENT_RUNTIME_CONTEXT 0x20000000
@@ -167,4 +167,3 @@ typedef struct {
#define EFI_EVENT_SIGNAL_LEGACY_BOOT 0x00000204
#endif
-
diff --git a/OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h b/OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h
index e2b5a28b8b..8da429286a 100644
--- a/OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h
+++ b/OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h
@@ -17,38 +17,38 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// Firmware Volume Block Attributes bit definitions.
///@{
-#define EFI_FVB_READ_DISABLED_CAP 0x00000001
-#define EFI_FVB_READ_ENABLED_CAP 0x00000002
-#define EFI_FVB_READ_STATUS 0x00000004
+#define EFI_FVB_READ_DISABLED_CAP 0x00000001
+#define EFI_FVB_READ_ENABLED_CAP 0x00000002
+#define EFI_FVB_READ_STATUS 0x00000004
#define EFI_FVB_WRITE_DISABLED_CAP 0x00000008
#define EFI_FVB_WRITE_ENABLED_CAP 0x00000010
#define EFI_FVB_WRITE_STATUS 0x00000020
-#define EFI_FVB_LOCK_CAP 0x00000040
-#define EFI_FVB_LOCK_STATUS 0x00000080
+#define EFI_FVB_LOCK_CAP 0x00000040
+#define EFI_FVB_LOCK_STATUS 0x00000080
-#define EFI_FVB_STICKY_WRITE 0x00000200
-#define EFI_FVB_MEMORY_MAPPED 0x00000400
-#define EFI_FVB_ERASE_POLARITY 0x00000800
+#define EFI_FVB_STICKY_WRITE 0x00000200
+#define EFI_FVB_MEMORY_MAPPED 0x00000400
+#define EFI_FVB_ERASE_POLARITY 0x00000800
-#define EFI_FVB_ALIGNMENT_CAP 0x00008000
-#define EFI_FVB_ALIGNMENT_2 0x00010000
-#define EFI_FVB_ALIGNMENT_4 0x00020000
-#define EFI_FVB_ALIGNMENT_8 0x00040000
-#define EFI_FVB_ALIGNMENT_16 0x00080000
-#define EFI_FVB_ALIGNMENT_32 0x00100000
-#define EFI_FVB_ALIGNMENT_64 0x00200000
-#define EFI_FVB_ALIGNMENT_128 0x00400000
-#define EFI_FVB_ALIGNMENT_256 0x00800000
-#define EFI_FVB_ALIGNMENT_512 0x01000000
-#define EFI_FVB_ALIGNMENT_1K 0x02000000
-#define EFI_FVB_ALIGNMENT_2K 0x04000000
-#define EFI_FVB_ALIGNMENT_4K 0x08000000
-#define EFI_FVB_ALIGNMENT_8K 0x10000000
-#define EFI_FVB_ALIGNMENT_16K 0x20000000
-#define EFI_FVB_ALIGNMENT_32K 0x40000000
-#define EFI_FVB_ALIGNMENT_64K 0x80000000
+#define EFI_FVB_ALIGNMENT_CAP 0x00008000
+#define EFI_FVB_ALIGNMENT_2 0x00010000
+#define EFI_FVB_ALIGNMENT_4 0x00020000
+#define EFI_FVB_ALIGNMENT_8 0x00040000
+#define EFI_FVB_ALIGNMENT_16 0x00080000
+#define EFI_FVB_ALIGNMENT_32 0x00100000
+#define EFI_FVB_ALIGNMENT_64 0x00200000
+#define EFI_FVB_ALIGNMENT_128 0x00400000
+#define EFI_FVB_ALIGNMENT_256 0x00800000
+#define EFI_FVB_ALIGNMENT_512 0x01000000
+#define EFI_FVB_ALIGNMENT_1K 0x02000000
+#define EFI_FVB_ALIGNMENT_2K 0x04000000
+#define EFI_FVB_ALIGNMENT_4K 0x08000000
+#define EFI_FVB_ALIGNMENT_8K 0x10000000
+#define EFI_FVB_ALIGNMENT_16K 0x20000000
+#define EFI_FVB_ALIGNMENT_32K 0x40000000
+#define EFI_FVB_ALIGNMENT_64K 0x80000000
///@}
/// This is a simple macro defined as the set of all FV Block Attributes signifying capabilities.
@@ -68,12 +68,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
* @param Bit A value indicating the bit(s) to test.
* If multiple bits are set, the logical OR of their tests is the expression's value.
**/
-#define EFI_TEST_FFS_ATTRIBUTES_BIT( FvbAttributes, TestAttributes, Bit) \
+#define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
((BOOLEAN) \
((FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit)) \
)
/// A simple macro defined as the set of all FV Block Attribute bits that indicate status.
-#define EFI_FVB_STATUS (EFI_FVB_READ_STATUS | EFI_FVB_WRITE_STATUS | EFI_FVB_LOCK_STATUS)
+#define EFI_FVB_STATUS (EFI_FVB_READ_STATUS | EFI_FVB_WRITE_STATUS | EFI_FVB_LOCK_STATUS)
-#endif /* __EFI_FIRMWARE_VOLUME_HEADER_H__ */
+#endif /* __EFI_FIRMWARE_VOLUME_HEADER_H__ */
diff --git a/OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h b/OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h
index c77e39b4c0..02fadd1351 100644
--- a/OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h
+++ b/OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h
@@ -17,16 +17,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Bit values for AuthenticationStatus
//
-#define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001
-#define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED 0x000002
-#define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED 0x000004
-#define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED 0x000008
-#define EFI_AGGREGATE_AUTH_STATUS_ALL 0x00000f
+#define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001
+#define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED 0x000002
+#define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED 0x000004
+#define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED 0x000008
+#define EFI_AGGREGATE_AUTH_STATUS_ALL 0x00000f
-#define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE 0x010000
-#define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED 0x020000
-#define EFI_LOCAL_AUTH_STATUS_NOT_TESTED 0x040000
-#define EFI_LOCAL_AUTH_STATUS_TEST_FAILED 0x080000
-#define EFI_LOCAL_AUTH_STATUS_ALL 0x0f0000
+#define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE 0x010000
+#define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED 0x020000
+#define EFI_LOCAL_AUTH_STATUS_NOT_TESTED 0x040000
+#define EFI_LOCAL_AUTH_STATUS_TEST_FAILED 0x080000
+#define EFI_LOCAL_AUTH_STATUS_ALL 0x0f0000
#endif
diff --git a/OvmfPkg/Csm/Include/Framework/FrameworkInternalFormRepresentation.h b/OvmfPkg/Csm/Include/Framework/FrameworkInternalFormRepresentation.h
index f10fc52312..2dcf6380e3 100644
--- a/OvmfPkg/Csm/Include/Framework/FrameworkInternalFormRepresentation.h
+++ b/OvmfPkg/Csm/Include/Framework/FrameworkInternalFormRepresentation.h
@@ -14,72 +14,72 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
#define __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
-typedef UINT16 STRING_REF;
+typedef UINT16 STRING_REF;
//
// IFR Op codes
//
-#define FRAMEWORK_EFI_IFR_FORM_OP 0x01
-#define FRAMEWORK_EFI_IFR_SUBTITLE_OP 0x02
-#define FRAMEWORK_EFI_IFR_TEXT_OP 0x03
-#define EFI_IFR_GRAPHIC_OP 0x04
-#define FRAMEWORK_EFI_IFR_ONE_OF_OP 0x05
-#define FRAMEWORK_EFI_IFR_CHECKBOX_OP 0x06
-#define FRAMEWORK_EFI_IFR_NUMERIC_OP 0x07
-#define FRAMEWORK_EFI_IFR_PASSWORD_OP 0x08
-#define FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP 0x09 ///< ONEOF OPTION field.
-#define FRAMEWORK_EFI_IFR_SUPPRESS_IF_OP 0x0A
-#define EFI_IFR_END_FORM_OP 0x0B
-#define EFI_IFR_HIDDEN_OP 0x0C
-#define EFI_IFR_END_FORM_SET_OP 0x0D
-#define FRAMEWORK_EFI_IFR_FORM_SET_OP 0x0E
-#define FRAMEWORK_EFI_IFR_REF_OP 0x0F
-#define EFI_IFR_END_ONE_OF_OP 0x10
-#define FRAMEWORK_EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP
-#define FRAMEWORK_EFI_IFR_INCONSISTENT_IF_OP 0x11
-#define FRAMEWORK_EFI_IFR_EQ_ID_VAL_OP 0x12
-#define FRAMEWORK_EFI_IFR_EQ_ID_ID_OP 0x13
-#define FRAMEWORK_EFI_IFR_EQ_ID_LIST_OP 0x14
-#define FRAMEWORK_EFI_IFR_AND_OP 0x15
-#define FRAMEWORK_EFI_IFR_OR_OP 0x16
-#define FRAMEWORK_EFI_IFR_NOT_OP 0x17
-#define EFI_IFR_END_IF_OP 0x18 ///< For endif of inconsistentif, suppressif, grayoutif.
-#define EFI_IFR_GRAYOUT_IF_OP 0x19
-#define FRAMEWORK_EFI_IFR_DATE_OP 0x1A
-#define FRAMEWORK_EFI_IFR_TIME_OP 0x1B
-#define FRAMEWORK_EFI_IFR_STRING_OP 0x1C
-#define EFI_IFR_LABEL_OP 0x1D
-#define EFI_IFR_SAVE_DEFAULTS_OP 0x1E
-#define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F
-#define EFI_IFR_BANNER_OP 0x20
-#define EFI_IFR_INVENTORY_OP 0x21
-#define EFI_IFR_EQ_VAR_VAL_OP 0x22
-#define FRAMEWORK_EFI_IFR_ORDERED_LIST_OP 0x23
-#define FRAMEWORK_EFI_IFR_VARSTORE_OP 0x24
-#define EFI_IFR_VARSTORE_SELECT_OP 0x25
-#define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26
-#define EFI_IFR_LAST_OPCODE EFI_IFR_VARSTORE_SELECT_PAIR_OP
-#define EFI_IFR_OEM_OP 0xFE
-#define EFI_IFR_NV_ACCESS_COMMAND 0xFF
+#define FRAMEWORK_EFI_IFR_FORM_OP 0x01
+#define FRAMEWORK_EFI_IFR_SUBTITLE_OP 0x02
+#define FRAMEWORK_EFI_IFR_TEXT_OP 0x03
+#define EFI_IFR_GRAPHIC_OP 0x04
+#define FRAMEWORK_EFI_IFR_ONE_OF_OP 0x05
+#define FRAMEWORK_EFI_IFR_CHECKBOX_OP 0x06
+#define FRAMEWORK_EFI_IFR_NUMERIC_OP 0x07
+#define FRAMEWORK_EFI_IFR_PASSWORD_OP 0x08
+#define FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP 0x09 ///< ONEOF OPTION field.
+#define FRAMEWORK_EFI_IFR_SUPPRESS_IF_OP 0x0A
+#define EFI_IFR_END_FORM_OP 0x0B
+#define EFI_IFR_HIDDEN_OP 0x0C
+#define EFI_IFR_END_FORM_SET_OP 0x0D
+#define FRAMEWORK_EFI_IFR_FORM_SET_OP 0x0E
+#define FRAMEWORK_EFI_IFR_REF_OP 0x0F
+#define EFI_IFR_END_ONE_OF_OP 0x10
+#define FRAMEWORK_EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP
+#define FRAMEWORK_EFI_IFR_INCONSISTENT_IF_OP 0x11
+#define FRAMEWORK_EFI_IFR_EQ_ID_VAL_OP 0x12
+#define FRAMEWORK_EFI_IFR_EQ_ID_ID_OP 0x13
+#define FRAMEWORK_EFI_IFR_EQ_ID_LIST_OP 0x14
+#define FRAMEWORK_EFI_IFR_AND_OP 0x15
+#define FRAMEWORK_EFI_IFR_OR_OP 0x16
+#define FRAMEWORK_EFI_IFR_NOT_OP 0x17
+#define EFI_IFR_END_IF_OP 0x18 ///< For endif of inconsistentif, suppressif, grayoutif.
+#define EFI_IFR_GRAYOUT_IF_OP 0x19
+#define FRAMEWORK_EFI_IFR_DATE_OP 0x1A
+#define FRAMEWORK_EFI_IFR_TIME_OP 0x1B
+#define FRAMEWORK_EFI_IFR_STRING_OP 0x1C
+#define EFI_IFR_LABEL_OP 0x1D
+#define EFI_IFR_SAVE_DEFAULTS_OP 0x1E
+#define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F
+#define EFI_IFR_BANNER_OP 0x20
+#define EFI_IFR_INVENTORY_OP 0x21
+#define EFI_IFR_EQ_VAR_VAL_OP 0x22
+#define FRAMEWORK_EFI_IFR_ORDERED_LIST_OP 0x23
+#define FRAMEWORK_EFI_IFR_VARSTORE_OP 0x24
+#define EFI_IFR_VARSTORE_SELECT_OP 0x25
+#define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26
+#define EFI_IFR_LAST_OPCODE EFI_IFR_VARSTORE_SELECT_PAIR_OP
+#define EFI_IFR_OEM_OP 0xFE
+#define EFI_IFR_NV_ACCESS_COMMAND 0xFF
//
// Define values for the flags fields in some VFR opcodes. These are
// bitmasks.
//
-#define EFI_IFR_FLAG_DEFAULT 0x01
-#define EFI_IFR_FLAG_MANUFACTURING 0x02
-#define EFI_IFR_FLAG_INTERACTIVE 0x04
-#define EFI_IFR_FLAG_NV_ACCESS 0x08
-#define EFI_IFR_FLAG_RESET_REQUIRED 0x10
-#define EFI_IFR_FLAG_LATE_CHECK 0x20
-
-#define EFI_NON_DEVICE_CLASS 0x00 ///< Useful when you do not want something in the Device Manager.
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
+#define EFI_IFR_FLAG_DEFAULT 0x01
+#define EFI_IFR_FLAG_MANUFACTURING 0x02
+#define EFI_IFR_FLAG_INTERACTIVE 0x04
+#define EFI_IFR_FLAG_NV_ACCESS 0x08
+#define EFI_IFR_FLAG_RESET_REQUIRED 0x10
+#define EFI_IFR_FLAG_LATE_CHECK 0x20
+
+#define EFI_NON_DEVICE_CLASS 0x00 ///< Useful when you do not want something in the Device Manager.
+#define EFI_DISK_DEVICE_CLASS 0x01
+#define EFI_VIDEO_DEVICE_CLASS 0x02
+#define EFI_NETWORK_DEVICE_CLASS 0x04
+#define EFI_INPUT_DEVICE_CLASS 0x08
+#define EFI_ON_BOARD_DEVICE_CLASS 0x10
+#define EFI_OTHER_DEVICE_CLASS 0x20
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
@@ -96,70 +96,69 @@ typedef UINT16 STRING_REF;
///
#define EFI_IFR_FLAG_CREATED 128
-
#pragma pack(1)
//
// IFR Structure definitions
//
typedef struct {
- UINT8 OpCode;
- UINT8 Length;
+ UINT8 OpCode;
+ UINT8 Length;
} FRAMEWORK_EFI_IFR_OP_HEADER;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- EFI_GUID Guid;
- STRING_REF FormSetTitle;
- STRING_REF Help;
- EFI_PHYSICAL_ADDRESS CallbackHandle;
- UINT16 Class;
- UINT16 SubClass;
- UINT16 NvDataSize; ///< Set once; the size of the NV data as defined in the script.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ EFI_GUID Guid;
+ STRING_REF FormSetTitle;
+ STRING_REF Help;
+ EFI_PHYSICAL_ADDRESS CallbackHandle;
+ UINT16 Class;
+ UINT16 SubClass;
+ UINT16 NvDataSize; ///< Set once; the size of the NV data as defined in the script.
} FRAMEWORK_EFI_IFR_FORM_SET;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 FormId;
- STRING_REF FormTitle;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 FormId;
+ STRING_REF FormTitle;
} FRAMEWORK_EFI_IFR_FORM;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 LabelId;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 LabelId;
} EFI_IFR_LABEL;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- STRING_REF SubTitle;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ STRING_REF SubTitle;
} FRAMEWORK_EFI_IFR_SUBTITLE;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- STRING_REF Help;
- STRING_REF Text;
- STRING_REF TextTwo;
- UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ STRING_REF Help;
+ STRING_REF Text;
+ STRING_REF TextTwo;
+ UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
+ UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code.
} FRAMEWORK_EFI_IFR_TEXT;
//
// goto
//
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 FormId;
- STRING_REF Prompt;
- STRING_REF Help; ///< The string Token for the context-help.
- UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 FormId;
+ STRING_REF Prompt;
+ STRING_REF Help; ///< The string Token for the context-help.
+ UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
+ UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code.
} FRAMEWORK_EFI_IFR_REF;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_FORM;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_FORM_SET;
//
@@ -167,51 +166,51 @@ typedef struct {
// code assumes this to be true, if this ever changes we need to revisit the InitializeTagStructures code
//
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; ///< The ID designating what the question is about...
- UINT8 Width; ///< The Size of the Data being saved.
- STRING_REF Prompt; ///< The String Token for the Prompt.
- STRING_REF Help; ///< The string Token for the context-help.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The ID designating what the question is about...
+ UINT8 Width; ///< The Size of the Data being saved.
+ STRING_REF Prompt; ///< The String Token for the Prompt.
+ STRING_REF Help; ///< The string Token for the context-help.
} FRAMEWORK_EFI_IFR_ONE_OF;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; ///< The offset in NV for storage of the data.
- UINT8 MaxEntries; ///< The maximum number of options in the ordered list (=size of NVStore).
- STRING_REF Prompt; ///< The string token for the prompt.
- STRING_REF Help; ///< The string token for the context-help.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The offset in NV for storage of the data.
+ UINT8 MaxEntries; ///< The maximum number of options in the ordered list (=size of NVStore).
+ STRING_REF Prompt; ///< The string token for the prompt.
+ STRING_REF Help; ///< The string token for the context-help.
} FRAMEWORK_EFI_IFR_ORDERED_LIST;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; ///< The ID designating what the question is about...
- UINT8 Width; ///< The Size of the Data being saved.
- STRING_REF Prompt; ///< The String Token for the Prompt.
- STRING_REF Help; ///< The string Token for the context-help.
- UINT8 Flags; ///< If non-zero, it means that it is the default option.
- UINT16 Key; ///< Value to be passed to caller to identify this particular op-code.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The ID designating what the question is about...
+ UINT8 Width; ///< The Size of the Data being saved.
+ STRING_REF Prompt; ///< The String Token for the Prompt.
+ STRING_REF Help; ///< The string Token for the context-help.
+ UINT8 Flags; ///< If non-zero, it means that it is the default option.
+ UINT16 Key; ///< Value to be passed to caller to identify this particular op-code.
} FRAMEWORK_EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- STRING_REF Option; ///< The string token describing the option.
- UINT16 Value; ///< The value associated with this option that is stored in the NVRAM.
- UINT8 Flags; ///< If non-zero, it means that it is the default option.
- UINT16 Key; ///< Value to be passed to caller to identify this particular op-code.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ STRING_REF Option; ///< The string token describing the option.
+ UINT16 Value; ///< The value associated with this option that is stored in the NVRAM.
+ UINT8 Flags; ///< If non-zero, it means that it is the default option.
+ UINT16 Key; ///< Value to be passed to caller to identify this particular op-code.
} FRAMEWORK_EFI_IFR_ONE_OF_OPTION;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; ///< The ID designating what the question is about...
- UINT8 Width; ///< The Size of the Data being saved.
- STRING_REF Prompt; ///< The String Token for the Prompt.
- STRING_REF Help; ///< The string Token for the context-help.
- UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
- UINT16 Minimum;
- UINT16 Maximum;
- UINT16 Step; ///< Zero means manual input. Otherwise, arrow selection is called for.
- UINT16 Default;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The ID designating what the question is about...
+ UINT8 Width; ///< The Size of the Data being saved.
+ STRING_REF Prompt; ///< The String Token for the Prompt.
+ STRING_REF Help; ///< The string Token for the context-help.
+ UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
+ UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT16 Step; ///< Zero means manual input. Otherwise, arrow selection is called for.
+ UINT16 Default;
} FRAMEWORK_EFI_IFR_NUMERIC;
//
@@ -223,50 +222,50 @@ typedef struct {
// gRT->GetXXXX series of calls.
//
typedef struct {
- FRAMEWORK_EFI_IFR_NUMERIC Hour;
- FRAMEWORK_EFI_IFR_NUMERIC Minute;
- FRAMEWORK_EFI_IFR_NUMERIC Second;
+ FRAMEWORK_EFI_IFR_NUMERIC Hour;
+ FRAMEWORK_EFI_IFR_NUMERIC Minute;
+ FRAMEWORK_EFI_IFR_NUMERIC Second;
} FRAMEWORK_EFI_IFR_TIME;
typedef struct {
- FRAMEWORK_EFI_IFR_NUMERIC Year;
- FRAMEWORK_EFI_IFR_NUMERIC Month;
- FRAMEWORK_EFI_IFR_NUMERIC Day;
+ FRAMEWORK_EFI_IFR_NUMERIC Year;
+ FRAMEWORK_EFI_IFR_NUMERIC Month;
+ FRAMEWORK_EFI_IFR_NUMERIC Day;
} FRAMEWORK_EFI_IFR_DATE;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId;///< The ID designating what the question is about...
- UINT8 Width; ///< The Size of the Data being saved.
- STRING_REF Prompt; ///< The String Token for the Prompt.
- STRING_REF Help; ///< The string Token for the context-help.
- UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
- UINT8 MinSize; ///< Minimum allowable sized password.
- UINT8 MaxSize; ///< Maximum allowable sized password.
- UINT16 Encoding;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The ID designating what the question is about...
+ UINT8 Width; ///< The Size of the Data being saved.
+ STRING_REF Prompt; ///< The String Token for the Prompt.
+ STRING_REF Help; ///< The string Token for the context-help.
+ UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
+ UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
+ UINT8 MinSize; ///< Minimum allowable sized password.
+ UINT8 MaxSize; ///< Maximum allowable sized password.
+ UINT16 Encoding;
} FRAMEWORK_EFI_IFR_PASSWORD;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; ///< The ID designating what the question is about...
- UINT8 Width; ///< The Size of the Data being saved.
- STRING_REF Prompt; ///< The String Token for the Prompt.
- STRING_REF Help; ///< The string Token for the context-help.
- UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
- UINT8 MinSize; ///< Minimum allowable sized password.
- UINT8 MaxSize; ///< Maximum allowable sized password.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The ID designating what the question is about...
+ UINT8 Width; ///< The Size of the Data being saved.
+ STRING_REF Prompt; ///< The String Token for the Prompt.
+ STRING_REF Help; ///< The string Token for the context-help.
+ UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
+ UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
+ UINT8 MinSize; ///< Minimum allowable sized password.
+ UINT8 MaxSize; ///< Maximum allowable sized password.
} FRAMEWORK_EFI_IFR_STRING;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_ONE_OF;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 Value;
- UINT16 Key;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 Value;
+ UINT16 Key;
} EFI_IFR_HIDDEN;
///
@@ -275,92 +274,92 @@ typedef struct {
/// keep the inconsistant is for implementation needed.
///@{
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT8 Flags;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT8 Flags;
} EFI_IFR_SUPPRESS;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT8 Flags;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT8 Flags;
} EFI_IFR_GRAY_OUT;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- STRING_REF Popup;
- UINT8 Flags;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ STRING_REF Popup;
+ UINT8 Flags;
} EFI_IFR_INCONSISTENT;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; ///< The offset into variable storage.
- UINT8 Width; ///< The size of variable storage.
- UINT16 Value; ///< The value to compare against.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The offset into variable storage.
+ UINT8 Width; ///< The size of variable storage.
+ UINT16 Value; ///< The value to compare against.
} FRAMEWORK_EFI_IFR_EQ_ID_VAL;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; ///< The offset into variable storage.
- UINT8 Width; ///< The size of variable storage.
- UINT16 ListLength;
- UINT16 ValueList[1];
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId; ///< The offset into variable storage.
+ UINT8 Width; ///< The size of variable storage.
+ UINT16 ListLength;
+ UINT16 ValueList[1];
} FRAMEWORK_EFI_IFR_EQ_ID_LIST;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId1; ///< The offset into variable storage for first value to compare.
- UINT8 Width; ///< The size of variable storage (must be same for both).
- UINT16 QuestionId2; ///< The offset into variable storage for second value to compare.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 QuestionId1; ///< The offset into variable storage for first value to compare.
+ UINT8 Width; ///< The size of variable storage (must be same for both).
+ UINT16 QuestionId2; ///< The offset into variable storage for second value to compare.
} FRAMEWORK_EFI_IFR_EQ_ID_ID;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 VariableId; ///< The offset into variable storage.
- UINT16 Value; ///< The value to compare against.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 VariableId; ///< The offset into variable storage.
+ UINT16 Value; ///< The value to compare against.
} EFI_IFR_EQ_VAR_VAL;
///@}
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
} FRAMEWORK_EFI_IFR_AND;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
} FRAMEWORK_EFI_IFR_OR;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
} FRAMEWORK_EFI_IFR_NOT;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_EXPR, EFI_IFR_END_IF;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 FormId;
- STRING_REF Prompt;
- STRING_REF Help;
- UINT8 Flags;
- UINT16 Key;
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 FormId;
+ STRING_REF Prompt;
+ STRING_REF Help;
+ UINT8 Flags;
+ UINT16 Key;
} EFI_IFR_SAVE_DEFAULTS;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- STRING_REF Help;
- STRING_REF Text;
- STRING_REF TextTwo; ///< Optional text.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ STRING_REF Help;
+ STRING_REF Text;
+ STRING_REF TextTwo; ///< Optional text.
} EFI_IFR_INVENTORY;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- EFI_GUID Guid; ///< GUID for the variable.
- UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
- UINT16 Size; ///< The size of the variable storage.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ EFI_GUID Guid; ///< GUID for the variable.
+ UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
+ UINT16 Size; ///< The size of the variable storage.
} FRAMEWORK_EFI_IFR_VARSTORE;
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
} EFI_IFR_VARSTORE_SELECT;
///
@@ -370,9 +369,9 @@ typedef struct {
/// IFR opcodes use the VarId as defined here.
///
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
- UINT16 SecondaryVarId; ///< The variable store ID, as referenced elsewhere in the form.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
+ UINT16 SecondaryVarId; ///< The variable store ID, as referenced elsewhere in the form.
} EFI_IFR_VARSTORE_SELECT_PAIR;
///
@@ -381,16 +380,16 @@ typedef struct {
#define EFI_IFR_RESTORE_DEFAULTS EFI_IFR_SAVE_DEFAULTS
typedef struct {
- FRAMEWORK_EFI_IFR_OP_HEADER Header;
- STRING_REF Title; ///< The string token for the banner title.
- UINT16 LineNumber; ///< 1-based line number.
- UINT8 Alignment; ///< Left, center, or right-aligned.
+ FRAMEWORK_EFI_IFR_OP_HEADER Header;
+ STRING_REF Title; ///< The string token for the banner title.
+ UINT16 LineNumber; ///< 1-based line number.
+ UINT8 Alignment; ///< Left, center, or right-aligned.
} EFI_IFR_BANNER;
-#define EFI_IFR_BANNER_ALIGN_LEFT 0
-#define EFI_IFR_BANNER_ALIGN_CENTER 1
-#define EFI_IFR_BANNER_ALIGN_RIGHT 2
-#define EFI_IFR_BANNER_TIMEOUT 0xFF
+#define EFI_IFR_BANNER_ALIGN_LEFT 0
+#define EFI_IFR_BANNER_ALIGN_CENTER 1
+#define EFI_IFR_BANNER_ALIGN_RIGHT 2
+#define EFI_IFR_BANNER_TIMEOUT 0xFF
#pragma pack()
diff --git a/OvmfPkg/Csm/Include/Framework/Hob.h b/OvmfPkg/Csm/Include/Framework/Hob.h
index f6a71fabe4..592a179bc2 100644
--- a/OvmfPkg/Csm/Include/Framework/Hob.h
+++ b/OvmfPkg/Csm/Include/Framework/Hob.h
@@ -17,12 +17,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// This macro is defined to comply with the hob Framework Spec. And the marco was
/// retired in the PI1.0 specification.
///
-#define EFI_HOB_TYPE_CV 0x0008
+#define EFI_HOB_TYPE_CV 0x0008
typedef struct {
- EFI_HOB_GENERIC_HEADER Header;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 Length;
+ EFI_HOB_GENERIC_HEADER Header;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT64 Length;
} EFI_HOB_CAPSULE_VOLUME;
#endif
diff --git a/OvmfPkg/Csm/Include/Framework/StatusCode.h b/OvmfPkg/Csm/Include/Framework/StatusCode.h
index 753029c13c..5678127a24 100644
--- a/OvmfPkg/Csm/Include/Framework/StatusCode.h
+++ b/OvmfPkg/Csm/Include/Framework/StatusCode.h
@@ -26,8 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
///
///@{
-#define EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS (EFI_SUBCLASS_SPECIFIC | 0x00000005)
-#define EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD (EFI_SUBCLASS_SPECIFIC | 0x00000006)
+#define EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS (EFI_SUBCLASS_SPECIFIC | 0x00000005)
+#define EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD (EFI_SUBCLASS_SPECIFIC | 0x00000006)
///@}
///
@@ -37,12 +37,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
///
///@{
-#define EFI_SW_DXE_RT_PC_S0 (EFI_SUBCLASS_SPECIFIC | 0x00000000)
-#define EFI_SW_DXE_RT_PC_S1 (EFI_SUBCLASS_SPECIFIC | 0x00000001)
-#define EFI_SW_DXE_RT_PC_S2 (EFI_SUBCLASS_SPECIFIC | 0x00000002)
-#define EFI_SW_DXE_RT_PC_S3 (EFI_SUBCLASS_SPECIFIC | 0x00000003)
-#define EFI_SW_DXE_RT_PC_S4 (EFI_SUBCLASS_SPECIFIC | 0x00000004)
-#define EFI_SW_DXE_RT_PC_S5 (EFI_SUBCLASS_SPECIFIC | 0x00000005)
+#define EFI_SW_DXE_RT_PC_S0 (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_SW_DXE_RT_PC_S1 (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_SW_DXE_RT_PC_S2 (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+#define EFI_SW_DXE_RT_PC_S3 (EFI_SUBCLASS_SPECIFIC | 0x00000003)
+#define EFI_SW_DXE_RT_PC_S4 (EFI_SUBCLASS_SPECIFIC | 0x00000004)
+#define EFI_SW_DXE_RT_PC_S5 (EFI_SUBCLASS_SPECIFIC | 0x00000005)
///@}
///
@@ -51,7 +51,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// Inconsistent with specification here:
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
///
-#define EFI_SOFTWARE_X64_EXCEPTION (EFI_SOFTWARE | 0x00130000)
+#define EFI_SOFTWARE_X64_EXCEPTION (EFI_SOFTWARE | 0x00130000)
///
/// Software Class X64 Exception Subclass Error Code definitions.
@@ -62,31 +62,31 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
///
///@{
-#define EFI_SW_EC_X64_DIVIDE_ERROR EXCEPT_X64_DIVIDE_ERROR
-#define EFI_SW_EC_X64_DEBUG EXCEPT_X64_DEBUG
-#define EFI_SW_EC_X64_NMI EXCEPT_X64_NMI
-#define EFI_SW_EC_X64_BREAKPOINT EXCEPT_X64_BREAKPOINT
-#define EFI_SW_EC_X64_OVERFLOW EXCEPT_X64_OVERFLOW
-#define EFI_SW_EC_X64_BOUND EXCEPT_X64_BOUND
-#define EFI_SW_EC_X64_INVALID_OPCODE EXCEPT_X64_INVALID_OPCODE
-#define EFI_SW_EC_X64_DOUBLE_FAULT EXCEPT_X64_DOUBLE_FAULT
-#define EFI_SW_EC_X64_INVALID_TSS EXCEPT_X64_INVALID_TSS
-#define EFI_SW_EC_X64_SEG_NOT_PRESENT EXCEPT_X64_SEG_NOT_PRESENT
-#define EFI_SW_EC_X64_STACK_FAULT EXCEPT_X64_STACK_FAULT
-#define EFI_SW_EC_X64_GP_FAULT EXCEPT_X64_GP_FAULT
-#define EFI_SW_EC_X64_PAGE_FAULT EXCEPT_X64_PAGE_FAULT
-#define EFI_SW_EC_X64_FP_ERROR EXCEPT_X64_FP_ERROR
-#define EFI_SW_EC_X64_ALIGNMENT_CHECK EXCEPT_X64_ALIGNMENT_CHECK
-#define EFI_SW_EC_X64_MACHINE_CHECK EXCEPT_X64_MACHINE_CHECK
-#define EFI_SW_EC_X64_SIMD EXCEPT_X64_SIMD
+#define EFI_SW_EC_X64_DIVIDE_ERROR EXCEPT_X64_DIVIDE_ERROR
+#define EFI_SW_EC_X64_DEBUG EXCEPT_X64_DEBUG
+#define EFI_SW_EC_X64_NMI EXCEPT_X64_NMI
+#define EFI_SW_EC_X64_BREAKPOINT EXCEPT_X64_BREAKPOINT
+#define EFI_SW_EC_X64_OVERFLOW EXCEPT_X64_OVERFLOW
+#define EFI_SW_EC_X64_BOUND EXCEPT_X64_BOUND
+#define EFI_SW_EC_X64_INVALID_OPCODE EXCEPT_X64_INVALID_OPCODE
+#define EFI_SW_EC_X64_DOUBLE_FAULT EXCEPT_X64_DOUBLE_FAULT
+#define EFI_SW_EC_X64_INVALID_TSS EXCEPT_X64_INVALID_TSS
+#define EFI_SW_EC_X64_SEG_NOT_PRESENT EXCEPT_X64_SEG_NOT_PRESENT
+#define EFI_SW_EC_X64_STACK_FAULT EXCEPT_X64_STACK_FAULT
+#define EFI_SW_EC_X64_GP_FAULT EXCEPT_X64_GP_FAULT
+#define EFI_SW_EC_X64_PAGE_FAULT EXCEPT_X64_PAGE_FAULT
+#define EFI_SW_EC_X64_FP_ERROR EXCEPT_X64_FP_ERROR
+#define EFI_SW_EC_X64_ALIGNMENT_CHECK EXCEPT_X64_ALIGNMENT_CHECK
+#define EFI_SW_EC_X64_MACHINE_CHECK EXCEPT_X64_MACHINE_CHECK
+#define EFI_SW_EC_X64_SIMD EXCEPT_X64_SIMD
///@}
///
/// Software Class EFI After Life Subclass Progress Code definitions.
///
///@{
-#define EFI_SW_AL_PC_ENTRY_POINT (EFI_SUBCLASS_SPECIFIC | 0x00000000)
-#define EFI_SW_AL_PC_RETURN_TO_LAST (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_SW_AL_PC_ENTRY_POINT (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_SW_AL_PC_RETURN_TO_LAST (EFI_SUBCLASS_SPECIFIC | 0x00000001)
///@}
///
@@ -95,7 +95,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// Inconsistent with specification here:
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
///
-#define EFI_SW_CSM_LEGACY_ROM_INIT (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_SW_CSM_LEGACY_ROM_INIT (EFI_SUBCLASS_SPECIFIC | 0x00000000)
///
/// IO Bus Class ATA/ATAPI Subclass Progress Code definitions.
@@ -130,7 +130,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
///
///@{
-#define EFI_CPU_CAUSE_NOT_DISABLED 0x0000
+#define EFI_CPU_CAUSE_NOT_DISABLED 0x0000
///@}
///
diff --git a/OvmfPkg/Csm/Include/Guid/LegacyBios.h b/OvmfPkg/Csm/Include/Guid/LegacyBios.h
index e35fbff8d5..b196844d00 100644
--- a/OvmfPkg/Csm/Include/Guid/LegacyBios.h
+++ b/OvmfPkg/Csm/Include/Guid/LegacyBios.h
@@ -24,6 +24,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
0x2e3044ac, 0x879f, 0x490f, {0x97, 0x60, 0xbb, 0xdf, 0xaf, 0x69, 0x5f, 0x50 } \
}
-extern EFI_GUID gEfiLegacyBiosGuid;
+extern EFI_GUID gEfiLegacyBiosGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h b/OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h
index 8ec3de5e38..4446b005cb 100644
--- a/OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h
+++ b/OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h
@@ -23,17 +23,17 @@ typedef UINT8 BBS_TYPE;
#pragma pack(1)
typedef struct {
- BBS_TYPE BbsType;
+ BBS_TYPE BbsType;
///
/// Length = sizeof (UINT16) + sizeof (Data)
///
- UINT16 Length;
- UINT16 Data[1];
+ UINT16 Length;
+ UINT16 Data[1];
} LEGACY_DEV_ORDER_ENTRY;
#pragma pack()
-#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"
+#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"
-extern EFI_GUID gEfiLegacyDevOrderVariableGuid;
+extern EFI_GUID gEfiLegacyDevOrderVariableGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h b/OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h
index 5e0216c765..bac03c11c4 100644
--- a/OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h
+++ b/OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h
@@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _FIRMWARE_VOLUME_H_
#define _FIRMWARE_VOLUME_H_
-
//
// Firmware Volume Protocol GUID definition
//
@@ -28,49 +27,49 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 } \
}
-#define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_')
+#define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_')
-typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;
+typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;
//
// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
//
-typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES;
+typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES;
//
// ************************************************************
// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
// ************************************************************
//
-#define EFI_FV_READ_DISABLE_CAP 0x0000000000000001ULL
-#define EFI_FV_READ_ENABLE_CAP 0x0000000000000002ULL
-#define EFI_FV_READ_STATUS 0x0000000000000004ULL
+#define EFI_FV_READ_DISABLE_CAP 0x0000000000000001ULL
+#define EFI_FV_READ_ENABLE_CAP 0x0000000000000002ULL
+#define EFI_FV_READ_STATUS 0x0000000000000004ULL
-#define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008ULL
-#define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010ULL
-#define EFI_FV_WRITE_STATUS 0x0000000000000020ULL
+#define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008ULL
+#define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010ULL
+#define EFI_FV_WRITE_STATUS 0x0000000000000020ULL
#define EFI_FV_LOCK_CAP 0x0000000000000040ULL
#define EFI_FV_LOCK_STATUS 0x0000000000000080ULL
#define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100ULL
-#define EFI_FV_ALIGNMENT_CAP 0x0000000000008000ULL
-#define EFI_FV_ALIGNMENT_2 0x0000000000010000ULL
-#define EFI_FV_ALIGNMENT_4 0x0000000000020000ULL
-#define EFI_FV_ALIGNMENT_8 0x0000000000040000ULL
-#define EFI_FV_ALIGNMENT_16 0x0000000000080000ULL
-#define EFI_FV_ALIGNMENT_32 0x0000000000100000ULL
-#define EFI_FV_ALIGNMENT_64 0x0000000000200000ULL
-#define EFI_FV_ALIGNMENT_128 0x0000000000400000ULL
-#define EFI_FV_ALIGNMENT_256 0x0000000000800000ULL
-#define EFI_FV_ALIGNMENT_512 0x0000000001000000ULL
-#define EFI_FV_ALIGNMENT_1K 0x0000000002000000ULL
-#define EFI_FV_ALIGNMENT_2K 0x0000000004000000ULL
-#define EFI_FV_ALIGNMENT_4K 0x0000000008000000ULL
-#define EFI_FV_ALIGNMENT_8K 0x0000000010000000ULL
-#define EFI_FV_ALIGNMENT_16K 0x0000000020000000ULL
-#define EFI_FV_ALIGNMENT_32K 0x0000000040000000ULL
-#define EFI_FV_ALIGNMENT_64K 0x0000000080000000ULL
+#define EFI_FV_ALIGNMENT_CAP 0x0000000000008000ULL
+#define EFI_FV_ALIGNMENT_2 0x0000000000010000ULL
+#define EFI_FV_ALIGNMENT_4 0x0000000000020000ULL
+#define EFI_FV_ALIGNMENT_8 0x0000000000040000ULL
+#define EFI_FV_ALIGNMENT_16 0x0000000000080000ULL
+#define EFI_FV_ALIGNMENT_32 0x0000000000100000ULL
+#define EFI_FV_ALIGNMENT_64 0x0000000000200000ULL
+#define EFI_FV_ALIGNMENT_128 0x0000000000400000ULL
+#define EFI_FV_ALIGNMENT_256 0x0000000000800000ULL
+#define EFI_FV_ALIGNMENT_512 0x0000000001000000ULL
+#define EFI_FV_ALIGNMENT_1K 0x0000000002000000ULL
+#define EFI_FV_ALIGNMENT_2K 0x0000000004000000ULL
+#define EFI_FV_ALIGNMENT_4K 0x0000000008000000ULL
+#define EFI_FV_ALIGNMENT_8K 0x0000000010000000ULL
+#define EFI_FV_ALIGNMENT_16K 0x0000000020000000ULL
+#define EFI_FV_ALIGNMENT_32K 0x0000000040000000ULL
+#define EFI_FV_ALIGNMENT_64K 0x0000000080000000ULL
//
// Protocol API definitions
@@ -210,17 +209,17 @@ EFI_STATUS
OUT UINT32 *AuthenticationStatus
);
-typedef UINT32 FRAMEWORK_EFI_FV_WRITE_POLICY;
+typedef UINT32 FRAMEWORK_EFI_FV_WRITE_POLICY;
-#define FRAMEWORK_EFI_FV_UNRELIABLE_WRITE 0x00000000
-#define FRAMEWORK_EFI_FV_RELIABLE_WRITE 0x00000001
+#define FRAMEWORK_EFI_FV_UNRELIABLE_WRITE 0x00000000
+#define FRAMEWORK_EFI_FV_RELIABLE_WRITE 0x00000001
typedef struct {
- EFI_GUID *NameGuid;
- EFI_FV_FILETYPE Type;
- EFI_FV_FILE_ATTRIBUTES FileAttributes;
- VOID *Buffer;
- UINT32 BufferSize;
+ EFI_GUID *NameGuid;
+ EFI_FV_FILETYPE Type;
+ EFI_FV_FILE_ATTRIBUTES FileAttributes;
+ VOID *Buffer;
+ UINT32 BufferSize;
} FRAMEWORK_EFI_FV_WRITE_FILE_DATA;
/**
@@ -296,45 +295,45 @@ struct _EFI_FIRMWARE_VOLUME_PROTOCOL {
///
/// Retrieves volume capabilities and current settings.
///
- FRAMEWORK_EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;
+ FRAMEWORK_EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;
///
/// Modifies the current settings of the firmware volume.
///
- FRAMEWORK_EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;
+ FRAMEWORK_EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;
///
/// Reads an entire file from the firmware volume.
///
- FRAMEWORK_EFI_FV_READ_FILE ReadFile;
+ FRAMEWORK_EFI_FV_READ_FILE ReadFile;
///
/// Reads a single section from a file into a buffer.
///
- FRAMEWORK_EFI_FV_READ_SECTION ReadSection;
+ FRAMEWORK_EFI_FV_READ_SECTION ReadSection;
///
/// Writes an entire file into the firmware volume.
///
- FRAMEWORK_EFI_FV_WRITE_FILE WriteFile;
+ FRAMEWORK_EFI_FV_WRITE_FILE WriteFile;
///
/// Provides service to allow searching the firmware volume.
///
- FRAMEWORK_EFI_FV_GET_NEXT_FILE GetNextFile;
+ FRAMEWORK_EFI_FV_GET_NEXT_FILE GetNextFile;
///
/// Data field that indicates the size in bytes of the Key input buffer for
/// the GetNextFile() API.
///
- UINT32 KeySize;
+ UINT32 KeySize;
///
/// Handle of the parent firmware volume.
///
- EFI_HANDLE ParentHandle;
+ EFI_HANDLE ParentHandle;
};
-extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;
+extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Protocol/IsaAcpi.h b/OvmfPkg/Csm/Include/Protocol/IsaAcpi.h
index 0ff57aa118..afb415a388 100644
--- a/OvmfPkg/Csm/Include/Protocol/IsaAcpi.h
+++ b/OvmfPkg/Csm/Include/Protocol/IsaAcpi.h
@@ -49,20 +49,20 @@ typedef struct _EFI_ISA_ACPI_PROTOCOL EFI_ISA_ACPI_PROTOCOL;
///
/// ISA ACPI Protocol MMIO resource attributes
///
-#define EFI_ISA_ACPI_MEMORY_WIDTH_MASK 0x03 ///< Bit mask of supported ISA memory width attributes.
-#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT 0x00 ///< ISA MMIO region only supports 8-bit access.
-#define EFI_ISA_ACPI_MEMORY_WIDTH_16_BIT 0x01 ///< ISA MMIO region only supports 16-bit access.
-#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT_AND_16_BIT 0x02 ///< ISA MMIO region supports both 8-bit and 16-bit access.
-#define EFI_ISA_ACPI_MEMORY_WRITEABLE 0x04 ///< ISA MMIO region supports write transactions.
-#define EFI_ISA_ACPI_MEMORY_CACHEABLE 0x08 ///< ISA MMIO region supports being cached.
-#define EFI_ISA_ACPI_MEMORY_SHADOWABLE 0x10 ///< ISA MMIO region may be shadowed.
-#define EFI_ISA_ACPI_MEMORY_EXPANSION_ROM 0x20 ///< ISA MMIO region is an expansion ROM.
+#define EFI_ISA_ACPI_MEMORY_WIDTH_MASK 0x03 ///< Bit mask of supported ISA memory width attributes.
+#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT 0x00 ///< ISA MMIO region only supports 8-bit access.
+#define EFI_ISA_ACPI_MEMORY_WIDTH_16_BIT 0x01 ///< ISA MMIO region only supports 16-bit access.
+#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT_AND_16_BIT 0x02 ///< ISA MMIO region supports both 8-bit and 16-bit access.
+#define EFI_ISA_ACPI_MEMORY_WRITEABLE 0x04 ///< ISA MMIO region supports write transactions.
+#define EFI_ISA_ACPI_MEMORY_CACHEABLE 0x08 ///< ISA MMIO region supports being cached.
+#define EFI_ISA_ACPI_MEMORY_SHADOWABLE 0x10 ///< ISA MMIO region may be shadowed.
+#define EFI_ISA_ACPI_MEMORY_EXPANSION_ROM 0x20 ///< ISA MMIO region is an expansion ROM.
///
/// ISA ACPI Protocol I/O resource attributes
///
-#define EFI_ISA_ACPI_IO_DECODE_10_BITS 0x01 ///< ISA controllers uses a 10-bit address decoder for I/O cycles.
-#define EFI_ISA_ACPI_IO_DECODE_16_BITS 0x02 ///< ISA controllers uses a 16-bit address decoder for I/O cycles.
+#define EFI_ISA_ACPI_IO_DECODE_10_BITS 0x01 ///< ISA controllers uses a 10-bit address decoder for I/O cycles.
+#define EFI_ISA_ACPI_IO_DECODE_16_BITS 0x02 ///< ISA controllers uses a 16-bit address decoder for I/O cycles.
///
/// EFI ISA ACPI resource type
@@ -79,26 +79,26 @@ typedef enum {
/// EFI ISA ACPI generic resource structure
///
typedef struct {
- EFI_ISA_ACPI_RESOURCE_TYPE Type; ///< The type of resource (I/O, MMIO, DMA, Interrupt).
- UINT32 Attribute; ///< Bit mask of attributes associated with this resource. See EFI_ISA_ACPI_xxx macros for valid combinations.
- UINT32 StartRange; ///< The start of the resource range.
- UINT32 EndRange; ///< The end of the resource range.
+ EFI_ISA_ACPI_RESOURCE_TYPE Type; ///< The type of resource (I/O, MMIO, DMA, Interrupt).
+ UINT32 Attribute; ///< Bit mask of attributes associated with this resource. See EFI_ISA_ACPI_xxx macros for valid combinations.
+ UINT32 StartRange; ///< The start of the resource range.
+ UINT32 EndRange; ///< The end of the resource range.
} EFI_ISA_ACPI_RESOURCE;
///
/// EFI ISA ACPI resource device identifier
///
typedef struct {
- UINT32 HID; ///< The ACPI Hardware Identifier value associated with an ISA controller. Matchs ACPI DSDT contents.
- UINT32 UID; ///< The ACPI Unique Identifier value associated with an ISA controller. Matches ACPI DSDT contents.
+ UINT32 HID; ///< The ACPI Hardware Identifier value associated with an ISA controller. Matchs ACPI DSDT contents.
+ UINT32 UID; ///< The ACPI Unique Identifier value associated with an ISA controller. Matches ACPI DSDT contents.
} EFI_ISA_ACPI_DEVICE_ID;
///
/// EFI ISA ACPI resource list
///
typedef struct {
- EFI_ISA_ACPI_DEVICE_ID Device; ///< The ACPI HID/UID associated with an ISA controller.
- EFI_ISA_ACPI_RESOURCE *ResourceItem; ///< A pointer to the list of resources associated with an ISA controller.
+ EFI_ISA_ACPI_DEVICE_ID Device; ///< The ACPI HID/UID associated with an ISA controller.
+ EFI_ISA_ACPI_RESOURCE *ResourceItem; ///< A pointer to the list of resources associated with an ISA controller.
} EFI_ISA_ACPI_RESOURCE_LIST;
/**
@@ -283,16 +283,16 @@ EFI_STATUS
/// and assign resources to an ISA controller.
///
struct _EFI_ISA_ACPI_PROTOCOL {
- EFI_ISA_ACPI_DEVICE_ENUMERATE DeviceEnumerate;
- EFI_ISA_ACPI_SET_DEVICE_POWER SetPower;
- EFI_ISA_ACPI_GET_CUR_RESOURCE GetCurResource;
- EFI_ISA_ACPI_GET_POS_RESOURCE GetPosResource;
- EFI_ISA_ACPI_SET_RESOURCE SetResource;
- EFI_ISA_ACPI_ENABLE_DEVICE EnableDevice;
- EFI_ISA_ACPI_INIT_DEVICE InitDevice;
- EFI_ISA_ACPI_INTERFACE_INIT InterfaceInit;
+ EFI_ISA_ACPI_DEVICE_ENUMERATE DeviceEnumerate;
+ EFI_ISA_ACPI_SET_DEVICE_POWER SetPower;
+ EFI_ISA_ACPI_GET_CUR_RESOURCE GetCurResource;
+ EFI_ISA_ACPI_GET_POS_RESOURCE GetPosResource;
+ EFI_ISA_ACPI_SET_RESOURCE SetResource;
+ EFI_ISA_ACPI_ENABLE_DEVICE EnableDevice;
+ EFI_ISA_ACPI_INIT_DEVICE InitDevice;
+ EFI_ISA_ACPI_INTERFACE_INIT InterfaceInit;
};
-extern EFI_GUID gEfiIsaAcpiProtocolGuid;
+extern EFI_GUID gEfiIsaAcpiProtocolGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Protocol/IsaIo.h b/OvmfPkg/Csm/Include/Protocol/IsaIo.h
index 8807e421fe..40a8171e95 100644
--- a/OvmfPkg/Csm/Include/Protocol/IsaIo.h
+++ b/OvmfPkg/Csm/Include/Protocol/IsaIo.h
@@ -128,11 +128,11 @@ typedef struct {
///
/// Read from ISA I/O or MMIO space.
///
- EFI_ISA_IO_PROTOCOL_IO_MEM Read;
+ EFI_ISA_IO_PROTOCOL_IO_MEM Read;
///
/// Write to ISA I/O or MMIO space.
///
- EFI_ISA_IO_PROTOCOL_IO_MEM Write;
+ EFI_ISA_IO_PROTOCOL_IO_MEM Write;
} EFI_ISA_IO_PROTOCOL_ACCESS;
/**
@@ -326,31 +326,31 @@ EFI_STATUS
/// ISA_PCI_IO_PROTOCOL instance associated with the ISA controller.
///
struct _EFI_ISA_IO_PROTOCOL {
- EFI_ISA_IO_PROTOCOL_ACCESS Mem;
- EFI_ISA_IO_PROTOCOL_ACCESS Io;
- EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem;
- EFI_ISA_IO_PROTOCOL_MAP Map;
- EFI_ISA_IO_PROTOCOL_UNMAP Unmap;
- EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
- EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
- EFI_ISA_IO_PROTOCOL_FLUSH Flush;
+ EFI_ISA_IO_PROTOCOL_ACCESS Mem;
+ EFI_ISA_IO_PROTOCOL_ACCESS Io;
+ EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem;
+ EFI_ISA_IO_PROTOCOL_MAP Map;
+ EFI_ISA_IO_PROTOCOL_UNMAP Unmap;
+ EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
+ EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
+ EFI_ISA_IO_PROTOCOL_FLUSH Flush;
///
/// The list of I/O , MMIO, DMA, and Interrupt resources associated with the
/// ISA controller abstracted by this instance of the EFI_ISA_IO_PROTOCOL.
///
- EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;
+ EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;
///
/// The size, in bytes, of the ROM image.
///
- UINT32 RomSize;
+ UINT32 RomSize;
///
/// A pointer to the in memory copy of the ROM image. The ISA Bus Driver is responsible
/// for allocating memory for the ROM image, and copying the contents of the ROM to memory
/// during ISA Bus initialization.
///
- VOID *RomImage;
+ VOID *RomImage;
};
-extern EFI_GUID gEfiIsaIoProtocolGuid;
+extern EFI_GUID gEfiIsaIoProtocolGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Protocol/LegacyBios.h b/OvmfPkg/Csm/Include/Protocol/LegacyBios.h
index 443f0c11a4..b9a225a874 100644
--- a/OvmfPkg/Csm/Include/Protocol/LegacyBios.h
+++ b/OvmfPkg/Csm/Include/Protocol/LegacyBios.h
@@ -26,10 +26,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
#pragma pack(1)
-typedef UINT8 SERIAL_MODE;
-typedef UINT8 PARALLEL_MODE;
+typedef UINT8 SERIAL_MODE;
+typedef UINT8 PARALLEL_MODE;
-#define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
+#define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
///
/// There is a table located within the traditional BIOS in either the 0xF000:xxxx or 0xE000:xxxx
@@ -44,75 +44,75 @@ typedef struct {
/// The string "$EFI" denotes the start of the EfiCompatibility table. Byte 0 is "I," byte
/// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32.
///
- UINT32 Signature;
+ UINT32 Signature;
///
/// The value required such that byte checksum of TableLength equals zero.
///
- UINT8 TableChecksum;
+ UINT8 TableChecksum;
///
/// The length of this table.
///
- UINT8 TableLength;
+ UINT8 TableLength;
///
/// The major EFI revision for which this table was generated.
///
- UINT8 EfiMajorRevision;
+ UINT8 EfiMajorRevision;
///
/// The minor EFI revision for which this table was generated.
///
- UINT8 EfiMinorRevision;
+ UINT8 EfiMinorRevision;
///
/// The major revision of this table.
///
- UINT8 TableMajorRevision;
+ UINT8 TableMajorRevision;
///
/// The minor revision of this table.
///
- UINT8 TableMinorRevision;
+ UINT8 TableMinorRevision;
///
/// Reserved for future usage.
///
- UINT16 Reserved;
+ UINT16 Reserved;
///
/// The segment of the entry point within the traditional BIOS for Compatibility16 functions.
///
- UINT16 Compatibility16CallSegment;
+ UINT16 Compatibility16CallSegment;
///
/// The offset of the entry point within the traditional BIOS for Compatibility16 functions.
///
- UINT16 Compatibility16CallOffset;
+ UINT16 Compatibility16CallOffset;
///
/// The segment of the entry point within the traditional BIOS for EfiCompatibility
/// to invoke the PnP installation check.
///
- UINT16 PnPInstallationCheckSegment;
+ UINT16 PnPInstallationCheckSegment;
///
/// The Offset of the entry point within the traditional BIOS for EfiCompatibility
/// to invoke the PnP installation check.
///
- UINT16 PnPInstallationCheckOffset;
+ UINT16 PnPInstallationCheckOffset;
///
/// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform
- ///Innovation Framework for EFI Driver Execution Environment Core Interface Specification (DXE CIS).
+ /// Innovation Framework for EFI Driver Execution Environment Core Interface Specification (DXE CIS).
///
- UINT32 EfiSystemTable;
+ UINT32 EfiSystemTable;
///
/// The address of an OEM-provided identifier string. The string is null terminated.
///
- UINT32 OemIdStringPointer;
+ UINT32 OemIdStringPointer;
///
/// The 32-bit physical address where ACPI RSD PTR is stored within the traditional
@@ -120,93 +120,93 @@ typedef struct {
/// reserved is the maximum for ACPI 2.0. The EfiCompatibility will fill in the ACPI
/// RSD PTR with either the ACPI 1.0b or 2.0 values.
///
- UINT32 AcpiRsdPtrPointer;
+ UINT32 AcpiRsdPtrPointer;
///
/// The OEM revision number. Usage is undefined but provided for OEM module usage.
///
- UINT16 OemRevision;
+ UINT16 OemRevision;
///
/// The 32-bit physical address where INT15 E820 data is stored within the traditional
/// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the
/// data to the indicated area.
///
- UINT32 E820Pointer;
+ UINT32 E820Pointer;
///
/// The length of the E820 data and is filled in by the EfiCompatibility code.
///
- UINT32 E820Length;
+ UINT32 E820Length;
///
/// The 32-bit physical address where the $PIR table is stored in the traditional BIOS.
/// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and
/// copy the data to the indicated area.
///
- UINT32 IrqRoutingTablePointer;
+ UINT32 IrqRoutingTablePointer;
///
/// The length of the $PIR table and is filled in by the EfiCompatibility code.
///
- UINT32 IrqRoutingTableLength;
+ UINT32 IrqRoutingTableLength;
///
/// The 32-bit physical address where the MP table is stored in the traditional BIOS.
/// The EfiCompatibility code will fill in the MpTablePtr value and copy the data
/// to the indicated area.
///
- UINT32 MpTablePtr;
+ UINT32 MpTablePtr;
///
/// The length of the MP table and is filled in by the EfiCompatibility code.
///
- UINT32 MpTableLength;
+ UINT32 MpTableLength;
///
/// The segment of the OEM-specific INT table/code.
///
- UINT16 OemIntSegment;
+ UINT16 OemIntSegment;
///
/// The offset of the OEM-specific INT table/code.
///
- UINT16 OemIntOffset;
+ UINT16 OemIntOffset;
///
/// The segment of the OEM-specific 32-bit table/code.
///
- UINT16 Oem32Segment;
+ UINT16 Oem32Segment;
///
/// The offset of the OEM-specific 32-bit table/code.
///
- UINT16 Oem32Offset;
+ UINT16 Oem32Offset;
///
/// The segment of the OEM-specific 16-bit table/code.
///
- UINT16 Oem16Segment;
+ UINT16 Oem16Segment;
///
/// The offset of the OEM-specific 16-bit table/code.
///
- UINT16 Oem16Offset;
+ UINT16 Oem16Offset;
///
/// The segment of the TPM binary passed to 16-bit CSM.
///
- UINT16 TpmSegment;
+ UINT16 TpmSegment;
///
/// The offset of the TPM binary passed to 16-bit CSM.
///
- UINT16 TpmOffset;
+ UINT16 TpmOffset;
///
/// A pointer to a string identifying the independent BIOS vendor.
///
- UINT32 IbvPointer;
+ UINT32 IbvPointer;
///
/// This field is NULL for all systems not supporting PCI Express. This field is the base
@@ -216,37 +216,37 @@ typedef struct {
/// Compatibility16InitializeYourself() is defined in Compatibility16
/// Functions.
///
- UINT32 PciExpressBase;
+ UINT32 PciExpressBase;
///
/// Maximum PCI bus number assigned.
///
- UINT8 LastPciBus;
+ UINT8 LastPciBus;
///
/// Start Address of Upper Memory Area (UMA) to be set as Read/Write. If
/// UmaAddress is a valid address in the shadow RAM, it also indicates that the region
/// from 0xC0000 to (UmaAddress - 1) can be used for Option ROM.
///
- UINT32 UmaAddress;
+ UINT32 UmaAddress;
///
/// Upper Memory Area size in bytes to be set as Read/Write. If zero, no UMA region
/// will be set as Read/Write (i.e. all Shadow RAM is set as Read-Only).
///
- UINT32 UmaSize;
+ UINT32 UmaSize;
///
/// Start Address of high memory that can be used for permanent allocation. If zero,
/// high memory is not available for permanent allocation.
///
- UINT32 HiPermanentMemoryAddress;
+ UINT32 HiPermanentMemoryAddress;
///
/// Size of high memory that can be used for permanent allocation in bytes. If zero,
/// high memory is not available for permanent allocation.
///
- UINT32 HiPermanentMemorySize;
+ UINT32 HiPermanentMemorySize;
} EFI_COMPATIBILITY16_TABLE;
///
@@ -267,7 +267,7 @@ typedef enum {
/// Return:
/// AX = Return Status codes
///
- Legacy16InitializeYourself = 0x0000,
+ Legacy16InitializeYourself = 0x0000,
///
/// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence.
@@ -277,7 +277,7 @@ typedef enum {
/// Return:
/// AX = Returned status codes
///
- Legacy16UpdateBbs = 0x0001,
+ Legacy16UpdateBbs = 0x0001,
///
/// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16
@@ -288,7 +288,7 @@ typedef enum {
/// Return:
/// AX = Returned status codes
///
- Legacy16PrepareToBoot = 0x0002,
+ Legacy16PrepareToBoot = 0x0002,
///
/// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only.
@@ -297,7 +297,7 @@ typedef enum {
/// Output:
/// AX = Returned status codes
///
- Legacy16Boot = 0x0003,
+ Legacy16Boot = 0x0003,
///
/// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is
@@ -319,7 +319,7 @@ typedef enum {
/// AX = Returned status codes
/// BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant.
///
- Legacy16DispatchOprom = 0x0005,
+ Legacy16DispatchOprom = 0x0005,
///
/// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address
@@ -336,7 +336,7 @@ typedef enum {
/// AX = Returned status codes
/// DS:BX = Address of the region
///
- Legacy16GetTableAddress = 0x0006,
+ Legacy16GetTableAddress = 0x0006,
///
/// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state.
@@ -349,7 +349,7 @@ typedef enum {
/// Output:
/// AX = Returned status codes
///
- Legacy16SetKeyboardLeds = 0x0007,
+ Legacy16SetKeyboardLeds = 0x0007,
///
/// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that
@@ -360,29 +360,27 @@ typedef enum {
/// Output:
/// AX = Returned status codes
///
- Legacy16InstallPciHandler = 0x0008
+ Legacy16InstallPciHandler = 0x0008
} EFI_COMPATIBILITY_FUNCTIONS;
-
///
/// EFI_DISPATCH_OPROM_TABLE
///
typedef struct {
- UINT16 PnPInstallationCheckSegment; ///< A pointer to the PnpInstallationCheck data structure.
- UINT16 PnPInstallationCheckOffset; ///< A pointer to the PnpInstallationCheck data structure.
- UINT16 OpromSegment; ///< The segment where the OpROM was placed. Offset is assumed to be 3.
- UINT8 PciBus; ///< The PCI bus.
- UINT8 PciDeviceFunction; ///< The PCI device * 0x08 | PCI function.
- UINT8 NumberBbsEntries; ///< The number of valid BBS table entries upon entry and exit. The IBV code may
- ///< increase this number, if BBS-compliant devices also hook INTs in order to force the
- ///< OpROM BIOS Setup to be executed.
- UINT32 BbsTablePointer; ///< A pointer to the BBS table.
- UINT16 RuntimeSegment; ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this
- ///< means that the relocation of this run time code is not supported.
- ///< Inconsistent with specification here:
- ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version]
- ///< has been changed to "RuntimeSegment" since keeping backward compatible.
-
+ UINT16 PnPInstallationCheckSegment; ///< A pointer to the PnpInstallationCheck data structure.
+ UINT16 PnPInstallationCheckOffset; ///< A pointer to the PnpInstallationCheck data structure.
+ UINT16 OpromSegment; ///< The segment where the OpROM was placed. Offset is assumed to be 3.
+ UINT8 PciBus; ///< The PCI bus.
+ UINT8 PciDeviceFunction; ///< The PCI device * 0x08 | PCI function.
+ UINT8 NumberBbsEntries; ///< The number of valid BBS table entries upon entry and exit. The IBV code may
+ ///< increase this number, if BBS-compliant devices also hook INTs in order to force the
+ ///< OpROM BIOS Setup to be executed.
+ UINT32 BbsTablePointer; ///< A pointer to the BBS table.
+ UINT16 RuntimeSegment; ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this
+ ///< means that the relocation of this run time code is not supported.
+ ///< Inconsistent with specification here:
+ ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version]
+ ///< has been changed to "RuntimeSegment" since keeping backward compatible.
} EFI_DISPATCH_OPROM_TABLE;
///
@@ -392,132 +390,132 @@ typedef struct {
///
/// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF.
///
- UINT32 BiosLessThan1MB;
+ UINT32 BiosLessThan1MB;
///
/// The starting address of the high memory block.
///
- UINT32 HiPmmMemory;
+ UINT32 HiPmmMemory;
///
/// The length of high memory block.
///
- UINT32 HiPmmMemorySizeInBytes;
+ UINT32 HiPmmMemorySizeInBytes;
///
/// The segment of the reverse thunk call code.
///
- UINT16 ReverseThunkCallSegment;
+ UINT16 ReverseThunkCallSegment;
///
/// The offset of the reverse thunk call code.
///
- UINT16 ReverseThunkCallOffset;
+ UINT16 ReverseThunkCallOffset;
///
/// The number of E820 entries copied to the Compatibility16 BIOS.
///
- UINT32 NumberE820Entries;
+ UINT32 NumberE820Entries;
///
/// The amount of usable memory above 1 MB, e.g., E820 type 1 memory.
///
- UINT32 OsMemoryAbove1Mb;
+ UINT32 OsMemoryAbove1Mb;
///
/// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM.
///
- UINT32 ThunkStart;
+ UINT32 ThunkStart;
///
/// The size of the thunk code.
///
- UINT32 ThunkSizeInBytes;
+ UINT32 ThunkSizeInBytes;
///
/// Starting address of memory under 1 MB.
///
- UINT32 LowPmmMemory;
+ UINT32 LowPmmMemory;
///
/// The length of low Memory block.
///
- UINT32 LowPmmMemorySizeInBytes;
+ UINT32 LowPmmMemorySizeInBytes;
} EFI_TO_COMPATIBILITY16_INIT_TABLE;
///
/// DEVICE_PRODUCER_SERIAL.
///
typedef struct {
- UINT16 Address; ///< I/O address assigned to the serial port.
- UINT8 Irq; ///< IRQ assigned to the serial port.
- SERIAL_MODE Mode; ///< Mode of serial port. Values are defined below.
+ UINT16 Address; ///< I/O address assigned to the serial port.
+ UINT8 Irq; ///< IRQ assigned to the serial port.
+ SERIAL_MODE Mode; ///< Mode of serial port. Values are defined below.
} DEVICE_PRODUCER_SERIAL;
///
/// DEVICE_PRODUCER_SERIAL's modes.
///@{
-#define DEVICE_SERIAL_MODE_NORMAL 0x00
-#define DEVICE_SERIAL_MODE_IRDA 0x01
-#define DEVICE_SERIAL_MODE_ASK_IR 0x02
-#define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
-#define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
-///@)
+#define DEVICE_SERIAL_MODE_NORMAL 0x00
+#define DEVICE_SERIAL_MODE_IRDA 0x01
+#define DEVICE_SERIAL_MODE_ASK_IR 0x02
+#define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
+#define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
+/// @)
///
/// DEVICE_PRODUCER_PARALLEL.
///
typedef struct {
- UINT16 Address; ///< I/O address assigned to the parallel port.
- UINT8 Irq; ///< IRQ assigned to the parallel port.
- UINT8 Dma; ///< DMA assigned to the parallel port.
- PARALLEL_MODE Mode; ///< Mode of the parallel port. Values are defined below.
+ UINT16 Address; ///< I/O address assigned to the parallel port.
+ UINT8 Irq; ///< IRQ assigned to the parallel port.
+ UINT8 Dma; ///< DMA assigned to the parallel port.
+ PARALLEL_MODE Mode; ///< Mode of the parallel port. Values are defined below.
} DEVICE_PRODUCER_PARALLEL;
///
/// DEVICE_PRODUCER_PARALLEL's modes.
///@{
-#define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
-#define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
-#define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
-#define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
+#define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
+#define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
+#define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
+#define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
///@}
///
/// DEVICE_PRODUCER_FLOPPY
///
typedef struct {
- UINT16 Address; ///< I/O address assigned to the floppy.
- UINT8 Irq; ///< IRQ assigned to the floppy.
- UINT8 Dma; ///< DMA assigned to the floppy.
- UINT8 NumberOfFloppy; ///< Number of floppies in the system.
+ UINT16 Address; ///< I/O address assigned to the floppy.
+ UINT8 Irq; ///< IRQ assigned to the floppy.
+ UINT8 Dma; ///< DMA assigned to the floppy.
+ UINT8 NumberOfFloppy; ///< Number of floppies in the system.
} DEVICE_PRODUCER_FLOPPY;
///
/// LEGACY_DEVICE_FLAGS
///
typedef struct {
- UINT32 A20Kybd : 1; ///< A20 controller by keyboard controller.
- UINT32 A20Port90 : 1; ///< A20 controlled by port 0x92.
- UINT32 Reserved : 30; ///< Reserved for future usage.
+ UINT32 A20Kybd : 1; ///< A20 controller by keyboard controller.
+ UINT32 A20Port90 : 1; ///< A20 controlled by port 0x92.
+ UINT32 Reserved : 30; ///< Reserved for future usage.
} LEGACY_DEVICE_FLAGS;
///
/// DEVICE_PRODUCER_DATA_HEADER
///
typedef struct {
- DEVICE_PRODUCER_SERIAL Serial[4]; ///< Data for serial port x. Type DEVICE_PRODUCER_SERIAL is defined below.
- DEVICE_PRODUCER_PARALLEL Parallel[3]; ///< Data for parallel port x. Type DEVICE_PRODUCER_PARALLEL is defined below.
- DEVICE_PRODUCER_FLOPPY Floppy; ///< Data for floppy. Type DEVICE_PRODUCER_FLOPPY is defined below.
- UINT8 MousePresent; ///< Flag to indicate if mouse is present.
- LEGACY_DEVICE_FLAGS Flags; ///< Miscellaneous Boolean state information passed to CSM.
+ DEVICE_PRODUCER_SERIAL Serial[4]; ///< Data for serial port x. Type DEVICE_PRODUCER_SERIAL is defined below.
+ DEVICE_PRODUCER_PARALLEL Parallel[3]; ///< Data for parallel port x. Type DEVICE_PRODUCER_PARALLEL is defined below.
+ DEVICE_PRODUCER_FLOPPY Floppy; ///< Data for floppy. Type DEVICE_PRODUCER_FLOPPY is defined below.
+ UINT8 MousePresent; ///< Flag to indicate if mouse is present.
+ LEGACY_DEVICE_FLAGS Flags; ///< Miscellaneous Boolean state information passed to CSM.
} DEVICE_PRODUCER_DATA_HEADER;
///
/// ATAPI_IDENTIFY
///
typedef struct {
- UINT16 Raw[256]; ///< Raw data from the IDE IdentifyDrive command.
+ UINT16 Raw[256]; ///< Raw data from the IDE IdentifyDrive command.
} ATAPI_IDENTIFY;
///
@@ -529,44 +527,44 @@ typedef struct {
/// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index
/// 1 is slave.
///
- UINT16 Status;
+ UINT16 Status;
///
/// PCI bus of IDE controller.
///
- UINT32 Bus;
+ UINT32 Bus;
///
/// PCI device of IDE controller.
///
- UINT32 Device;
+ UINT32 Device;
///
/// PCI function of IDE controller.
///
- UINT32 Function;
+ UINT32 Function;
///
/// Command ports base address.
///
- UINT16 CommandBaseAddress;
+ UINT16 CommandBaseAddress;
///
/// Control ports base address.
///
- UINT16 ControlBaseAddress;
+ UINT16 ControlBaseAddress;
///
/// Bus master address.
///
- UINT16 BusMasterAddress;
+ UINT16 BusMasterAddress;
- UINT8 HddIrq;
+ UINT8 HddIrq;
///
/// Data that identifies the drive data; one per possible attached drive.
///
- ATAPI_IDENTIFY IdentifyDrive[2];
+ ATAPI_IDENTIFY IdentifyDrive[2];
} HDD_INFO;
///
@@ -585,10 +583,10 @@ typedef struct {
/// BBS_STATUS_FLAGS;\.
///
typedef struct {
- UINT16 OldPosition : 4; ///< Prior priority.
- UINT16 Reserved1 : 4; ///< Reserved for future use.
- UINT16 Enabled : 1; ///< If 0, ignore this entry.
- UINT16 Failed : 1; ///< 0 = Not known if boot failure occurred.
+ UINT16 OldPosition : 4; ///< Prior priority.
+ UINT16 Reserved1 : 4; ///< Reserved for future use.
+ UINT16 Enabled : 1; ///< If 0, ignore this entry.
+ UINT16 Failed : 1; ///< 0 = Not known if boot failure occurred.
///< 1 = Boot attempted failed.
///
@@ -598,8 +596,8 @@ typedef struct {
/// 10 = Media is present and appears bootable.
/// 11 = Reserved.
///
- UINT16 MediaPresent : 2;
- UINT16 Reserved2 : 4; ///< Reserved for future use.
+ UINT16 MediaPresent : 2;
+ UINT16 Reserved2 : 4; ///< Reserved for future use.
} BBS_STATUS_FLAGS;
///
@@ -609,134 +607,134 @@ typedef struct {
///
/// The boot priority for this boot device. Values are defined below.
///
- UINT16 BootPriority;
+ UINT16 BootPriority;
///
/// The PCI bus for this boot device.
///
- UINT32 Bus;
+ UINT32 Bus;
///
/// The PCI device for this boot device.
///
- UINT32 Device;
+ UINT32 Device;
///
/// The PCI function for the boot device.
///
- UINT32 Function;
+ UINT32 Function;
///
/// The PCI class for this boot device.
///
- UINT8 Class;
+ UINT8 Class;
///
/// The PCI Subclass for this boot device.
///
- UINT8 SubClass;
+ UINT8 SubClass;
///
/// Segment:offset address of an ASCIIZ description string describing the manufacturer.
///
- UINT16 MfgStringOffset;
+ UINT16 MfgStringOffset;
///
/// Segment:offset address of an ASCIIZ description string describing the manufacturer.
///
- UINT16 MfgStringSegment;
+ UINT16 MfgStringSegment;
///
/// BBS device type. BBS device types are defined below.
///
- UINT16 DeviceType;
+ UINT16 DeviceType;
///
/// Status of this boot device. Type BBS_STATUS_FLAGS is defined below.
///
- BBS_STATUS_FLAGS StatusFlags;
+ BBS_STATUS_FLAGS StatusFlags;
///
/// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
/// BCV devices.
///
- UINT16 BootHandlerOffset;
+ UINT16 BootHandlerOffset;
///
/// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
/// BCV devices.
///
- UINT16 BootHandlerSegment;
+ UINT16 BootHandlerSegment;
///
/// Segment:offset address of an ASCIIZ description string describing this device.
///
- UINT16 DescStringOffset;
+ UINT16 DescStringOffset;
///
/// Segment:offset address of an ASCIIZ description string describing this device.
///
- UINT16 DescStringSegment;
+ UINT16 DescStringSegment;
///
/// Reserved.
///
- UINT32 InitPerReserved;
+ UINT32 InitPerReserved;
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
- UINT32 AdditionalIrq13Handler;
+ UINT32 AdditionalIrq13Handler;
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
- UINT32 AdditionalIrq18Handler;
+ UINT32 AdditionalIrq18Handler;
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
- UINT32 AdditionalIrq19Handler;
+ UINT32 AdditionalIrq19Handler;
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
- UINT32 AdditionalIrq40Handler;
- UINT8 AssignedDriveNumber;
- UINT32 AdditionalIrq41Handler;
- UINT32 AdditionalIrq46Handler;
- UINT32 IBV1;
- UINT32 IBV2;
+ UINT32 AdditionalIrq40Handler;
+ UINT8 AssignedDriveNumber;
+ UINT32 AdditionalIrq41Handler;
+ UINT32 AdditionalIrq46Handler;
+ UINT32 IBV1;
+ UINT32 IBV2;
} BBS_TABLE;
///
/// BBS device type values
///@{
-#define BBS_FLOPPY 0x01
-#define BBS_HARDDISK 0x02
-#define BBS_CDROM 0x03
-#define BBS_PCMCIA 0x04
-#define BBS_USB 0x05
-#define BBS_EMBED_NETWORK 0x06
-#define BBS_BEV_DEVICE 0x80
-#define BBS_UNKNOWN 0xff
+#define BBS_FLOPPY 0x01
+#define BBS_HARDDISK 0x02
+#define BBS_CDROM 0x03
+#define BBS_PCMCIA 0x04
+#define BBS_USB 0x05
+#define BBS_EMBED_NETWORK 0x06
+#define BBS_BEV_DEVICE 0x80
+#define BBS_UNKNOWN 0xff
///@}
///
/// BBS boot priority values
///@{
-#define BBS_DO_NOT_BOOT_FROM 0xFFFC
-#define BBS_LOWEST_PRIORITY 0xFFFD
-#define BBS_UNPRIORITIZED_ENTRY 0xFFFE
-#define BBS_IGNORE_ENTRY 0xFFFF
+#define BBS_DO_NOT_BOOT_FROM 0xFFFC
+#define BBS_LOWEST_PRIORITY 0xFFFD
+#define BBS_UNPRIORITIZED_ENTRY 0xFFFE
+#define BBS_IGNORE_ENTRY 0xFFFF
///@}
///
@@ -747,70 +745,70 @@ typedef struct {
/// Access mechanism used to generate the soft SMI. Defined types are below. The other
/// values are reserved for future usage.
///
- UINT16 Type : 3;
+ UINT16 Type : 3;
///
/// The size of "port" in bits. Defined values are below.
///
- UINT16 PortGranularity : 3;
+ UINT16 PortGranularity : 3;
///
/// The size of data in bits. Defined values are below.
///
- UINT16 DataGranularity : 3;
+ UINT16 DataGranularity : 3;
///
/// Reserved for future use.
///
- UINT16 Reserved : 7;
+ UINT16 Reserved : 7;
} SMM_ATTRIBUTES;
///
/// SMM_ATTRIBUTES type values.
///@{
-#define STANDARD_IO 0x00
-#define STANDARD_MEMORY 0x01
+#define STANDARD_IO 0x00
+#define STANDARD_MEMORY 0x01
///@}
///
/// SMM_ATTRIBUTES port size constants.
///@{
-#define PORT_SIZE_8 0x00
-#define PORT_SIZE_16 0x01
-#define PORT_SIZE_32 0x02
-#define PORT_SIZE_64 0x03
+#define PORT_SIZE_8 0x00
+#define PORT_SIZE_16 0x01
+#define PORT_SIZE_32 0x02
+#define PORT_SIZE_64 0x03
///@}
///
/// SMM_ATTRIBUTES data size constants.
///@{
-#define DATA_SIZE_8 0x00
-#define DATA_SIZE_16 0x01
-#define DATA_SIZE_32 0x02
-#define DATA_SIZE_64 0x03
+#define DATA_SIZE_8 0x00
+#define DATA_SIZE_16 0x01
+#define DATA_SIZE_32 0x02
+#define DATA_SIZE_64 0x03
///@}
///
/// SMM_FUNCTION & relating constants.
///
typedef struct {
- UINT16 Function : 15;
- UINT16 Owner : 1;
+ UINT16 Function : 15;
+ UINT16 Owner : 1;
} SMM_FUNCTION;
///
/// SMM_FUNCTION Function constants.
///@{
-#define INT15_D042 0x0000
-#define GET_USB_BOOT_INFO 0x0001
-#define DMI_PNP_50_57 0x0002
+#define INT15_D042 0x0000
+#define GET_USB_BOOT_INFO 0x0001
+#define DMI_PNP_50_57 0x0002
///@}
///
/// SMM_FUNCTION Owner constants.
///@{
-#define STANDARD_OWNER 0x0
-#define OEM_OWNER 0x1
+#define STANDARD_OWNER 0x0
+#define OEM_OWNER 0x1
///@}
///
@@ -822,30 +820,30 @@ typedef struct {
/// Describes the access mechanism, SmmPort, and SmmData sizes. Type
/// SMM_ATTRIBUTES is defined below.
///
- SMM_ATTRIBUTES SmmAttributes;
+ SMM_ATTRIBUTES SmmAttributes;
///
/// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below.
///
- SMM_FUNCTION SmmFunction;
+ SMM_FUNCTION SmmFunction;
///
/// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes.
///
- UINT8 SmmPort;
+ UINT8 SmmPort;
///
/// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes.
///
- UINT8 SmmData;
+ UINT8 SmmData;
} SMM_ENTRY;
///
/// SMM_TABLE
///
typedef struct {
- UINT16 NumSmmEntries; ///< Number of entries represented by SmmEntry.
- SMM_ENTRY SmmEntry; ///< One entry per function. Type SMM_ENTRY is defined below.
+ UINT16 NumSmmEntries; ///< Number of entries represented by SmmEntry.
+ SMM_ENTRY SmmEntry; ///< One entry per function. Type SMM_ENTRY is defined below.
} SMM_TABLE;
///
@@ -855,23 +853,23 @@ typedef struct {
///
/// This bit set indicates that the ServiceAreaData is valid.
///
- UINT8 DirectoryServiceValidity : 1;
+ UINT8 DirectoryServiceValidity : 1;
///
/// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if
/// DirectoryServiceValidity is 0.
///
- UINT8 RabcaUsedFlag : 1;
+ UINT8 RabcaUsedFlag : 1;
///
/// This bit set indicates to execute hard disk diagnostics.
///
- UINT8 ExecuteHddDiagnosticsFlag : 1;
+ UINT8 ExecuteHddDiagnosticsFlag : 1;
///
/// Reserved for future use. Set to 0.
///
- UINT8 Reserved : 5;
+ UINT8 Reserved : 5;
} UDC_ATTRIBUTES;
///
@@ -882,74 +880,74 @@ typedef struct {
/// This field contains the bit-mapped attributes of the PARTIES information. Type
/// UDC_ATTRIBUTES is defined below.
///
- UDC_ATTRIBUTES Attributes;
+ UDC_ATTRIBUTES Attributes;
///
/// This field contains the zero-based device on which the selected
/// ServiceDataArea is present. It is 0 for master and 1 for the slave device.
///
- UINT8 DeviceNumber;
+ UINT8 DeviceNumber;
///
/// This field contains the zero-based index into the BbsTable for the parent device.
/// This index allows the user to reference the parent device information such as PCI
/// bus, device function.
///
- UINT8 BbsTableEntryNumberForParentDevice;
+ UINT8 BbsTableEntryNumberForParentDevice;
///
/// This field contains the zero-based index into the BbsTable for the boot entry.
///
- UINT8 BbsTableEntryNumberForBoot;
+ UINT8 BbsTableEntryNumberForBoot;
///
/// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry.
///
- UINT8 BbsTableEntryNumberForHddDiag;
+ UINT8 BbsTableEntryNumberForHddDiag;
///
/// The raw Beer data.
///
- UINT8 BeerData[128];
+ UINT8 BeerData[128];
///
/// The raw data of selected service area.
///
- UINT8 ServiceAreaData[64];
+ UINT8 ServiceAreaData[64];
} UD_TABLE;
-#define EFI_TO_LEGACY_MAJOR_VERSION 0x02
-#define EFI_TO_LEGACY_MINOR_VERSION 0x00
-#define MAX_IDE_CONTROLLER 8
+#define EFI_TO_LEGACY_MAJOR_VERSION 0x02
+#define EFI_TO_LEGACY_MINOR_VERSION 0x00
+#define MAX_IDE_CONTROLLER 8
///
/// EFI_TO_COMPATIBILITY16_BOOT_TABLE
///
typedef struct {
- UINT16 MajorVersion; ///< The EfiCompatibility major version number.
- UINT16 MinorVersion; ///< The EfiCompatibility minor version number.
- UINT32 AcpiTable; ///< The location of the RSDT ACPI table. < 4G range.
- UINT32 SmbiosTable; ///< The location of the SMBIOS table in EFI memory. < 4G range.
- UINT32 SmbiosTableLength;
+ UINT16 MajorVersion; ///< The EfiCompatibility major version number.
+ UINT16 MinorVersion; ///< The EfiCompatibility minor version number.
+ UINT32 AcpiTable; ///< The location of the RSDT ACPI table. < 4G range.
+ UINT32 SmbiosTable; ///< The location of the SMBIOS table in EFI memory. < 4G range.
+ UINT32 SmbiosTableLength;
//
// Legacy SIO state
//
- DEVICE_PRODUCER_DATA_HEADER SioData; ///< Standard traditional device information.
- UINT16 DevicePathType; ///< The default boot type.
- UINT16 PciIrqMask; ///< Mask of which IRQs have been assigned to PCI.
- UINT32 NumberE820Entries; ///< Number of E820 entries. The number can change from the
+ DEVICE_PRODUCER_DATA_HEADER SioData; ///< Standard traditional device information.
+ UINT16 DevicePathType; ///< The default boot type.
+ UINT16 PciIrqMask; ///< Mask of which IRQs have been assigned to PCI.
+ UINT32 NumberE820Entries; ///< Number of E820 entries. The number can change from the
///< Compatibility16InitializeYourself() function.
//
// Controller & Drive Identify[2] per controller information
//
- HDD_INFO HddInfo[MAX_IDE_CONTROLLER]; ///< Hard disk drive information, including raw Identify Drive data.
- UINT32 NumberBbsEntries; ///< Number of entries in the BBS table
- UINT32 BbsTable; ///< A pointer to the BBS table. Type BBS_TABLE is defined below.
- UINT32 SmmTable; ///< A pointer to the SMM table. Type SMM_TABLE is defined below.
- UINT32 OsMemoryAbove1Mb; ///< The amount of usable memory above 1 MB, i.e. E820 type 1 memory. This value can
+ HDD_INFO HddInfo[MAX_IDE_CONTROLLER]; ///< Hard disk drive information, including raw Identify Drive data.
+ UINT32 NumberBbsEntries; ///< Number of entries in the BBS table
+ UINT32 BbsTable; ///< A pointer to the BBS table. Type BBS_TABLE is defined below.
+ UINT32 SmmTable; ///< A pointer to the SMM table. Type SMM_TABLE is defined below.
+ UINT32 OsMemoryAbove1Mb; ///< The amount of usable memory above 1 MB, i.e. E820 type 1 memory. This value can
///< differ from the value in EFI_TO_COMPATIBILITY16_INIT_TABLE as more
///< memory may have been discovered.
- UINT32 UnconventionalDeviceTable; ///< Information to boot off an unconventional device like a PARTIES partition. Type
+ UINT32 UnconventionalDeviceTable; ///< Information to boot off an unconventional device like a PARTIES partition. Type
///< UD_TABLE is defined below.
} EFI_TO_COMPATIBILITY16_BOOT_TABLE;
@@ -957,28 +955,28 @@ typedef struct {
/// EFI_LEGACY_INSTALL_PCI_HANDLER
///
typedef struct {
- UINT8 PciBus; ///< The PCI bus of the device.
- UINT8 PciDeviceFun; ///< The PCI device in bits 7:3 and function in bits 2:0.
- UINT8 PciSegment; ///< The PCI segment of the device.
- UINT8 PciClass; ///< The PCI class code of the device.
- UINT8 PciSubclass; ///< The PCI subclass code of the device.
- UINT8 PciInterface; ///< The PCI interface code of the device.
+ UINT8 PciBus; ///< The PCI bus of the device.
+ UINT8 PciDeviceFun; ///< The PCI device in bits 7:3 and function in bits 2:0.
+ UINT8 PciSegment; ///< The PCI segment of the device.
+ UINT8 PciClass; ///< The PCI class code of the device.
+ UINT8 PciSubclass; ///< The PCI subclass code of the device.
+ UINT8 PciInterface; ///< The PCI interface code of the device.
//
// Primary section
//
- UINT8 PrimaryIrq; ///< The primary device IRQ.
- UINT8 PrimaryReserved; ///< Reserved.
- UINT16 PrimaryControl; ///< The primary device control I/O base.
- UINT16 PrimaryBase; ///< The primary device I/O base.
- UINT16 PrimaryBusMaster; ///< The primary device bus master I/O base.
+ UINT8 PrimaryIrq; ///< The primary device IRQ.
+ UINT8 PrimaryReserved; ///< Reserved.
+ UINT16 PrimaryControl; ///< The primary device control I/O base.
+ UINT16 PrimaryBase; ///< The primary device I/O base.
+ UINT16 PrimaryBusMaster; ///< The primary device bus master I/O base.
//
// Secondary Section
//
- UINT8 SecondaryIrq; ///< The secondary device IRQ.
- UINT8 SecondaryReserved; ///< Reserved.
- UINT16 SecondaryControl; ///< The secondary device control I/O base.
- UINT16 SecondaryBase; ///< The secondary device I/O base.
- UINT16 SecondaryBusMaster; ///< The secondary device bus master I/O base.
+ UINT8 SecondaryIrq; ///< The secondary device IRQ.
+ UINT8 SecondaryReserved; ///< Reserved.
+ UINT16 SecondaryControl; ///< The secondary device control I/O base.
+ UINT16 SecondaryBase; ///< The secondary device I/O base.
+ UINT16 SecondaryBusMaster; ///< The secondary device bus master I/O base.
} EFI_LEGACY_INSTALL_PCI_HANDLER;
//
@@ -1007,128 +1005,128 @@ typedef struct _EFI_LEGACY_BIOS_PROTOCOL EFI_LEGACY_BIOS_PROTOCOL;
/// to Segment:Offset 16-bit form.
///
///@{
-#define EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)
-#define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)
+#define EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)
+#define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)
///@}
-#define CARRY_FLAG 0x01
+#define CARRY_FLAG 0x01
///
/// EFI_EFLAGS_REG
///
typedef struct {
- UINT32 CF:1;
- UINT32 Reserved1:1;
- UINT32 PF:1;
- UINT32 Reserved2:1;
- UINT32 AF:1;
- UINT32 Reserved3:1;
- UINT32 ZF:1;
- UINT32 SF:1;
- UINT32 TF:1;
- UINT32 IF:1;
- UINT32 DF:1;
- UINT32 OF:1;
- UINT32 IOPL:2;
- UINT32 NT:1;
- UINT32 Reserved4:2;
- UINT32 VM:1;
- UINT32 Reserved5:14;
+ UINT32 CF : 1;
+ UINT32 Reserved1 : 1;
+ UINT32 PF : 1;
+ UINT32 Reserved2 : 1;
+ UINT32 AF : 1;
+ UINT32 Reserved3 : 1;
+ UINT32 ZF : 1;
+ UINT32 SF : 1;
+ UINT32 TF : 1;
+ UINT32 IF : 1;
+ UINT32 DF : 1;
+ UINT32 OF : 1;
+ UINT32 IOPL : 2;
+ UINT32 NT : 1;
+ UINT32 Reserved4 : 2;
+ UINT32 VM : 1;
+ UINT32 Reserved5 : 14;
} EFI_EFLAGS_REG;
///
/// EFI_DWORD_REGS
///
typedef struct {
- UINT32 EAX;
- UINT32 EBX;
- UINT32 ECX;
- UINT32 EDX;
- UINT32 ESI;
- UINT32 EDI;
- EFI_EFLAGS_REG EFlags;
- UINT16 ES;
- UINT16 CS;
- UINT16 SS;
- UINT16 DS;
- UINT16 FS;
- UINT16 GS;
- UINT32 EBP;
- UINT32 ESP;
+ UINT32 EAX;
+ UINT32 EBX;
+ UINT32 ECX;
+ UINT32 EDX;
+ UINT32 ESI;
+ UINT32 EDI;
+ EFI_EFLAGS_REG EFlags;
+ UINT16 ES;
+ UINT16 CS;
+ UINT16 SS;
+ UINT16 DS;
+ UINT16 FS;
+ UINT16 GS;
+ UINT32 EBP;
+ UINT32 ESP;
} EFI_DWORD_REGS;
///
/// EFI_FLAGS_REG
///
typedef struct {
- UINT16 CF:1;
- UINT16 Reserved1:1;
- UINT16 PF:1;
- UINT16 Reserved2:1;
- UINT16 AF:1;
- UINT16 Reserved3:1;
- UINT16 ZF:1;
- UINT16 SF:1;
- UINT16 TF:1;
- UINT16 IF:1;
- UINT16 DF:1;
- UINT16 OF:1;
- UINT16 IOPL:2;
- UINT16 NT:1;
- UINT16 Reserved4:1;
+ UINT16 CF : 1;
+ UINT16 Reserved1 : 1;
+ UINT16 PF : 1;
+ UINT16 Reserved2 : 1;
+ UINT16 AF : 1;
+ UINT16 Reserved3 : 1;
+ UINT16 ZF : 1;
+ UINT16 SF : 1;
+ UINT16 TF : 1;
+ UINT16 IF : 1;
+ UINT16 DF : 1;
+ UINT16 OF : 1;
+ UINT16 IOPL : 2;
+ UINT16 NT : 1;
+ UINT16 Reserved4 : 1;
} EFI_FLAGS_REG;
///
/// EFI_WORD_REGS
///
typedef struct {
- UINT16 AX;
- UINT16 ReservedAX;
- UINT16 BX;
- UINT16 ReservedBX;
- UINT16 CX;
- UINT16 ReservedCX;
- UINT16 DX;
- UINT16 ReservedDX;
- UINT16 SI;
- UINT16 ReservedSI;
- UINT16 DI;
- UINT16 ReservedDI;
- EFI_FLAGS_REG Flags;
- UINT16 ReservedFlags;
- UINT16 ES;
- UINT16 CS;
- UINT16 SS;
- UINT16 DS;
- UINT16 FS;
- UINT16 GS;
- UINT16 BP;
- UINT16 ReservedBP;
- UINT16 SP;
- UINT16 ReservedSP;
+ UINT16 AX;
+ UINT16 ReservedAX;
+ UINT16 BX;
+ UINT16 ReservedBX;
+ UINT16 CX;
+ UINT16 ReservedCX;
+ UINT16 DX;
+ UINT16 ReservedDX;
+ UINT16 SI;
+ UINT16 ReservedSI;
+ UINT16 DI;
+ UINT16 ReservedDI;
+ EFI_FLAGS_REG Flags;
+ UINT16 ReservedFlags;
+ UINT16 ES;
+ UINT16 CS;
+ UINT16 SS;
+ UINT16 DS;
+ UINT16 FS;
+ UINT16 GS;
+ UINT16 BP;
+ UINT16 ReservedBP;
+ UINT16 SP;
+ UINT16 ReservedSP;
} EFI_WORD_REGS;
///
/// EFI_BYTE_REGS
///
typedef struct {
- UINT8 AL, AH;
- UINT16 ReservedAX;
- UINT8 BL, BH;
- UINT16 ReservedBX;
- UINT8 CL, CH;
- UINT16 ReservedCX;
- UINT8 DL, DH;
- UINT16 ReservedDX;
+ UINT8 AL, AH;
+ UINT16 ReservedAX;
+ UINT8 BL, BH;
+ UINT16 ReservedBX;
+ UINT8 CL, CH;
+ UINT16 ReservedCX;
+ UINT8 DL, DH;
+ UINT16 ReservedDX;
} EFI_BYTE_REGS;
///
/// EFI_IA32_REGISTER_SET
///
typedef union {
- EFI_DWORD_REGS E;
- EFI_WORD_REGS X;
- EFI_BYTE_REGS H;
+ EFI_DWORD_REGS E;
+ EFI_WORD_REGS X;
+ EFI_BYTE_REGS H;
} EFI_IA32_REGISTER_SET;
/**
@@ -1453,63 +1451,63 @@ struct _EFI_LEGACY_BIOS_PROTOCOL {
///
/// Performs traditional software INT. See the Int86() function description.
///
- EFI_LEGACY_BIOS_INT86 Int86;
+ EFI_LEGACY_BIOS_INT86 Int86;
///
/// Performs a far call into Compatibility16 or traditional OpROM code.
///
- EFI_LEGACY_BIOS_FARCALL86 FarCall86;
+ EFI_LEGACY_BIOS_FARCALL86 FarCall86;
///
/// Checks if a traditional OpROM exists for this device.
///
- EFI_LEGACY_BIOS_CHECK_ROM CheckPciRom;
+ EFI_LEGACY_BIOS_CHECK_ROM CheckPciRom;
///
/// Loads a traditional OpROM in traditional OpROM address space.
///
- EFI_LEGACY_BIOS_INSTALL_ROM InstallPciRom;
+ EFI_LEGACY_BIOS_INSTALL_ROM InstallPciRom;
///
/// Boots a traditional OS.
///
- EFI_LEGACY_BIOS_BOOT LegacyBoot;
+ EFI_LEGACY_BIOS_BOOT LegacyBoot;
///
/// Updates BDA to reflect the current EFI keyboard LED status.
///
- EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS UpdateKeyboardLedStatus;
+ EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS UpdateKeyboardLedStatus;
///
/// Allows an external agent, such as BIOS Setup, to get the BBS data.
///
- EFI_LEGACY_BIOS_GET_BBS_INFO GetBbsInfo;
+ EFI_LEGACY_BIOS_GET_BBS_INFO GetBbsInfo;
///
/// Causes all legacy OpROMs to be shadowed.
///
- EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS ShadowAllLegacyOproms;
+ EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS ShadowAllLegacyOproms;
///
/// Performs all actions prior to boot. Used when booting an EFI-aware OS
/// rather than a legacy OS.
///
- EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI PrepareToBootEfi;
+ EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI PrepareToBootEfi;
///
/// Allows EFI to reserve an area in the 0xE0000 or 0xF0000 block.
///
- EFI_LEGACY_BIOS_GET_LEGACY_REGION GetLegacyRegion;
+ EFI_LEGACY_BIOS_GET_LEGACY_REGION GetLegacyRegion;
///
/// Allows EFI to copy data to the area specified by GetLegacyRegion.
///
- EFI_LEGACY_BIOS_COPY_LEGACY_REGION CopyLegacyRegion;
+ EFI_LEGACY_BIOS_COPY_LEGACY_REGION CopyLegacyRegion;
///
/// Allows the user to boot off an unconventional device such as a PARTIES partition.
///
- EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE BootUnconventionalDevice;
+ EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE BootUnconventionalDevice;
};
//
@@ -1548,6 +1546,6 @@ struct _EFI_LEGACY_BIOS_PROTOCOL {
} \
} while (FALSE)
-extern EFI_GUID gEfiLegacyBiosProtocolGuid;
+extern EFI_GUID gEfiLegacyBiosProtocolGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h b/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
index 37f5d9178b..941b1c8331 100644
--- a/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
+++ b/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
@@ -66,7 +66,7 @@ typedef enum {
///
/// EFI_UNSUPPORTED The MP table is not supported on this platform.
///
- EfiGetPlatformBinaryMpTable = 0,
+ EfiGetPlatformBinaryMpTable = 0,
///
/// This mode returns a block of data. The content and usage is IBV or OEM defined.
/// OEMs or IBVs normally use this function for nonstandard Compatibility16 runtime soft
@@ -104,7 +104,7 @@ typedef enum {
///
/// EFI_UNSUPPORTED Oem INT is not supported on this platform.
///
- EfiGetPlatformBinaryOemIntData = 1,
+ EfiGetPlatformBinaryOemIntData = 1,
///
/// This mode returns a block of data. The content and usage is IBV defined. OEMs or
/// IBVs normally use this mode for nonstandard Compatibility16 runtime 16 bit routines. It
@@ -146,57 +146,57 @@ typedef enum {
///
/// EFI_UNSUPPORTED Oem16 is not supported on this platform.
///
- EfiGetPlatformBinaryOem16Data = 2,
-///
-/// This mode returns a block of data. The content and usage are IBV defined. OEMs or
-/// IBVs normally use this mode for nonstandard Compatibility16 runtime 32 bit routines. It
-/// is the responsibility of this routine to coalesce multiple OEM 32 bit functions, if they
-/// exist, into one coherent package that is understandable by the Compatibility16 code.
-///
-/// Example usage: A legacy mobile BIOS that has a pre existing runtime
-/// interface to return the battery status to calling applications.
-///
-/// This mode is invoked twice. The first invocation has LegacySegment and
-/// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
-///
-/// The second invocation has LegacySegment and LegacyOffset set to the location
-/// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
-/// invocation allows any table address fix ups to occur in the EFI memory copy of the table.
-/// The caller, not EfiGetPlatformBinaryOem32Data, copies the modified table to
-/// the allocated region in 0xF0000 or 0xE0000 block after the second invocation..
-///
-/// Note: There are two generic mechanisms by which this mode can be used.
-/// Mechanism 1: This mode returns the data and the Legacy BIOS Protocol copies
-/// the data into the F0000 or E0000 block in the Compatibility16 code. The
-/// EFI_COMPATIBILITY16_TABLE entries Oem32Segment and Oem32Offset can
-/// be viewed as two UINT16 entries.
-/// Mechanism 2: This mode directly fills in the EFI_COMPATIBILITY16_TABLE with
-/// a pointer to the INT15 E820 region containing the 32 bit code. It returns
-/// EFI_UNSUPPORTED. The EFI_COMPATIBILITY16_TABLE entries,
-/// Oem32Segment and Oem32Offset, can be viewed as two UINT16 entries or
-/// as a single UINT32 entry as determined by the IBV.
-///
-/// The function parameters associated with this mode are:
-///
-/// TableSize Size of data.
-///
-/// Location Location to place the table. 0x00 or 0xE0000 or 0xF0000 64 KB blocks.
-/// Bit 0 = 1 0xF0000 64 KB block.
-/// Bit 1 = 1 0xE0000 64 KB block.
-/// Multiple bits can be set.
-///
-/// Alignment Bit mapped address alignment granularity.
-/// The first nonzero bit from the right is the address granularity.
-///
-/// LegacySegment Segment in which EfiCompatibility code will place the table or data.
-///
-/// LegacyOffset Offset in which EfiCompatibility code will place the table or data.
-///
-/// The return values associated with this mode are:
-/// EFI_SUCCESS The data was returned successfully.
-/// EFI_UNSUPPORTED Oem32 is not supported on this platform.
-///
-EfiGetPlatformBinaryOem32Data = 3,
+ EfiGetPlatformBinaryOem16Data = 2,
+ ///
+ /// This mode returns a block of data. The content and usage are IBV defined. OEMs or
+ /// IBVs normally use this mode for nonstandard Compatibility16 runtime 32 bit routines. It
+ /// is the responsibility of this routine to coalesce multiple OEM 32 bit functions, if they
+ /// exist, into one coherent package that is understandable by the Compatibility16 code.
+ ///
+ /// Example usage: A legacy mobile BIOS that has a pre existing runtime
+ /// interface to return the battery status to calling applications.
+ ///
+ /// This mode is invoked twice. The first invocation has LegacySegment and
+ /// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
+ ///
+ /// The second invocation has LegacySegment and LegacyOffset set to the location
+ /// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
+ /// invocation allows any table address fix ups to occur in the EFI memory copy of the table.
+ /// The caller, not EfiGetPlatformBinaryOem32Data, copies the modified table to
+ /// the allocated region in 0xF0000 or 0xE0000 block after the second invocation..
+ ///
+ /// Note: There are two generic mechanisms by which this mode can be used.
+ /// Mechanism 1: This mode returns the data and the Legacy BIOS Protocol copies
+ /// the data into the F0000 or E0000 block in the Compatibility16 code. The
+ /// EFI_COMPATIBILITY16_TABLE entries Oem32Segment and Oem32Offset can
+ /// be viewed as two UINT16 entries.
+ /// Mechanism 2: This mode directly fills in the EFI_COMPATIBILITY16_TABLE with
+ /// a pointer to the INT15 E820 region containing the 32 bit code. It returns
+ /// EFI_UNSUPPORTED. The EFI_COMPATIBILITY16_TABLE entries,
+ /// Oem32Segment and Oem32Offset, can be viewed as two UINT16 entries or
+ /// as a single UINT32 entry as determined by the IBV.
+ ///
+ /// The function parameters associated with this mode are:
+ ///
+ /// TableSize Size of data.
+ ///
+ /// Location Location to place the table. 0x00 or 0xE0000 or 0xF0000 64 KB blocks.
+ /// Bit 0 = 1 0xF0000 64 KB block.
+ /// Bit 1 = 1 0xE0000 64 KB block.
+ /// Multiple bits can be set.
+ ///
+ /// Alignment Bit mapped address alignment granularity.
+ /// The first nonzero bit from the right is the address granularity.
+ ///
+ /// LegacySegment Segment in which EfiCompatibility code will place the table or data.
+ ///
+ /// LegacyOffset Offset in which EfiCompatibility code will place the table or data.
+ ///
+ /// The return values associated with this mode are:
+ /// EFI_SUCCESS The data was returned successfully.
+ /// EFI_UNSUPPORTED Oem32 is not supported on this platform.
+ ///
+ EfiGetPlatformBinaryOem32Data = 3,
///
/// This mode returns a TPM binary image for the onboard TPM device.
///
@@ -226,7 +226,7 @@ EfiGetPlatformBinaryOem32Data = 3,
///
/// EFI_NOT_FOUND No BinaryImage was found.
///
- EfiGetPlatformBinaryTpmBinary = 4,
+ EfiGetPlatformBinaryTpmBinary = 4,
///
/// The mode finds the Compatibility16 Rom Image.
///
@@ -250,7 +250,7 @@ EfiGetPlatformBinaryOem32Data = 3,
///
/// EFI_NOT_FOUND ROM not found.
///
- EfiGetPlatformBinarySystemRom = 5,
+ EfiGetPlatformBinarySystemRom = 5,
///
/// This mode returns the Base address of PciExpress memory mapped configuration
/// address space.
@@ -275,9 +275,9 @@ EfiGetPlatformBinaryOem32Data = 3,
///
/// EFI_UNSUPPORTED System does not PciExpress.
///
- EfiGetPlatformPciExpressBase = 6,
+ EfiGetPlatformPciExpressBase = 6,
///
- EfiGetPlatformPmmSize = 7,
+ EfiGetPlatformPmmSize = 7,
///
EfiGetPlatformEndOpromShadowAddr = 8,
///
@@ -301,7 +301,7 @@ typedef enum {
///
/// AdditionalData NULL.
///
- EfiGetPlatformVgaHandle = 0,
+ EfiGetPlatformVgaHandle = 0,
///
/// This mode returns the Compatibility16 policy for the device that should be the IDE
/// controller used during a Compatibility16 boot.
@@ -317,7 +317,7 @@ typedef enum {
/// AdditionalData Pointer to HddInfo.
/// Information about all onboard IDE controllers.
///
- EfiGetPlatformIdeHandle = 1,
+ EfiGetPlatformIdeHandle = 1,
///
/// This mode returns the Compatibility16 policy for the device that should be the ISA bus
/// controller used during a Compatibility16 boot.
@@ -332,7 +332,7 @@ typedef enum {
///
/// AdditionalData NULL.
///
- EfiGetPlatformIsaBusHandle = 2,
+ EfiGetPlatformIsaBusHandle = 2,
///
/// This mode returns the Compatibility16 policy for the device that should be the USB
/// device used during a Compatibility16 boot.
@@ -347,7 +347,7 @@ typedef enum {
///
/// AdditionalData NULL.
///
- EfiGetPlatformUsbHandle = 3
+ EfiGetPlatformUsbHandle = 3
} EFI_GET_PLATFORM_HANDLE_MODE;
/**
@@ -387,7 +387,7 @@ typedef enum {
///
/// AdditionalData NULL.
///
- EfiPlatformHookShadowServiceRoms= 1,
+ EfiPlatformHookShadowServiceRoms = 1,
///
/// This mode allows platform to perform any required operation after an OpROM has
/// completed its initialization.
@@ -404,21 +404,21 @@ typedef enum {
///
/// AdditionalData NULL.
///
- EfiPlatformHookAfterRomInit = 2
+ EfiPlatformHookAfterRomInit = 2
} EFI_GET_PLATFORM_HOOK_MODE;
///
/// This IRQ has not been assigned to PCI.
///
-#define PCI_UNUSED 0x00
+#define PCI_UNUSED 0x00
///
/// This IRQ has been assigned to PCI.
///
-#define PCI_USED 0xFF
+#define PCI_USED 0xFF
///
/// This IRQ has been used by an SIO legacy device and cannot be used by PCI.
///
-#define LEGACY_USED 0xFE
+#define LEGACY_USED 0xFE
#pragma pack(1)
@@ -426,7 +426,7 @@ typedef struct {
///
/// IRQ for this entry.
///
- UINT8 Irq;
+ UINT8 Irq;
///
/// Status of this IRQ.
///
@@ -437,103 +437,101 @@ typedef struct {
/// LEGACY_USED 0xFE. This IRQ has been used by an SIO legacy
/// device and cannot be used by PCI.
///
- UINT8 Used;
+ UINT8 Used;
} EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY;
//
// Define PIR table structures
//
-#define EFI_LEGACY_PIRQ_TABLE_SIGNATURE SIGNATURE_32 ('$', 'P', 'I', 'R')
+#define EFI_LEGACY_PIRQ_TABLE_SIGNATURE SIGNATURE_32 ('$', 'P', 'I', 'R')
typedef struct {
///
/// $PIR.
///
- UINT32 Signature;
+ UINT32 Signature;
///
/// 0x00.
///
- UINT8 MinorVersion;
+ UINT8 MinorVersion;
///
/// 0x01 for table version 1.0.
///
- UINT8 MajorVersion;
+ UINT8 MajorVersion;
///
/// 0x20 + RoutingTableEntries * 0x10.
///
- UINT16 TableSize;
+ UINT16 TableSize;
///
/// PCI interrupt router bus.
///
- UINT8 Bus;
+ UINT8 Bus;
///
/// PCI interrupt router device/function.
///
- UINT8 DevFun;
+ UINT8 DevFun;
///
/// If nonzero, bit map of IRQs reserved for PCI.
///
- UINT16 PciOnlyIrq;
+ UINT16 PciOnlyIrq;
///
/// Vendor ID of a compatible PCI interrupt router.
///
- UINT16 CompatibleVid;
+ UINT16 CompatibleVid;
///
/// Device ID of a compatible PCI interrupt router.
///
- UINT16 CompatibleDid;
+ UINT16 CompatibleDid;
///
/// If nonzero, a value passed directly to the IRQ miniport's Initialize function.
///
- UINT32 Miniport;
+ UINT32 Miniport;
///
/// Reserved for future usage.
///
- UINT8 Reserved[11];
+ UINT8 Reserved[11];
///
/// This byte plus the sum of all other bytes in the LocalPirqTable equal 0x00.
///
- UINT8 Checksum;
+ UINT8 Checksum;
} EFI_LEGACY_PIRQ_TABLE_HEADER;
-
typedef struct {
///
/// If nonzero, a value assigned by the IBV.
///
- UINT8 Pirq;
+ UINT8 Pirq;
///
/// If nonzero, the IRQs that can be assigned to this device.
///
- UINT16 IrqMask;
+ UINT16 IrqMask;
} EFI_LEGACY_PIRQ_ENTRY;
typedef struct {
///
/// PCI bus of the entry.
///
- UINT8 Bus;
+ UINT8 Bus;
///
/// PCI device of this entry.
///
- UINT8 Device;
+ UINT8 Device;
///
/// An IBV value and IRQ mask for PIRQ pins A through D.
///
- EFI_LEGACY_PIRQ_ENTRY PirqEntry[4];
+ EFI_LEGACY_PIRQ_ENTRY PirqEntry[4];
///
/// If nonzero, the slot number assigned by the board manufacturer.
///
- UINT8 Slot;
+ UINT8 Slot;
///
/// Reserved for future use.
///
- UINT8 Reserved;
+ UINT8 Reserved;
} EFI_LEGACY_IRQ_ROUTING_ENTRY;
#pragma pack()
-
/**
Finds the binary data or other platform information.
@@ -725,31 +723,31 @@ struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL {
///
/// Gets binary data or other platform information.
///
- EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO GetPlatformInfo;
+ EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO GetPlatformInfo;
///
/// Returns a buffer of all handles matching the requested subfunction.
///
- EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE GetPlatformHandle;
+ EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE GetPlatformHandle;
///
/// Loads and initializes the traditional BIOS SMM handler.
- EFI_LEGACY_BIOS_PLATFORM_SMM_INIT SmmInit;
+ EFI_LEGACY_BIOS_PLATFORM_SMM_INIT SmmInit;
///
/// Allows platform to perform any required actions after a LegacyBios operation.
///
- EFI_LEGACY_BIOS_PLATFORM_HOOKS PlatformHooks;
+ EFI_LEGACY_BIOS_PLATFORM_HOOKS PlatformHooks;
///
/// Gets $PIR table.
- EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE GetRoutingTable;
+ EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE GetRoutingTable;
///
/// Translates the given PIRQ to the final value after traversing any PCI bridges.
///
- EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ TranslatePirq;
+ EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ TranslatePirq;
///
/// Final platform function before the system attempts to boot to a traditional OS.
///
- EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT PrepareToBoot;
+ EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT PrepareToBoot;
};
-extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;
+extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h b/OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h
index b3ad2ffb3c..8287ad5b5c 100644
--- a/OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h
+++ b/OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h
@@ -13,7 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _EFI_LEGACY_INTERRUPT_H_
#define _EFI_LEGACY_INTERRUPT_H_
-
#define EFI_LEGACY_INTERRUPT_PROTOCOL_GUID \
{ \
0x31ce593d, 0x108a, 0x485d, {0xad, 0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe } \
@@ -99,24 +98,24 @@ struct _EFI_LEGACY_INTERRUPT_PROTOCOL {
///
/// Gets the number of PIRQs supported.
///
- EFI_LEGACY_INTERRUPT_GET_NUMBER_PIRQS GetNumberPirqs;
+ EFI_LEGACY_INTERRUPT_GET_NUMBER_PIRQS GetNumberPirqs;
///
/// Gets the PCI bus, device, and function that is associated with this protocol.
///
- EFI_LEGACY_INTERRUPT_GET_LOCATION GetLocation;
+ EFI_LEGACY_INTERRUPT_GET_LOCATION GetLocation;
///
/// Reads the indicated PIRQ register.
///
- EFI_LEGACY_INTERRUPT_READ_PIRQ ReadPirq;
+ EFI_LEGACY_INTERRUPT_READ_PIRQ ReadPirq;
///
/// Writes to the indicated PIRQ register.
///
- EFI_LEGACY_INTERRUPT_WRITE_PIRQ WritePirq;
+ EFI_LEGACY_INTERRUPT_WRITE_PIRQ WritePirq;
};
-extern EFI_GUID gEfiLegacyInterruptProtocolGuid;
+extern EFI_GUID gEfiLegacyInterruptProtocolGuid;
#endif
diff --git a/OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h b/OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h
index 5071c712ff..fa023a2dfa 100644
--- a/OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h
+++ b/OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h
@@ -20,7 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// Forward declaration for the EFI_VGA_MINI_PORT_PROTOCOL.
///
-typedef struct _EFI_VGA_MINI_PORT_PROTOCOL EFI_VGA_MINI_PORT_PROTOCOL;
+typedef struct _EFI_VGA_MINI_PORT_PROTOCOL EFI_VGA_MINI_PORT_PROTOCOL;
/**
Sets the text display mode of a VGA controller.
@@ -49,40 +49,40 @@ EFI_STATUS
);
struct _EFI_VGA_MINI_PORT_PROTOCOL {
- EFI_VGA_MINI_PORT_SET_MODE SetMode;
+ EFI_VGA_MINI_PORT_SET_MODE SetMode;
///
/// MMIO base address of the VGA text mode framebuffer. Typically set to 0xB8000.
///
- UINT64 VgaMemoryOffset;
+ UINT64 VgaMemoryOffset;
///
/// I/O Port address for the VGA CRTC address register. Typically set to 0x3D4.
///
- UINT64 CrtcAddressRegisterOffset;
+ UINT64 CrtcAddressRegisterOffset;
///
/// I/O Port address for the VGA CRTC data register. Typically set to 0x3D5.
///
- UINT64 CrtcDataRegisterOffset;
+ UINT64 CrtcDataRegisterOffset;
///
/// PCI Controller MMIO BAR index of the VGA text mode frame buffer. Typically
/// set to EFI_PCI_IO_PASS_THROUGH_BAR
///
- UINT8 VgaMemoryBar;
+ UINT8 VgaMemoryBar;
///
/// PCI Controller I/O BAR index of the VGA CRTC address register. Typically
/// set to EFI_PCI_IO_PASS_THROUGH_BAR
///
- UINT8 CrtcAddressRegisterBar;
+ UINT8 CrtcAddressRegisterBar;
///
/// PCI Controller I/O BAR index of the VGA CRTC data register. Typically set
/// to EFI_PCI_IO_PASS_THROUGH_BAR
///
- UINT8 CrtcDataRegisterBar;
+ UINT8 CrtcDataRegisterBar;
///
/// The maximum number of text modes that this VGA controller supports.
///
- UINT8 MaxMode;
+ UINT8 MaxMode;
};
-extern EFI_GUID gEfiVgaMiniPortProtocolGuid;
+extern EFI_GUID gEfiVgaMiniPortProtocolGuid;
#endif
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c
index 5e4c7a249e..cd80720a1d 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c
@@ -14,13 +14,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// FLOPPY_NOT_PRESENT = No floppy controller present
// FLOPPY_PRESENT_NO_MEDIA = Floppy controller present but no media inserted
//
-#define FLOPPY_NOT_PRESENT 0
-#define FLOPPY_PRESENT_WITH_MEDIA 1
-#define FLOPPY_PRESENT_NO_MEDIA 2
+#define FLOPPY_NOT_PRESENT 0
+#define FLOPPY_PRESENT_WITH_MEDIA 1
+#define FLOPPY_PRESENT_NO_MEDIA 2
-BBS_TABLE *mBbsTable;
-BOOLEAN mBbsTableDoneFlag = FALSE;
-BOOLEAN IsHaveMediaInFloppy = TRUE;
+BBS_TABLE *mBbsTable;
+BOOLEAN mBbsTableDoneFlag = FALSE;
+BOOLEAN IsHaveMediaInFloppy = TRUE;
/**
Checks the state of the floppy and if media is inserted.
@@ -44,23 +44,23 @@ HasMediaInFloppy (
VOID
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- EFI_ISA_IO_PROTOCOL *IsaIo;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ EFI_ISA_IO_PROTOCOL *IsaIo;
+ EFI_BLOCK_IO_PROTOCOL *BlkIo;
- HandleBuffer = NULL;
- HandleCount = 0;
+ HandleBuffer = NULL;
+ HandleCount = 0;
gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiIsaIoProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ ByProtocol,
+ &gEfiIsaIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
//
// If don't find any ISA/IO protocol assume no floppy. Need for floppy
@@ -76,7 +76,7 @@ HasMediaInFloppy (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiIsaIoProtocolGuid,
- (VOID **) &IsaIo
+ (VOID **)&IsaIo
);
if (EFI_ERROR (Status)) {
continue;
@@ -85,6 +85,7 @@ HasMediaInFloppy (
if (IsaIo->ResourceList->Device.HID != EISA_PNP_ID (0x604)) {
continue;
}
+
//
// Update blockio in case the floppy is inserted in during BdsTimeout
//
@@ -103,7 +104,7 @@ HasMediaInFloppy (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
+ (VOID **)&BlkIo
);
if (EFI_ERROR (Status)) {
continue;
@@ -121,10 +122,8 @@ HasMediaInFloppy (
FreePool (HandleBuffer);
return FLOPPY_NOT_PRESENT;
-
}
-
/**
Complete build of BBS TABLE.
@@ -136,8 +135,8 @@ HasMediaInFloppy (
**/
EFI_STATUS
LegacyBiosBuildBbs (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN BBS_TABLE *BbsTable
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN BBS_TABLE *BbsTable
)
{
UINTN BbsIndex;
@@ -172,18 +171,18 @@ LegacyBiosBuildBbs (
}
}
- BbsTable[0].Bus = 0xff;
- BbsTable[0].Device = 0xff;
- BbsTable[0].Function = 0xff;
- BbsTable[0].DeviceType = BBS_FLOPPY;
- BbsTable[0].Class = 01;
- BbsTable[0].SubClass = 02;
- BbsTable[0].StatusFlags.OldPosition = 0;
- BbsTable[0].StatusFlags.Reserved1 = 0;
- BbsTable[0].StatusFlags.Enabled = 0;
- BbsTable[0].StatusFlags.Failed = 0;
- BbsTable[0].StatusFlags.MediaPresent = 0;
- BbsTable[0].StatusFlags.Reserved2 = 0;
+ BbsTable[0].Bus = 0xff;
+ BbsTable[0].Device = 0xff;
+ BbsTable[0].Function = 0xff;
+ BbsTable[0].DeviceType = BBS_FLOPPY;
+ BbsTable[0].Class = 01;
+ BbsTable[0].SubClass = 02;
+ BbsTable[0].StatusFlags.OldPosition = 0;
+ BbsTable[0].StatusFlags.Reserved1 = 0;
+ BbsTable[0].StatusFlags.Enabled = 0;
+ BbsTable[0].StatusFlags.Failed = 0;
+ BbsTable[0].StatusFlags.MediaPresent = 0;
+ BbsTable[0].StatusFlags.Reserved2 = 0;
//
// Onboard HDD - Note Each HDD controller controls 2 drives
@@ -196,10 +195,8 @@ LegacyBiosBuildBbs (
LegacyBiosBuildIdeData (Private, &HddInfo, 0);
for (HddIndex = 0; HddIndex < MAX_IDE_CONTROLLER; HddIndex++) {
-
BbsIndex = HddIndex * 2 + 1;
for (Index = 0; Index < 2; ++Index) {
-
BbsTable[BbsIndex + Index].Bus = HddInfo[HddIndex].Bus;
BbsTable[BbsIndex + Index].Device = HddInfo[HddIndex].Device;
BbsTable[BbsIndex + Index].Function = HddInfo[HddIndex].Function;
@@ -286,7 +283,7 @@ LegacyBiosBuildBbs (
Status = gBS->HandleProtocol (
BlockIoHandles[BlockIndex],
&gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
+ (VOID **)&BlkIo
);
if (EFI_ERROR (Status)) {
@@ -313,7 +310,7 @@ LegacyBiosBuildBbs (
Status = gBS->HandleProtocol (
BlockIoHandles[BlockIndex],
&gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath
+ (VOID **)&DevicePath
);
if (EFI_ERROR (Status)) {
continue;
@@ -324,14 +321,17 @@ LegacyBiosBuildBbs (
//
DevicePathNode = DevicePath;
while (!IsDevicePathEnd (DevicePathNode)) {
- if (DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH &&
- DevicePathSubType (DevicePathNode) == MSG_ATAPI_DP) {
+ if ((DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePathNode) == MSG_ATAPI_DP))
+ {
break;
}
+
DevicePathNode = NextDevicePathNode (DevicePathNode);
}
+
if (!IsDevicePathEnd (DevicePathNode)) {
- continue;
+ continue;
}
//
@@ -349,7 +349,7 @@ LegacyBiosBuildBbs (
Status = gBS->HandleProtocol (
PciHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
if (EFI_ERROR (Status)) {
continue;
@@ -367,13 +367,21 @@ LegacyBiosBuildBbs (
}
if (SegNum != 0) {
- DEBUG ((DEBUG_WARN, "CSM cannot use PCI devices in segment %Lu\n",
- (UINT64) SegNum));
+ DEBUG ((
+ DEBUG_WARN,
+ "CSM cannot use PCI devices in segment %Lu\n",
+ (UINT64)SegNum
+ ));
continue;
}
- DEBUG ((DEBUG_INFO, "Add Legacy Bbs entry for PCI %d/%d/%d\n",
- BusNum, DevNum, FuncNum));
+ DEBUG ((
+ DEBUG_INFO,
+ "Add Legacy Bbs entry for PCI %d/%d/%d\n",
+ BusNum,
+ DevNum,
+ FuncNum
+ ));
BbsTable[BbsIndex].Bus = BusNum;
BbsTable[BbsIndex].Device = DevNum;
@@ -403,7 +411,6 @@ LegacyBiosBuildBbs (
return EFI_SUCCESS;
}
-
/**
Get all BBS info
@@ -421,30 +428,30 @@ LegacyBiosBuildBbs (
EFI_STATUS
EFIAPI
LegacyBiosGetBbsInfo (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- OUT UINT16 *HddCount,
- OUT HDD_INFO **HddInfo,
- OUT UINT16 *BbsCount,
- OUT BBS_TABLE **BbsTable
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ OUT UINT16 *HddCount,
+ OUT HDD_INFO **HddInfo,
+ OUT UINT16 *BbsCount,
+ OUT BBS_TABLE **BbsTable
)
{
- LEGACY_BIOS_INSTANCE *Private;
- EFI_IA32_REGISTER_SET Regs;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
-// HDD_INFO *LocalHddInfo;
-// IN BBS_TABLE *LocalBbsTable;
- UINTN NumHandles;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- UINTN TempData;
- UINT32 Granularity;
-
- HandleBuffer = NULL;
-
- Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
- EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
-// LocalHddInfo = EfiToLegacy16BootTable->HddInfo;
-// LocalBbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
+ LEGACY_BIOS_INSTANCE *Private;
+ EFI_IA32_REGISTER_SET Regs;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
+ // HDD_INFO *LocalHddInfo;
+ // IN BBS_TABLE *LocalBbsTable;
+ UINTN NumHandles;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ UINTN TempData;
+ UINT32 Granularity;
+
+ HandleBuffer = NULL;
+
+ Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
+ EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
+ // LocalHddInfo = EfiToLegacy16BootTable->HddInfo;
+ // LocalBbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
if (!mBbsTableDoneFlag) {
mBbsTable = Private->BbsTablePtr;
@@ -457,12 +464,12 @@ LegacyBiosGetBbsInfo (
// Get PciRootBridgeIO protocol
//
gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiPciRootBridgeIoProtocolGuid,
- NULL,
- &NumHandles,
- &HandleBuffer
- );
+ ByProtocol,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
if (NumHandles == 0) {
return EFI_NOT_FOUND;
@@ -475,7 +482,6 @@ LegacyBiosGetBbsInfo (
// PCI bus driver enumerate all subsequent handles
//
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, FALSE);
-
}
LegacyBiosBuildBbs (Private, mBbsTable);
@@ -491,18 +497,18 @@ LegacyBiosGetBbsInfo (
//
// Pass in handoff data
//
- TempData = (UINTN) EfiToLegacy16BootTable;
- Regs.X.ES = NORMALIZE_EFI_SEGMENT ((UINT32) TempData);
- Regs.X.BX = NORMALIZE_EFI_OFFSET ((UINT32) TempData);
+ TempData = (UINTN)EfiToLegacy16BootTable;
+ Regs.X.ES = NORMALIZE_EFI_SEGMENT ((UINT32)TempData);
+ Regs.X.BX = NORMALIZE_EFI_OFFSET ((UINT32)TempData);
Private->LegacyBios.FarCall86 (
- This,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ This,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
Private->Cpu->FlushDataCache (Private->Cpu, 0xE0000, 0x20000, EfiCpuFlushTypeWriteBackInvalidate);
Private->LegacyRegion->Lock (Private->LegacyRegion, 0xe0000, 0x20000, &Granularity);
@@ -518,7 +524,7 @@ LegacyBiosGetBbsInfo (
*HddCount = MAX_IDE_CONTROLLER;
*HddInfo = EfiToLegacy16BootTable->HddInfo;
- *BbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
- *BbsCount = (UINT16) (sizeof (Private->IntThunk->BbsTable) / sizeof (BBS_TABLE));
+ *BbsTable = (BBS_TABLE *)(UINTN)EfiToLegacy16BootTable->BbsTable;
+ *BbsCount = (UINT16)(sizeof (Private->IntThunk->BbsTable) / sizeof (BBS_TABLE));
return EFI_SUCCESS;
}
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBda.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBda.c
index aa6e07ab91..a873015d06 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBda.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBda.c
@@ -21,25 +21,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_STATUS
LegacyBiosInitBda (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- BDA_STRUC *Bda;
- UINT8 *Ebda;
+ BDA_STRUC *Bda;
+ UINT8 *Ebda;
- Bda = (BDA_STRUC *) ((UINTN) 0x400);
- Ebda = (UINT8 *) ((UINTN) 0x9fc00);
+ Bda = (BDA_STRUC *)((UINTN)0x400);
+ Ebda = (UINT8 *)((UINTN)0x9fc00);
ACCESS_PAGE0_CODE (
ZeroMem (Bda, 0x100);
//
// 640k-1k for EBDA
//
- Bda->MemSize = 0x27f;
- Bda->KeyHead = 0x1e;
- Bda->KeyTail = 0x1e;
- Bda->FloppyData = 0x00;
- Bda->FloppyTimeout = 0xff;
+ Bda->MemSize = 0x27f;
+ Bda->KeyHead = 0x1e;
+ Bda->KeyTail = 0x1e;
+ Bda->FloppyData = 0x00;
+ Bda->FloppyTimeout = 0xff;
Bda->KeyStart = 0x001E;
Bda->KeyEnd = 0x003E;
@@ -50,10 +50,10 @@ LegacyBiosInitBda (
// Move LPT time out here and zero out LPT4 since some SCSI OPROMS
// use this as scratch pad (LPT4 is Reserved)
//
- Bda->Lpt1_2Timeout = 0x1414;
- Bda->Lpt3_4Timeout = 0x1400;
+ Bda->Lpt1_2Timeout = 0x1414;
+ Bda->Lpt3_4Timeout = 0x1400;
- );
+ );
ZeroMem (Ebda, 0x400);
*Ebda = 0x01;
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c
index 3ce19496b0..d587b55e3b 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c
@@ -13,7 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// define maximum number of HDD system supports
//
-#define MAX_HDD_ENTRIES 0x30
+#define MAX_HDD_ENTRIES 0x30
//
// Module Global:
@@ -25,7 +25,7 @@ LEGACY_BIOS_INSTANCE mPrivateData;
//
// The SMBIOS table in EfiRuntimeServicesData memory
//
-VOID *mRuntimeSmbiosEntryPoint = NULL;
+VOID *mRuntimeSmbiosEntryPoint = NULL;
//
// The SMBIOS table in EfiReservedMemoryType memory
@@ -50,27 +50,27 @@ BOOLEAN mEndOfDxe = FALSE;
**/
EFI_STATUS
AllocateLegacyMemory (
- IN EFI_ALLOCATE_TYPE AllocateType,
- IN EFI_MEMORY_TYPE MemoryType,
- IN EFI_PHYSICAL_ADDRESS StartPageAddress,
- IN UINTN Pages,
- OUT EFI_PHYSICAL_ADDRESS *Result
+ IN EFI_ALLOCATE_TYPE AllocateType,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN EFI_PHYSICAL_ADDRESS StartPageAddress,
+ IN UINTN Pages,
+ OUT EFI_PHYSICAL_ADDRESS *Result
)
{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS MemPage;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS MemPage;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
//
// Allocate Pages of memory less <= StartPageAddress
//
- MemPage = (EFI_PHYSICAL_ADDRESS) (UINTN) StartPageAddress;
- Status = gBS->AllocatePages (
- AllocateType,
- MemoryType,
- Pages,
- &MemPage
- );
+ MemPage = (EFI_PHYSICAL_ADDRESS)(UINTN)StartPageAddress;
+ Status = gBS->AllocatePages (
+ AllocateType,
+ MemoryType,
+ Pages,
+ &MemPage
+ );
//
// Do not ASSERT on Status error but let caller decide since some cases
// memory is already taken but that is ok.
@@ -81,13 +81,14 @@ AllocateLegacyMemory (
// Make sure that the buffer can be used to store code.
//
Status = gDS->GetMemorySpaceDescriptor (MemPage, &MemDesc);
- if (!EFI_ERROR (Status) && (MemDesc.Attributes & EFI_MEMORY_XP) != 0) {
+ if (!EFI_ERROR (Status) && ((MemDesc.Attributes & EFI_MEMORY_XP) != 0)) {
Status = gDS->SetMemorySpaceAttributes (
MemPage,
EFI_PAGES_TO_SIZE (Pages),
MemDesc.Attributes & (~EFI_MEMORY_XP)
);
}
+
if (EFI_ERROR (Status)) {
gBS->FreePages (MemPage, Pages);
}
@@ -95,13 +96,12 @@ AllocateLegacyMemory (
}
if (!EFI_ERROR (Status)) {
- *Result = (EFI_PHYSICAL_ADDRESS) (UINTN) MemPage;
+ *Result = (EFI_PHYSICAL_ADDRESS)(UINTN)MemPage;
}
return Status;
}
-
/**
This function is called when EFI needs to reserve an area in the 0xE0000 or 0xF0000
64 KB blocks.
@@ -126,39 +126,38 @@ AllocateLegacyMemory (
EFI_STATUS
EFIAPI
LegacyBiosGetLegacyRegion (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINTN LegacyMemorySize,
- IN UINTN Region,
- IN UINTN Alignment,
- OUT VOID **LegacyMemoryAddress
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINTN LegacyMemorySize,
+ IN UINTN Region,
+ IN UINTN Alignment,
+ OUT VOID **LegacyMemoryAddress
)
{
-
- LEGACY_BIOS_INSTANCE *Private;
- EFI_IA32_REGISTER_SET Regs;
- EFI_STATUS Status;
- UINT32 Granularity;
+ LEGACY_BIOS_INSTANCE *Private;
+ EFI_IA32_REGISTER_SET Regs;
+ EFI_STATUS Status;
+ UINT32 Granularity;
Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
Private->LegacyRegion->UnLock (Private->LegacyRegion, 0xE0000, 0x20000, &Granularity);
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16GetTableAddress;
- Regs.X.BX = (UINT16) Region;
- Regs.X.CX = (UINT16) LegacyMemorySize;
- Regs.X.DX = (UINT16) Alignment;
+ Regs.X.BX = (UINT16)Region;
+ Regs.X.CX = (UINT16)LegacyMemorySize;
+ Regs.X.DX = (UINT16)Alignment;
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ &Private->LegacyBios,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
if (Regs.X.AX == 0) {
- *LegacyMemoryAddress = (VOID *) (((UINTN) Regs.X.DS << 4) + Regs.X.BX);
- Status = EFI_SUCCESS;
+ *LegacyMemoryAddress = (VOID *)(((UINTN)Regs.X.DS << 4) + Regs.X.BX);
+ Status = EFI_SUCCESS;
} else {
Status = EFI_OUT_OF_RESOURCES;
}
@@ -169,7 +168,6 @@ LegacyBiosGetLegacyRegion (
return Status;
}
-
/**
This function is called when copying data to the region assigned by
EFI_LEGACY_BIOS_PROTOCOL.GetLegacyRegion().
@@ -187,21 +185,22 @@ LegacyBiosGetLegacyRegion (
EFI_STATUS
EFIAPI
LegacyBiosCopyLegacyRegion (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINTN LegacyMemorySize,
- IN VOID *LegacyMemoryAddress,
- IN VOID *LegacyMemorySourceAddress
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINTN LegacyMemorySize,
+ IN VOID *LegacyMemoryAddress,
+ IN VOID *LegacyMemorySourceAddress
)
{
-
LEGACY_BIOS_INSTANCE *Private;
UINT32 Granularity;
- if ((LegacyMemoryAddress < (VOID *)(UINTN)0xE0000 ) ||
- ((UINTN) LegacyMemoryAddress + LegacyMemorySize > (UINTN) 0x100000)
- ) {
+ if ((LegacyMemoryAddress < (VOID *)(UINTN)0xE0000) ||
+ ((UINTN)LegacyMemoryAddress + LegacyMemorySize > (UINTN)0x100000)
+ )
+ {
return EFI_ACCESS_DENIED;
}
+
//
// There is no protection from writes over lapping if this function is
// called multiple times.
@@ -216,7 +215,6 @@ LegacyBiosCopyLegacyRegion (
return EFI_SUCCESS;
}
-
/**
Find Legacy16 BIOS image in the FLASH device and shadow it into memory. Find
the $EFI table in the shadow area. Thunk into the Legacy16 code after it had
@@ -233,33 +231,33 @@ ShadowAndStartLegacy16 (
IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_STATUS Status;
- UINT8 *Ptr;
- UINT8 *PtrEnd;
- BOOLEAN Done;
- EFI_COMPATIBILITY16_TABLE *Table;
- UINT8 CheckSum;
- EFI_IA32_REGISTER_SET Regs;
- EFI_TO_COMPATIBILITY16_INIT_TABLE *EfiToLegacy16InitTable;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
- VOID *LegacyBiosImage;
- UINTN LegacyBiosImageSize;
- UINTN E820Size;
- UINT32 *ClearPtr;
- BBS_TABLE *BbsTable;
- LEGACY_EFI_HDD_TABLE *LegacyEfiHddTable;
- UINTN Index;
- UINT32 TpmPointer;
- VOID *TpmBinaryImage;
- UINTN TpmBinaryImageSize;
- UINTN Location;
- UINTN Alignment;
- UINTN TempData;
- EFI_PHYSICAL_ADDRESS Address;
- UINT16 OldMask;
- UINT16 NewMask;
- UINT32 Granularity;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
+ EFI_STATUS Status;
+ UINT8 *Ptr;
+ UINT8 *PtrEnd;
+ BOOLEAN Done;
+ EFI_COMPATIBILITY16_TABLE *Table;
+ UINT8 CheckSum;
+ EFI_IA32_REGISTER_SET Regs;
+ EFI_TO_COMPATIBILITY16_INIT_TABLE *EfiToLegacy16InitTable;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
+ VOID *LegacyBiosImage;
+ UINTN LegacyBiosImageSize;
+ UINTN E820Size;
+ UINT32 *ClearPtr;
+ BBS_TABLE *BbsTable;
+ LEGACY_EFI_HDD_TABLE *LegacyEfiHddTable;
+ UINTN Index;
+ UINT32 TpmPointer;
+ VOID *TpmBinaryImage;
+ UINTN TpmBinaryImageSize;
+ UINTN Location;
+ UINTN Alignment;
+ UINTN TempData;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT16 OldMask;
+ UINT16 NewMask;
+ UINT32 Granularity;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
Location = 0;
Alignment = 0;
@@ -300,23 +298,23 @@ ShadowAndStartLegacy16 (
// end testtest
//
EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
- Status = Private->LegacyBiosPlatform->GetPlatformInfo (
- Private->LegacyBiosPlatform,
- EfiGetPlatformBinarySystemRom,
- &LegacyBiosImage,
- &LegacyBiosImageSize,
- &Location,
- &Alignment,
- 0,
- 0
- );
+ Status = Private->LegacyBiosPlatform->GetPlatformInfo (
+ Private->LegacyBiosPlatform,
+ EfiGetPlatformBinarySystemRom,
+ &LegacyBiosImage,
+ &LegacyBiosImageSize,
+ &Location,
+ &Alignment,
+ 0,
+ 0
+ );
if (EFI_ERROR (Status)) {
return Status;
}
- Private->BiosStart = (UINT32) (0x100000 - LegacyBiosImageSize);
- Private->OptionRom = 0xc0000;
- Private->LegacyBiosImageSize = (UINT32) LegacyBiosImageSize;
+ Private->BiosStart = (UINT32)(0x100000 - LegacyBiosImageSize);
+ Private->OptionRom = 0xc0000;
+ Private->LegacyBiosImageSize = (UINT32)LegacyBiosImageSize;
//
// Can only shadow into memory allocated for legacy usage.
@@ -328,20 +326,20 @@ ShadowAndStartLegacy16 (
//
Private->LegacyRegion->UnLock (Private->LegacyRegion, 0xc0000, 0x40000, &Granularity);
- ClearPtr = (VOID *) ((UINTN) 0xc0000);
+ ClearPtr = (VOID *)((UINTN)0xc0000);
//
// Initialize region from 0xc0000 to start of BIOS to all ffs. This allows unused
// regions to be used by EMM386 etc.
//
- SetMem ((VOID *) ClearPtr, (UINTN) (0x40000 - LegacyBiosImageSize), 0xff);
+ SetMem ((VOID *)ClearPtr, (UINTN)(0x40000 - LegacyBiosImageSize), 0xff);
TempData = Private->BiosStart;
CopyMem (
- (VOID *) TempData,
+ (VOID *)TempData,
LegacyBiosImage,
- (UINTN) LegacyBiosImageSize
+ (UINTN)LegacyBiosImageSize
);
Private->Cpu->FlushDataCache (Private->Cpu, 0xc0000, 0x40000, EfiCpuFlushTypeWriteBackInvalidate);
@@ -351,12 +349,12 @@ ShadowAndStartLegacy16 (
//
Done = FALSE;
Table = NULL;
- for (Ptr = (UINT8 *) TempData; Ptr < (UINT8 *) ((UINTN) 0x100000) && !Done; Ptr += 0x10) {
- if (*(UINT32 *) Ptr == SIGNATURE_32 ('I', 'F', 'E', '$')) {
- Table = (EFI_COMPATIBILITY16_TABLE *) Ptr;
- PtrEnd = Ptr + Table->TableLength;
+ for (Ptr = (UINT8 *)TempData; Ptr < (UINT8 *)((UINTN)0x100000) && !Done; Ptr += 0x10) {
+ if (*(UINT32 *)Ptr == SIGNATURE_32 ('I', 'F', 'E', '$')) {
+ Table = (EFI_COMPATIBILITY16_TABLE *)Ptr;
+ PtrEnd = Ptr + Table->TableLength;
for (CheckSum = 0; Ptr < PtrEnd; Ptr++) {
- CheckSum = (UINT8) (CheckSum +*Ptr);
+ CheckSum = (UINT8)(CheckSum +*Ptr);
}
Done = TRUE;
@@ -378,24 +376,24 @@ ShadowAndStartLegacy16 (
//
// Remember location of the Legacy16 table
//
- Private->Legacy16Table = Table;
- Private->Legacy16CallSegment = Table->Compatibility16CallSegment;
- Private->Legacy16CallOffset = Table->Compatibility16CallOffset;
- EfiToLegacy16InitTable = &Private->IntThunk->EfiToLegacy16InitTable;
- Private->Legacy16InitPtr = EfiToLegacy16InitTable;
- Private->Legacy16BootPtr = &Private->IntThunk->EfiToLegacy16BootTable;
- Private->InternalIrqRoutingTable = NULL;
- Private->NumberIrqRoutingEntries = 0;
- Private->BbsTablePtr = NULL;
- Private->LegacyEfiHddTable = NULL;
- Private->DiskEnd = 0;
- Private->Disk4075 = 0;
- Private->HddTablePtr = &Private->IntThunk->EfiToLegacy16BootTable.HddInfo;
- Private->NumberHddControllers = MAX_IDE_CONTROLLER;
- Private->Dump[0] = 'D';
- Private->Dump[1] = 'U';
- Private->Dump[2] = 'M';
- Private->Dump[3] = 'P';
+ Private->Legacy16Table = Table;
+ Private->Legacy16CallSegment = Table->Compatibility16CallSegment;
+ Private->Legacy16CallOffset = Table->Compatibility16CallOffset;
+ EfiToLegacy16InitTable = &Private->IntThunk->EfiToLegacy16InitTable;
+ Private->Legacy16InitPtr = EfiToLegacy16InitTable;
+ Private->Legacy16BootPtr = &Private->IntThunk->EfiToLegacy16BootTable;
+ Private->InternalIrqRoutingTable = NULL;
+ Private->NumberIrqRoutingEntries = 0;
+ Private->BbsTablePtr = NULL;
+ Private->LegacyEfiHddTable = NULL;
+ Private->DiskEnd = 0;
+ Private->Disk4075 = 0;
+ Private->HddTablePtr = &Private->IntThunk->EfiToLegacy16BootTable.HddInfo;
+ Private->NumberHddControllers = MAX_IDE_CONTROLLER;
+ Private->Dump[0] = 'D';
+ Private->Dump[1] = 'U';
+ Private->Dump[2] = 'M';
+ Private->Dump[3] = 'P';
ZeroMem (
Private->Legacy16BootPtr,
@@ -405,7 +403,7 @@ ShadowAndStartLegacy16 (
//
// Store away a copy of the EFI System Table
//
- Table->EfiSystemTable = (UINT32) (UINTN) gST;
+ Table->EfiSystemTable = (UINT32)(UINTN)gST;
//
// IPF CSM integration -Bug
@@ -423,31 +421,31 @@ ShadowAndStartLegacy16 (
//
// All legacy interrupt should be masked when do initialization work from legacy 16 code.
//
- Private->Legacy8259->GetMask(Private->Legacy8259, &OldMask, NULL, NULL, NULL);
+ Private->Legacy8259->GetMask (Private->Legacy8259, &OldMask, NULL, NULL, NULL);
NewMask = 0xFFFF;
- Private->Legacy8259->SetMask(Private->Legacy8259, &NewMask, NULL, NULL, NULL);
+ Private->Legacy8259->SetMask (Private->Legacy8259, &NewMask, NULL, NULL, NULL);
//
// Call into Legacy16 code to do an INIT
//
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16InitializeYourself;
- Regs.X.ES = EFI_SEGMENT (*((UINT32 *) &EfiToLegacy16InitTable));
- Regs.X.BX = EFI_OFFSET (*((UINT32 *) &EfiToLegacy16InitTable));
+ Regs.X.ES = EFI_SEGMENT (*((UINT32 *)&EfiToLegacy16InitTable));
+ Regs.X.BX = EFI_OFFSET (*((UINT32 *)&EfiToLegacy16InitTable));
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Table->Compatibility16CallSegment,
- Table->Compatibility16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ &Private->LegacyBios,
+ Table->Compatibility16CallSegment,
+ Table->Compatibility16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
//
// Restore original legacy interrupt mask value
//
- Private->Legacy8259->SetMask(Private->Legacy8259, &OldMask, NULL, NULL, NULL);
+ Private->Legacy8259->SetMask (Private->Legacy8259, &OldMask, NULL, NULL, NULL);
if (Regs.X.AX != 0) {
return EFI_DEVICE_ERROR;
@@ -469,30 +467,31 @@ ShadowAndStartLegacy16 (
//
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16GetTableAddress;
- Regs.X.CX = (UINT16) E820Size;
+ Regs.X.CX = (UINT16)E820Size;
Regs.X.DX = 1;
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Table->Compatibility16CallSegment,
- Table->Compatibility16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ &Private->LegacyBios,
+ Table->Compatibility16CallSegment,
+ Table->Compatibility16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
- Table->E820Pointer = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
- Table->E820Length = (UINT32) E820Size;
+ Table->E820Pointer = (UINT32)(Regs.X.DS * 16 + Regs.X.BX);
+ Table->E820Length = (UINT32)E820Size;
if (Regs.X.AX != 0) {
DEBUG ((DEBUG_ERROR, "Legacy16 E820 length insufficient\n"));
} else {
TempData = Table->E820Pointer;
- CopyMem ((VOID *) TempData, Private->E820Table, E820Size);
+ CopyMem ((VOID *)TempData, Private->E820Table, E820Size);
}
+
//
// Get PnPInstallationCheck Info.
//
- Private->PnPInstallationCheckSegment = Table->PnPInstallationCheckSegment;
- Private->PnPInstallationCheckOffset = Table->PnPInstallationCheckOffset;
+ Private->PnPInstallationCheckSegment = Table->PnPInstallationCheckSegment;
+ Private->PnPInstallationCheckOffset = Table->PnPInstallationCheckOffset;
//
// Check if PCI Express is supported. If yes, Save base address.
@@ -508,9 +507,10 @@ ShadowAndStartLegacy16 (
0
);
if (!EFI_ERROR (Status)) {
- Private->Legacy16Table->PciExpressBase = (UINT32)Location;
- Location = 0;
+ Private->Legacy16Table->PciExpressBase = (UINT32)Location;
+ Location = 0;
}
+
//
// Check if TPM is supported. If yes get a region in E0000,F0000 to copy it
// into, copy it and update pointer to binary image. This needs to be
@@ -527,35 +527,34 @@ ShadowAndStartLegacy16 (
0
);
if (!EFI_ERROR (Status)) {
-
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16GetTableAddress;
- Regs.X.CX = (UINT16) TpmBinaryImageSize;
+ Regs.X.CX = (UINT16)TpmBinaryImageSize;
Regs.X.DX = 1;
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Table->Compatibility16CallSegment,
- Table->Compatibility16CallOffset,
- &Regs,
- NULL,
- 0
- );
-
- TpmPointer = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
+ &Private->LegacyBios,
+ Table->Compatibility16CallSegment,
+ Table->Compatibility16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
+
+ TpmPointer = (UINT32)(Regs.X.DS * 16 + Regs.X.BX);
if (Regs.X.AX != 0) {
DEBUG ((DEBUG_ERROR, "TPM cannot be loaded\n"));
} else {
- CopyMem ((VOID *) (UINTN)TpmPointer, TpmBinaryImage, TpmBinaryImageSize);
+ CopyMem ((VOID *)(UINTN)TpmPointer, TpmBinaryImage, TpmBinaryImageSize);
Table->TpmSegment = Regs.X.DS;
Table->TpmOffset = Regs.X.BX;
-
}
}
+
//
// Lock the Legacy BIOS region
//
- Private->Cpu->FlushDataCache (Private->Cpu, Private->BiosStart, (UINT32) LegacyBiosImageSize, EfiCpuFlushTypeWriteBackInvalidate);
- Private->LegacyRegion->Lock (Private->LegacyRegion, Private->BiosStart, (UINT32) LegacyBiosImageSize, &Granularity);
+ Private->Cpu->FlushDataCache (Private->Cpu, Private->BiosStart, (UINT32)LegacyBiosImageSize, EfiCpuFlushTypeWriteBackInvalidate);
+ Private->LegacyRegion->Lock (Private->LegacyRegion, Private->BiosStart, (UINT32)LegacyBiosImageSize, &Granularity);
//
// Get the BbsTable from LOW_MEMORY_THUNK
@@ -563,8 +562,8 @@ ShadowAndStartLegacy16 (
BbsTable = (BBS_TABLE *)(UINTN)Private->IntThunk->BbsTable;
ZeroMem ((VOID *)BbsTable, sizeof (Private->IntThunk->BbsTable));
- EfiToLegacy16BootTable->BbsTable = (UINT32)(UINTN)BbsTable;
- Private->BbsTablePtr = (VOID *) BbsTable;
+ EfiToLegacy16BootTable->BbsTable = (UINT32)(UINTN)BbsTable;
+ Private->BbsTablePtr = (VOID *)BbsTable;
//
// Populate entire table with BBS_IGNORE_ENTRY
@@ -574,10 +573,11 @@ ShadowAndStartLegacy16 (
for (Index = 0; Index < MAX_BBS_ENTRIES; Index++) {
BbsTable[Index].BootPriority = BBS_IGNORE_ENTRY;
}
+
//
// Allocate space for Legacy HDD table
//
- LegacyEfiHddTable = (LEGACY_EFI_HDD_TABLE *) AllocateZeroPool ((UINTN) MAX_HDD_ENTRIES * sizeof (LEGACY_EFI_HDD_TABLE));
+ LegacyEfiHddTable = (LEGACY_EFI_HDD_TABLE *)AllocateZeroPool ((UINTN)MAX_HDD_ENTRIES * sizeof (LEGACY_EFI_HDD_TABLE));
ASSERT (LegacyEfiHddTable);
Private->LegacyEfiHddTable = LegacyEfiHddTable;
@@ -612,7 +612,7 @@ ShadowAndStartLegacy16 (
EFI_STATUS
EFIAPI
LegacyBiosShadowAllLegacyOproms (
- IN EFI_LEGACY_BIOS_PROTOCOL *This
+ IN EFI_LEGACY_BIOS_PROTOCOL *This
)
{
LEGACY_BIOS_INSTANCE *Private;
@@ -657,16 +657,16 @@ LegacyBiosShadowAllLegacyOproms (
**/
UINT16
GetPciInterfaceVersion (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_IA32_REGISTER_SET Reg;
- BOOLEAN ThunkFailed;
- UINT16 PciInterfaceVersion;
+ EFI_IA32_REGISTER_SET Reg;
+ BOOLEAN ThunkFailed;
+ UINT16 PciInterfaceVersion;
PciInterfaceVersion = 0;
- Reg.X.AX = 0xB101;
+ Reg.X.AX = 0xB101;
Reg.E.EDI = 0;
ThunkFailed = Private->LegacyBios.Int86 (&Private->LegacyBios, 0x1A, &Reg);
@@ -684,6 +684,7 @@ GetPciInterfaceVersion (
PciInterfaceVersion = Reg.X.BX;
}
}
+
return PciInterfaceVersion;
}
@@ -699,25 +700,25 @@ GetPciInterfaceVersion (
VOID
EFIAPI
InstallSmbiosEventCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
+ EFI_STATUS Status;
+ SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
//
// Get SMBIOS table from EFI configuration table
//
Status = EfiGetSystemConfigurationTable (
- &gEfiSmbiosTableGuid,
- &mRuntimeSmbiosEntryPoint
- );
+ &gEfiSmbiosTableGuid,
+ &mRuntimeSmbiosEntryPoint
+ );
if ((EFI_ERROR (Status)) || (mRuntimeSmbiosEntryPoint == NULL)) {
return;
}
- EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) mRuntimeSmbiosEntryPoint;
+ EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)mRuntimeSmbiosEntryPoint;
//
// Allocate memory for SMBIOS Entry Point Structure.
@@ -728,21 +729,23 @@ InstallSmbiosEventCallback (
// Entrypoint structure with fixed size is allocated only once.
//
mReserveSmbiosEntryPoint = SIZE_4GB - 1;
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- EFI_SIZE_TO_PAGES ((UINTN) (EntryPointStructure->EntryPointLength)),
- &mReserveSmbiosEntryPoint
- );
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiReservedMemoryType,
+ EFI_SIZE_TO_PAGES ((UINTN)(EntryPointStructure->EntryPointLength)),
+ &mReserveSmbiosEntryPoint
+ );
if (EFI_ERROR (Status)) {
mReserveSmbiosEntryPoint = 0;
return;
}
+
DEBUG ((DEBUG_INFO, "Allocate memory for Smbios Entry Point Structure\n"));
}
if ((mStructureTableAddress != 0) &&
- (mStructureTablePages < EFI_SIZE_TO_PAGES ((UINT32)EntryPointStructure->TableLength))) {
+ (mStructureTablePages < EFI_SIZE_TO_PAGES ((UINT32)EntryPointStructure->TableLength)))
+ {
//
// If original buffer is not enough for the new SMBIOS table, free original buffer and re-allocate
//
@@ -759,22 +762,23 @@ InstallSmbiosEventCallback (
//
mStructureTableAddress = SIZE_4GB - 1;
mStructureTablePages = EFI_SIZE_TO_PAGES (EntryPointStructure->TableLength);
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- mStructureTablePages,
- &mStructureTableAddress
- );
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiReservedMemoryType,
+ mStructureTablePages,
+ &mStructureTableAddress
+ );
if (EFI_ERROR (Status)) {
gBS->FreePages (
- mReserveSmbiosEntryPoint,
- EFI_SIZE_TO_PAGES ((UINTN) (EntryPointStructure->EntryPointLength))
- );
+ mReserveSmbiosEntryPoint,
+ EFI_SIZE_TO_PAGES ((UINTN)(EntryPointStructure->EntryPointLength))
+ );
mReserveSmbiosEntryPoint = 0;
mStructureTableAddress = 0;
mStructureTablePages = 0;
return;
}
+
DEBUG ((DEBUG_INFO, "Allocate memory for Smbios Structure Table\n"));
}
}
@@ -791,8 +795,8 @@ InstallSmbiosEventCallback (
VOID
EFIAPI
ToggleEndOfDxeStatus (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
mEndOfDxe = TRUE;
@@ -812,8 +816,8 @@ ToggleEndOfDxeStatus (
EFI_STATUS
EFIAPI
LegacyBiosInstall (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -850,7 +854,7 @@ LegacyBiosInstall (
// When UEFI Secure Boot is enabled, CSM module will not start any more.
//
SecureBoot = NULL;
- GetEfiGlobalVariable2 (EFI_SECURE_BOOT_MODE_NAME, (VOID**)&SecureBoot, NULL);
+ GetEfiGlobalVariable2 (EFI_SECURE_BOOT_MODE_NAME, (VOID **)&SecureBoot, NULL);
if ((SecureBoot != NULL) && (*SecureBoot == SECURE_BOOT_MODE_ENABLE)) {
FreePool (SecureBoot);
return EFI_SECURITY_VIOLATION;
@@ -867,22 +871,22 @@ LegacyBiosInstall (
// Grab a copy of all the protocols we depend on. Any error would
// be a dispatcher bug!.
//
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &Private->Cpu);
+ Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Private->Cpu);
ASSERT_EFI_ERROR (Status);
- Status = gBS->LocateProtocol (&gEfiTimerArchProtocolGuid, NULL, (VOID **) &Private->Timer);
+ Status = gBS->LocateProtocol (&gEfiTimerArchProtocolGuid, NULL, (VOID **)&Private->Timer);
ASSERT_EFI_ERROR (Status);
- Status = gBS->LocateProtocol (&gEfiLegacyRegion2ProtocolGuid, NULL, (VOID **) &Private->LegacyRegion);
+ Status = gBS->LocateProtocol (&gEfiLegacyRegion2ProtocolGuid, NULL, (VOID **)&Private->LegacyRegion);
ASSERT_EFI_ERROR (Status);
- Status = gBS->LocateProtocol (&gEfiLegacyBiosPlatformProtocolGuid, NULL, (VOID **) &Private->LegacyBiosPlatform);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosPlatformProtocolGuid, NULL, (VOID **)&Private->LegacyBiosPlatform);
ASSERT_EFI_ERROR (Status);
- Status = gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid, NULL, (VOID **) &Private->Legacy8259);
+ Status = gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid, NULL, (VOID **)&Private->Legacy8259);
ASSERT_EFI_ERROR (Status);
- Status = gBS->LocateProtocol (&gEfiLegacyInterruptProtocolGuid, NULL, (VOID **) &Private->LegacyInterrupt);
+ Status = gBS->LocateProtocol (&gEfiLegacyInterruptProtocolGuid, NULL, (VOID **)&Private->LegacyInterrupt);
ASSERT_EFI_ERROR (Status);
//
@@ -891,7 +895,7 @@ LegacyBiosInstall (
Status = gBS->LocateProtocol (
&gEfiGenericMemTestProtocolGuid,
NULL,
- (VOID **) &Private->GenericMemoryTest
+ (VOID **)&Private->GenericMemoryTest
);
ASSERT_EFI_ERROR (Status);
@@ -904,6 +908,7 @@ LegacyBiosInstall (
StartAddress = Descriptor.BaseAddress + Descriptor.Length;
continue;
}
+
Length = MIN (Descriptor.Length, 0xa0000 - StartAddress);
Private->GenericMemoryTest->CompatibleRangeTest (
Private->GenericMemoryTest,
@@ -912,6 +917,7 @@ LegacyBiosInstall (
);
StartAddress = StartAddress + Length;
}
+
//
// Make sure all memory from 1MB to 16MB is tested and added to memory map
//
@@ -921,6 +927,7 @@ LegacyBiosInstall (
StartAddress = Descriptor.BaseAddress + Descriptor.Length;
continue;
}
+
Length = MIN (Descriptor.Length, BASE_16MB - StartAddress);
Private->GenericMemoryTest->CompatibleRangeTest (
Private->GenericMemoryTest,
@@ -932,17 +939,17 @@ LegacyBiosInstall (
Private->Signature = LEGACY_BIOS_INSTANCE_SIGNATURE;
- Private->LegacyBios.Int86 = LegacyBiosInt86;
- Private->LegacyBios.FarCall86 = LegacyBiosFarCall86;
- Private->LegacyBios.CheckPciRom = LegacyBiosCheckPciRom;
- Private->LegacyBios.InstallPciRom = LegacyBiosInstallPciRom;
- Private->LegacyBios.LegacyBoot = LegacyBiosLegacyBoot;
- Private->LegacyBios.UpdateKeyboardLedStatus = LegacyBiosUpdateKeyboardLedStatus;
- Private->LegacyBios.GetBbsInfo = LegacyBiosGetBbsInfo;
- Private->LegacyBios.ShadowAllLegacyOproms = LegacyBiosShadowAllLegacyOproms;
- Private->LegacyBios.PrepareToBootEfi = LegacyBiosPrepareToBootEfi;
- Private->LegacyBios.GetLegacyRegion = LegacyBiosGetLegacyRegion;
- Private->LegacyBios.CopyLegacyRegion = LegacyBiosCopyLegacyRegion;
+ Private->LegacyBios.Int86 = LegacyBiosInt86;
+ Private->LegacyBios.FarCall86 = LegacyBiosFarCall86;
+ Private->LegacyBios.CheckPciRom = LegacyBiosCheckPciRom;
+ Private->LegacyBios.InstallPciRom = LegacyBiosInstallPciRom;
+ Private->LegacyBios.LegacyBoot = LegacyBiosLegacyBoot;
+ Private->LegacyBios.UpdateKeyboardLedStatus = LegacyBiosUpdateKeyboardLedStatus;
+ Private->LegacyBios.GetBbsInfo = LegacyBiosGetBbsInfo;
+ Private->LegacyBios.ShadowAllLegacyOproms = LegacyBiosShadowAllLegacyOproms;
+ Private->LegacyBios.PrepareToBootEfi = LegacyBiosPrepareToBootEfi;
+ Private->LegacyBios.GetLegacyRegion = LegacyBiosGetLegacyRegion;
+ Private->LegacyBios.CopyLegacyRegion = LegacyBiosCopyLegacyRegion;
Private->LegacyBios.BootUnconventionalDevice = LegacyBiosBootUnconventionalDevice;
Private->ImageHandle = ImageHandle;
@@ -994,16 +1001,16 @@ LegacyBiosInstall (
);
ASSERT (MemoryAddress == 0x000000000);
- ClearPtr = (VOID *) ((UINTN) 0x0000);
+ ClearPtr = (VOID *)((UINTN)0x0000);
//
// Initialize region from 0x0000 to 4k. This initializes interrupt vector
// range.
//
ACCESS_PAGE0_CODE (
- gBS->SetMem ((VOID *) ClearPtr, 0x400, INITIAL_VALUE_BELOW_1K);
- ZeroMem ((VOID *) ((UINTN)ClearPtr + 0x400), 0xC00);
- );
+ gBS->SetMem ((VOID *)ClearPtr, 0x400, INITIAL_VALUE_BELOW_1K);
+ ZeroMem ((VOID *)((UINTN)ClearPtr + 0x400), 0xC00);
+ );
//
// Allocate pages for OPROM usage
@@ -1020,7 +1027,7 @@ LegacyBiosInstall (
);
ASSERT_EFI_ERROR (Status);
- ZeroMem ((VOID *) ((UINTN) MemoryAddress), MemorySize);
+ ZeroMem ((VOID *)((UINTN)MemoryAddress), MemorySize);
//
// Allocate all 32k chunks from 0x60000 ~ 0x88000 for Legacy OPROMs that
@@ -1028,8 +1035,8 @@ LegacyBiosInstall (
// OpROMs expect different areas to be free
//
EbdaReservedBaseAddress = MemoryAddress;
- MemoryAddress = PcdGet32 (PcdOpromReservedMemoryBase);
- MemorySize = PcdGet32 (PcdOpromReservedMemorySize);
+ MemoryAddress = PcdGet32 (PcdOpromReservedMemoryBase);
+ MemorySize = PcdGet32 (PcdOpromReservedMemorySize);
//
// Check if base address and size for reserved memory are 4KB aligned.
//
@@ -1048,7 +1055,7 @@ LegacyBiosInstall (
&StartAddress
);
if (!EFI_ERROR (Status)) {
- MemoryPtr = (VOID *) ((UINTN) StartAddress);
+ MemoryPtr = (VOID *)((UINTN)StartAddress);
ZeroMem (MemoryPtr, 0x1000);
} else {
DEBUG ((DEBUG_ERROR, "WARNING: Allocate legacy memory fail for SCSI card - %x\n", MemStart));
@@ -1069,7 +1076,7 @@ LegacyBiosInstall (
);
ASSERT_EFI_ERROR (Status);
- ZeroMem ((VOID *) ((UINTN) MemoryAddressUnder1MB), MemorySize);
+ ZeroMem ((VOID *)((UINTN)MemoryAddressUnder1MB), MemorySize);
//
// Allocate space for thunker and Init Thunker
@@ -1082,10 +1089,10 @@ LegacyBiosInstall (
&MemoryAddress
);
ASSERT_EFI_ERROR (Status);
- Private->IntThunk = (LOW_MEMORY_THUNK *) (UINTN) MemoryAddress;
+ Private->IntThunk = (LOW_MEMORY_THUNK *)(UINTN)MemoryAddress;
EfiToLegacy16InitTable = &Private->IntThunk->EfiToLegacy16InitTable;
- EfiToLegacy16InitTable->ThunkStart = (UINT32) (EFI_PHYSICAL_ADDRESS) (UINTN) MemoryAddress;
- EfiToLegacy16InitTable->ThunkSizeInBytes = (UINT32) (sizeof (LOW_MEMORY_THUNK));
+ EfiToLegacy16InitTable->ThunkStart = (UINT32)(EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
+ EfiToLegacy16InitTable->ThunkSizeInBytes = (UINT32)(sizeof (LOW_MEMORY_THUNK));
Status = LegacyBiosInitializeThunk (Private);
ASSERT_EFI_ERROR (Status);
@@ -1093,8 +1100,8 @@ LegacyBiosInstall (
//
// Init the legacy memory map in memory < 1 MB.
//
- EfiToLegacy16InitTable->BiosLessThan1MB = (UINT32) MemoryAddressUnder1MB;
- EfiToLegacy16InitTable->LowPmmMemory = (UINT32) MemoryAddressUnder1MB;
+ EfiToLegacy16InitTable->BiosLessThan1MB = (UINT32)MemoryAddressUnder1MB;
+ EfiToLegacy16InitTable->LowPmmMemory = (UINT32)MemoryAddressUnder1MB;
EfiToLegacy16InitTable->LowPmmMemorySizeInBytes = MemorySize;
MemorySize = PcdGet32 (PcdHighPmmMemorySize);
@@ -1121,8 +1128,9 @@ LegacyBiosInstall (
&MemoryAddress
);
}
+
if (!EFI_ERROR (Status)) {
- EfiToLegacy16InitTable->HiPmmMemory = (UINT32) (EFI_PHYSICAL_ADDRESS) (UINTN) MemoryAddress;
+ EfiToLegacy16InitTable->HiPmmMemory = (UINT32)(EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
EfiToLegacy16InitTable->HiPmmMemorySizeInBytes = MemorySize;
}
@@ -1135,32 +1143,34 @@ LegacyBiosInstall (
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Initialize interrupt redirection code and entries;
// IDT Vectors 0x68-0x6f must be redirected to IDT Vectors 0x08-0x0f.
//
CopyMem (
- Private->IntThunk->InterruptRedirectionCode,
- (VOID *) (UINTN) InterruptRedirectionTemplate,
- sizeof (Private->IntThunk->InterruptRedirectionCode)
- );
+ Private->IntThunk->InterruptRedirectionCode,
+ (VOID *)(UINTN)InterruptRedirectionTemplate,
+ sizeof (Private->IntThunk->InterruptRedirectionCode)
+ );
//
// Save Unexpected interrupt vector so can restore it just prior to boot
//
ACCESS_PAGE0_CODE (
- BaseVectorMaster = (UINT32 *) (sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);
+ BaseVectorMaster = (UINT32 *)(sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);
Private->BiosUnexpectedInt = BaseVectorMaster[0];
- IntRedirCode = (UINT32) (UINTN) Private->IntThunk->InterruptRedirectionCode;
+ IntRedirCode = (UINT32)(UINTN)Private->IntThunk->InterruptRedirectionCode;
for (Index = 0; Index < 8; Index++) {
- BaseVectorMaster[Index] = (EFI_SEGMENT (IntRedirCode + Index * 4) << 16) | EFI_OFFSET (IntRedirCode + Index * 4);
- }
- );
+ BaseVectorMaster[Index] = (EFI_SEGMENT (IntRedirCode + Index * 4) << 16) | EFI_OFFSET (IntRedirCode + Index * 4);
+ }
+
+ );
//
// Save EFI value
//
- Private->ThunkSeg = (UINT16) (EFI_SEGMENT (IntRedirCode));
+ Private->ThunkSeg = (UINT16)(EFI_SEGMENT (IntRedirCode));
//
// Allocate reserved memory for SMBIOS table used in legacy boot if SMBIOS table exists
@@ -1198,18 +1208,20 @@ LegacyBiosInstall (
// Make a new handle and install the protocol
//
Private->Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Private->Handle,
- &gEfiLegacyBiosProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Private->LegacyBios
- );
+ Status = gBS->InstallProtocolInterface (
+ &Private->Handle,
+ &gEfiLegacyBiosProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &Private->LegacyBios
+ );
Private->Csm16PciInterfaceVersion = GetPciInterfaceVersion (Private);
- DEBUG ((DEBUG_INFO, "CSM16 PCI BIOS Interface Version: %02x.%02x\n",
- (UINT8) (Private->Csm16PciInterfaceVersion >> 8),
- (UINT8) Private->Csm16PciInterfaceVersion
- ));
+ DEBUG ((
+ DEBUG_INFO,
+ "CSM16 PCI BIOS Interface Version: %02x.%02x\n",
+ (UINT8)(Private->Csm16PciInterfaceVersion >> 8),
+ (UINT8)Private->Csm16PciInterfaceVersion
+ ));
ASSERT (Private->Csm16PciInterfaceVersion != 0);
return Status;
}
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h
index f437d0cc42..5a706d9ea6 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h
@@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _LEGACY_BIOS_INTERFACE_
#define _LEGACY_BIOS_INTERFACE_
-
#include <FrameworkDxe.h>
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/SmBios.h>
@@ -62,7 +61,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// BUGBUG: This entry maybe changed to PCD in future and wait for
// redesign of BDS library
//
-#define MAX_BBS_ENTRIES 0x100
+#define MAX_BBS_ENTRIES 0x100
//
// Thunk Status Codes
@@ -79,8 +78,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// 8259 Hardware definitions
//
-#define LEGACY_MODE_BASE_VECTOR_MASTER 0x08
-#define LEGACY_MODE_BASE_VECTOR_SLAVE 0x70
+#define LEGACY_MODE_BASE_VECTOR_MASTER 0x08
+#define LEGACY_MODE_BASE_VECTOR_SLAVE 0x70
//
// The original PC used INT8-F for master PIC. Since these mapped over
@@ -96,53 +95,53 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// offset + 0xabcd could overflow which exceeds 0xFFFF which is invalid in real mode.
// So this will keep offset as small as possible to avoid offset overflow in real mode.
//
-#define NORMALIZE_EFI_SEGMENT(_Adr) (UINT16) (((UINTN) (_Adr)) >> 4)
-#define NORMALIZE_EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xf)
+#define NORMALIZE_EFI_SEGMENT(_Adr) (UINT16) (((UINTN) (_Adr)) >> 4)
+#define NORMALIZE_EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xf)
//
// Trace defines
//
//
-#define LEGACY_BDA_TRACE 0x000
-#define LEGACY_BIOS_TRACE 0x040
-#define LEGACY_BOOT_TRACE 0x080
-#define LEGACY_CMOS_TRACE 0x0C0
-#define LEGACY_IDE_TRACE 0x100
-#define LEGACY_MP_TRACE 0x140
-#define LEGACY_PCI_TRACE 0x180
-#define LEGACY_SIO_TRACE 0x1C0
-
-#define LEGACY_PCI_TRACE_000 LEGACY_PCI_TRACE + 0x00
-#define LEGACY_PCI_TRACE_001 LEGACY_PCI_TRACE + 0x01
-#define LEGACY_PCI_TRACE_002 LEGACY_PCI_TRACE + 0x02
-#define LEGACY_PCI_TRACE_003 LEGACY_PCI_TRACE + 0x03
-#define LEGACY_PCI_TRACE_004 LEGACY_PCI_TRACE + 0x04
-#define LEGACY_PCI_TRACE_005 LEGACY_PCI_TRACE + 0x05
-#define LEGACY_PCI_TRACE_006 LEGACY_PCI_TRACE + 0x06
-#define LEGACY_PCI_TRACE_007 LEGACY_PCI_TRACE + 0x07
-#define LEGACY_PCI_TRACE_008 LEGACY_PCI_TRACE + 0x08
-#define LEGACY_PCI_TRACE_009 LEGACY_PCI_TRACE + 0x09
-#define LEGACY_PCI_TRACE_00A LEGACY_PCI_TRACE + 0x0A
-#define LEGACY_PCI_TRACE_00B LEGACY_PCI_TRACE + 0x0B
-#define LEGACY_PCI_TRACE_00C LEGACY_PCI_TRACE + 0x0C
-#define LEGACY_PCI_TRACE_00D LEGACY_PCI_TRACE + 0x0D
-#define LEGACY_PCI_TRACE_00E LEGACY_PCI_TRACE + 0x0E
-#define LEGACY_PCI_TRACE_00F LEGACY_PCI_TRACE + 0x0F
-
-#define BDA_VIDEO_MODE 0x49
-
-#define IDE_PI_REGISTER_PNE BIT0
-#define IDE_PI_REGISTER_SNE BIT2
+#define LEGACY_BDA_TRACE 0x000
+#define LEGACY_BIOS_TRACE 0x040
+#define LEGACY_BOOT_TRACE 0x080
+#define LEGACY_CMOS_TRACE 0x0C0
+#define LEGACY_IDE_TRACE 0x100
+#define LEGACY_MP_TRACE 0x140
+#define LEGACY_PCI_TRACE 0x180
+#define LEGACY_SIO_TRACE 0x1C0
+
+#define LEGACY_PCI_TRACE_000 LEGACY_PCI_TRACE + 0x00
+#define LEGACY_PCI_TRACE_001 LEGACY_PCI_TRACE + 0x01
+#define LEGACY_PCI_TRACE_002 LEGACY_PCI_TRACE + 0x02
+#define LEGACY_PCI_TRACE_003 LEGACY_PCI_TRACE + 0x03
+#define LEGACY_PCI_TRACE_004 LEGACY_PCI_TRACE + 0x04
+#define LEGACY_PCI_TRACE_005 LEGACY_PCI_TRACE + 0x05
+#define LEGACY_PCI_TRACE_006 LEGACY_PCI_TRACE + 0x06
+#define LEGACY_PCI_TRACE_007 LEGACY_PCI_TRACE + 0x07
+#define LEGACY_PCI_TRACE_008 LEGACY_PCI_TRACE + 0x08
+#define LEGACY_PCI_TRACE_009 LEGACY_PCI_TRACE + 0x09
+#define LEGACY_PCI_TRACE_00A LEGACY_PCI_TRACE + 0x0A
+#define LEGACY_PCI_TRACE_00B LEGACY_PCI_TRACE + 0x0B
+#define LEGACY_PCI_TRACE_00C LEGACY_PCI_TRACE + 0x0C
+#define LEGACY_PCI_TRACE_00D LEGACY_PCI_TRACE + 0x0D
+#define LEGACY_PCI_TRACE_00E LEGACY_PCI_TRACE + 0x0E
+#define LEGACY_PCI_TRACE_00F LEGACY_PCI_TRACE + 0x0F
+
+#define BDA_VIDEO_MODE 0x49
+
+#define IDE_PI_REGISTER_PNE BIT0
+#define IDE_PI_REGISTER_SNE BIT2
typedef struct {
- UINTN PciSegment;
- UINTN PciBus;
- UINTN PciDevice;
- UINTN PciFunction;
- UINT32 ShadowAddress;
- UINT32 ShadowedSize;
- UINT8 DiskStart;
- UINT8 DiskEnd;
+ UINTN PciSegment;
+ UINTN PciBus;
+ UINTN PciDevice;
+ UINTN PciFunction;
+ UINT32 ShadowAddress;
+ UINT32 ShadowedSize;
+ UINT8 DiskStart;
+ UINT8 DiskEnd;
} ROM_INSTANCE_ENTRY;
//
@@ -150,15 +149,15 @@ typedef struct {
//
#if defined (MDE_CPU_IA32)
-#define NUM_REAL_GDT_ENTRIES 3
-#define CONVENTIONAL_MEMORY_TOP 0xA0000 // 640 KB
-#define INITIAL_VALUE_BELOW_1K 0x0
+#define NUM_REAL_GDT_ENTRIES 3
+#define CONVENTIONAL_MEMORY_TOP 0xA0000 // 640 KB
+#define INITIAL_VALUE_BELOW_1K 0x0
#elif defined (MDE_CPU_X64)
-#define NUM_REAL_GDT_ENTRIES 8
-#define CONVENTIONAL_MEMORY_TOP 0xA0000 // 640 KB
-#define INITIAL_VALUE_BELOW_1K 0x0
+#define NUM_REAL_GDT_ENTRIES 8
+#define CONVENTIONAL_MEMORY_TOP 0xA0000 // 640 KB
+#define INITIAL_VALUE_BELOW_1K 0x0
#endif
@@ -168,28 +167,28 @@ typedef struct {
// Define what a processor GDT looks like
//
typedef struct {
- UINT32 LimitLo : 16;
- UINT32 BaseLo : 16;
- UINT32 BaseMid : 8;
- UINT32 Type : 4;
- UINT32 System : 1;
- UINT32 Dpl : 2;
- UINT32 Present : 1;
- UINT32 LimitHi : 4;
- UINT32 Software : 1;
- UINT32 Reserved : 1;
- UINT32 DefaultSize : 1;
- UINT32 Granularity : 1;
- UINT32 BaseHi : 8;
+ UINT32 LimitLo : 16;
+ UINT32 BaseLo : 16;
+ UINT32 BaseMid : 8;
+ UINT32 Type : 4;
+ UINT32 System : 1;
+ UINT32 Dpl : 2;
+ UINT32 Present : 1;
+ UINT32 LimitHi : 4;
+ UINT32 Software : 1;
+ UINT32 Reserved : 1;
+ UINT32 DefaultSize : 1;
+ UINT32 Granularity : 1;
+ UINT32 BaseHi : 8;
} GDT32;
typedef struct {
- UINT16 LimitLow;
- UINT16 BaseLow;
- UINT8 BaseMid;
- UINT8 Attribute;
- UINT8 LimitHi;
- UINT8 BaseHi;
+ UINT16 LimitLow;
+ UINT16 BaseLow;
+ UINT8 BaseMid;
+ UINT8 Attribute;
+ UINT8 LimitHi;
+ UINT8 BaseHi;
} GDT64;
//
@@ -197,13 +196,13 @@ typedef struct {
// This data structure must be kept in sync with ASM STRUCT in Thunk.inc
//
typedef struct {
- UINT16 Limit;
- UINT64 Base;
+ UINT16 Limit;
+ UINT64 Base;
} DESCRIPTOR64;
typedef struct {
- UINT16 Limit;
- UINT32 Base;
+ UINT16 Limit;
+ UINT32 Base;
} DESCRIPTOR32;
//
@@ -220,33 +219,33 @@ typedef struct {
// Space for the code
// The address of Code is also the beginning of the relocated Thunk code
//
- CHAR8 Code[4096]; // ?
+ CHAR8 Code[4096]; // ?
//
// The address of the Reverse Thunk code
// Note that this member CONTAINS the address of the relocated reverse thunk
// code unlike the member variable 'Code', which IS the address of the Thunk
// code.
//
- UINT32 LowReverseThunkStart;
+ UINT32 LowReverseThunkStart;
//
// Data for the code (cs releative)
//
- DESCRIPTOR32 GdtDesc; // Protected mode GDT
- DESCRIPTOR32 IdtDesc; // Protected mode IDT
- UINT32 FlatSs;
- UINT32 FlatEsp;
+ DESCRIPTOR32 GdtDesc; // Protected mode GDT
+ DESCRIPTOR32 IdtDesc; // Protected mode IDT
+ UINT32 FlatSs;
+ UINT32 FlatEsp;
- UINT32 LowCodeSelector; // Low code selector in GDT
- UINT32 LowDataSelector; // Low data selector in GDT
- UINT32 LowStack;
- DESCRIPTOR32 RealModeIdtDesc;
+ UINT32 LowCodeSelector; // Low code selector in GDT
+ UINT32 LowDataSelector; // Low data selector in GDT
+ UINT32 LowStack;
+ DESCRIPTOR32 RealModeIdtDesc;
//
// real-mode GDT (temporary GDT with two real mode segment descriptors)
//
- GDT32 RealModeGdt[NUM_REAL_GDT_ENTRIES];
- DESCRIPTOR32 RealModeGdtDesc;
+ GDT32 RealModeGdt[NUM_REAL_GDT_ENTRIES];
+ DESCRIPTOR32 RealModeGdtDesc;
//
// Members specifically for the reverse thunk
@@ -254,36 +253,36 @@ typedef struct {
// before performing the reverse thunk. The RevFlat* members must be set
// before calling the reverse thunk assembly code.
//
- UINT16 RevRealDs;
- UINT16 RevRealSs;
- UINT32 RevRealEsp;
- DESCRIPTOR32 RevRealIdtDesc;
- UINT16 RevFlatDataSelector; // Flat data selector in GDT
- UINT32 RevFlatStack;
+ UINT16 RevRealDs;
+ UINT16 RevRealSs;
+ UINT32 RevRealEsp;
+ DESCRIPTOR32 RevRealIdtDesc;
+ UINT16 RevFlatDataSelector; // Flat data selector in GDT
+ UINT32 RevFlatStack;
//
// A low memory stack
//
- CHAR8 Stack[LOW_STACK_SIZE];
+ CHAR8 Stack[LOW_STACK_SIZE];
//
// Stack for flat mode after reverse thunk
// @bug - This may no longer be necessary if the reverse thunk interface
// is changed to have the flat stack in a different location.
//
- CHAR8 RevThunkStack[LOW_STACK_SIZE];
+ CHAR8 RevThunkStack[LOW_STACK_SIZE];
//
// Legacy16 Init memory map info
//
- EFI_TO_COMPATIBILITY16_INIT_TABLE EfiToLegacy16InitTable;
+ EFI_TO_COMPATIBILITY16_INIT_TABLE EfiToLegacy16InitTable;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE EfiToLegacy16BootTable;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE EfiToLegacy16BootTable;
- CHAR8 InterruptRedirectionCode[32];
- EFI_LEGACY_INSTALL_PCI_HANDLER PciHandler;
- EFI_DISPATCH_OPROM_TABLE DispatchOpromTable;
- BBS_TABLE BbsTable[MAX_BBS_ENTRIES];
+ CHAR8 InterruptRedirectionCode[32];
+ EFI_LEGACY_INSTALL_PCI_HANDLER PciHandler;
+ EFI_DISPATCH_OPROM_TABLE DispatchOpromTable;
+ BBS_TABLE BbsTable[MAX_BBS_ENTRIES];
} LOW_MEMORY_THUNK;
#elif defined (MDE_CPU_X64)
@@ -293,42 +292,42 @@ typedef struct {
// Space for the code
// The address of Code is also the beginning of the relocated Thunk code
//
- CHAR8 Code[4096]; // ?
+ CHAR8 Code[4096]; // ?
//
// Data for the code (cs releative)
//
- DESCRIPTOR64 X64GdtDesc; // Protected mode GDT
- DESCRIPTOR64 X64IdtDesc; // Protected mode IDT
- UINTN X64Ss;
- UINTN X64Esp;
+ DESCRIPTOR64 X64GdtDesc; // Protected mode GDT
+ DESCRIPTOR64 X64IdtDesc; // Protected mode IDT
+ UINTN X64Ss;
+ UINTN X64Esp;
- UINTN RealStack;
- DESCRIPTOR32 RealModeIdtDesc;
- DESCRIPTOR32 RealModeGdtDesc;
+ UINTN RealStack;
+ DESCRIPTOR32 RealModeIdtDesc;
+ DESCRIPTOR32 RealModeGdtDesc;
//
// real-mode GDT (temporary GDT with two real mode segment descriptors)
//
- GDT64 RealModeGdt[NUM_REAL_GDT_ENTRIES];
- UINT64 PageMapLevel4;
+ GDT64 RealModeGdt[NUM_REAL_GDT_ENTRIES];
+ UINT64 PageMapLevel4;
//
// A low memory stack
//
- CHAR8 Stack[LOW_STACK_SIZE];
+ CHAR8 Stack[LOW_STACK_SIZE];
//
// Legacy16 Init memory map info
//
- EFI_TO_COMPATIBILITY16_INIT_TABLE EfiToLegacy16InitTable;
+ EFI_TO_COMPATIBILITY16_INIT_TABLE EfiToLegacy16InitTable;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE EfiToLegacy16BootTable;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE EfiToLegacy16BootTable;
- CHAR8 InterruptRedirectionCode[32];
- EFI_LEGACY_INSTALL_PCI_HANDLER PciHandler;
- EFI_DISPATCH_OPROM_TABLE DispatchOpromTable;
- BBS_TABLE BbsTable[MAX_BBS_ENTRIES];
+ CHAR8 InterruptRedirectionCode[32];
+ EFI_LEGACY_INSTALL_PCI_HANDLER PciHandler;
+ EFI_DISPATCH_OPROM_TABLE DispatchOpromTable;
+ BBS_TABLE BbsTable[MAX_BBS_ENTRIES];
} LOW_MEMORY_THUNK;
#endif
@@ -337,42 +336,42 @@ typedef struct {
// PnP Expansion Header
//
typedef struct {
- UINT32 PnpSignature;
- UINT8 Revision;
- UINT8 Length;
- UINT16 NextHeader;
- UINT8 Reserved1;
- UINT8 Checksum;
- UINT32 DeviceId;
- UINT16 MfgPointer;
- UINT16 ProductNamePointer;
- UINT8 Class;
- UINT8 SubClass;
- UINT8 Interface;
- UINT8 DeviceIndicators;
- UINT16 Bcv;
- UINT16 DisconnectVector;
- UINT16 Bev;
- UINT16 Reserved2;
- UINT16 StaticResourceVector;
+ UINT32 PnpSignature;
+ UINT8 Revision;
+ UINT8 Length;
+ UINT16 NextHeader;
+ UINT8 Reserved1;
+ UINT8 Checksum;
+ UINT32 DeviceId;
+ UINT16 MfgPointer;
+ UINT16 ProductNamePointer;
+ UINT8 Class;
+ UINT8 SubClass;
+ UINT8 Interface;
+ UINT8 DeviceIndicators;
+ UINT16 Bcv;
+ UINT16 DisconnectVector;
+ UINT16 Bev;
+ UINT16 Reserved2;
+ UINT16 StaticResourceVector;
} LEGACY_PNP_EXPANSION_HEADER;
typedef struct {
- UINT8 PciSegment;
- UINT8 PciBus;
- UINT8 PciDevice;
- UINT8 PciFunction;
- UINT16 Vid;
- UINT16 Did;
- UINT16 SysSid;
- UINT16 SVid;
- UINT8 Class;
- UINT8 SubClass;
- UINT8 Interface;
- UINT8 Reserved;
- UINTN RomStart;
- UINTN ManufacturerString;
- UINTN ProductNameString;
+ UINT8 PciSegment;
+ UINT8 PciBus;
+ UINT8 PciDevice;
+ UINT8 PciFunction;
+ UINT16 Vid;
+ UINT16 Did;
+ UINT16 SysSid;
+ UINT16 SVid;
+ UINT8 Class;
+ UINT8 SubClass;
+ UINT8 Interface;
+ UINT8 Reserved;
+ UINTN RomStart;
+ UINTN ManufacturerString;
+ UINTN ProductNameString;
} LEGACY_ROM_AND_BBS_TABLE;
//
@@ -382,219 +381,217 @@ typedef struct {
// This mapping is ignored booting to a legacy OS.
//
typedef struct {
- UINT8 PciSegment;
- UINT8 PciBus;
- UINT8 PciDevice;
- UINT8 PciFunction;
- UINT8 StartDriveNumber;
- UINT8 EndDriveNumber;
+ UINT8 PciSegment;
+ UINT8 PciBus;
+ UINT8 PciDevice;
+ UINT8 PciFunction;
+ UINT8 StartDriveNumber;
+ UINT8 EndDriveNumber;
} LEGACY_EFI_HDD_TABLE;
//
// This data is passed to Leacy16Boot
//
typedef enum {
- EfiAcpiAddressRangeMemory = 1,
- EfiAcpiAddressRangeReserved = 2,
- EfiAcpiAddressRangeACPI = 3,
- EfiAcpiAddressRangeNVS = 4,
+ EfiAcpiAddressRangeMemory = 1,
+ EfiAcpiAddressRangeReserved = 2,
+ EfiAcpiAddressRangeACPI = 3,
+ EfiAcpiAddressRangeNVS = 4,
EfiAddressRangePersistentMemory = 7
} EFI_ACPI_MEMORY_TYPE;
typedef struct {
- UINT64 BaseAddr;
- UINT64 Length;
- EFI_ACPI_MEMORY_TYPE Type;
+ UINT64 BaseAddr;
+ UINT64 Length;
+ EFI_ACPI_MEMORY_TYPE Type;
} EFI_E820_ENTRY64;
typedef struct {
- UINT32 BassAddrLow;
- UINT32 BaseAddrHigh;
- UINT32 LengthLow;
- UINT32 LengthHigh;
- EFI_ACPI_MEMORY_TYPE Type;
+ UINT32 BassAddrLow;
+ UINT32 BaseAddrHigh;
+ UINT32 LengthLow;
+ UINT32 LengthHigh;
+ EFI_ACPI_MEMORY_TYPE Type;
} EFI_E820_ENTRY;
#pragma pack()
-extern BBS_TABLE *mBbsTable;
-
-extern EFI_GENERIC_MEMORY_TEST_PROTOCOL *gGenMemoryTest;
-
-extern BOOLEAN mEndOfDxe;
-
-#define PORT_70 0x70
-#define PORT_71 0x71
-
-#define CMOS_0A 0x0a ///< Status register A
-#define CMOS_0D 0x0d ///< Status register D
-#define CMOS_0E 0x0e ///< Diagnostic Status
-#define CMOS_0F 0x0f ///< Shutdown status
-#define CMOS_10 0x10 ///< Floppy type
-#define CMOS_12 0x12 ///< IDE type
-#define CMOS_14 0x14 ///< Same as BDA 40:10
-#define CMOS_15 0x15 ///< Low byte of base memory in 1k increments
-#define CMOS_16 0x16 ///< High byte of base memory in 1k increments
-#define CMOS_17 0x17 ///< Low byte of 1MB+ memory in 1k increments - max 15 MB
-#define CMOS_18 0x18 ///< High byte of 1MB+ memory in 1k increments - max 15 MB
-#define CMOS_19 0x19 ///< C: extended drive type
-#define CMOS_1A 0x1a ///< D: extended drive type
-#define CMOS_2E 0x2e ///< Most significient byte of standard checksum
-#define CMOS_2F 0x2f ///< Least significient byte of standard checksum
-#define CMOS_30 0x30 ///< CMOS 0x17
-#define CMOS_31 0x31 ///< CMOS 0x18
-#define CMOS_32 0x32 ///< Century byte
+extern BBS_TABLE *mBbsTable;
+
+extern EFI_GENERIC_MEMORY_TEST_PROTOCOL *gGenMemoryTest;
+
+extern BOOLEAN mEndOfDxe;
+
+#define PORT_70 0x70
+#define PORT_71 0x71
+
+#define CMOS_0A 0x0a ///< Status register A
+#define CMOS_0D 0x0d ///< Status register D
+#define CMOS_0E 0x0e ///< Diagnostic Status
+#define CMOS_0F 0x0f ///< Shutdown status
+#define CMOS_10 0x10 ///< Floppy type
+#define CMOS_12 0x12 ///< IDE type
+#define CMOS_14 0x14 ///< Same as BDA 40:10
+#define CMOS_15 0x15 ///< Low byte of base memory in 1k increments
+#define CMOS_16 0x16 ///< High byte of base memory in 1k increments
+#define CMOS_17 0x17 ///< Low byte of 1MB+ memory in 1k increments - max 15 MB
+#define CMOS_18 0x18 ///< High byte of 1MB+ memory in 1k increments - max 15 MB
+#define CMOS_19 0x19 ///< C: extended drive type
+#define CMOS_1A 0x1a ///< D: extended drive type
+#define CMOS_2E 0x2e ///< Most significient byte of standard checksum
+#define CMOS_2F 0x2f ///< Least significient byte of standard checksum
+#define CMOS_30 0x30 ///< CMOS 0x17
+#define CMOS_31 0x31 ///< CMOS 0x18
+#define CMOS_32 0x32 ///< Century byte
//
// 8254 Timer registers
//
-#define TIMER0_COUNT_PORT 0x40
-#define TIMER1_COUNT_PORT 0x41
-#define TIMER2_COUNT_PORT 0x42
-#define TIMER_CONTROL_PORT 0x43
+#define TIMER0_COUNT_PORT 0x40
+#define TIMER1_COUNT_PORT 0x41
+#define TIMER2_COUNT_PORT 0x42
+#define TIMER_CONTROL_PORT 0x43
//
// Timer 0, Read/Write LSB then MSB, Square wave output, binary count use.
//
-#define TIMER0_CONTROL_WORD 0x36
+#define TIMER0_CONTROL_WORD 0x36
#define LEGACY_BIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('L', 'B', 'I', 'T')
typedef struct {
- UINTN Signature;
+ UINTN Signature;
- EFI_HANDLE Handle;
- EFI_LEGACY_BIOS_PROTOCOL LegacyBios;
+ EFI_HANDLE Handle;
+ EFI_LEGACY_BIOS_PROTOCOL LegacyBios;
- EFI_HANDLE ImageHandle;
+ EFI_HANDLE ImageHandle;
//
// CPU Architectural Protocol
//
- EFI_CPU_ARCH_PROTOCOL *Cpu;
+ EFI_CPU_ARCH_PROTOCOL *Cpu;
//
// Timer Architectural Protocol
//
- EFI_TIMER_ARCH_PROTOCOL *Timer;
- BOOLEAN TimerUses8254;
+ EFI_TIMER_ARCH_PROTOCOL *Timer;
+ BOOLEAN TimerUses8254;
//
// Protocol to Lock and Unlock 0xc0000 - 0xfffff
//
- EFI_LEGACY_REGION2_PROTOCOL *LegacyRegion;
+ EFI_LEGACY_REGION2_PROTOCOL *LegacyRegion;
- EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
+ EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
//
// Interrupt control for thunk and PCI IRQ
//
- EFI_LEGACY_8259_PROTOCOL *Legacy8259;
+ EFI_LEGACY_8259_PROTOCOL *Legacy8259;
//
// PCI Interrupt PIRQ control
//
- EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
+ EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
//
// Generic Memory Test
//
- EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenericMemoryTest;
+ EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenericMemoryTest;
//
// TRUE if PCI Interrupt Line registers have been programmed.
//
- BOOLEAN PciInterruptLine;
+ BOOLEAN PciInterruptLine;
//
// Code space below 1MB needed by thunker to transition to real mode.
// Contains stack and real mode code fragments
//
- LOW_MEMORY_THUNK *IntThunk;
+ LOW_MEMORY_THUNK *IntThunk;
//
// Starting shadow address of the Legacy BIOS
//
- UINT32 BiosStart;
- UINT32 LegacyBiosImageSize;
+ UINT32 BiosStart;
+ UINT32 LegacyBiosImageSize;
//
// Start of variables used by CsmItp.mac ITP macro file and/os LegacyBios
//
- UINT8 Dump[4];
+ UINT8 Dump[4];
//
// $EFI Legacy16 code entry info in memory < 1 MB;
//
- EFI_COMPATIBILITY16_TABLE *Legacy16Table;
- VOID *Legacy16InitPtr;
- VOID *Legacy16BootPtr;
- VOID *InternalIrqRoutingTable;
- UINT32 NumberIrqRoutingEntries;
- VOID *BbsTablePtr;
- VOID *HddTablePtr;
- UINT32 NumberHddControllers;
+ EFI_COMPATIBILITY16_TABLE *Legacy16Table;
+ VOID *Legacy16InitPtr;
+ VOID *Legacy16BootPtr;
+ VOID *InternalIrqRoutingTable;
+ UINT32 NumberIrqRoutingEntries;
+ VOID *BbsTablePtr;
+ VOID *HddTablePtr;
+ UINT32 NumberHddControllers;
//
// Cached copy of Legacy16 entry point
//
- UINT16 Legacy16CallSegment;
- UINT16 Legacy16CallOffset;
+ UINT16 Legacy16CallSegment;
+ UINT16 Legacy16CallOffset;
//
// Returned from $EFI and passed in to OPROMS
//
- UINT16 PnPInstallationCheckSegment;
- UINT16 PnPInstallationCheckOffset;
+ UINT16 PnPInstallationCheckSegment;
+ UINT16 PnPInstallationCheckOffset;
//
// E820 table
//
- EFI_E820_ENTRY E820Table[EFI_MAX_E820_ENTRY];
- UINT32 NumberE820Entries;
+ EFI_E820_ENTRY E820Table[EFI_MAX_E820_ENTRY];
+ UINT32 NumberE820Entries;
//
// True if legacy VGA INT 10h handler installed
//
- BOOLEAN VgaInstalled;
+ BOOLEAN VgaInstalled;
//
// Number of IDE drives
//
- UINT8 IdeDriveCount;
+ UINT8 IdeDriveCount;
//
// Current Free Option ROM space. An option ROM must NOT go past
// BiosStart.
//
- UINT32 OptionRom;
+ UINT32 OptionRom;
//
// Save Legacy16 unexpected interrupt vector. Reprogram INT 68-6F from
// EFI values to legacy value just before boot.
//
- UINT32 BiosUnexpectedInt;
- UINT32 ThunkSavedInt[8];
- UINT16 ThunkSeg;
- LEGACY_EFI_HDD_TABLE *LegacyEfiHddTable;
- UINT16 LegacyEfiHddTableIndex;
- UINT8 DiskEnd;
- UINT8 Disk4075;
- UINT16 TraceIndex;
- UINT16 Trace[0x200];
+ UINT32 BiosUnexpectedInt;
+ UINT32 ThunkSavedInt[8];
+ UINT16 ThunkSeg;
+ LEGACY_EFI_HDD_TABLE *LegacyEfiHddTable;
+ UINT16 LegacyEfiHddTableIndex;
+ UINT8 DiskEnd;
+ UINT8 Disk4075;
+ UINT16 TraceIndex;
+ UINT16 Trace[0x200];
//
// Indicate that whether GenericLegacyBoot is entered or not
//
- BOOLEAN LegacyBootEntered;
+ BOOLEAN LegacyBootEntered;
//
// CSM16 PCI Interface Version
//
- UINT16 Csm16PciInterfaceVersion;
-
+ UINT16 Csm16PciInterfaceVersion;
} LEGACY_BIOS_INSTANCE;
-
#pragma pack(1)
/*
@@ -636,41 +633,41 @@ typedef struct {
40:98-101 skip
*/
typedef struct {
- UINT16 Com1;
- UINT16 Com2;
- UINT16 Com3;
- UINT16 Com4;
- UINT16 Lpt1;
- UINT16 Lpt2;
- UINT16 Lpt3;
- UINT16 Ebda;
- UINT16 MachineConfig;
- UINT8 Bda12;
- UINT16 MemSize;
- UINT8 Bda15_16[0x02];
- UINT8 ShiftStatus;
- UINT8 Bda18_19[0x02];
- UINT16 KeyHead;
- UINT16 KeyTail;
- UINT16 Bda1E_3D[0x10];
- UINT16 FloppyData;
- UINT8 FloppyTimeout;
- UINT8 Bda41_74[0x34];
- UINT8 NumberOfDrives;
- UINT8 Bda76_77[0x02];
- UINT16 Lpt1_2Timeout;
- UINT16 Lpt3_4Timeout;
- UINT16 Com1_2Timeout;
- UINT16 Com3_4Timeout;
- UINT16 KeyStart;
- UINT16 KeyEnd;
- UINT8 Bda84_87[0x4];
- UINT8 DataXmit;
- UINT8 Bda89_8F[0x07];
- UINT8 FloppyXRate;
- UINT8 Bda91_95[0x05];
- UINT8 KeyboardStatus;
- UINT8 LedStatus;
+ UINT16 Com1;
+ UINT16 Com2;
+ UINT16 Com3;
+ UINT16 Com4;
+ UINT16 Lpt1;
+ UINT16 Lpt2;
+ UINT16 Lpt3;
+ UINT16 Ebda;
+ UINT16 MachineConfig;
+ UINT8 Bda12;
+ UINT16 MemSize;
+ UINT8 Bda15_16[0x02];
+ UINT8 ShiftStatus;
+ UINT8 Bda18_19[0x02];
+ UINT16 KeyHead;
+ UINT16 KeyTail;
+ UINT16 Bda1E_3D[0x10];
+ UINT16 FloppyData;
+ UINT8 FloppyTimeout;
+ UINT8 Bda41_74[0x34];
+ UINT8 NumberOfDrives;
+ UINT8 Bda76_77[0x02];
+ UINT16 Lpt1_2Timeout;
+ UINT16 Lpt3_4Timeout;
+ UINT16 Com1_2Timeout;
+ UINT16 Com3_4Timeout;
+ UINT16 KeyStart;
+ UINT16 KeyEnd;
+ UINT8 Bda84_87[0x4];
+ UINT8 DataXmit;
+ UINT8 Bda89_8F[0x07];
+ UINT8 FloppyXRate;
+ UINT8 Bda91_95[0x05];
+ UINT8 KeyboardStatus;
+ UINT8 LedStatus;
} BDA_STRUC;
#pragma pack()
@@ -694,12 +691,11 @@ typedef struct {
BOOLEAN
EFIAPI
LegacyBiosInt86 (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT8 BiosInt,
- IN EFI_IA32_REGISTER_SET *Regs
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT8 BiosInt,
+ IN EFI_IA32_REGISTER_SET *Regs
);
-
/**
Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the
16-bit register context on entry and exit. Arguments can be passed on
@@ -721,15 +717,14 @@ LegacyBiosInt86 (
BOOLEAN
EFIAPI
LegacyBiosFarCall86 (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT16 Segment,
- IN UINT16 Offset,
- IN EFI_IA32_REGISTER_SET *Regs,
- IN VOID *Stack,
- IN UINTN StackSize
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT16 Segment,
+ IN UINT16 Offset,
+ IN EFI_IA32_REGISTER_SET *Regs,
+ IN VOID *Stack,
+ IN UINTN StackSize
);
-
/**
Test to see if a legacy PCI ROM exists for this device. Optionally return
the Legacy ROM instance for this PCI device.
@@ -748,14 +743,13 @@ LegacyBiosFarCall86 (
EFI_STATUS
EFIAPI
LegacyBiosCheckPciRom (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN EFI_HANDLE PciHandle,
- OUT VOID **RomImage OPTIONAL,
- OUT UINTN *RomSize OPTIONAL,
- OUT UINTN *Flags
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ OUT VOID **RomImage OPTIONAL,
+ OUT UINTN *RomSize OPTIONAL,
+ OUT UINTN *Flags
);
-
/**
Assign drive number to legacy HDD drives prior to booting an EFI
aware OS so the OS can access drives without an EFI driver.
@@ -772,12 +766,11 @@ LegacyBiosCheckPciRom (
EFI_STATUS
EFIAPI
LegacyBiosPrepareToBootEfi (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- OUT UINT16 *BbsCount,
- OUT BBS_TABLE **BbsTable
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ OUT UINT16 *BbsCount,
+ OUT BBS_TABLE **BbsTable
);
-
/**
To boot from an unconventional device like parties and/or execute
HDD diagnostics.
@@ -796,14 +789,13 @@ LegacyBiosPrepareToBootEfi (
EFI_STATUS
EFIAPI
LegacyBiosBootUnconventionalDevice (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UDC_ATTRIBUTES Attributes,
- IN UINTN BbsEntry,
- IN VOID *BeerData,
- IN VOID *ServiceAreaData
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UDC_ATTRIBUTES Attributes,
+ IN UINTN BbsEntry,
+ IN VOID *BeerData,
+ IN VOID *ServiceAreaData
);
-
/**
Load a legacy PC-AT OPROM on the PciHandle device. Return information
about how many disks were added by the OPROM and the shadow address and
@@ -834,17 +826,16 @@ LegacyBiosBootUnconventionalDevice (
EFI_STATUS
EFIAPI
LegacyBiosInstallPciRom (
- IN EFI_LEGACY_BIOS_PROTOCOL * This,
- IN EFI_HANDLE PciHandle,
- IN VOID **RomImage,
- OUT UINTN *Flags,
- OUT UINT8 *DiskStart OPTIONAL,
- OUT UINT8 *DiskEnd OPTIONAL,
- OUT VOID **RomShadowAddress OPTIONAL,
- OUT UINT32 *RomShadowedSize OPTIONAL
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ IN VOID **RomImage,
+ OUT UINTN *Flags,
+ OUT UINT8 *DiskStart OPTIONAL,
+ OUT UINT8 *DiskEnd OPTIONAL,
+ OUT VOID **RomShadowAddress OPTIONAL,
+ OUT UINT32 *RomShadowedSize OPTIONAL
);
-
/**
Fill in the standard BDA for Keyboard LEDs
@@ -857,11 +848,10 @@ LegacyBiosInstallPciRom (
EFI_STATUS
EFIAPI
LegacyBiosUpdateKeyboardLedStatus (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT8 Leds
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT8 Leds
);
-
/**
Get all BBS info
@@ -879,14 +869,13 @@ LegacyBiosUpdateKeyboardLedStatus (
EFI_STATUS
EFIAPI
LegacyBiosGetBbsInfo (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- OUT UINT16 *HddCount,
- OUT HDD_INFO **HddInfo,
- OUT UINT16 *BbsCount,
- OUT BBS_TABLE **BbsTable
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ OUT UINT16 *HddCount,
+ OUT HDD_INFO **HddInfo,
+ OUT UINT16 *BbsCount,
+ OUT BBS_TABLE **BbsTable
);
-
/**
Shadow all legacy16 OPROMs that haven't been shadowed.
Warning: Use this with caution. This routine disconnects all EFI
@@ -901,10 +890,9 @@ LegacyBiosGetBbsInfo (
EFI_STATUS
EFIAPI
LegacyBiosShadowAllLegacyOproms (
- IN EFI_LEGACY_BIOS_PROTOCOL *This
+ IN EFI_LEGACY_BIOS_PROTOCOL *This
);
-
/**
Attempt to legacy boot the BootOption. If the EFI contexted has been
compromised this function will not return.
@@ -920,13 +908,12 @@ LegacyBiosShadowAllLegacyOproms (
EFI_STATUS
EFIAPI
LegacyBiosLegacyBoot (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
- IN UINT32 LoadOptionsSize,
- IN VOID *LoadOptions
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
+ IN UINT32 LoadOptionsSize,
+ IN VOID *LoadOptions
);
-
/**
Allocate memory < 1 MB and copy the thunker code into low memory. Se up
all the descriptors.
@@ -938,10 +925,9 @@ LegacyBiosLegacyBoot (
**/
EFI_STATUS
LegacyBiosInitializeThunk (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Fill in the standard BDA and EBDA stuff before Legacy16 load
@@ -952,10 +938,9 @@ LegacyBiosInitializeThunk (
**/
EFI_STATUS
LegacyBiosInitBda (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Collect IDE Inquiry data from the IDE disks
@@ -968,12 +953,11 @@ LegacyBiosInitBda (
**/
EFI_STATUS
LegacyBiosBuildIdeData (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN HDD_INFO **HddInfo,
- IN UINT16 Flag
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN HDD_INFO **HddInfo,
+ IN UINT16 Flag
);
-
/**
Enable ide controller. This gets disabled when LegacyBoot.c is about
to run the Option ROMs.
@@ -984,10 +968,9 @@ LegacyBiosBuildIdeData (
**/
VOID
EnableIdeController (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
If the IDE channel is in compatibility (legacy) mode, remove all
PCI I/O BAR addresses from the controller.
@@ -998,10 +981,9 @@ EnableIdeController (
**/
VOID
InitLegacyIdeController (
- IN EFI_HANDLE IdeController
+ IN EFI_HANDLE IdeController
);
-
/**
Program the interrupt routing register in all the PCI devices. On a PC AT system
this register contains the 8259 IRQ vector that matches its PCI interrupt.
@@ -1014,10 +996,9 @@ InitLegacyIdeController (
**/
EFI_STATUS
PciProgramAllInterruptLineRegisters (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Collect EFI Info about legacy devices.
@@ -1028,10 +1009,9 @@ PciProgramAllInterruptLineRegisters (
**/
EFI_STATUS
LegacyBiosBuildSioData (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Shadow all the PCI legacy ROMs. Use data from the Legacy BIOS Protocol
to chose the order. Skip any devices that have already have legacy
@@ -1045,10 +1025,9 @@ LegacyBiosBuildSioData (
**/
EFI_STATUS
PciShadowRoms (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Fill in the standard BDA and EBDA stuff prior to legacy Boot
@@ -1059,10 +1038,9 @@ PciShadowRoms (
**/
EFI_STATUS
LegacyBiosCompleteBdaBeforeBoot (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Fill in the standard CMOS stuff before Legacy16 load
@@ -1073,10 +1051,9 @@ LegacyBiosCompleteBdaBeforeBoot (
**/
EFI_STATUS
LegacyBiosInitCmos (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Fill in the standard CMOS stuff prior to legacy Boot
@@ -1087,10 +1064,9 @@ LegacyBiosInitCmos (
**/
EFI_STATUS
LegacyBiosCompleteStandardCmosBeforeBoot (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
-
/**
Contains the code that is copied into low memory (below 640K).
This code reflects interrupts 0x68-0x6f to interrupts 0x08-0x0f.
@@ -1105,7 +1081,6 @@ InterruptRedirectionTemplate (
VOID
);
-
/**
Build the E820 table.
@@ -1117,8 +1092,8 @@ InterruptRedirectionTemplate (
**/
EFI_STATUS
LegacyBiosBuildE820 (
- IN LEGACY_BIOS_INSTANCE *Private,
- OUT UINTN *Size
+ IN LEGACY_BIOS_INSTANCE *Private,
+ OUT UINTN *Size
);
/**
@@ -1129,7 +1104,7 @@ LegacyBiosBuildE820 (
**/
VOID
ShutdownAPs (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
/**
@@ -1141,7 +1116,7 @@ ShutdownAPs (
**/
VOID
GetRegisters (
- LOW_MEMORY_THUNK *IntThunk
+ LOW_MEMORY_THUNK *IntThunk
);
/**
@@ -1156,9 +1131,9 @@ GetRegisters (
**/
UINTN
CallRealThunkCode (
- UINT8 *RealCode,
- UINT8 BiosInt,
- UINT32 CallAddress
+ UINT8 *RealCode,
+ UINT8 BiosInt,
+ UINT32 CallAddress
);
/**
@@ -1169,7 +1144,7 @@ CallRealThunkCode (
**/
VOID
GenerateSoftInit (
- UINT8 Vector
+ UINT8 Vector
);
/**
@@ -1187,11 +1162,11 @@ GenerateSoftInit (
**/
EFI_STATUS
AllocateLegacyMemory (
- IN EFI_ALLOCATE_TYPE AllocateType,
- IN EFI_MEMORY_TYPE MemoryType,
- IN EFI_PHYSICAL_ADDRESS StartPageAddress,
- IN UINTN Pages,
- OUT EFI_PHYSICAL_ADDRESS *Result
+ IN EFI_ALLOCATE_TYPE AllocateType,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN EFI_PHYSICAL_ADDRESS StartPageAddress,
+ IN UINTN Pages,
+ OUT EFI_PHYSICAL_ADDRESS *Result
);
/**
@@ -1214,11 +1189,11 @@ AllocateLegacyMemory (
EFI_STATUS
EFIAPI
LegacyBiosGetLegacyRegion (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINTN LegacyMemorySize,
- IN UINTN Region,
- IN UINTN Alignment,
- OUT VOID **LegacyMemoryAddress
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINTN LegacyMemorySize,
+ IN UINTN Region,
+ IN UINTN Alignment,
+ OUT VOID **LegacyMemoryAddress
);
/**
@@ -1238,10 +1213,10 @@ LegacyBiosGetLegacyRegion (
EFI_STATUS
EFIAPI
LegacyBiosCopyLegacyRegion (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINTN LegacyMemorySize,
- IN VOID *LegacyMemoryAddress,
- IN VOID *LegacyMemorySourceAddress
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINTN LegacyMemorySize,
+ IN VOID *LegacyMemoryAddress,
+ IN VOID *LegacyMemorySourceAddress
);
/**
@@ -1295,8 +1270,8 @@ HasMediaInFloppy (
**/
EFI_STATUS
CalculateIdentifyDriveChecksum (
- IN UINT8 *IdentifyDriveData,
- OUT UINT8 *Checksum
+ IN UINT8 *IdentifyDriveData,
+ OUT UINT8 *Checksum
);
/**
@@ -1307,7 +1282,7 @@ CalculateIdentifyDriveChecksum (
**/
VOID
UpdateIdentifyDriveData (
- IN UINT8 *IdentifyDriveData
+ IN UINT8 *IdentifyDriveData
);
/**
@@ -1321,8 +1296,8 @@ UpdateIdentifyDriveData (
**/
EFI_STATUS
LegacyBiosBuildBbs (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN BBS_TABLE *BbsTable
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN BBS_TABLE *BbsTable
);
/**
@@ -1386,14 +1361,14 @@ LegacyCalculateWriteStandardCmosChecksum (
**/
EFI_STATUS
LegacyBiosCheckPciRomEx (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN EFI_HANDLE PciHandle,
- OUT VOID **RomImage OPTIONAL,
- OUT UINTN *RomSize OPTIONAL,
- OUT UINTN *RuntimeImageLength OPTIONAL,
- OUT UINTN *Flags OPTIONAL,
- OUT UINT8 *OpromRevision OPTIONAL,
- OUT VOID **ConfigUtilityCodeHeader OPTIONAL
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ OUT VOID **RomImage OPTIONAL,
+ OUT UINTN *RomSize OPTIONAL,
+ OUT UINTN *RuntimeImageLength OPTIONAL,
+ OUT UINTN *Flags OPTIONAL,
+ OUT UINT8 *OpromRevision OPTIONAL,
+ OUT VOID **ConfigUtilityCodeHeader OPTIONAL
);
/**
@@ -1408,8 +1383,8 @@ LegacyBiosCheckPciRomEx (
**/
EFI_STATUS
RelocateImageUnder4GIfNeeded (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -1433,12 +1408,12 @@ RelocateImageUnder4GIfNeeded (
BOOLEAN
EFIAPI
InternalLegacyBiosFarCall (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT16 Segment,
- IN UINT16 Offset,
- IN EFI_IA32_REGISTER_SET *Regs,
- IN VOID *Stack,
- IN UINTN StackSize
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT16 Segment,
+ IN UINT16 Offset,
+ IN EFI_IA32_REGISTER_SET *Regs,
+ IN VOID *Stack,
+ IN UINTN StackSize
);
/**
@@ -1454,7 +1429,7 @@ InternalLegacyBiosFarCall (
**/
EFI_STATUS
LegacyBiosInstallVgaRom (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
);
#endif
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
index 9a09d72307..83d94cf289 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
@@ -13,18 +13,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define BOOT_EFI_OS 1
#define BOOT_UNCONVENTIONAL_DEVICE 2
-UINT32 mLoadOptionsSize = 0;
-UINTN mBootMode = BOOT_LEGACY_OS;
-VOID *mLoadOptions = NULL;
-BBS_BBS_DEVICE_PATH *mBbsDevicePathPtr = NULL;
-BBS_BBS_DEVICE_PATH mBbsDevicePathNode;
-UDC_ATTRIBUTES mAttributes = { 0, 0, 0, 0 };
-UINTN mBbsEntry = 0;
-VOID *mBeerData = NULL;
-VOID *mServiceAreaData = NULL;
-UINT64 mLowWater = 0xffffffffffffffffULL;
-
-extern BBS_TABLE *mBbsTable;
+UINT32 mLoadOptionsSize = 0;
+UINTN mBootMode = BOOT_LEGACY_OS;
+VOID *mLoadOptions = NULL;
+BBS_BBS_DEVICE_PATH *mBbsDevicePathPtr = NULL;
+BBS_BBS_DEVICE_PATH mBbsDevicePathNode;
+UDC_ATTRIBUTES mAttributes = { 0, 0, 0, 0 };
+UINTN mBbsEntry = 0;
+VOID *mBeerData = NULL;
+VOID *mServiceAreaData = NULL;
+UINT64 mLowWater = 0xffffffffffffffffULL;
+
+extern BBS_TABLE *mBbsTable;
extern VOID *mRuntimeSmbiosEntryPoint;
extern EFI_PHYSICAL_ADDRESS mReserveSmbiosEntryPoint;
@@ -39,12 +39,12 @@ extern EFI_PHYSICAL_ADDRESS mStructureTableAddress;
**/
VOID
PrintBbsTable (
- IN BBS_TABLE *BbsTable
+ IN BBS_TABLE *BbsTable
)
{
- UINT16 Index;
- UINT16 SubIndex;
- CHAR8 *String;
+ UINT16 Index;
+ UINT16 SubIndex;
+ CHAR8 *String;
DEBUG ((DEBUG_INFO, "\n"));
DEBUG ((DEBUG_INFO, " NO Prio bb/dd/ff cl/sc Type Stat segm:offs mfgs:mfgo dess:deso\n"));
@@ -60,25 +60,25 @@ PrintBbsTable (
DEBUG ((
DEBUG_INFO,
" %02x: %04x %02x/%02x/%02x %02x/%02x %04x %04x",
- (UINTN) Index,
- (UINTN) BbsTable[Index].BootPriority,
- (UINTN) BbsTable[Index].Bus,
- (UINTN) BbsTable[Index].Device,
- (UINTN) BbsTable[Index].Function,
- (UINTN) BbsTable[Index].Class,
- (UINTN) BbsTable[Index].SubClass,
- (UINTN) BbsTable[Index].DeviceType,
- (UINTN) * (UINT16 *) &BbsTable[Index].StatusFlags
+ (UINTN)Index,
+ (UINTN)BbsTable[Index].BootPriority,
+ (UINTN)BbsTable[Index].Bus,
+ (UINTN)BbsTable[Index].Device,
+ (UINTN)BbsTable[Index].Function,
+ (UINTN)BbsTable[Index].Class,
+ (UINTN)BbsTable[Index].SubClass,
+ (UINTN)BbsTable[Index].DeviceType,
+ (UINTN)*(UINT16 *)&BbsTable[Index].StatusFlags
));
DEBUG ((
DEBUG_INFO,
" %04x:%04x %04x:%04x %04x:%04x",
- (UINTN) BbsTable[Index].BootHandlerSegment,
- (UINTN) BbsTable[Index].BootHandlerOffset,
- (UINTN) BbsTable[Index].MfgStringSegment,
- (UINTN) BbsTable[Index].MfgStringOffset,
- (UINTN) BbsTable[Index].DescStringSegment,
- (UINTN) BbsTable[Index].DescStringOffset
+ (UINTN)BbsTable[Index].BootHandlerSegment,
+ (UINTN)BbsTable[Index].BootHandlerOffset,
+ (UINTN)BbsTable[Index].MfgStringSegment,
+ (UINTN)BbsTable[Index].MfgStringOffset,
+ (UINTN)BbsTable[Index].DescStringSegment,
+ (UINTN)BbsTable[Index].DescStringOffset
));
//
@@ -86,18 +86,20 @@ PrintBbsTable (
//
String = (CHAR8 *)(((UINTN)BbsTable[Index].DescStringSegment << 4) + BbsTable[Index].DescStringOffset);
if (String != NULL) {
- DEBUG ((DEBUG_INFO," ("));
+ DEBUG ((DEBUG_INFO, " ("));
for (SubIndex = 0; String[SubIndex] != 0; SubIndex++) {
DEBUG ((DEBUG_INFO, "%c", String[SubIndex]));
}
- DEBUG ((DEBUG_INFO,")"));
+
+ DEBUG ((DEBUG_INFO, ")"));
}
- DEBUG ((DEBUG_INFO,"\n"));
+
+ DEBUG ((DEBUG_INFO, "\n"));
}
DEBUG ((DEBUG_INFO, "\n"));
- return ;
+ return;
}
/**
@@ -109,10 +111,10 @@ PrintBbsTable (
**/
VOID
PrintHddInfo (
- IN HDD_INFO *HddInfo
+ IN HDD_INFO *HddInfo
)
{
- UINTN Index;
+ UINTN Index;
DEBUG ((DEBUG_INFO, "\n"));
for (Index = 0; Index < MAX_IDE_CONTROLLER; Index++) {
@@ -129,7 +131,7 @@ PrintHddInfo (
DEBUG ((DEBUG_INFO, "\n"));
- return ;
+ return;
}
/**
@@ -140,16 +142,16 @@ PrintPciInterruptRegister (
VOID
)
{
- EFI_STATUS Status;
- UINTN Index;
- EFI_HANDLE *Handles;
- UINTN HandleNum;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 Interrupt[2];
- UINTN Segment;
- UINTN Bus;
- UINTN Device;
- UINTN Function;
+ EFI_STATUS Status;
+ UINTN Index;
+ EFI_HANDLE *Handles;
+ UINTN HandleNum;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINT8 Interrupt[2];
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
gBS->LocateHandleBuffer (
ByProtocol,
@@ -167,7 +169,7 @@ PrintPciInterruptRegister (
DEBUG ((DEBUG_INFO, " bb/dd/ff interrupt line interrupt pin\n"));
DEBUG ((DEBUG_INFO, "======================================\n"));
for (Index = 0; Index < HandleNum; Index++) {
- Status = gBS->HandleProtocol (Handles[Index], &gEfiPciIoProtocolGuid, (VOID **) &PciIo);
+ Status = gBS->HandleProtocol (Handles[Index], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
if (!EFI_ERROR (Status)) {
Status = PciIo->Pci.Read (
PciIo,
@@ -177,6 +179,7 @@ PrintPciInterruptRegister (
Interrupt
);
}
+
if (!EFI_ERROR (Status)) {
Status = PciIo->GetLocation (
PciIo,
@@ -186,11 +189,20 @@ PrintPciInterruptRegister (
&Function
);
}
+
if (!EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, " %02x/%02x/%02x 0x%02x 0x%02x\n",
- Bus, Device, Function, Interrupt[0], Interrupt[1]));
+ DEBUG ((
+ DEBUG_INFO,
+ " %02x/%02x/%02x 0x%02x 0x%02x\n",
+ Bus,
+ Device,
+ Function,
+ Interrupt[0],
+ Interrupt[1]
+ ));
}
}
+
DEBUG ((DEBUG_INFO, "\n"));
if (Handles != NULL) {
@@ -206,7 +218,7 @@ PrintPciInterruptRegister (
**/
VOID
UpdateIdentifyDriveData (
- IN UINT8 *IdentifyDriveData
+ IN UINT8 *IdentifyDriveData
);
/**
@@ -219,30 +231,30 @@ UpdateIdentifyDriveData (
**/
EFI_STATUS
UpdateSioData (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index1;
- UINT8 LegacyInterrupts[16];
- EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable;
- UINTN RoutingTableEntries;
- EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY *IrqPriorityTable;
- UINTN NumberPriorityEntries;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
- UINT8 HddIrq;
- UINT16 LegacyInt;
- UINT16 LegMask;
- UINT32 Register;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- EFI_ISA_IO_PROTOCOL *IsaIo;
-
- LegacyInt = 0;
- HandleBuffer = NULL;
-
- EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN Index1;
+ UINT8 LegacyInterrupts[16];
+ EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable;
+ UINTN RoutingTableEntries;
+ EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY *IrqPriorityTable;
+ UINTN NumberPriorityEntries;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
+ UINT8 HddIrq;
+ UINT16 LegacyInt;
+ UINT16 LegMask;
+ UINT32 Register;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ EFI_ISA_IO_PROTOCOL *IsaIo;
+
+ LegacyInt = 0;
+ HandleBuffer = NULL;
+
+ EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
LegacyBiosBuildSioData (Private);
SetMem (LegacyInterrupts, sizeof (LegacyInterrupts), 0);
@@ -270,21 +282,21 @@ UpdateSioData (
}
Private->LegacyBiosPlatform->GetRoutingTable (
- Private->LegacyBiosPlatform,
- (VOID *) &RoutingTable,
- &RoutingTableEntries,
- NULL,
- NULL,
- (VOID **) &IrqPriorityTable,
- &NumberPriorityEntries
- );
+ Private->LegacyBiosPlatform,
+ (VOID *)&RoutingTable,
+ &RoutingTableEntries,
+ NULL,
+ NULL,
+ (VOID **)&IrqPriorityTable,
+ &NumberPriorityEntries
+ );
//
// Remove legacy interrupts from the list of PCI interrupts available.
//
for (Index = 0; Index <= 0x0b; Index++) {
for (Index1 = 0; Index1 <= NumberPriorityEntries; Index1++) {
if (LegacyInterrupts[Index] != 0) {
- LegacyInt = (UINT16) (LegacyInt | (1 << LegacyInterrupts[Index]));
+ LegacyInt = (UINT16)(LegacyInt | (1 << LegacyInterrupts[Index]));
if (LegacyInterrupts[Index] == IrqPriorityTable[Index1].Irq) {
IrqPriorityTable[Index1].Used = LEGACY_USED;
}
@@ -293,37 +305,37 @@ UpdateSioData (
}
Private->Legacy8259->GetMask (
- Private->Legacy8259,
- &LegMask,
- NULL,
- NULL,
- NULL
- );
+ Private->Legacy8259,
+ &LegMask,
+ NULL,
+ NULL,
+ NULL
+ );
//
// Set SIO interrupts and disable mouse. Let mouse driver
// re-enable it.
//
- LegMask = (UINT16) ((LegMask &~LegacyInt) | 0x1000);
+ LegMask = (UINT16)((LegMask &~LegacyInt) | 0x1000);
Private->Legacy8259->SetMask (
- Private->Legacy8259,
- &LegMask,
- NULL,
- NULL,
- NULL
- );
+ Private->Legacy8259,
+ &LegMask,
+ NULL,
+ NULL,
+ NULL
+ );
//
// Disable mouse in keyboard controller
//
Register = 0xA7;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiIsaIoProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiIsaIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -332,11 +344,10 @@ UpdateSioData (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiIsaIoProtocolGuid,
- (VOID **) &IsaIo
+ (VOID **)&IsaIo
);
ASSERT_EFI_ERROR (Status);
IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, 0x64, 1, &Register);
-
}
if (HandleBuffer != NULL) {
@@ -344,7 +355,6 @@ UpdateSioData (
}
return EFI_SUCCESS;
-
}
/**
@@ -360,12 +370,13 @@ UpdateSioData (
**/
EFI_STATUS
CalculateIdentifyDriveChecksum (
- IN UINT8 *IdentifyDriveData,
- OUT UINT8 *Checksum
+ IN UINT8 *IdentifyDriveData,
+ OUT UINT8 *Checksum
)
{
- UINTN Index;
- UINT8 LocalChecksum;
+ UINTN Index;
+ UINT8 LocalChecksum;
+
LocalChecksum = 0;
*Checksum = 0;
if (IdentifyDriveData[510] != 0xA5) {
@@ -373,14 +384,13 @@ CalculateIdentifyDriveChecksum (
}
for (Index = 0; Index < 512; Index++) {
- LocalChecksum = (UINT8) (LocalChecksum + IdentifyDriveData[Index]);
+ LocalChecksum = (UINT8)(LocalChecksum + IdentifyDriveData[Index]);
}
*Checksum = LocalChecksum;
return EFI_SUCCESS;
}
-
/**
Identify drive data must be updated to actual parameters before boot.
@@ -390,7 +400,7 @@ CalculateIdentifyDriveChecksum (
**/
VOID
UpdateIdentifyDriveData (
- IN UINT8 *IdentifyDriveData
+ IN UINT8 *IdentifyDriveData
)
{
UINT16 NumberCylinders;
@@ -406,31 +416,32 @@ UpdateIdentifyDriveData (
// Status indicates if Integrity byte is correct. Checksum should be
// 0 if valid.
//
- ReadInfo = (ATAPI_IDENTIFY *) IdentifyDriveData;
- Status = CalculateIdentifyDriveChecksum (IdentifyDriveData, &OriginalChecksum);
+ ReadInfo = (ATAPI_IDENTIFY *)IdentifyDriveData;
+ Status = CalculateIdentifyDriveChecksum (IdentifyDriveData, &OriginalChecksum);
if (OriginalChecksum != 0) {
Status = EFI_SECURITY_VIOLATION;
}
+
//
// If NumberCylinders = 0 then do data(Controller present but don drive attached).
//
NumberCylinders = ReadInfo->Raw[1];
if (NumberCylinders != 0) {
- ReadInfo->Raw[54] = NumberCylinders;
+ ReadInfo->Raw[54] = NumberCylinders;
- NumberHeads = ReadInfo->Raw[3];
- ReadInfo->Raw[55] = NumberHeads;
+ NumberHeads = ReadInfo->Raw[3];
+ ReadInfo->Raw[55] = NumberHeads;
- NumberSectorsTrack = ReadInfo->Raw[6];
- ReadInfo->Raw[56] = NumberSectorsTrack;
+ NumberSectorsTrack = ReadInfo->Raw[6];
+ ReadInfo->Raw[56] = NumberSectorsTrack;
//
// Copy Multisector info and set valid bit.
//
- ReadInfo->Raw[59] = (UINT16) (ReadInfo->Raw[47] + 0x100);
- CapacityInSectors = (UINT32) ((UINT32) (NumberCylinders) * (UINT32) (NumberHeads) * (UINT32) (NumberSectorsTrack));
- ReadInfo->Raw[57] = (UINT16) (CapacityInSectors >> 16);
- ReadInfo->Raw[58] = (UINT16) (CapacityInSectors & 0xffff);
+ ReadInfo->Raw[59] = (UINT16)(ReadInfo->Raw[47] + 0x100);
+ CapacityInSectors = (UINT32)((UINT32)(NumberCylinders) * (UINT32)(NumberHeads) * (UINT32)(NumberSectorsTrack));
+ ReadInfo->Raw[57] = (UINT16)(CapacityInSectors >> 16);
+ ReadInfo->Raw[58] = (UINT16)(CapacityInSectors & 0xffff);
if (Status == EFI_SUCCESS) {
//
// Forece checksum byte to 0 and get new checksum.
@@ -441,8 +452,8 @@ UpdateIdentifyDriveData (
//
// Force new checksum such that sum is 0.
//
- FinalChecksum = (UINT8) ((UINT8)0 - FinalChecksum);
- ReadInfo->Raw[255] = (UINT16) (ReadInfo->Raw[255] | (FinalChecksum << 8));
+ FinalChecksum = (UINT8)((UINT8)0 - FinalChecksum);
+ ReadInfo->Raw[255] = (UINT16)(ReadInfo->Raw[255] | (FinalChecksum << 8));
}
}
}
@@ -457,7 +468,7 @@ UpdateIdentifyDriveData (
**/
VOID
UpdateAllIdentifyDriveData (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
UINTN Index;
@@ -470,11 +481,11 @@ UpdateAllIdentifyDriveData (
// Each controller can have 2 devices. Update for each device
//
if ((HddInfo[Index].Status & HDD_MASTER_IDE) != 0) {
- UpdateIdentifyDriveData ((UINT8 *) (&HddInfo[Index].IdentifyDrive[0].Raw[0]));
+ UpdateIdentifyDriveData ((UINT8 *)(&HddInfo[Index].IdentifyDrive[0].Raw[0]));
}
if ((HddInfo[Index].Status & HDD_SLAVE_IDE) != 0) {
- UpdateIdentifyDriveData ((UINT8 *) (&HddInfo[Index].IdentifyDrive[1].Raw[0]));
+ UpdateIdentifyDriveData ((UINT8 *)(&HddInfo[Index].IdentifyDrive[1].Raw[0]));
}
}
}
@@ -489,15 +500,15 @@ UpdateAllIdentifyDriveData (
**/
VOID
EnableIdeController (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_STATUS Status;
- EFI_HANDLE IdeController;
- UINT8 ByteBuffer;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_STATUS Status;
+ EFI_HANDLE IdeController;
+ UINT8 ByteBuffer;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
Status = Private->LegacyBiosPlatform->GetPlatformHandle (
Private->LegacyBiosPlatform,
@@ -509,11 +520,11 @@ EnableIdeController (
);
if (!EFI_ERROR (Status)) {
IdeController = HandleBuffer[0];
- Status = gBS->HandleProtocol (
- IdeController,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
- );
+ Status = gBS->HandleProtocol (
+ IdeController,
+ &gEfiPciIoProtocolGuid,
+ (VOID **)&PciIo
+ );
ByteBuffer = 0x1f;
if (!EFI_ERROR (Status)) {
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x04, 1, &ByteBuffer);
@@ -521,7 +532,6 @@ EnableIdeController (
}
}
-
/**
Enable ide controller. This gets disabled when LegacyBoot.c is about
to run the Option ROMs.
@@ -532,15 +542,15 @@ EnableIdeController (
**/
VOID
EnableAllControllers (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE01 PciConfigHeader;
- EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE01 PciConfigHeader;
+ EFI_STATUS Status;
//
//
@@ -563,17 +573,17 @@ EnableAllControllers (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
ASSERT_EFI_ERROR (Status);
PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint32,
- 0,
- sizeof (PciConfigHeader) / sizeof (UINT32),
- &PciConfigHeader
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ 0,
+ sizeof (PciConfigHeader) / sizeof (UINT32),
+ &PciConfigHeader
+ );
//
// We do not enable PPB here. This is for HotPlug Consideration.
@@ -600,8 +610,8 @@ EnableAllControllers (
IS_PCI_IDE (&PciConfigHeader) ||
IS_PCI_P2P (&PciConfigHeader) ||
IS_PCI_P2P_SUB (&PciConfigHeader) ||
- IS_PCI_LPC (&PciConfigHeader) )) {
-
+ IS_PCI_LPC (&PciConfigHeader)))
+ {
PciConfigHeader.Hdr.Command |= 0x1f;
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 4, 1, &PciConfigHeader.Hdr.Command);
@@ -627,52 +637,52 @@ EnableAllControllers (
**/
EFI_STATUS
LegacyGetDataOrTable (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN EFI_GET_PLATFORM_INFO_MODE Id
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN EFI_GET_PLATFORM_INFO_MODE Id
)
{
- VOID *Table;
- UINT32 TablePtr;
- UINTN TableSize;
- UINTN Alignment;
- UINTN Location;
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
- EFI_COMPATIBILITY16_TABLE *Legacy16Table;
- EFI_IA32_REGISTER_SET Regs;
- LEGACY_BIOS_INSTANCE *Private;
+ VOID *Table;
+ UINT32 TablePtr;
+ UINTN TableSize;
+ UINTN Alignment;
+ UINTN Location;
+ EFI_STATUS Status;
+ EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
+ EFI_COMPATIBILITY16_TABLE *Legacy16Table;
+ EFI_IA32_REGISTER_SET Regs;
+ LEGACY_BIOS_INSTANCE *Private;
- Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
+ Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
- LegacyBiosPlatform = Private->LegacyBiosPlatform;
- Legacy16Table = Private->Legacy16Table;
+ LegacyBiosPlatform = Private->LegacyBiosPlatform;
+ Legacy16Table = Private->Legacy16Table;
//
// Phase 1 - get an address allocated in 16-bit code
//
while (TRUE) {
switch (Id) {
- case EfiGetPlatformBinaryMpTable:
- case EfiGetPlatformBinaryOemIntData:
- case EfiGetPlatformBinaryOem32Data:
- case EfiGetPlatformBinaryOem16Data:
+ case EfiGetPlatformBinaryMpTable:
+ case EfiGetPlatformBinaryOemIntData:
+ case EfiGetPlatformBinaryOem32Data:
+ case EfiGetPlatformBinaryOem16Data:
{
Status = LegacyBiosPlatform->GetPlatformInfo (
- LegacyBiosPlatform,
- Id,
- (VOID *) &Table,
- &TableSize,
- &Location,
- &Alignment,
- 0,
- 0
- );
+ LegacyBiosPlatform,
+ Id,
+ (VOID *)&Table,
+ &TableSize,
+ &Location,
+ &Alignment,
+ 0,
+ 0
+ );
DEBUG ((DEBUG_INFO, "LegacyGetDataOrTable - ID: %x, %r\n", (UINTN)Id, Status));
DEBUG ((DEBUG_INFO, " Table - %x, Size - %x, Location - %x, Alignment - %x\n", (UINTN)Table, (UINTN)TableSize, (UINTN)Location, (UINTN)Alignment));
break;
}
- default:
+ default:
{
return EFI_INVALID_PARAMETER;
}
@@ -684,17 +694,17 @@ LegacyGetDataOrTable (
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16GetTableAddress;
- Regs.X.CX = (UINT16) TableSize;
- Regs.X.BX = (UINT16) Location;
- Regs.X.DX = (UINT16) Alignment;
+ Regs.X.CX = (UINT16)TableSize;
+ Regs.X.BX = (UINT16)Location;
+ Regs.X.DX = (UINT16)Alignment;
Private->LegacyBios.FarCall86 (
- This,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ This,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
if (Regs.X.AX != 0) {
DEBUG ((DEBUG_ERROR, "Table ID %x length insufficient\n", Id));
@@ -703,38 +713,38 @@ LegacyGetDataOrTable (
break;
}
}
+
//
// Phase 2 Call routine second time with address to allow address adjustment
//
Status = LegacyBiosPlatform->GetPlatformInfo (
- LegacyBiosPlatform,
- Id,
- (VOID *) &Table,
- &TableSize,
- &Location,
- &Alignment,
- Regs.X.DS,
- Regs.X.BX
- );
+ LegacyBiosPlatform,
+ Id,
+ (VOID *)&Table,
+ &TableSize,
+ &Location,
+ &Alignment,
+ Regs.X.DS,
+ Regs.X.BX
+ );
switch (Id) {
- case EfiGetPlatformBinaryMpTable:
+ case EfiGetPlatformBinaryMpTable:
{
- Legacy16Table->MpTablePtr = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
- Legacy16Table->MpTableLength = (UINT32)TableSize;
+ Legacy16Table->MpTablePtr = (UINT32)(Regs.X.DS * 16 + Regs.X.BX);
+ Legacy16Table->MpTableLength = (UINT32)TableSize;
DEBUG ((DEBUG_INFO, "MP table in legacy region - %x\n", (UINTN)Legacy16Table->MpTablePtr));
break;
}
- case EfiGetPlatformBinaryOemIntData:
+ case EfiGetPlatformBinaryOemIntData:
{
-
- Legacy16Table->OemIntSegment = Regs.X.DS;
- Legacy16Table->OemIntOffset = Regs.X.BX;
+ Legacy16Table->OemIntSegment = Regs.X.DS;
+ Legacy16Table->OemIntOffset = Regs.X.BX;
DEBUG ((DEBUG_INFO, "OemInt table in legacy region - %04x:%04x\n", (UINTN)Legacy16Table->OemIntSegment, (UINTN)Legacy16Table->OemIntOffset));
break;
}
- case EfiGetPlatformBinaryOem32Data:
+ case EfiGetPlatformBinaryOem32Data:
{
Legacy16Table->Oem32Segment = Regs.X.DS;
Legacy16Table->Oem32Offset = Regs.X.BX;
@@ -742,7 +752,7 @@ LegacyGetDataOrTable (
break;
}
- case EfiGetPlatformBinaryOem16Data:
+ case EfiGetPlatformBinaryOem16Data:
{
//
// Legacy16Table->Oem16Segment = Regs.X.DS;
@@ -751,7 +761,7 @@ LegacyGetDataOrTable (
break;
}
- default:
+ default:
{
return EFI_INVALID_PARAMETER;
}
@@ -760,13 +770,14 @@ LegacyGetDataOrTable (
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Phase 3 Copy table to final location
//
- TablePtr = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
+ TablePtr = (UINT32)(Regs.X.DS * 16 + Regs.X.BX);
CopyMem (
- (VOID *) (UINTN)TablePtr,
+ (VOID *)(UINTN)TablePtr,
Table,
TableSize
);
@@ -783,53 +794,54 @@ CreateSmbiosTableInReservedMemory (
VOID
)
{
- SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
+ SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
if ((mRuntimeSmbiosEntryPoint == NULL) ||
(mReserveSmbiosEntryPoint == 0) ||
- (mStructureTableAddress == 0)) {
+ (mStructureTableAddress == 0))
+ {
return;
}
- EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) mRuntimeSmbiosEntryPoint;
+ EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)mRuntimeSmbiosEntryPoint;
//
// Copy SMBIOS Entry Point Structure
//
CopyMem (
- (VOID *)(UINTN) mReserveSmbiosEntryPoint,
+ (VOID *)(UINTN)mReserveSmbiosEntryPoint,
EntryPointStructure,
EntryPointStructure->EntryPointLength
- );
+ );
//
// Copy SMBIOS Structure Table into EfiReservedMemoryType memory
//
CopyMem (
- (VOID *)(UINTN) mStructureTableAddress,
- (VOID *)(UINTN) EntryPointStructure->TableAddress,
+ (VOID *)(UINTN)mStructureTableAddress,
+ (VOID *)(UINTN)EntryPointStructure->TableAddress,
EntryPointStructure->TableLength
- );
+ );
//
// Update TableAddress in Entry Point Structure
//
- EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)(UINTN) mReserveSmbiosEntryPoint;
- EntryPointStructure->TableAddress = (UINT32)(UINTN) mStructureTableAddress;
+ EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)(UINTN)mReserveSmbiosEntryPoint;
+ EntryPointStructure->TableAddress = (UINT32)(UINTN)mStructureTableAddress;
//
// Fixup checksums in the Entry Point Structure
//
- EntryPointStructure->IntermediateChecksum = 0;
+ EntryPointStructure->IntermediateChecksum = 0;
EntryPointStructure->EntryPointStructureChecksum = 0;
EntryPointStructure->IntermediateChecksum =
CalculateCheckSum8 (
- (UINT8 *) EntryPointStructure + OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString),
+ (UINT8 *)EntryPointStructure + OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString),
EntryPointStructure->EntryPointLength - OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString)
);
EntryPointStructure->EntryPointStructureChecksum =
- CalculateCheckSum8 ((UINT8 *) EntryPointStructure, EntryPointStructure->EntryPointLength);
+ CalculateCheckSum8 ((UINT8 *)EntryPointStructure, EntryPointStructure->EntryPointLength);
}
/**
@@ -845,47 +857,47 @@ CreateSmbiosTableInReservedMemory (
**/
EFI_STATUS
GenericLegacyBoot (
- IN EFI_LEGACY_BIOS_PROTOCOL *This
+ IN EFI_LEGACY_BIOS_PROTOCOL *This
)
{
- EFI_STATUS Status;
- LEGACY_BIOS_INSTANCE *Private;
- EFI_IA32_REGISTER_SET Regs;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
- EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
- UINTN CopySize;
- VOID *AcpiPtr;
- HDD_INFO *HddInfo;
- HDD_INFO *LocalHddInfo;
- UINTN Index;
- EFI_COMPATIBILITY16_TABLE *Legacy16Table;
- UINT32 *BdaPtr;
- UINT16 HddCount;
- UINT16 BbsCount;
- BBS_TABLE *LocalBbsTable;
- UINT32 *BaseVectorMaster;
- EFI_TIME BootTime;
- UINT32 LocalTime;
- EFI_HANDLE IdeController;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- VOID *AcpiTable;
- UINTN ShadowAddress;
- UINT32 Granularity;
+ EFI_STATUS Status;
+ LEGACY_BIOS_INSTANCE *Private;
+ EFI_IA32_REGISTER_SET Regs;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
+ EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
+ UINTN CopySize;
+ VOID *AcpiPtr;
+ HDD_INFO *HddInfo;
+ HDD_INFO *LocalHddInfo;
+ UINTN Index;
+ EFI_COMPATIBILITY16_TABLE *Legacy16Table;
+ UINT32 *BdaPtr;
+ UINT16 HddCount;
+ UINT16 BbsCount;
+ BBS_TABLE *LocalBbsTable;
+ UINT32 *BaseVectorMaster;
+ EFI_TIME BootTime;
+ UINT32 LocalTime;
+ EFI_HANDLE IdeController;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ VOID *AcpiTable;
+ UINTN ShadowAddress;
+ UINT32 Granularity;
LocalHddInfo = NULL;
HddCount = 0;
BbsCount = 0;
LocalBbsTable = NULL;
- Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
+ Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
DEBUG_CODE (
DEBUG ((DEBUG_ERROR, "Start of legacy boot\n"));
- );
+ );
- Legacy16Table = Private->Legacy16Table;
- EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
- HddInfo = &EfiToLegacy16BootTable->HddInfo[0];
+ Legacy16Table = Private->Legacy16Table;
+ EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
+ HddInfo = &EfiToLegacy16BootTable->HddInfo[0];
LegacyBiosPlatform = Private->LegacyBiosPlatform;
@@ -900,17 +912,18 @@ GenericLegacyBoot (
IdeController = NULL;
if ((mBootMode == BOOT_LEGACY_OS) || (mBootMode == BOOT_UNCONVENTIONAL_DEVICE)) {
Status = LegacyBiosPlatform->GetPlatformHandle (
- Private->LegacyBiosPlatform,
- EfiGetPlatformIdeHandle,
- 0,
- &HandleBuffer,
- &HandleCount,
- NULL
- );
+ Private->LegacyBiosPlatform,
+ EfiGetPlatformIdeHandle,
+ 0,
+ &HandleBuffer,
+ &HandleCount,
+ NULL
+ );
if (!EFI_ERROR (Status)) {
IdeController = HandleBuffer[0];
}
}
+
//
// Unlock the Legacy BIOS region
//
@@ -928,37 +941,37 @@ GenericLegacyBoot (
if (CopySize > Private->Legacy16Table->E820Length) {
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16GetTableAddress;
- Regs.X.BX = (UINT16) 0x0; // Any region
- Regs.X.CX = (UINT16) CopySize;
- Regs.X.DX = (UINT16) 0x4; // Alignment
+ Regs.X.BX = (UINT16)0x0; // Any region
+ Regs.X.CX = (UINT16)CopySize;
+ Regs.X.DX = (UINT16)0x4; // Alignment
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Private->Legacy16Table->Compatibility16CallSegment,
- Private->Legacy16Table->Compatibility16CallOffset,
- &Regs,
- NULL,
- 0
- );
-
- Private->Legacy16Table->E820Pointer = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
- Private->Legacy16Table->E820Length = (UINT32) CopySize;
+ &Private->LegacyBios,
+ Private->Legacy16Table->Compatibility16CallSegment,
+ Private->Legacy16Table->Compatibility16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
+
+ Private->Legacy16Table->E820Pointer = (UINT32)(Regs.X.DS * 16 + Regs.X.BX);
+ Private->Legacy16Table->E820Length = (UINT32)CopySize;
if (Regs.X.AX != 0) {
DEBUG ((DEBUG_ERROR, "Legacy16 E820 length insufficient\n"));
return EFI_OUT_OF_RESOURCES;
} else {
CopyMem (
- (VOID *)(UINTN) Private->Legacy16Table->E820Pointer,
+ (VOID *)(UINTN)Private->Legacy16Table->E820Pointer,
Private->E820Table,
CopySize
);
}
} else {
CopyMem (
- (VOID *)(UINTN) Private->Legacy16Table->E820Pointer,
+ (VOID *)(UINTN)Private->Legacy16Table->E820Pointer,
Private->E820Table,
CopySize
);
- Private->Legacy16Table->E820Length = (UINT32) CopySize;
+ Private->Legacy16Table->E820Length = (UINT32)CopySize;
}
//
@@ -967,26 +980,29 @@ GenericLegacyBoot (
if (mReserveSmbiosEntryPoint == 0) {
DEBUG ((DEBUG_INFO, "Smbios table is not found!\n"));
}
+
CreateSmbiosTableInReservedMemory ();
EfiToLegacy16BootTable->SmbiosTable = (UINT32)(UINTN)mReserveSmbiosEntryPoint;
AcpiTable = NULL;
- Status = EfiGetSystemConfigurationTable (
- &gEfiAcpi20TableGuid,
- &AcpiTable
- );
+ Status = EfiGetSystemConfigurationTable (
+ &gEfiAcpi20TableGuid,
+ &AcpiTable
+ );
if (EFI_ERROR (Status)) {
Status = EfiGetSystemConfigurationTable (
&gEfiAcpi10TableGuid,
&AcpiTable
);
}
+
//
// We do not ASSERT if AcpiTable not found. It is possible that a platform does not produce AcpiTable.
//
if (AcpiTable == NULL) {
DEBUG ((DEBUG_INFO, "ACPI table is not found!\n"));
}
+
EfiToLegacy16BootTable->AcpiTable = (UINT32)(UINTN)AcpiTable;
//
@@ -995,21 +1011,21 @@ GenericLegacyBoot (
// Rev != 0 Length is UINT32 at offset 20 decimal
//
if (AcpiTable != NULL) {
-
AcpiPtr = AcpiTable;
- if (*((UINT8 *) AcpiPtr + 15) == 0) {
+ if (*((UINT8 *)AcpiPtr + 15) == 0) {
CopySize = 20;
} else {
- AcpiPtr = ((UINT8 *) AcpiPtr + 20);
- CopySize = (*(UINT32 *) AcpiPtr);
+ AcpiPtr = ((UINT8 *)AcpiPtr + 20);
+ CopySize = (*(UINT32 *)AcpiPtr);
}
CopyMem (
- (VOID *)(UINTN) Private->Legacy16Table->AcpiRsdPtrPointer,
+ (VOID *)(UINTN)Private->Legacy16Table->AcpiRsdPtrPointer,
AcpiTable,
CopySize
);
}
+
//
// Make sure all PCI Interrupt Line register are programmed to match 8259
//
@@ -1034,12 +1050,13 @@ GenericLegacyBoot (
if ((mBootMode == BOOT_LEGACY_OS) || (mBootMode == BOOT_UNCONVENTIONAL_DEVICE)) {
UpdateSioData (Private);
}
+
//
// Setup BDA and EBDA standard areas before Legacy Boot
//
ACCESS_PAGE0_CODE (
LegacyBiosCompleteBdaBeforeBoot (Private);
- );
+ );
LegacyBiosCompleteStandardCmosBeforeBoot (Private);
//
@@ -1063,7 +1080,7 @@ GenericLegacyBoot (
// Adjust value by 1 second.
//
gRT->GetTime (&BootTime, NULL);
- LocalTime = BootTime.Hour * 3600 + BootTime.Minute * 60 + BootTime.Second;
+ LocalTime = BootTime.Hour * 3600 + BootTime.Minute * 60 + BootTime.Second;
LocalTime += 1;
//
@@ -1072,9 +1089,9 @@ GenericLegacyBoot (
//
LocalTime = (LocalTime * 182) / 10;
ACCESS_PAGE0_CODE (
- BdaPtr = (UINT32 *) (UINTN)0x46C;
- *BdaPtr = LocalTime;
- );
+ BdaPtr = (UINT32 *)(UINTN)0x46C;
+ *BdaPtr = LocalTime;
+ );
//
// Shadow PCI ROMs. We must do this near the end since this will kick
@@ -1130,13 +1147,15 @@ GenericLegacyBoot (
for (Index = 0; Index < MAX_IDE_CONTROLLER; Index++) {
if ((LocalHddInfo[Index].IdentifyDrive[0].Raw[0] != 0) &&
(LocalBbsTable[2 * Index + 1].BootPriority == BBS_IGNORE_ENTRY)
- ) {
+ )
+ {
LocalBbsTable[2 * Index + 1].BootPriority = BBS_UNPRIORITIZED_ENTRY;
}
if ((LocalHddInfo[Index].IdentifyDrive[1].Raw[0] != 0) &&
(LocalBbsTable[2 * Index + 2].BootPriority == BBS_IGNORE_ENTRY)
- ) {
+ )
+ {
LocalBbsTable[2 * Index + 2].BootPriority = BBS_UNPRIORITIZED_ENTRY;
}
}
@@ -1154,24 +1173,27 @@ GenericLegacyBoot (
mBbsTable,
mLoadOptionsSize,
mLoadOptions,
- (VOID *) &Private->IntThunk->EfiToLegacy16BootTable
+ (VOID *)&Private->IntThunk->EfiToLegacy16BootTable
);
//
// If no boot device return to BDS
//
if ((mBootMode == BOOT_LEGACY_OS) || (mBootMode == BOOT_UNCONVENTIONAL_DEVICE)) {
- for (Index = 0; Index < BbsCount; Index++){
+ for (Index = 0; Index < BbsCount; Index++) {
if ((LocalBbsTable[Index].BootPriority != BBS_DO_NOT_BOOT_FROM) &&
(LocalBbsTable[Index].BootPriority != BBS_UNPRIORITIZED_ENTRY) &&
- (LocalBbsTable[Index].BootPriority != BBS_IGNORE_ENTRY)) {
+ (LocalBbsTable[Index].BootPriority != BBS_IGNORE_ENTRY))
+ {
break;
}
}
+
if (Index == BbsCount) {
return EFI_DEVICE_ERROR;
}
}
+
//
// Let the Legacy16 code know the device path type for legacy boot
//
@@ -1218,17 +1240,18 @@ GenericLegacyBoot (
Regs.X.BX = NORMALIZE_EFI_OFFSET ((UINTN)EfiToLegacy16BootTable);
Private->LegacyBios.FarCall86 (
- This,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ This,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
if (Regs.X.AX != 0) {
return EFI_DEVICE_ERROR;
}
+
//
// Lock the Legacy BIOS region
//
@@ -1240,13 +1263,18 @@ GenericLegacyBoot (
);
if ((Private->Legacy16Table->TableLength >= OFFSET_OF (EFI_COMPATIBILITY16_TABLE, HiPermanentMemoryAddress)) &&
- ((Private->Legacy16Table->UmaAddress != 0) && (Private->Legacy16Table->UmaSize != 0))) {
+ ((Private->Legacy16Table->UmaAddress != 0) && (Private->Legacy16Table->UmaSize != 0)))
+ {
//
// Here we could reduce UmaAddress down as far as Private->OptionRom, taking into
// account the granularity of the access control.
//
- DEBUG((DEBUG_INFO, "Unlocking UMB RAM region 0x%x-0x%x\n", Private->Legacy16Table->UmaAddress,
- Private->Legacy16Table->UmaAddress + Private->Legacy16Table->UmaSize));
+ DEBUG ((
+ DEBUG_INFO,
+ "Unlocking UMB RAM region 0x%x-0x%x\n",
+ Private->Legacy16Table->UmaAddress,
+ Private->Legacy16Table->UmaAddress + Private->Legacy16Table->UmaSize
+ ));
Private->LegacyRegion->UnLock (
Private->LegacyRegion,
@@ -1271,7 +1299,6 @@ GenericLegacyBoot (
//
EnableAllControllers (Private);
if ((mBootMode == BOOT_LEGACY_OS) || (mBootMode == BOOT_UNCONVENTIONAL_DEVICE)) {
-
//
// Signal all the events that are waiting on EVT_SIGNAL_LEGACY_BOOT
//
@@ -1297,7 +1324,6 @@ GenericLegacyBoot (
//
SaveAndSetDebugTimerInterrupt (FALSE);
-
//
// Put the 8259 into its legacy mode by reprogramming the vector bases
//
@@ -1321,34 +1347,37 @@ GenericLegacyBoot (
//
//
ACCESS_PAGE0_CODE (
- BaseVectorMaster = (UINT32 *) (sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);
+ BaseVectorMaster = (UINT32 *)(sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);
for (Index = 0; Index < 8; Index++) {
- Private->ThunkSavedInt[Index] = BaseVectorMaster[Index];
- if (Private->ThunkSeg == (UINT16) (BaseVectorMaster[Index] >> 16)) {
- BaseVectorMaster[Index] = (UINT32) (Private->BiosUnexpectedInt);
- }
+ Private->ThunkSavedInt[Index] = BaseVectorMaster[Index];
+ if (Private->ThunkSeg == (UINT16)(BaseVectorMaster[Index] >> 16)) {
+ BaseVectorMaster[Index] = (UINT32)(Private->BiosUnexpectedInt);
}
- );
+ }
+
+ );
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16Boot;
Private->LegacyBios.FarCall86 (
- This,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ This,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
ACCESS_PAGE0_CODE (
- BaseVectorMaster = (UINT32 *) (sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);
+ BaseVectorMaster = (UINT32 *)(sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);
for (Index = 0; Index < 8; Index++) {
- BaseVectorMaster[Index] = Private->ThunkSavedInt[Index];
- }
- );
+ BaseVectorMaster[Index] = Private->ThunkSavedInt[Index];
+ }
+
+ );
}
+
Private->LegacyBootEntered = TRUE;
if ((mBootMode == BOOT_LEGACY_OS) || (mBootMode == BOOT_UNCONVENTIONAL_DEVICE)) {
//
@@ -1364,7 +1393,6 @@ GenericLegacyBoot (
}
}
-
/**
Assign drive number to legacy HDD drives prior to booting an EFI
aware OS so the OS can access drives without an EFI driver.
@@ -1381,22 +1409,22 @@ GenericLegacyBoot (
EFI_STATUS
EFIAPI
LegacyBiosPrepareToBootEfi (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- OUT UINT16 *BbsCount,
- OUT BBS_TABLE **BbsTable
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ OUT UINT16 *BbsCount,
+ OUT BBS_TABLE **BbsTable
)
{
- EFI_STATUS Status;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
- LEGACY_BIOS_INSTANCE *Private;
-
- Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
- EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
- mBootMode = BOOT_EFI_OS;
- mBbsDevicePathPtr = NULL;
- Status = GenericLegacyBoot (This);
- *BbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
- *BbsCount = (UINT16) (sizeof (Private->IntThunk->BbsTable) / sizeof (BBS_TABLE));
+ EFI_STATUS Status;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
+ LEGACY_BIOS_INSTANCE *Private;
+
+ Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
+ EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
+ mBootMode = BOOT_EFI_OS;
+ mBbsDevicePathPtr = NULL;
+ Status = GenericLegacyBoot (This);
+ *BbsTable = (BBS_TABLE *)(UINTN)EfiToLegacy16BootTable->BbsTable;
+ *BbsCount = (UINT16)(sizeof (Private->IntThunk->BbsTable) / sizeof (BBS_TABLE));
return Status;
}
@@ -1418,28 +1446,28 @@ LegacyBiosPrepareToBootEfi (
EFI_STATUS
EFIAPI
LegacyBiosBootUnconventionalDevice (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UDC_ATTRIBUTES Attributes,
- IN UINTN BbsEntry,
- IN VOID *BeerData,
- IN VOID *ServiceAreaData
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UDC_ATTRIBUTES Attributes,
+ IN UINTN BbsEntry,
+ IN VOID *BeerData,
+ IN VOID *ServiceAreaData
)
{
- EFI_STATUS Status;
- EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
- LEGACY_BIOS_INSTANCE *Private;
- UD_TABLE *UcdTable;
- UINTN Index;
- UINT16 BootPriority;
- BBS_TABLE *BbsTable;
-
- BootPriority = 0;
- Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
- mBootMode = BOOT_UNCONVENTIONAL_DEVICE;
+ EFI_STATUS Status;
+ EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
+ LEGACY_BIOS_INSTANCE *Private;
+ UD_TABLE *UcdTable;
+ UINTN Index;
+ UINT16 BootPriority;
+ BBS_TABLE *BbsTable;
+
+ BootPriority = 0;
+ Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
+ mBootMode = BOOT_UNCONVENTIONAL_DEVICE;
mBbsDevicePathPtr = &mBbsDevicePathNode;
- mAttributes = Attributes;
- mBbsEntry = BbsEntry;
- mBeerData = BeerData, mServiceAreaData = ServiceAreaData;
+ mAttributes = Attributes;
+ mBbsEntry = BbsEntry;
+ mBeerData = BeerData, mServiceAreaData = ServiceAreaData;
EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
@@ -1449,58 +1477,62 @@ LegacyBiosBootUnconventionalDevice (
if ((Attributes.DirectoryServiceValidity == 0) &&
(Attributes.RabcaUsedFlag == 0) &&
(Attributes.ExecuteHddDiagnosticsFlag == 0)
- ) {
+ )
+ {
return EFI_INVALID_PARAMETER;
}
if (((Attributes.DirectoryServiceValidity != 0) && (ServiceAreaData == NULL)) ||
(((Attributes.DirectoryServiceValidity | Attributes.RabcaUsedFlag) != 0) && (BeerData == NULL))
- ) {
+ )
+ {
return EFI_INVALID_PARAMETER;
}
- UcdTable = (UD_TABLE *) AllocatePool (
- sizeof (UD_TABLE)
- );
+ UcdTable = (UD_TABLE *)AllocatePool (
+ sizeof (UD_TABLE)
+ );
if (NULL == UcdTable) {
return EFI_OUT_OF_RESOURCES;
}
EfiToLegacy16BootTable->UnconventionalDeviceTable = (UINT32)(UINTN)UcdTable;
- UcdTable->Attributes = Attributes;
- UcdTable->BbsTableEntryNumberForParentDevice = (UINT8) BbsEntry;
+ UcdTable->Attributes = Attributes;
+ UcdTable->BbsTableEntryNumberForParentDevice = (UINT8)BbsEntry;
//
// Force all existing BBS entries to DoNotBoot. This allows 16-bit CSM
// to assign drive numbers but bot boot from. Only newly created entries
// will be valid.
//
- BbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
+ BbsTable = (BBS_TABLE *)(UINTN)EfiToLegacy16BootTable->BbsTable;
for (Index = 0; Index < EfiToLegacy16BootTable->NumberBbsEntries; Index++) {
BbsTable[Index].BootPriority = BBS_DO_NOT_BOOT_FROM;
}
+
//
// If parent is onboard IDE then assign controller & device number
// else they are 0.
//
if (BbsEntry < MAX_IDE_CONTROLLER * 2) {
- UcdTable->DeviceNumber = (UINT8) ((BbsEntry - 1) % 2);
+ UcdTable->DeviceNumber = (UINT8)((BbsEntry - 1) % 2);
}
if (BeerData != NULL) {
CopyMem (
- (VOID *) UcdTable->BeerData,
+ (VOID *)UcdTable->BeerData,
BeerData,
- (UINTN) 128
+ (UINTN)128
);
}
if (ServiceAreaData != NULL) {
CopyMem (
- (VOID *) UcdTable->ServiceAreaData,
+ (VOID *)UcdTable->ServiceAreaData,
ServiceAreaData,
- (UINTN) 64
+ (UINTN)64
);
}
+
//
// For each new entry do the following:
// 1. Increment current number of BBS entries
@@ -1514,8 +1546,8 @@ LegacyBiosBootUnconventionalDevice (
EfiToLegacy16BootTable->NumberBbsEntries += 1;
CopyMem (
- (VOID *) &BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority,
- (VOID *) &BbsTable[BbsEntry].BootPriority,
+ (VOID *)&BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority,
+ (VOID *)&BbsTable[BbsEntry].BootPriority,
sizeof (BBS_TABLE)
);
@@ -1523,10 +1555,10 @@ LegacyBiosBootUnconventionalDevice (
BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootHandlerSegment = 0;
BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].DeviceType = 0x80;
- UcdTable->BbsTableEntryNumberForHddDiag = (UINT8) (EfiToLegacy16BootTable->NumberBbsEntries - 1);
+ UcdTable->BbsTableEntryNumberForHddDiag = (UINT8)(EfiToLegacy16BootTable->NumberBbsEntries - 1);
BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority = BootPriority;
- BootPriority += 1;
+ BootPriority += 1;
//
// Set device type as BBS_TYPE_DEV for PARTIES diagnostic
@@ -1537,22 +1569,23 @@ LegacyBiosBootUnconventionalDevice (
if (((Attributes.DirectoryServiceValidity | Attributes.RabcaUsedFlag)) != 0) {
EfiToLegacy16BootTable->NumberBbsEntries += 1;
CopyMem (
- (VOID *) &BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority,
- (VOID *) &BbsTable[BbsEntry].BootPriority,
+ (VOID *)&BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority,
+ (VOID *)&BbsTable[BbsEntry].BootPriority,
sizeof (BBS_TABLE)
);
BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootHandlerOffset = 0;
BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootHandlerSegment = 0;
BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].DeviceType = 0x01;
- UcdTable->BbsTableEntryNumberForBoot = (UINT8) (EfiToLegacy16BootTable->NumberBbsEntries - 1);
- BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority = BootPriority;
+ UcdTable->BbsTableEntryNumberForBoot = (UINT8)(EfiToLegacy16BootTable->NumberBbsEntries - 1);
+ BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority = BootPriority;
//
// Set device type as BBS_TYPE_FLOPPY for PARTIES boot as floppy
//
mBbsDevicePathNode.DeviceType = BBS_TYPE_FLOPPY;
}
+
//
// Build the BBS Device Path for this boot selection
//
@@ -1562,7 +1595,7 @@ LegacyBiosBootUnconventionalDevice (
mBbsDevicePathNode.StatusFlag = 0;
mBbsDevicePathNode.String[0] = 0;
- Status = GenericLegacyBoot (This);
+ Status = GenericLegacyBoot (This);
return Status;
}
@@ -1581,10 +1614,10 @@ LegacyBiosBootUnconventionalDevice (
EFI_STATUS
EFIAPI
LegacyBiosLegacyBoot (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
- IN UINT32 LoadOptionsSize,
- IN VOID *LoadOptions
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
+ IN UINT32 LoadOptionsSize,
+ IN VOID *LoadOptions
)
{
EFI_STATUS Status;
@@ -1608,46 +1641,46 @@ LegacyBiosLegacyBoot (
**/
EFI_ACPI_MEMORY_TYPE
EfiMemoryTypeToE820Type (
- IN UINT32 Type
+ IN UINT32 Type
)
{
switch (Type) {
- case EfiLoaderCode:
- case EfiLoaderData:
- case EfiBootServicesCode:
- case EfiBootServicesData:
- case EfiConventionalMemory:
- //
- // The memory of EfiRuntimeServicesCode and EfiRuntimeServicesData are
- // usable memory for legacy OS, because legacy OS is not aware of EFI runtime concept.
- // In ACPI specification, EfiRuntimeServiceCode and EfiRuntimeServiceData
- // should be mapped to AddressRangeReserved. This statement is for UEFI OS, not for legacy OS.
- //
- case EfiRuntimeServicesCode:
- case EfiRuntimeServicesData:
- return EfiAcpiAddressRangeMemory;
+ case EfiLoaderCode:
+ case EfiLoaderData:
+ case EfiBootServicesCode:
+ case EfiBootServicesData:
+ case EfiConventionalMemory:
+ //
+ // The memory of EfiRuntimeServicesCode and EfiRuntimeServicesData are
+ // usable memory for legacy OS, because legacy OS is not aware of EFI runtime concept.
+ // In ACPI specification, EfiRuntimeServiceCode and EfiRuntimeServiceData
+ // should be mapped to AddressRangeReserved. This statement is for UEFI OS, not for legacy OS.
+ //
+ case EfiRuntimeServicesCode:
+ case EfiRuntimeServicesData:
+ return EfiAcpiAddressRangeMemory;
- case EfiPersistentMemory:
- return EfiAddressRangePersistentMemory;
+ case EfiPersistentMemory:
+ return EfiAddressRangePersistentMemory;
- case EfiACPIReclaimMemory:
- return EfiAcpiAddressRangeACPI;
+ case EfiACPIReclaimMemory:
+ return EfiAcpiAddressRangeACPI;
- case EfiACPIMemoryNVS:
- return EfiAcpiAddressRangeNVS;
+ case EfiACPIMemoryNVS:
+ return EfiAcpiAddressRangeNVS;
- //
- // All other types map to reserved.
- // Adding the code just waists FLASH space.
- //
- // case EfiReservedMemoryType:
- // case EfiUnusableMemory:
- // case EfiMemoryMappedIO:
- // case EfiMemoryMappedIOPortSpace:
- // case EfiPalCode:
- //
- default:
- return EfiAcpiAddressRangeReserved;
+ //
+ // All other types map to reserved.
+ // Adding the code just waists FLASH space.
+ //
+ // case EfiReservedMemoryType:
+ // case EfiUnusableMemory:
+ // case EfiMemoryMappedIO:
+ // case EfiMemoryMappedIOPortSpace:
+ // case EfiPalCode:
+ //
+ default:
+ return EfiAcpiAddressRangeReserved;
}
}
@@ -1662,47 +1695,47 @@ EfiMemoryTypeToE820Type (
**/
EFI_STATUS
LegacyBiosBuildE820 (
- IN LEGACY_BIOS_INSTANCE *Private,
- OUT UINTN *Size
+ IN LEGACY_BIOS_INSTANCE *Private,
+ OUT UINTN *Size
)
{
- EFI_STATUS Status;
- EFI_E820_ENTRY64 *E820Table;
- EFI_MEMORY_DESCRIPTOR *EfiMemoryMap;
- EFI_MEMORY_DESCRIPTOR *EfiMemoryMapEnd;
- EFI_MEMORY_DESCRIPTOR *EfiEntry;
- EFI_MEMORY_DESCRIPTOR *NextEfiEntry;
- EFI_MEMORY_DESCRIPTOR TempEfiEntry;
- UINTN EfiMemoryMapSize;
- UINTN EfiMapKey;
- UINTN EfiDescriptorSize;
- UINT32 EfiDescriptorVersion;
- UINTN Index;
- EFI_PEI_HOB_POINTERS Hob;
- EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob;
- UINTN TempIndex;
- UINTN IndexSort;
- UINTN TempNextIndex;
- EFI_E820_ENTRY64 TempE820;
- EFI_ACPI_MEMORY_TYPE TempType;
- BOOLEAN ChangedFlag;
- UINTN Above1MIndex;
- UINT64 MemoryBlockLength;
-
- E820Table = (EFI_E820_ENTRY64 *) Private->E820Table;
+ EFI_STATUS Status;
+ EFI_E820_ENTRY64 *E820Table;
+ EFI_MEMORY_DESCRIPTOR *EfiMemoryMap;
+ EFI_MEMORY_DESCRIPTOR *EfiMemoryMapEnd;
+ EFI_MEMORY_DESCRIPTOR *EfiEntry;
+ EFI_MEMORY_DESCRIPTOR *NextEfiEntry;
+ EFI_MEMORY_DESCRIPTOR TempEfiEntry;
+ UINTN EfiMemoryMapSize;
+ UINTN EfiMapKey;
+ UINTN EfiDescriptorSize;
+ UINT32 EfiDescriptorVersion;
+ UINTN Index;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob;
+ UINTN TempIndex;
+ UINTN IndexSort;
+ UINTN TempNextIndex;
+ EFI_E820_ENTRY64 TempE820;
+ EFI_ACPI_MEMORY_TYPE TempType;
+ BOOLEAN ChangedFlag;
+ UINTN Above1MIndex;
+ UINT64 MemoryBlockLength;
+
+ E820Table = (EFI_E820_ENTRY64 *)Private->E820Table;
//
// Get the EFI memory map.
//
- EfiMemoryMapSize = 0;
- EfiMemoryMap = NULL;
- Status = gBS->GetMemoryMap (
- &EfiMemoryMapSize,
- EfiMemoryMap,
- &EfiMapKey,
- &EfiDescriptorSize,
- &EfiDescriptorVersion
- );
+ EfiMemoryMapSize = 0;
+ EfiMemoryMap = NULL;
+ Status = gBS->GetMemoryMap (
+ &EfiMemoryMapSize,
+ EfiMemoryMap,
+ &EfiMapKey,
+ &EfiDescriptorSize,
+ &EfiDescriptorVersion
+ );
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
do {
@@ -1712,7 +1745,7 @@ LegacyBiosBuildE820 (
// EfiMemoryMapEnd which is dependent upon EfiMemoryMapSize. Otherwise
// we process bogus entries and create bogus E820 entries.
//
- EfiMemoryMap = (EFI_MEMORY_DESCRIPTOR *) AllocatePool (EfiMemoryMapSize);
+ EfiMemoryMap = (EFI_MEMORY_DESCRIPTOR *)AllocatePool (EfiMemoryMapSize);
ASSERT (EfiMemoryMap != NULL);
Status = gBS->GetMemoryMap (
&EfiMemoryMapSize,
@@ -1736,17 +1769,17 @@ LegacyBiosBuildE820 (
// First entry is 0 to (640k - EBDA)
//
ACCESS_PAGE0_CODE (
- E820Table[0].BaseAddr = 0;
- E820Table[0].Length = (UINT64) ((*(UINT16 *) (UINTN)0x40E) << 4);
- E820Table[0].Type = EfiAcpiAddressRangeMemory;
- );
+ E820Table[0].BaseAddr = 0;
+ E820Table[0].Length = (UINT64)((*(UINT16 *)(UINTN)0x40E) << 4);
+ E820Table[0].Type = EfiAcpiAddressRangeMemory;
+ );
//
// Second entry is (640k - EBDA) to 640k
//
- E820Table[1].BaseAddr = E820Table[0].Length;
- E820Table[1].Length = (UINT64) ((640 * 1024) - E820Table[0].Length);
- E820Table[1].Type = EfiAcpiAddressRangeReserved;
+ E820Table[1].BaseAddr = E820Table[0].Length;
+ E820Table[1].Length = (UINT64)((640 * 1024) - E820Table[0].Length);
+ E820Table[1].Type = EfiAcpiAddressRangeReserved;
//
// Third Entry is legacy BIOS
@@ -1760,9 +1793,9 @@ LegacyBiosBuildE820 (
// The CSM binary image size is not the actually size that CSM binary used,
// to avoid memory corrupt, we declare the 0E0000 - 0FFFFF is used by CSM binary.
//
- E820Table[2].BaseAddr = 0xE0000;
- E820Table[2].Length = 0x20000;
- E820Table[2].Type = EfiAcpiAddressRangeReserved;
+ E820Table[2].BaseAddr = 0xE0000;
+ E820Table[2].Length = 0x20000;
+ E820Table[2].Type = EfiAcpiAddressRangeReserved;
Above1MIndex = 2;
@@ -1775,7 +1808,7 @@ LegacyBiosBuildE820 (
//
EfiEntry = EfiMemoryMap;
NextEfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
- EfiMemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) EfiMemoryMap + EfiMemoryMapSize);
+ EfiMemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)EfiMemoryMap + EfiMemoryMapSize);
while (EfiEntry < EfiMemoryMapEnd) {
while (NextEfiEntry < EfiMemoryMapEnd) {
if (EfiEntry->PhysicalStart > NextEfiEntry->PhysicalStart) {
@@ -1787,14 +1820,14 @@ LegacyBiosBuildE820 (
NextEfiEntry = NEXT_MEMORY_DESCRIPTOR (NextEfiEntry, EfiDescriptorSize);
}
- EfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
- NextEfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
+ EfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
+ NextEfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
}
EfiEntry = EfiMemoryMap;
- EfiMemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) EfiMemoryMap + EfiMemoryMapSize);
+ EfiMemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)EfiMemoryMap + EfiMemoryMapSize);
for (Index = Above1MIndex; (EfiEntry < EfiMemoryMapEnd) && (Index < EFI_MAX_E820_ENTRY - 1); ) {
- MemoryBlockLength = (UINT64) (LShiftU64 (EfiEntry->NumberOfPages, 12));
+ MemoryBlockLength = (UINT64)(LShiftU64 (EfiEntry->NumberOfPages, 12));
if ((EfiEntry->PhysicalStart + MemoryBlockLength) < 0x100000) {
//
// Skip the memory block if under 1MB
@@ -1804,7 +1837,7 @@ LegacyBiosBuildE820 (
//
// When the memory block spans below 1MB, ensure the memory block start address is at least 1MB
//
- MemoryBlockLength -= 0x100000 - EfiEntry->PhysicalStart;
+ MemoryBlockLength -= 0x100000 - EfiEntry->PhysicalStart;
EfiEntry->PhysicalStart = 0x100000;
}
@@ -1823,11 +1856,12 @@ LegacyBiosBuildE820 (
// Make a new entry
//
++Index;
- E820Table[Index].BaseAddr = EfiEntry->PhysicalStart;
- E820Table[Index].Length = MemoryBlockLength;
- E820Table[Index].Type = TempType;
+ E820Table[Index].BaseAddr = EfiEntry->PhysicalStart;
+ E820Table[Index].Length = MemoryBlockLength;
+ E820Table[Index].Type = TempType;
}
}
+
EfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
}
@@ -1837,26 +1871,27 @@ LegacyBiosBuildE820 (
// Process the reserved memory map to produce E820 map ;
//
for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) {
- if (Hob.Raw != NULL && GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
+ if ((Hob.Raw != NULL) && (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR)) {
ResourceHob = Hob.ResourceDescriptor;
if (((ResourceHob->ResourceType == EFI_RESOURCE_MEMORY_MAPPED_IO) ||
- (ResourceHob->ResourceType == EFI_RESOURCE_FIRMWARE_DEVICE) ||
- (ResourceHob->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) ) &&
+ (ResourceHob->ResourceType == EFI_RESOURCE_FIRMWARE_DEVICE) ||
+ (ResourceHob->ResourceType == EFI_RESOURCE_MEMORY_RESERVED)) &&
(ResourceHob->PhysicalStart > 0x100000) &&
- (Index < EFI_MAX_E820_ENTRY - 1)) {
+ (Index < EFI_MAX_E820_ENTRY - 1))
+ {
++Index;
- E820Table[Index].BaseAddr = ResourceHob->PhysicalStart;
- E820Table[Index].Length = ResourceHob->ResourceLength;
- E820Table[Index].Type = EfiAcpiAddressRangeReserved;
+ E820Table[Index].BaseAddr = ResourceHob->PhysicalStart;
+ E820Table[Index].Length = ResourceHob->ResourceLength;
+ E820Table[Index].Type = EfiAcpiAddressRangeReserved;
}
}
}
- Index ++;
+ Index++;
Private->IntThunk->EfiToLegacy16InitTable.NumberE820Entries = (UINT32)Index;
Private->IntThunk->EfiToLegacy16BootTable.NumberE820Entries = (UINT32)Index;
- Private->NumberE820Entries = (UINT32)Index;
- *Size = (UINTN) (Index * sizeof (EFI_E820_ENTRY64));
+ Private->NumberE820Entries = (UINT32)Index;
+ *Size = (UINTN)(Index * sizeof (EFI_E820_ENTRY64));
//
// Sort E820Table from low to high
@@ -1865,18 +1900,18 @@ LegacyBiosBuildE820 (
ChangedFlag = FALSE;
for (TempNextIndex = 1; TempNextIndex < Index - TempIndex; TempNextIndex++) {
if (E820Table[TempNextIndex - 1].BaseAddr > E820Table[TempNextIndex].BaseAddr) {
- ChangedFlag = TRUE;
- TempE820.BaseAddr = E820Table[TempNextIndex - 1].BaseAddr;
- TempE820.Length = E820Table[TempNextIndex - 1].Length;
- TempE820.Type = E820Table[TempNextIndex - 1].Type;
-
- E820Table[TempNextIndex - 1].BaseAddr = E820Table[TempNextIndex].BaseAddr;
- E820Table[TempNextIndex - 1].Length = E820Table[TempNextIndex].Length;
- E820Table[TempNextIndex - 1].Type = E820Table[TempNextIndex].Type;
-
- E820Table[TempNextIndex].BaseAddr = TempE820.BaseAddr;
- E820Table[TempNextIndex].Length = TempE820.Length;
- E820Table[TempNextIndex].Type = TempE820.Type;
+ ChangedFlag = TRUE;
+ TempE820.BaseAddr = E820Table[TempNextIndex - 1].BaseAddr;
+ TempE820.Length = E820Table[TempNextIndex - 1].Length;
+ TempE820.Type = E820Table[TempNextIndex - 1].Type;
+
+ E820Table[TempNextIndex - 1].BaseAddr = E820Table[TempNextIndex].BaseAddr;
+ E820Table[TempNextIndex - 1].Length = E820Table[TempNextIndex].Length;
+ E820Table[TempNextIndex - 1].Type = E820Table[TempNextIndex].Type;
+
+ E820Table[TempNextIndex].BaseAddr = TempE820.BaseAddr;
+ E820Table[TempNextIndex].Length = TempE820.Length;
+ E820Table[TempNextIndex].Type = TempE820.Type;
}
}
@@ -1889,49 +1924,50 @@ LegacyBiosBuildE820 (
// Remove the overlap range
//
for (TempIndex = 1; TempIndex < Index; TempIndex++) {
- if (E820Table[TempIndex - 1].BaseAddr <= E820Table[TempIndex].BaseAddr &&
+ if ((E820Table[TempIndex - 1].BaseAddr <= E820Table[TempIndex].BaseAddr) &&
((E820Table[TempIndex - 1].BaseAddr + E820Table[TempIndex - 1].Length) >=
- (E820Table[TempIndex].BaseAddr +E820Table[TempIndex].Length))) {
- //
- //Overlap range is found
- //
- ASSERT (E820Table[TempIndex - 1].Type == E820Table[TempIndex].Type);
-
- if (TempIndex == Index - 1) {
- E820Table[TempIndex].BaseAddr = 0;
- E820Table[TempIndex].Length = 0;
- E820Table[TempIndex].Type = (EFI_ACPI_MEMORY_TYPE) 0;
- Index--;
- break;
- } else {
- for (IndexSort = TempIndex; IndexSort < Index - 1; IndexSort ++) {
- E820Table[IndexSort].BaseAddr = E820Table[IndexSort + 1].BaseAddr;
- E820Table[IndexSort].Length = E820Table[IndexSort + 1].Length;
- E820Table[IndexSort].Type = E820Table[IndexSort + 1].Type;
- }
- Index--;
- }
- }
- }
+ (E820Table[TempIndex].BaseAddr +E820Table[TempIndex].Length)))
+ {
+ //
+ // Overlap range is found
+ //
+ ASSERT (E820Table[TempIndex - 1].Type == E820Table[TempIndex].Type);
+ if (TempIndex == Index - 1) {
+ E820Table[TempIndex].BaseAddr = 0;
+ E820Table[TempIndex].Length = 0;
+ E820Table[TempIndex].Type = (EFI_ACPI_MEMORY_TYPE)0;
+ Index--;
+ break;
+ } else {
+ for (IndexSort = TempIndex; IndexSort < Index - 1; IndexSort++) {
+ E820Table[IndexSort].BaseAddr = E820Table[IndexSort + 1].BaseAddr;
+ E820Table[IndexSort].Length = E820Table[IndexSort + 1].Length;
+ E820Table[IndexSort].Type = E820Table[IndexSort + 1].Type;
+ }
+ Index--;
+ }
+ }
+ }
Private->IntThunk->EfiToLegacy16InitTable.NumberE820Entries = (UINT32)Index;
Private->IntThunk->EfiToLegacy16BootTable.NumberE820Entries = (UINT32)Index;
- Private->NumberE820Entries = (UINT32)Index;
- *Size = (UINTN) (Index * sizeof (EFI_E820_ENTRY64));
+ Private->NumberE820Entries = (UINT32)Index;
+ *Size = (UINTN)(Index * sizeof (EFI_E820_ENTRY64));
//
// Determine OS usable memory above 1MB
//
Private->IntThunk->EfiToLegacy16BootTable.OsMemoryAbove1Mb = 0x0000;
for (TempIndex = Above1MIndex; TempIndex < Index; TempIndex++) {
- if (E820Table[TempIndex].BaseAddr >= 0x100000 && E820Table[TempIndex].BaseAddr < 0x100000000ULL) { // not include above 4G memory
+ if ((E820Table[TempIndex].BaseAddr >= 0x100000) && (E820Table[TempIndex].BaseAddr < 0x100000000ULL)) {
+ // not include above 4G memory
//
// ACPIReclaimMemory is also usable memory for ACPI OS, after OS dumps all ACPI tables.
//
if ((E820Table[TempIndex].Type == EfiAcpiAddressRangeMemory) || (E820Table[TempIndex].Type == EfiAcpiAddressRangeACPI)) {
- Private->IntThunk->EfiToLegacy16BootTable.OsMemoryAbove1Mb += (UINT32) (E820Table[TempIndex].Length);
+ Private->IntThunk->EfiToLegacy16BootTable.OsMemoryAbove1Mb += (UINT32)(E820Table[TempIndex].Length);
} else {
break; // break at first not normal memory, because SMM may use reserved memory.
}
@@ -1944,7 +1980,9 @@ LegacyBiosBuildE820 (
// Print DEBUG information
//
for (TempIndex = 0; TempIndex < Index; TempIndex++) {
- DEBUG((DEBUG_INFO, "E820[%2d]: 0x%016lx - 0x%016lx, Type = %d\n",
+ DEBUG ((
+ DEBUG_INFO,
+ "E820[%2d]: 0x%016lx - 0x%016lx, Type = %d\n",
TempIndex,
E820Table[TempIndex].BaseAddr,
(E820Table[TempIndex].BaseAddr + E820Table[TempIndex].Length),
@@ -1955,7 +1993,6 @@ LegacyBiosBuildE820 (
return EFI_SUCCESS;
}
-
/**
Fill in the standard BDA and EBDA stuff prior to legacy Boot
@@ -1966,21 +2003,21 @@ LegacyBiosBuildE820 (
**/
EFI_STATUS
LegacyBiosCompleteBdaBeforeBoot (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- BDA_STRUC *Bda;
- UINT16 MachineConfig;
- DEVICE_PRODUCER_DATA_HEADER *SioPtr;
+ BDA_STRUC *Bda;
+ UINT16 MachineConfig;
+ DEVICE_PRODUCER_DATA_HEADER *SioPtr;
- Bda = (BDA_STRUC *) ((UINTN) 0x400);
+ Bda = (BDA_STRUC *)((UINTN)0x400);
MachineConfig = 0;
- SioPtr = &(Private->IntThunk->EfiToLegacy16BootTable.SioData);
- Bda->Com1 = SioPtr->Serial[0].Address;
- Bda->Com2 = SioPtr->Serial[1].Address;
- Bda->Com3 = SioPtr->Serial[2].Address;
- Bda->Com4 = SioPtr->Serial[3].Address;
+ SioPtr = &(Private->IntThunk->EfiToLegacy16BootTable.SioData);
+ Bda->Com1 = SioPtr->Serial[0].Address;
+ Bda->Com2 = SioPtr->Serial[1].Address;
+ Bda->Com3 = SioPtr->Serial[2].Address;
+ Bda->Com4 = SioPtr->Serial[3].Address;
if (SioPtr->Serial[0].Address != 0x00) {
MachineConfig += 0x200;
@@ -2014,22 +2051,22 @@ LegacyBiosCompleteBdaBeforeBoot (
MachineConfig += 0x4000;
}
- Bda->NumberOfDrives = (UINT8) (Bda->NumberOfDrives + Private->IdeDriveCount);
+ Bda->NumberOfDrives = (UINT8)(Bda->NumberOfDrives + Private->IdeDriveCount);
if (SioPtr->Floppy.NumberOfFloppy != 0x00) {
- MachineConfig = (UINT16) (MachineConfig + 0x01 + (SioPtr->Floppy.NumberOfFloppy - 1) * 0x40);
- Bda->FloppyXRate = 0x07;
+ MachineConfig = (UINT16)(MachineConfig + 0x01 + (SioPtr->Floppy.NumberOfFloppy - 1) * 0x40);
+ Bda->FloppyXRate = 0x07;
}
- Bda->Lpt1_2Timeout = 0x1414;
- Bda->Lpt3_4Timeout = 0x1414;
- Bda->Com1_2Timeout = 0x0101;
- Bda->Com3_4Timeout = 0x0101;
+ Bda->Lpt1_2Timeout = 0x1414;
+ Bda->Lpt3_4Timeout = 0x1414;
+ Bda->Com1_2Timeout = 0x0101;
+ Bda->Com3_4Timeout = 0x0101;
//
// Force VGA and Coprocessor, indicate 101/102 keyboard
//
- MachineConfig = (UINT16) (MachineConfig + 0x00 + 0x02 + (SioPtr->MousePresent * 0x04));
- Bda->MachineConfig = MachineConfig;
+ MachineConfig = (UINT16)(MachineConfig + 0x00 + 0x02 + (SioPtr->MousePresent * 0x04));
+ Bda->MachineConfig = MachineConfig;
return EFI_SUCCESS;
}
@@ -2046,26 +2083,26 @@ LegacyBiosCompleteBdaBeforeBoot (
EFI_STATUS
EFIAPI
LegacyBiosUpdateKeyboardLedStatus (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT8 Leds
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT8 Leds
)
{
- LEGACY_BIOS_INSTANCE *Private;
- BDA_STRUC *Bda;
- UINT8 LocalLeds;
- EFI_IA32_REGISTER_SET Regs;
+ LEGACY_BIOS_INSTANCE *Private;
+ BDA_STRUC *Bda;
+ UINT8 LocalLeds;
+ EFI_IA32_REGISTER_SET Regs;
- Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
+ Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
ACCESS_PAGE0_CODE (
- Bda = (BDA_STRUC *) ((UINTN) 0x400);
+ Bda = (BDA_STRUC *)((UINTN)0x400);
LocalLeds = Leds;
- Bda->LedStatus = (UINT8) ((Bda->LedStatus &~0x07) | LocalLeds);
- LocalLeds = (UINT8) (LocalLeds << 4);
- Bda->ShiftStatus = (UINT8) ((Bda->ShiftStatus &~0x70) | LocalLeds);
- LocalLeds = (UINT8) (Leds & 0x20);
- Bda->KeyboardStatus = (UINT8) ((Bda->KeyboardStatus &~0x20) | LocalLeds);
- );
+ Bda->LedStatus = (UINT8)((Bda->LedStatus &~0x07) | LocalLeds);
+ LocalLeds = (UINT8)(LocalLeds << 4);
+ Bda->ShiftStatus = (UINT8)((Bda->ShiftStatus &~0x70) | LocalLeds);
+ LocalLeds = (UINT8)(Leds & 0x20);
+ Bda->KeyboardStatus = (UINT8)((Bda->KeyboardStatus &~0x20) | LocalLeds);
+ );
//
// Call into Legacy16 code to allow it to do any processing
@@ -2075,18 +2112,17 @@ LegacyBiosUpdateKeyboardLedStatus (
Regs.H.CL = Leds;
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Private->Legacy16Table->Compatibility16CallSegment,
- Private->Legacy16Table->Compatibility16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ &Private->LegacyBios,
+ Private->Legacy16Table->Compatibility16CallSegment,
+ Private->Legacy16Table->Compatibility16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
return EFI_SUCCESS;
}
-
/**
Fill in the standard CMOS stuff prior to legacy Boot
@@ -2097,7 +2133,7 @@ LegacyBiosUpdateKeyboardLedStatus (
**/
EFI_STATUS
LegacyBiosCompleteStandardCmosBeforeBoot (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
UINT8 Bda;
@@ -2113,7 +2149,7 @@ LegacyBiosCompleteStandardCmosBeforeBoot (
//
ACCESS_PAGE0_CODE (
Bda = (UINT8)(*((UINT8 *)((UINTN)0x410)) | BIT3);
- );
+ );
//
// Force display enabled
@@ -2143,7 +2179,7 @@ LegacyBiosCompleteStandardCmosBeforeBoot (
//
Size = (15 * SIZE_1MB) >> 10;
if (Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb < (15 * SIZE_1MB)) {
- Size = Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb >> 10;
+ Size = Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb >> 10;
}
LegacyWriteStandardCmos (CMOS_17, (UINT8)(Size & 0xFF));
@@ -2168,8 +2204,8 @@ LegacyBiosCompleteStandardCmosBeforeBoot (
**/
EFI_STATUS
RelocateImageUnder4GIfNeeded (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyCmos.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyCmos.c
index de25e06184..7220d8e65a 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyCmos.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyCmos.c
@@ -66,12 +66,12 @@ LegacyCalculateWriteStandardCmosChecksum (
for (Checksum = 0, Register = 0x10; Register < 0x2e; Register++) {
Checksum = (UINT16)(Checksum + LegacyReadStandardCmos (Register));
}
+
LegacyWriteStandardCmos (CMOS_2E, (UINT8)(Checksum >> 8));
LegacyWriteStandardCmos (CMOS_2F, (UINT8)(Checksum & 0xff));
return EFI_SUCCESS;
}
-
/**
Fill in the standard CMOS stuff before Legacy16 load
@@ -82,7 +82,7 @@ LegacyCalculateWriteStandardCmosChecksum (
**/
EFI_STATUS
LegacyBiosInitCmos (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
UINT32 Size;
@@ -103,7 +103,7 @@ LegacyBiosInitCmos (
Size = 15 * SIZE_1MB;
if (Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb < (15 * SIZE_1MB)) {
- Size = Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb >> 10;
+ Size = Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb >> 10;
}
LegacyWriteStandardCmos (CMOS_17, (UINT8)(Size & 0xFF));
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c
index 789f48370e..323f76c970 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "LegacyBiosInterface.h"
-BOOLEAN mIdeDataBuiltFlag = FALSE;
+BOOLEAN mIdeDataBuiltFlag = FALSE;
/**
Collect IDE Inquiry data from the IDE disks
@@ -23,9 +23,9 @@ BOOLEAN mIdeDataBuiltFlag = FALSE;
**/
EFI_STATUS
LegacyBiosBuildIdeData (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN HDD_INFO **HddInfo,
- IN UINT16 Flag
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN HDD_INFO **HddInfo,
+ IN UINT16 Flag
)
{
EFI_STATUS Status;
@@ -60,14 +60,14 @@ LegacyBiosBuildIdeData (
//
PciDevicePath = NULL;
LocalHddInfo = *HddInfo;
- Status = Private->LegacyBiosPlatform->GetPlatformHandle (
- Private->LegacyBiosPlatform,
- EfiGetPlatformIdeHandle,
- 0,
- &HandleBuffer,
- &HandleCount,
- (VOID *) &LocalHddInfo
- );
+ Status = Private->LegacyBiosPlatform->GetPlatformHandle (
+ Private->LegacyBiosPlatform,
+ EfiGetPlatformIdeHandle,
+ 0,
+ &HandleBuffer,
+ &HandleCount,
+ (VOID *)&LocalHddInfo
+ );
if (!EFI_ERROR (Status)) {
IdeController = HandleBuffer[0];
//
@@ -75,10 +75,10 @@ LegacyBiosBuildIdeData (
//
if (Flag != 0) {
gBS->DisconnectController (
- IdeController,
- NULL,
- NULL
- );
+ IdeController,
+ NULL,
+ NULL
+ );
}
gBS->ConnectController (IdeController, NULL, NULL, FALSE);
@@ -88,13 +88,13 @@ LegacyBiosBuildIdeData (
// And GetIdeHandle will switch to Legacy mode, if required.
//
Private->LegacyBiosPlatform->GetPlatformHandle (
- Private->LegacyBiosPlatform,
- EfiGetPlatformIdeHandle,
- 0,
- &HandleBuffer,
- &HandleCount,
- (VOID *) &LocalHddInfo
- );
+ Private->LegacyBiosPlatform,
+ EfiGetPlatformIdeHandle,
+ 0,
+ &HandleBuffer,
+ &HandleCount,
+ (VOID *)&LocalHddInfo
+ );
}
mIdeDataBuiltFlag = TRUE;
@@ -103,19 +103,19 @@ LegacyBiosBuildIdeData (
// Get Identity command from all drives
//
gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDiskInfoProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
-
- Private->IdeDriveCount = (UINT8) HandleCount;
+ ByProtocol,
+ &gEfiDiskInfoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+
+ Private->IdeDriveCount = (UINT8)HandleCount;
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDiskInfoProtocolGuid,
- (VOID **) &DiskInfo
+ (VOID **)&DiskInfo
);
ASSERT_EFI_ERROR (Status);
@@ -126,7 +126,7 @@ LegacyBiosBuildIdeData (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
- (VOID *) &DevicePath
+ (VOID *)&DevicePath
);
ASSERT_EFI_ERROR (Status);
@@ -134,12 +134,14 @@ LegacyBiosBuildIdeData (
while (!IsDevicePathEnd (DevicePathNode)) {
TempDevicePathNode = NextDevicePathNode (DevicePathNode);
if ((DevicePathType (DevicePathNode) == HARDWARE_DEVICE_PATH) &&
- ( DevicePathSubType (DevicePathNode) == HW_PCI_DP) &&
- ( DevicePathType(TempDevicePathNode) == MESSAGING_DEVICE_PATH) &&
- ( DevicePathSubType(TempDevicePathNode) == MSG_ATAPI_DP) ) {
- PciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;
+ (DevicePathSubType (DevicePathNode) == HW_PCI_DP) &&
+ (DevicePathType (TempDevicePathNode) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType (TempDevicePathNode) == MSG_ATAPI_DP))
+ {
+ PciDevicePath = (PCI_DEVICE_PATH *)DevicePathNode;
break;
}
+
DevicePathNode = NextDevicePathNode (DevicePathNode);
}
@@ -161,7 +163,8 @@ LegacyBiosBuildIdeData (
for (PciIndex = 0; PciIndex < 8; PciIndex++) {
if ((PciDevicePath->Device == LocalHddInfo[PciIndex].Device) &&
(PciDevicePath->Function == LocalHddInfo[PciIndex].Function)
- ) {
+ )
+ {
break;
}
}
@@ -186,15 +189,15 @@ LegacyBiosBuildIdeData (
InquiryData = NULL;
InquiryDataSize = 0;
- Status = DiskInfo->Inquiry (
- DiskInfo,
- NULL,
- &InquiryDataSize
- );
+ Status = DiskInfo->Inquiry (
+ DiskInfo,
+ NULL,
+ &InquiryDataSize
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- InquiryData = (UINT8 *) AllocatePool (
- InquiryDataSize
- );
+ InquiryData = (UINT8 *)AllocatePool (
+ InquiryDataSize
+ );
if (InquiryData != NULL) {
Status = DiskInfo->Inquiry (
DiskInfo,
@@ -227,6 +230,7 @@ LegacyBiosBuildIdeData (
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_SLAVE_ATAPI_ZIPDISK;
}
}
+
FreePool (InquiryData);
} else {
if (IdeDevice == 0) {
@@ -246,7 +250,6 @@ LegacyBiosBuildIdeData (
return EFI_SUCCESS;
}
-
/**
If the IDE channel is in compatibility (legacy) mode, remove all
PCI I/O BAR addresses from the controller.
@@ -257,13 +260,13 @@ LegacyBiosBuildIdeData (
**/
VOID
InitLegacyIdeController (
- IN EFI_HANDLE IdeController
+ IN EFI_HANDLE IdeController
)
{
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT32 IOBarClear;
- EFI_STATUS Status;
- PCI_TYPE00 PciData;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINT32 IOBarClear;
+ EFI_STATUS Status;
+ PCI_TYPE00 PciData;
//
// If the IDE channel is in compatibility (legacy) mode, remove all
@@ -277,20 +280,21 @@ InitLegacyIdeController (
(VOID **)&PciIo
);
if (EFI_ERROR (Status)) {
- return ;
+ return;
}
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (PciData), &PciData);
if (EFI_ERROR (Status)) {
- return ;
+ return;
}
//
// Check whether this is IDE
//
if ((PciData.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE) ||
- (PciData.Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE)) {
- return ;
+ (PciData.Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE))
+ {
+ return;
}
//
@@ -301,10 +305,11 @@ InitLegacyIdeController (
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x10, 1, &IOBarClear);
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x14, 1, &IOBarClear);
}
+
if ((PciData.Hdr.ClassCode[0] & IDE_PI_REGISTER_SNE) == 0) {
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x18, 1, &IOBarClear);
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x1C, 1, &IOBarClear);
}
- return ;
+ return;
}
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
index ea0df4972b..07ee5ab099 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
@@ -9,32 +9,32 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "LegacyBiosInterface.h"
#include <IndustryStandard/Pci30.h>
-#define PCI_START_ADDRESS(x) (((x) + 0x7ff) & ~0x7ff)
+#define PCI_START_ADDRESS(x) (((x) + 0x7ff) & ~0x7ff)
#define MAX_BRIDGE_INDEX 0x20
typedef struct {
- UINTN PciSegment;
- UINTN PciBus;
- UINTN PciDevice;
- UINTN PciFunction;
- UINT8 PrimaryBus;
- UINT8 SecondaryBus;
- UINT8 SubordinateBus;
+ UINTN PciSegment;
+ UINTN PciBus;
+ UINTN PciDevice;
+ UINTN PciFunction;
+ UINT8 PrimaryBus;
+ UINT8 SecondaryBus;
+ UINT8 SubordinateBus;
} BRIDGE_TABLE;
-#define ROM_MAX_ENTRIES 24
-BRIDGE_TABLE Bridges[MAX_BRIDGE_INDEX];
-UINTN SortedBridgeIndex[MAX_BRIDGE_INDEX];
-UINTN NumberOfBridges;
+#define ROM_MAX_ENTRIES 24
+BRIDGE_TABLE Bridges[MAX_BRIDGE_INDEX];
+UINTN SortedBridgeIndex[MAX_BRIDGE_INDEX];
+UINTN NumberOfBridges;
LEGACY_PNP_EXPANSION_HEADER *mBasePnpPtr;
-UINT16 mBbsRomSegment;
-UINTN mHandleCount;
-EFI_HANDLE mVgaHandle;
-BOOLEAN mIgnoreBbsUpdateFlag;
-BOOLEAN mVgaInstallationInProgress = FALSE;
-UINT32 mRomCount = 0x00;
-ROM_INSTANCE_ENTRY mRomEntry[ROM_MAX_ENTRIES];
-EDKII_IOMMU_PROTOCOL *mIoMmu;
+UINT16 mBbsRomSegment;
+UINTN mHandleCount;
+EFI_HANDLE mVgaHandle;
+BOOLEAN mIgnoreBbsUpdateFlag;
+BOOLEAN mVgaInstallationInProgress = FALSE;
+UINT32 mRomCount = 0x00;
+ROM_INSTANCE_ENTRY mRomEntry[ROM_MAX_ENTRIES];
+EDKII_IOMMU_PROTOCOL *mIoMmu;
/**
Query shadowed legacy ROM parameters registered by RomShadow() previously.
@@ -51,20 +51,20 @@ EDKII_IOMMU_PROTOCOL *mIoMmu;
**/
EFI_STATUS
GetShadowedRomParameters (
- IN EFI_HANDLE PciHandle,
- OUT UINT8 *DiskStart OPTIONAL,
- OUT UINT8 *DiskEnd OPTIONAL,
- OUT VOID **RomShadowAddress OPTIONAL,
- OUT UINTN *ShadowedSize OPTIONAL
+ IN EFI_HANDLE PciHandle,
+ OUT UINT8 *DiskStart OPTIONAL,
+ OUT UINT8 *DiskEnd OPTIONAL,
+ OUT VOID **RomShadowAddress OPTIONAL,
+ OUT UINTN *ShadowedSize OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINTN Index;
- UINTN PciSegment;
- UINTN PciBus;
- UINTN PciDevice;
- UINTN PciFunction;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN Index;
+ UINTN PciSegment;
+ UINTN PciBus;
+ UINTN PciDevice;
+ UINTN PciFunction;
//
// Get the PCI I/O Protocol on PciHandle
@@ -72,7 +72,7 @@ GetShadowedRomParameters (
Status = gBS->HandleProtocol (
PciHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
if (EFI_ERROR (Status)) {
return Status;
@@ -89,11 +89,12 @@ GetShadowedRomParameters (
&PciFunction
);
- for(Index = 0; Index < mRomCount; Index++) {
+ for (Index = 0; Index < mRomCount; Index++) {
if ((mRomEntry[Index].PciSegment == PciSegment) &&
(mRomEntry[Index].PciBus == PciBus) &&
(mRomEntry[Index].PciDevice == PciDevice) &&
- (mRomEntry[Index].PciFunction == PciFunction)) {
+ (mRomEntry[Index].PciFunction == PciFunction))
+ {
break;
}
}
@@ -141,15 +142,15 @@ GetShadowedRomParameters (
**/
EFI_STATUS
RomShadow (
- IN EFI_HANDLE PciHandle,
- IN UINT32 ShadowAddress,
- IN UINT32 ShadowedSize,
- IN UINT8 DiskStart,
- IN UINT8 DiskEnd
+ IN EFI_HANDLE PciHandle,
+ IN UINT32 ShadowAddress,
+ IN UINT32 ShadowedSize,
+ IN UINT8 DiskStart,
+ IN UINT8 DiskEnd
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
//
// See if there is room to register another option ROM
@@ -157,17 +158,19 @@ RomShadow (
if (mRomCount >= ROM_MAX_ENTRIES) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// Get the PCI I/O Protocol on PciHandle
//
Status = gBS->HandleProtocol (
PciHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Get the location of the PCI device
//
@@ -188,7 +191,6 @@ RomShadow (
return EFI_SUCCESS;
}
-
/**
Return EFI_SUCCESS if PciHandle has had a legacy BIOS ROM shadowed. This
information represents every call to RomShadow ()
@@ -201,16 +203,16 @@ RomShadow (
**/
EFI_STATUS
IsLegacyRom (
- IN EFI_HANDLE PciHandle
+ IN EFI_HANDLE PciHandle
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINTN Index;
- UINTN Segment;
- UINTN Bus;
- UINTN Device;
- UINTN Function;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN Index;
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
//
// Get the PCI I/O Protocol on PciHandle
@@ -218,11 +220,12 @@ IsLegacyRom (
Status = gBS->HandleProtocol (
PciHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Get the location of the PCI device
//
@@ -238,11 +241,12 @@ IsLegacyRom (
// See if the option ROM from PciHandle has been previously posted
//
for (Index = 0; Index < mRomCount; Index++) {
- if (mRomEntry[Index].PciSegment == Segment &&
- mRomEntry[Index].PciBus == Bus &&
- mRomEntry[Index].PciDevice == Device &&
- mRomEntry[Index].PciFunction == Function
- ) {
+ if ((mRomEntry[Index].PciSegment == Segment) &&
+ (mRomEntry[Index].PciBus == Bus) &&
+ (mRomEntry[Index].PciDevice == Device) &&
+ (mRomEntry[Index].PciFunction == Function)
+ )
+ {
return EFI_SUCCESS;
}
}
@@ -271,14 +275,14 @@ IsLegacyRom (
**/
EFI_STATUS
GetPciLegacyRom (
- IN UINT16 Csm16Revision,
- IN UINT16 VendorId,
- IN UINT16 DeviceId,
- IN OUT VOID **Rom,
- IN OUT UINTN *ImageSize,
- OUT UINTN *MaxRuntimeImageLength OPTIONAL,
- OUT UINT8 *OpRomRevision OPTIONAL,
- OUT VOID **ConfigUtilityCodeHeader OPTIONAL
+ IN UINT16 Csm16Revision,
+ IN UINT16 VendorId,
+ IN UINT16 DeviceId,
+ IN OUT VOID **Rom,
+ IN OUT UINTN *ImageSize,
+ OUT UINTN *MaxRuntimeImageLength OPTIONAL,
+ OUT UINT8 *OpRomRevision OPTIONAL,
+ OUT VOID **ConfigUtilityCodeHeader OPTIONAL
)
{
BOOLEAN Match;
@@ -288,7 +292,6 @@ GetPciLegacyRom (
VOID *BackupImage;
VOID *BestImage;
-
if (*ImageSize < sizeof (EFI_PCI_ROM_HEADER)) {
return EFI_NOT_FOUND;
}
@@ -297,13 +300,14 @@ GetPciLegacyRom (
BackupImage = NULL;
RomHeader.Raw = *Rom;
while (RomHeader.Generic->Signature == PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
- if (RomHeader.Generic->PcirOffset == 0 ||
- (RomHeader.Generic->PcirOffset & 3) !=0 ||
- *ImageSize < RomHeader.Raw - (UINT8 *) *Rom + RomHeader.Generic->PcirOffset + sizeof (PCI_DATA_STRUCTURE)) {
+ if ((RomHeader.Generic->PcirOffset == 0) ||
+ ((RomHeader.Generic->PcirOffset & 3) != 0) ||
+ (*ImageSize < RomHeader.Raw - (UINT8 *)*Rom + RomHeader.Generic->PcirOffset + sizeof (PCI_DATA_STRUCTURE)))
+ {
break;
}
- Pcir = (PCI_3_0_DATA_STRUCTURE *) (RomHeader.Raw + RomHeader.Generic->PcirOffset);
+ Pcir = (PCI_3_0_DATA_STRUCTURE *)(RomHeader.Raw + RomHeader.Generic->PcirOffset);
//
// Check signature in the PCI Data Structure.
//
@@ -321,7 +325,7 @@ GetPciLegacyRom (
if (Pcir->DeviceId == DeviceId) {
Match = TRUE;
} else if ((Pcir->Revision >= 3) && (Pcir->DeviceListOffset != 0)) {
- DeviceIdList = (UINT16 *)(((UINT8 *) Pcir) + Pcir->DeviceListOffset);
+ DeviceIdList = (UINT16 *)(((UINT8 *)Pcir) + Pcir->DeviceListOffset);
//
// Checking the device list
//
@@ -330,7 +334,8 @@ GetPciLegacyRom (
Match = TRUE;
break;
}
- DeviceIdList ++;
+
+ DeviceIdList++;
}
}
}
@@ -345,7 +350,7 @@ GetPciLegacyRom (
// case 1.1: meets OpRom 3.0
// Perfect!!!
//
- BestImage = RomHeader.Raw;
+ BestImage = RomHeader.Raw;
break;
} else {
//
@@ -369,7 +374,7 @@ GetPciLegacyRom (
// case 2.2: meets OpRom 2.x
// Perfect!!!
//
- BestImage = RomHeader.Raw;
+ BestImage = RomHeader.Raw;
break;
}
}
@@ -389,15 +394,17 @@ GetPciLegacyRom (
if (BackupImage == NULL) {
return EFI_NOT_FOUND;
}
+
//
// The versions of CSM16 and OpRom don't match exactly
//
BestImage = BackupImage;
}
+
RomHeader.Raw = BestImage;
- Pcir = (PCI_3_0_DATA_STRUCTURE *) (RomHeader.Raw + RomHeader.Generic->PcirOffset);
- *Rom = BestImage;
- *ImageSize = Pcir->ImageLength * 512;
+ Pcir = (PCI_3_0_DATA_STRUCTURE *)(RomHeader.Raw + RomHeader.Generic->PcirOffset);
+ *Rom = BestImage;
+ *ImageSize = Pcir->ImageLength * 512;
if (MaxRuntimeImageLength != NULL) {
if (Pcir->Revision < 3) {
@@ -444,22 +451,22 @@ GetPciLegacyRom (
**/
EFI_STATUS
CreateBridgeTable (
- IN EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable,
- IN UINTN RoutingTableEntries
+ IN EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable,
+ IN UINTN RoutingTableEntries
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN BridgeIndex;
- UINTN Index;
- UINTN Index1;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE01 PciConfigHeader;
- BRIDGE_TABLE SlotBridges[MAX_BRIDGE_INDEX];
- UINTN SlotBridgeIndex;
-
- BridgeIndex = 0x00;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN BridgeIndex;
+ UINTN Index;
+ UINTN Index1;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE01 PciConfigHeader;
+ BRIDGE_TABLE SlotBridges[MAX_BRIDGE_INDEX];
+ UINTN SlotBridgeIndex;
+
+ BridgeIndex = 0x00;
SlotBridgeIndex = 0x00;
//
@@ -475,11 +482,12 @@ CreateBridgeTable (
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
+
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
if (EFI_ERROR (Status)) {
continue;
@@ -502,19 +510,20 @@ CreateBridgeTable (
&Bridges[BridgeIndex].PciFunction
);
- Bridges[BridgeIndex].PrimaryBus = PciConfigHeader.Bridge.PrimaryBus;
+ Bridges[BridgeIndex].PrimaryBus = PciConfigHeader.Bridge.PrimaryBus;
- Bridges[BridgeIndex].SecondaryBus = PciConfigHeader.Bridge.SecondaryBus;
+ Bridges[BridgeIndex].SecondaryBus = PciConfigHeader.Bridge.SecondaryBus;
Bridges[BridgeIndex].SubordinateBus = PciConfigHeader.Bridge.SubordinateBus;
- for (Index1 = 0; Index1 < RoutingTableEntries; Index1++){
+ for (Index1 = 0; Index1 < RoutingTableEntries; Index1++) {
//
// Test whether we have found the Bridge in the slot, must be the one that directly interfaced to the board
// Once we find one, store it in the SlotBridges[]
//
- if ((RoutingTable[Index1].Slot != 0) && (Bridges[BridgeIndex].PrimaryBus == RoutingTable[Index1].Bus)
- && ((Bridges[BridgeIndex].PciDevice << 3) == RoutingTable[Index1].Device)) {
+ if ( (RoutingTable[Index1].Slot != 0) && (Bridges[BridgeIndex].PrimaryBus == RoutingTable[Index1].Bus)
+ && ((Bridges[BridgeIndex].PciDevice << 3) == RoutingTable[Index1].Device))
+ {
CopyMem (&SlotBridges[SlotBridgeIndex], &Bridges[BridgeIndex], sizeof (BRIDGE_TABLE));
SlotBridgeIndex++;
@@ -529,10 +538,11 @@ CreateBridgeTable (
//
// Pack up Bridges by removing those useless ones
//
- for (Index = 0; Index < BridgeIndex;){
+ for (Index = 0; Index < BridgeIndex;) {
for (Index1 = 0; Index1 < SlotBridgeIndex; Index1++) {
if (((Bridges[Index].PciBus == SlotBridges[Index1].PrimaryBus) && (Bridges[Index].PciDevice == SlotBridges[Index1].PciDevice)) ||
- ((Bridges[Index].PciBus >= SlotBridges[Index1].SecondaryBus) && (Bridges[Index].PciBus <= SlotBridges[Index1].SubordinateBus))) {
+ ((Bridges[Index].PciBus >= SlotBridges[Index1].SecondaryBus) && (Bridges[Index].PciBus <= SlotBridges[Index1].SubordinateBus)))
+ {
//
// We have found one that meets our criteria
//
@@ -545,7 +555,7 @@ CreateBridgeTable (
// This one doesn't meet criteria, pack it
//
if (Index1 >= SlotBridgeIndex) {
- for (Index1 = Index; BridgeIndex > 1 && Index1 < BridgeIndex - 1 ; Index1++) {
+ for (Index1 = Index; BridgeIndex > 1 && Index1 < BridgeIndex - 1; Index1++) {
CopyMem (&Bridges[Index1], &Bridges[Index1 + 1], sizeof (BRIDGE_TABLE));
}
@@ -574,18 +584,19 @@ CreateBridgeTable (
if ((Bridges[Index].SecondaryBus == Bridges[Index1].SecondaryBus) &&
(Bridges[Index].SubordinateBus > Bridges[Index1].SubordinateBus)
- ) {
+ )
+ {
SortedBridgeIndex[Index] = Index1;
SortedBridgeIndex[Index1] = Index;
}
}
}
}
+
FreePool (HandleBuffer);
return EFI_SUCCESS;
}
-
/**
Find base Bridge for device.
@@ -601,14 +612,15 @@ CreateBridgeTable (
**/
EFI_STATUS
GetBaseBus (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN UINTN PciBus,
- IN UINTN PciDevice,
- IN EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable,
- IN UINTN RoutingTableEntries
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN UINTN PciBus,
+ IN UINTN PciDevice,
+ IN EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable,
+ IN UINTN RoutingTableEntries
)
{
- UINTN Index;
+ UINTN Index;
+
for (Index = 0; Index < RoutingTableEntries; Index++) {
if ((RoutingTable[Index].Bus == PciBus) && (RoutingTable[Index].Device == (PciDevice << 3))) {
return EFI_SUCCESS;
@@ -635,11 +647,11 @@ GetBaseBus (
**/
EFI_STATUS
TranslateBusPirq (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN OUT UINTN *PciBus,
- IN OUT UINTN *PciDevice,
- IN OUT UINTN *PciFunction,
- IN OUT UINT8 *PirqIndex
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN OUT UINTN *PciBus,
+ IN OUT UINTN *PciDevice,
+ IN OUT UINTN *PciFunction,
+ IN OUT UINT8 *PirqIndex
)
{
/*
@@ -689,24 +701,25 @@ No other busses match criteria. Device to be programmed is Bus 5, Device 1.
Rotate (B,C,D,A) by 1 giving C,D,A,B. Translated PIRQ is C.
*/
- UINTN LocalBus;
- UINTN LocalDevice;
- UINTN BaseBus;
- UINTN BaseDevice;
- UINTN BaseFunction;
- UINT8 LocalPirqIndex;
- BOOLEAN BaseIndexFlag;
- UINTN BridgeIndex;
- UINTN SBridgeIndex;
- BaseIndexFlag = FALSE;
- BridgeIndex = 0x00;
-
- LocalPirqIndex = *PirqIndex;
- LocalBus = *PciBus;
- LocalDevice = *PciDevice;
- BaseBus = *PciBus;
- BaseDevice = *PciDevice;
- BaseFunction = *PciFunction;
+ UINTN LocalBus;
+ UINTN LocalDevice;
+ UINTN BaseBus;
+ UINTN BaseDevice;
+ UINTN BaseFunction;
+ UINT8 LocalPirqIndex;
+ BOOLEAN BaseIndexFlag;
+ UINTN BridgeIndex;
+ UINTN SBridgeIndex;
+
+ BaseIndexFlag = FALSE;
+ BridgeIndex = 0x00;
+
+ LocalPirqIndex = *PirqIndex;
+ LocalBus = *PciBus;
+ LocalDevice = *PciDevice;
+ BaseBus = *PciBus;
+ BaseDevice = *PciDevice;
+ BaseFunction = *PciFunction;
//
// LocalPirqIndex list PIRQs in rotated fashion
@@ -732,17 +745,17 @@ Rotate (B,C,D,A) by 1 giving C,D,A,B. Translated PIRQ is C.
BaseFunction = Bridges[SBridgeIndex].PciFunction;
BaseIndexFlag = TRUE;
} else {
- LocalPirqIndex = (UINT8) ((LocalPirqIndex + (UINT8)Bridges[SBridgeIndex].PciDevice)%4);
+ LocalPirqIndex = (UINT8)((LocalPirqIndex + (UINT8)Bridges[SBridgeIndex].PciDevice)%4);
}
//
// Check if at device. If not get new PCI location & PIRQ
//
- if (Bridges[SBridgeIndex].SecondaryBus == (UINT8) LocalBus) {
+ if (Bridges[SBridgeIndex].SecondaryBus == (UINT8)LocalBus) {
//
// Translate PIRQ
//
- LocalPirqIndex = (UINT8) ((LocalPirqIndex + (UINT8) (LocalDevice)) % 4);
+ LocalPirqIndex = (UINT8)((LocalPirqIndex + (UINT8)(LocalDevice)) % 4);
break;
}
}
@@ -751,19 +764,18 @@ Rotate (B,C,D,A) by 1 giving C,D,A,B. Translated PIRQ is C.
//
// In case we fail to find the Bridge just above us, this is some potential error and we want to warn the user
//
- if(BridgeIndex >= NumberOfBridges){
+ if (BridgeIndex >= NumberOfBridges) {
DEBUG ((DEBUG_ERROR, "Cannot Find IRQ Routing for Bus %d, Device %d, Function %d\n", *PciBus, *PciDevice, *PciFunction));
}
- *PirqIndex = LocalPirqIndex;
- *PciBus = BaseBus;
- *PciDevice = BaseDevice;
- *PciFunction = BaseFunction;
+ *PirqIndex = LocalPirqIndex;
+ *PciBus = BaseBus;
+ *PciDevice = BaseDevice;
+ *PciFunction = BaseFunction;
return EFI_SUCCESS;
}
-
/**
Copy the $PIR table as required.
@@ -776,59 +788,59 @@ Rotate (B,C,D,A) by 1 giving C,D,A,B. Translated PIRQ is C.
**/
VOID
CopyPirqTable (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable,
- IN UINTN RoutingTableEntries,
- IN EFI_LEGACY_PIRQ_TABLE_HEADER *PirqTable,
- IN UINTN PirqTableSize
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable,
+ IN UINTN RoutingTableEntries,
+ IN EFI_LEGACY_PIRQ_TABLE_HEADER *PirqTable,
+ IN UINTN PirqTableSize
)
{
- EFI_IA32_REGISTER_SET Regs;
- UINT32 Granularity;
+ EFI_IA32_REGISTER_SET Regs;
+ UINT32 Granularity;
//
// Copy $PIR table, if it exists.
//
if (PirqTable != NULL) {
Private->LegacyRegion->UnLock (
- Private->LegacyRegion,
- 0xE0000,
- 0x20000,
- &Granularity
- );
-
- Private->InternalIrqRoutingTable = RoutingTable;
- Private->NumberIrqRoutingEntries = (UINT16) (RoutingTableEntries);
+ Private->LegacyRegion,
+ 0xE0000,
+ 0x20000,
+ &Granularity
+ );
+
+ Private->InternalIrqRoutingTable = RoutingTable;
+ Private->NumberIrqRoutingEntries = (UINT16)(RoutingTableEntries);
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
Regs.X.AX = Legacy16GetTableAddress;
- Regs.X.CX = (UINT16) PirqTableSize;
+ Regs.X.CX = (UINT16)PirqTableSize;
//
// Allocate at F segment according to PCI IRQ Routing Table Specification
//
- Regs.X.BX = (UINT16) 0x1;
+ Regs.X.BX = (UINT16)0x1;
//
// 16-byte boundary alignment requirement according to
// PCI IRQ Routing Table Specification
//
Regs.X.DX = 0x10;
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ &Private->LegacyBios,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
- Private->Legacy16Table->IrqRoutingTablePointer = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
+ Private->Legacy16Table->IrqRoutingTablePointer = (UINT32)(Regs.X.DS * 16 + Regs.X.BX);
if (Regs.X.AX != 0) {
DEBUG ((DEBUG_ERROR, "PIRQ table length insufficient - %x\n", PirqTableSize));
} else {
DEBUG ((DEBUG_INFO, "PIRQ table in legacy region - %x\n", Private->Legacy16Table->IrqRoutingTablePointer));
Private->Legacy16Table->IrqRoutingTableLength = (UINT32)PirqTableSize;
CopyMem (
- (VOID *) (UINTN)Private->Legacy16Table->IrqRoutingTablePointer,
+ (VOID *)(UINTN)Private->Legacy16Table->IrqRoutingTablePointer,
PirqTable,
PirqTableSize
);
@@ -890,10 +902,10 @@ DumpPciHandle (
**/
VOID
InstallLegacyIrqHandler (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT8 PciIrq,
- IN PCI_TYPE00 *PciConfigHeader
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT8 PciIrq,
+ IN PCI_TYPE00 *PciConfigHeader
)
{
EFI_IA32_REGISTER_SET Regs;
@@ -924,7 +936,7 @@ InstallLegacyIrqHandler (
NULL
);
- LegMask = (UINT16) (LegMask | (UINT16) (1 << PciIrq));
+ LegMask = (UINT16)(LegMask | (UINT16)(1 << PciIrq));
Legacy8259->SetMask (
Legacy8259,
@@ -935,18 +947,18 @@ InstallLegacyIrqHandler (
);
PciIo->GetLocation (
- PciIo,
- &PciSegment,
- &PciBus,
- &PciDevice,
- &PciFunction
- );
- Private->IntThunk->PciHandler.PciBus = (UINT8) PciBus;
- Private->IntThunk->PciHandler.PciDeviceFun = (UINT8) ((PciDevice << 3) + PciFunction);
- Private->IntThunk->PciHandler.PciSegment = (UINT8) PciSegment;
- Private->IntThunk->PciHandler.PciClass = PciConfigHeader->Hdr.ClassCode[2];
- Private->IntThunk->PciHandler.PciSubclass = PciConfigHeader->Hdr.ClassCode[1];
- Private->IntThunk->PciHandler.PciInterface = PciConfigHeader->Hdr.ClassCode[0];
+ PciIo,
+ &PciSegment,
+ &PciBus,
+ &PciDevice,
+ &PciFunction
+ );
+ Private->IntThunk->PciHandler.PciBus = (UINT8)PciBus;
+ Private->IntThunk->PciHandler.PciDeviceFun = (UINT8)((PciDevice << 3) + PciFunction);
+ Private->IntThunk->PciHandler.PciSegment = (UINT8)PciSegment;
+ Private->IntThunk->PciHandler.PciClass = PciConfigHeader->Hdr.ClassCode[2];
+ Private->IntThunk->PciHandler.PciSubclass = PciConfigHeader->Hdr.ClassCode[1];
+ Private->IntThunk->PciHandler.PciInterface = PciConfigHeader->Hdr.ClassCode[0];
//
// Use native mode base address registers in two cases:
@@ -954,30 +966,30 @@ InstallLegacyIrqHandler (
// in native mode OR
// 2. PCI device Sub Class Code is not IDE
//
- Private->IntThunk->PciHandler.PrimaryBusMaster = (UINT16)(PciConfigHeader->Device.Bar[4] & 0xfffc);
+ Private->IntThunk->PciHandler.PrimaryBusMaster = (UINT16)(PciConfigHeader->Device.Bar[4] & 0xfffc);
if (((PciConfigHeader->Hdr.ClassCode[0] & 0x01) != 0) || (PciConfigHeader->Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE)) {
- Private->IntThunk->PciHandler.PrimaryIrq = PciIrq;
- Private->IntThunk->PciHandler.PrimaryBase = (UINT16) (PciConfigHeader->Device.Bar[0] & 0xfffc);
- Private->IntThunk->PciHandler.PrimaryControl = (UINT16) ((PciConfigHeader->Device.Bar[1] & 0xfffc) + 2);
+ Private->IntThunk->PciHandler.PrimaryIrq = PciIrq;
+ Private->IntThunk->PciHandler.PrimaryBase = (UINT16)(PciConfigHeader->Device.Bar[0] & 0xfffc);
+ Private->IntThunk->PciHandler.PrimaryControl = (UINT16)((PciConfigHeader->Device.Bar[1] & 0xfffc) + 2);
} else {
- Private->IntThunk->PciHandler.PrimaryIrq = 14;
- Private->IntThunk->PciHandler.PrimaryBase = 0x1f0;
- Private->IntThunk->PciHandler.PrimaryControl = 0x3f6;
+ Private->IntThunk->PciHandler.PrimaryIrq = 14;
+ Private->IntThunk->PciHandler.PrimaryBase = 0x1f0;
+ Private->IntThunk->PciHandler.PrimaryControl = 0x3f6;
}
+
//
// Secondary controller data
//
if (Private->IntThunk->PciHandler.PrimaryBusMaster != 0) {
- Private->IntThunk->PciHandler.SecondaryBusMaster = (UINT16) ((PciConfigHeader->Device.Bar[4] & 0xfffc) + 8);
- PrimaryMaster = (UINT16) (Private->IntThunk->PciHandler.PrimaryBusMaster + 2);
- SecondaryMaster = (UINT16) (Private->IntThunk->PciHandler.SecondaryBusMaster + 2);
+ Private->IntThunk->PciHandler.SecondaryBusMaster = (UINT16)((PciConfigHeader->Device.Bar[4] & 0xfffc) + 8);
+ PrimaryMaster = (UINT16)(Private->IntThunk->PciHandler.PrimaryBusMaster + 2);
+ SecondaryMaster = (UINT16)(Private->IntThunk->PciHandler.SecondaryBusMaster + 2);
//
// Clear pending interrupts in Bus Master registers
//
IoWrite16 (PrimaryMaster, 0x04);
IoWrite16 (SecondaryMaster, 0x04);
-
}
//
@@ -987,14 +999,13 @@ InstallLegacyIrqHandler (
// 2. PCI device Sub Class Code is not IDE
//
if (((PciConfigHeader->Hdr.ClassCode[0] & 0x04) != 0) || (PciConfigHeader->Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE)) {
- Private->IntThunk->PciHandler.SecondaryIrq = PciIrq;
- Private->IntThunk->PciHandler.SecondaryBase = (UINT16) (PciConfigHeader->Device.Bar[2] & 0xfffc);
- Private->IntThunk->PciHandler.SecondaryControl = (UINT16) ((PciConfigHeader->Device.Bar[3] & 0xfffc) + 2);
+ Private->IntThunk->PciHandler.SecondaryIrq = PciIrq;
+ Private->IntThunk->PciHandler.SecondaryBase = (UINT16)(PciConfigHeader->Device.Bar[2] & 0xfffc);
+ Private->IntThunk->PciHandler.SecondaryControl = (UINT16)((PciConfigHeader->Device.Bar[3] & 0xfffc) + 2);
} else {
-
- Private->IntThunk->PciHandler.SecondaryIrq = 15;
- Private->IntThunk->PciHandler.SecondaryBase = 0x170;
- Private->IntThunk->PciHandler.SecondaryControl = 0x376;
+ Private->IntThunk->PciHandler.SecondaryIrq = 15;
+ Private->IntThunk->PciHandler.SecondaryBase = 0x170;
+ Private->IntThunk->PciHandler.SecondaryControl = 0x376;
}
//
@@ -1021,20 +1032,20 @@ InstallLegacyIrqHandler (
);
Regs.X.AX = Legacy16InstallPciHandler;
- TempData = (UINTN) &Private->IntThunk->PciHandler;
- Regs.X.ES = EFI_SEGMENT ((UINT32) TempData);
- Regs.X.BX = EFI_OFFSET ((UINT32) TempData);
+ TempData = (UINTN)&Private->IntThunk->PciHandler;
+ Regs.X.ES = EFI_SEGMENT ((UINT32)TempData);
+ Regs.X.BX = EFI_OFFSET ((UINT32)TempData);
DumpPciHandle (&Private->IntThunk->PciHandler);
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ &Private->LegacyBios,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
Private->Cpu->FlushDataCache (Private->Cpu, 0xE0000, 0x20000, EfiCpuFlushTypeWriteBackInvalidate);
Private->LegacyRegion->Lock (
@@ -1043,10 +1054,8 @@ InstallLegacyIrqHandler (
0x20000,
&Granularity
);
-
}
-
/**
Program the interrupt routing register in all the PCI devices. On a PC AT system
this register contains the 8259 IRQ vector that matches its PCI interrupt.
@@ -1059,37 +1068,37 @@ InstallLegacyIrqHandler (
**/
EFI_STATUS
PciProgramAllInterruptLineRegisters (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_LEGACY_8259_PROTOCOL *Legacy8259;
- EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
- EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
- UINT8 InterruptPin;
- UINTN Index;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN MassStorageHandleCount;
- EFI_HANDLE *MassStorageHandleBuffer;
- UINTN MassStorageHandleIndex;
- UINT8 PciIrq;
- UINT16 Command;
- UINTN PciSegment;
- UINTN PciBus;
- UINTN PciDevice;
- UINTN PciFunction;
- EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable;
- UINTN RoutingTableEntries;
- UINT16 LegMask;
- UINT16 LegEdgeLevel;
- PCI_TYPE00 PciConfigHeader;
- EFI_LEGACY_PIRQ_TABLE_HEADER *PirqTable;
- UINTN PirqTableSize;
- UINTN Flags;
- HDD_INFO *HddInfo;
- UINT64 Supports;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_LEGACY_8259_PROTOCOL *Legacy8259;
+ EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;
+ EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform;
+ UINT8 InterruptPin;
+ UINTN Index;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN MassStorageHandleCount;
+ EFI_HANDLE *MassStorageHandleBuffer;
+ UINTN MassStorageHandleIndex;
+ UINT8 PciIrq;
+ UINT16 Command;
+ UINTN PciSegment;
+ UINTN PciBus;
+ UINTN PciDevice;
+ UINTN PciFunction;
+ EFI_LEGACY_IRQ_ROUTING_ENTRY *RoutingTable;
+ UINTN RoutingTableEntries;
+ UINT16 LegMask;
+ UINT16 LegEdgeLevel;
+ PCI_TYPE00 PciConfigHeader;
+ EFI_LEGACY_PIRQ_TABLE_HEADER *PirqTable;
+ UINTN PirqTableSize;
+ UINTN Flags;
+ HDD_INFO *HddInfo;
+ UINT64 Supports;
//
// Note - This routine use to return immediately if Private->PciInterruptLine
@@ -1101,15 +1110,15 @@ PciProgramAllInterruptLineRegisters (
// EFI_ALREADY_STARTED. In addition check if PCI device InterruptLine != 0.
// If zero then function unprogrammed else skip function.
//
- Legacy8259 = Private->Legacy8259;
- LegacyInterrupt = Private->LegacyInterrupt;
- LegacyBiosPlatform = Private->LegacyBiosPlatform;
+ Legacy8259 = Private->Legacy8259;
+ LegacyInterrupt = Private->LegacyInterrupt;
+ LegacyBiosPlatform = Private->LegacyBiosPlatform;
LegacyBiosPlatform->GetRoutingTable (
Private->LegacyBiosPlatform,
- (VOID *) &RoutingTable,
+ (VOID *)&RoutingTable,
&RoutingTableEntries,
- (VOID *) &PirqTable,
+ (VOID *)&PirqTable,
&PirqTableSize,
NULL,
NULL
@@ -1136,6 +1145,7 @@ PciProgramAllInterruptLineRegisters (
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
+
if (HandleCount == mHandleCount) {
FreePool (HandleBuffer);
return EFI_ALREADY_STARTED;
@@ -1164,7 +1174,7 @@ PciProgramAllInterruptLineRegisters (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
ASSERT_EFI_ERROR (Status);
@@ -1192,13 +1202,14 @@ PciProgramAllInterruptLineRegisters (
);
if (!EFI_ERROR (Status)) {
Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationEnable,
+ Supports,
+ NULL
+ );
}
+
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x04, 1, &Command);
if (EFI_ERROR (Status)) {
@@ -1238,6 +1249,7 @@ PciProgramAllInterruptLineRegisters (
&InterruptPin
);
}
+
//
// Translate InterruptPin(0-3) into PIRQ
//
@@ -1290,7 +1302,7 @@ PciProgramAllInterruptLineRegisters (
// since ConnectController may force native mode and we don't
// want that for primary IDE controller
//
- MassStorageHandleCount = 0;
+ MassStorageHandleCount = 0;
MassStorageHandleBuffer = NULL;
LegacyBiosPlatform->GetPlatformHandle (
Private->LegacyBiosPlatform,
@@ -1327,6 +1339,7 @@ PciProgramAllInterruptLineRegisters (
}
}
}
+
//
// Write InterruptPin and enable 8259.
//
@@ -1337,7 +1350,7 @@ PciProgramAllInterruptLineRegisters (
1,
&PciIrq
);
- Private->IntThunk->EfiToLegacy16BootTable.PciIrqMask = (UINT16) (Private->IntThunk->EfiToLegacy16BootTable.PciIrqMask | (UINT16) (1 << PciIrq));
+ Private->IntThunk->EfiToLegacy16BootTable.PciIrqMask = (UINT16)(Private->IntThunk->EfiToLegacy16BootTable.PciIrqMask | (UINT16)(1 << PciIrq));
Legacy8259->GetMask (
Legacy8259,
@@ -1347,8 +1360,8 @@ PciProgramAllInterruptLineRegisters (
NULL
);
- LegMask = (UINT16) (LegMask & (UINT16)~(1 << PciIrq));
- LegEdgeLevel = (UINT16) (LegEdgeLevel | (UINT16) (1 << PciIrq));
+ LegMask = (UINT16)(LegMask & (UINT16) ~(1 << PciIrq));
+ LegEdgeLevel = (UINT16)(LegEdgeLevel | (UINT16)(1 << PciIrq));
Legacy8259->SetMask (
Legacy8259,
&LegMask,
@@ -1358,11 +1371,11 @@ PciProgramAllInterruptLineRegisters (
);
}
}
+
FreePool (HandleBuffer);
return EFI_SUCCESS;
}
-
/**
Find & verify PnP Expansion header in ROM image
@@ -1377,43 +1390,43 @@ PciProgramAllInterruptLineRegisters (
**/
EFI_STATUS
FindNextPnpExpansionHeader (
- IN LEGACY_BIOS_INSTANCE *Private,
- IN BOOLEAN FirstHeader,
- IN OUT LEGACY_PNP_EXPANSION_HEADER **PnpPtr
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN BOOLEAN FirstHeader,
+ IN OUT LEGACY_PNP_EXPANSION_HEADER **PnpPtr
)
{
- UINTN TempData;
- LEGACY_PNP_EXPANSION_HEADER *LocalPnpPtr;
+ UINTN TempData;
+ LEGACY_PNP_EXPANSION_HEADER *LocalPnpPtr;
+
LocalPnpPtr = *PnpPtr;
if (FirstHeader == FIRST_INSTANCE) {
- mBasePnpPtr = LocalPnpPtr;
- mBbsRomSegment = (UINT16) ((UINTN) mBasePnpPtr >> 4);
+ mBasePnpPtr = LocalPnpPtr;
+ mBbsRomSegment = (UINT16)((UINTN)mBasePnpPtr >> 4);
//
// Offset 0x1a gives offset to PnP expansion header for the first
// instance, there after the structure gives the offset to the next
// structure
//
- LocalPnpPtr = (LEGACY_PNP_EXPANSION_HEADER *) ((UINT8 *) LocalPnpPtr + 0x1a);
- TempData = (*((UINT16 *) LocalPnpPtr));
+ LocalPnpPtr = (LEGACY_PNP_EXPANSION_HEADER *)((UINT8 *)LocalPnpPtr + 0x1a);
+ TempData = (*((UINT16 *)LocalPnpPtr));
} else {
- TempData = (UINT16) LocalPnpPtr->NextHeader;
+ TempData = (UINT16)LocalPnpPtr->NextHeader;
}
- LocalPnpPtr = (LEGACY_PNP_EXPANSION_HEADER *) (((UINT8 *) mBasePnpPtr + TempData));
+ LocalPnpPtr = (LEGACY_PNP_EXPANSION_HEADER *)(((UINT8 *)mBasePnpPtr + TempData));
//
// Search for PnP table in Shadowed ROM
//
*PnpPtr = LocalPnpPtr;
- if (*(UINT32 *) LocalPnpPtr == SIGNATURE_32 ('$', 'P', 'n', 'P')) {
+ if (*(UINT32 *)LocalPnpPtr == SIGNATURE_32 ('$', 'P', 'n', 'P')) {
return EFI_SUCCESS;
} else {
return EFI_NOT_FOUND;
}
}
-
/**
Update list of Bev or BCV table entries.
@@ -1432,38 +1445,39 @@ UpdateBevBcvTable (
IN EFI_PCI_IO_PROTOCOL *PciIo
)
{
- VOID *RomEnd;
- BBS_TABLE *BbsTable;
- UINTN BbsIndex;
- EFI_LEGACY_EXPANSION_ROM_HEADER *PciPtr;
- LEGACY_PNP_EXPANSION_HEADER *PnpPtr;
- BOOLEAN Instance;
- EFI_STATUS Status;
- UINTN Segment;
- UINTN Bus;
- UINTN Device;
- UINTN Function;
- UINT8 Class;
- UINT16 DeviceType;
- Segment = 0;
- Bus = 0;
- Device = 0;
- Function = 0;
- Class = 0;
- DeviceType = BBS_UNKNOWN;
+ VOID *RomEnd;
+ BBS_TABLE *BbsTable;
+ UINTN BbsIndex;
+ EFI_LEGACY_EXPANSION_ROM_HEADER *PciPtr;
+ LEGACY_PNP_EXPANSION_HEADER *PnpPtr;
+ BOOLEAN Instance;
+ EFI_STATUS Status;
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
+ UINT8 Class;
+ UINT16 DeviceType;
+
+ Segment = 0;
+ Bus = 0;
+ Device = 0;
+ Function = 0;
+ Class = 0;
+ DeviceType = BBS_UNKNOWN;
//
// Skip floppy and 2*onboard IDE controller entries(Master/Slave per
// controller).
//
- BbsIndex = Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries;
+ BbsIndex = Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries;
- BbsTable = (BBS_TABLE*)(UINTN) Private->IntThunk->EfiToLegacy16BootTable.BbsTable;
- PnpPtr = (LEGACY_PNP_EXPANSION_HEADER *) RomStart;
- PciPtr = (EFI_LEGACY_EXPANSION_ROM_HEADER *) RomStart;
+ BbsTable = (BBS_TABLE *)(UINTN)Private->IntThunk->EfiToLegacy16BootTable.BbsTable;
+ PnpPtr = (LEGACY_PNP_EXPANSION_HEADER *)RomStart;
+ PciPtr = (EFI_LEGACY_EXPANSION_ROM_HEADER *)RomStart;
- RomEnd = (VOID *) (PciPtr->Size512 * 512 + (UINTN) PciPtr);
- Instance = FIRST_INSTANCE;
+ RomEnd = (VOID *)(PciPtr->Size512 * 512 + (UINTN)PciPtr);
+ Instance = FIRST_INSTANCE;
//
// OPROMs like PXE may not be tied to a piece of hardware and thus
// don't have a PciIo associated with them
@@ -1494,20 +1508,21 @@ UpdateBevBcvTable (
}
while (TRUE) {
- Status = FindNextPnpExpansionHeader (Private, Instance, &PnpPtr);
- Instance = NOT_FIRST_INSTANCE;
+ Status = FindNextPnpExpansionHeader (Private, Instance, &PnpPtr);
+ Instance = NOT_FIRST_INSTANCE;
if (EFI_ERROR (Status)) {
break;
}
+
//
// There can be additional $PnP headers within the OPROM.
// Example: SCSI can have one per drive.
//
BbsTable[BbsIndex].BootPriority = BBS_UNPRIORITIZED_ENTRY;
BbsTable[BbsIndex].DeviceType = DeviceType;
- BbsTable[BbsIndex].Bus = (UINT32) Bus;
- BbsTable[BbsIndex].Device = (UINT32) Device;
- BbsTable[BbsIndex].Function = (UINT32) Function;
+ BbsTable[BbsIndex].Bus = (UINT32)Bus;
+ BbsTable[BbsIndex].Device = (UINT32)Device;
+ BbsTable[BbsIndex].Function = (UINT32)Function;
BbsTable[BbsIndex].StatusFlags.OldPosition = 0;
BbsTable[BbsIndex].StatusFlags.Reserved1 = 0;
BbsTable[BbsIndex].StatusFlags.Enabled = 0;
@@ -1532,22 +1547,21 @@ UpdateBevBcvTable (
}
if (PnpPtr->Bev != 0) {
- BbsTable[BbsIndex].BootHandlerOffset = PnpPtr->Bev;
- BbsTable[BbsIndex].DeviceType = BBS_BEV_DEVICE;
+ BbsTable[BbsIndex].BootHandlerOffset = PnpPtr->Bev;
+ BbsTable[BbsIndex].DeviceType = BBS_BEV_DEVICE;
++BbsIndex;
}
- if ((PnpPtr == (LEGACY_PNP_EXPANSION_HEADER *) PciPtr) || (PnpPtr > (LEGACY_PNP_EXPANSION_HEADER *) RomEnd)) {
+ if ((PnpPtr == (LEGACY_PNP_EXPANSION_HEADER *)PciPtr) || (PnpPtr > (LEGACY_PNP_EXPANSION_HEADER *)RomEnd)) {
break;
}
}
- BbsTable[BbsIndex].BootPriority = BBS_IGNORE_ENTRY;
- Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries = (UINT32) BbsIndex;
+ BbsTable[BbsIndex].BootPriority = BBS_IGNORE_ENTRY;
+ Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries = (UINT32)BbsIndex;
return EFI_SUCCESS;
}
-
/**
Shadow all the PCI legacy ROMs. Use data from the Legacy BIOS Protocol
to chose the order. Skip any devices that have already have legacy
@@ -1561,22 +1575,22 @@ UpdateBevBcvTable (
**/
EFI_STATUS
PciShadowRoms (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
- UINTN Index;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- EFI_HANDLE VgaHandle;
- EFI_HANDLE FirstHandle;
- VOID **RomStart;
- UINTN Flags;
- PCI_TYPE00 PciConfigHeader;
- UINT16 *Command;
- UINT64 Supports;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 Pci;
+ UINTN Index;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ EFI_HANDLE VgaHandle;
+ EFI_HANDLE FirstHandle;
+ VOID **RomStart;
+ UINTN Flags;
+ PCI_TYPE00 PciConfigHeader;
+ UINT16 *Command;
+ UINT64 Supports;
//
// Make the VGA device first
@@ -1606,6 +1620,7 @@ PciShadowRoms (
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Place the VGA handle as first.
//
@@ -1617,27 +1632,28 @@ PciShadowRoms (
break;
}
}
+
//
// Allocate memory to save Command WORD from each device. We do this
// to restore devices to same state as EFI after switching to legacy.
//
- Command = (UINT16 *) AllocatePool (
- sizeof (UINT16) * (HandleCount + 1)
- );
+ Command = (UINT16 *)AllocatePool (
+ sizeof (UINT16) * (HandleCount + 1)
+ );
if (NULL == Command) {
FreePool (HandleBuffer);
return EFI_OUT_OF_RESOURCES;
}
+
//
// Disconnect all EFI devices first. This covers cases where alegacy BIOS
// may control multiple PCI devices.
//
for (Index = 0; Index < HandleCount; Index++) {
-
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
ASSERT_EFI_ERROR (Status);
@@ -1659,6 +1675,7 @@ PciShadowRoms (
if (!EFI_ERROR (Status)) {
continue;
}
+
//
// Stop EFI Drivers with oprom.
//
@@ -1668,15 +1685,15 @@ PciShadowRoms (
NULL
);
}
+
//
// For every device that has not had a legacy ROM started. Start a legacy ROM.
//
for (Index = 0; Index < HandleCount; Index++) {
-
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
ASSERT_EFI_ERROR (Status);
@@ -1698,9 +1715,10 @@ PciShadowRoms (
// one will work in legacy mode (OPROM will be given control) and
// other Video devices will work in native mode (OS driver will handle these devices).
//
- if (IS_PCI_DISPLAY (&Pci) && Index != 0) {
+ if (IS_PCI_DISPLAY (&Pci) && (Index != 0)) {
continue;
}
+
//
// Skip any device that already has a legacy ROM run
//
@@ -1712,7 +1730,7 @@ PciShadowRoms (
//
// If legacy VBIOS Oprom has not been dispatched before, install legacy VBIOS here.
//
- if (IS_PCI_DISPLAY (&Pci) && Index == 0) {
+ if (IS_PCI_DISPLAY (&Pci) && (Index == 0)) {
Status = LegacyBiosInstallVgaRom (Private);
//
// A return status of EFI_NOT_FOUND is considered valid (No EFI
@@ -1732,7 +1750,7 @@ PciShadowRoms (
&Flags,
NULL,
NULL,
- (VOID **) &RomStart,
+ (VOID **)&RomStart,
NULL
);
if (EFI_ERROR (Status)) {
@@ -1740,6 +1758,7 @@ PciShadowRoms (
continue;
}
}
+
//
// Restore Command register so legacy has same devices enabled or disabled
// as EFI.
@@ -1766,13 +1785,14 @@ PciShadowRoms (
);
if (!EFI_ERROR (Status)) {
Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationEnable,
+ Supports,
+ NULL
+ );
}
+
if (!EFI_ERROR (Status)) {
Command[Index] = 0x1f;
}
@@ -1793,7 +1813,6 @@ PciShadowRoms (
return EFI_SUCCESS;
}
-
/**
Test to see if a legacy PCI ROM exists for this device. Optionally return
the Legacy ROM instance for this PCI device.
@@ -1812,11 +1831,11 @@ PciShadowRoms (
EFI_STATUS
EFIAPI
LegacyBiosCheckPciRom (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN EFI_HANDLE PciHandle,
- OUT VOID **RomImage OPTIONAL,
- OUT UINTN *RomSize OPTIONAL,
- OUT UINTN *Flags
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ OUT VOID **RomImage OPTIONAL,
+ OUT UINTN *RomSize OPTIONAL,
+ OUT UINTN *Flags
)
{
return LegacyBiosCheckPciRomEx (
@@ -1829,7 +1848,6 @@ LegacyBiosCheckPciRom (
NULL,
NULL
);
-
}
/**
@@ -1854,31 +1872,31 @@ LegacyBiosCheckPciRom (
**/
EFI_STATUS
LegacyBiosCheckPciRomEx (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN EFI_HANDLE PciHandle,
- OUT VOID **RomImage OPTIONAL,
- OUT UINTN *RomSize OPTIONAL,
- OUT UINTN *RuntimeImageLength OPTIONAL,
- OUT UINTN *Flags OPTIONAL,
- OUT UINT8 *OpromRevision OPTIONAL,
- OUT VOID **ConfigUtilityCodeHeader OPTIONAL
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ OUT VOID **RomImage OPTIONAL,
+ OUT UINTN *RomSize OPTIONAL,
+ OUT UINTN *RuntimeImageLength OPTIONAL,
+ OUT UINTN *Flags OPTIONAL,
+ OUT UINT8 *OpromRevision OPTIONAL,
+ OUT VOID **ConfigUtilityCodeHeader OPTIONAL
)
{
- EFI_STATUS Status;
- LEGACY_BIOS_INSTANCE *Private;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINTN LocalRomSize;
- VOID *LocalRomImage;
- PCI_TYPE00 PciConfigHeader;
- VOID *LocalConfigUtilityCodeHeader;
+ EFI_STATUS Status;
+ LEGACY_BIOS_INSTANCE *Private;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN LocalRomSize;
+ VOID *LocalRomImage;
+ PCI_TYPE00 PciConfigHeader;
+ VOID *LocalConfigUtilityCodeHeader;
LocalConfigUtilityCodeHeader = NULL;
- *Flags = NO_ROM;
- Status = gBS->HandleProtocol (
- PciHandle,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
- );
+ *Flags = NO_ROM;
+ Status = gBS->HandleProtocol (
+ PciHandle,
+ &gEfiPciIoProtocolGuid,
+ (VOID **)&PciIo
+ );
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
@@ -1891,10 +1909,11 @@ LegacyBiosCheckPciRomEx (
*Flags |= (UINTN)(ROM_FOUND | VALID_LEGACY_ROM);
return EFI_SUCCESS;
}
+
//
// Check for PCI ROM Bar
//
- LocalRomSize = (UINTN) PciIo->RomSize;
+ LocalRomSize = (UINTN)PciIo->RomSize;
LocalRomImage = PciIo->RomImage;
if (LocalRomSize != 0) {
*Flags |= ROM_FOUND;
@@ -1912,16 +1931,16 @@ LegacyBiosCheckPciRomEx (
);
Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
- Status = GetPciLegacyRom (
- Private->Csm16PciInterfaceVersion,
- PciConfigHeader.Hdr.VendorId,
- PciConfigHeader.Hdr.DeviceId,
- &LocalRomImage,
- &LocalRomSize,
- RuntimeImageLength,
- OpromRevision,
- &LocalConfigUtilityCodeHeader
- );
+ Status = GetPciLegacyRom (
+ Private->Csm16PciInterfaceVersion,
+ PciConfigHeader.Hdr.VendorId,
+ PciConfigHeader.Hdr.DeviceId,
+ &LocalRomImage,
+ &LocalRomSize,
+ RuntimeImageLength,
+ OpromRevision,
+ &LocalConfigUtilityCodeHeader
+ );
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
@@ -1964,11 +1983,11 @@ EnablePs2Keyboard (
VOID
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- EFI_ISA_IO_PROTOCOL *IsaIo;
- UINTN Index;
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ EFI_ISA_IO_PROTOCOL *IsaIo;
+ UINTN Index;
//
// Get SimpleTextIn and find PS2 controller
@@ -1983,6 +2002,7 @@ EnablePs2Keyboard (
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
+
for (Index = 0; Index < HandleCount; Index++) {
//
// Open the IO Abstraction(s) needed to perform the supported test
@@ -1990,7 +2010,7 @@ EnablePs2Keyboard (
Status = gBS->OpenProtocol (
HandleBuffer[Index],
&gEfiIsaIoProtocolGuid,
- (VOID **) &IsaIo,
+ (VOID **)&IsaIo,
NULL,
HandleBuffer[Index],
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
@@ -2001,7 +2021,7 @@ EnablePs2Keyboard (
// Use the ISA I/O Protocol to see if Controller is the Keyboard
// controller
//
- if (IsaIo->ResourceList->Device.HID != EISA_PNP_ID (0x303) || IsaIo->ResourceList->Device.UID != 0) {
+ if ((IsaIo->ResourceList->Device.HID != EISA_PNP_ID (0x303)) || (IsaIo->ResourceList->Device.UID != 0)) {
Status = EFI_UNSUPPORTED;
}
@@ -2017,11 +2037,11 @@ EnablePs2Keyboard (
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, FALSE);
}
}
+
FreePool (HandleBuffer);
return EFI_SUCCESS;
}
-
/**
Load a legacy PC-AT OpROM for VGA controller.
@@ -2035,7 +2055,7 @@ EnablePs2Keyboard (
**/
EFI_STATUS
LegacyBiosInstallVgaRom (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
EFI_STATUS Status;
@@ -2103,7 +2123,7 @@ LegacyBiosInstallVgaRom (
Status = gBS->HandleProtocol (
OpenInfoBuffer[Index].AgentHandle,
&gEfiLegacyBiosGuid,
- (VOID **) &Interface
+ (VOID **)&Interface
);
if (!EFI_ERROR (Status)) {
//
@@ -2132,19 +2152,20 @@ LegacyBiosInstallVgaRom (
return Status;
}
}
+
//
// Find all the Thunk Driver
//
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiLegacyBiosGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiLegacyBiosGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
ASSERT_EFI_ERROR (Status);
- ConnectHandleBuffer = (EFI_HANDLE *) AllocatePool (sizeof (EFI_HANDLE) * (HandleCount + 1));
+ ConnectHandleBuffer = (EFI_HANDLE *)AllocatePool (sizeof (EFI_HANDLE) * (HandleCount + 1));
ASSERT (ConnectHandleBuffer != NULL);
CopyMem (
@@ -2162,7 +2183,7 @@ LegacyBiosInstallVgaRom (
Status = gBS->HandleProtocol (
VgaHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
ASSERT_EFI_ERROR (Status);
PciIo->Pci.Read (
@@ -2208,7 +2229,6 @@ LegacyBiosInstallVgaRom (
FreePool (ConnectHandleBuffer);
if (EFI_ERROR (Status)) {
-
Private->VgaInstalled = FALSE;
//
@@ -2221,7 +2241,6 @@ LegacyBiosInstallVgaRom (
return EFI_SUCCESS;
}
-
/**
Load a legacy PC-AT OpROM.
@@ -2249,41 +2268,41 @@ LegacyBiosInstallVgaRom (
EFI_STATUS
EFIAPI
LegacyBiosInstallRom (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN LEGACY_BIOS_INSTANCE *Private,
- IN EFI_HANDLE PciHandle,
- IN UINT8 OpromRevision,
- IN VOID *RomImage,
- IN UINTN ImageSize,
- IN OUT UINTN *RuntimeImageLength,
- OUT UINT8 *DiskStart OPTIONAL,
- OUT UINT8 *DiskEnd OPTIONAL,
- OUT VOID **RomShadowAddress OPTIONAL
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN LEGACY_BIOS_INSTANCE *Private,
+ IN EFI_HANDLE PciHandle,
+ IN UINT8 OpromRevision,
+ IN VOID *RomImage,
+ IN UINTN ImageSize,
+ IN OUT UINTN *RuntimeImageLength,
+ OUT UINT8 *DiskStart OPTIONAL,
+ OUT UINT8 *DiskEnd OPTIONAL,
+ OUT VOID **RomShadowAddress OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_STATUS PciEnableStatus;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 LocalDiskStart;
- UINT8 LocalDiskEnd;
- UINTN Segment;
- UINTN Bus;
- UINTN Device;
- UINTN Function;
- EFI_IA32_REGISTER_SET Regs;
- UINT8 VideoMode;
- UINT8 OldVideoMode;
- EFI_TIME BootTime;
- UINT32 *BdaPtr;
- UINT32 LocalTime;
- UINT32 StartBbsIndex;
- UINT32 EndBbsIndex;
- UINT32 MaxRomAddr;
- UINTN TempData;
- UINTN InitAddress;
- UINTN RuntimeAddress;
- EFI_PHYSICAL_ADDRESS PhysicalAddress;
- UINT32 Granularity;
+ EFI_STATUS Status;
+ EFI_STATUS PciEnableStatus;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINT8 LocalDiskStart;
+ UINT8 LocalDiskEnd;
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
+ EFI_IA32_REGISTER_SET Regs;
+ UINT8 VideoMode;
+ UINT8 OldVideoMode;
+ EFI_TIME BootTime;
+ UINT32 *BdaPtr;
+ UINT32 LocalTime;
+ UINT32 StartBbsIndex;
+ UINT32 EndBbsIndex;
+ UINT32 MaxRomAddr;
+ UINTN TempData;
+ UINTN InitAddress;
+ UINTN RuntimeAddress;
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;
+ UINT32 Granularity;
PciIo = NULL;
LocalDiskStart = 0;
@@ -2297,14 +2316,14 @@ LegacyBiosInstallRom (
PhysicalAddress = 0;
MaxRomAddr = PcdGet32 (PcdEndOpromShadowAddress);
- if ((Private->Legacy16Table->TableLength >= OFFSET_OF(EFI_COMPATIBILITY16_TABLE, HiPermanentMemoryAddress)) &&
+ if ((Private->Legacy16Table->TableLength >= OFFSET_OF (EFI_COMPATIBILITY16_TABLE, HiPermanentMemoryAddress)) &&
(Private->Legacy16Table->UmaAddress != 0) &&
(Private->Legacy16Table->UmaSize != 0) &&
- (MaxRomAddr > (Private->Legacy16Table->UmaAddress))) {
+ (MaxRomAddr > (Private->Legacy16Table->UmaAddress)))
+ {
MaxRomAddr = Private->Legacy16Table->UmaAddress;
}
-
PciProgramAllInterruptLineRegisters (Private);
if ((OpromRevision >= 3) && (Private->Csm16PciInterfaceVersion >= 0x0300)) {
@@ -2313,12 +2332,12 @@ LegacyBiosInstallRom (
// first test if there is enough space for its INIT code
//
PhysicalAddress = CONVENTIONAL_MEMORY_TOP;
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiBootServicesCode,
- EFI_SIZE_TO_PAGES (ImageSize),
- &PhysicalAddress
- );
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiBootServicesCode,
+ EFI_SIZE_TO_PAGES (ImageSize),
+ &PhysicalAddress
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", DEBUG_LINE_NUMBER));
@@ -2331,7 +2350,8 @@ LegacyBiosInstallRom (
);
return EFI_OUT_OF_RESOURCES;
}
- InitAddress = (UINTN) PhysicalAddress;
+
+ InitAddress = (UINTN)PhysicalAddress;
//
// then test if there is enough space for its RT code
//
@@ -2353,7 +2373,7 @@ LegacyBiosInstallRom (
// CSM16 2.x meets PCI 2.x/3.0 OpROM
// test if there is enough space for its INIT code
//
- InitAddress = PCI_START_ADDRESS (Private->OptionRom);
+ InitAddress = PCI_START_ADDRESS (Private->OptionRom);
if (InitAddress + ImageSize > MaxRomAddr) {
DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", DEBUG_LINE_NUMBER));
//
@@ -2378,14 +2398,14 @@ LegacyBiosInstallRom (
Private->LegacyRegion->UnLock (
Private->LegacyRegion,
- (UINT32) RuntimeAddress,
- (UINT32) ImageSize,
+ (UINT32)RuntimeAddress,
+ (UINT32)ImageSize,
&Granularity
);
DEBUG ((DEBUG_INFO, " Shadowing OpROM init/runtime/isize = %x/%x/%x\n", InitAddress, RuntimeAddress, ImageSize));
- CopyMem ((VOID *) InitAddress, RomImage, ImageSize);
+ CopyMem ((VOID *)InitAddress, RomImage, ImageSize);
//
// Read the highest disk number "installed: and assume a new disk will
@@ -2397,32 +2417,32 @@ LegacyBiosInstallRom (
// 3. Onboard IDE controllers will change 40:75
//
ACCESS_PAGE0_CODE (
- LocalDiskStart = (UINT8) ((*(UINT8 *) ((UINTN) 0x475)) + 0x80);
+ LocalDiskStart = (UINT8)((*(UINT8 *)((UINTN)0x475)) + 0x80);
if ((Private->Disk4075 + 0x80) < LocalDiskStart) {
- //
- // Update table since onboard IDE drives found
- //
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciSegment = 0xff;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciBus = 0xff;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciDevice = 0xff;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciFunction = 0xff;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].StartDriveNumber = (UINT8) (Private->Disk4075 + 0x80);
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].EndDriveNumber = LocalDiskStart;
- Private->LegacyEfiHddTableIndex ++;
- Private->Disk4075 = (UINT8) (LocalDiskStart & 0x7f);
- Private->DiskEnd = LocalDiskStart;
- }
+ //
+ // Update table since onboard IDE drives found
+ //
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciSegment = 0xff;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciBus = 0xff;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciDevice = 0xff;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciFunction = 0xff;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].StartDriveNumber = (UINT8)(Private->Disk4075 + 0x80);
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].EndDriveNumber = LocalDiskStart;
+ Private->LegacyEfiHddTableIndex++;
+ Private->Disk4075 = (UINT8)(LocalDiskStart & 0x7f);
+ Private->DiskEnd = LocalDiskStart;
+ }
if (PciHandle != mVgaHandle) {
+ EnablePs2Keyboard ();
- EnablePs2Keyboard ();
+ //
+ // Store current mode settings since PrepareToScanRom may change mode.
+ //
+ VideoMode = *(UINT8 *)((UINTN)(0x400 + BDA_VIDEO_MODE));
+ }
- //
- // Store current mode settings since PrepareToScanRom may change mode.
- //
- VideoMode = *(UINT8 *) ((UINTN) (0x400 + BDA_VIDEO_MODE));
- }
- );
+ );
//
// Notify the platform that we are about to scan the ROM
@@ -2466,9 +2486,9 @@ LegacyBiosInstallRom (
//
ACCESS_PAGE0_CODE (
LocalTime = (LocalTime * 182) / 10;
- BdaPtr = (UINT32 *) ((UINTN) 0x46C);
+ BdaPtr = (UINT32 *)((UINTN)0x46C);
*BdaPtr = LocalTime;
- );
+ );
//
// Pass in handoff data
@@ -2476,11 +2496,10 @@ LegacyBiosInstallRom (
PciEnableStatus = EFI_UNSUPPORTED;
ZeroMem (&Regs, sizeof (Regs));
if (PciHandle != NULL) {
-
Status = gBS->HandleProtocol (
PciHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
ASSERT_EFI_ERROR (Status);
@@ -2504,23 +2523,23 @@ LegacyBiosInstallRom (
DEBUG ((DEBUG_INFO, "Shadowing OpROM on the PCI device %x/%x/%x\n", Bus, Device, Function));
}
- mIgnoreBbsUpdateFlag = FALSE;
- Regs.X.AX = Legacy16DispatchOprom;
+ mIgnoreBbsUpdateFlag = FALSE;
+ Regs.X.AX = Legacy16DispatchOprom;
//
// Generate DispatchOpRomTable data
//
Private->IntThunk->DispatchOpromTable.PnPInstallationCheckSegment = Private->Legacy16Table->PnPInstallationCheckSegment;
Private->IntThunk->DispatchOpromTable.PnPInstallationCheckOffset = Private->Legacy16Table->PnPInstallationCheckOffset;
- Private->IntThunk->DispatchOpromTable.OpromSegment = (UINT16) (InitAddress >> 4);
- Private->IntThunk->DispatchOpromTable.PciBus = (UINT8) Bus;
- Private->IntThunk->DispatchOpromTable.PciDeviceFunction = (UINT8) ((Device << 3) | Function);
- Private->IntThunk->DispatchOpromTable.NumberBbsEntries = (UINT8) Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries;
- Private->IntThunk->DispatchOpromTable.BbsTablePointer = (UINT32) (UINTN) Private->BbsTablePtr;
+ Private->IntThunk->DispatchOpromTable.OpromSegment = (UINT16)(InitAddress >> 4);
+ Private->IntThunk->DispatchOpromTable.PciBus = (UINT8)Bus;
+ Private->IntThunk->DispatchOpromTable.PciDeviceFunction = (UINT8)((Device << 3) | Function);
+ Private->IntThunk->DispatchOpromTable.NumberBbsEntries = (UINT8)Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries;
+ Private->IntThunk->DispatchOpromTable.BbsTablePointer = (UINT32)(UINTN)Private->BbsTablePtr;
Private->IntThunk->DispatchOpromTable.RuntimeSegment = (UINT16)((OpromRevision < 3) ? 0xffff : (RuntimeAddress >> 4));
- TempData = (UINTN) &Private->IntThunk->DispatchOpromTable;
- Regs.X.ES = EFI_SEGMENT ((UINT32) TempData);
- Regs.X.BX = EFI_OFFSET ((UINT32) TempData);
+ TempData = (UINTN)&Private->IntThunk->DispatchOpromTable;
+ Regs.X.ES = EFI_SEGMENT ((UINT32)TempData);
+ Regs.X.BX = EFI_OFFSET ((UINT32)TempData);
//
// Skip dispatching ROM for those PCI devices that can not be enabled by PciIo->Attributes
// Otherwise, it may cause the system to hang in some cases
@@ -2528,35 +2547,37 @@ LegacyBiosInstallRom (
if (!EFI_ERROR (PciEnableStatus)) {
DEBUG ((DEBUG_INFO, " Legacy16DispatchOprom - %02x/%02x/%02x\n", Bus, Device, Function));
Private->LegacyBios.FarCall86 (
- &Private->LegacyBios,
- Private->Legacy16CallSegment,
- Private->Legacy16CallOffset,
- &Regs,
- NULL,
- 0
- );
+ &Private->LegacyBios,
+ Private->Legacy16CallSegment,
+ Private->Legacy16CallOffset,
+ &Regs,
+ NULL,
+ 0
+ );
} else {
Regs.X.BX = 0;
}
- if (Private->IntThunk->DispatchOpromTable.NumberBbsEntries != (UINT8) Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries) {
- Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries = (UINT8) Private->IntThunk->DispatchOpromTable.NumberBbsEntries;
- mIgnoreBbsUpdateFlag = TRUE;
+ if (Private->IntThunk->DispatchOpromTable.NumberBbsEntries != (UINT8)Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries) {
+ Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries = (UINT8)Private->IntThunk->DispatchOpromTable.NumberBbsEntries;
+ mIgnoreBbsUpdateFlag = TRUE;
}
+
//
// Check if non-BBS compliant drives found
//
if (Regs.X.BX != 0) {
- LocalDiskEnd = (UINT8) (LocalDiskStart + Regs.H.BL);
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciSegment = (UINT8) Segment;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciBus = (UINT8) Bus;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciDevice = (UINT8) Device;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciFunction = (UINT8) Function;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].StartDriveNumber = Private->DiskEnd;
- Private->DiskEnd = LocalDiskEnd;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].EndDriveNumber = Private->DiskEnd;
- Private->LegacyEfiHddTableIndex += 1;
+ LocalDiskEnd = (UINT8)(LocalDiskStart + Regs.H.BL);
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciSegment = (UINT8)Segment;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciBus = (UINT8)Bus;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciDevice = (UINT8)Device;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciFunction = (UINT8)Function;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].StartDriveNumber = Private->DiskEnd;
+ Private->DiskEnd = LocalDiskEnd;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].EndDriveNumber = Private->DiskEnd;
+ Private->LegacyEfiHddTableIndex += 1;
}
+
//
// Skip video mode set, if installing VGA
//
@@ -2564,9 +2585,11 @@ LegacyBiosInstallRom (
//
// Set mode settings since PrepareToScanRom may change mode
//
- ACCESS_PAGE0_CODE ({
- OldVideoMode = *(UINT8 *) ((UINTN) (0x400 + BDA_VIDEO_MODE));
- });
+ ACCESS_PAGE0_CODE (
+ {
+ OldVideoMode = *(UINT8 *)((UINTN)(0x400 + BDA_VIDEO_MODE));
+ }
+ );
if (VideoMode != OldVideoMode) {
//
@@ -2577,6 +2600,7 @@ LegacyBiosInstallRom (
Private->LegacyBios.Int86 (&Private->LegacyBios, 0x10, &Regs);
}
}
+
//
// Regs.X.AX from the adapter initializion is ignored since some adapters
// do not follow the standard of setting AX = 0 on success.
@@ -2584,14 +2608,14 @@ LegacyBiosInstallRom (
//
// The ROM could have updated its size so we need to read again.
//
- if (((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
+ if (((EFI_LEGACY_EXPANSION_ROM_HEADER *)RuntimeAddress)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
//
// Now we check the signature (0xaa55) to judge whether the run-time code is truly generated by INIT function.
// If signature is not valid, that means the INIT function didn't copy the run-time code to RuntimeAddress.
//
*RuntimeImageLength = 0;
} else {
- *RuntimeImageLength = ((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Size512 * 512;
+ *RuntimeImageLength = ((EFI_LEGACY_EXPANSION_ROM_HEADER *)RuntimeAddress)->Size512 * 512;
}
DEBUG ((DEBUG_INFO, " fsize = %x\n", *RuntimeImageLength));
@@ -2604,13 +2628,13 @@ LegacyBiosInstallRom (
//
// Make area from end of shadowed rom to end of original rom all ffs
//
- gBS->SetMem ((VOID *) (InitAddress + *RuntimeImageLength), ImageSize - *RuntimeImageLength, 0xff);
+ gBS->SetMem ((VOID *)(InitAddress + *RuntimeImageLength), ImageSize - *RuntimeImageLength, 0xff);
}
}
ACCESS_PAGE0_CODE (
- LocalDiskEnd = (UINT8) ((*(UINT8 *) ((UINTN) 0x475)) + 0x80);
- );
+ LocalDiskEnd = (UINT8)((*(UINT8 *)((UINTN)0x475)) + 0x80);
+ );
//
// Allow platform to perform any required actions after the
@@ -2634,29 +2658,30 @@ LegacyBiosInstallRom (
TempData = RuntimeAddress;
UpdateBevBcvTable (
Private,
- (EFI_LEGACY_EXPANSION_ROM_HEADER *) TempData,
+ (EFI_LEGACY_EXPANSION_ROM_HEADER *)TempData,
PciIo
);
- EndBbsIndex = Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries;
- LocalDiskEnd = (UINT8) (LocalDiskStart + (UINT8) (EndBbsIndex - StartBbsIndex));
+ EndBbsIndex = Private->IntThunk->EfiToLegacy16BootTable.NumberBbsEntries;
+ LocalDiskEnd = (UINT8)(LocalDiskStart + (UINT8)(EndBbsIndex - StartBbsIndex));
if (LocalDiskEnd != LocalDiskStart) {
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciSegment = (UINT8) Segment;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciBus = (UINT8) Bus;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciDevice = (UINT8) Device;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciFunction = (UINT8) Function;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].StartDriveNumber = Private->DiskEnd;
- Private->DiskEnd = LocalDiskEnd;
- Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].EndDriveNumber = Private->DiskEnd;
- Private->LegacyEfiHddTableIndex += 1;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciSegment = (UINT8)Segment;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciBus = (UINT8)Bus;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciDevice = (UINT8)Device;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].PciFunction = (UINT8)Function;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].StartDriveNumber = Private->DiskEnd;
+ Private->DiskEnd = LocalDiskEnd;
+ Private->LegacyEfiHddTable[Private->LegacyEfiHddTableIndex].EndDriveNumber = Private->DiskEnd;
+ Private->LegacyEfiHddTableIndex += 1;
}
}
+
//
// Mark PCI device as having a legacy BIOS ROM loaded.
//
RomShadow (
PciHandle,
- (UINT32) RuntimeAddress,
- (UINT32) *RuntimeImageLength,
+ (UINT32)RuntimeAddress,
+ (UINT32)*RuntimeImageLength,
LocalDiskStart,
LocalDiskEnd
);
@@ -2666,7 +2691,7 @@ LegacyBiosInstallRom (
// Stuff caller's OPTIONAL return parameters.
//
if (RomShadowAddress != NULL) {
- *RomShadowAddress = (VOID *) RuntimeAddress;
+ *RomShadowAddress = (VOID *)RuntimeAddress;
}
if (DiskStart != NULL) {
@@ -2677,7 +2702,7 @@ LegacyBiosInstallRom (
*DiskEnd = LocalDiskEnd;
}
- Private->OptionRom = (UINT32) (RuntimeAddress + *RuntimeImageLength);
+ Private->OptionRom = (UINT32)(RuntimeAddress + *RuntimeImageLength);
Status = EFI_SUCCESS;
@@ -2713,14 +2738,14 @@ Done:
**/
EFI_STATUS
IoMmuGrantAccess (
- IN EFI_HANDLE PciHandle,
- IN EFI_PHYSICAL_ADDRESS HostAddress,
- IN UINTN NumberOfBytes
+ IN EFI_HANDLE PciHandle,
+ IN EFI_PHYSICAL_ADDRESS HostAddress,
+ IN UINTN NumberOfBytes
)
{
- EFI_PHYSICAL_ADDRESS DeviceAddress;
- VOID *Mapping;
- EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS DeviceAddress;
+ VOID *Mapping;
+ EFI_STATUS Status;
if (PciHandle == NULL) {
return EFI_UNSUPPORTED;
@@ -2730,6 +2755,7 @@ IoMmuGrantAccess (
if (mIoMmu == NULL) {
gBS->LocateProtocol (&gEdkiiIoMmuProtocolGuid, NULL, (VOID **)&mIoMmu);
}
+
if (mIoMmu != NULL) {
Status = mIoMmu->Map (
mIoMmu,
@@ -2739,7 +2765,7 @@ IoMmuGrantAccess (
&DeviceAddress,
&Mapping
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "LegacyPci - IoMmuMap - %r\n", Status));
} else {
ASSERT (DeviceAddress == HostAddress);
@@ -2749,11 +2775,12 @@ IoMmuGrantAccess (
Mapping,
EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "LegacyPci - IoMmuSetAttribute - %r\n", Status));
}
}
}
+
return Status;
}
@@ -2787,34 +2814,34 @@ IoMmuGrantAccess (
EFI_STATUS
EFIAPI
LegacyBiosInstallPciRom (
- IN EFI_LEGACY_BIOS_PROTOCOL * This,
- IN EFI_HANDLE PciHandle,
- IN VOID **RomImage,
- OUT UINTN *Flags,
- OUT UINT8 *DiskStart OPTIONAL,
- OUT UINT8 *DiskEnd OPTIONAL,
- OUT VOID **RomShadowAddress OPTIONAL,
- OUT UINT32 *RomShadowedSize OPTIONAL
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ IN VOID **RomImage,
+ OUT UINTN *Flags,
+ OUT UINT8 *DiskStart OPTIONAL,
+ OUT UINT8 *DiskEnd OPTIONAL,
+ OUT VOID **RomShadowAddress OPTIONAL,
+ OUT UINT32 *RomShadowedSize OPTIONAL
)
{
- EFI_STATUS Status;
- LEGACY_BIOS_INSTANCE *Private;
- VOID *LocalRomImage;
- UINTN ImageSize;
- UINTN RuntimeImageLength;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE01 PciConfigHeader;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN PciSegment;
- UINTN PciBus;
- UINTN PciDevice;
- UINTN PciFunction;
- UINTN LastBus;
- UINTN Index;
- UINT8 OpromRevision;
- UINT32 Granularity;
- PCI_3_0_DATA_STRUCTURE *Pcir;
+ EFI_STATUS Status;
+ LEGACY_BIOS_INSTANCE *Private;
+ VOID *LocalRomImage;
+ UINTN ImageSize;
+ UINTN RuntimeImageLength;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE01 PciConfigHeader;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN PciSegment;
+ UINTN PciBus;
+ UINTN PciDevice;
+ UINTN PciFunction;
+ UINTN LastBus;
+ UINTN Index;
+ UINT8 OpromRevision;
+ UINT32 Granularity;
+ PCI_3_0_DATA_STRUCTURE *Pcir;
OpromRevision = 0;
@@ -2836,7 +2863,7 @@ LegacyBiosInstallPciRom (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
if (EFI_ERROR (Status)) {
continue;
@@ -2860,7 +2887,7 @@ LegacyBiosInstallPciRom (
0x20000,
&Granularity
);
- Private->Legacy16Table->LastPciBus = (UINT8) LastBus;
+ Private->Legacy16Table->LastPciBus = (UINT8)LastBus;
Private->LegacyRegion->Lock (
Private->LegacyRegion,
0xE0000,
@@ -2878,7 +2905,7 @@ LegacyBiosInstallPciRom (
Status = gBS->HandleProtocol (
PciHandle,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo
+ (VOID **)&PciIo
);
if (!EFI_ERROR (Status)) {
@@ -2894,16 +2921,17 @@ LegacyBiosInstallPciRom (
// if video installed & OPROM is video return
//
if (
- (
- ((PciConfigHeader.Hdr.ClassCode[2] == PCI_CLASS_OLD) &&
- (PciConfigHeader.Hdr.ClassCode[1] == PCI_CLASS_OLD_VGA))
- ||
- ((PciConfigHeader.Hdr.ClassCode[2] == PCI_CLASS_DISPLAY) &&
- (PciConfigHeader.Hdr.ClassCode[1] == PCI_CLASS_DISPLAY_VGA))
- )
- &&
- (!Private->VgaInstalled)
- ) {
+ (
+ ((PciConfigHeader.Hdr.ClassCode[2] == PCI_CLASS_OLD) &&
+ (PciConfigHeader.Hdr.ClassCode[1] == PCI_CLASS_OLD_VGA))
+ ||
+ ((PciConfigHeader.Hdr.ClassCode[2] == PCI_CLASS_DISPLAY) &&
+ (PciConfigHeader.Hdr.ClassCode[1] == PCI_CLASS_DISPLAY_VGA))
+ )
+ &&
+ (!Private->VgaInstalled)
+ )
+ {
mVgaInstallationInProgress = TRUE;
//
@@ -2911,6 +2939,7 @@ LegacyBiosInstallPciRom (
//
}
}
+
//
// To run any legacy image, the VGA needs to be installed first.
// if installing the video, then don't need the thunk as already installed.
@@ -2931,8 +2960,8 @@ LegacyBiosInstallPciRom (
// A return status of EFI_NOT_FOUND is considered valid (No EFI
// driver is controlling video.
//
- mVgaInstallationInProgress = TRUE;
- Status = LegacyBiosInstallVgaRom (Private);
+ mVgaInstallationInProgress = TRUE;
+ Status = LegacyBiosInstallVgaRom (Private);
if (EFI_ERROR (Status)) {
if (Status != EFI_NOT_FOUND) {
mVgaInstallationInProgress = FALSE;
@@ -2943,6 +2972,7 @@ LegacyBiosInstallPciRom (
}
}
}
+
//
// See if the option ROM for PciHandle has already been executed
//
@@ -2955,7 +2985,7 @@ LegacyBiosInstallPciRom (
DiskStart,
DiskEnd,
RomShadowAddress,
- (UINTN *) RomShadowedSize
+ (UINTN *)RomShadowedSize
);
return EFI_SUCCESS;
}
@@ -2999,8 +3029,8 @@ LegacyBiosInstallPciRom (
// A return status of EFI_NOT_FOUND is considered valid (No EFI
// driver is controlling video.
//
- mVgaInstallationInProgress = TRUE;
- Status = LegacyBiosInstallVgaRom (Private);
+ mVgaInstallationInProgress = TRUE;
+ Status = LegacyBiosInstallVgaRom (Private);
if (EFI_ERROR (Status)) {
if (Status != EFI_NOT_FOUND) {
mVgaInstallationInProgress = FALSE;
@@ -3012,15 +3042,16 @@ LegacyBiosInstallPciRom (
}
LocalRomImage = *RomImage;
- if (((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE ||
- ((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->PcirOffset == 0 ||
- (((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->PcirOffset & 3 ) != 0) {
+ if ((((PCI_EXPANSION_ROM_HEADER *)LocalRomImage)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) ||
+ (((PCI_EXPANSION_ROM_HEADER *)LocalRomImage)->PcirOffset == 0) ||
+ ((((PCI_EXPANSION_ROM_HEADER *)LocalRomImage)->PcirOffset & 3) != 0))
+ {
mVgaInstallationInProgress = FALSE;
return EFI_UNSUPPORTED;
}
Pcir = (PCI_3_0_DATA_STRUCTURE *)
- ((UINT8 *) LocalRomImage + ((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->PcirOffset);
+ ((UINT8 *)LocalRomImage + ((PCI_EXPANSION_ROM_HEADER *)LocalRomImage)->PcirOffset);
if ((Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) || (Pcir->CodeType != PCI_CODE_TYPE_PCAT_IMAGE)) {
mVgaInstallationInProgress = FALSE;
@@ -3033,6 +3064,7 @@ LegacyBiosInstallPciRom (
} else {
OpromRevision = 0;
}
+
if (Pcir->Revision < 3) {
RuntimeImageLength = 0;
} else {
@@ -3059,22 +3091,22 @@ LegacyBiosInstallPciRom (
//
ASSERT (Private->TraceIndex < 0x200);
Private->Trace[Private->TraceIndex] = LEGACY_PCI_TRACE_000;
- Private->TraceIndex ++;
- Private->TraceIndex = (UINT16) (Private->TraceIndex % 0x200);
- Status = LegacyBiosInstallRom (
- This,
- Private,
- PciHandle,
- OpromRevision,
- LocalRomImage,
- ImageSize,
- &RuntimeImageLength,
- DiskStart,
- DiskEnd,
- RomShadowAddress
- );
+ Private->TraceIndex++;
+ Private->TraceIndex = (UINT16)(Private->TraceIndex % 0x200);
+ Status = LegacyBiosInstallRom (
+ This,
+ Private,
+ PciHandle,
+ OpromRevision,
+ LocalRomImage,
+ ImageSize,
+ &RuntimeImageLength,
+ DiskStart,
+ DiskEnd,
+ RomShadowAddress
+ );
if (RomShadowedSize != NULL) {
- *RomShadowedSize = (UINT32) RuntimeImageLength;
+ *RomShadowedSize = (UINT32)RuntimeImageLength;
}
mVgaInstallationInProgress = FALSE;
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c
index 6b9bb5ed8b..0cb48fa8ab 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c
@@ -21,32 +21,32 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_STATUS
LegacyBiosBuildSioDataFromSio (
- IN DEVICE_PRODUCER_DATA_HEADER *SioPtr
+ IN DEVICE_PRODUCER_DATA_HEADER *SioPtr
)
{
- EFI_STATUS Status;
- DEVICE_PRODUCER_SERIAL *SioSerial;
- DEVICE_PRODUCER_PARALLEL *SioParallel;
- DEVICE_PRODUCER_FLOPPY *SioFloppy;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- UINTN ChildIndex;
- EFI_SIO_PROTOCOL *Sio;
- ACPI_RESOURCE_HEADER_PTR Resources;
- EFI_ACPI_IO_PORT_DESCRIPTOR *IoResource;
- EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR *FixedIoResource;
- EFI_ACPI_DMA_DESCRIPTOR *DmaResource;
- EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR *IrqResource;
- UINT16 Address;
- UINT8 Dma;
- UINT8 Irq;
- UINTN EntryCount;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- ACPI_HID_DEVICE_PATH *Acpi;
+ EFI_STATUS Status;
+ DEVICE_PRODUCER_SERIAL *SioSerial;
+ DEVICE_PRODUCER_PARALLEL *SioParallel;
+ DEVICE_PRODUCER_FLOPPY *SioFloppy;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ UINTN ChildIndex;
+ EFI_SIO_PROTOCOL *Sio;
+ ACPI_RESOURCE_HEADER_PTR Resources;
+ EFI_ACPI_IO_PORT_DESCRIPTOR *IoResource;
+ EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR *FixedIoResource;
+ EFI_ACPI_DMA_DESCRIPTOR *DmaResource;
+ EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR *IrqResource;
+ UINT16 Address;
+ UINT8 Dma;
+ UINT8 Irq;
+ UINTN EntryCount;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ EFI_SERIAL_IO_PROTOCOL *SerialIo;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ ACPI_HID_DEVICE_PATH *Acpi;
//
// Get the list of ISA controllers in the system
@@ -61,11 +61,12 @@ LegacyBiosBuildSioDataFromSio (
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
+
//
// Collect legacy information from each of the ISA controllers in the system
//
for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSioProtocolGuid, (VOID **) &Sio);
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSioProtocolGuid, (VOID **)&Sio);
if (EFI_ERROR (Status)) {
continue;
}
@@ -73,46 +74,46 @@ LegacyBiosBuildSioDataFromSio (
Address = MAX_UINT16;
Dma = MAX_UINT8;
Irq = MAX_UINT8;
- Status = Sio->GetResources (Sio, &Resources);
+ Status = Sio->GetResources (Sio, &Resources);
if (!EFI_ERROR (Status)) {
//
// Get the base address information from ACPI resource descriptor.
//
while (Resources.SmallHeader->Byte != ACPI_END_TAG_DESCRIPTOR) {
switch (Resources.SmallHeader->Byte) {
- case ACPI_IO_PORT_DESCRIPTOR:
- IoResource = (EFI_ACPI_IO_PORT_DESCRIPTOR *) Resources.SmallHeader;
- Address = IoResource->BaseAddressMin;
- break;
-
- case ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR:
- FixedIoResource = (EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR *) Resources.SmallHeader;
- Address = FixedIoResource->BaseAddress;
- break;
-
- case ACPI_DMA_DESCRIPTOR:
- DmaResource = (EFI_ACPI_DMA_DESCRIPTOR *) Resources.SmallHeader;
- Dma = (UINT8) LowBitSet32 (DmaResource->ChannelMask);
- break;
-
- case ACPI_IRQ_DESCRIPTOR:
- case ACPI_IRQ_NOFLAG_DESCRIPTOR:
- IrqResource = (EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR *) Resources.SmallHeader;
- Irq = (UINT8) LowBitSet32 (IrqResource->Mask);
- break;
-
- default:
- break;
+ case ACPI_IO_PORT_DESCRIPTOR:
+ IoResource = (EFI_ACPI_IO_PORT_DESCRIPTOR *)Resources.SmallHeader;
+ Address = IoResource->BaseAddressMin;
+ break;
+
+ case ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR:
+ FixedIoResource = (EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR *)Resources.SmallHeader;
+ Address = FixedIoResource->BaseAddress;
+ break;
+
+ case ACPI_DMA_DESCRIPTOR:
+ DmaResource = (EFI_ACPI_DMA_DESCRIPTOR *)Resources.SmallHeader;
+ Dma = (UINT8)LowBitSet32 (DmaResource->ChannelMask);
+ break;
+
+ case ACPI_IRQ_DESCRIPTOR:
+ case ACPI_IRQ_NOFLAG_DESCRIPTOR:
+ IrqResource = (EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR *)Resources.SmallHeader;
+ Irq = (UINT8)LowBitSet32 (IrqResource->Mask);
+ break;
+
+ default:
+ break;
}
if (Resources.SmallHeader->Bits.Type == 0) {
- Resources.SmallHeader = (ACPI_SMALL_RESOURCE_HEADER *) ((UINT8 *) Resources.SmallHeader
- + Resources.SmallHeader->Bits.Length
- + sizeof (*Resources.SmallHeader));
+ Resources.SmallHeader = (ACPI_SMALL_RESOURCE_HEADER *)((UINT8 *)Resources.SmallHeader
+ + Resources.SmallHeader->Bits.Length
+ + sizeof (*Resources.SmallHeader));
} else {
- Resources.LargeHeader = (ACPI_LARGE_RESOURCE_HEADER *) ((UINT8 *) Resources.LargeHeader
- + Resources.LargeHeader->Length
- + sizeof (*Resources.LargeHeader));
+ Resources.LargeHeader = (ACPI_LARGE_RESOURCE_HEADER *)((UINT8 *)Resources.LargeHeader
+ + Resources.LargeHeader->Length
+ + sizeof (*Resources.LargeHeader));
}
}
}
@@ -126,13 +127,14 @@ LegacyBiosBuildSioDataFromSio (
Acpi = NULL;
while (!IsDevicePathEnd (DevicePath)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath;
+ Acpi = (ACPI_HID_DEVICE_PATH *)DevicePath;
DevicePath = NextDevicePathNode (DevicePath);
}
if ((Acpi == NULL) || (DevicePathType (Acpi) != ACPI_DEVICE_PATH) ||
((DevicePathSubType (Acpi) != ACPI_DP) && (DevicePathSubType (Acpi) != ACPI_EXTENDED_DP))
- ) {
+ )
+ {
continue;
}
@@ -141,9 +143,8 @@ LegacyBiosBuildSioDataFromSio (
//
// Ignore DMA resource since it is always returned NULL
//
- if (Acpi->HID == EISA_PNP_ID (0x500) || Acpi->HID == EISA_PNP_ID (0x501)) {
-
- if (Acpi->UID < 4 && Address != MAX_UINT16 && Irq != MAX_UINT8) {
+ if ((Acpi->HID == EISA_PNP_ID (0x500)) || (Acpi->HID == EISA_PNP_ID (0x501))) {
+ if ((Acpi->UID < 4) && (Address != MAX_UINT16) && (Irq != MAX_UINT8)) {
//
// Get the handle of the child device that has opened the Super I/O Protocol
//
@@ -156,14 +157,15 @@ LegacyBiosBuildSioDataFromSio (
if (EFI_ERROR (Status)) {
continue;
}
+
for (ChildIndex = 0; ChildIndex < EntryCount; ChildIndex++) {
if ((OpenInfoBuffer[ChildIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = gBS->HandleProtocol (OpenInfoBuffer[ChildIndex].ControllerHandle, &gEfiSerialIoProtocolGuid, (VOID **) &SerialIo);
+ Status = gBS->HandleProtocol (OpenInfoBuffer[ChildIndex].ControllerHandle, &gEfiSerialIoProtocolGuid, (VOID **)&SerialIo);
if (!EFI_ERROR (Status)) {
- SioSerial = &SioPtr->Serial[Acpi->UID];
- SioSerial->Address = Address;
- SioSerial->Irq = Irq;
- SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF;
+ SioSerial = &SioPtr->Serial[Acpi->UID];
+ SioSerial->Address = Address;
+ SioSerial->Irq = Irq;
+ SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF;
break;
}
}
@@ -172,36 +174,39 @@ LegacyBiosBuildSioDataFromSio (
FreePool (OpenInfoBuffer);
}
}
+
//
// See if this is an ISA parallel port
//
// Ignore DMA resource since it is always returned NULL, port
// only used in output mode.
//
- if (Acpi->HID == EISA_PNP_ID (0x400) || Acpi->HID == EISA_PNP_ID (0x401)) {
- if (Acpi->UID < 3 && Address != MAX_UINT16 && Irq != MAX_UINT8 && Dma != MAX_UINT8) {
- SioParallel = &SioPtr->Parallel[Acpi->UID];
- SioParallel->Address = Address;
- SioParallel->Irq = Irq;
- SioParallel->Dma = Dma;
- SioParallel->Mode = DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY;
+ if ((Acpi->HID == EISA_PNP_ID (0x400)) || (Acpi->HID == EISA_PNP_ID (0x401))) {
+ if ((Acpi->UID < 3) && (Address != MAX_UINT16) && (Irq != MAX_UINT8) && (Dma != MAX_UINT8)) {
+ SioParallel = &SioPtr->Parallel[Acpi->UID];
+ SioParallel->Address = Address;
+ SioParallel->Irq = Irq;
+ SioParallel->Dma = Dma;
+ SioParallel->Mode = DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY;
}
}
+
//
// See if this is an ISA floppy controller
//
if (Acpi->HID == EISA_PNP_ID (0x604)) {
- if (Address != MAX_UINT16 && Irq != MAX_UINT8 && Dma != MAX_UINT8) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);
+ if ((Address != MAX_UINT16) && (Irq != MAX_UINT8) && (Dma != MAX_UINT8)) {
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);
if (!EFI_ERROR (Status)) {
- SioFloppy = &SioPtr->Floppy;
- SioFloppy->Address = Address;
- SioFloppy->Irq = Irq;
- SioFloppy->Dma = Dma;
+ SioFloppy = &SioPtr->Floppy;
+ SioFloppy->Address = Address;
+ SioFloppy->Irq = Irq;
+ SioFloppy->Dma = Dma;
SioFloppy->NumberOfFloppy++;
}
}
}
+
//
// See if this is a mouse
// Always set mouse found so USB hot plug will work
@@ -225,7 +230,6 @@ LegacyBiosBuildSioDataFromSio (
FreePool (HandleBuffer);
return EFI_SUCCESS;
-
}
/**
@@ -239,27 +243,27 @@ LegacyBiosBuildSioDataFromSio (
**/
EFI_STATUS
LegacyBiosBuildSioDataFromIsaIo (
- IN DEVICE_PRODUCER_DATA_HEADER *SioPtr
+ IN DEVICE_PRODUCER_DATA_HEADER *SioPtr
)
{
- EFI_STATUS Status;
- DEVICE_PRODUCER_SERIAL *SioSerial;
- DEVICE_PRODUCER_PARALLEL *SioParallel;
- DEVICE_PRODUCER_FLOPPY *SioFloppy;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- UINTN ResourceIndex;
- UINTN ChildIndex;
- EFI_ISA_IO_PROTOCOL *IsaIo;
- EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;
- EFI_ISA_ACPI_RESOURCE *IoResource;
- EFI_ISA_ACPI_RESOURCE *DmaResource;
- EFI_ISA_ACPI_RESOURCE *InterruptResource;
- UINTN EntryCount;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
+ EFI_STATUS Status;
+ DEVICE_PRODUCER_SERIAL *SioSerial;
+ DEVICE_PRODUCER_PARALLEL *SioParallel;
+ DEVICE_PRODUCER_FLOPPY *SioFloppy;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ UINTN ResourceIndex;
+ UINTN ChildIndex;
+ EFI_ISA_IO_PROTOCOL *IsaIo;
+ EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;
+ EFI_ISA_ACPI_RESOURCE *IoResource;
+ EFI_ISA_ACPI_RESOURCE *DmaResource;
+ EFI_ISA_ACPI_RESOURCE *InterruptResource;
+ UINTN EntryCount;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ EFI_SERIAL_IO_PROTOCOL *SerialIo;
//
// Get the list of ISA controllers in the system
@@ -274,12 +278,12 @@ LegacyBiosBuildSioDataFromIsaIo (
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
+
//
// Collect legacy information from each of the ISA controllers in the system
//
for (Index = 0; Index < HandleCount; Index++) {
-
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiIsaIoProtocolGuid, (VOID **) &IsaIo);
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiIsaIoProtocolGuid, (VOID **)&IsaIo);
if (EFI_ERROR (Status)) {
continue;
}
@@ -289,6 +293,7 @@ LegacyBiosBuildSioDataFromIsaIo (
if (ResourceList == NULL) {
continue;
}
+
//
// Collect the resource types neededto fill in the SIO data structure
//
@@ -298,38 +303,40 @@ LegacyBiosBuildSioDataFromIsaIo (
for (ResourceIndex = 0;
ResourceList->ResourceItem[ResourceIndex].Type != EfiIsaAcpiResourceEndOfList;
ResourceIndex++
- ) {
+ )
+ {
switch (ResourceList->ResourceItem[ResourceIndex].Type) {
- case EfiIsaAcpiResourceIo:
- IoResource = &ResourceList->ResourceItem[ResourceIndex];
- break;
+ case EfiIsaAcpiResourceIo:
+ IoResource = &ResourceList->ResourceItem[ResourceIndex];
+ break;
- case EfiIsaAcpiResourceMemory:
- break;
+ case EfiIsaAcpiResourceMemory:
+ break;
- case EfiIsaAcpiResourceDma:
- DmaResource = &ResourceList->ResourceItem[ResourceIndex];
- break;
+ case EfiIsaAcpiResourceDma:
+ DmaResource = &ResourceList->ResourceItem[ResourceIndex];
+ break;
- case EfiIsaAcpiResourceInterrupt:
- InterruptResource = &ResourceList->ResourceItem[ResourceIndex];
- break;
+ case EfiIsaAcpiResourceInterrupt:
+ InterruptResource = &ResourceList->ResourceItem[ResourceIndex];
+ break;
- default:
- break;
+ default:
+ break;
}
}
+
//
// See if this is an ISA serial port
//
// Ignore DMA resource since it is always returned NULL
//
- if (ResourceList->Device.HID == EISA_PNP_ID (0x500) || ResourceList->Device.HID == EISA_PNP_ID (0x501)) {
-
- if (ResourceList->Device.UID <= 3 &&
- IoResource != NULL &&
- InterruptResource != NULL
- ) {
+ if ((ResourceList->Device.HID == EISA_PNP_ID (0x500)) || (ResourceList->Device.HID == EISA_PNP_ID (0x501))) {
+ if ((ResourceList->Device.UID <= 3) &&
+ (IoResource != NULL) &&
+ (InterruptResource != NULL)
+ )
+ {
//
// Get the handle of the child device that has opened the ISA I/O Protocol
//
@@ -342,17 +349,18 @@ LegacyBiosBuildSioDataFromIsaIo (
if (EFI_ERROR (Status)) {
continue;
}
+
//
// We want resource for legacy even if no 32-bit driver installed
//
for (ChildIndex = 0; ChildIndex < EntryCount; ChildIndex++) {
if ((OpenInfoBuffer[ChildIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = gBS->HandleProtocol (OpenInfoBuffer[ChildIndex].ControllerHandle, &gEfiSerialIoProtocolGuid, (VOID **) &SerialIo);
+ Status = gBS->HandleProtocol (OpenInfoBuffer[ChildIndex].ControllerHandle, &gEfiSerialIoProtocolGuid, (VOID **)&SerialIo);
if (!EFI_ERROR (Status)) {
- SioSerial = &SioPtr->Serial[ResourceList->Device.UID];
- SioSerial->Address = (UINT16) IoResource->StartRange;
- SioSerial->Irq = (UINT8) InterruptResource->StartRange;
- SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF;
+ SioSerial = &SioPtr->Serial[ResourceList->Device.UID];
+ SioSerial->Address = (UINT16)IoResource->StartRange;
+ SioSerial->Irq = (UINT8)InterruptResource->StartRange;
+ SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF;
break;
}
}
@@ -361,40 +369,44 @@ LegacyBiosBuildSioDataFromIsaIo (
FreePool (OpenInfoBuffer);
}
}
+
//
// See if this is an ISA parallel port
//
// Ignore DMA resource since it is always returned NULL, port
// only used in output mode.
//
- if (ResourceList->Device.HID == EISA_PNP_ID (0x400) || ResourceList->Device.HID == EISA_PNP_ID (0x401)) {
- if (ResourceList->Device.UID <= 2 &&
- IoResource != NULL &&
- InterruptResource != NULL &&
- DmaResource != NULL
- ) {
- SioParallel = &SioPtr->Parallel[ResourceList->Device.UID];
- SioParallel->Address = (UINT16) IoResource->StartRange;
- SioParallel->Irq = (UINT8) InterruptResource->StartRange;
- SioParallel->Dma = (UINT8) DmaResource->StartRange;
- SioParallel->Mode = DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY;
+ if ((ResourceList->Device.HID == EISA_PNP_ID (0x400)) || (ResourceList->Device.HID == EISA_PNP_ID (0x401))) {
+ if ((ResourceList->Device.UID <= 2) &&
+ (IoResource != NULL) &&
+ (InterruptResource != NULL) &&
+ (DmaResource != NULL)
+ )
+ {
+ SioParallel = &SioPtr->Parallel[ResourceList->Device.UID];
+ SioParallel->Address = (UINT16)IoResource->StartRange;
+ SioParallel->Irq = (UINT8)InterruptResource->StartRange;
+ SioParallel->Dma = (UINT8)DmaResource->StartRange;
+ SioParallel->Mode = DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY;
}
}
+
//
// See if this is an ISA floppy controller
//
if (ResourceList->Device.HID == EISA_PNP_ID (0x604)) {
- if (IoResource != NULL && InterruptResource != NULL && DmaResource != NULL) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);
+ if ((IoResource != NULL) && (InterruptResource != NULL) && (DmaResource != NULL)) {
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);
if (!EFI_ERROR (Status)) {
- SioFloppy = &SioPtr->Floppy;
- SioFloppy->Address = (UINT16) IoResource->StartRange;
- SioFloppy->Irq = (UINT8) InterruptResource->StartRange;
- SioFloppy->Dma = (UINT8) DmaResource->StartRange;
+ SioFloppy = &SioPtr->Floppy;
+ SioFloppy->Address = (UINT16)IoResource->StartRange;
+ SioFloppy->Irq = (UINT8)InterruptResource->StartRange;
+ SioFloppy->Dma = (UINT8)DmaResource->StartRange;
SioFloppy->NumberOfFloppy++;
}
}
}
+
//
// See if this is a mouse
// Always set mouse found so USB hot plug will work
@@ -430,14 +442,14 @@ LegacyBiosBuildSioDataFromIsaIo (
**/
EFI_STATUS
LegacyBiosBuildSioData (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_STATUS Status;
- DEVICE_PRODUCER_DATA_HEADER *SioPtr;
- EFI_HANDLE IsaBusController;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
+ EFI_STATUS Status;
+ DEVICE_PRODUCER_DATA_HEADER *SioPtr;
+ EFI_HANDLE IsaBusController;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
//
// Get the pointer to the SIO data structure
diff --git a/OvmfPkg/Csm/LegacyBiosDxe/Thunk.c b/OvmfPkg/Csm/LegacyBiosDxe/Thunk.c
index dd706fbd6e..62f19b6519 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/Thunk.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/Thunk.c
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "LegacyBiosInterface.h"
-THUNK_CONTEXT mThunkContext;
+THUNK_CONTEXT mThunkContext;
/**
Sets the counter value for Timer #0 in a legacy 8254 timer.
@@ -23,8 +23,8 @@ SetPitCount (
)
{
IoWrite8 (TIMER_CONTROL_PORT, TIMER0_CONTROL_WORD);
- IoWrite8 (TIMER0_COUNT_PORT, (UINT8) (Count & 0xFF));
- IoWrite8 (TIMER0_COUNT_PORT, (UINT8) ((Count>>8) & 0xFF));
+ IoWrite8 (TIMER0_COUNT_PORT, (UINT8)(Count & 0xFF));
+ IoWrite8 (TIMER0_COUNT_PORT, (UINT8)((Count>>8) & 0xFF));
}
/**
@@ -45,13 +45,13 @@ SetPitCount (
BOOLEAN
EFIAPI
LegacyBiosInt86 (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT8 BiosInt,
- IN EFI_IA32_REGISTER_SET *Regs
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT8 BiosInt,
+ IN EFI_IA32_REGISTER_SET *Regs
)
{
- UINT16 Segment;
- UINT16 Offset;
+ UINT16 Segment;
+ UINT16 Offset;
Regs->X.Flags.Reserved1 = 1;
Regs->X.Flags.Reserved2 = 0;
@@ -67,9 +67,9 @@ LegacyBiosInt86 (
// We use this base address to get the legacy interrupt handler.
//
ACCESS_PAGE0_CODE (
- Segment = (UINT16)(((UINT32 *)0)[BiosInt] >> 16);
- Offset = (UINT16)((UINT32 *)0)[BiosInt];
- );
+ Segment = (UINT16)(((UINT32 *)0)[BiosInt] >> 16);
+ Offset = (UINT16)((UINT32 *)0)[BiosInt];
+ );
return InternalLegacyBiosFarCall (
This,
@@ -102,12 +102,12 @@ LegacyBiosInt86 (
BOOLEAN
EFIAPI
LegacyBiosFarCall86 (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT16 Segment,
- IN UINT16 Offset,
- IN EFI_IA32_REGISTER_SET *Regs,
- IN VOID *Stack,
- IN UINTN StackSize
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT16 Segment,
+ IN UINT16 Offset,
+ IN EFI_IA32_REGISTER_SET *Regs,
+ IN VOID *Stack,
+ IN UINTN StackSize
)
{
Regs->X.Flags.Reserved1 = 1;
@@ -134,8 +134,8 @@ LegacyBiosFarCall86 (
VOID
EFIAPI
LegacyBiosNullInterruptHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
}
@@ -161,12 +161,12 @@ LegacyBiosNullInterruptHandler (
BOOLEAN
EFIAPI
InternalLegacyBiosFarCall (
- IN EFI_LEGACY_BIOS_PROTOCOL *This,
- IN UINT16 Segment,
- IN UINT16 Offset,
- IN EFI_IA32_REGISTER_SET *Regs,
- IN VOID *Stack,
- IN UINTN StackSize
+ IN EFI_LEGACY_BIOS_PROTOCOL *This,
+ IN UINT16 Segment,
+ IN UINT16 Offset,
+ IN EFI_IA32_REGISTER_SET *Regs,
+ IN VOID *Stack,
+ IN UINTN StackSize
)
{
UINTN Status;
@@ -180,19 +180,19 @@ InternalLegacyBiosFarCall (
Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
ZeroMem (&ThunkRegSet, sizeof (ThunkRegSet));
- ThunkRegSet.X.DI = Regs->X.DI;
- ThunkRegSet.X.SI = Regs->X.SI;
- ThunkRegSet.X.BP = Regs->X.BP;
- ThunkRegSet.X.BX = Regs->X.BX;
- ThunkRegSet.X.DX = Regs->X.DX;
+ ThunkRegSet.X.DI = Regs->X.DI;
+ ThunkRegSet.X.SI = Regs->X.SI;
+ ThunkRegSet.X.BP = Regs->X.BP;
+ ThunkRegSet.X.BX = Regs->X.BX;
+ ThunkRegSet.X.DX = Regs->X.DX;
//
// Sometimes, ECX is used to pass in 32 bit data. For example, INT 1Ah, AX = B10Dh is
// "PCI BIOS v2.0c + Write Configuration DWORD" and ECX has the dword to write.
//
- ThunkRegSet.E.ECX = Regs->E.ECX;
- ThunkRegSet.X.AX = Regs->X.AX;
- ThunkRegSet.E.DS = Regs->X.DS;
- ThunkRegSet.E.ES = Regs->X.ES;
+ ThunkRegSet.E.ECX = Regs->E.ECX;
+ ThunkRegSet.X.AX = Regs->X.AX;
+ ThunkRegSet.E.DS = Regs->X.DS;
+ ThunkRegSet.E.ES = Regs->X.ES;
CopyMem (&(ThunkRegSet.E.EFLAGS.UintN), &(Regs->X.Flags), sizeof (Regs->X.Flags));
@@ -200,7 +200,7 @@ InternalLegacyBiosFarCall (
// Clear the error flag; thunk code may set it. Stack16 should be the high address
// Make Statk16 address the low 16 bit must be not zero.
//
- Stack16 = (UINT16 *)((UINT8 *) mThunkContext.RealModeBuffer + mThunkContext.RealModeBufferSize - sizeof (UINT16));
+ Stack16 = (UINT16 *)((UINT8 *)mThunkContext.RealModeBuffer + mThunkContext.RealModeBufferSize - sizeof (UINT16));
//
// Save current rate of DXE Timer
@@ -229,22 +229,25 @@ InternalLegacyBiosFarCall (
// handled properly from real mode.
//
DEBUG_CODE_BEGIN ();
- UINTN Vector;
- UINTN Count;
-
- for (Vector = 0x20, Count = 0; Vector < 0x100; Vector++) {
- Status = Private->Cpu->RegisterInterruptHandler (Private->Cpu, Vector, LegacyBiosNullInterruptHandler);
- if (Status == EFI_ALREADY_STARTED) {
- Count++;
- }
- if (Status == EFI_SUCCESS) {
- Private->Cpu->RegisterInterruptHandler (Private->Cpu, Vector, NULL);
- }
+ UINTN Vector;
+ UINTN Count;
+
+ for (Vector = 0x20, Count = 0; Vector < 0x100; Vector++) {
+ Status = Private->Cpu->RegisterInterruptHandler (Private->Cpu, Vector, LegacyBiosNullInterruptHandler);
+ if (Status == EFI_ALREADY_STARTED) {
+ Count++;
}
- if (Count >= 2) {
- DEBUG ((DEBUG_ERROR, "ERROR: More than one HW interrupt active with CSM enabled\n"));
+
+ if (Status == EFI_SUCCESS) {
+ Private->Cpu->RegisterInterruptHandler (Private->Cpu, Vector, NULL);
}
- ASSERT (Count < 2);
+ }
+
+ if (Count >= 2) {
+ DEBUG ((DEBUG_ERROR, "ERROR: More than one HW interrupt active with CSM enabled\n"));
+ }
+
+ ASSERT (Count < 2);
DEBUG_CODE_END ();
//
@@ -252,11 +255,11 @@ InternalLegacyBiosFarCall (
// period is less than the CSM required rate of 54.9254, then force the 8254
// PIT counter to 0, which is the CSM required rate of 54.9254 ms
//
- if (Private->TimerUses8254 && TimerPeriod < 549254) {
+ if (Private->TimerUses8254 && (TimerPeriod < 549254)) {
SetPitCount (0);
}
- if (Stack != NULL && StackSize != 0) {
+ if ((Stack != NULL) && (StackSize != 0)) {
//
// Copy Stack to low memory stack
//
@@ -264,12 +267,12 @@ InternalLegacyBiosFarCall (
CopyMem (Stack16, Stack, StackSize);
}
- ThunkRegSet.E.SS = (UINT16) (((UINTN) Stack16 >> 16) << 12);
- ThunkRegSet.E.ESP = (UINT16) (UINTN) Stack16;
- ThunkRegSet.E.CS = Segment;
- ThunkRegSet.E.Eip = Offset;
+ ThunkRegSet.E.SS = (UINT16)(((UINTN)Stack16 >> 16) << 12);
+ ThunkRegSet.E.ESP = (UINT16)(UINTN)Stack16;
+ ThunkRegSet.E.CS = Segment;
+ ThunkRegSet.E.Eip = Offset;
- mThunkContext.RealModeState = &ThunkRegSet;
+ mThunkContext.RealModeState = &ThunkRegSet;
//
// Set Legacy16 state. 0x08, 0x70 is legacy 8259 vector bases.
@@ -279,7 +282,7 @@ InternalLegacyBiosFarCall (
AsmThunk16 (&mThunkContext);
- if (Stack != NULL && StackSize != 0) {
+ if ((Stack != NULL) && (StackSize != 0)) {
//
// Copy low memory stack to Stack
//
@@ -311,17 +314,17 @@ InternalLegacyBiosFarCall (
// PcdEbdaReservedMemorySize should be adjusted to larger for more OPROMs.
//
DEBUG_CODE_BEGIN ();
- {
- UINTN EbdaBaseAddress;
- UINTN ReservedEbdaBaseAddress;
-
- ACCESS_PAGE0_CODE (
- EbdaBaseAddress = (*(UINT16 *) (UINTN) 0x40E) << 4;
- ReservedEbdaBaseAddress = CONVENTIONAL_MEMORY_TOP
- - PcdGet32 (PcdEbdaReservedMemorySize);
- ASSERT (ReservedEbdaBaseAddress <= EbdaBaseAddress);
+ {
+ UINTN EbdaBaseAddress;
+ UINTN ReservedEbdaBaseAddress;
+
+ ACCESS_PAGE0_CODE (
+ EbdaBaseAddress = (*(UINT16 *)(UINTN)0x40E) << 4;
+ ReservedEbdaBaseAddress = CONVENTIONAL_MEMORY_TOP
+ - PcdGet32 (PcdEbdaReservedMemorySize);
+ ASSERT (ReservedEbdaBaseAddress <= EbdaBaseAddress);
);
- }
+ }
DEBUG_CODE_END ();
//
@@ -329,21 +332,21 @@ InternalLegacyBiosFarCall (
//
SaveAndSetDebugTimerInterrupt (InterruptState);
- Regs->E.EDI = ThunkRegSet.E.EDI;
- Regs->E.ESI = ThunkRegSet.E.ESI;
- Regs->E.EBP = ThunkRegSet.E.EBP;
- Regs->E.EBX = ThunkRegSet.E.EBX;
- Regs->E.EDX = ThunkRegSet.E.EDX;
- Regs->E.ECX = ThunkRegSet.E.ECX;
- Regs->E.EAX = ThunkRegSet.E.EAX;
- Regs->X.SS = ThunkRegSet.E.SS;
- Regs->X.CS = ThunkRegSet.E.CS;
- Regs->X.DS = ThunkRegSet.E.DS;
- Regs->X.ES = ThunkRegSet.E.ES;
+ Regs->E.EDI = ThunkRegSet.E.EDI;
+ Regs->E.ESI = ThunkRegSet.E.ESI;
+ Regs->E.EBP = ThunkRegSet.E.EBP;
+ Regs->E.EBX = ThunkRegSet.E.EBX;
+ Regs->E.EDX = ThunkRegSet.E.EDX;
+ Regs->E.ECX = ThunkRegSet.E.ECX;
+ Regs->E.EAX = ThunkRegSet.E.EAX;
+ Regs->X.SS = ThunkRegSet.E.SS;
+ Regs->X.CS = ThunkRegSet.E.CS;
+ Regs->X.DS = ThunkRegSet.E.DS;
+ Regs->X.ES = ThunkRegSet.E.ES;
CopyMem (&(Regs->X.Flags), &(ThunkRegSet.E.EFLAGS.UintN), sizeof (Regs->X.Flags));
- return (BOOLEAN) (Regs->X.Flags.CF == 1);
+ return (BOOLEAN)(Regs->X.Flags.CF == 1);
}
/**
@@ -357,16 +360,16 @@ InternalLegacyBiosFarCall (
**/
EFI_STATUS
LegacyBiosInitializeThunk (
- IN LEGACY_BIOS_INSTANCE *Private
+ IN LEGACY_BIOS_INSTANCE *Private
)
{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS MemoryAddress;
- UINT8 TimerVector;
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS MemoryAddress;
+ UINT8 TimerVector;
- MemoryAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->IntThunk;
+ MemoryAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Private->IntThunk;
- mThunkContext.RealModeBuffer = (VOID *) (UINTN) (MemoryAddress + ((sizeof (LOW_MEMORY_THUNK) / EFI_PAGE_SIZE) + 1) * EFI_PAGE_SIZE);
+ mThunkContext.RealModeBuffer = (VOID *)(UINTN)(MemoryAddress + ((sizeof (LOW_MEMORY_THUNK) / EFI_PAGE_SIZE) + 1) * EFI_PAGE_SIZE);
mThunkContext.RealModeBufferSize = EFI_PAGE_SIZE;
mThunkContext.ThunkAttributes = THUNK_ATTRIBUTE_BIG_REAL_MODE | THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15;
@@ -376,7 +379,7 @@ LegacyBiosInitializeThunk (
// Get the interrupt vector number corresponding to IRQ0 from the 8259 driver
//
TimerVector = 0;
- Status = Private->Legacy8259->GetVector (Private->Legacy8259, Efi8259Irq0, &TimerVector);
+ Status = Private->Legacy8259->GetVector (Private->Legacy8259, Efi8259Irq0, &TimerVector);
ASSERT_EFI_ERROR (Status);
//
diff --git a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c
index 31e211a7b9..6b4fa933f2 100644
--- a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c
+++ b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c
@@ -7,67 +7,63 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include "LegacyBootMaintUi.h"
LEGACY_BOOT_OPTION_CALLBACK_DATA *mLegacyBootOptionPrivate = NULL;
-EFI_GUID mLegacyBootOptionGuid = LEGACY_BOOT_OPTION_FORMSET_GUID;
-CHAR16 mLegacyBootStorageName[] = L"LegacyBootData";
-BBS_TYPE mBbsType[] = {BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM, BBS_EMBED_NETWORK, BBS_BEV_DEVICE, BBS_UNKNOWN};
-BOOLEAN mFirstEnterLegacyForm = FALSE;
-
+EFI_GUID mLegacyBootOptionGuid = LEGACY_BOOT_OPTION_FORMSET_GUID;
+CHAR16 mLegacyBootStorageName[] = L"LegacyBootData";
+BBS_TYPE mBbsType[] = { BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM, BBS_EMBED_NETWORK, BBS_BEV_DEVICE, BBS_UNKNOWN };
+BOOLEAN mFirstEnterLegacyForm = FALSE;
///
/// Legacy FD Info from LegacyBios.GetBbsInfo()
///
-LEGACY_MENU_OPTION LegacyFDMenu = {
+LEGACY_MENU_OPTION LegacyFDMenu = {
LEGACY_MENU_OPTION_SIGNATURE,
- {NULL},
+ { NULL },
0
};
///
/// Legacy HD Info from LegacyBios.GetBbsInfo()
///
-LEGACY_MENU_OPTION LegacyHDMenu = {
+LEGACY_MENU_OPTION LegacyHDMenu = {
LEGACY_MENU_OPTION_SIGNATURE,
- {NULL},
+ { NULL },
0
};
///
/// Legacy CD Info from LegacyBios.GetBbsInfo()
///
-LEGACY_MENU_OPTION LegacyCDMenu = {
+LEGACY_MENU_OPTION LegacyCDMenu = {
LEGACY_MENU_OPTION_SIGNATURE,
- {NULL},
+ { NULL },
0
};
///
/// Legacy NET Info from LegacyBios.GetBbsInfo()
///
-LEGACY_MENU_OPTION LegacyNETMenu = {
+LEGACY_MENU_OPTION LegacyNETMenu = {
LEGACY_MENU_OPTION_SIGNATURE,
- {NULL},
+ { NULL },
0
};
///
/// Legacy NET Info from LegacyBios.GetBbsInfo()
///
-LEGACY_MENU_OPTION LegacyBEVMenu = {
+LEGACY_MENU_OPTION LegacyBEVMenu = {
LEGACY_MENU_OPTION_SIGNATURE,
- {NULL},
+ { NULL },
0
};
-
VOID *mLegacyStartOpCodeHandle = NULL;
-VOID *mLegacyEndOpCodeHandle = NULL;
-EFI_IFR_GUID_LABEL *mLegacyStartLabel = NULL;
-EFI_IFR_GUID_LABEL *mLegacyEndLabel = NULL;
-
+VOID *mLegacyEndOpCodeHandle = NULL;
+EFI_IFR_GUID_LABEL *mLegacyStartLabel = NULL;
+EFI_IFR_GUID_LABEL *mLegacyEndLabel = NULL;
HII_VENDOR_DEVICE_PATH mLegacyBootOptionHiiVendorDevicePath = {
{
@@ -75,18 +71,19 @@ HII_VENDOR_DEVICE_PATH mLegacyBootOptionHiiVendorDevicePath = {
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)
}
},
- { 0x6bc75598, 0x89b4, 0x483d, { 0x91, 0x60, 0x7f, 0x46, 0x9a, 0x96, 0x35, 0x31 } }
+ { 0x6bc75598, 0x89b4, 0x483d, { 0x91, 0x60, 0x7f, 0x46, 0x9a, 0x96, 0x35, 0x31 }
+ }
},
{
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ (UINT8)(END_DEVICE_PATH_LENGTH),
+ (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
}
}
};
@@ -101,7 +98,6 @@ GetLegacyOptions (
VOID
);
-
/**
Base on the L"LegacyDevOrder" variable to build the current order data.
@@ -131,28 +127,28 @@ GetLegacyOptionsOrder (
**/
EFI_STATUS
OrderLegacyBootOption4SameType (
- UINT16 *DevOrder,
- UINTN DevOrderCount,
- UINT16 **EnBootOption,
- UINTN *EnBootOptionCount,
- UINT16 **DisBootOption,
- UINTN *DisBootOptionCount
+ UINT16 *DevOrder,
+ UINTN DevOrderCount,
+ UINT16 **EnBootOption,
+ UINTN *EnBootOptionCount,
+ UINT16 **DisBootOption,
+ UINTN *DisBootOptionCount
)
{
- EFI_STATUS Status;
- UINT16 *NewBootOption;
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- UINTN Index;
- UINTN StartPosition;
+ EFI_STATUS Status;
+ UINT16 *NewBootOption;
+ UINT16 *BootOrder;
+ UINTN BootOrderSize;
+ UINTN Index;
+ UINTN StartPosition;
- EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
+ EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
- CHAR16 OptionName[sizeof ("Boot####")];
- UINT16 *BbsIndexArray;
- UINT16 *DeviceTypeArray;
+ CHAR16 OptionName[sizeof ("Boot####")];
+ UINT16 *BbsIndexArray;
+ UINT16 *DeviceTypeArray;
- GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSize);
+ GetEfiGlobalVariable2 (L"BootOrder", (VOID **)&BootOrder, &BootOrderSize);
ASSERT (BootOrder != NULL);
BbsIndexArray = AllocatePool (BootOrderSize);
@@ -170,24 +166,25 @@ OrderLegacyBootOption4SameType (
ASSERT (*DisBootOption != NULL);
for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
-
UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]);
Status = EfiBootManagerVariableToLoadOption (OptionName, &BootOption);
ASSERT_EFI_ERROR (Status);
if ((DevicePathType (BootOption.FilePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (BootOption.FilePath) == BBS_BBS_DP)) {
+ (DevicePathSubType (BootOption.FilePath) == BBS_BBS_DP))
+ {
//
// Legacy Boot Option
//
ASSERT (BootOption.OptionalDataSize == sizeof (LEGACY_BOOT_OPTION_BBS_DATA));
- DeviceTypeArray[Index] = ((BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType;
- BbsIndexArray [Index] = ((LEGACY_BOOT_OPTION_BBS_DATA *) BootOption.OptionalData)->BbsIndex;
+ DeviceTypeArray[Index] = ((BBS_BBS_DEVICE_PATH *)BootOption.FilePath)->DeviceType;
+ BbsIndexArray[Index] = ((LEGACY_BOOT_OPTION_BBS_DATA *)BootOption.OptionalData)->BbsIndex;
} else {
DeviceTypeArray[Index] = BBS_TYPE_UNKNOWN;
- BbsIndexArray [Index] = 0xFFFF;
+ BbsIndexArray[Index] = 0xFFFF;
}
+
EfiBootManagerFreeLoadOption (&BootOption);
}
@@ -201,7 +198,7 @@ OrderLegacyBootOption4SameType (
while (DevOrderCount-- != 0) {
for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
if (BbsIndexArray[Index] == (DevOrder[DevOrderCount] & 0xFF)) {
- StartPosition = MIN (StartPosition, Index);
+ StartPosition = MIN (StartPosition, Index);
NewBootOption[DevOrderCount] = BootOrder[Index];
if ((DevOrder[DevOrderCount] & 0xFF00) == 0xFF00) {
@@ -211,6 +208,7 @@ OrderLegacyBootOption4SameType (
(*EnBootOption)[*EnBootOptionCount] = BootOrder[Index];
(*EnBootOptionCount)++;
}
+
break;
}
}
@@ -249,93 +247,92 @@ OrderLegacyBootOption4SameType (
**/
EFI_STATUS
UpdateBBSOption (
- IN LEGACY_BOOT_NV_DATA *NVMapData
+ IN LEGACY_BOOT_NV_DATA *NVMapData
)
{
- UINTN Index;
- UINTN Index2;
- UINTN CurrentType;
- VOID *BootOptionVar;
- CHAR16 VarName[100];
- UINTN OptionSize;
- EFI_STATUS Status;
- UINT32 *Attribute;
- LEGACY_MENU_OPTION *OptionMenu;
- UINT16 *LegacyDev;
- UINT16 *InitialLegacyDev;
- UINT8 *VarData;
- UINTN VarSize;
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- UINT8 *OriginalPtr;
- UINT8 *DisMap;
- UINTN Pos;
- UINTN Bit;
- UINT16 *NewOrder;
- UINT16 Tmp;
- UINT16 *EnBootOption;
- UINTN EnBootOptionCount;
- UINT16 *DisBootOption;
- UINTN DisBootOptionCount;
- UINTN BufferSize;
-
-
- DisMap = NULL;
- NewOrder = NULL;
- CurrentType = 0;
- EnBootOption = NULL;
- DisBootOption = NULL;
-
-
- DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;
- Status = EFI_SUCCESS;
+ UINTN Index;
+ UINTN Index2;
+ UINTN CurrentType;
+ VOID *BootOptionVar;
+ CHAR16 VarName[100];
+ UINTN OptionSize;
+ EFI_STATUS Status;
+ UINT32 *Attribute;
+ LEGACY_MENU_OPTION *OptionMenu;
+ UINT16 *LegacyDev;
+ UINT16 *InitialLegacyDev;
+ UINT8 *VarData;
+ UINTN VarSize;
+ LEGACY_DEV_ORDER_ENTRY *DevOrder;
+ UINT8 *OriginalPtr;
+ UINT8 *DisMap;
+ UINTN Pos;
+ UINTN Bit;
+ UINT16 *NewOrder;
+ UINT16 Tmp;
+ UINT16 *EnBootOption;
+ UINTN EnBootOptionCount;
+ UINT16 *DisBootOption;
+ UINTN DisBootOptionCount;
+ UINTN BufferSize;
+
+ DisMap = NULL;
+ NewOrder = NULL;
+ CurrentType = 0;
+ EnBootOption = NULL;
+ DisBootOption = NULL;
+
+ DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;
+ Status = EFI_SUCCESS;
//
// Update the Variable "LegacyDevOrder"
//
- GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **) &VarData, &VarSize);
+ GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **)&VarData, &VarSize);
if (VarData == NULL) {
return EFI_NOT_FOUND;
}
+
OriginalPtr = VarData;
while (mBbsType[CurrentType] != BBS_UNKNOWN) {
switch (mBbsType[CurrentType]) {
- case BBS_FLOPPY:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyFDMenu;
- LegacyDev = NVMapData->LegacyFD;
- InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyFD;
- BufferSize = sizeof (NVMapData->LegacyFD);
- break;
+ case BBS_FLOPPY:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyFDMenu;
+ LegacyDev = NVMapData->LegacyFD;
+ InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyFD;
+ BufferSize = sizeof (NVMapData->LegacyFD);
+ break;
- case BBS_HARDDISK:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyHDMenu;
- LegacyDev = NVMapData->LegacyHD;
- InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyHD;
+ case BBS_HARDDISK:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyHDMenu;
+ LegacyDev = NVMapData->LegacyHD;
+ InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyHD;
- BufferSize = sizeof (NVMapData->LegacyHD);
- break;
+ BufferSize = sizeof (NVMapData->LegacyHD);
+ break;
- case BBS_CDROM:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyCDMenu;
- LegacyDev = NVMapData->LegacyCD;
- InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyCD;
- BufferSize = sizeof (NVMapData->LegacyCD);
- break;
+ case BBS_CDROM:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyCDMenu;
+ LegacyDev = NVMapData->LegacyCD;
+ InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyCD;
+ BufferSize = sizeof (NVMapData->LegacyCD);
+ break;
- case BBS_EMBED_NETWORK:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyNETMenu;
- LegacyDev = NVMapData->LegacyNET;
- InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyNET;
- BufferSize = sizeof (NVMapData->LegacyNET);
- break;
+ case BBS_EMBED_NETWORK:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyNETMenu;
+ LegacyDev = NVMapData->LegacyNET;
+ InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyNET;
+ BufferSize = sizeof (NVMapData->LegacyNET);
+ break;
- default:
- ASSERT (mBbsType[CurrentType] == BBS_BEV_DEVICE);
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyBEVMenu;
- LegacyDev = NVMapData->LegacyBEV;
- InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyBEV;
- BufferSize = sizeof (NVMapData->LegacyBEV);
- break;
+ default:
+ ASSERT (mBbsType[CurrentType] == BBS_BEV_DEVICE);
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyBEVMenu;
+ LegacyDev = NVMapData->LegacyBEV;
+ InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyBEV;
+ BufferSize = sizeof (NVMapData->LegacyBEV);
+ break;
}
//
@@ -346,14 +343,14 @@ UpdateBBSOption (
continue;
}
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) OriginalPtr;
+ DevOrder = (LEGACY_DEV_ORDER_ENTRY *)OriginalPtr;
while (VarData < OriginalPtr + VarSize) {
if (DevOrder->BbsType == mBbsType[CurrentType]) {
break;
}
VarData += sizeof (BBS_TYPE) + DevOrder->Length;
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData;
+ DevOrder = (LEGACY_DEV_ORDER_ENTRY *)VarData;
}
if (VarData >= OriginalPtr + VarSize) {
@@ -382,11 +379,11 @@ UpdateBBSOption (
// so we use DisMap to set en/dis state of each item in NewOrder array
//
for (Index2 = 0; Index2 < OptionMenu->MenuNumber; Index2++) {
- Tmp = (UINT16) (DevOrder->Data[Index2] & 0xFF);
+ Tmp = (UINT16)(DevOrder->Data[Index2] & 0xFF);
Pos = Tmp / 8;
Bit = 7 - (Tmp % 8);
if ((DisMap[Pos] & (1 << Bit)) != 0) {
- NewOrder[Index] = (UINT16) (0xFF00 | Tmp);
+ NewOrder[Index] = (UINT16)(0xFF00 | Tmp);
Index++;
}
}
@@ -406,25 +403,25 @@ UpdateBBSOption (
ASSERT (OptionMenu->MenuNumber == DevOrder->Length / sizeof (UINT16) - 1);
Status = OrderLegacyBootOption4SameType (
- DevOrder->Data,
- DevOrder->Length / sizeof (UINT16) - 1,
- &EnBootOption,
- &EnBootOptionCount,
- &DisBootOption,
- &DisBootOptionCount
- );
- if (EFI_ERROR(Status)) {
- goto Fail;
- }
+ DevOrder->Data,
+ DevOrder->Length / sizeof (UINT16) - 1,
+ &EnBootOption,
+ &EnBootOptionCount,
+ &DisBootOption,
+ &DisBootOptionCount
+ );
+ if (EFI_ERROR (Status)) {
+ goto Fail;
+ }
//
// 2. Deactivate the DisBootOption and activate the EnBootOption
//
for (Index = 0; Index < DisBootOptionCount; Index++) {
UnicodeSPrint (VarName, sizeof (VarName), L"Boot%04x", DisBootOption[Index]);
- GetEfiGlobalVariable2 (VarName, (VOID **) &BootOptionVar, &OptionSize);
+ GetEfiGlobalVariable2 (VarName, (VOID **)&BootOptionVar, &OptionSize);
if (BootOptionVar != NULL) {
- Attribute = (UINT32 *) BootOptionVar;
+ Attribute = (UINT32 *)BootOptionVar;
*Attribute &= ~LOAD_OPTION_ACTIVE;
Status = gRT->SetVariable (
@@ -441,9 +438,9 @@ UpdateBBSOption (
for (Index = 0; Index < EnBootOptionCount; Index++) {
UnicodeSPrint (VarName, sizeof (VarName), L"Boot%04x", EnBootOption[Index]);
- GetEfiGlobalVariable2 (VarName, (VOID **) &BootOptionVar, &OptionSize);
+ GetEfiGlobalVariable2 (VarName, (VOID **)&BootOptionVar, &OptionSize);
if (BootOptionVar != NULL) {
- Attribute = (UINT32 *) BootOptionVar;
+ Attribute = (UINT32 *)BootOptionVar;
*Attribute |= LOAD_OPTION_ACTIVE;
Status = gRT->SetVariable (
@@ -458,7 +455,6 @@ UpdateBBSOption (
}
}
-
FreePool (EnBootOption);
FreePool (DisBootOption);
@@ -511,15 +507,16 @@ Fail:
EFI_STATUS
EFIAPI
LegacyBootOptionExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
)
{
- if (Progress == NULL || Results == NULL) {
+ if ((Progress == NULL) || (Results == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
*Progress = Request;
return EFI_NOT_FOUND;
}
@@ -543,18 +540,17 @@ LegacyBootOptionExtractConfig (
EFI_STATUS
EFIAPI
LegacyBootOptionRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
)
{
- EFI_STATUS Status;
- EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
- LEGACY_BOOT_NV_DATA *CurrentNVMapData;
- UINTN BufferSize;
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
+ LEGACY_BOOT_NV_DATA *CurrentNVMapData;
+ UINTN BufferSize;
-
- if (Configuration == NULL || Progress == NULL) {
+ if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -571,7 +567,7 @@ LegacyBootOptionRouteConfig (
Status = gBS->LocateProtocol (
&gEfiHiiConfigRoutingProtocolGuid,
NULL,
- (VOID **) &ConfigRouting
+ (VOID **)&ConfigRouting
);
if (EFI_ERROR (Status)) {
return Status;
@@ -581,13 +577,13 @@ LegacyBootOptionRouteConfig (
// Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
//
CurrentNVMapData = &mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData;
- Status = ConfigRouting->ConfigToBlock (
- ConfigRouting,
- Configuration,
- (UINT8 *) CurrentNVMapData,
- &BufferSize,
- Progress
- );
+ Status = ConfigRouting->ConfigToBlock (
+ ConfigRouting,
+ Configuration,
+ (UINT8 *)CurrentNVMapData,
+ &BufferSize,
+ Progress
+ );
ASSERT_EFI_ERROR (Status);
Status = UpdateBBSOption (CurrentNVMapData);
@@ -610,6 +606,7 @@ RefreshLegacyUpdateData (
if (mLegacyStartOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (mLegacyStartOpCodeHandle);
}
+
if (mLegacyEndOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (mLegacyEndOpCodeHandle);
}
@@ -618,17 +615,17 @@ RefreshLegacyUpdateData (
// Create new OpCode Handle
//
mLegacyStartOpCodeHandle = HiiAllocateOpCodeHandle ();
- mLegacyEndOpCodeHandle = HiiAllocateOpCodeHandle ();
+ mLegacyEndOpCodeHandle = HiiAllocateOpCodeHandle ();
//
// Create Hii Extend Label OpCode as the start opcode
//
- mLegacyStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
- mLegacyStartOpCodeHandle,
- &gEfiIfrTianoGuid,
- NULL,
- sizeof (EFI_IFR_GUID_LABEL)
- );
+ mLegacyStartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
+ mLegacyStartOpCodeHandle,
+ &gEfiIfrTianoGuid,
+ NULL,
+ sizeof (EFI_IFR_GUID_LABEL)
+ );
mLegacyStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mLegacyStartLabel->Number = FORM_BOOT_LEGACY_DEVICE_ID;
@@ -636,16 +633,15 @@ RefreshLegacyUpdateData (
//
// Create Hii Extend Label OpCode as the start opcode
//
- mLegacyEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
- mLegacyEndOpCodeHandle,
- &gEfiIfrTianoGuid,
- NULL,
- sizeof (EFI_IFR_GUID_LABEL)
- );
+ mLegacyEndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
+ mLegacyEndOpCodeHandle,
+ &gEfiIfrTianoGuid,
+ NULL,
+ sizeof (EFI_IFR_GUID_LABEL)
+ );
mLegacyEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mLegacyEndLabel->Number = FORM_BOOT_LEGACY_LABEL_END;
-
}
/**
@@ -662,13 +658,13 @@ RefreshLegacyUpdateData (
**/
LEGACY_MENU_ENTRY *
GetMenuEntry (
- LEGACY_MENU_OPTION *MenuOption,
- UINTN MenuNumber
+ LEGACY_MENU_OPTION *MenuOption,
+ UINTN MenuNumber
)
{
- LEGACY_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
- LIST_ENTRY *List;
+ LEGACY_MENU_ENTRY *NewMenuEntry;
+ UINTN Index;
+ LIST_ENTRY *List;
ASSERT (MenuNumber < MenuOption->MenuNumber);
@@ -691,12 +687,12 @@ GetMenuEntry (
**/
VOID
CreateLegacyMenuStringToken (
- IN EFI_HII_HANDLE HiiHandle,
- IN LEGACY_MENU_OPTION *MenuOption
+ IN EFI_HII_HANDLE HiiHandle,
+ IN LEGACY_MENU_OPTION *MenuOption
)
{
- LEGACY_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
+ LEGACY_MENU_ENTRY *NewMenuEntry;
+ UINTN Index;
for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
NewMenuEntry = GetMenuEntry (MenuOption, Index);
@@ -731,22 +727,22 @@ CreateLegacyMenuStringToken (
**/
VOID
UpdateLegacyDeviceOrderPage (
- IN UINT16 UpdatePageId
+ IN UINT16 UpdatePageId
)
{
- LEGACY_MENU_OPTION *OptionMenu;
- LEGACY_MENU_ENTRY *NewMenuEntry;
- EFI_STRING_ID StrRef;
- EFI_STRING_ID StrRefHelp;
- UINT16 *Default;
- UINT16 Index;
- UINT16 Key;
- CHAR16 String[100];
- CHAR16 *TypeStr;
- CHAR16 *TypeStrHelp;
- CHAR16 *FormTitle;
- VOID *OptionsOpCodeHandle;
- VOID *DefaultOpCodeHandle;
+ LEGACY_MENU_OPTION *OptionMenu;
+ LEGACY_MENU_ENTRY *NewMenuEntry;
+ EFI_STRING_ID StrRef;
+ EFI_STRING_ID StrRefHelp;
+ UINT16 *Default;
+ UINT16 Index;
+ UINT16 Key;
+ CHAR16 String[100];
+ CHAR16 *TypeStr;
+ CHAR16 *TypeStrHelp;
+ CHAR16 *FormTitle;
+ VOID *OptionsOpCodeHandle;
+ VOID *DefaultOpCodeHandle;
Key = 0;
StrRef = 0;
@@ -756,70 +752,69 @@ UpdateLegacyDeviceOrderPage (
TypeStrHelp = NULL;
Default = NULL;
- RefreshLegacyUpdateData();
+ RefreshLegacyUpdateData ();
//
// Create oneof option list
//
switch (UpdatePageId) {
- case FORM_FLOPPY_BOOT_ID:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyFDMenu;
- Key = (UINT16) LEGACY_FD_QUESTION_ID;
- TypeStr = STR_FLOPPY;
- TypeStrHelp = STR_FLOPPY_HELP;
- FormTitle = STR_FLOPPY_TITLE;
- Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyFD;
- break;
-
- case FORM_HARDDISK_BOOT_ID:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyHDMenu;
- Key = (UINT16) LEGACY_HD_QUESTION_ID;
- TypeStr = STR_HARDDISK;
- TypeStrHelp = STR_HARDDISK_HELP;
- FormTitle = STR_HARDDISK_TITLE;
- Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyHD;
- break;
-
- case FORM_CDROM_BOOT_ID:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyCDMenu;
- Key = (UINT16) LEGACY_CD_QUESTION_ID;
- TypeStr = STR_CDROM;
- TypeStrHelp = STR_CDROM_HELP;
- FormTitle = STR_CDROM_TITLE;
- Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyCD;
- break;
-
- case FORM_NET_BOOT_ID:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyNETMenu;
- Key = (UINT16) LEGACY_NET_QUESTION_ID;
- TypeStr = STR_NET;
- TypeStrHelp = STR_NET_HELP;
- FormTitle = STR_NET_TITLE;
- Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyNET;
- break;
-
- case FORM_BEV_BOOT_ID:
- OptionMenu = (LEGACY_MENU_OPTION *) &LegacyBEVMenu;
- Key = (UINT16) LEGACY_BEV_QUESTION_ID;
- TypeStr = STR_BEV;
- TypeStrHelp = STR_BEV_HELP;
- FormTitle = STR_BEV_TITLE;
- Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyBEV;
- break;
-
- default:
- DEBUG ((DEBUG_ERROR, "Invalid command ID for updating page!\n"));
- return;
+ case FORM_FLOPPY_BOOT_ID:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyFDMenu;
+ Key = (UINT16)LEGACY_FD_QUESTION_ID;
+ TypeStr = STR_FLOPPY;
+ TypeStrHelp = STR_FLOPPY_HELP;
+ FormTitle = STR_FLOPPY_TITLE;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyFD;
+ break;
+
+ case FORM_HARDDISK_BOOT_ID:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyHDMenu;
+ Key = (UINT16)LEGACY_HD_QUESTION_ID;
+ TypeStr = STR_HARDDISK;
+ TypeStrHelp = STR_HARDDISK_HELP;
+ FormTitle = STR_HARDDISK_TITLE;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyHD;
+ break;
+
+ case FORM_CDROM_BOOT_ID:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyCDMenu;
+ Key = (UINT16)LEGACY_CD_QUESTION_ID;
+ TypeStr = STR_CDROM;
+ TypeStrHelp = STR_CDROM_HELP;
+ FormTitle = STR_CDROM_TITLE;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyCD;
+ break;
+
+ case FORM_NET_BOOT_ID:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyNETMenu;
+ Key = (UINT16)LEGACY_NET_QUESTION_ID;
+ TypeStr = STR_NET;
+ TypeStrHelp = STR_NET_HELP;
+ FormTitle = STR_NET_TITLE;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyNET;
+ break;
+
+ case FORM_BEV_BOOT_ID:
+ OptionMenu = (LEGACY_MENU_OPTION *)&LegacyBEVMenu;
+ Key = (UINT16)LEGACY_BEV_QUESTION_ID;
+ TypeStr = STR_BEV;
+ TypeStrHelp = STR_BEV_HELP;
+ FormTitle = STR_BEV_TITLE;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyBEV;
+ break;
+
+ default:
+ DEBUG ((DEBUG_ERROR, "Invalid command ID for updating page!\n"));
+ return;
}
- HiiSetString (mLegacyBootOptionPrivate->HiiHandle, STRING_TOKEN(STR_ORDER_CHANGE_PROMPT), FormTitle, NULL);
+ HiiSetString (mLegacyBootOptionPrivate->HiiHandle, STRING_TOKEN (STR_ORDER_CHANGE_PROMPT), FormTitle, NULL);
CreateLegacyMenuStringToken (mLegacyBootOptionPrivate->HiiHandle, OptionMenu);
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
-
for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
NewMenuEntry = GetMenuEntry (OptionMenu, Index);
//
@@ -830,7 +825,7 @@ UpdateLegacyDeviceOrderPage (
NewMenuEntry->DisplayStringToken,
0,
EFI_IFR_TYPE_NUM_SIZE_16,
- ((LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext)->BbsIndex
+ ((LEGACY_DEVICE_CONTEXT *)NewMenuEntry->VariableContext)->BbsIndex
);
}
@@ -870,15 +865,15 @@ UpdateLegacyDeviceOrderPage (
HiiCreateOneOfOpCode (
mLegacyStartOpCodeHandle,
- (EFI_QUESTION_ID) (Key + Index),
+ (EFI_QUESTION_ID)(Key + Index),
VARSTORE_ID_LEGACY_BOOT,
- (UINT16) (Key + Index * 2 - CONFIG_OPTION_OFFSET),
+ (UINT16)(Key + Index * 2 - CONFIG_OPTION_OFFSET),
StrRef,
StrRefHelp,
EFI_IFR_FLAG_CALLBACK,
EFI_IFR_NUMERIC_SIZE_2,
OptionsOpCodeHandle,
- DefaultOpCodeHandle //NULL //
+ DefaultOpCodeHandle // NULL //
);
HiiFreeOpCodeHandle (DefaultOpCodeHandle);
@@ -895,7 +890,6 @@ UpdateLegacyDeviceOrderPage (
HiiFreeOpCodeHandle (OptionsOpCodeHandle);
}
-
/**
Adjust question value when one question value has been changed.
@@ -905,30 +899,30 @@ UpdateLegacyDeviceOrderPage (
**/
VOID
AdjustOptionValue (
- IN UINT16 QuestionId,
- IN EFI_IFR_TYPE_VALUE *Value
+ IN UINT16 QuestionId,
+ IN EFI_IFR_TYPE_VALUE *Value
)
{
- UINTN Number;
- UINT16 *Default;
- LEGACY_BOOT_NV_DATA *CurrentNVMap;
- UINT16 *CurrentVal;
- UINTN Index;
- UINTN Index2;
- UINTN Index3;
- UINTN NewValuePos;
- UINTN OldValue;
- UINTN NewValue;
- UINT8 *DisMap;
- UINTN Pos;
- UINTN Bit;
-
- Number = 0;
- CurrentVal = 0;
- Default = NULL;
- NewValue = 0;
+ UINTN Number;
+ UINT16 *Default;
+ LEGACY_BOOT_NV_DATA *CurrentNVMap;
+ UINT16 *CurrentVal;
+ UINTN Index;
+ UINTN Index2;
+ UINTN Index3;
+ UINTN NewValuePos;
+ UINTN OldValue;
+ UINTN NewValue;
+ UINT8 *DisMap;
+ UINTN Pos;
+ UINTN Bit;
+
+ Number = 0;
+ CurrentVal = 0;
+ Default = NULL;
+ NewValue = 0;
NewValuePos = 0;
- OldValue = 0;
+ OldValue = 0;
//
// Update Select FD/HD/CD/NET/BEV Order Form
@@ -936,29 +930,29 @@ AdjustOptionValue (
ASSERT ((QuestionId >= LEGACY_FD_QUESTION_ID) && (QuestionId < LEGACY_BEV_QUESTION_ID + MAX_MENU_NUMBER));
CurrentNVMap = &mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData;
- HiiGetBrowserData (&mLegacyBootOptionGuid, mLegacyBootStorageName, sizeof (LEGACY_BOOT_NV_DATA), (UINT8 *) CurrentNVMap);
- DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;
-
- if (QuestionId >= LEGACY_FD_QUESTION_ID && QuestionId < LEGACY_FD_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyFDMenu.MenuNumber;
- CurrentVal = CurrentNVMap->LegacyFD;
- Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyFD;
- } else if (QuestionId >= LEGACY_HD_QUESTION_ID && QuestionId < LEGACY_HD_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyHDMenu.MenuNumber;
- CurrentVal = CurrentNVMap->LegacyHD;
- Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyHD;
- } else if (QuestionId >= LEGACY_CD_QUESTION_ID && QuestionId < LEGACY_CD_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyCDMenu.MenuNumber;
- CurrentVal = CurrentNVMap->LegacyCD;
- Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyCD;
- } else if (QuestionId >= LEGACY_NET_QUESTION_ID && QuestionId < LEGACY_NET_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyNETMenu.MenuNumber;
- CurrentVal = CurrentNVMap->LegacyNET;
- Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyNET;
- } else if (QuestionId >= LEGACY_BEV_QUESTION_ID && QuestionId < LEGACY_BEV_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyBEVMenu.MenuNumber;
- CurrentVal = CurrentNVMap->LegacyBEV;
- Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyBEV;
+ HiiGetBrowserData (&mLegacyBootOptionGuid, mLegacyBootStorageName, sizeof (LEGACY_BOOT_NV_DATA), (UINT8 *)CurrentNVMap);
+ DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;
+
+ if ((QuestionId >= LEGACY_FD_QUESTION_ID) && (QuestionId < LEGACY_FD_QUESTION_ID + MAX_MENU_NUMBER)) {
+ Number = (UINT16)LegacyFDMenu.MenuNumber;
+ CurrentVal = CurrentNVMap->LegacyFD;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyFD;
+ } else if ((QuestionId >= LEGACY_HD_QUESTION_ID) && (QuestionId < LEGACY_HD_QUESTION_ID + MAX_MENU_NUMBER)) {
+ Number = (UINT16)LegacyHDMenu.MenuNumber;
+ CurrentVal = CurrentNVMap->LegacyHD;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyHD;
+ } else if ((QuestionId >= LEGACY_CD_QUESTION_ID) && (QuestionId < LEGACY_CD_QUESTION_ID + MAX_MENU_NUMBER)) {
+ Number = (UINT16)LegacyCDMenu.MenuNumber;
+ CurrentVal = CurrentNVMap->LegacyCD;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyCD;
+ } else if ((QuestionId >= LEGACY_NET_QUESTION_ID) && (QuestionId < LEGACY_NET_QUESTION_ID + MAX_MENU_NUMBER)) {
+ Number = (UINT16)LegacyNETMenu.MenuNumber;
+ CurrentVal = CurrentNVMap->LegacyNET;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyNET;
+ } else if ((QuestionId >= LEGACY_BEV_QUESTION_ID) && (QuestionId < LEGACY_BEV_QUESTION_ID + MAX_MENU_NUMBER)) {
+ Number = (UINT16)LegacyBEVMenu.MenuNumber;
+ CurrentVal = CurrentNVMap->LegacyBEV;
+ Default = mLegacyBootOptionPrivate->MaintainMapData->LastTimeNvData.LegacyBEV;
}
//
@@ -967,8 +961,8 @@ AdjustOptionValue (
//
for (Index = 0; Index < Number; Index++) {
if (CurrentVal[Index] != Default[Index]) {
- OldValue = Default[Index];
- NewValue = CurrentVal[Index];
+ OldValue = Default[Index];
+ NewValue = CurrentVal[Index];
break;
}
}
@@ -982,9 +976,9 @@ AdjustOptionValue (
// This item will be disable
// Just move the items behind this forward to overlap it
//
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
+ Pos = OldValue / 8;
+ Bit = 7 - (OldValue % 8);
+ DisMap[Pos] = (UINT8)(DisMap[Pos] | (UINT8)(1 << Bit));
for (Index2 = Index; Index2 < Number - 1; Index2++) {
CurrentVal[Index2] = CurrentVal[Index2 + 1];
}
@@ -1025,27 +1019,28 @@ AdjustOptionValue (
// If NewValue is not in OldlegacyDev array, we are changing to a disabled item
// so we should modify DisMap to reflect the change
//
- Pos = NewValue / 8;
- Bit = 7 - (NewValue % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] & (~ (UINT8) (1 << Bit)));
+ Pos = NewValue / 8;
+ Bit = 7 - (NewValue % 8);
+ DisMap[Pos] = (UINT8)(DisMap[Pos] & (~(UINT8)(1 << Bit)));
if (0xFF != OldValue) {
//
// Because NewValue is a item that was disabled before
// so after changing the OldValue should be disabled
// actually we are doing a swap of enable-disable states of two items
//
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
+ Pos = OldValue / 8;
+ Bit = 7 - (OldValue % 8);
+ DisMap[Pos] = (UINT8)(DisMap[Pos] | (UINT8)(1 << Bit));
}
}
}
+
//
// To prevent DISABLE appears in the middle of the list
// we should perform a re-ordering
//
Index3 = Index;
- Index = 0;
+ Index = 0;
while (Index < Number) {
if (0xFF != CurrentVal[Index]) {
Index++;
@@ -1063,8 +1058,8 @@ AdjustOptionValue (
}
if (Index2 < Number) {
- CurrentVal[Index] = CurrentVal[Index2];
- CurrentVal[Index2] = 0xFF;
+ CurrentVal[Index] = CurrentVal[Index2];
+ CurrentVal[Index2] = 0xFF;
}
Index++;
@@ -1080,7 +1075,7 @@ AdjustOptionValue (
//
// Pass changed uncommitted data back to Form Browser
//
- HiiSetBrowserData (&mLegacyBootOptionGuid, mLegacyBootStorageName, sizeof (LEGACY_BOOT_NV_DATA), (UINT8 *) CurrentNVMap, NULL);
+ HiiSetBrowserData (&mLegacyBootOptionGuid, mLegacyBootStorageName, sizeof (LEGACY_BOOT_NV_DATA), (UINT8 *)CurrentNVMap, NULL);
}
/**
@@ -1104,15 +1099,15 @@ AdjustOptionValue (
EFI_STATUS
EFIAPI
LegacyBootOptionCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN EFI_BROWSER_ACTION Action,
+ IN EFI_QUESTION_ID QuestionId,
+ IN UINT8 Type,
+ IN EFI_IFR_TYPE_VALUE *Value,
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
- if (Action != EFI_BROWSER_ACTION_CHANGED && Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_FORM_OPEN) {
+ if ((Action != EFI_BROWSER_ACTION_CHANGED) && (Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_FORM_OPEN)) {
//
// Do nothing for other UEFI Action. Only do call back when data is changed or the form is open.
//
@@ -1140,16 +1135,16 @@ LegacyBootOptionCallback (
if (Action == EFI_BROWSER_ACTION_CHANGING) {
switch (QuestionId) {
- case FORM_FLOPPY_BOOT_ID:
- case FORM_HARDDISK_BOOT_ID:
- case FORM_CDROM_BOOT_ID:
- case FORM_NET_BOOT_ID:
- case FORM_BEV_BOOT_ID:
- UpdateLegacyDeviceOrderPage (QuestionId);
- break;
+ case FORM_FLOPPY_BOOT_ID:
+ case FORM_HARDDISK_BOOT_ID:
+ case FORM_CDROM_BOOT_ID:
+ case FORM_NET_BOOT_ID:
+ case FORM_BEV_BOOT_ID:
+ UpdateLegacyDeviceOrderPage (QuestionId);
+ break;
- default:
- break;
+ default:
+ break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
if ((Value == NULL) || (ActionRequest == NULL)) {
@@ -1157,13 +1152,13 @@ LegacyBootOptionCallback (
}
if ((QuestionId >= LEGACY_FD_QUESTION_ID) && (QuestionId < LEGACY_BEV_QUESTION_ID + MAX_MENU_NUMBER)) {
- AdjustOptionValue(QuestionId, Value);
+ AdjustOptionValue (QuestionId, Value);
}
}
+
return EFI_SUCCESS;
}
-
/**
Create a menu entry by given menu type.
@@ -1178,7 +1173,7 @@ CreateMenuEntry (
VOID
)
{
- LEGACY_MENU_ENTRY *MenuEntry;
+ LEGACY_MENU_ENTRY *MenuEntry;
//
// Create new menu entry
@@ -1194,7 +1189,7 @@ CreateMenuEntry (
return NULL;
}
- MenuEntry->Signature = LEGACY_MENU_ENTRY_SIGNATURE;
+ MenuEntry->Signature = LEGACY_MENU_ENTRY_SIGNATURE;
return MenuEntry;
}
@@ -1208,20 +1203,20 @@ GetLegacyOptionsOrder (
VOID
)
{
- UINTN VarSize;
- UINT8 *VarData;
- UINT8 *VarTmp;
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- UINT16 *LegacyDev;
- UINTN Index;
- LEGACY_MENU_OPTION *OptionMenu;
- UINT16 VarDevOrder;
- UINTN Pos;
- UINTN Bit;
- UINT8 *DisMap;
- UINTN TotalLength;
-
- LegacyDev = NULL;
+ UINTN VarSize;
+ UINT8 *VarData;
+ UINT8 *VarTmp;
+ LEGACY_DEV_ORDER_ENTRY *DevOrder;
+ UINT16 *LegacyDev;
+ UINTN Index;
+ LEGACY_MENU_OPTION *OptionMenu;
+ UINT16 VarDevOrder;
+ UINTN Pos;
+ UINTN Bit;
+ UINT8 *DisMap;
+ UINTN TotalLength;
+
+ LegacyDev = NULL;
OptionMenu = NULL;
DisMap = ZeroMem (mLegacyBootOptionPrivate->MaintainMapData->DisableMap, sizeof (mLegacyBootOptionPrivate->MaintainMapData->DisableMap));
@@ -1229,42 +1224,42 @@ GetLegacyOptionsOrder (
//
// Get Device Order from variable
//
- GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **) &VarData, &VarSize);
+ GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **)&VarData, &VarSize);
VarTmp = VarData;
if (NULL != VarData) {
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData;
+ DevOrder = (LEGACY_DEV_ORDER_ENTRY *)VarData;
while (VarData < VarTmp + VarSize) {
switch (DevOrder->BbsType) {
- case BBS_FLOPPY:
- LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyFD;
- OptionMenu = &LegacyFDMenu;
- break;
+ case BBS_FLOPPY:
+ LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyFD;
+ OptionMenu = &LegacyFDMenu;
+ break;
- case BBS_HARDDISK:
- LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyHD;
- OptionMenu = &LegacyHDMenu;
- break;
+ case BBS_HARDDISK:
+ LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyHD;
+ OptionMenu = &LegacyHDMenu;
+ break;
- case BBS_CDROM:
- LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyCD;
- OptionMenu = &LegacyCDMenu;
- break;
+ case BBS_CDROM:
+ LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyCD;
+ OptionMenu = &LegacyCDMenu;
+ break;
- case BBS_EMBED_NETWORK:
- LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyNET;
- OptionMenu = &LegacyNETMenu;
- break;
+ case BBS_EMBED_NETWORK:
+ LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyNET;
+ OptionMenu = &LegacyNETMenu;
+ break;
- case BBS_BEV_DEVICE:
- LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyBEV;
- OptionMenu = &LegacyBEVMenu;
- break;
+ case BBS_BEV_DEVICE:
+ LegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyBEV;
+ OptionMenu = &LegacyBEVMenu;
+ break;
- case BBS_UNKNOWN:
- default:
- ASSERT (FALSE);
- DEBUG ((DEBUG_ERROR, "Unsupported device type found!\n"));
- break;
+ case BBS_UNKNOWN:
+ default:
+ ASSERT (FALSE);
+ DEBUG ((DEBUG_ERROR, "Unsupported device type found!\n"));
+ break;
}
//
@@ -1272,21 +1267,21 @@ GetLegacyOptionsOrder (
//
for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
TotalLength = sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16);
- VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + TotalLength);
+ VarDevOrder = *(UINT16 *)((UINT8 *)DevOrder + TotalLength);
if (0xFF00 == (VarDevOrder & 0xFF00)) {
- LegacyDev[Index] = 0xFF;
- Pos = (VarDevOrder & 0xFF) / 8;
- Bit = 7 - ((VarDevOrder & 0xFF) % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
+ LegacyDev[Index] = 0xFF;
+ Pos = (VarDevOrder & 0xFF) / 8;
+ Bit = 7 - ((VarDevOrder & 0xFF) % 8);
+ DisMap[Pos] = (UINT8)(DisMap[Pos] | (UINT8)(1 << Bit));
} else {
LegacyDev[Index] = VarDevOrder & 0xFF;
}
}
- VarData ++;
- VarData += *(UINT16 *) VarData;
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData;
+ VarData++;
+ VarData += *(UINT16 *)VarData;
+ DevOrder = (LEGACY_DEV_ORDER_ENTRY *)VarData;
}
}
@@ -1324,11 +1319,11 @@ GetLegacyOptions (
InitializeListHead (&LegacyNETMenu.Head);
InitializeListHead (&LegacyBEVMenu.Head);
- FDNum = 0;
- HDNum = 0;
- CDNum = 0;
- NETNum = 0;
- BEVNum = 0;
+ FDNum = 0;
+ HDNum = 0;
+ CDNum = 0;
+ NETNum = 0;
+ BEVNum = 0;
EfiBootManagerConnectAll ();
@@ -1343,59 +1338,60 @@ GetLegacyOptions (
for (Index = 0; Index < BootOptionCount; Index++) {
if ((DevicePathType (BootOption[Index].FilePath) != BBS_DEVICE_PATH) ||
(DevicePathSubType (BootOption[Index].FilePath) != BBS_BBS_DP)
- ) {
+ )
+ {
continue;
}
+
ASSERT (BootOption[Index].OptionalDataSize == sizeof (LEGACY_BOOT_OPTION_BBS_DATA));
NewMenuEntry = CreateMenuEntry ();
ASSERT (NewMenuEntry != NULL);
- NewLegacyDevContext = (LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;
- NewLegacyDevContext->BbsIndex = ((LEGACY_BOOT_OPTION_BBS_DATA *) BootOption[Index].OptionalData)->BbsIndex;
+ NewLegacyDevContext = (LEGACY_DEVICE_CONTEXT *)NewMenuEntry->VariableContext;
+ NewLegacyDevContext->BbsIndex = ((LEGACY_BOOT_OPTION_BBS_DATA *)BootOption[Index].OptionalData)->BbsIndex;
NewLegacyDevContext->Description = AllocateCopyPool (StrSize (BootOption[Index].Description), BootOption[Index].Description);
ASSERT (NewLegacyDevContext->Description != NULL);
NewMenuEntry->DisplayString = NewLegacyDevContext->Description;
NewMenuEntry->HelpString = NULL;
- switch (((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType) {
- case BBS_TYPE_FLOPPY:
- InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link);
- FDNum++;
- break;
+ switch (((BBS_BBS_DEVICE_PATH *)BootOption[Index].FilePath)->DeviceType) {
+ case BBS_TYPE_FLOPPY:
+ InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link);
+ FDNum++;
+ break;
- case BBS_TYPE_HARDDRIVE:
- InsertTailList (&LegacyHDMenu.Head, &NewMenuEntry->Link);
- HDNum++;
- break;
+ case BBS_TYPE_HARDDRIVE:
+ InsertTailList (&LegacyHDMenu.Head, &NewMenuEntry->Link);
+ HDNum++;
+ break;
- case BBS_TYPE_CDROM:
- InsertTailList (&LegacyCDMenu.Head, &NewMenuEntry->Link);
- CDNum++;
- break;
+ case BBS_TYPE_CDROM:
+ InsertTailList (&LegacyCDMenu.Head, &NewMenuEntry->Link);
+ CDNum++;
+ break;
- case BBS_TYPE_EMBEDDED_NETWORK:
- InsertTailList (&LegacyNETMenu.Head, &NewMenuEntry->Link);
- NETNum++;
- break;
+ case BBS_TYPE_EMBEDDED_NETWORK:
+ InsertTailList (&LegacyNETMenu.Head, &NewMenuEntry->Link);
+ NETNum++;
+ break;
- case BBS_TYPE_BEV:
- InsertTailList (&LegacyBEVMenu.Head, &NewMenuEntry->Link);
- BEVNum++;
- break;
+ case BBS_TYPE_BEV:
+ InsertTailList (&LegacyBEVMenu.Head, &NewMenuEntry->Link);
+ BEVNum++;
+ break;
}
}
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
- LegacyFDMenu.MenuNumber = FDNum;
- LegacyHDMenu.MenuNumber = HDNum;
- LegacyCDMenu.MenuNumber = CDNum;
- LegacyNETMenu.MenuNumber = NETNum;
- LegacyBEVMenu.MenuNumber = BEVNum;
+ LegacyFDMenu.MenuNumber = FDNum;
+ LegacyHDMenu.MenuNumber = HDNum;
+ LegacyCDMenu.MenuNumber = CDNum;
+ LegacyNETMenu.MenuNumber = NETNum;
+ LegacyBEVMenu.MenuNumber = BEVNum;
}
-
/**
Install Boot Manager Menu driver.
@@ -1410,15 +1406,15 @@ GetLegacyOptions (
EFI_STATUS
EFIAPI
LegacyBootMaintUiLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
LEGACY_BOOT_OPTION_CALLBACK_DATA *LegacyBootOptionData;
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (!EFI_ERROR (Status)) {
//
// Create LegacyBootOptionData structures for Driver Callback
@@ -1450,12 +1446,12 @@ LegacyBootMaintUiLibConstructor (
// Publish our HII data
//
LegacyBootOptionData->HiiHandle = HiiAddPackages (
- &mLegacyBootOptionGuid,
- LegacyBootOptionData->DriverHandle,
- LegacyBootMaintUiVfrBin,
- LegacyBootMaintUiLibStrings,
- NULL
- );
+ &mLegacyBootOptionGuid,
+ LegacyBootOptionData->DriverHandle,
+ LegacyBootMaintUiVfrBin,
+ LegacyBootMaintUiLibStrings,
+ NULL
+ );
ASSERT (LegacyBootOptionData->HiiHandle != NULL);
mLegacyBootOptionPrivate = LegacyBootOptionData;
@@ -1481,9 +1477,9 @@ LegacyBootMaintUiLibDestructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- if (mLegacyBootOptionPrivate != NULL && mLegacyBootOptionPrivate->DriverHandle != NULL) {
+ if ((mLegacyBootOptionPrivate != NULL) && (mLegacyBootOptionPrivate->DriverHandle != NULL)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
mLegacyBootOptionPrivate->DriverHandle,
&gEfiDevicePathProtocolGuid,
@@ -1502,4 +1498,3 @@ LegacyBootMaintUiLibDestructor (
return EFI_SUCCESS;
}
-
diff --git a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h
index 87290294df..65aa89327a 100644
--- a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h
+++ b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h
@@ -6,13 +6,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#ifndef _EFI_LEGACY_BOOT_OPTION_H_
#define _EFI_LEGACY_BOOT_OPTION_H_
#include <PiDxe.h>
-
#include <Guid/GlobalVariable.h>
#include <Guid/LegacyDevOrder.h>
#include <Guid/MdeModuleHii.h>
@@ -38,42 +36,40 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "LegacyBootMaintUiVfr.h"
-#define CONFIG_OPTION_OFFSET 0x1200
+#define CONFIG_OPTION_OFFSET 0x1200
//
// VarOffset that will be used to create question
// all these values are computed from the structure
// defined below
//
-#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))
+#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))
//
// Question Id of Zero is invalid, so add an offset to it
//
-#define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
-
-
-#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
-#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
-#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
-#define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
-#define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
+#define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
+#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
+#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
+#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
+#define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
+#define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
//
// String Constant
//
-#define STR_FLOPPY L"Floppy Drive #%02x"
-#define STR_HARDDISK L"HardDisk Drive #%02x"
-#define STR_CDROM L"ATAPI CDROM Drive #%02x"
-#define STR_NET L"NET Drive #%02x"
-#define STR_BEV L"BEV Drive #%02x"
-
-#define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
-#define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
-#define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
-#define STR_NET_HELP L"NET Drive #%02x"
-#define STR_BEV_HELP L"BEV Drive #%02x"
+#define STR_FLOPPY L"Floppy Drive #%02x"
+#define STR_HARDDISK L"HardDisk Drive #%02x"
+#define STR_CDROM L"ATAPI CDROM Drive #%02x"
+#define STR_NET L"NET Drive #%02x"
+#define STR_BEV L"BEV Drive #%02x"
+
+#define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
+#define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
+#define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
+#define STR_NET_HELP L"NET Drive #%02x"
+#define STR_BEV_HELP L"BEV Drive #%02x"
#define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"
#define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"
@@ -84,7 +80,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// These are the VFR compiler generated data representing our VFR data.
//
-extern UINT8 LegacyBootMaintUiVfrBin[];
+extern UINT8 LegacyBootMaintUiVfrBin[];
#pragma pack(1)
@@ -92,52 +88,49 @@ extern UINT8 LegacyBootMaintUiVfrBin[];
/// HII specific Vendor Device Path definition.
///
typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
} HII_VENDOR_DEVICE_PATH;
-
-
//
// Variable created with this flag will be "Efi:...."
//
#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
-
#define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')
typedef struct {
- UINTN Signature;
+ UINTN Signature;
//
// HII relative handles
//
- EFI_HII_HANDLE HiiHandle;
- EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+ EFI_HANDLE DriverHandle;
//
// Produced protocols
//
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
//
// Maintain the data.
//
- LEGACY_BOOT_MAINTAIN_DATA *MaintainMapData;
+ LEGACY_BOOT_MAINTAIN_DATA *MaintainMapData;
} LEGACY_BOOT_OPTION_CALLBACK_DATA;
//
// All of the signatures that will be used in list structure
//
-#define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
-#define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
+#define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
+#define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
#define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9
typedef struct {
- UINTN Signature;
- LIST_ENTRY Head;
- UINTN MenuNumber;
+ UINTN Signature;
+ LIST_ENTRY Head;
+ UINTN MenuNumber;
} LEGACY_MENU_OPTION;
typedef struct {
@@ -146,18 +139,18 @@ typedef struct {
} LEGACY_DEVICE_CONTEXT;
typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- UINTN OptionNumber;
- UINT16 *DisplayString;
- UINT16 *HelpString;
- EFI_STRING_ID DisplayStringToken;
- EFI_STRING_ID HelpStringToken;
- VOID *VariableContext;
+ UINTN Signature;
+ LIST_ENTRY Link;
+ UINTN OptionNumber;
+ UINT16 *DisplayString;
+ UINT16 *HelpString;
+ EFI_STRING_ID DisplayStringToken;
+ EFI_STRING_ID HelpStringToken;
+ VOID *VariableContext;
} LEGACY_MENU_ENTRY;
typedef struct {
- UINT16 BbsIndex;
+ UINT16 BbsIndex;
} LEGACY_BOOT_OPTION_BBS_DATA;
#pragma pack()
@@ -183,12 +176,12 @@ typedef struct {
EFI_STATUS
EFIAPI
LegacyBootOptionCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN EFI_BROWSER_ACTION Action,
+ IN EFI_QUESTION_ID QuestionId,
+ IN UINT8 Type,
+ IN EFI_IFR_TYPE_VALUE *Value,
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
);
/**
@@ -216,10 +209,10 @@ LegacyBootOptionCallback (
EFI_STATUS
EFIAPI
LegacyBootOptionExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
);
/**
@@ -241,9 +234,9 @@ LegacyBootOptionExtractConfig (
EFI_STATUS
EFIAPI
LegacyBootOptionRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
);
#endif
diff --git a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h
index 1335486574..7c751fc73c 100644
--- a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h
+++ b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h
@@ -6,34 +6,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#ifndef _EFI_LEGACY_BOOT_OPTION_VFR_H_
#define _EFI_LEGACY_BOOT_OPTION_VFR_H_
#include <Guid/HiiBootMaintenanceFormset.h>
-#define MAX_MENU_NUMBER 100
+#define MAX_MENU_NUMBER 100
#define LEGACY_BOOT_OPTION_FORMSET_GUID { 0x6bc75598, 0x89b4, 0x483d, { 0x91, 0x60, 0x7f, 0x46, 0x9a, 0x96, 0x35, 0x31 } }
-#define VARSTORE_ID_LEGACY_BOOT 0x0001
-
+#define VARSTORE_ID_LEGACY_BOOT 0x0001
#define LEGACY_BOOT_FORM_ID 0x1000
#define LEGACY_ORDER_CHANGE_FORM_ID 0x1001
+#define FORM_FLOPPY_BOOT_ID 0x2000
+#define FORM_HARDDISK_BOOT_ID 0x2001
+#define FORM_CDROM_BOOT_ID 0x2002
+#define FORM_NET_BOOT_ID 0x2003
+#define FORM_BEV_BOOT_ID 0x2004
-#define FORM_FLOPPY_BOOT_ID 0x2000
-#define FORM_HARDDISK_BOOT_ID 0x2001
-#define FORM_CDROM_BOOT_ID 0x2002
-#define FORM_NET_BOOT_ID 0x2003
-#define FORM_BEV_BOOT_ID 0x2004
-
-
-
-#define FORM_BOOT_LEGACY_DEVICE_ID 0x9000
-#define FORM_BOOT_LEGACY_LABEL_END 0x9001
-
+#define FORM_BOOT_LEGACY_DEVICE_ID 0x9000
+#define FORM_BOOT_LEGACY_LABEL_END 0x9001
#pragma pack(1)
@@ -49,11 +43,11 @@ typedef struct {
//
// Legacy Device Order Selection Storage
//
- UINT16 LegacyFD[MAX_MENU_NUMBER];
- UINT16 LegacyHD[MAX_MENU_NUMBER];
- UINT16 LegacyCD[MAX_MENU_NUMBER];
- UINT16 LegacyNET[MAX_MENU_NUMBER];
- UINT16 LegacyBEV[MAX_MENU_NUMBER];
+ UINT16 LegacyFD[MAX_MENU_NUMBER];
+ UINT16 LegacyHD[MAX_MENU_NUMBER];
+ UINT16 LegacyCD[MAX_MENU_NUMBER];
+ UINT16 LegacyNET[MAX_MENU_NUMBER];
+ UINT16 LegacyBEV[MAX_MENU_NUMBER];
} LEGACY_BOOT_NV_DATA;
///
@@ -68,10 +62,10 @@ typedef struct {
//
// Legacy Device Order Selection Storage
//
- LEGACY_BOOT_NV_DATA InitialNvData;
- LEGACY_BOOT_NV_DATA CurrentNvData;
- LEGACY_BOOT_NV_DATA LastTimeNvData;
- UINT8 DisableMap[32];
+ LEGACY_BOOT_NV_DATA InitialNvData;
+ LEGACY_BOOT_NV_DATA CurrentNvData;
+ LEGACY_BOOT_NV_DATA LastTimeNvData;
+ UINT8 DisableMap[32];
} LEGACY_BOOT_MAINTAIN_DATA;
#pragma pack()
diff --git a/OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h b/OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h
index 292e2c1e7a..8dd8b884d3 100644
--- a/OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h
+++ b/OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h
@@ -28,7 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#pragma pack(1)
typedef struct {
- UINT16 BbsIndex;
+ UINT16 BbsIndex;
} LEGACY_BM_BOOT_OPTION_BBS_DATA;
#pragma pack()
@@ -44,7 +44,7 @@ typedef struct {
VOID
EFIAPI
LegacyBmBoot (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
+ IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
);
/**
diff --git a/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c b/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c
index cd0e02060f..032aacba68 100644
--- a/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c
+++ b/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c
@@ -25,9 +25,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
LegacyBootManagerLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
-)
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
{
EfiBootManagerRegisterLegacyBootSupport (
LegacyBmRefreshAllBootOption,
@@ -45,12 +45,14 @@ LegacyBootManagerLibConstructor (
**/
UINT16
LegacyBmDeviceType (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- ASSERT ((DevicePathType (DevicePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (DevicePath) == BBS_BBS_DP));
- return ((BBS_BBS_DEVICE_PATH *) DevicePath)->DeviceType;
+ ASSERT (
+ (DevicePathType (DevicePath) == BBS_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePath) == BBS_BBS_DP)
+ );
+ return ((BBS_BBS_DEVICE_PATH *)DevicePath)->DeviceType;
}
/**
@@ -63,7 +65,7 @@ LegacyBmDeviceType (
**/
BOOLEAN
LegacyBmValidBbsEntry (
- IN BBS_TABLE *BbsEntry
+ IN BBS_TABLE *BbsEntry
)
{
switch (BbsEntry->BootPriority) {
@@ -87,10 +89,10 @@ LegacyBmValidBbsEntry (
**/
VOID
LegacyBmBuildLegacyDevNameString (
- IN BBS_TABLE *CurBBSEntry,
- IN UINTN Index,
- IN UINTN BufSize,
- OUT CHAR16 *BootString
+ IN BBS_TABLE *CurBBSEntry,
+ IN UINTN Index,
+ IN UINTN BufSize,
+ OUT CHAR16 *BootString
)
{
CHAR16 *Fmt;
@@ -100,77 +102,78 @@ LegacyBmBuildLegacyDevNameString (
CHAR16 StringBufferU[LEGACY_BM_BOOT_DESCRIPTION_LENGTH + 1];
switch (Index) {
- //
- // Primary Master
- //
- case 1:
- Fmt = L"Primary Master %s";
- break;
+ //
+ // Primary Master
+ //
+ case 1:
+ Fmt = L"Primary Master %s";
+ break;
- //
- // Primary Slave
- //
- case 2:
- Fmt = L"Primary Slave %s";
- break;
+ //
+ // Primary Slave
+ //
+ case 2:
+ Fmt = L"Primary Slave %s";
+ break;
- //
- // Secondary Master
- //
- case 3:
- Fmt = L"Secondary Master %s";
- break;
+ //
+ // Secondary Master
+ //
+ case 3:
+ Fmt = L"Secondary Master %s";
+ break;
- //
- // Secondary Slave
- //
- case 4:
- Fmt = L"Secondary Slave %s";
- break;
+ //
+ // Secondary Slave
+ //
+ case 4:
+ Fmt = L"Secondary Slave %s";
+ break;
- default:
- Fmt = L"%s";
- break;
+ default:
+ Fmt = L"%s";
+ break;
}
switch (CurBBSEntry->DeviceType) {
- case BBS_FLOPPY:
- Type = L"Floppy";
- break;
-
- case BBS_HARDDISK:
- Type = L"Harddisk";
- break;
-
- case BBS_CDROM:
- Type = L"CDROM";
- break;
-
- case BBS_PCMCIA:
- Type = L"PCMCIAe";
- break;
-
- case BBS_USB:
- Type = L"USB";
- break;
-
- case BBS_EMBED_NETWORK:
- Type = L"Network";
- break;
-
- case BBS_BEV_DEVICE:
- Type = L"BEVe";
- break;
-
- case BBS_UNKNOWN:
- default:
- Type = L"Unknown";
- break;
+ case BBS_FLOPPY:
+ Type = L"Floppy";
+ break;
+
+ case BBS_HARDDISK:
+ Type = L"Harddisk";
+ break;
+
+ case BBS_CDROM:
+ Type = L"CDROM";
+ break;
+
+ case BBS_PCMCIA:
+ Type = L"PCMCIAe";
+ break;
+
+ case BBS_USB:
+ Type = L"USB";
+ break;
+
+ case BBS_EMBED_NETWORK:
+ Type = L"Network";
+ break;
+
+ case BBS_BEV_DEVICE:
+ Type = L"BEVe";
+ break;
+
+ case BBS_UNKNOWN:
+ default:
+ Type = L"Unknown";
+ break;
}
+
//
// If current BBS entry has its description then use it.
//
- StringDesc = (CHAR8 *) (((UINTN) CurBBSEntry->DescStringSegment << 4) + CurBBSEntry->DescStringOffset);
+ StringDesc = (CHAR8 *)(((UINTN)CurBBSEntry->DescStringSegment << 4) + CurBBSEntry->DescStringOffset);
if (NULL != StringDesc) {
//
// Only get first 32 characters, this is suggested by BBS spec
@@ -178,15 +181,15 @@ LegacyBmBuildLegacyDevNameString (
CopyMem (StringBufferA, StringDesc, LEGACY_BM_BOOT_DESCRIPTION_LENGTH);
StringBufferA[LEGACY_BM_BOOT_DESCRIPTION_LENGTH] = 0;
AsciiStrToUnicodeStrS (StringBufferA, StringBufferU, ARRAY_SIZE (StringBufferU));
- Fmt = L"%s";
- Type = StringBufferU;
+ Fmt = L"%s";
+ Type = StringBufferU;
}
//
// BbsTable 16 entries are for onboard IDE.
// Set description string for SATA harddisks, Harddisk 0 ~ Harddisk 11
//
- if (Index >= 5 && Index <= 16 && (CurBBSEntry->DeviceType == BBS_HARDDISK || CurBBSEntry->DeviceType == BBS_CDROM)) {
+ if ((Index >= 5) && (Index <= 16) && ((CurBBSEntry->DeviceType == BBS_HARDDISK) || (CurBBSEntry->DeviceType == BBS_CDROM))) {
Fmt = L"%s %d";
UnicodeSPrint (BootString, BufSize, Fmt, Type, Index - 5);
} else {
@@ -206,23 +209,24 @@ LegacyBmBuildLegacyDevNameString (
**/
UINT16
LegacyBmFuzzyMatch (
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOption,
- BBS_TABLE *BbsTable,
- UINT16 BbsCount,
- BOOLEAN *BbsIndexUsed
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOption,
+ BBS_TABLE *BbsTable,
+ UINT16 BbsCount,
+ BOOLEAN *BbsIndexUsed
)
{
- UINT16 Index;
- LEGACY_BM_BOOT_OPTION_BBS_DATA *BbsData;
- CHAR16 Description[LEGACY_BM_BOOT_DESCRIPTION_LENGTH + 1];
+ UINT16 Index;
+ LEGACY_BM_BOOT_OPTION_BBS_DATA *BbsData;
+ CHAR16 Description[LEGACY_BM_BOOT_DESCRIPTION_LENGTH + 1];
- BbsData = (LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOption->OptionalData;
+ BbsData = (LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption->OptionalData;
//
// Directly check the BBS index stored in BootOption
//
if ((BbsData->BbsIndex < BbsCount) &&
- (LegacyBmDeviceType (BootOption->FilePath) == BbsTable[BbsData->BbsIndex].DeviceType)) {
+ (LegacyBmDeviceType (BootOption->FilePath) == BbsTable[BbsData->BbsIndex].DeviceType))
+ {
LegacyBmBuildLegacyDevNameString (
&BbsTable[BbsData->BbsIndex],
BbsData->BbsIndex,
@@ -246,7 +250,8 @@ LegacyBmFuzzyMatch (
//
for (Index = 0; Index < BbsCount; Index++) {
if (!LegacyBmValidBbsEntry (&BbsTable[Index]) ||
- (BbsTable[Index].DeviceType != LegacyBmDeviceType (BootOption->FilePath))) {
+ (BbsTable[Index].DeviceType != LegacyBmDeviceType (BootOption->FilePath)))
+ {
continue;
}
@@ -289,44 +294,48 @@ LegacyBmFuzzyMatch (
**/
VOID
LegacyBmUpdateBbsIndex (
- LEGACY_DEV_ORDER_ENTRY *LegacyDevOrder,
- UINTN *LegacyDevOrderSize,
- UINT16 DeviceType,
- UINT16 OldBbsIndex,
- UINT16 NewBbsIndex // Delete entry if -1
+ LEGACY_DEV_ORDER_ENTRY *LegacyDevOrder,
+ UINTN *LegacyDevOrderSize,
+ UINT16 DeviceType,
+ UINT16 OldBbsIndex,
+ UINT16 NewBbsIndex // Delete entry if -1
)
{
- LEGACY_DEV_ORDER_ENTRY *Entry;
- UINTN Index;
+ LEGACY_DEV_ORDER_ENTRY *Entry;
+ UINTN Index;
- ASSERT (((LegacyDevOrder == NULL) && (*LegacyDevOrderSize == 0)) ||
- ((LegacyDevOrder != NULL) && (*LegacyDevOrderSize != 0))
- );
+ ASSERT (
+ ((LegacyDevOrder == NULL) && (*LegacyDevOrderSize == 0)) ||
+ ((LegacyDevOrder != NULL) && (*LegacyDevOrderSize != 0))
+ );
for (Entry = LegacyDevOrder;
- Entry < (LEGACY_DEV_ORDER_ENTRY *) ((UINT8 *) LegacyDevOrder + *LegacyDevOrderSize);
- Entry = (LEGACY_DEV_ORDER_ENTRY *) ((UINTN) Entry + sizeof (BBS_TYPE) + Entry->Length)
- ) {
+ Entry < (LEGACY_DEV_ORDER_ENTRY *)((UINT8 *)LegacyDevOrder + *LegacyDevOrderSize);
+ Entry = (LEGACY_DEV_ORDER_ENTRY *)((UINTN)Entry + sizeof (BBS_TYPE) + Entry->Length)
+ )
+ {
if (Entry->BbsType == DeviceType) {
for (Index = 0; Index < Entry->Length / sizeof (UINT16) - 1; Index++) {
if (Entry->Data[Index] == OldBbsIndex) {
- if (NewBbsIndex == (UINT16) -1) {
+ if (NewBbsIndex == (UINT16)-1) {
//
// Delete the old entry
//
CopyMem (
&Entry->Data[Index],
&Entry->Data[Index + 1],
- (UINT8 *) LegacyDevOrder + *LegacyDevOrderSize - (UINT8 *) &Entry->Data[Index + 1]
+ (UINT8 *)LegacyDevOrder + *LegacyDevOrderSize - (UINT8 *)&Entry->Data[Index + 1]
);
Entry->Length -= sizeof (UINT16);
- *LegacyDevOrderSize -= sizeof(UINT16);
+ *LegacyDevOrderSize -= sizeof (UINT16);
} else {
- Entry->Data[Index] = NewBbsIndex;
+ Entry->Data[Index] = NewBbsIndex;
}
+
break;
}
}
+
break;
}
}
@@ -350,7 +359,8 @@ LegacyBmDeleteAllBootOptions (
BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
for (Index = 0; Index < BootOptionCount; Index++) {
if ((DevicePathType (BootOption[Index].FilePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP)) {
+ (DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP))
+ {
Status = EfiBootManagerDeleteLoadOptionVariable (BootOption[Index].OptionNumber, BootOption[Index].OptionType);
//
// Deleting variable with current variable implementation shouldn't fail.
@@ -374,7 +384,6 @@ LegacyBmDeleteAllBootOptions (
return EFI_SUCCESS;
}
-
/**
Delete all the invalid legacy boot options.
@@ -401,12 +410,12 @@ LegacyBmDeleteAllInvalidBootOptions (
UINTN LegacyDevOrderSize;
BOOLEAN *BbsIndexUsed;
- HddCount = 0;
- BbsCount = 0;
- HddInfo = NULL;
- BbsTable = NULL;
+ HddCount = 0;
+ BbsCount = 0;
+ HddInfo = NULL;
+ BbsTable = NULL;
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -422,7 +431,7 @@ LegacyBmDeleteAllInvalidBootOptions (
return Status;
}
- GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **) &LegacyDevOrder, &LegacyDevOrderSize);
+ GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **)&LegacyDevOrder, &LegacyDevOrderSize);
BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
@@ -434,13 +443,14 @@ LegacyBmDeleteAllInvalidBootOptions (
// Skip non legacy boot option
//
if ((DevicePathType (BootOption[Index].FilePath) != BBS_DEVICE_PATH) ||
- (DevicePathSubType (BootOption[Index].FilePath) != BBS_BBS_DP)) {
+ (DevicePathSubType (BootOption[Index].FilePath) != BBS_BBS_DP))
+ {
continue;
}
BbsIndex = LegacyBmFuzzyMatch (&BootOption[Index], BbsTable, BbsCount, BbsIndexUsed);
if (BbsIndex == BbsCount) {
- DEBUG ((DEBUG_INFO, "[LegacyBds] Delete Boot Option Boot%04x: %s\n", (UINTN) BootOption[Index].OptionNumber, BootOption[Index].Description));
+ DEBUG ((DEBUG_INFO, "[LegacyBds] Delete Boot Option Boot%04x: %s\n", (UINTN)BootOption[Index].OptionNumber, BootOption[Index].Description));
//
// Delete entry from LegacyDevOrder
//
@@ -448,14 +458,20 @@ LegacyBmDeleteAllInvalidBootOptions (
LegacyDevOrder,
&LegacyDevOrderSize,
LegacyBmDeviceType (BootOption[Index].FilePath),
- ((LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOption[Index].OptionalData)->BbsIndex,
- (UINT16) -1
+ ((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption[Index].OptionalData)->BbsIndex,
+ (UINT16)-1
);
EfiBootManagerDeleteLoadOptionVariable (BootOption[Index].OptionNumber, BootOption[Index].OptionType);
} else {
- if (((LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOption[Index].OptionalData)->BbsIndex != BbsIndex) {
- DEBUG ((DEBUG_INFO, "[LegacyBds] Update Boot Option Boot%04x: %s Bbs0x%04x->Bbs0x%04x\n", (UINTN) BootOption[Index].OptionNumber, BootOption[Index].Description,
- (UINTN) ((LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOption[Index].OptionalData)->BbsIndex, (UINTN) BbsIndex));
+ if (((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption[Index].OptionalData)->BbsIndex != BbsIndex) {
+ DEBUG ((
+ DEBUG_INFO,
+ "[LegacyBds] Update Boot Option Boot%04x: %s Bbs0x%04x->Bbs0x%04x\n",
+ (UINTN)BootOption[Index].OptionNumber,
+ BootOption[Index].Description,
+ (UINTN)((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption[Index].OptionalData)->BbsIndex,
+ (UINTN)BbsIndex
+ ));
//
// Update the BBS index in LegacyDevOrder
//
@@ -463,18 +479,19 @@ LegacyBmDeleteAllInvalidBootOptions (
LegacyDevOrder,
&LegacyDevOrderSize,
LegacyBmDeviceType (BootOption[Index].FilePath),
- ((LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOption[Index].OptionalData)->BbsIndex,
+ ((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption[Index].OptionalData)->BbsIndex,
BbsIndex
);
//
// Update the OptionalData in the Boot#### variable
//
- ((LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOption[Index].OptionalData)->BbsIndex = BbsIndex;
+ ((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption[Index].OptionalData)->BbsIndex = BbsIndex;
EfiBootManagerLoadOptionToVariable (&BootOption[Index]);
}
}
}
+
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
if (LegacyDevOrder != NULL) {
@@ -492,7 +509,8 @@ LegacyBmDeleteAllInvalidBootOptions (
FreePool (LegacyDevOrder);
}
- FreePool(BbsIndexUsed);
+
+ FreePool (BbsIndexUsed);
return Status;
}
@@ -514,13 +532,13 @@ LegacyBmCreateLegacyBootOption (
IN UINT16 BbsIndex
)
{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- CHAR16 Description[LEGACY_BM_BOOT_DESCRIPTION_LENGTH + 1];
- CHAR8 HelpString[LEGACY_BM_BOOT_DESCRIPTION_LENGTH + 1];
- UINTN StringLen;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 Description[LEGACY_BM_BOOT_DESCRIPTION_LENGTH + 1];
+ CHAR8 HelpString[LEGACY_BM_BOOT_DESCRIPTION_LENGTH + 1];
+ UINTN StringLen;
LEGACY_BM_BOOT_OPTION_BBS_DATA *OptionalData;
- BBS_BBS_DEVICE_PATH *BbsNode;
+ BBS_BBS_DEVICE_PATH *BbsNode;
if ((BootOption == NULL) || (BbsEntry == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -532,11 +550,11 @@ LegacyBmCreateLegacyBootOption (
// Create the BBS device path with description string
//
UnicodeStrToAsciiStrS (Description, HelpString, sizeof (HelpString));
- StringLen = AsciiStrLen (HelpString);
+ StringLen = AsciiStrLen (HelpString);
DevicePath = AllocatePool (sizeof (BBS_BBS_DEVICE_PATH) + StringLen + END_DEVICE_PATH_LENGTH);
ASSERT (DevicePath != NULL);
- BbsNode = (BBS_BBS_DEVICE_PATH *) DevicePath;
+ BbsNode = (BBS_BBS_DEVICE_PATH *)DevicePath;
SetDevicePathNodeLength (BbsNode, sizeof (BBS_BBS_DEVICE_PATH) + StringLen);
BbsNode->Header.Type = BBS_DEVICE_PATH;
BbsNode->Header.SubType = BBS_BBS_DP;
@@ -563,7 +581,7 @@ LegacyBmCreateLegacyBootOption (
LOAD_OPTION_ACTIVE,
Description,
DevicePath,
- (UINT8 *) OptionalData,
+ (UINT8 *)OptionalData,
sizeof (LEGACY_BM_BOOT_OPTION_BBS_DATA)
);
FreePool (DevicePath);
@@ -585,13 +603,13 @@ LegacyBmCreateLegacyBootOption (
**/
UINT16 *
LegacyBmFillDevOrderBuf (
- IN BBS_TABLE *BbsTable,
- IN BBS_TYPE BbsType,
- IN UINTN BbsCount,
- OUT UINT16 *Buf
+ IN BBS_TABLE *BbsTable,
+ IN BBS_TYPE BbsType,
+ IN UINTN BbsCount,
+ OUT UINT16 *Buf
)
{
- UINTN Index;
+ UINTN Index;
for (Index = 0; Index < BbsCount; Index++) {
if (!LegacyBmValidBbsEntry (&BbsTable[Index])) {
@@ -602,7 +620,7 @@ LegacyBmFillDevOrderBuf (
continue;
}
- *Buf = (UINT16) (Index & 0xFF);
+ *Buf = (UINT16)(Index & 0xFF);
Buf++;
}
@@ -624,31 +642,31 @@ LegacyBmFillDevOrderBuf (
**/
EFI_STATUS
LegacyBmCreateDevOrder (
- IN BBS_TABLE *BbsTable,
- IN UINT16 BbsCount
+ IN BBS_TABLE *BbsTable,
+ IN UINT16 BbsCount
)
{
- UINTN Index;
- UINTN FDCount;
- UINTN HDCount;
- UINTN CDCount;
- UINTN NETCount;
- UINTN BEVCount;
- UINTN TotalSize;
- UINTN HeaderSize;
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- LEGACY_DEV_ORDER_ENTRY *DevOrderPtr;
- EFI_STATUS Status;
-
- FDCount = 0;
- HDCount = 0;
- CDCount = 0;
- NETCount = 0;
- BEVCount = 0;
- TotalSize = 0;
- HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
- DevOrder = NULL;
- Status = EFI_SUCCESS;
+ UINTN Index;
+ UINTN FDCount;
+ UINTN HDCount;
+ UINTN CDCount;
+ UINTN NETCount;
+ UINTN BEVCount;
+ UINTN TotalSize;
+ UINTN HeaderSize;
+ LEGACY_DEV_ORDER_ENTRY *DevOrder;
+ LEGACY_DEV_ORDER_ENTRY *DevOrderPtr;
+ EFI_STATUS Status;
+
+ FDCount = 0;
+ HDCount = 0;
+ CDCount = 0;
+ NETCount = 0;
+ BEVCount = 0;
+ TotalSize = 0;
+ HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
+ DevOrder = NULL;
+ Status = EFI_SUCCESS;
//
// Count all boot devices
@@ -659,28 +677,28 @@ LegacyBmCreateDevOrder (
}
switch (BbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- FDCount++;
- break;
+ case BBS_FLOPPY:
+ FDCount++;
+ break;
- case BBS_HARDDISK:
- HDCount++;
- break;
+ case BBS_HARDDISK:
+ HDCount++;
+ break;
- case BBS_CDROM:
- CDCount++;
- break;
+ case BBS_CDROM:
+ CDCount++;
+ break;
- case BBS_EMBED_NETWORK:
- NETCount++;
- break;
+ case BBS_EMBED_NETWORK:
+ NETCount++;
+ break;
- case BBS_BEV_DEVICE:
- BEVCount++;
- break;
+ case BBS_BEV_DEVICE:
+ BEVCount++;
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -697,29 +715,30 @@ LegacyBmCreateDevOrder (
if (NULL == DevOrder) {
return EFI_OUT_OF_RESOURCES;
}
- DevOrderPtr = DevOrder;
+
+ DevOrderPtr = DevOrder;
DevOrderPtr->BbsType = BBS_FLOPPY;
- DevOrderPtr->Length = (UINT16) (sizeof (DevOrderPtr->Length) + FDCount * sizeof (UINT16));
- DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) LegacyBmFillDevOrderBuf (BbsTable, BBS_FLOPPY, BbsCount, DevOrderPtr->Data);
+ DevOrderPtr->Length = (UINT16)(sizeof (DevOrderPtr->Length) + FDCount * sizeof (UINT16));
+ DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *)LegacyBmFillDevOrderBuf (BbsTable, BBS_FLOPPY, BbsCount, DevOrderPtr->Data);
DevOrderPtr->BbsType = BBS_HARDDISK;
- DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));
- DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) LegacyBmFillDevOrderBuf (BbsTable, BBS_HARDDISK, BbsCount, DevOrderPtr->Data);
+ DevOrderPtr->Length = (UINT16)(sizeof (UINT16) + HDCount * sizeof (UINT16));
+ DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *)LegacyBmFillDevOrderBuf (BbsTable, BBS_HARDDISK, BbsCount, DevOrderPtr->Data);
DevOrderPtr->BbsType = BBS_CDROM;
- DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));
- DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) LegacyBmFillDevOrderBuf (BbsTable, BBS_CDROM, BbsCount, DevOrderPtr->Data);
+ DevOrderPtr->Length = (UINT16)(sizeof (UINT16) + CDCount * sizeof (UINT16));
+ DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *)LegacyBmFillDevOrderBuf (BbsTable, BBS_CDROM, BbsCount, DevOrderPtr->Data);
DevOrderPtr->BbsType = BBS_EMBED_NETWORK;
- DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));
- DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) LegacyBmFillDevOrderBuf (BbsTable, BBS_EMBED_NETWORK, BbsCount, DevOrderPtr->Data);
+ DevOrderPtr->Length = (UINT16)(sizeof (UINT16) + NETCount * sizeof (UINT16));
+ DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *)LegacyBmFillDevOrderBuf (BbsTable, BBS_EMBED_NETWORK, BbsCount, DevOrderPtr->Data);
DevOrderPtr->BbsType = BBS_BEV_DEVICE;
- DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));
- DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) LegacyBmFillDevOrderBuf (BbsTable, BBS_BEV_DEVICE, BbsCount, DevOrderPtr->Data);
+ DevOrderPtr->Length = (UINT16)(sizeof (UINT16) + BEVCount * sizeof (UINT16));
+ DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *)LegacyBmFillDevOrderBuf (BbsTable, BBS_BEV_DEVICE, BbsCount, DevOrderPtr->Data);
- ASSERT (TotalSize == ((UINTN) DevOrderPtr - (UINTN) DevOrder));
+ ASSERT (TotalSize == ((UINTN)DevOrderPtr - (UINTN)DevOrder));
//
// Save device order for legacy boot device to variable.
@@ -751,54 +770,54 @@ LegacyBmUpdateDevOrder (
VOID
)
{
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- LEGACY_DEV_ORDER_ENTRY *NewDevOrder;
- LEGACY_DEV_ORDER_ENTRY *Ptr;
- LEGACY_DEV_ORDER_ENTRY *NewPtr;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- UINTN Index;
- UINTN Index2;
- UINTN *Idx;
- UINTN FDCount;
- UINTN HDCount;
- UINTN CDCount;
- UINTN NETCount;
- UINTN BEVCount;
- UINTN TotalSize;
- UINTN HeaderSize;
- UINT16 *NewFDPtr;
- UINT16 *NewHDPtr;
- UINT16 *NewCDPtr;
- UINT16 *NewNETPtr;
- UINT16 *NewBEVPtr;
- UINT16 *NewDevPtr;
- UINTN FDIndex;
- UINTN HDIndex;
- UINTN CDIndex;
- UINTN NETIndex;
- UINTN BEVIndex;
-
- Idx = NULL;
- FDCount = 0;
- HDCount = 0;
- CDCount = 0;
- NETCount = 0;
- BEVCount = 0;
- TotalSize = 0;
- HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
- FDIndex = 0;
- HDIndex = 0;
- CDIndex = 0;
- NETIndex = 0;
- BEVIndex = 0;
- NewDevPtr = NULL;
-
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ LEGACY_DEV_ORDER_ENTRY *DevOrder;
+ LEGACY_DEV_ORDER_ENTRY *NewDevOrder;
+ LEGACY_DEV_ORDER_ENTRY *Ptr;
+ LEGACY_DEV_ORDER_ENTRY *NewPtr;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ EFI_STATUS Status;
+ UINT16 HddCount;
+ UINT16 BbsCount;
+ HDD_INFO *LocalHddInfo;
+ BBS_TABLE *LocalBbsTable;
+ UINTN Index;
+ UINTN Index2;
+ UINTN *Idx;
+ UINTN FDCount;
+ UINTN HDCount;
+ UINTN CDCount;
+ UINTN NETCount;
+ UINTN BEVCount;
+ UINTN TotalSize;
+ UINTN HeaderSize;
+ UINT16 *NewFDPtr;
+ UINT16 *NewHDPtr;
+ UINT16 *NewCDPtr;
+ UINT16 *NewNETPtr;
+ UINT16 *NewBEVPtr;
+ UINT16 *NewDevPtr;
+ UINTN FDIndex;
+ UINTN HDIndex;
+ UINTN CDIndex;
+ UINTN NETIndex;
+ UINTN BEVIndex;
+
+ Idx = NULL;
+ FDCount = 0;
+ HDCount = 0;
+ CDCount = 0;
+ NETCount = 0;
+ BEVCount = 0;
+ TotalSize = 0;
+ HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
+ FDIndex = 0;
+ HDIndex = 0;
+ CDIndex = 0;
+ NETIndex = 0;
+ BEVIndex = 0;
+ NewDevPtr = NULL;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -814,10 +833,11 @@ LegacyBmUpdateDevOrder (
return Status;
}
- GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **) &DevOrder, NULL);
+ GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **)&DevOrder, NULL);
if (NULL == DevOrder) {
return LegacyBmCreateDevOrder (LocalBbsTable, BbsCount);
}
+
//
// First we figure out how many boot devices with same device type respectively
//
@@ -827,28 +847,28 @@ LegacyBmUpdateDevOrder (
}
switch (LocalBbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- FDCount++;
- break;
+ case BBS_FLOPPY:
+ FDCount++;
+ break;
- case BBS_HARDDISK:
- HDCount++;
- break;
+ case BBS_HARDDISK:
+ HDCount++;
+ break;
- case BBS_CDROM:
- CDCount++;
- break;
+ case BBS_CDROM:
+ CDCount++;
+ break;
- case BBS_EMBED_NETWORK:
- NETCount++;
- break;
+ case BBS_EMBED_NETWORK:
+ NETCount++;
+ break;
- case BBS_BEV_DEVICE:
- BEVCount++;
- break;
+ case BBS_BEV_DEVICE:
+ BEVCount++;
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -869,93 +889,103 @@ LegacyBmUpdateDevOrder (
Ptr = DevOrder;
NewPtr = NewDevOrder;
NewPtr->BbsType = Ptr->BbsType;
- NewPtr->Length = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));
+ NewPtr->Length = (UINT16)(sizeof (UINT16) + FDCount * sizeof (UINT16));
for (Index = 0; Index < Ptr->Length / sizeof (UINT16) - 1; Index++) {
if (!LegacyBmValidBbsEntry (&LocalBbsTable[Ptr->Data[Index] & 0xFF]) ||
- LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_FLOPPY
- ) {
+ (LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_FLOPPY)
+ )
+ {
continue;
}
NewPtr->Data[FDIndex] = Ptr->Data[Index];
FDIndex++;
}
+
NewFDPtr = NewPtr->Data;
//
// copy HD
//
- Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
- NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
+ Ptr = (LEGACY_DEV_ORDER_ENTRY *)(&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
+ NewPtr = (LEGACY_DEV_ORDER_ENTRY *)(&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
NewPtr->BbsType = Ptr->BbsType;
- NewPtr->Length = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));
+ NewPtr->Length = (UINT16)(sizeof (UINT16) + HDCount * sizeof (UINT16));
for (Index = 0; Index < Ptr->Length / sizeof (UINT16) - 1; Index++) {
if (!LegacyBmValidBbsEntry (&LocalBbsTable[Ptr->Data[Index] & 0xFF]) ||
- LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_HARDDISK
- ) {
+ (LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_HARDDISK)
+ )
+ {
continue;
}
NewPtr->Data[HDIndex] = Ptr->Data[Index];
HDIndex++;
}
+
NewHDPtr = NewPtr->Data;
//
// copy CD
//
- Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
- NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
+ Ptr = (LEGACY_DEV_ORDER_ENTRY *)(&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
+ NewPtr = (LEGACY_DEV_ORDER_ENTRY *)(&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
NewPtr->BbsType = Ptr->BbsType;
- NewPtr->Length = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));
+ NewPtr->Length = (UINT16)(sizeof (UINT16) + CDCount * sizeof (UINT16));
for (Index = 0; Index < Ptr->Length / sizeof (UINT16) - 1; Index++) {
if (!LegacyBmValidBbsEntry (&LocalBbsTable[Ptr->Data[Index] & 0xFF]) ||
- LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_CDROM
- ) {
+ (LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_CDROM)
+ )
+ {
continue;
}
NewPtr->Data[CDIndex] = Ptr->Data[Index];
CDIndex++;
}
+
NewCDPtr = NewPtr->Data;
//
// copy NET
//
- Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
- NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
+ Ptr = (LEGACY_DEV_ORDER_ENTRY *)(&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
+ NewPtr = (LEGACY_DEV_ORDER_ENTRY *)(&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
NewPtr->BbsType = Ptr->BbsType;
- NewPtr->Length = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));
+ NewPtr->Length = (UINT16)(sizeof (UINT16) + NETCount * sizeof (UINT16));
for (Index = 0; Index < Ptr->Length / sizeof (UINT16) - 1; Index++) {
if (!LegacyBmValidBbsEntry (&LocalBbsTable[Ptr->Data[Index] & 0xFF]) ||
- LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_EMBED_NETWORK
- ) {
+ (LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_EMBED_NETWORK)
+ )
+ {
continue;
}
NewPtr->Data[NETIndex] = Ptr->Data[Index];
NETIndex++;
}
+
NewNETPtr = NewPtr->Data;
//
// copy BEV
//
- Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
- NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
+ Ptr = (LEGACY_DEV_ORDER_ENTRY *)(&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]);
+ NewPtr = (LEGACY_DEV_ORDER_ENTRY *)(&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]);
NewPtr->BbsType = Ptr->BbsType;
- NewPtr->Length = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));
+ NewPtr->Length = (UINT16)(sizeof (UINT16) + BEVCount * sizeof (UINT16));
for (Index = 0; Index < Ptr->Length / sizeof (UINT16) - 1; Index++) {
if (!LegacyBmValidBbsEntry (&LocalBbsTable[Ptr->Data[Index] & 0xFF]) ||
- LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_BEV_DEVICE
- ) {
+ (LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_BEV_DEVICE)
+ )
+ {
continue;
}
NewPtr->Data[BEVIndex] = Ptr->Data[Index];
BEVIndex++;
}
+
NewBEVPtr = NewPtr->Data;
for (Index = 0; Index < BbsCount; Index++) {
@@ -964,42 +994,43 @@ LegacyBmUpdateDevOrder (
}
switch (LocalBbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- Idx = &FDIndex;
- NewDevPtr = NewFDPtr;
- break;
+ case BBS_FLOPPY:
+ Idx = &FDIndex;
+ NewDevPtr = NewFDPtr;
+ break;
- case BBS_HARDDISK:
- Idx = &HDIndex;
- NewDevPtr = NewHDPtr;
- break;
+ case BBS_HARDDISK:
+ Idx = &HDIndex;
+ NewDevPtr = NewHDPtr;
+ break;
- case BBS_CDROM:
- Idx = &CDIndex;
- NewDevPtr = NewCDPtr;
- break;
+ case BBS_CDROM:
+ Idx = &CDIndex;
+ NewDevPtr = NewCDPtr;
+ break;
- case BBS_EMBED_NETWORK:
- Idx = &NETIndex;
- NewDevPtr = NewNETPtr;
- break;
+ case BBS_EMBED_NETWORK:
+ Idx = &NETIndex;
+ NewDevPtr = NewNETPtr;
+ break;
- case BBS_BEV_DEVICE:
- Idx = &BEVIndex;
- NewDevPtr = NewBEVPtr;
- break;
+ case BBS_BEV_DEVICE:
+ Idx = &BEVIndex;
+ NewDevPtr = NewBEVPtr;
+ break;
- default:
- Idx = NULL;
- break;
+ default:
+ Idx = NULL;
+ break;
}
+
//
// at this point we have copied those valid indexes to new buffer
// and we should check if there is any new appeared boot device
//
if (Idx != NULL) {
for (Index2 = 0; Index2 < *Idx; Index2++) {
- if ((NewDevPtr[Index2] & 0xFF) == (UINT16) Index) {
+ if ((NewDevPtr[Index2] & 0xFF) == (UINT16)Index) {
break;
}
}
@@ -1015,8 +1046,9 @@ LegacyBmUpdateDevOrder (
break;
}
}
+
CopyMem (&NewDevPtr[Index2 + 1], &NewDevPtr[Index2], (*Idx - Index2) * sizeof (UINT16));
- NewDevPtr[Index2] = (UINT16) (Index & 0xFF);
+ NewDevPtr[Index2] = (UINT16)(Index & 0xFF);
(*Idx)++;
}
}
@@ -1051,37 +1083,37 @@ LegacyBmUpdateDevOrder (
**/
EFI_STATUS
LegacyBmSetPriorityForSameTypeDev (
- IN UINT16 DeviceType,
- IN UINTN BbsIndex,
- IN OUT BBS_TABLE *LocalBbsTable,
- IN OUT UINT16 *Priority
+ IN UINT16 DeviceType,
+ IN UINTN BbsIndex,
+ IN OUT BBS_TABLE *LocalBbsTable,
+ IN OUT UINT16 *Priority
)
{
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- LEGACY_DEV_ORDER_ENTRY *DevOrderPtr;
- UINTN DevOrderSize;
- UINTN Index;
+ LEGACY_DEV_ORDER_ENTRY *DevOrder;
+ LEGACY_DEV_ORDER_ENTRY *DevOrderPtr;
+ UINTN DevOrderSize;
+ UINTN Index;
- GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **) &DevOrder, &DevOrderSize);
+ GetVariable2 (VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, (VOID **)&DevOrder, &DevOrderSize);
if (NULL == DevOrder) {
return EFI_OUT_OF_RESOURCES;
}
DevOrderPtr = DevOrder;
- while ((UINT8 *) DevOrderPtr < (UINT8 *) DevOrder + DevOrderSize) {
+ while ((UINT8 *)DevOrderPtr < (UINT8 *)DevOrder + DevOrderSize) {
if (DevOrderPtr->BbsType == DeviceType) {
break;
}
- DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) ((UINTN) DevOrderPtr + sizeof (BBS_TYPE) + DevOrderPtr->Length);
+ DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *)((UINTN)DevOrderPtr + sizeof (BBS_TYPE) + DevOrderPtr->Length);
}
- if ((UINT8 *) DevOrderPtr >= (UINT8 *) DevOrder + DevOrderSize) {
+ if ((UINT8 *)DevOrderPtr >= (UINT8 *)DevOrder + DevOrderSize) {
FreePool (DevOrder);
return EFI_NOT_FOUND;
}
- if (BbsIndex != (UINTN) -1) {
+ if (BbsIndex != (UINTN)-1) {
//
// In case the BBS entry isn't valid because devices were plugged or removed.
//
@@ -1089,9 +1121,11 @@ LegacyBmSetPriorityForSameTypeDev (
FreePool (DevOrder);
return EFI_NOT_FOUND;
}
+
LocalBbsTable[BbsIndex].BootPriority = *Priority;
(*Priority)++;
}
+
//
// If the high byte of the DevIndex is 0xFF, it indicates that this device has been disabled.
//
@@ -1134,20 +1168,20 @@ LegacyBmPrintBbsTable (
DEBUG (
(DEBUG_INFO,
- " %02x: %04x %02x/%02x/%02x %02x/%02x %04x %04x %04x:%04x\n",
- (UINTN) Index,
- (UINTN) LocalBbsTable[Index].BootPriority,
- (UINTN) LocalBbsTable[Index].Bus,
- (UINTN) LocalBbsTable[Index].Device,
- (UINTN) LocalBbsTable[Index].Function,
- (UINTN) LocalBbsTable[Index].Class,
- (UINTN) LocalBbsTable[Index].SubClass,
- (UINTN) LocalBbsTable[Index].DeviceType,
- (UINTN) * (UINT16 *) &LocalBbsTable[Index].StatusFlags,
- (UINTN) LocalBbsTable[Index].BootHandlerSegment,
- (UINTN) LocalBbsTable[Index].BootHandlerOffset,
- (UINTN) ((LocalBbsTable[Index].MfgStringSegment << 4) + LocalBbsTable[Index].MfgStringOffset),
- (UINTN) ((LocalBbsTable[Index].DescStringSegment << 4) + LocalBbsTable[Index].DescStringOffset))
+ " %02x: %04x %02x/%02x/%02x %02x/%02x %04x %04x %04x:%04x\n",
+ (UINTN)Index,
+ (UINTN)LocalBbsTable[Index].BootPriority,
+ (UINTN)LocalBbsTable[Index].Bus,
+ (UINTN)LocalBbsTable[Index].Device,
+ (UINTN)LocalBbsTable[Index].Function,
+ (UINTN)LocalBbsTable[Index].Class,
+ (UINTN)LocalBbsTable[Index].SubClass,
+ (UINTN)LocalBbsTable[Index].DeviceType,
+ (UINTN)*(UINT16 *)&LocalBbsTable[Index].StatusFlags,
+ (UINTN)LocalBbsTable[Index].BootHandlerSegment,
+ (UINTN)LocalBbsTable[Index].BootHandlerOffset,
+ (UINTN)((LocalBbsTable[Index].MfgStringSegment << 4) + LocalBbsTable[Index].MfgStringOffset),
+ (UINTN)((LocalBbsTable[Index].DescStringSegment << 4) + LocalBbsTable[Index].DescStringOffset))
);
}
@@ -1165,7 +1199,7 @@ LegacyBmPrintBbsTable (
**/
EFI_STATUS
LegacyBmRefreshBbsTableForBoot (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
+ IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
)
{
EFI_STATUS Status;
@@ -1190,7 +1224,7 @@ LegacyBmRefreshBbsTableForBoot (
LocalBbsTable = NULL;
DevType = BBS_UNKNOWN;
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1215,38 +1249,42 @@ LegacyBmRefreshBbsTableForBoot (
LocalBbsTable[Index].BootPriority = BBS_UNPRIORITIZED_ENTRY;
}
}
+
//
// boot priority always starts at 0
//
Priority = 0;
if ((DevicePathType (BootOption->FilePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (BootOption->FilePath) == BBS_BBS_DP)) {
+ (DevicePathSubType (BootOption->FilePath) == BBS_BBS_DP))
+ {
//
// If BootOption stands for a legacy boot option, we prioritize the devices with the same type first.
//
DevType = LegacyBmDeviceType (BootOption->FilePath);
- BbsIndex = ((LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOption->OptionalData)->BbsIndex;
- Status = LegacyBmSetPriorityForSameTypeDev (
- DevType,
- BbsIndex,
- LocalBbsTable,
- &Priority
- );
+ BbsIndex = ((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption->OptionalData)->BbsIndex;
+ Status = LegacyBmSetPriorityForSameTypeDev (
+ DevType,
+ BbsIndex,
+ LocalBbsTable,
+ &Priority
+ );
if (EFI_ERROR (Status)) {
return Status;
}
}
+
//
// we have to set the boot priority for other BBS entries with different device types
//
- Option = EfiBootManagerGetLoadOptions (&OptionCount, LoadOptionTypeBoot);
- DeviceType = AllocatePool (sizeof (UINT16) * OptionCount);
+ Option = EfiBootManagerGetLoadOptions (&OptionCount, LoadOptionTypeBoot);
+ DeviceType = AllocatePool (sizeof (UINT16) * OptionCount);
ASSERT (DeviceType != NULL);
DeviceType[0] = DevType;
DeviceTypeCount = 1;
for (Index = 0; Index < OptionCount; Index++) {
if ((DevicePathType (Option[Index].FilePath) != BBS_DEVICE_PATH) ||
- (DevicePathSubType (Option[Index].FilePath) != BBS_BBS_DP)) {
+ (DevicePathSubType (Option[Index].FilePath) != BBS_BBS_DP))
+ {
continue;
}
@@ -1256,6 +1294,7 @@ LegacyBmRefreshBbsTableForBoot (
break;
}
}
+
if (DeviceTypeIndex < DeviceTypeCount) {
//
// We don't want to process twice for a device type
@@ -1268,21 +1307,21 @@ LegacyBmRefreshBbsTableForBoot (
Status = LegacyBmSetPriorityForSameTypeDev (
DevType,
- (UINTN) -1,
+ (UINTN)-1,
LocalBbsTable,
&Priority
);
}
+
EfiBootManagerFreeLoadOptions (Option, OptionCount);
- DEBUG_CODE_BEGIN();
- LegacyBmPrintBbsTable (LocalBbsTable, BbsCount);
- DEBUG_CODE_END();
+ DEBUG_CODE_BEGIN ();
+ LegacyBmPrintBbsTable (LocalBbsTable, BbsCount);
+ DEBUG_CODE_END ();
return Status;
}
-
/**
Boot the legacy system with the boot option.
@@ -1295,13 +1334,13 @@ LegacyBmRefreshBbsTableForBoot (
VOID
EFIAPI
LegacyBmBoot (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
+ IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
)
{
EFI_STATUS Status;
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
//
// If no LegacyBios protocol we do not support legacy boot
@@ -1309,6 +1348,7 @@ LegacyBmBoot (
BootOption->Status = EFI_UNSUPPORTED;
return;
}
+
//
// Notes: if we separate the int 19, then we don't need to refresh BBS
//
@@ -1320,7 +1360,7 @@ LegacyBmBoot (
BootOption->Status = LegacyBios->LegacyBoot (
LegacyBios,
- (BBS_BBS_DEVICE_PATH *) BootOption->FilePath,
+ (BBS_BBS_DEVICE_PATH *)BootOption->FilePath,
BootOption->OptionalDataSize,
BootOption->OptionalData
);
@@ -1335,7 +1375,7 @@ LegacyBmBoot (
**/
EFI_BOOT_MANAGER_LOAD_OPTION *
LegacyBmEnumerateAllBootOptions (
- UINTN *BootOptionCount
+ UINTN *BootOptionCount
)
{
EFI_STATUS Status;
@@ -1353,7 +1393,7 @@ LegacyBmEnumerateAllBootOptions (
*BootOptionCount = 0;
BbsCount = 0;
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
return NULL;
}
@@ -1402,19 +1442,20 @@ LegacyBmEnumerateAllBootOptions (
**/
INTN
LegacyBmFindBootOption (
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,
- IN UINTN Count
+ IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,
+ IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,
+ IN UINTN Count
)
{
- UINTN Index;
+ UINTN Index;
for (Index = 0; Index < Count; Index++) {
if ((StrCmp (Key->Description, Array[Index].Description) == 0) &&
(CompareMem (Key->FilePath, Array[Index].FilePath, GetDevicePathSize (Key->FilePath)) == 0) &&
(Key->OptionalDataSize == Array[Index].OptionalDataSize) &&
- (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->OptionalDataSize) == 0)) {
- return (INTN) Index;
+ (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->OptionalDataSize) == 0))
+ {
+ return (INTN)Index;
}
}
@@ -1431,25 +1472,26 @@ LegacyBmRefreshAllBootOption (
VOID
)
{
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN RootBridgeHandleCount;
- EFI_HANDLE *RootBridgeHandleBuffer;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN RootBridgeIndex;
- UINTN Index;
- UINTN Flags;
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
- UINTN BootOptionCount;
- EFI_BOOT_MANAGER_LOAD_OPTION *ExistingBootOptions;
- UINTN ExistingBootOptionCount;
-
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ EFI_STATUS Status;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ UINTN RootBridgeHandleCount;
+ EFI_HANDLE *RootBridgeHandleBuffer;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN RootBridgeIndex;
+ UINTN Index;
+ UINTN Flags;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN BootOptionCount;
+ EFI_BOOT_MANAGER_LOAD_OPTION *ExistingBootOptions;
+ UINTN ExistingBootOptionCount;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
if (EFI_ERROR (Status)) {
LegacyBmDeleteAllBootOptions ();
return;
}
+
PERF_START (NULL, "LegacyBootOptionEnum", "BDS", 0);
//
@@ -1500,15 +1542,16 @@ LegacyBmRefreshAllBootOption (
LegacyBmDeleteAllInvalidBootOptions ();
ExistingBootOptions = EfiBootManagerGetLoadOptions (&ExistingBootOptionCount, LoadOptionTypeBoot);
- BootOptions = LegacyBmEnumerateAllBootOptions (&BootOptionCount);
+ BootOptions = LegacyBmEnumerateAllBootOptions (&BootOptionCount);
for (Index = 0; Index < BootOptionCount; Index++) {
if (LegacyBmFindBootOption (&BootOptions[Index], ExistingBootOptions, ExistingBootOptionCount) == -1) {
- Status = EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN) -1);
+ Status = EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN)-1);
DEBUG ((
- DEBUG_INFO, "[LegacyBds] New Boot Option: Boot%04x Bbs0x%04x %s %r\n",
- (UINTN) BootOptions[Index].OptionNumber,
- (UINTN) ((LEGACY_BM_BOOT_OPTION_BBS_DATA *) BootOptions[Index].OptionalData)->BbsIndex,
+ DEBUG_INFO,
+ "[LegacyBds] New Boot Option: Boot%04x Bbs0x%04x %s %r\n",
+ (UINTN)BootOptions[Index].OptionNumber,
+ (UINTN)((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOptions[Index].OptionalData)->BbsIndex,
BootOptions[Index].Description,
Status
));
@@ -1519,12 +1562,12 @@ LegacyBmRefreshAllBootOption (
}
EfiBootManagerFreeLoadOptions (ExistingBootOptions, ExistingBootOptionCount);
- EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
+ EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
//
// Failure to create LegacyDevOrder variable only impacts the boot order.
//
LegacyBmUpdateDevOrder ();
- PERF_END (NULL, "LegacyBootOptionEnum", "BDS", 0);
+ PERF_END (NULL, "LegacyBootOptionEnum", "BDS", 0);
}