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>
This commit is contained in:
committed by
mergify[bot]
parent
d1050b9dff
commit
ac0a286f4d
@@ -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
|
||||
);
|
||||
&Private->LegacyBios,
|
||||
Table->Compatibility16CallSegment,
|
||||
Table->Compatibility16CallOffset,
|
||||
&Regs,
|
||||
NULL,
|
||||
0
|
||||
);
|
||||
|
||||
TpmPointer = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user