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
@ -47,6 +47,7 @@ volatile UINT64 mTimerPeriod = 0;
|
||||
//
|
||||
// Worker Functions
|
||||
//
|
||||
|
||||
/**
|
||||
Sets the counter value for Timer #0 in a legacy 8254 timer.
|
||||
|
||||
@ -133,11 +134,11 @@ TimerDriverRegisterHandler (
|
||||
//
|
||||
// Check for invalid parameters
|
||||
//
|
||||
if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {
|
||||
if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {
|
||||
if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
@ -203,11 +204,10 @@ TimerDriverSetTimerPeriod (
|
||||
//
|
||||
mLegacy8259->DisableIrq (mLegacy8259, Efi8259Irq0);
|
||||
} else {
|
||||
|
||||
//
|
||||
// Convert TimerPeriod into 8254 counts
|
||||
//
|
||||
TimerCount = DivU64x32 (MultU64x32 (119318, (UINT32) TimerPeriod) + 500000, 1000000);
|
||||
TimerCount = DivU64x32 (MultU64x32 (119318, (UINT32)TimerPeriod) + 500000, 1000000);
|
||||
|
||||
//
|
||||
// Check for overflow
|
||||
@ -216,16 +216,18 @@ TimerDriverSetTimerPeriod (
|
||||
TimerCount = 0;
|
||||
TimerPeriod = MAX_TIMER_TICK_DURATION;
|
||||
}
|
||||
|
||||
//
|
||||
// Program the 8254 timer with the new count value
|
||||
//
|
||||
SetPitCount ((UINT16) TimerCount);
|
||||
SetPitCount ((UINT16)TimerCount);
|
||||
|
||||
//
|
||||
// Enable timer interrupt
|
||||
//
|
||||
mLegacy8259->EnableIrq (mLegacy8259, Efi8259Irq0, FALSE);
|
||||
}
|
||||
|
||||
//
|
||||
// Save the new timer period
|
||||
//
|
||||
@ -353,13 +355,13 @@ TimerDriverInitialize (
|
||||
//
|
||||
// Find the CPU architectural protocol.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &mCpu);
|
||||
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&mCpu);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Find the Legacy8259 protocol.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid, NULL, (VOID **) &mLegacy8259);
|
||||
Status = gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid, NULL, (VOID **)&mLegacy8259);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
@ -372,7 +374,7 @@ TimerDriverInitialize (
|
||||
// Get the interrupt vector number corresponding to IRQ0 from the 8259 driver
|
||||
//
|
||||
TimerVector = 0;
|
||||
Status = mLegacy8259->GetVector (mLegacy8259, Efi8259Irq0, (UINT8 *) &TimerVector);
|
||||
Status = mLegacy8259->GetVector (mLegacy8259, Efi8259Irq0, (UINT8 *)&TimerVector);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
@ -392,11 +394,11 @@ TimerDriverInitialize (
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mTimerHandle,
|
||||
&gEfiTimerArchProtocolGuid, &mTimer,
|
||||
&gEfiTimerArchProtocolGuid,
|
||||
&mTimer,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
|
||||
/**
|
||||
Initialize the Timer Architectural Protocol driver
|
||||
|
||||
|
@ -55,10 +55,10 @@ Interrupt8259WriteMask (
|
||||
IN UINT16 EdgeLevel
|
||||
)
|
||||
{
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, (UINT8) Mask);
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, (UINT8) (Mask >> 8));
|
||||
IoWrite8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER, (UINT8) EdgeLevel);
|
||||
IoWrite8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE, (UINT8) (EdgeLevel >> 8));
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, (UINT8)Mask);
|
||||
IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, (UINT8)(Mask >> 8));
|
||||
IoWrite8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER, (UINT8)EdgeLevel);
|
||||
IoWrite8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE, (UINT8)(EdgeLevel >> 8));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,14 +83,14 @@ Interrupt8259ReadMask (
|
||||
MasterValue = IoRead8 (LEGACY_8259_MASK_REGISTER_MASTER);
|
||||
SlaveValue = IoRead8 (LEGACY_8259_MASK_REGISTER_SLAVE);
|
||||
|
||||
*Mask = (UINT16) (MasterValue | (SlaveValue << 8));
|
||||
*Mask = (UINT16)(MasterValue | (SlaveValue << 8));
|
||||
}
|
||||
|
||||
if (EdgeLevel != NULL) {
|
||||
MasterValue = IoRead8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER);
|
||||
SlaveValue = IoRead8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE);
|
||||
|
||||
*EdgeLevel = (UINT16) (MasterValue | (SlaveValue << 8));
|
||||
*EdgeLevel = (UINT16)(MasterValue | (SlaveValue << 8));
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,9 +416,9 @@ Interrupt8259GetVector (
|
||||
}
|
||||
|
||||
if (Irq <= Efi8259Irq7) {
|
||||
*Vector = (UINT8) (mMasterBase + Irq);
|
||||
*Vector = (UINT8)(mMasterBase + Irq);
|
||||
} else {
|
||||
*Vector = (UINT8) (mSlaveBase + (Irq - Efi8259Irq8));
|
||||
*Vector = (UINT8)(mSlaveBase + (Irq - Efi8259Irq8));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -447,11 +447,11 @@ Interrupt8259EnableIrq (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
mProtectedModeMask = (UINT16) (mProtectedModeMask & ~(1 << Irq));
|
||||
mProtectedModeMask = (UINT16)(mProtectedModeMask & ~(1 << Irq));
|
||||
if (LevelTriggered) {
|
||||
mProtectedModeEdgeLevel = (UINT16) (mProtectedModeEdgeLevel | (1 << Irq));
|
||||
mProtectedModeEdgeLevel = (UINT16)(mProtectedModeEdgeLevel | (1 << Irq));
|
||||
} else {
|
||||
mProtectedModeEdgeLevel = (UINT16) (mProtectedModeEdgeLevel & ~(1 << Irq));
|
||||
mProtectedModeEdgeLevel = (UINT16)(mProtectedModeEdgeLevel & ~(1 << Irq));
|
||||
}
|
||||
|
||||
Interrupt8259WriteMask (mProtectedModeMask, mProtectedModeEdgeLevel);
|
||||
@ -480,9 +480,9 @@ Interrupt8259DisableIrq (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
mProtectedModeMask = (UINT16) (mProtectedModeMask | (1 << Irq));
|
||||
mProtectedModeMask = (UINT16)(mProtectedModeMask | (1 << Irq));
|
||||
|
||||
mProtectedModeEdgeLevel = (UINT16) (mProtectedModeEdgeLevel & ~(1 << Irq));
|
||||
mProtectedModeEdgeLevel = (UINT16)(mProtectedModeEdgeLevel & ~(1 << Irq));
|
||||
|
||||
Interrupt8259WriteMask (mProtectedModeMask, mProtectedModeEdgeLevel);
|
||||
|
||||
@ -514,7 +514,7 @@ Interrupt8259GetInterruptLine (
|
||||
Status = gBS->HandleProtocol (
|
||||
PciHandle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@ -69,4 +69,3 @@ TransferS3ContextToBootScript (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "AcpiPlatform.h"
|
||||
|
||||
|
||||
//
|
||||
// Condensed structure for capturing the fw_cfg operations -- select, skip,
|
||||
// write -- inherent in executing a QEMU_LOADER_WRITE_POINTER command.
|
||||
@ -27,7 +26,6 @@ typedef struct {
|
||||
// and QEMU_LOADER_WRITE_POINTER.PointeeOffset
|
||||
} CONDENSED_WRITE_POINTER;
|
||||
|
||||
|
||||
//
|
||||
// Context structure to accumulate CONDENSED_WRITE_POINTER objects from
|
||||
// QEMU_LOADER_WRITE_POINTER commands.
|
||||
@ -45,7 +43,6 @@ struct S3_CONTEXT {
|
||||
// WritePointers
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Scratch buffer, allocated in EfiReservedMemoryType type memory, for the ACPI
|
||||
// S3 Boot Script opcodes to work on.
|
||||
@ -56,7 +53,6 @@ typedef union {
|
||||
} SCRATCH_BUFFER;
|
||||
#pragma pack ()
|
||||
|
||||
|
||||
/**
|
||||
Allocate an S3_CONTEXT object.
|
||||
|
||||
@ -91,8 +87,10 @@ AllocateS3Context (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Context->WritePointers = AllocatePool (WritePointerCount *
|
||||
sizeof *Context->WritePointers);
|
||||
Context->WritePointers = AllocatePool (
|
||||
WritePointerCount *
|
||||
sizeof *Context->WritePointers
|
||||
);
|
||||
if (Context->WritePointers == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto FreeContext;
|
||||
@ -108,7 +106,6 @@ FreeContext:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Release an S3_CONTEXT object.
|
||||
|
||||
@ -123,7 +120,6 @@ ReleaseS3Context (
|
||||
FreePool (S3Context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Save the information necessary to replicate a QEMU_LOADER_WRITE_POINTER
|
||||
command during S3 resume, in condensed format.
|
||||
@ -170,19 +166,26 @@ SaveCondensedWritePointerToS3Context (
|
||||
if (S3Context->Used == S3Context->Allocated) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Condensed = S3Context->WritePointers + S3Context->Used;
|
||||
Condensed->PointerItem = PointerItem;
|
||||
Condensed->PointerSize = PointerSize;
|
||||
Condensed->PointerOffset = PointerOffset;
|
||||
Condensed->PointerValue = PointerValue;
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: 0x%04x/[0x%08x+%d] := 0x%Lx (%Lu)\n",
|
||||
__FUNCTION__, PointerItem, PointerOffset, PointerSize, PointerValue,
|
||||
(UINT64)S3Context->Used));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: 0x%04x/[0x%08x+%d] := 0x%Lx (%Lu)\n",
|
||||
__FUNCTION__,
|
||||
PointerItem,
|
||||
PointerOffset,
|
||||
PointerSize,
|
||||
PointerValue,
|
||||
(UINT64)S3Context->Used
|
||||
));
|
||||
++S3Context->Used;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION provided to QemuFwCfgS3Lib.
|
||||
**/
|
||||
@ -207,8 +210,10 @@ AppendFwCfgBootScript (
|
||||
|
||||
Condensed = &S3Context->WritePointers[Index];
|
||||
|
||||
Status = QemuFwCfgS3ScriptSkipBytes (Condensed->PointerItem,
|
||||
Condensed->PointerOffset);
|
||||
Status = QemuFwCfgS3ScriptSkipBytes (
|
||||
Condensed->PointerItem,
|
||||
Condensed->PointerOffset
|
||||
);
|
||||
if (RETURN_ERROR (Status)) {
|
||||
goto FatalError;
|
||||
}
|
||||
@ -230,7 +235,6 @@ FatalError:
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Translate and append the information from an S3_CONTEXT object to the ACPI S3
|
||||
Boot Script.
|
||||
@ -263,7 +267,10 @@ TransferS3ContextToBootScript (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = QemuFwCfgS3CallWhenBootScriptReady (AppendFwCfgBootScript,
|
||||
S3Context, sizeof (SCRATCH_BUFFER));
|
||||
Status = QemuFwCfgS3CallWhenBootScriptReady (
|
||||
AppendFwCfgBootScript,
|
||||
S3Context,
|
||||
sizeof (SCRATCH_BUFFER)
|
||||
);
|
||||
return (EFI_STATUS)Status;
|
||||
}
|
||||
|
@ -27,13 +27,12 @@ FindAcpiTableProtocol (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiAcpiTableProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&AcpiTable
|
||||
(VOID **)&AcpiTable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return AcpiTable;
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
@ -44,17 +43,19 @@ OnRootBridgesConnected (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: root bridges have been connected, installing ACPI tables\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
Status = InstallAcpiTables (FindAcpiTableProtocol ());
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
|
||||
}
|
||||
|
||||
gBS->CloseEvent (Event);
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AcpiPlatformEntryPoint (
|
||||
@ -71,8 +72,12 @@ AcpiPlatformEntryPoint (
|
||||
// the full functionality.
|
||||
//
|
||||
if (PcdGetBool (PcdPciDisableBusEnumeration)) {
|
||||
DEBUG ((DEBUG_INFO, "%a: PCI or its enumeration disabled, installing "
|
||||
"ACPI tables\n", __FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: PCI or its enumeration disabled, installing "
|
||||
"ACPI tables\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return InstallAcpiTables (FindAcpiTableProtocol ());
|
||||
}
|
||||
|
||||
@ -82,13 +87,20 @@ AcpiPlatformEntryPoint (
|
||||
// setup. (Note that we're a DXE_DRIVER; our entry point function is invoked
|
||||
// strictly before BDS is entered and can connect the root bridges.)
|
||||
//
|
||||
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
|
||||
OnRootBridgesConnected, NULL /* Context */,
|
||||
&gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
OnRootBridgesConnected,
|
||||
NULL /* Context */,
|
||||
&gRootBridgesConnectedEventGroupGuid,
|
||||
&RootBridgesConnected
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: waiting for root bridges to be connected, registered callback\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "AcpiPlatform.h"
|
||||
|
||||
|
||||
/**
|
||||
Collect all PciIo protocol instances in the system. Save their original
|
||||
attributes, and enable IO and MMIO decoding for each.
|
||||
@ -61,8 +60,13 @@ EnablePciDecoding (
|
||||
return;
|
||||
}
|
||||
|
||||
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPciIoProtocolGuid,
|
||||
NULL /* SearchKey */, &NoHandles, &Handles);
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
NULL /* SearchKey */,
|
||||
&NoHandles,
|
||||
&Handles
|
||||
);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
//
|
||||
// No PCI devices were found on either of the root bridges. We're done.
|
||||
@ -71,15 +75,22 @@ EnablePciDecoding (
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: LocateHandleBuffer(): %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: LocateHandleBuffer(): %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
OrigAttrs = AllocatePool (NoHandles * sizeof *OrigAttrs);
|
||||
if (OrigAttrs == NULL) {
|
||||
DEBUG ((DEBUG_WARN, "%a: AllocatePool(): out of resources\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: AllocatePool(): out of resources\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
goto FreeHandles;
|
||||
}
|
||||
|
||||
@ -90,30 +101,49 @@ EnablePciDecoding (
|
||||
//
|
||||
// Look up PciIo on the handle and stash it
|
||||
//
|
||||
Status = gBS->HandleProtocol (Handles[Idx], &gEfiPciIoProtocolGuid,
|
||||
(VOID**)&PciIo);
|
||||
Status = gBS->HandleProtocol (
|
||||
Handles[Idx],
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
OrigAttrs[Idx].PciIo = PciIo;
|
||||
|
||||
//
|
||||
// Stash the current attributes
|
||||
//
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationGet, 0,
|
||||
&OrigAttrs[Idx].PciAttributes);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationGet,
|
||||
0,
|
||||
&OrigAttrs[Idx].PciAttributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationGet: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationGet: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve supported attributes
|
||||
//
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSupported, 0,
|
||||
&Attributes);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationSupported,
|
||||
0,
|
||||
&Attributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationSupported: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationSupported: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
|
||||
@ -121,11 +151,19 @@ EnablePciDecoding (
|
||||
// Enable IO and MMIO decoding
|
||||
//
|
||||
Attributes &= EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY;
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationEnable,
|
||||
Attributes, NULL);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationEnable,
|
||||
Attributes,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationEnable: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationEnable: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
}
|
||||
@ -141,19 +179,20 @@ EnablePciDecoding (
|
||||
RestoreAttributes:
|
||||
while (Idx > 0) {
|
||||
--Idx;
|
||||
OrigAttrs[Idx].PciIo->Attributes (OrigAttrs[Idx].PciIo,
|
||||
OrigAttrs[Idx].PciIo->Attributes (
|
||||
OrigAttrs[Idx].PciIo,
|
||||
EfiPciIoAttributeOperationSet,
|
||||
OrigAttrs[Idx].PciAttributes,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (OrigAttrs);
|
||||
|
||||
FreeHandles:
|
||||
FreePool (Handles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Restore the original PCI attributes saved with EnablePciDecoding().
|
||||
|
||||
@ -190,5 +229,6 @@ RestorePciDecoding (
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (OriginalAttributes);
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ typedef struct {
|
||||
// part of ACPI tables.
|
||||
} BLOB;
|
||||
|
||||
|
||||
/**
|
||||
Compare a standalone key against a user structure containing an embedded key.
|
||||
|
||||
@ -65,7 +64,6 @@ BlobKeyCompare (
|
||||
return AsciiStrCmp (StandaloneKey, (CONST CHAR8 *)Blob->File);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Comparator function for two user structures.
|
||||
|
||||
@ -93,7 +91,6 @@ BlobCompare (
|
||||
return BlobKeyCompare (Blob1->File, UserStruct2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Comparator function for two opaque pointers, ordering on (unsigned) pointer
|
||||
value itself.
|
||||
@ -120,13 +117,14 @@ PointerCompare (
|
||||
if (Pointer1 == Pointer2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((UINTN)Pointer1 < (UINTN)Pointer2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Comparator function for two ASCII strings. Can be used as both Key and
|
||||
UserStruct comparator.
|
||||
@ -151,7 +149,6 @@ AsciiStringCompare (
|
||||
return AsciiStrCmp (AsciiString1, AsciiString2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Release the ORDERED_COLLECTION structure populated by
|
||||
CollectAllocationsRestrictedTo32Bit() (below).
|
||||
@ -166,20 +163,21 @@ STATIC
|
||||
VOID
|
||||
ReleaseAllocationsRestrictedTo32Bit (
|
||||
IN ORDERED_COLLECTION *AllocationsRestrictedTo32Bit
|
||||
)
|
||||
)
|
||||
{
|
||||
ORDERED_COLLECTION_ENTRY *Entry, *Entry2;
|
||||
|
||||
for (Entry = OrderedCollectionMin (AllocationsRestrictedTo32Bit);
|
||||
Entry != NULL;
|
||||
Entry = Entry2) {
|
||||
Entry = Entry2)
|
||||
{
|
||||
Entry2 = OrderedCollectionNext (Entry);
|
||||
OrderedCollectionDelete (AllocationsRestrictedTo32Bit, Entry, NULL);
|
||||
}
|
||||
|
||||
OrderedCollectionUninit (AllocationsRestrictedTo32Bit);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Iterate over the linker/loader script, and collect the names of the fw_cfg
|
||||
blobs that are referenced by QEMU_LOADER_ADD_POINTER.PointeeFile fields, such
|
||||
@ -213,7 +211,7 @@ CollectAllocationsRestrictedTo32Bit (
|
||||
OUT ORDERED_COLLECTION **AllocationsRestrictedTo32Bit,
|
||||
IN CONST QEMU_LOADER_ENTRY *LoaderStart,
|
||||
IN CONST QEMU_LOADER_ENTRY *LoaderEnd
|
||||
)
|
||||
)
|
||||
{
|
||||
ORDERED_COLLECTION *Collection;
|
||||
CONST QEMU_LOADER_ENTRY *LoaderEntry;
|
||||
@ -230,6 +228,7 @@ CollectAllocationsRestrictedTo32Bit (
|
||||
if (LoaderEntry->Type != QemuLoaderCmdAddPointer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AddPointer = &LoaderEntry->Command.AddPointer;
|
||||
|
||||
if (AddPointer->PointerSize >= 8) {
|
||||
@ -276,7 +275,6 @@ RollBack:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process a QEMU_LOADER_ALLOCATE command.
|
||||
|
||||
@ -335,15 +333,24 @@ ProcessCmdAllocate (
|
||||
}
|
||||
|
||||
if (Allocate->Alignment > EFI_PAGE_SIZE) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: unsupported alignment 0x%x\n", __FUNCTION__,
|
||||
Allocate->Alignment));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: unsupported alignment 0x%x\n",
|
||||
__FUNCTION__,
|
||||
Allocate->Alignment
|
||||
));
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = QemuFwCfgFindFile ((CHAR8 *)Allocate->File, &FwCfgItem, &FwCfgSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: QemuFwCfgFindFile(\"%a\"): %r\n", __FUNCTION__,
|
||||
Allocate->File, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: QemuFwCfgFindFile(\"%a\"): %r\n",
|
||||
__FUNCTION__,
|
||||
Allocate->File,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -352,11 +359,17 @@ ProcessCmdAllocate (
|
||||
if (OrderedCollectionFind (
|
||||
AllocationsRestrictedTo32Bit,
|
||||
Allocate->File
|
||||
) != NULL) {
|
||||
) != NULL)
|
||||
{
|
||||
Address = MAX_UINT32;
|
||||
}
|
||||
Status = gBS->AllocatePages (AllocateMaxAddress, EfiACPIMemoryNVS, NumPages,
|
||||
&Address);
|
||||
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiACPIMemoryNVS,
|
||||
NumPages,
|
||||
&Address
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@ -366,6 +379,7 @@ ProcessCmdAllocate (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto FreePages;
|
||||
}
|
||||
|
||||
CopyMem (Blob->File, Allocate->File, QEMU_LOADER_FNAME_SIZE);
|
||||
Blob->Size = FwCfgSize;
|
||||
Blob->Base = (VOID *)(UINTN)Address;
|
||||
@ -373,10 +387,15 @@ ProcessCmdAllocate (
|
||||
|
||||
Status = OrderedCollectionInsert (Tracker, NULL, Blob);
|
||||
if (Status == RETURN_ALREADY_STARTED) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: duplicated file \"%a\"\n", __FUNCTION__,
|
||||
Allocate->File));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: duplicated file \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
Allocate->File
|
||||
));
|
||||
Status = EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreeBlob;
|
||||
}
|
||||
@ -385,9 +404,17 @@ ProcessCmdAllocate (
|
||||
QemuFwCfgReadBytes (FwCfgSize, Blob->Base);
|
||||
ZeroMem (Blob->Base + Blob->Size, EFI_PAGES_TO_SIZE (NumPages) - Blob->Size);
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: File=\"%a\" Alignment=0x%x Zone=%d Size=0x%Lx "
|
||||
"Address=0x%Lx\n", __FUNCTION__, Allocate->File, Allocate->Alignment,
|
||||
Allocate->Zone, (UINT64)Blob->Size, (UINT64)(UINTN)Blob->Base));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: File=\"%a\" Alignment=0x%x Zone=%d Size=0x%Lx "
|
||||
"Address=0x%Lx\n",
|
||||
__FUNCTION__,
|
||||
Allocate->File,
|
||||
Allocate->Alignment,
|
||||
Allocate->Zone,
|
||||
(UINT64)Blob->Size,
|
||||
(UINT64)(UINTN)Blob->Base
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
|
||||
FreeBlob:
|
||||
@ -399,7 +426,6 @@ FreePages:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process a QEMU_LOADER_ADD_POINTER command.
|
||||
|
||||
@ -431,28 +457,39 @@ ProcessCmdAddPointer (
|
||||
UINT8 *PointerField;
|
||||
UINT64 PointerValue;
|
||||
|
||||
if (AddPointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0' ||
|
||||
AddPointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
|
||||
if ((AddPointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') ||
|
||||
(AddPointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0'))
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
TrackerEntry = OrderedCollectionFind (Tracker, AddPointer->PointerFile);
|
||||
TrackerEntry2 = OrderedCollectionFind (Tracker, AddPointer->PointeeFile);
|
||||
if (TrackerEntry == NULL || TrackerEntry2 == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid blob reference(s) \"%a\" / \"%a\"\n",
|
||||
__FUNCTION__, AddPointer->PointerFile, AddPointer->PointeeFile));
|
||||
if ((TrackerEntry == NULL) || (TrackerEntry2 == NULL)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid blob reference(s) \"%a\" / \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
AddPointer->PointerFile,
|
||||
AddPointer->PointeeFile
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
Blob = OrderedCollectionUserStruct (TrackerEntry);
|
||||
Blob2 = OrderedCollectionUserStruct (TrackerEntry2);
|
||||
if ((AddPointer->PointerSize != 1 && AddPointer->PointerSize != 2 &&
|
||||
AddPointer->PointerSize != 4 && AddPointer->PointerSize != 8) ||
|
||||
Blob->Size < AddPointer->PointerSize ||
|
||||
Blob->Size - AddPointer->PointerSize < AddPointer->PointerOffset) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid pointer location or size in \"%a\"\n",
|
||||
__FUNCTION__, AddPointer->PointerFile));
|
||||
if (((AddPointer->PointerSize != 1) && (AddPointer->PointerSize != 2) &&
|
||||
(AddPointer->PointerSize != 4) && (AddPointer->PointerSize != 8)) ||
|
||||
(Blob->Size < AddPointer->PointerSize) ||
|
||||
(Blob->Size - AddPointer->PointerSize < AddPointer->PointerOffset))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid pointer location or size in \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
AddPointer->PointerFile
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -460,8 +497,12 @@ ProcessCmdAddPointer (
|
||||
PointerValue = 0;
|
||||
CopyMem (&PointerValue, PointerField, AddPointer->PointerSize);
|
||||
if (PointerValue >= Blob2->Size) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid pointer value in \"%a\"\n", __FUNCTION__,
|
||||
AddPointer->PointerFile));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid pointer value in \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
AddPointer->PointerFile
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -472,23 +513,34 @@ ProcessCmdAddPointer (
|
||||
ASSERT ((UINTN)Blob2->Base <= MAX_ADDRESS - Blob2->Size);
|
||||
|
||||
PointerValue += (UINT64)(UINTN)Blob2->Base;
|
||||
if (AddPointer->PointerSize < 8 &&
|
||||
RShiftU64 (PointerValue, AddPointer->PointerSize * 8) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: relocated pointer value unrepresentable in "
|
||||
"\"%a\"\n", __FUNCTION__, AddPointer->PointerFile));
|
||||
if ((AddPointer->PointerSize < 8) &&
|
||||
(RShiftU64 (PointerValue, AddPointer->PointerSize * 8) != 0))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: relocated pointer value unrepresentable in "
|
||||
"\"%a\"\n",
|
||||
__FUNCTION__,
|
||||
AddPointer->PointerFile
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
CopyMem (PointerField, &PointerValue, AddPointer->PointerSize);
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
|
||||
"PointerOffset=0x%x PointerSize=%d\n", __FUNCTION__,
|
||||
AddPointer->PointerFile, AddPointer->PointeeFile,
|
||||
AddPointer->PointerOffset, AddPointer->PointerSize));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
|
||||
"PointerOffset=0x%x PointerSize=%d\n",
|
||||
__FUNCTION__,
|
||||
AddPointer->PointerFile,
|
||||
AddPointer->PointeeFile,
|
||||
AddPointer->PointerOffset,
|
||||
AddPointer->PointerSize
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process a QEMU_LOADER_ADD_CHECKSUM command.
|
||||
|
||||
@ -522,17 +574,26 @@ ProcessCmdAddChecksum (
|
||||
|
||||
TrackerEntry = OrderedCollectionFind (Tracker, AddChecksum->File);
|
||||
if (TrackerEntry == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid blob reference \"%a\"\n", __FUNCTION__,
|
||||
AddChecksum->File));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid blob reference \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
AddChecksum->File
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
Blob = OrderedCollectionUserStruct (TrackerEntry);
|
||||
if (Blob->Size <= AddChecksum->ResultOffset ||
|
||||
Blob->Size < AddChecksum->Length ||
|
||||
Blob->Size - AddChecksum->Length < AddChecksum->Start) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid checksum range in \"%a\"\n",
|
||||
__FUNCTION__, AddChecksum->File));
|
||||
if ((Blob->Size <= AddChecksum->ResultOffset) ||
|
||||
(Blob->Size < AddChecksum->Length) ||
|
||||
(Blob->Size - AddChecksum->Length < AddChecksum->Start))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid checksum range in \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
AddChecksum->File
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -540,13 +601,19 @@ ProcessCmdAddChecksum (
|
||||
Blob->Base + AddChecksum->Start,
|
||||
AddChecksum->Length
|
||||
);
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: File=\"%a\" ResultOffset=0x%x Start=0x%x "
|
||||
"Length=0x%x\n", __FUNCTION__, AddChecksum->File,
|
||||
AddChecksum->ResultOffset, AddChecksum->Start, AddChecksum->Length));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: File=\"%a\" ResultOffset=0x%x Start=0x%x "
|
||||
"Length=0x%x\n",
|
||||
__FUNCTION__,
|
||||
AddChecksum->File,
|
||||
AddChecksum->ResultOffset,
|
||||
AddChecksum->Start,
|
||||
AddChecksum->Length
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process a QEMU_LOADER_WRITE_POINTER command.
|
||||
|
||||
@ -593,29 +660,42 @@ ProcessCmdWritePointer (
|
||||
BLOB *PointeeBlob;
|
||||
UINT64 PointerValue;
|
||||
|
||||
if (WritePointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0' ||
|
||||
WritePointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
|
||||
if ((WritePointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') ||
|
||||
(WritePointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0'))
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
Status = QemuFwCfgFindFile ((CONST CHAR8 *)WritePointer->PointerFile,
|
||||
&PointerItem, &PointerItemSize);
|
||||
Status = QemuFwCfgFindFile (
|
||||
(CONST CHAR8 *)WritePointer->PointerFile,
|
||||
&PointerItem,
|
||||
&PointerItemSize
|
||||
);
|
||||
PointeeEntry = OrderedCollectionFind (Tracker, WritePointer->PointeeFile);
|
||||
if (RETURN_ERROR (Status) || PointeeEntry == NULL) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
if (RETURN_ERROR (Status) || (PointeeEntry == NULL)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid fw_cfg file or blob reference \"%a\" / \"%a\"\n",
|
||||
__FUNCTION__, WritePointer->PointerFile, WritePointer->PointeeFile));
|
||||
__FUNCTION__,
|
||||
WritePointer->PointerFile,
|
||||
WritePointer->PointeeFile
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
if ((WritePointer->PointerSize != 1 && WritePointer->PointerSize != 2 &&
|
||||
WritePointer->PointerSize != 4 && WritePointer->PointerSize != 8) ||
|
||||
if (((WritePointer->PointerSize != 1) && (WritePointer->PointerSize != 2) &&
|
||||
(WritePointer->PointerSize != 4) && (WritePointer->PointerSize != 8)) ||
|
||||
(PointerItemSize < WritePointer->PointerSize) ||
|
||||
(PointerItemSize - WritePointer->PointerSize <
|
||||
WritePointer->PointerOffset)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid pointer location or size in \"%a\"\n",
|
||||
__FUNCTION__, WritePointer->PointerFile));
|
||||
WritePointer->PointerOffset))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid pointer location or size in \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
WritePointer->PointerFile
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -633,10 +713,15 @@ ProcessCmdWritePointer (
|
||||
ASSERT ((UINTN)PointeeBlob->Base <= MAX_ADDRESS - PointeeBlob->Size);
|
||||
|
||||
PointerValue += (UINT64)(UINTN)PointeeBlob->Base;
|
||||
if (WritePointer->PointerSize < 8 &&
|
||||
RShiftU64 (PointerValue, WritePointer->PointerSize * 8) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: pointer value unrepresentable in \"%a\"\n",
|
||||
__FUNCTION__, WritePointer->PointerFile));
|
||||
if ((WritePointer->PointerSize < 8) &&
|
||||
(RShiftU64 (PointerValue, WritePointer->PointerSize * 8) != 0))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: pointer value unrepresentable in \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
WritePointer->PointerFile
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -670,15 +755,20 @@ ProcessCmdWritePointer (
|
||||
//
|
||||
PointeeBlob->HostsOnlyTableData = FALSE;
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
|
||||
"PointerOffset=0x%x PointeeOffset=0x%x PointerSize=%d\n", __FUNCTION__,
|
||||
WritePointer->PointerFile, WritePointer->PointeeFile,
|
||||
WritePointer->PointerOffset, WritePointer->PointeeOffset,
|
||||
WritePointer->PointerSize));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
|
||||
"PointerOffset=0x%x PointeeOffset=0x%x PointerSize=%d\n",
|
||||
__FUNCTION__,
|
||||
WritePointer->PointerFile,
|
||||
WritePointer->PointeeFile,
|
||||
WritePointer->PointerOffset,
|
||||
WritePointer->PointeeOffset,
|
||||
WritePointer->PointerSize
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Undo a QEMU_LOADER_WRITE_POINTER command.
|
||||
|
||||
@ -700,8 +790,11 @@ UndoCmdWritePointer (
|
||||
UINTN PointerItemSize;
|
||||
UINT64 PointerValue;
|
||||
|
||||
Status = QemuFwCfgFindFile ((CONST CHAR8 *)WritePointer->PointerFile,
|
||||
&PointerItem, &PointerItemSize);
|
||||
Status = QemuFwCfgFindFile (
|
||||
(CONST CHAR8 *)WritePointer->PointerFile,
|
||||
&PointerItem,
|
||||
&PointerItemSize
|
||||
);
|
||||
ASSERT_RETURN_ERROR (Status);
|
||||
|
||||
PointerValue = 0;
|
||||
@ -709,13 +802,16 @@ UndoCmdWritePointer (
|
||||
QemuFwCfgSkipBytes (WritePointer->PointerOffset);
|
||||
QemuFwCfgWriteBytes (WritePointer->PointerSize, &PointerValue);
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE,
|
||||
"%a: PointerFile=\"%a\" PointerOffset=0x%x PointerSize=%d\n", __FUNCTION__,
|
||||
WritePointer->PointerFile, WritePointer->PointerOffset,
|
||||
WritePointer->PointerSize));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: PointerFile=\"%a\" PointerOffset=0x%x PointerSize=%d\n",
|
||||
__FUNCTION__,
|
||||
WritePointer->PointerFile,
|
||||
WritePointer->PointerOffset,
|
||||
WritePointer->PointerSize
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We'll be saving the keys of installed tables so that we can roll them back
|
||||
// in case of failure. 128 tables should be enough for anyone (TM).
|
||||
@ -806,7 +902,7 @@ Process2ndPassCmdAddPointer (
|
||||
CONST EFI_ACPI_DESCRIPTION_HEADER *Header;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (*NumInstalled < 0 || *NumInstalled > INSTALLED_TABLES_MAX) {
|
||||
if ((*NumInstalled < 0) || (*NumInstalled > INSTALLED_TABLES_MAX)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -823,7 +919,7 @@ Process2ndPassCmdAddPointer (
|
||||
// by the Blob2->Size check and later checks in ProcessCmdAddPointer().
|
||||
//
|
||||
Blob2Remaining = (UINTN)Blob2->Base;
|
||||
ASSERT(PointerValue >= Blob2Remaining);
|
||||
ASSERT (PointerValue >= Blob2Remaining);
|
||||
Blob2Remaining += Blob2->Size;
|
||||
ASSERT (PointerValue < Blob2Remaining);
|
||||
|
||||
@ -845,13 +941,20 @@ Process2ndPassCmdAddPointer (
|
||||
));
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
Blob2Remaining -= (UINTN) PointerValue;
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: checking for ACPI header in \"%a\" at 0x%Lx "
|
||||
"(remaining: 0x%Lx): ", __FUNCTION__, AddPointer->PointeeFile,
|
||||
PointerValue, (UINT64)Blob2Remaining));
|
||||
Blob2Remaining -= (UINTN)PointerValue;
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: checking for ACPI header in \"%a\" at 0x%Lx "
|
||||
"(remaining: 0x%Lx): ",
|
||||
__FUNCTION__,
|
||||
AddPointer->PointeeFile,
|
||||
PointerValue,
|
||||
(UINT64)Blob2Remaining
|
||||
));
|
||||
|
||||
TableSize = 0;
|
||||
|
||||
@ -861,12 +964,17 @@ Process2ndPassCmdAddPointer (
|
||||
if (sizeof *Facs <= Blob2Remaining) {
|
||||
Facs = (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)PointerValue;
|
||||
|
||||
if (Facs->Length >= sizeof *Facs &&
|
||||
Facs->Length <= Blob2Remaining &&
|
||||
Facs->Signature ==
|
||||
EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
|
||||
DEBUG ((DEBUG_VERBOSE, "found \"%-4.4a\" size 0x%x\n",
|
||||
(CONST CHAR8 *)&Facs->Signature, Facs->Length));
|
||||
if ((Facs->Length >= sizeof *Facs) &&
|
||||
(Facs->Length <= Blob2Remaining) &&
|
||||
(Facs->Signature ==
|
||||
EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"found \"%-4.4a\" size 0x%x\n",
|
||||
(CONST CHAR8 *)&Facs->Signature,
|
||||
Facs->Length
|
||||
));
|
||||
TableSize = Facs->Length;
|
||||
}
|
||||
}
|
||||
@ -874,28 +982,34 @@ Process2ndPassCmdAddPointer (
|
||||
//
|
||||
// check for the uniform tables
|
||||
//
|
||||
if (TableSize == 0 && sizeof *Header <= Blob2Remaining) {
|
||||
if ((TableSize == 0) && (sizeof *Header <= Blob2Remaining)) {
|
||||
Header = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)PointerValue;
|
||||
|
||||
if (Header->Length >= sizeof *Header &&
|
||||
Header->Length <= Blob2Remaining &&
|
||||
CalculateSum8 ((CONST UINT8 *)Header, Header->Length) == 0) {
|
||||
if ((Header->Length >= sizeof *Header) &&
|
||||
(Header->Length <= Blob2Remaining) &&
|
||||
(CalculateSum8 ((CONST UINT8 *)Header, Header->Length) == 0))
|
||||
{
|
||||
//
|
||||
// This looks very much like an ACPI table from QEMU:
|
||||
// - Length field consistent with both ACPI and containing blob size
|
||||
// - checksum is correct
|
||||
//
|
||||
DEBUG ((DEBUG_VERBOSE, "found \"%-4.4a\" size 0x%x\n",
|
||||
(CONST CHAR8 *)&Header->Signature, Header->Length));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"found \"%-4.4a\" size 0x%x\n",
|
||||
(CONST CHAR8 *)&Header->Signature,
|
||||
Header->Length
|
||||
));
|
||||
TableSize = Header->Length;
|
||||
|
||||
//
|
||||
// Skip RSDT and XSDT because those are handled by
|
||||
// EFI_ACPI_TABLE_PROTOCOL automatically.
|
||||
if (Header->Signature ==
|
||||
EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE ||
|
||||
Header->Signature ==
|
||||
EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
|
||||
if ((Header->Signature ==
|
||||
EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) ||
|
||||
(Header->Signature ==
|
||||
EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -908,20 +1022,32 @@ Process2ndPassCmdAddPointer (
|
||||
}
|
||||
|
||||
if (*NumInstalled == INSTALLED_TABLES_MAX) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: can't install more than %d tables\n",
|
||||
__FUNCTION__, INSTALLED_TABLES_MAX));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: can't install more than %d tables\n",
|
||||
__FUNCTION__,
|
||||
INSTALLED_TABLES_MAX
|
||||
));
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto RollbackSeenPointer;
|
||||
}
|
||||
|
||||
Status = AcpiProtocol->InstallAcpiTable (AcpiProtocol,
|
||||
(VOID *)(UINTN)PointerValue, TableSize,
|
||||
&InstalledKey[*NumInstalled]);
|
||||
Status = AcpiProtocol->InstallAcpiTable (
|
||||
AcpiProtocol,
|
||||
(VOID *)(UINTN)PointerValue,
|
||||
TableSize,
|
||||
&InstalledKey[*NumInstalled]
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTable(): %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: InstallAcpiTable(): %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RollbackSeenPointer;
|
||||
}
|
||||
|
||||
++*NumInstalled;
|
||||
return EFI_SUCCESS;
|
||||
|
||||
@ -930,7 +1056,6 @@ RollbackSeenPointer:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Download, process, and install ACPI table data from the QEMU loader
|
||||
interface.
|
||||
@ -980,9 +1105,14 @@ InstallQemuFwCfgTables (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (FwCfgSize % sizeof *LoaderEntry != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: \"etc/table-loader\" has invalid size 0x%Lx\n",
|
||||
__FUNCTION__, (UINT64)FwCfgSize));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: \"etc/table-loader\" has invalid size 0x%Lx\n",
|
||||
__FUNCTION__,
|
||||
(UINT64)FwCfgSize
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -990,6 +1120,7 @@ InstallQemuFwCfgTables (
|
||||
if (LoaderStart == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
EnablePciDecoding (&OriginalPciAttributes, &OriginalPciAttributesCount);
|
||||
QemuFwCfgSelectItem (FwCfgItem);
|
||||
QemuFwCfgReadBytes (FwCfgSize, LoaderStart);
|
||||
@ -1043,26 +1174,38 @@ InstallQemuFwCfgTables (
|
||||
break;
|
||||
|
||||
case QemuLoaderCmdAddPointer:
|
||||
Status = ProcessCmdAddPointer (&LoaderEntry->Command.AddPointer,
|
||||
Tracker);
|
||||
Status = ProcessCmdAddPointer (
|
||||
&LoaderEntry->Command.AddPointer,
|
||||
Tracker
|
||||
);
|
||||
break;
|
||||
|
||||
case QemuLoaderCmdAddChecksum:
|
||||
Status = ProcessCmdAddChecksum (&LoaderEntry->Command.AddChecksum,
|
||||
Tracker);
|
||||
Status = ProcessCmdAddChecksum (
|
||||
&LoaderEntry->Command.AddChecksum,
|
||||
Tracker
|
||||
);
|
||||
break;
|
||||
|
||||
case QemuLoaderCmdWritePointer:
|
||||
Status = ProcessCmdWritePointer (&LoaderEntry->Command.WritePointer,
|
||||
Tracker, S3Context);
|
||||
Status = ProcessCmdWritePointer (
|
||||
&LoaderEntry->Command.WritePointer,
|
||||
Tracker,
|
||||
S3Context
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
WritePointerSubsetEnd = LoaderEntry + 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: unknown loader command: 0x%x\n",
|
||||
__FUNCTION__, LoaderEntry->Type));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: unknown loader command: 0x%x\n",
|
||||
__FUNCTION__,
|
||||
LoaderEntry->Type
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1113,6 +1256,7 @@ InstallQemuFwCfgTables (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto UninstallAcpiTables;
|
||||
}
|
||||
|
||||
//
|
||||
// Ownership of S3Context has been transferred.
|
||||
//
|
||||
@ -1134,10 +1278,12 @@ UninstallAcpiTables:
|
||||
|
||||
for (SeenPointerEntry = OrderedCollectionMin (SeenPointers);
|
||||
SeenPointerEntry != NULL;
|
||||
SeenPointerEntry = SeenPointerEntry2) {
|
||||
SeenPointerEntry = SeenPointerEntry2)
|
||||
{
|
||||
SeenPointerEntry2 = OrderedCollectionNext (SeenPointerEntry);
|
||||
OrderedCollectionDelete (SeenPointers, SeenPointerEntry, NULL);
|
||||
}
|
||||
|
||||
OrderedCollectionUninit (SeenPointers);
|
||||
|
||||
FreeKeys:
|
||||
@ -1164,7 +1310,8 @@ RollbackWritePointersAndFreeTracker:
|
||||
// not directly part of some ACPI table.
|
||||
//
|
||||
for (TrackerEntry = OrderedCollectionMin (Tracker); TrackerEntry != NULL;
|
||||
TrackerEntry = TrackerEntry2) {
|
||||
TrackerEntry = TrackerEntry2)
|
||||
{
|
||||
VOID *UserStruct;
|
||||
BLOB *Blob;
|
||||
|
||||
@ -1173,12 +1320,18 @@ RollbackWritePointersAndFreeTracker:
|
||||
Blob = UserStruct;
|
||||
|
||||
if (EFI_ERROR (Status) || Blob->HostsOnlyTableData) {
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: freeing \"%a\"\n", __FUNCTION__,
|
||||
Blob->File));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: freeing \"%a\"\n",
|
||||
__FUNCTION__,
|
||||
Blob->File
|
||||
));
|
||||
gBS->FreePages ((UINTN)Blob->Base, EFI_SIZE_TO_PAGES (Blob->Size));
|
||||
}
|
||||
|
||||
FreePool (Blob);
|
||||
}
|
||||
|
||||
OrderedCollectionUninit (Tracker);
|
||||
|
||||
FreeS3Context:
|
||||
|
@ -58,7 +58,7 @@ STATIC HASH_TABLE *mHashesTable;
|
||||
STATIC UINT16 mHashesTableSize;
|
||||
|
||||
STATIC
|
||||
CONST GUID*
|
||||
CONST GUID *
|
||||
FindBlobEntryGuid (
|
||||
IN CONST CHAR16 *BlobName
|
||||
)
|
||||
@ -97,17 +97,23 @@ VerifyBlob (
|
||||
INT32 Remaining;
|
||||
HASH_TABLE *Entry;
|
||||
|
||||
if (mHashesTable == NULL || mHashesTableSize == 0) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
if ((mHashesTable == NULL) || (mHashesTableSize == 0)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Verifier called but no hashes table discoverd in MEMFD\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
Guid = FindBlobEntryGuid (BlobName);
|
||||
if (Guid == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Unknown blob name \"%s\"\n", __FUNCTION__,
|
||||
BlobName));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Unknown blob name \"%s\"\n",
|
||||
__FUNCTION__,
|
||||
BlobName
|
||||
));
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
@ -118,7 +124,8 @@ VerifyBlob (
|
||||
for (Entry = mHashesTable, Remaining = mHashesTableSize;
|
||||
Remaining >= sizeof *Entry && Remaining >= Entry->Len;
|
||||
Remaining -= Entry->Len,
|
||||
Entry = (HASH_TABLE *)((UINT8 *)Entry + Entry->Len)) {
|
||||
Entry = (HASH_TABLE *)((UINT8 *)Entry + Entry->Len))
|
||||
{
|
||||
UINTN EntrySize;
|
||||
EFI_STATUS Status;
|
||||
UINT8 Hash[SHA256_DIGEST_SIZE];
|
||||
@ -131,8 +138,13 @@ VerifyBlob (
|
||||
|
||||
EntrySize = Entry->Len - sizeof Entry->Guid - sizeof Entry->Len;
|
||||
if (EntrySize != SHA256_DIGEST_SIZE) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Hash has the wrong size %d != %d\n",
|
||||
__FUNCTION__, EntrySize, SHA256_DIGEST_SIZE));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Hash has the wrong size %d != %d\n",
|
||||
__FUNCTION__,
|
||||
EntrySize,
|
||||
SHA256_DIGEST_SIZE
|
||||
));
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
@ -144,18 +156,31 @@ VerifyBlob (
|
||||
|
||||
if (CompareMem (Entry->Data, Hash, EntrySize) == 0) {
|
||||
Status = EFI_SUCCESS;
|
||||
DEBUG ((DEBUG_INFO, "%a: Hash comparison succeeded for \"%s\"\n",
|
||||
__FUNCTION__, BlobName));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Hash comparison succeeded for \"%s\"\n",
|
||||
__FUNCTION__,
|
||||
BlobName
|
||||
));
|
||||
} else {
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
DEBUG ((DEBUG_ERROR, "%a: Hash comparison failed for \"%s\"\n",
|
||||
__FUNCTION__, BlobName));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Hash comparison failed for \"%s\"\n",
|
||||
__FUNCTION__,
|
||||
BlobName
|
||||
));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "%a: Hash GUID %g not found in table\n", __FUNCTION__,
|
||||
Guid));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Hash GUID %g not found in table\n",
|
||||
__FUNCTION__,
|
||||
Guid
|
||||
));
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
@ -183,20 +208,29 @@ BlobVerifierLibSevHashesConstructor (
|
||||
Ptr = (void *)(UINTN)FixedPcdGet64 (PcdQemuHashTableBase);
|
||||
Size = FixedPcdGet32 (PcdQemuHashTableSize);
|
||||
|
||||
if (Ptr == NULL || Size < sizeof *Ptr ||
|
||||
if ((Ptr == NULL) || (Size < sizeof *Ptr) ||
|
||||
!CompareGuid (&Ptr->Guid, &SEV_HASH_TABLE_GUID) ||
|
||||
Ptr->Len < sizeof *Ptr || Ptr->Len > Size) {
|
||||
(Ptr->Len < sizeof *Ptr) || (Ptr->Len > Size))
|
||||
{
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Found injected hashes table in secure location\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Found injected hashes table in secure location\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
|
||||
mHashesTable = (HASH_TABLE *)Ptr->Data;
|
||||
mHashesTableSize = Ptr->Len - sizeof Ptr->Guid - sizeof Ptr->Len;
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: mHashesTable=0x%p, Size=%u\n", __FUNCTION__,
|
||||
mHashesTable, mHashesTableSize));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: mHashesTable=0x%p, Size=%u\n",
|
||||
__FUNCTION__,
|
||||
mHashesTable,
|
||||
mHashesTableSize
|
||||
));
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ STATIC CONFIDENTIAL_COMPUTING_SECRET_LOCATION mSecretDxeTable = {
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeSecretDxe(
|
||||
InitializeSecretDxe (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
@ -51,8 +51,9 @@ AmdSevDxeEntryPoint (
|
||||
CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc;
|
||||
|
||||
Desc = &AllDescMap[Index];
|
||||
if (Desc->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo ||
|
||||
Desc->GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
|
||||
if ((Desc->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) ||
|
||||
(Desc->GcdMemoryType == EfiGcdMemoryTypeNonExistent))
|
||||
{
|
||||
Status = MemEncryptSevClearMmioPageEncMask (
|
||||
0,
|
||||
Desc->BaseAddress,
|
||||
@ -123,8 +124,12 @@ AmdSevDxeEntryPoint (
|
||||
MapPagesCount // NumPages
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: MemEncryptSevClearPageEncMask(): %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: MemEncryptSevClearPageEncMask(): %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ InstallAcpiTable (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Locate the first instance of a protocol. If the protocol requested is an
|
||||
FV protocol, then it will return the first FV that contains the ACPI table
|
||||
@ -85,7 +84,7 @@ LocateFvInstanceWithTables (
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiFirmwareVolume2ProtocolGuid,
|
||||
(VOID**) &FvInstance
|
||||
(VOID **)&FvInstance
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -94,7 +93,7 @@ LocateFvInstanceWithTables (
|
||||
//
|
||||
Status = FvInstance->ReadFile (
|
||||
FvInstance,
|
||||
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
|
||||
(EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),
|
||||
NULL,
|
||||
&Size,
|
||||
&FileType,
|
||||
@ -124,7 +123,6 @@ LocateFvInstanceWithTables (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Find ACPI tables in an FV and install them.
|
||||
|
||||
@ -171,19 +169,19 @@ InstallOvmfFvTables (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
ASSERT (FwVol != NULL);
|
||||
|
||||
//
|
||||
// Read tables from the storage file.
|
||||
//
|
||||
while (Status == EFI_SUCCESS) {
|
||||
|
||||
Status = FwVol->ReadSection (
|
||||
FwVol,
|
||||
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
|
||||
(EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),
|
||||
EFI_SECTION_RAW,
|
||||
Instance,
|
||||
(VOID**) &CurrentTable,
|
||||
(VOID **)&CurrentTable,
|
||||
&Size,
|
||||
&FvStatus
|
||||
);
|
||||
@ -193,7 +191,7 @@ InstallOvmfFvTables (
|
||||
//
|
||||
TableHandle = 0;
|
||||
|
||||
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
|
||||
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *)CurrentTable)->Length;
|
||||
ASSERT (Size >= TableSize);
|
||||
|
||||
//
|
||||
@ -249,4 +247,3 @@ InstallAcpiTables (
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ InstallAcpiTable (
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BhyveInstallAcpiTable(
|
||||
BhyveInstallAcpiTable (
|
||||
IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol,
|
||||
IN VOID *AcpiTableBuffer,
|
||||
IN UINTN AcpiTableBufferSize,
|
||||
|
@ -37,7 +37,7 @@ BhyveInstallAcpiMadtTable (
|
||||
|
||||
// Query the host for the number of vCPUs
|
||||
CpuCount = 0;
|
||||
cSize = sizeof(CpuCount);
|
||||
cSize = sizeof (CpuCount);
|
||||
if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) {
|
||||
DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount));
|
||||
ASSERT (CpuCount >= 1);
|
||||
@ -57,7 +57,7 @@ BhyveInstallAcpiMadtTable (
|
||||
}
|
||||
|
||||
CopyMem (&(Madt->Header), AcpiTableBuffer, sizeof (EFI_ACPI_DESCRIPTION_HEADER));
|
||||
Madt->Header.Length = (UINT32) NewBufferSize;
|
||||
Madt->Header.Length = (UINT32)NewBufferSize;
|
||||
Madt->LocalApicAddress = 0xFEE00000;
|
||||
Madt->Flags = EFI_ACPI_1_0_PCAT_COMPAT;
|
||||
Ptr = Madt + 1;
|
||||
@ -66,17 +66,18 @@ BhyveInstallAcpiMadtTable (
|
||||
for (Loop = 0; Loop < CpuCount; ++Loop) {
|
||||
LocalApic->Type = EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC;
|
||||
LocalApic->Length = sizeof (*LocalApic);
|
||||
LocalApic->AcpiProcessorId = (UINT8) Loop;
|
||||
LocalApic->ApicId = (UINT8) Loop;
|
||||
LocalApic->AcpiProcessorId = (UINT8)Loop;
|
||||
LocalApic->ApicId = (UINT8)Loop;
|
||||
LocalApic->Flags = 1; // enabled
|
||||
++LocalApic;
|
||||
}
|
||||
|
||||
Ptr = LocalApic;
|
||||
|
||||
IoApic = Ptr;
|
||||
IoApic->Type = EFI_ACPI_1_0_IO_APIC;
|
||||
IoApic->Length = sizeof (*IoApic);
|
||||
IoApic->IoApicId = (UINT8) CpuCount;
|
||||
IoApic->IoApicId = (UINT8)CpuCount;
|
||||
IoApic->Reserved = EFI_ACPI_RESERVED_BYTE;
|
||||
IoApic->IoApicAddress = 0xFEC00000;
|
||||
IoApic->SystemVectorBase = 0x00000000;
|
||||
@ -94,7 +95,7 @@ BhyveInstallAcpiMadtTable (
|
||||
Iso->Flags = 0x0000; // Conforms to specs of the bus
|
||||
Ptr = Iso + 1;
|
||||
|
||||
ASSERT ((UINTN) ((UINT8 *)Ptr - (UINT8 *)Madt) == NewBufferSize);
|
||||
ASSERT ((UINTN)((UINT8 *)Ptr - (UINT8 *)Madt) == NewBufferSize);
|
||||
Status = InstallAcpiTable (AcpiProtocol, Madt, NewBufferSize, TableKey);
|
||||
|
||||
FreePool (Madt);
|
||||
@ -114,7 +115,7 @@ BhyveInstallAcpiTable (
|
||||
EFI_ACPI_DESCRIPTION_HEADER *Hdr;
|
||||
EFI_ACPI_TABLE_INSTALL_ACPI_TABLE TableInstallFunction;
|
||||
|
||||
Hdr = (EFI_ACPI_DESCRIPTION_HEADER*) AcpiTableBuffer;
|
||||
Hdr = (EFI_ACPI_DESCRIPTION_HEADER *)AcpiTableBuffer;
|
||||
switch (Hdr->Signature) {
|
||||
case EFI_ACPI_1_0_APIC_SIGNATURE:
|
||||
TableInstallFunction = BhyveInstallAcpiMadtTable;
|
||||
|
@ -22,13 +22,12 @@ FindAcpiTableProtocol (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiAcpiTableProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&AcpiTable
|
||||
(VOID **)&AcpiTable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return AcpiTable;
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
@ -39,17 +38,19 @@ OnRootBridgesConnected (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: root bridges have been connected, installing ACPI tables\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
Status = InstallAcpiTables (FindAcpiTableProtocol ());
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
|
||||
}
|
||||
|
||||
gBS->CloseEvent (Event);
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AcpiPlatformEntryPoint (
|
||||
@ -66,8 +67,12 @@ AcpiPlatformEntryPoint (
|
||||
// the full functionality.
|
||||
//
|
||||
if (PcdGetBool (PcdPciDisableBusEnumeration)) {
|
||||
DEBUG ((DEBUG_INFO, "%a: PCI or its enumeration disabled, installing "
|
||||
"ACPI tables\n", __FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: PCI or its enumeration disabled, installing "
|
||||
"ACPI tables\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return InstallAcpiTables (FindAcpiTableProtocol ());
|
||||
}
|
||||
|
||||
@ -77,13 +82,20 @@ AcpiPlatformEntryPoint (
|
||||
// setup. (Note that we're a DXE_DRIVER; our entry point function is invoked
|
||||
// strictly before BDS is entered and can connect the root bridges.)
|
||||
//
|
||||
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
|
||||
OnRootBridgesConnected, NULL /* Context */,
|
||||
&gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
OnRootBridgesConnected,
|
||||
NULL /* Context */,
|
||||
&gRootBridgesConnectedEventGroupGuid,
|
||||
&RootBridgesConnected
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: waiting for root bridges to be connected, registered callback\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "AcpiPlatform.h"
|
||||
|
||||
|
||||
/**
|
||||
Collect all PciIo protocol instances in the system. Save their original
|
||||
attributes, and enable IO and MMIO decoding for each.
|
||||
@ -59,8 +58,13 @@ EnablePciDecoding (
|
||||
return;
|
||||
}
|
||||
|
||||
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPciIoProtocolGuid,
|
||||
NULL /* SearchKey */, &NoHandles, &Handles);
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
NULL /* SearchKey */,
|
||||
&NoHandles,
|
||||
&Handles
|
||||
);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
//
|
||||
// No PCI devices were found on either of the root bridges. We're done.
|
||||
@ -69,15 +73,22 @@ EnablePciDecoding (
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: LocateHandleBuffer(): %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: LocateHandleBuffer(): %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
OrigAttrs = AllocatePool (NoHandles * sizeof *OrigAttrs);
|
||||
if (OrigAttrs == NULL) {
|
||||
DEBUG ((DEBUG_WARN, "%a: AllocatePool(): out of resources\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: AllocatePool(): out of resources\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
goto FreeHandles;
|
||||
}
|
||||
|
||||
@ -88,30 +99,49 @@ EnablePciDecoding (
|
||||
//
|
||||
// Look up PciIo on the handle and stash it
|
||||
//
|
||||
Status = gBS->HandleProtocol (Handles[Idx], &gEfiPciIoProtocolGuid,
|
||||
(VOID**)&PciIo);
|
||||
Status = gBS->HandleProtocol (
|
||||
Handles[Idx],
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
OrigAttrs[Idx].PciIo = PciIo;
|
||||
|
||||
//
|
||||
// Stash the current attributes
|
||||
//
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationGet, 0,
|
||||
&OrigAttrs[Idx].PciAttributes);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationGet,
|
||||
0,
|
||||
&OrigAttrs[Idx].PciAttributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationGet: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationGet: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve supported attributes
|
||||
//
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSupported, 0,
|
||||
&Attributes);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationSupported,
|
||||
0,
|
||||
&Attributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationSupported: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationSupported: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
|
||||
@ -119,11 +149,19 @@ EnablePciDecoding (
|
||||
// Enable IO and MMIO decoding
|
||||
//
|
||||
Attributes &= EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY;
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationEnable,
|
||||
Attributes, NULL);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationEnable,
|
||||
Attributes,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationEnable: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationEnable: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
}
|
||||
@ -139,19 +177,20 @@ EnablePciDecoding (
|
||||
RestoreAttributes:
|
||||
while (Idx > 0) {
|
||||
--Idx;
|
||||
OrigAttrs[Idx].PciIo->Attributes (OrigAttrs[Idx].PciIo,
|
||||
OrigAttrs[Idx].PciIo->Attributes (
|
||||
OrigAttrs[Idx].PciIo,
|
||||
EfiPciIoAttributeOperationSet,
|
||||
OrigAttrs[Idx].PciAttributes,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (OrigAttrs);
|
||||
|
||||
FreeHandles:
|
||||
FreePool (Handles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Restore the original PCI attributes saved with EnablePciDecoding().
|
||||
|
||||
@ -188,5 +227,6 @@ RestorePciDecoding (
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (OriginalAttributes);
|
||||
}
|
||||
|
@ -50,18 +50,16 @@ EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName = {
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuGopComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuGopComponentNameGetControllerName,
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuGopComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuGopComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = {
|
||||
{ "eng", L"Emulator GOP Driver" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
@ -118,7 +116,6 @@ EmuGopComponentNameGetDriverName (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
@ -87,7 +87,6 @@ typedef struct {
|
||||
UINT32 FbSize;
|
||||
} GOP_PRIVATE_DATA;
|
||||
|
||||
|
||||
#define GOP_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
|
||||
|
||||
|
@ -19,7 +19,6 @@ BhyveGetGraphicsMode (
|
||||
UINT16 *Depth
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||
@ -81,7 +80,7 @@ EmuGopDriverBindingSupported (
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo,
|
||||
(VOID **)&PciIo,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@ -107,11 +106,11 @@ EmuGopDriverBindingSupported (
|
||||
}
|
||||
|
||||
Status = EFI_UNSUPPORTED;
|
||||
if (Pci.Hdr.VendorId == 0xFB5D && Pci.Hdr.DeviceId == 0x40FB) {
|
||||
DEBUG((DEBUG_INFO, "BHYVE framebuffer device detected\n"));
|
||||
if ((Pci.Hdr.VendorId == 0xFB5D) && (Pci.Hdr.DeviceId == 0x40FB)) {
|
||||
DEBUG ((DEBUG_INFO, "BHYVE framebuffer device detected\n"));
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
BhyveGetGraphicsMode(PciIo, &Width, &Height, &Depth);
|
||||
BhyveGetGraphicsMode (PciIo, &Width, &Height, &Depth);
|
||||
PcdSet32S (PcdVideoHorizontalResolution, Width);
|
||||
PcdSet32S (PcdVideoVerticalResolution, Height);
|
||||
}
|
||||
@ -130,7 +129,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Starts a device controller or a bus controller.
|
||||
|
||||
@ -204,7 +202,7 @@ EmuGopDriverBindingStart (
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &Private->PciIo,
|
||||
(VOID **)&Private->PciIo,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@ -221,20 +219,26 @@ EmuGopDriverBindingStart (
|
||||
Private->PciIo,
|
||||
PCI_BAR_IDX0,
|
||||
NULL,
|
||||
(VOID**) &MmioDesc
|
||||
(VOID **)&MmioDesc
|
||||
);
|
||||
if (EFI_ERROR (Status) ||
|
||||
MmioDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM) {
|
||||
(MmioDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM))
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "BHYVE GOP: No mmio bar\n"));
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "BHYVE GOP: Using mmio bar @ 0x%lx\n",
|
||||
MmioDesc->AddrRangeMin));
|
||||
BhyveGetMemregs(Private, &Memregs);
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"BHYVE GOP: Using mmio bar @ 0x%lx\n",
|
||||
MmioDesc->AddrRangeMin
|
||||
));
|
||||
BhyveGetMemregs (Private, &Memregs);
|
||||
Private->FbSize = Memregs.FbSize;
|
||||
}
|
||||
|
||||
if (MmioDesc != NULL) {
|
||||
FreePool (MmioDesc);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
@ -247,14 +251,18 @@ EmuGopDriverBindingStart (
|
||||
Private->PciIo,
|
||||
PCI_BAR_IDX1,
|
||||
NULL,
|
||||
(VOID**) &MmioDesc
|
||||
(VOID **)&MmioDesc
|
||||
);
|
||||
if (EFI_ERROR (Status) ||
|
||||
MmioDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM) {
|
||||
(MmioDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM))
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "BHYVE GOP: No frame-buffer bar\n"));
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "BHYVE GOP: Using frame-buffer bar @ 0x%lx\n",
|
||||
MmioDesc->AddrRangeMin));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"BHYVE GOP: Using frame-buffer bar @ 0x%lx\n",
|
||||
MmioDesc->AddrRangeMin
|
||||
));
|
||||
Private->FbAddr = MmioDesc->AddrRangeMin;
|
||||
// XXX assert BAR is >= size
|
||||
}
|
||||
@ -262,12 +270,17 @@ EmuGopDriverBindingStart (
|
||||
if (MmioDesc != NULL) {
|
||||
FreePool (MmioDesc);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "BHYVE GOP: Framebuf addr 0x%lx, size %x\n",
|
||||
Private->FbAddr, Private->FbSize));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"BHYVE GOP: Framebuf addr 0x%lx, size %x\n",
|
||||
Private->FbAddr,
|
||||
Private->FbSize
|
||||
));
|
||||
|
||||
Status = EmuGopConstructor (Private);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -279,18 +292,19 @@ EmuGopDriverBindingStart (
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Private->Handle,
|
||||
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
&Private->GraphicsOutput,
|
||||
NULL
|
||||
);
|
||||
|
||||
DEBUG((DEBUG_INFO, "BHYVE framebuffer device started\n"));
|
||||
DEBUG ((DEBUG_INFO, "BHYVE framebuffer device started\n"));
|
||||
|
||||
//
|
||||
// Install int10 handler
|
||||
//
|
||||
#ifndef CSM_ENABLE
|
||||
#ifndef CSM_ENABLE
|
||||
InstallVbeShim (L"Framebuffer", Private->FbAddr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Done:
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -309,8 +323,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Stops a device controller or a bus controller.
|
||||
|
||||
@ -350,7 +362,7 @@ EmuGopDriverBindingStop (
|
||||
EFI_STATUS Status;
|
||||
GOP_PRIVATE_DATA *Private;
|
||||
|
||||
DEBUG((DEBUG_INFO, "BHYVE framebuffer device stopping\n"));
|
||||
DEBUG ((DEBUG_INFO, "BHYVE framebuffer device stopping\n"));
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
@ -377,7 +389,8 @@ EmuGopDriverBindingStop (
|
||||
//
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
Private->Handle,
|
||||
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
&Private->GraphicsOutput,
|
||||
NULL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@ -402,13 +415,11 @@ EmuGopDriverBindingStop (
|
||||
FreeUnicodeStringTable (Private->ControllerNameTable);
|
||||
|
||||
gBS->FreePool (Private);
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// This protocol provides the services required to determine if a driver supports a given controller.
|
||||
/// If a controller is supported, then it also provides routines to start and stop the controller.
|
||||
@ -422,8 +433,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for module EmuGop. The user code starts with this function.
|
||||
|
||||
@ -453,7 +462,6 @@ InitializeEmuGop (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -469,7 +477,6 @@ BhyveGetGraphicsMode (
|
||||
UINT64 Offset;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
Offset = (UINT64)&BhyveRegs.Width - (UINT64)&BhyveRegs;
|
||||
|
||||
Status = PciIo->Mem.Read (
|
||||
@ -538,6 +545,11 @@ BhyveGetMemregs (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "BHYVE Get Memregs, size %d width %d height %d\n",
|
||||
Memregs->FbSize, Memregs->Width, Memregs->Height));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"BHYVE Get Memregs, size %d width %d height %d\n",
|
||||
Memregs->FbSize,
|
||||
Memregs->Width,
|
||||
Memregs->Height
|
||||
));
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ Abstract:
|
||||
#include "Gop.h"
|
||||
#include <Library/FrameBufferBltLib.h>
|
||||
|
||||
|
||||
EFI_EVENT mGopScreenExitBootServicesEvent;
|
||||
|
||||
GOP_MODE_DATA mGopModeData[] = {
|
||||
@ -30,7 +29,7 @@ GOP_MODE_DATA mGopModeData[] = {
|
||||
{ 1024, 768, 32, 0 },
|
||||
{ 800, 600, 32, 0 },
|
||||
{ 640, 480, 32, 0 }
|
||||
};
|
||||
};
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
@ -53,14 +52,18 @@ BhyveGopCompleteModeInfo (
|
||||
Info->PixelInformation.BlueMask = PIXEL24_BLUE_MASK;
|
||||
Info->PixelInformation.ReservedMask = 0;
|
||||
} else if (ModeData->ColorDepth == 32) {
|
||||
DEBUG ((DEBUG_INFO, "%dx%d PixelBlueGreenRedReserved8BitPerColor\n",
|
||||
ModeData->HorizontalResolution, ModeData->VerticalResolution));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%dx%d PixelBlueGreenRedReserved8BitPerColor\n",
|
||||
ModeData->HorizontalResolution,
|
||||
ModeData->VerticalResolution
|
||||
));
|
||||
Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
|
||||
}
|
||||
|
||||
Info->PixelsPerScanLine = Info->HorizontalResolution;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns information for an available graphics mode that the graphics device
|
||||
and the set of active video output devices supports.
|
||||
@ -91,7 +94,7 @@ EmuGopQuerytMode (
|
||||
|
||||
Private = GOP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (Info == NULL || SizeOfInfo == NULL || (UINTN) ModeNumber >= This->Mode->MaxMode) {
|
||||
if ((Info == NULL) || (SizeOfInfo == NULL) || ((UINTN)ModeNumber >= This->Mode->MaxMode)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -108,12 +111,10 @@ EmuGopQuerytMode (
|
||||
(*Info)->VerticalResolution = ModeData->VerticalResolution;
|
||||
(*Info)->PixelFormat = PixelBitMask;
|
||||
(*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution;
|
||||
BhyveGopCompleteModeInfo(ModeData, *Info);
|
||||
BhyveGopCompleteModeInfo (ModeData, *Info);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set the video device into the specified mode and clears the visible portions of
|
||||
the output display to black.
|
||||
@ -142,13 +143,14 @@ EmuGopSetMode (
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
|
||||
UINTN confsize = 0;
|
||||
|
||||
fbconf = NULL;
|
||||
|
||||
Private = GOP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (ModeNumber >= This->Mode->MaxMode) {
|
||||
// Tell bhyve that we are switching out of vesa
|
||||
BhyveSetGraphicsMode(Private, 0, 0, 0);
|
||||
BhyveSetGraphicsMode (Private, 0, 0, 0);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@ -161,11 +163,11 @@ EmuGopSetMode (
|
||||
Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution;
|
||||
|
||||
Info = This->Mode->Info;
|
||||
BhyveGopCompleteModeInfo(ModeData, Info);
|
||||
BhyveGopCompleteModeInfo (ModeData, Info);
|
||||
|
||||
This->Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;
|
||||
This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;
|
||||
This->Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
This->Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
This->Mode->FrameBufferBase = Private->GraphicsOutput.Mode->FrameBufferBase;
|
||||
|
||||
/*
|
||||
@ -175,18 +177,24 @@ EmuGopSetMode (
|
||||
This->Mode->FrameBufferSize = Private->FbSize;
|
||||
DEBUG ((DEBUG_INFO, "BHYVE GOP FrameBufferBase: 0x%x, FrameBufferSize: 0x%x\n", This->Mode->FrameBufferBase, This->Mode->FrameBufferSize));
|
||||
|
||||
BhyveSetGraphicsMode(Private, (UINT16)ModeData->HorizontalResolution, (UINT16)ModeData->VerticalResolution, (UINT16)ModeData->ColorDepth);
|
||||
BhyveSetGraphicsMode (Private, (UINT16)ModeData->HorizontalResolution, (UINT16)ModeData->VerticalResolution, (UINT16)ModeData->ColorDepth);
|
||||
|
||||
RETURN_STATUS ret = FrameBufferBltConfigure (
|
||||
(VOID*)(UINTN) This->Mode->FrameBufferBase,
|
||||
This->Mode->Info, fbconf, &confsize
|
||||
(VOID *)(UINTN)This->Mode->FrameBufferBase,
|
||||
This->Mode->Info,
|
||||
fbconf,
|
||||
&confsize
|
||||
);
|
||||
if (ret == EFI_BUFFER_TOO_SMALL || ret == EFI_INVALID_PARAMETER) {
|
||||
fbconf = AllocatePool(confsize);
|
||||
ret = FrameBufferBltConfigure(
|
||||
(VOID*)(UINTN)This->Mode->FrameBufferBase,
|
||||
This->Mode->Info, fbconf, &confsize);
|
||||
ASSERT(ret == EFI_SUCCESS);
|
||||
|
||||
if ((ret == EFI_BUFFER_TOO_SMALL) || (ret == EFI_INVALID_PARAMETER)) {
|
||||
fbconf = AllocatePool (confsize);
|
||||
ret = FrameBufferBltConfigure (
|
||||
(VOID *)(UINTN)This->Mode->FrameBufferBase,
|
||||
This->Mode->Info,
|
||||
fbconf,
|
||||
&confsize
|
||||
);
|
||||
ASSERT (ret == EFI_SUCCESS);
|
||||
}
|
||||
|
||||
Fill.Red = 0;
|
||||
@ -207,8 +215,6 @@ EmuGopSetMode (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
|
||||
|
||||
@ -251,7 +257,7 @@ EmuGopBlt (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Width == 0 || Height == 0) {
|
||||
if ((Width == 0) || (Height == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -291,7 +297,6 @@ EmuGopBlt (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Construction and Destruction functions
|
||||
//
|
||||
@ -302,8 +307,8 @@ EmuGopConstructor (
|
||||
)
|
||||
{
|
||||
// Set mode 0 to be the requested resolution
|
||||
mGopModeData[0].HorizontalResolution = PcdGet32 ( PcdVideoHorizontalResolution);
|
||||
mGopModeData[0].VerticalResolution = PcdGet32 ( PcdVideoVerticalResolution );
|
||||
mGopModeData[0].HorizontalResolution = PcdGet32 (PcdVideoHorizontalResolution);
|
||||
mGopModeData[0].VerticalResolution = PcdGet32 (PcdVideoVerticalResolution);
|
||||
|
||||
Private->ModeData = mGopModeData;
|
||||
|
||||
@ -318,15 +323,15 @@ EmuGopConstructor (
|
||||
if (Private->GraphicsOutput.Mode == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
||||
if (Private->GraphicsOutput.Mode->Info == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
DEBUG ((DEBUG_INFO, "BHYVE Gop Constructor\n"));
|
||||
|
||||
Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA);
|
||||
Private->GraphicsOutput.Mode->MaxMode = sizeof (mGopModeData) / sizeof (GOP_MODE_DATA);
|
||||
//
|
||||
// Till now, we have no idea about the window size.
|
||||
//
|
||||
@ -336,14 +341,12 @@ EmuGopConstructor (
|
||||
Private->GraphicsOutput.Mode->Info->VerticalResolution = 0;
|
||||
Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBitMask;
|
||||
Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) Private->FbAddr;
|
||||
Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS)Private->FbAddr;
|
||||
Private->GraphicsOutput.Mode->FrameBufferSize = Private->FbSize;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuGopDestructor (
|
||||
GOP_PRIVATE_DATA *Private
|
||||
@ -356,6 +359,7 @@ EmuGopDestructor (
|
||||
if (Private->GraphicsOutput.Mode->Info != NULL) {
|
||||
FreePool (Private->GraphicsOutput.Mode->Info);
|
||||
}
|
||||
|
||||
FreePool (Private->GraphicsOutput.Mode);
|
||||
Private->GraphicsOutput.Mode = NULL;
|
||||
}
|
||||
@ -363,13 +367,13 @@ EmuGopDestructor (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ShutdownGopEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
@ -52,7 +52,6 @@ STATIC CONST UINT16 vbeModeIds[] = {
|
||||
|
||||
STATIC VBE2_MODE_INFO vbeModes[] = {
|
||||
{ // 0x13f 640x480x32
|
||||
|
||||
// ModeAttr - BytesPerScanLine
|
||||
VBE_MODE_DISABLED, 0x07, 0x00, 0x40, 0x40, 0xA000, 0x00, 0x0000, 640*4,
|
||||
// Width, Height..., Vbe3
|
||||
@ -63,7 +62,6 @@ STATIC VBE2_MODE_INFO vbeModes[] = {
|
||||
0xdeadbeef, 0x0000, 0x0000
|
||||
},
|
||||
{ // 0x140 800x600x32
|
||||
|
||||
// ModeAttr - BytesPerScanLine
|
||||
VBE_MODE_DISABLED, 0x07, 0x00, 0x40, 0x40, 0xA000, 0x00, 0x0000, 800*4,
|
||||
// Width, Height..., Vbe3
|
||||
@ -74,7 +72,6 @@ STATIC VBE2_MODE_INFO vbeModes[] = {
|
||||
0xdeadbeef, 0x0000, 0x0000
|
||||
},
|
||||
{ // 0x141 1024x768x32
|
||||
|
||||
// ModeAttr - BytesPerScanLine
|
||||
VBE_MODE_ENABLED, 0x07, 0x00, 0x40, 0x40, 0xA000, 0x00, 0x0000, 1024*4,
|
||||
// Width, Height..., Vbe3
|
||||
@ -130,8 +127,12 @@ InstallVbeShim (
|
||||
//
|
||||
Segment0Pages = 1;
|
||||
Int0x10 = (IVT_ENTRY *)(UINTN)Segment0 + 0x10;
|
||||
Status = gBS->AllocatePages (AllocateAddress, EfiBootServicesCode,
|
||||
Segment0Pages, &Segment0);
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateAddress,
|
||||
EfiBootServicesCode,
|
||||
Segment0Pages,
|
||||
&Segment0
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EFI_PHYSICAL_ADDRESS Handler;
|
||||
@ -142,9 +143,14 @@ InstallVbeShim (
|
||||
// it's already present.
|
||||
//
|
||||
Handler = (Int0x10->Segment << 4) + Int0x10->Offset;
|
||||
if (Handler >= SegmentC && Handler < SegmentF) {
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: Video BIOS handler found at %04x:%04x\n",
|
||||
__FUNCTION__, Int0x10->Segment, Int0x10->Offset));
|
||||
if ((Handler >= SegmentC) && (Handler < SegmentF)) {
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: Video BIOS handler found at %04x:%04x\n",
|
||||
__FUNCTION__,
|
||||
Int0x10->Segment,
|
||||
Int0x10->Offset
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -152,8 +158,12 @@ InstallVbeShim (
|
||||
// Otherwise we'll overwrite the Int10h vector, even though we may not own
|
||||
// the page at zero.
|
||||
//
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: failed to allocate page at zero: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: failed to allocate page at zero: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
} else {
|
||||
//
|
||||
// We managed to allocate the page at zero. SVN r14218 guarantees that it
|
||||
@ -203,11 +213,12 @@ InstallVbeShim (
|
||||
VbeInfo->Capabilities = BIT1 | BIT0; // DAC can be switched into 8-bit mode
|
||||
|
||||
VbeInfo->ModeListAddress = (UINT32)SegmentC << 12 | (UINT16)((UINTN)Ptr-SegmentC);
|
||||
for (i = 0; i < NUM_VBE_MODES; i ++) {
|
||||
*(UINT16*)Ptr = vbeModeIds[i]; // mode number
|
||||
for (i = 0; i < NUM_VBE_MODES; i++) {
|
||||
*(UINT16 *)Ptr = vbeModeIds[i]; // mode number
|
||||
Ptr += 2;
|
||||
}
|
||||
*(UINT16*)Ptr = 0xFFFF; // mode list terminator
|
||||
|
||||
*(UINT16 *)Ptr = 0xFFFF; // mode list terminator
|
||||
Ptr += 2;
|
||||
|
||||
VbeInfo->VideoMem64K = (UINT16)((1024 * 768 * 4 + 65535) / 65536);
|
||||
@ -218,9 +229,12 @@ InstallVbeShim (
|
||||
Ptr += 5;
|
||||
|
||||
VbeInfo->ProductNameAddress = (UINT32)SegmentC << 12 | (UINT16)((UINTN)Ptr-SegmentC);
|
||||
Printed = AsciiSPrint ((CHAR8 *)Ptr,
|
||||
sizeof VbeInfoFull->Buffer - (Ptr - VbeInfoFull->Buffer), "%s",
|
||||
CardName);
|
||||
Printed = AsciiSPrint (
|
||||
(CHAR8 *)Ptr,
|
||||
sizeof VbeInfoFull->Buffer - (Ptr - VbeInfoFull->Buffer),
|
||||
"%s",
|
||||
CardName
|
||||
);
|
||||
Ptr += Printed + 1;
|
||||
|
||||
VbeInfo->ProductRevAddress = (UINT32)SegmentC << 12 | (UINT16)((UINTN)Ptr-SegmentC);
|
||||
@ -251,9 +265,14 @@ InstallVbeShim (
|
||||
//
|
||||
// Second, point the Int10h vector at the shim.
|
||||
//
|
||||
Int0x10->Segment = (UINT16) ((UINT32)SegmentC >> 4);
|
||||
Int0x10->Offset = (UINT16) ((UINTN) (VbeModeInfo + 1) - SegmentC);
|
||||
Int0x10->Segment = (UINT16)((UINT32)SegmentC >> 4);
|
||||
Int0x10->Offset = (UINT16)((UINTN)(VbeModeInfo + 1) - SegmentC);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: VBE shim installed to %x:%x\n",
|
||||
__FUNCTION__, Int0x10->Segment, Int0x10->Offset));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: VBE shim installed to %x:%x\n",
|
||||
__FUNCTION__,
|
||||
Int0x10->Segment,
|
||||
Int0x10->Offset
|
||||
));
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
//
|
||||
// THIS FILE WAS GENERATED BY "VbeShim.sh". DO NOT EDIT.
|
||||
//
|
||||
|
||||
#ifndef _VBE_SHIM_H_
|
||||
#define _VBE_SHIM_H_
|
||||
STATIC CONST UINT8 mVbeShim[] = {
|
||||
@ -516,397 +517,397 @@ STATIC CONST UINT8 mVbeShim[] = {
|
||||
/* 000001FD nop */ 0x90,
|
||||
/* 000001FE nop */ 0x90,
|
||||
/* 000001FF nop */ 0x90,
|
||||
/* 00000200 cmp ax,0x4f00 */ 0x3D, 0x00, 0x4F,
|
||||
/* 00000203 jz 0x237 */ 0x74, 0x32,
|
||||
/* 00000205 cmp ax,0x4f01 */ 0x3D, 0x01, 0x4F,
|
||||
/* 00000208 jz 0x257 */ 0x74, 0x4D,
|
||||
/* 0000020A cmp ax,0x4f02 */ 0x3D, 0x02, 0x4F,
|
||||
/* 0000020D jz word 0x2c8 */ 0x0F, 0x84, 0xB7, 0x00,
|
||||
/* 00000211 cmp ax,0x4f03 */ 0x3D, 0x03, 0x4F,
|
||||
/* 00000214 jz word 0x325 */ 0x0F, 0x84, 0x0D, 0x01,
|
||||
/* 00000218 cmp ax,0x4f10 */ 0x3D, 0x10, 0x4F,
|
||||
/* 0000021B jz word 0x337 */ 0x0F, 0x84, 0x18, 0x01,
|
||||
/* 0000021F cmp ax,0x4f15 */ 0x3D, 0x15, 0x4F,
|
||||
/* 00000222 jz word 0x344 */ 0x0F, 0x84, 0x1E, 0x01,
|
||||
/* 00000226 cmp ah,0x0 */ 0x80, 0xFC, 0x00,
|
||||
/* 00000229 jz word 0x363 */ 0x0F, 0x84, 0x36, 0x01,
|
||||
/* 00000200 cmp ax,0x4f00 */ 0x3D,0x00, 0x4F,
|
||||
/* 00000203 jz 0x237 */ 0x74,0x32,
|
||||
/* 00000205 cmp ax,0x4f01 */ 0x3D,0x01, 0x4F,
|
||||
/* 00000208 jz 0x257 */ 0x74,0x4D,
|
||||
/* 0000020A cmp ax,0x4f02 */ 0x3D,0x02, 0x4F,
|
||||
/* 0000020D jz word 0x2c8 */ 0x0F,0x84, 0xB7,0x00,
|
||||
/* 00000211 cmp ax,0x4f03 */ 0x3D,0x03, 0x4F,
|
||||
/* 00000214 jz word 0x325 */ 0x0F,0x84, 0x0D,0x01,
|
||||
/* 00000218 cmp ax,0x4f10 */ 0x3D,0x10, 0x4F,
|
||||
/* 0000021B jz word 0x337 */ 0x0F,0x84, 0x18,0x01,
|
||||
/* 0000021F cmp ax,0x4f15 */ 0x3D,0x15, 0x4F,
|
||||
/* 00000222 jz word 0x344 */ 0x0F,0x84, 0x1E,0x01,
|
||||
/* 00000226 cmp ah,0x0 */ 0x80,0xFC, 0x00,
|
||||
/* 00000229 jz word 0x363 */ 0x0F,0x84, 0x36,0x01,
|
||||
/* 0000022D push si */ 0x56,
|
||||
/* 0000022E mov si,0x3d7 */ 0xBE, 0xD7, 0x03,
|
||||
/* 00000231 call word 0x3ad */ 0xE8, 0x79, 0x01,
|
||||
/* 0000022E mov si,0x3d7 */ 0xBE,0xD7, 0x03,
|
||||
/* 00000231 call word 0x3ad */ 0xE8,0x79, 0x01,
|
||||
/* 00000234 pop si */ 0x5E,
|
||||
/* 00000235 jmp short 0x235 */ 0xEB, 0xFE,
|
||||
/* 00000235 jmp short 0x235 */ 0xEB,0xFE,
|
||||
/* 00000237 push es */ 0x06,
|
||||
/* 00000238 push di */ 0x57,
|
||||
/* 00000239 push ds */ 0x1E,
|
||||
/* 0000023A push si */ 0x56,
|
||||
/* 0000023B push cx */ 0x51,
|
||||
/* 0000023C push si */ 0x56,
|
||||
/* 0000023D mov si,0x3eb */ 0xBE, 0xEB, 0x03,
|
||||
/* 00000240 call word 0x3ad */ 0xE8, 0x6A, 0x01,
|
||||
/* 0000023D mov si,0x3eb */ 0xBE,0xEB, 0x03,
|
||||
/* 00000240 call word 0x3ad */ 0xE8,0x6A, 0x01,
|
||||
/* 00000243 pop si */ 0x5E,
|
||||
/* 00000244 push cs */ 0x0E,
|
||||
/* 00000245 pop ds */ 0x1F,
|
||||
/* 00000246 mov si,0x0 */ 0xBE, 0x00, 0x00,
|
||||
/* 00000249 mov cx,0x100 */ 0xB9, 0x00, 0x01,
|
||||
/* 00000246 mov si,0x0 */ 0xBE,0x00, 0x00,
|
||||
/* 00000249 mov cx,0x100 */ 0xB9,0x00, 0x01,
|
||||
/* 0000024C cld */ 0xFC,
|
||||
/* 0000024D rep movsb */ 0xF3, 0xA4,
|
||||
/* 0000024D rep movsb */ 0xF3,0xA4,
|
||||
/* 0000024F pop cx */ 0x59,
|
||||
/* 00000250 pop si */ 0x5E,
|
||||
/* 00000251 pop ds */ 0x1F,
|
||||
/* 00000252 pop di */ 0x5F,
|
||||
/* 00000253 pop es */ 0x07,
|
||||
/* 00000254 jmp word 0x395 */ 0xE9, 0x3E, 0x01,
|
||||
/* 00000254 jmp word 0x395 */ 0xE9,0x3E, 0x01,
|
||||
/* 00000257 push es */ 0x06,
|
||||
/* 00000258 push di */ 0x57,
|
||||
/* 00000259 push ds */ 0x1E,
|
||||
/* 0000025A push si */ 0x56,
|
||||
/* 0000025B push cx */ 0x51,
|
||||
/* 0000025C push si */ 0x56,
|
||||
/* 0000025D mov si,0x3f6 */ 0xBE, 0xF6, 0x03,
|
||||
/* 00000260 call word 0x3ad */ 0xE8, 0x4A, 0x01,
|
||||
/* 0000025D mov si,0x3f6 */ 0xBE,0xF6, 0x03,
|
||||
/* 00000260 call word 0x3ad */ 0xE8,0x4A, 0x01,
|
||||
/* 00000263 pop si */ 0x5E,
|
||||
/* 00000264 and cx,0xbfff */ 0x81, 0xE1, 0xFF, 0xBF,
|
||||
/* 00000268 cmp cx,0x13f */ 0x81, 0xF9, 0x3F, 0x01,
|
||||
/* 0000026C jz 0x284 */ 0x74, 0x16,
|
||||
/* 0000026E cmp cx,0x140 */ 0x81, 0xF9, 0x40, 0x01,
|
||||
/* 00000272 jz 0x291 */ 0x74, 0x1D,
|
||||
/* 00000274 cmp cx,0x141 */ 0x81, 0xF9, 0x41, 0x01,
|
||||
/* 00000278 jz 0x29e */ 0x74, 0x24,
|
||||
/* 00000264 and cx,0xbfff */ 0x81,0xE1, 0xFF,0xBF,
|
||||
/* 00000268 cmp cx,0x13f */ 0x81,0xF9, 0x3F,0x01,
|
||||
/* 0000026C jz 0x284 */ 0x74,0x16,
|
||||
/* 0000026E cmp cx,0x140 */ 0x81,0xF9, 0x40,0x01,
|
||||
/* 00000272 jz 0x291 */ 0x74,0x1D,
|
||||
/* 00000274 cmp cx,0x141 */ 0x81,0xF9, 0x41,0x01,
|
||||
/* 00000278 jz 0x29e */ 0x74,0x24,
|
||||
/* 0000027A push si */ 0x56,
|
||||
/* 0000027B mov si,0x42c */ 0xBE, 0x2C, 0x04,
|
||||
/* 0000027E call word 0x3ad */ 0xE8, 0x2C, 0x01,
|
||||
/* 0000027B mov si,0x42c */ 0xBE,0x2C, 0x04,
|
||||
/* 0000027E call word 0x3ad */ 0xE8,0x2C, 0x01,
|
||||
/* 00000281 pop si */ 0x5E,
|
||||
/* 00000282 jmp short 0x235 */ 0xEB, 0xB1,
|
||||
/* 00000282 jmp short 0x235 */ 0xEB,0xB1,
|
||||
/* 00000284 push si */ 0x56,
|
||||
/* 00000285 mov si,0x46b */ 0xBE, 0x6B, 0x04,
|
||||
/* 00000288 call word 0x3ad */ 0xE8, 0x22, 0x01,
|
||||
/* 00000285 mov si,0x46b */ 0xBE,0x6B, 0x04,
|
||||
/* 00000288 call word 0x3ad */ 0xE8,0x22, 0x01,
|
||||
/* 0000028B pop si */ 0x5E,
|
||||
/* 0000028C mov si,0x100 */ 0xBE, 0x00, 0x01,
|
||||
/* 0000028F jmp short 0x2b8 */ 0xEB, 0x27,
|
||||
/* 0000028C mov si,0x100 */ 0xBE,0x00, 0x01,
|
||||
/* 0000028F jmp short 0x2b8 */ 0xEB,0x27,
|
||||
/* 00000291 push si */ 0x56,
|
||||
/* 00000292 mov si,0x47d */ 0xBE, 0x7D, 0x04,
|
||||
/* 00000295 call word 0x3ad */ 0xE8, 0x15, 0x01,
|
||||
/* 00000292 mov si,0x47d */ 0xBE,0x7D, 0x04,
|
||||
/* 00000295 call word 0x3ad */ 0xE8,0x15, 0x01,
|
||||
/* 00000298 pop si */ 0x5E,
|
||||
/* 00000299 mov si,0x132 */ 0xBE, 0x32, 0x01,
|
||||
/* 0000029C jmp short 0x2b8 */ 0xEB, 0x1A,
|
||||
/* 00000299 mov si,0x132 */ 0xBE,0x32, 0x01,
|
||||
/* 0000029C jmp short 0x2b8 */ 0xEB,0x1A,
|
||||
/* 0000029E push si */ 0x56,
|
||||
/* 0000029F mov si,0x48f */ 0xBE, 0x8F, 0x04,
|
||||
/* 000002A2 call word 0x3ad */ 0xE8, 0x08, 0x01,
|
||||
/* 0000029F mov si,0x48f */ 0xBE,0x8F, 0x04,
|
||||
/* 000002A2 call word 0x3ad */ 0xE8,0x08, 0x01,
|
||||
/* 000002A5 pop si */ 0x5E,
|
||||
/* 000002A6 mov si,0x164 */ 0xBE, 0x64, 0x01,
|
||||
/* 000002A9 jmp short 0x2b8 */ 0xEB, 0x0D,
|
||||
/* 000002A6 mov si,0x164 */ 0xBE,0x64, 0x01,
|
||||
/* 000002A9 jmp short 0x2b8 */ 0xEB,0x0D,
|
||||
/* 000002AB push si */ 0x56,
|
||||
/* 000002AC mov si,0x4a2 */ 0xBE, 0xA2, 0x04,
|
||||
/* 000002AF call word 0x3ad */ 0xE8, 0xFB, 0x00,
|
||||
/* 000002AC mov si,0x4a2 */ 0xBE,0xA2, 0x04,
|
||||
/* 000002AF call word 0x3ad */ 0xE8,0xFB, 0x00,
|
||||
/* 000002B2 pop si */ 0x5E,
|
||||
/* 000002B3 mov si,0x196 */ 0xBE, 0x96, 0x01,
|
||||
/* 000002B6 jmp short 0x2b8 */ 0xEB, 0x00,
|
||||
/* 000002B3 mov si,0x196 */ 0xBE,0x96, 0x01,
|
||||
/* 000002B6 jmp short 0x2b8 */ 0xEB,0x00,
|
||||
/* 000002B8 push cs */ 0x0E,
|
||||
/* 000002B9 pop ds */ 0x1F,
|
||||
/* 000002BA mov cx,0x32 */ 0xB9, 0x32, 0x00,
|
||||
/* 000002BA mov cx,0x32 */ 0xB9,0x32, 0x00,
|
||||
/* 000002BD cld */ 0xFC,
|
||||
/* 000002BE rep movsb */ 0xF3, 0xA4,
|
||||
/* 000002BE rep movsb */ 0xF3,0xA4,
|
||||
/* 000002C0 pop cx */ 0x59,
|
||||
/* 000002C1 pop si */ 0x5E,
|
||||
/* 000002C2 pop ds */ 0x1F,
|
||||
/* 000002C3 pop di */ 0x5F,
|
||||
/* 000002C4 pop es */ 0x07,
|
||||
/* 000002C5 jmp word 0x395 */ 0xE9, 0xCD, 0x00,
|
||||
/* 000002C5 jmp word 0x395 */ 0xE9,0xCD, 0x00,
|
||||
/* 000002C8 push dx */ 0x52,
|
||||
/* 000002C9 push ax */ 0x50,
|
||||
/* 000002CA push si */ 0x56,
|
||||
/* 000002CB mov si,0x410 */ 0xBE, 0x10, 0x04,
|
||||
/* 000002CE call word 0x3ad */ 0xE8, 0xDC, 0x00,
|
||||
/* 000002CB mov si,0x410 */ 0xBE,0x10, 0x04,
|
||||
/* 000002CE call word 0x3ad */ 0xE8,0xDC, 0x00,
|
||||
/* 000002D1 pop si */ 0x5E,
|
||||
/* 000002D2 and bx,0xbfff */ 0x81, 0xE3, 0xFF, 0xBF,
|
||||
/* 000002D6 cmp bx,0x13f */ 0x81, 0xFB, 0x3F, 0x01,
|
||||
/* 000002DA jz 0x2f3 */ 0x74, 0x17,
|
||||
/* 000002DC cmp bx,0x140 */ 0x81, 0xFB, 0x40, 0x01,
|
||||
/* 000002E0 jz 0x2fd */ 0x74, 0x1B,
|
||||
/* 000002E2 cmp bx,0x141 */ 0x81, 0xFB, 0x41, 0x01,
|
||||
/* 000002E6 jz 0x307 */ 0x74, 0x1F,
|
||||
/* 000002D2 and bx,0xbfff */ 0x81,0xE3, 0xFF,0xBF,
|
||||
/* 000002D6 cmp bx,0x13f */ 0x81,0xFB, 0x3F,0x01,
|
||||
/* 000002DA jz 0x2f3 */ 0x74,0x17,
|
||||
/* 000002DC cmp bx,0x140 */ 0x81,0xFB, 0x40,0x01,
|
||||
/* 000002E0 jz 0x2fd */ 0x74,0x1B,
|
||||
/* 000002E2 cmp bx,0x141 */ 0x81,0xFB, 0x41,0x01,
|
||||
/* 000002E6 jz 0x307 */ 0x74,0x1F,
|
||||
/* 000002E8 push si */ 0x56,
|
||||
/* 000002E9 mov si,0x42c */ 0xBE, 0x2C, 0x04,
|
||||
/* 000002EC call word 0x3ad */ 0xE8, 0xBE, 0x00,
|
||||
/* 000002E9 mov si,0x42c */ 0xBE,0x2C, 0x04,
|
||||
/* 000002EC call word 0x3ad */ 0xE8,0xBE, 0x00,
|
||||
/* 000002EF pop si */ 0x5E,
|
||||
/* 000002F0 jmp word 0x235 */ 0xE9, 0x42, 0xFF,
|
||||
/* 000002F0 jmp word 0x235 */ 0xE9,0x42, 0xFF,
|
||||
/* 000002F3 push si */ 0x56,
|
||||
/* 000002F4 mov si,0x46b */ 0xBE, 0x6B, 0x04,
|
||||
/* 000002F7 call word 0x3ad */ 0xE8, 0xB3, 0x00,
|
||||
/* 000002F4 mov si,0x46b */ 0xBE,0x6B, 0x04,
|
||||
/* 000002F7 call word 0x3ad */ 0xE8,0xB3, 0x00,
|
||||
/* 000002FA pop si */ 0x5E,
|
||||
/* 000002FB jmp short 0x319 */ 0xEB, 0x1C,
|
||||
/* 000002FB jmp short 0x319 */ 0xEB,0x1C,
|
||||
/* 000002FD push si */ 0x56,
|
||||
/* 000002FE mov si,0x47d */ 0xBE, 0x7D, 0x04,
|
||||
/* 00000301 call word 0x3ad */ 0xE8, 0xA9, 0x00,
|
||||
/* 000002FE mov si,0x47d */ 0xBE,0x7D, 0x04,
|
||||
/* 00000301 call word 0x3ad */ 0xE8,0xA9, 0x00,
|
||||
/* 00000304 pop si */ 0x5E,
|
||||
/* 00000305 jmp short 0x319 */ 0xEB, 0x12,
|
||||
/* 00000305 jmp short 0x319 */ 0xEB,0x12,
|
||||
/* 00000307 push si */ 0x56,
|
||||
/* 00000308 mov si,0x48f */ 0xBE, 0x8F, 0x04,
|
||||
/* 0000030B call word 0x3ad */ 0xE8, 0x9F, 0x00,
|
||||
/* 00000308 mov si,0x48f */ 0xBE,0x8F, 0x04,
|
||||
/* 0000030B call word 0x3ad */ 0xE8,0x9F, 0x00,
|
||||
/* 0000030E pop si */ 0x5E,
|
||||
/* 0000030F jmp short 0x319 */ 0xEB, 0x08,
|
||||
/* 0000030F jmp short 0x319 */ 0xEB,0x08,
|
||||
/* 00000311 push si */ 0x56,
|
||||
/* 00000312 mov si,0x4a2 */ 0xBE, 0xA2, 0x04,
|
||||
/* 00000315 call word 0x3ad */ 0xE8, 0x95, 0x00,
|
||||
/* 00000312 mov si,0x4a2 */ 0xBE,0xA2, 0x04,
|
||||
/* 00000315 call word 0x3ad */ 0xE8,0x95, 0x00,
|
||||
/* 00000318 pop si */ 0x5E,
|
||||
/* 00000319 mov [0x4b0],bl */ 0x88, 0x1E, 0xB0, 0x04,
|
||||
/* 0000031D mov [0x4b1],bh */ 0x88, 0x3E, 0xB1, 0x04,
|
||||
/* 00000319 mov [0x4b0],bl */ 0x88,0x1E, 0xB0,0x04,
|
||||
/* 0000031D mov [0x4b1],bh */ 0x88,0x3E, 0xB1,0x04,
|
||||
/* 00000321 pop ax */ 0x58,
|
||||
/* 00000322 pop dx */ 0x5A,
|
||||
/* 00000323 jmp short 0x395 */ 0xEB, 0x70,
|
||||
/* 00000323 jmp short 0x395 */ 0xEB,0x70,
|
||||
/* 00000325 push si */ 0x56,
|
||||
/* 00000326 mov si,0x405 */ 0xBE, 0x05, 0x04,
|
||||
/* 00000329 call word 0x3ad */ 0xE8, 0x81, 0x00,
|
||||
/* 00000326 mov si,0x405 */ 0xBE,0x05, 0x04,
|
||||
/* 00000329 call word 0x3ad */ 0xE8,0x81, 0x00,
|
||||
/* 0000032C pop si */ 0x5E,
|
||||
/* 0000032D mov bl,[0x4b0] */ 0x8A, 0x1E, 0xB0, 0x04,
|
||||
/* 00000331 mov bh,[0x4b1] */ 0x8A, 0x3E, 0xB1, 0x04,
|
||||
/* 00000335 jmp short 0x395 */ 0xEB, 0x5E,
|
||||
/* 0000032D mov bl,[0x4b0] */ 0x8A,0x1E, 0xB0,0x04,
|
||||
/* 00000331 mov bh,[0x4b1] */ 0x8A,0x3E, 0xB1,0x04,
|
||||
/* 00000335 jmp short 0x395 */ 0xEB,0x5E,
|
||||
/* 00000337 push si */ 0x56,
|
||||
/* 00000338 mov si,0x43b */ 0xBE, 0x3B, 0x04,
|
||||
/* 0000033B call word 0x3ad */ 0xE8, 0x6F, 0x00,
|
||||
/* 00000338 mov si,0x43b */ 0xBE,0x3B, 0x04,
|
||||
/* 0000033B call word 0x3ad */ 0xE8,0x6F, 0x00,
|
||||
/* 0000033E pop si */ 0x5E,
|
||||
/* 0000033F mov bx,0x80 */ 0xBB, 0x80, 0x00,
|
||||
/* 00000342 jmp short 0x395 */ 0xEB, 0x51,
|
||||
/* 0000033F mov bx,0x80 */ 0xBB,0x80, 0x00,
|
||||
/* 00000342 jmp short 0x395 */ 0xEB,0x51,
|
||||
/* 00000344 push es */ 0x06,
|
||||
/* 00000345 push di */ 0x57,
|
||||
/* 00000346 push ds */ 0x1E,
|
||||
/* 00000347 push si */ 0x56,
|
||||
/* 00000348 push cx */ 0x51,
|
||||
/* 00000349 push si */ 0x56,
|
||||
/* 0000034A mov si,0x450 */ 0xBE, 0x50, 0x04,
|
||||
/* 0000034D call word 0x3ad */ 0xE8, 0x5D, 0x00,
|
||||
/* 0000034A mov si,0x450 */ 0xBE,0x50, 0x04,
|
||||
/* 0000034D call word 0x3ad */ 0xE8,0x5D, 0x00,
|
||||
/* 00000350 pop si */ 0x5E,
|
||||
/* 00000351 push cs */ 0x0E,
|
||||
/* 00000352 pop ds */ 0x1F,
|
||||
/* 00000353 mov si,0x4b2 */ 0xBE, 0xB2, 0x04,
|
||||
/* 00000356 mov cx,0x80 */ 0xB9, 0x80, 0x00,
|
||||
/* 00000353 mov si,0x4b2 */ 0xBE,0xB2, 0x04,
|
||||
/* 00000356 mov cx,0x80 */ 0xB9,0x80, 0x00,
|
||||
/* 00000359 cld */ 0xFC,
|
||||
/* 0000035A rep movsb */ 0xF3, 0xA4,
|
||||
/* 0000035A rep movsb */ 0xF3,0xA4,
|
||||
/* 0000035C pop cx */ 0x59,
|
||||
/* 0000035D pop si */ 0x5E,
|
||||
/* 0000035E pop ds */ 0x1F,
|
||||
/* 0000035F pop di */ 0x5F,
|
||||
/* 00000360 pop es */ 0x07,
|
||||
/* 00000361 jmp short 0x395 */ 0xEB, 0x32,
|
||||
/* 00000361 jmp short 0x395 */ 0xEB,0x32,
|
||||
/* 00000363 push si */ 0x56,
|
||||
/* 00000364 mov si,0x41b */ 0xBE, 0x1B, 0x04,
|
||||
/* 00000367 call word 0x3ad */ 0xE8, 0x43, 0x00,
|
||||
/* 00000364 mov si,0x41b */ 0xBE,0x1B, 0x04,
|
||||
/* 00000367 call word 0x3ad */ 0xE8,0x43, 0x00,
|
||||
/* 0000036A pop si */ 0x5E,
|
||||
/* 0000036B cmp al,0x3 */ 0x3C, 0x03,
|
||||
/* 0000036D jz 0x37e */ 0x74, 0x0F,
|
||||
/* 0000036F cmp al,0x12 */ 0x3C, 0x12,
|
||||
/* 00000371 jz 0x38a */ 0x74, 0x17,
|
||||
/* 0000036B cmp al,0x3 */ 0x3C,0x03,
|
||||
/* 0000036D jz 0x37e */ 0x74,0x0F,
|
||||
/* 0000036F cmp al,0x12 */ 0x3C,0x12,
|
||||
/* 00000371 jz 0x38a */ 0x74,0x17,
|
||||
/* 00000373 push si */ 0x56,
|
||||
/* 00000374 mov si,0x42c */ 0xBE, 0x2C, 0x04,
|
||||
/* 00000377 call word 0x3ad */ 0xE8, 0x33, 0x00,
|
||||
/* 00000374 mov si,0x42c */ 0xBE,0x2C, 0x04,
|
||||
/* 00000377 call word 0x3ad */ 0xE8,0x33, 0x00,
|
||||
/* 0000037A pop si */ 0x5E,
|
||||
/* 0000037B jmp word 0x235 */ 0xE9, 0xB7, 0xFE,
|
||||
/* 0000037B jmp word 0x235 */ 0xE9,0xB7, 0xFE,
|
||||
/* 0000037E push si */ 0x56,
|
||||
/* 0000037F mov si,0x45c */ 0xBE, 0x5C, 0x04,
|
||||
/* 00000382 call word 0x3ad */ 0xE8, 0x28, 0x00,
|
||||
/* 0000037F mov si,0x45c */ 0xBE,0x5C, 0x04,
|
||||
/* 00000382 call word 0x3ad */ 0xE8,0x28, 0x00,
|
||||
/* 00000385 pop si */ 0x5E,
|
||||
/* 00000386 mov al,0x0 */ 0xB0, 0x00,
|
||||
/* 00000388 jmp short 0x38c */ 0xEB, 0x02,
|
||||
/* 0000038A mov al,0x0 */ 0xB0, 0x00,
|
||||
/* 00000386 mov al,0x0 */ 0xB0,0x00,
|
||||
/* 00000388 jmp short 0x38c */ 0xEB,0x02,
|
||||
/* 0000038A mov al,0x0 */ 0xB0,0x00,
|
||||
/* 0000038C push si */ 0x56,
|
||||
/* 0000038D mov si,0x3c2 */ 0xBE, 0xC2, 0x03,
|
||||
/* 00000390 call word 0x3ad */ 0xE8, 0x1A, 0x00,
|
||||
/* 0000038D mov si,0x3c2 */ 0xBE,0xC2, 0x03,
|
||||
/* 00000390 call word 0x3ad */ 0xE8,0x1A, 0x00,
|
||||
/* 00000393 pop si */ 0x5E,
|
||||
/* 00000394 iretw */ 0xCF,
|
||||
/* 00000395 push si */ 0x56,
|
||||
/* 00000396 mov si,0x3c2 */ 0xBE, 0xC2, 0x03,
|
||||
/* 00000399 call word 0x3ad */ 0xE8, 0x11, 0x00,
|
||||
/* 00000396 mov si,0x3c2 */ 0xBE,0xC2, 0x03,
|
||||
/* 00000399 call word 0x3ad */ 0xE8,0x11, 0x00,
|
||||
/* 0000039C pop si */ 0x5E,
|
||||
/* 0000039D mov ax,0x4f */ 0xB8, 0x4F, 0x00,
|
||||
/* 0000039D mov ax,0x4f */ 0xB8,0x4F, 0x00,
|
||||
/* 000003A0 iretw */ 0xCF,
|
||||
/* 000003A1 push si */ 0x56,
|
||||
/* 000003A2 mov si,0x3c8 */ 0xBE, 0xC8, 0x03,
|
||||
/* 000003A5 call word 0x3ad */ 0xE8, 0x05, 0x00,
|
||||
/* 000003A2 mov si,0x3c8 */ 0xBE,0xC8, 0x03,
|
||||
/* 000003A5 call word 0x3ad */ 0xE8,0x05, 0x00,
|
||||
/* 000003A8 pop si */ 0x5E,
|
||||
/* 000003A9 mov ax,0x24f */ 0xB8, 0x4F, 0x02,
|
||||
/* 000003A9 mov ax,0x24f */ 0xB8,0x4F, 0x02,
|
||||
/* 000003AC iretw */ 0xCF,
|
||||
/* 000003AD pushaw */ 0x60,
|
||||
/* 000003AE push ds */ 0x1E,
|
||||
/* 000003AF push cs */ 0x0E,
|
||||
/* 000003B0 pop ds */ 0x1F,
|
||||
/* 000003B1 mov dx,0x220 */ 0xBA, 0x20, 0x02,
|
||||
/* 000003B4 mov ax,0x0 */ 0xB8, 0x00, 0x00,
|
||||
/* 000003B1 mov dx,0x220 */ 0xBA,0x20, 0x02,
|
||||
/* 000003B4 mov ax,0x0 */ 0xB8,0x00, 0x00,
|
||||
/* 000003B7 lodsb */ 0xAC,
|
||||
/* 000003B8 cmp al,0x0 */ 0x3C, 0x00,
|
||||
/* 000003BA jz 0x3bf */ 0x74, 0x03,
|
||||
/* 000003B8 cmp al,0x0 */ 0x3C,0x00,
|
||||
/* 000003BA jz 0x3bf */ 0x74,0x03,
|
||||
/* 000003BC out dx,al */ 0xEE,
|
||||
/* 000003BD jmp short 0x3b7 */ 0xEB, 0xF8,
|
||||
/* 000003BD jmp short 0x3b7 */ 0xEB,0xF8,
|
||||
/* 000003BF pop ds */ 0x1F,
|
||||
/* 000003C0 popaw */ 0x61,
|
||||
/* 000003C1 ret */ 0xC3,
|
||||
/* 000003C2 jna 0x413 */ 0x76, 0x4F,
|
||||
/* 000003C4 imul cx,[di],byte +0xa */ 0x6B, 0x0D, 0x0A,
|
||||
/* 000003C7 add [bp+0x55],dh */ 0x00, 0x76, 0x55,
|
||||
/* 000003C2 jna 0x413 */ 0x76,0x4F,
|
||||
/* 000003C4 imul cx,[di],byte +0xa */ 0x6B,0x0D, 0x0A,
|
||||
/* 000003C7 add [bp+0x55],dh */ 0x00,0x76, 0x55,
|
||||
/* 000003CA outsb */ 0x6E,
|
||||
/* 000003CB jnc 0x442 */ 0x73, 0x75,
|
||||
/* 000003CD jo 0x43f */ 0x70, 0x70,
|
||||
/* 000003CB jnc 0x442 */ 0x73,0x75,
|
||||
/* 000003CD jo 0x43f */ 0x70,0x70,
|
||||
/* 000003CF outsw */ 0x6F,
|
||||
/* 000003D0 jc 0x446 */ 0x72, 0x74,
|
||||
/* 000003D2 fs or ax,0xa */ 0x65, 0x64, 0x0D, 0x0A, 0x00,
|
||||
/* 000003D7 jna 0x42e */ 0x76, 0x55,
|
||||
/* 000003D0 jc 0x446 */ 0x72,0x74,
|
||||
/* 000003D2 fs or ax,0xa */ 0x65,0x64, 0x0D,0x0A, 0x00,
|
||||
/* 000003D7 jna 0x42e */ 0x76,0x55,
|
||||
/* 000003D9 outsb */ 0x6E,
|
||||
/* 000003DA imul bp,[bp+0x6f],byte +0x77 */ 0x6B, 0x6E, 0x6F, 0x77,
|
||||
/* 000003DA imul bp,[bp+0x6f],byte +0x77 */ 0x6B,0x6E, 0x6F,0x77,
|
||||
/* 000003DE outsb */ 0x6E,
|
||||
/* 000003DF and [bp+0x75],al */ 0x20, 0x46, 0x75,
|
||||
/* 000003DF and [bp+0x75],al */ 0x20,0x46, 0x75,
|
||||
/* 000003E2 outsb */ 0x6E,
|
||||
/* 000003E3 arpl [si+0x69],si */ 0x63, 0x74, 0x69,
|
||||
/* 000003E3 arpl [si+0x69],si */ 0x63,0x74, 0x69,
|
||||
/* 000003E6 outsw */ 0x6F,
|
||||
/* 000003E7 outsb */ 0x6E,
|
||||
/* 000003E8 or ax,0xa */ 0x0D, 0x0A, 0x00,
|
||||
/* 000003EB jna 0x434 */ 0x76, 0x47,
|
||||
/* 000003ED gs jz 0x439 */ 0x65, 0x74, 0x49,
|
||||
/* 000003E8 or ax,0xa */ 0x0D,0x0A, 0x00,
|
||||
/* 000003EB jna 0x434 */ 0x76,0x47,
|
||||
/* 000003ED gs jz 0x439 */ 0x65,0x74, 0x49,
|
||||
/* 000003F0 outsb */ 0x6E,
|
||||
/* 000003F1 outsd */ 0x66, 0x6F,
|
||||
/* 000003F3 or ax,0xa */ 0x0D, 0x0A, 0x00,
|
||||
/* 000003F6 jna 0x43f */ 0x76, 0x47,
|
||||
/* 000003F8 gs jz 0x448 */ 0x65, 0x74, 0x4D,
|
||||
/* 000003F1 outsd */ 0x66,0x6F,
|
||||
/* 000003F3 or ax,0xa */ 0x0D,0x0A, 0x00,
|
||||
/* 000003F6 jna 0x43f */ 0x76,0x47,
|
||||
/* 000003F8 gs jz 0x448 */ 0x65,0x74, 0x4D,
|
||||
/* 000003FB outsw */ 0x6F,
|
||||
/* 000003FC gs dec cx */ 0x64, 0x65, 0x49,
|
||||
/* 000003FC gs dec cx */ 0x64,0x65, 0x49,
|
||||
/* 000003FF outsb */ 0x6E,
|
||||
/* 00000400 outsd */ 0x66, 0x6F,
|
||||
/* 00000402 or ax,0xa */ 0x0D, 0x0A, 0x00,
|
||||
/* 00000405 jna 0x44e */ 0x76, 0x47,
|
||||
/* 00000407 gs jz 0x457 */ 0x65, 0x74, 0x4D,
|
||||
/* 00000400 outsd */ 0x66,0x6F,
|
||||
/* 00000402 or ax,0xa */ 0x0D,0x0A, 0x00,
|
||||
/* 00000405 jna 0x44e */ 0x76,0x47,
|
||||
/* 00000407 gs jz 0x457 */ 0x65,0x74, 0x4D,
|
||||
/* 0000040A outsw */ 0x6F,
|
||||
/* 0000040B gs or ax,0xa */ 0x64, 0x65, 0x0D, 0x0A, 0x00,
|
||||
/* 00000410 jna 0x465 */ 0x76, 0x53,
|
||||
/* 00000412 gs jz 0x462 */ 0x65, 0x74, 0x4D,
|
||||
/* 0000040B gs or ax,0xa */ 0x64,0x65, 0x0D,0x0A, 0x00,
|
||||
/* 00000410 jna 0x465 */ 0x76,0x53,
|
||||
/* 00000412 gs jz 0x462 */ 0x65,0x74, 0x4D,
|
||||
/* 00000415 outsw */ 0x6F,
|
||||
/* 00000416 gs or ax,0xa */ 0x64, 0x65, 0x0D, 0x0A, 0x00,
|
||||
/* 0000041B jna 0x470 */ 0x76, 0x53,
|
||||
/* 0000041D gs jz 0x46d */ 0x65, 0x74, 0x4D,
|
||||
/* 00000416 gs or ax,0xa */ 0x64,0x65, 0x0D,0x0A, 0x00,
|
||||
/* 0000041B jna 0x470 */ 0x76,0x53,
|
||||
/* 0000041D gs jz 0x46d */ 0x65,0x74, 0x4D,
|
||||
/* 00000420 outsw */ 0x6F,
|
||||
/* 00000421 gs dec sp */ 0x64, 0x65, 0x4C,
|
||||
/* 00000424 gs a32 popaw */ 0x65, 0x67, 0x61,
|
||||
/* 00000427 arpl [bx+di+0xd],di */ 0x63, 0x79, 0x0D,
|
||||
/* 0000042A or al,[bx+si] */ 0x0A, 0x00,
|
||||
/* 0000042C jna 0x483 */ 0x76, 0x55,
|
||||
/* 00000421 gs dec sp */ 0x64,0x65, 0x4C,
|
||||
/* 00000424 gs a32 popaw */ 0x65,0x67, 0x61,
|
||||
/* 00000427 arpl [bx+di+0xd],di */ 0x63,0x79, 0x0D,
|
||||
/* 0000042A or al,[bx+si] */ 0x0A,0x00,
|
||||
/* 0000042C jna 0x483 */ 0x76,0x55,
|
||||
/* 0000042E outsb */ 0x6E,
|
||||
/* 0000042F imul bp,[bx+0x77],byte +0x6e */ 0x6B, 0x6F, 0x77, 0x6E,
|
||||
/* 00000433 and [di+0x6f],cl */ 0x20, 0x4D, 0x6F,
|
||||
/* 00000436 gs or ax,0xa */ 0x64, 0x65, 0x0D, 0x0A, 0x00,
|
||||
/* 0000043B jna 0x484 */ 0x76, 0x47,
|
||||
/* 0000043D gs jz 0x490 */ 0x65, 0x74, 0x50,
|
||||
/* 0000042F imul bp,[bx+0x77],byte +0x6e */ 0x6B,0x6F, 0x77,0x6E,
|
||||
/* 00000433 and [di+0x6f],cl */ 0x20,0x4D, 0x6F,
|
||||
/* 00000436 gs or ax,0xa */ 0x64,0x65, 0x0D,0x0A, 0x00,
|
||||
/* 0000043B jna 0x484 */ 0x76,0x47,
|
||||
/* 0000043D gs jz 0x490 */ 0x65,0x74, 0x50,
|
||||
/* 00000440 insw */ 0x6D,
|
||||
/* 00000441 inc bx */ 0x43,
|
||||
/* 00000442 popaw */ 0x61,
|
||||
/* 00000443 jo 0x4a6 */ 0x70, 0x61,
|
||||
/* 00000445 bound bp,[bx+di+0x6c] */ 0x62, 0x69, 0x6C,
|
||||
/* 00000448 imul si,[si+0x69],word 0x7365 */ 0x69, 0x74, 0x69, 0x65, 0x73,
|
||||
/* 0000044D or ax,0xa */ 0x0D, 0x0A, 0x00,
|
||||
/* 00000450 jna 0x4a4 */ 0x76, 0x52,
|
||||
/* 00000452 gs popaw */ 0x65, 0x61,
|
||||
/* 00000454 fs inc bp */ 0x64, 0x45,
|
||||
/* 00000456 imul sp,[fs:si+0xd],word 0xa */ 0x64, 0x69, 0x64, 0x0D, 0x0A, 0x00,
|
||||
/* 0000045C jna 0x4aa */ 0x76, 0x4C,
|
||||
/* 0000045E gs a32 popaw */ 0x65, 0x67, 0x61,
|
||||
/* 00000461 arpl [bx+di+0x4d],di */ 0x63, 0x79, 0x4D,
|
||||
/* 00000443 jo 0x4a6 */ 0x70,0x61,
|
||||
/* 00000445 bound bp,[bx+di+0x6c] */ 0x62,0x69, 0x6C,
|
||||
/* 00000448 imul si,[si+0x69],word 0x7365 */ 0x69,0x74, 0x69,0x65, 0x73,
|
||||
/* 0000044D or ax,0xa */ 0x0D,0x0A, 0x00,
|
||||
/* 00000450 jna 0x4a4 */ 0x76,0x52,
|
||||
/* 00000452 gs popaw */ 0x65,0x61,
|
||||
/* 00000454 fs inc bp */ 0x64,0x45,
|
||||
/* 00000456 imul sp,[fs:si+0xd],word 0xa */ 0x64,0x69, 0x64,0x0D, 0x0A, 0x00,
|
||||
/* 0000045C jna 0x4aa */ 0x76,0x4C,
|
||||
/* 0000045E gs a32 popaw */ 0x65,0x67, 0x61,
|
||||
/* 00000461 arpl [bx+di+0x4d],di */ 0x63,0x79, 0x4D,
|
||||
/* 00000464 outsw */ 0x6F,
|
||||
/* 00000465 xor cx,[gs:di] */ 0x64, 0x65, 0x33, 0x0D,
|
||||
/* 00000469 or al,[bx+si] */ 0x0A, 0x00,
|
||||
/* 00000465 xor cx,[gs:di] */ 0x64,0x65, 0x33,0x0D,
|
||||
/* 00000469 or al,[bx+si] */ 0x0A,0x00,
|
||||
/* 0000046B insw */ 0x6D,
|
||||
/* 0000046C outsw */ 0x6F,
|
||||
/* 0000046D gs pop di */ 0x64, 0x65, 0x5F,
|
||||
/* 00000470 ss xor al,0x30 */ 0x36, 0x34, 0x30,
|
||||
/* 00000473 js 0x4a9 */ 0x78, 0x34,
|
||||
/* 00000475 cmp [bx+si],dh */ 0x38, 0x30,
|
||||
/* 00000477 js 0x4ac */ 0x78, 0x33,
|
||||
/* 00000479 xor cl,[di] */ 0x32, 0x0D,
|
||||
/* 0000047B or al,[bx+si] */ 0x0A, 0x00,
|
||||
/* 0000046D gs pop di */ 0x64,0x65, 0x5F,
|
||||
/* 00000470 ss xor al,0x30 */ 0x36,0x34, 0x30,
|
||||
/* 00000473 js 0x4a9 */ 0x78,0x34,
|
||||
/* 00000475 cmp [bx+si],dh */ 0x38,0x30,
|
||||
/* 00000477 js 0x4ac */ 0x78,0x33,
|
||||
/* 00000479 xor cl,[di] */ 0x32,0x0D,
|
||||
/* 0000047B or al,[bx+si] */ 0x0A,0x00,
|
||||
/* 0000047D insw */ 0x6D,
|
||||
/* 0000047E outsw */ 0x6F,
|
||||
/* 0000047F gs pop di */ 0x64, 0x65, 0x5F,
|
||||
/* 00000482 cmp [bx+si],dh */ 0x38, 0x30,
|
||||
/* 00000484 xor [bx+si+0x36],bh */ 0x30, 0x78, 0x36,
|
||||
/* 00000487 xor [bx+si],dh */ 0x30, 0x30,
|
||||
/* 00000489 js 0x4be */ 0x78, 0x33,
|
||||
/* 0000048B xor cl,[di] */ 0x32, 0x0D,
|
||||
/* 0000048D or al,[bx+si] */ 0x0A, 0x00,
|
||||
/* 0000047F gs pop di */ 0x64,0x65, 0x5F,
|
||||
/* 00000482 cmp [bx+si],dh */ 0x38,0x30,
|
||||
/* 00000484 xor [bx+si+0x36],bh */ 0x30,0x78, 0x36,
|
||||
/* 00000487 xor [bx+si],dh */ 0x30,0x30,
|
||||
/* 00000489 js 0x4be */ 0x78,0x33,
|
||||
/* 0000048B xor cl,[di] */ 0x32,0x0D,
|
||||
/* 0000048D or al,[bx+si] */ 0x0A,0x00,
|
||||
/* 0000048F insw */ 0x6D,
|
||||
/* 00000490 outsw */ 0x6F,
|
||||
/* 00000491 gs pop di */ 0x64, 0x65, 0x5F,
|
||||
/* 00000494 xor [bx+si],si */ 0x31, 0x30,
|
||||
/* 00000496 xor dh,[si] */ 0x32, 0x34,
|
||||
/* 00000498 js 0x4d1 */ 0x78, 0x37,
|
||||
/* 0000049A cmp [ss:bx+si+0x33],bh */ 0x36, 0x38, 0x78, 0x33,
|
||||
/* 0000049E xor cl,[di] */ 0x32, 0x0D,
|
||||
/* 000004A0 or al,[bx+si] */ 0x0A, 0x00,
|
||||
/* 00000491 gs pop di */ 0x64,0x65, 0x5F,
|
||||
/* 00000494 xor [bx+si],si */ 0x31,0x30,
|
||||
/* 00000496 xor dh,[si] */ 0x32,0x34,
|
||||
/* 00000498 js 0x4d1 */ 0x78,0x37,
|
||||
/* 0000049A cmp [ss:bx+si+0x33],bh */ 0x36,0x38, 0x78,0x33,
|
||||
/* 0000049E xor cl,[di] */ 0x32,0x0D,
|
||||
/* 000004A0 or al,[bx+si] */ 0x0A,0x00,
|
||||
/* 000004A2 insw */ 0x6D,
|
||||
/* 000004A3 outsw */ 0x6F,
|
||||
/* 000004A4 gs pop di */ 0x64, 0x65, 0x5F,
|
||||
/* 000004A7 jnz 0x517 */ 0x75, 0x6E,
|
||||
/* 000004A9 jnz 0x51e */ 0x75, 0x73,
|
||||
/* 000004AB fs or ax,0xa */ 0x65, 0x64, 0x0D, 0x0A, 0x00,
|
||||
/* 000004B0 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004B2 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004B4 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004B6 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004B8 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004BA add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004BC add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004BE add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004C0 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004C2 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004C4 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004C6 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004C8 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004CA add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004CC add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004CE add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004D0 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004D2 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004D4 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004D6 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004D8 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004DA add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004DC add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004DE add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004E0 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004E2 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004E4 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004E6 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004E8 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004EA add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004EC add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004EE add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004F0 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004F2 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004F4 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004F6 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004F8 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004FA add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004FC add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004FE add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000500 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000502 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000504 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000506 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000508 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000050A add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000050C add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000050E add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000510 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000512 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000514 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000516 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000518 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000051A add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000051C add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000051E add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000520 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000522 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000524 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000526 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000528 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000052A add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000052C add [bx+si],al */ 0x00, 0x00,
|
||||
/* 0000052E add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000530 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 00000532 add [bx+si],al */ 0x00, 0x00,
|
||||
/* 000004A4 gs pop di */ 0x64,0x65, 0x5F,
|
||||
/* 000004A7 jnz 0x517 */ 0x75,0x6E,
|
||||
/* 000004A9 jnz 0x51e */ 0x75,0x73,
|
||||
/* 000004AB fs or ax,0xa */ 0x65,0x64, 0x0D,0x0A, 0x00,
|
||||
/* 000004B0 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004B2 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004B4 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004B6 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004B8 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004BA add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004BC add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004BE add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004C0 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004C2 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004C4 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004C6 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004C8 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004CA add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004CC add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004CE add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004D0 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004D2 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004D4 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004D6 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004D8 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004DA add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004DC add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004DE add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004E0 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004E2 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004E4 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004E6 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004E8 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004EA add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004EC add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004EE add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004F0 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004F2 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004F4 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004F6 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004F8 add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004FA add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004FC add [bx+si],al */ 0x00,0x00,
|
||||
/* 000004FE add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000500 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000502 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000504 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000506 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000508 add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000050A add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000050C add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000050E add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000510 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000512 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000514 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000516 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000518 add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000051A add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000051C add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000051E add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000520 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000522 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000524 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000526 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000528 add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000052A add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000052C add [bx+si],al */ 0x00,0x00,
|
||||
/* 0000052E add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000530 add [bx+si],al */ 0x00,0x00,
|
||||
/* 00000532 add [bx+si],al */ 0x00,0x00,
|
||||
};
|
||||
#endif
|
||||
|
@ -73,7 +73,7 @@ ClearCacheOnMpServicesAvailable (
|
||||
0, // TimeoutInMicroSeconds: inf.
|
||||
NULL // ProcedureArgument
|
||||
);
|
||||
if (EFI_ERROR (Status) && Status != EFI_NOT_STARTED) {
|
||||
if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status));
|
||||
return Status;
|
||||
}
|
||||
@ -105,7 +105,11 @@ InstallClearCacheCallback (
|
||||
|
||||
Status = PeiServicesNotifyPpi (&mMpServicesNotify);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: failed to set up MP Services callback: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: failed to set up MP Services callback: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "Cmos.h"
|
||||
#include "Library/IoLib.h"
|
||||
|
||||
@ -27,11 +26,10 @@ CmosRead8 (
|
||||
IN UINTN Index
|
||||
)
|
||||
{
|
||||
IoWrite8 (0x70, (UINT8) Index);
|
||||
IoWrite8 (0x70, (UINT8)Index);
|
||||
return IoRead8 (0x71);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Writes 8-bits of CMOS data.
|
||||
|
||||
@ -51,8 +49,7 @@ CmosWrite8 (
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
IoWrite8 (0x70, (UINT8) Index);
|
||||
IoWrite8 (0x70, (UINT8)Index);
|
||||
IoWrite8 (0x71, Value);
|
||||
return Value;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,4 @@ CmosWrite8 (
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
|
||||
#endif /* _CMOS_H_ */
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
|
||||
|
||||
/**
|
||||
Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
|
||||
and DXE know about them.
|
||||
@ -83,7 +82,7 @@ PeiFvInitialization (
|
||||
//
|
||||
PeiServicesInstallFvInfoPpi (
|
||||
NULL,
|
||||
(VOID *)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase),
|
||||
(VOID *)(UINTN)PcdGet32 (PcdOvmfDxeMemFvBase),
|
||||
PcdGet32 (PcdOvmfDxeMemFvSize),
|
||||
NULL,
|
||||
NULL
|
||||
@ -91,4 +90,3 @@ PeiFvInitialization (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,6 @@ Q35TsegMbytesInitialization (
|
||||
mQ35TsegMbytes = ExtendedTsegMbytes;
|
||||
}
|
||||
|
||||
|
||||
UINT32
|
||||
GetSystemMemorySizeBelow4gb (
|
||||
VOID
|
||||
@ -118,13 +117,12 @@ GetSystemMemorySizeBelow4gb (
|
||||
// into the calculation to get the total memory size.
|
||||
//
|
||||
|
||||
Cmos0x34 = (UINT8) CmosRead8 (0x34);
|
||||
Cmos0x35 = (UINT8) CmosRead8 (0x35);
|
||||
Cmos0x34 = (UINT8)CmosRead8 (0x34);
|
||||
Cmos0x35 = (UINT8)CmosRead8 (0x35);
|
||||
|
||||
return (UINT32) (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
|
||||
return (UINT32)(((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
UINT64
|
||||
GetSystemMemorySizeAbove4gb (
|
||||
@ -143,13 +141,12 @@ GetSystemMemorySizeAbove4gb (
|
||||
|
||||
Size = 0;
|
||||
for (CmosIndex = 0x5d; CmosIndex >= 0x5b; CmosIndex--) {
|
||||
Size = (UINT32) (Size << 8) + (UINT32) CmosRead8 (CmosIndex);
|
||||
Size = (UINT32)(Size << 8) + (UINT32)CmosRead8 (CmosIndex);
|
||||
}
|
||||
|
||||
return LShiftU64 (Size, 16);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Return the highest address that DXE could possibly use, plus one.
|
||||
**/
|
||||
@ -170,11 +167,12 @@ GetFirstNonAddress (
|
||||
// resources to 32-bit anyway. See DegradeResource() in
|
||||
// "PciResourceSupport.c".
|
||||
//
|
||||
#ifdef MDE_CPU_IA32
|
||||
#ifdef MDE_CPU_IA32
|
||||
if (!FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
|
||||
return FirstNonAddress;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Otherwise, in order to calculate the highest address plus one, we must
|
||||
@ -184,8 +182,11 @@ GetFirstNonAddress (
|
||||
|
||||
if (Pci64Size == 0) {
|
||||
if (mBootMode != BOOT_ON_S3_RESUME) {
|
||||
DEBUG ((DEBUG_INFO, "%a: disabling 64-bit PCI host aperture\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: disabling 64-bit PCI host aperture\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
PcdStatus = PcdSet64S (PcdPciMmio64Size, 0);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
}
|
||||
@ -224,8 +225,13 @@ GetFirstNonAddress (
|
||||
PcdStatus = PcdSet64S (PcdPciMmio64Size, Pci64Size);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Pci64Base=0x%Lx Pci64Size=0x%Lx\n",
|
||||
__FUNCTION__, Pci64Base, Pci64Size));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Pci64Base=0x%Lx Pci64Size=0x%Lx\n",
|
||||
__FUNCTION__,
|
||||
Pci64Base,
|
||||
Pci64Size
|
||||
));
|
||||
}
|
||||
|
||||
//
|
||||
@ -235,7 +241,6 @@ GetFirstNonAddress (
|
||||
return FirstNonAddress;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize the mPhysMemAddressWidth variable, based on guest RAM size.
|
||||
**/
|
||||
@ -272,10 +277,10 @@ AddressWidthInitialization (
|
||||
if (mPhysMemAddressWidth <= 36) {
|
||||
mPhysMemAddressWidth = 36;
|
||||
}
|
||||
|
||||
ASSERT (mPhysMemAddressWidth <= 48);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Calculate the cap for the permanent PEI memory.
|
||||
**/
|
||||
@ -295,11 +300,12 @@ GetPeiMemoryCap (
|
||||
//
|
||||
// If DXE is 32-bit, then just return the traditional 64 MB cap.
|
||||
//
|
||||
#ifdef MDE_CPU_IA32
|
||||
#ifdef MDE_CPU_IA32
|
||||
if (!FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
|
||||
return SIZE_64MB;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Dependent on physical address width, PEI memory allocations can be
|
||||
@ -340,7 +346,6 @@ GetPeiMemoryCap (
|
||||
return (UINT32)(EFI_PAGES_TO_SIZE (TotalPages) + SIZE_64MB);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Publish PEI core memory
|
||||
|
||||
@ -384,8 +389,13 @@ PublishPeiMemory (
|
||||
MemorySize = mS3AcpiReservedMemorySize;
|
||||
} else {
|
||||
PeiMemoryCap = GetPeiMemoryCap ();
|
||||
DEBUG ((DEBUG_INFO, "%a: mPhysMemAddressWidth=%d PeiMemoryCap=%u KB\n",
|
||||
__FUNCTION__, mPhysMemAddressWidth, PeiMemoryCap >> 10));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: mPhysMemAddressWidth=%d PeiMemoryCap=%u KB\n",
|
||||
__FUNCTION__,
|
||||
mPhysMemAddressWidth,
|
||||
PeiMemoryCap >> 10
|
||||
));
|
||||
|
||||
//
|
||||
// Determine the range of memory to use during PEI
|
||||
@ -410,13 +420,12 @@ PublishPeiMemory (
|
||||
//
|
||||
// Publish this memory to the PEI Core
|
||||
//
|
||||
Status = PublishSystemMemory(MemoryBase, MemorySize);
|
||||
Status = PublishSystemMemory (MemoryBase, MemorySize);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Peform Memory Detection for QEMU / KVM
|
||||
|
||||
@ -473,8 +482,11 @@ QemuInitializeRam (
|
||||
|
||||
TsegSize = mQ35TsegMbytes * SIZE_1MB;
|
||||
AddMemoryRangeHob (BASE_1MB, LowerMemorySize - TsegSize);
|
||||
AddReservedMemoryBaseSizeHob (LowerMemorySize - TsegSize, TsegSize,
|
||||
TRUE);
|
||||
AddReservedMemoryBaseSizeHob (
|
||||
LowerMemorySize - TsegSize,
|
||||
TsegSize,
|
||||
TRUE
|
||||
);
|
||||
} else {
|
||||
AddMemoryRangeHob (BASE_1MB, LowerMemorySize);
|
||||
}
|
||||
@ -516,16 +528,22 @@ QemuInitializeRam (
|
||||
//
|
||||
// Set memory range from 640KB to 1MB to uncacheable
|
||||
//
|
||||
Status = MtrrSetMemoryAttribute (BASE_512KB + BASE_128KB,
|
||||
BASE_1MB - (BASE_512KB + BASE_128KB), CacheUncacheable);
|
||||
Status = MtrrSetMemoryAttribute (
|
||||
BASE_512KB + BASE_128KB,
|
||||
BASE_1MB - (BASE_512KB + BASE_128KB),
|
||||
CacheUncacheable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Set memory range from the "top of lower RAM" (RAM below 4GB) to 4GB as
|
||||
// uncacheable
|
||||
//
|
||||
Status = MtrrSetMemoryAttribute (LowerMemorySize,
|
||||
SIZE_4GB - LowerMemorySize, CacheUncacheable);
|
||||
Status = MtrrSetMemoryAttribute (
|
||||
LowerMemorySize,
|
||||
SIZE_4GB - LowerMemorySize,
|
||||
CacheUncacheable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
@ -541,7 +559,7 @@ InitializeRamRegions (
|
||||
{
|
||||
QemuInitializeRam ();
|
||||
|
||||
if (mS3Supported && mBootMode != BOOT_ON_S3_RESUME) {
|
||||
if (mS3Supported && (mBootMode != BOOT_ON_S3_RESUME)) {
|
||||
//
|
||||
// This is the memory range that will be used for PEI on S3 resume
|
||||
//
|
||||
@ -571,7 +589,7 @@ InitializeRamRegions (
|
||||
EfiACPIMemoryNVS
|
||||
);
|
||||
|
||||
#ifdef MDE_CPU_X64
|
||||
#ifdef MDE_CPU_X64
|
||||
//
|
||||
// Reserve the initial page tables built by the reset vector code.
|
||||
//
|
||||
@ -579,11 +597,11 @@ InitializeRamRegions (
|
||||
// resume, it must be reserved as ACPI NVS.
|
||||
//
|
||||
BuildMemoryAllocationHob (
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfSecPageTablesBase),
|
||||
(UINT64)(UINTN) PcdGet32 (PcdOvmfSecPageTablesSize),
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfSecPageTablesBase),
|
||||
(UINT64)(UINTN)PcdGet32 (PcdOvmfSecPageTablesSize),
|
||||
EfiACPIMemoryNVS
|
||||
);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mBootMode != BOOT_ON_S3_RESUME) {
|
||||
@ -599,12 +617,12 @@ InitializeRamRegions (
|
||||
// such that they would overlap the LockBox storage.
|
||||
//
|
||||
ZeroMem (
|
||||
(VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),
|
||||
(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize)
|
||||
(VOID *)(UINTN)PcdGet32 (PcdOvmfLockBoxStorageBase),
|
||||
(UINTN)PcdGet32 (PcdOvmfLockBoxStorageSize)
|
||||
);
|
||||
BuildMemoryAllocationHob (
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),
|
||||
(UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize),
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfLockBoxStorageBase),
|
||||
(UINT64)(UINTN)PcdGet32 (PcdOvmfLockBoxStorageSize),
|
||||
mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
|
||||
);
|
||||
}
|
||||
@ -618,7 +636,7 @@ InitializeRamRegions (
|
||||
//
|
||||
TsegSize = mQ35TsegMbytes * SIZE_1MB;
|
||||
BuildMemoryAllocationHob (
|
||||
GetSystemMemorySizeBelow4gb() - TsegSize,
|
||||
GetSystemMemorySizeBelow4gb () - TsegSize,
|
||||
TsegSize,
|
||||
EfiReservedMemoryType
|
||||
);
|
||||
|
@ -47,7 +47,6 @@ EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
|
||||
{ EfiMaxMemoryType, 0x000 }
|
||||
};
|
||||
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] = {
|
||||
{
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
|
||||
@ -56,7 +55,6 @@ EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
UINT16 mHostBridgeDevId;
|
||||
|
||||
EFI_BOOT_MODE mBootMode = BOOT_WITH_FULL_CONFIGURATION;
|
||||
@ -115,7 +113,6 @@ AddIoMemoryRangeHob (
|
||||
AddIoMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
AddMemoryBaseSizeHob (
|
||||
EFI_PHYSICAL_ADDRESS MemoryBase,
|
||||
@ -136,7 +133,6 @@ AddMemoryBaseSizeHob (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
AddMemoryRangeHob (
|
||||
EFI_PHYSICAL_ADDRESS MemoryBase,
|
||||
@ -146,7 +142,6 @@ AddMemoryRangeHob (
|
||||
AddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
MemMapInitialization (
|
||||
VOID
|
||||
@ -165,7 +160,7 @@ MemMapInitialization (
|
||||
BuildGuidDataHob (
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
mDefaultMemoryTypeInformation,
|
||||
sizeof(mDefaultMemoryTypeInformation)
|
||||
sizeof (mDefaultMemoryTypeInformation)
|
||||
);
|
||||
|
||||
//
|
||||
@ -192,9 +187,10 @@ MemMapInitialization (
|
||||
PciBase = (UINT32)(PciExBarBase + SIZE_256MB);
|
||||
} else {
|
||||
PciBase = (UINT32)PcdGet64 (PcdPciMmio32Base);
|
||||
if (PciBase == 0)
|
||||
if (PciBase == 0) {
|
||||
PciBase = (TopOfLowRam < BASE_2GB) ? BASE_2GB : TopOfLowRam;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// address purpose size
|
||||
@ -242,10 +238,14 @@ MemMapInitialization (
|
||||
// uncacheable reserved memory right here.
|
||||
//
|
||||
AddReservedMemoryBaseSizeHob (PciExBarBase, SIZE_256MB, FALSE);
|
||||
BuildMemoryAllocationHob (PciExBarBase, SIZE_256MB,
|
||||
EfiReservedMemoryType);
|
||||
BuildMemoryAllocationHob (
|
||||
PciExBarBase,
|
||||
SIZE_256MB,
|
||||
EfiReservedMemoryType
|
||||
);
|
||||
}
|
||||
AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress), SIZE_1MB);
|
||||
|
||||
AddIoMemoryBaseSizeHob (PcdGet32 (PcdCpuLocalApicBaseAddress), SIZE_1MB);
|
||||
|
||||
//
|
||||
// On Q35, the IO Port space is available for PCI resource allocations from
|
||||
@ -370,11 +370,16 @@ MiscInitialization (
|
||||
AcpiEnBit = ICH9_ACPI_CNTL_ACPI_EN;
|
||||
break;
|
||||
default:
|
||||
DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
|
||||
__FUNCTION__, mHostBridgeDevId));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Unknown Host Bridge Device ID: 0x%04x\n",
|
||||
__FUNCTION__,
|
||||
mHostBridgeDevId
|
||||
));
|
||||
ASSERT (FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
PcdStatus = PcdSet16S (PcdOvmfHostBridgePciDevId, mHostBridgeDevId);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
@ -417,7 +422,6 @@ MiscInitialization (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
BootModeInitialization (
|
||||
VOID
|
||||
@ -428,6 +432,7 @@ BootModeInitialization (
|
||||
if (CmosRead8 (0xF) == 0xFE) {
|
||||
mBootMode = BOOT_ON_S3_RESUME;
|
||||
}
|
||||
|
||||
CmosWrite8 (0xF, 0x00);
|
||||
|
||||
Status = PeiServicesSetBootMode (mBootMode);
|
||||
@ -437,7 +442,6 @@ BootModeInitialization (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ReserveEmuVariableNvStore (
|
||||
)
|
||||
@ -456,7 +460,8 @@ ReserveEmuVariableNvStore (
|
||||
AllocateRuntimePages (
|
||||
EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize))
|
||||
);
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"Reserved variable store memory: 0x%lX; size: %dkb\n",
|
||||
VariableStore,
|
||||
(2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024
|
||||
@ -465,7 +470,6 @@ ReserveEmuVariableNvStore (
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
DebugDumpCmos (
|
||||
VOID
|
||||
@ -479,6 +483,7 @@ DebugDumpCmos (
|
||||
if ((Loop % 0x10) == 0) {
|
||||
DEBUG ((DEBUG_INFO, "%02x:", Loop));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, " %02x", CmosRead8 (Loop)));
|
||||
if ((Loop % 0x10) == 0xf) {
|
||||
DEBUG ((DEBUG_INFO, "\n"));
|
||||
@ -486,27 +491,34 @@ DebugDumpCmos (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
S3Verification (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
#if defined (MDE_CPU_X64)
|
||||
#if defined (MDE_CPU_X64)
|
||||
if (FeaturePcdGet (PcdSmmSmramRequire) && mS3Supported) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
"%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Please disable S3 on the QEMU command line (see the README),\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
"%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n", __FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
Fetch the number of boot CPUs from QEMU and expose it to UefiCpuPkg modules.
|
||||
@ -528,6 +540,7 @@ MaxCpuCountInitialization (
|
||||
mMaxCpuCount = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Otherwise, set mMaxCpuCount to the value reported by QEMU.
|
||||
//
|
||||
@ -542,11 +555,14 @@ MaxCpuCountInitialization (
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
PcdStatus = PcdSet32S (PcdCpuApInitTimeOutInMicroSeconds, MAX_UINT32);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
DEBUG ((DEBUG_INFO, "%a: QEMU reports %d processor(s)\n", __FUNCTION__,
|
||||
ProcessorCount));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: QEMU reports %d processor(s)\n",
|
||||
__FUNCTION__,
|
||||
ProcessorCount
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Perform Platform PEI initialization.
|
||||
|
||||
@ -596,6 +612,7 @@ InitializePlatform (
|
||||
if (!FeaturePcdGet (PcdSmmSmramRequire)) {
|
||||
ReserveEmuVariableNvStore ();
|
||||
}
|
||||
|
||||
PeiFvInitialization ();
|
||||
MemMapInitialization ();
|
||||
NoexecDxeInitialization ();
|
||||
|
@ -24,18 +24,17 @@ GetBhyveSmbiosTables (
|
||||
UINT8 *BhyveSmbiosPtr;
|
||||
SMBIOS_TABLE_ENTRY_POINT *BhyveSmbiosEntryPointStructure;
|
||||
|
||||
for (BhyveSmbiosPtr = (UINT8*)(UINTN) BHYVE_SMBIOS_PHYSICAL_ADDRESS;
|
||||
BhyveSmbiosPtr < (UINT8*)(UINTN) BHYVE_SMBIOS_PHYSICAL_END;
|
||||
BhyveSmbiosPtr += 0x10) {
|
||||
|
||||
BhyveSmbiosEntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) BhyveSmbiosPtr;
|
||||
|
||||
if (!AsciiStrnCmp ((CHAR8 *) BhyveSmbiosEntryPointStructure->AnchorString, "_SM_", 4) &&
|
||||
!AsciiStrnCmp ((CHAR8 *) BhyveSmbiosEntryPointStructure->IntermediateAnchorString, "_DMI_", 5) &&
|
||||
IsEntryPointStructureValid (BhyveSmbiosEntryPointStructure)) {
|
||||
for (BhyveSmbiosPtr = (UINT8 *)(UINTN)BHYVE_SMBIOS_PHYSICAL_ADDRESS;
|
||||
BhyveSmbiosPtr < (UINT8 *)(UINTN)BHYVE_SMBIOS_PHYSICAL_END;
|
||||
BhyveSmbiosPtr += 0x10)
|
||||
{
|
||||
BhyveSmbiosEntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)BhyveSmbiosPtr;
|
||||
|
||||
if (!AsciiStrnCmp ((CHAR8 *)BhyveSmbiosEntryPointStructure->AnchorString, "_SM_", 4) &&
|
||||
!AsciiStrnCmp ((CHAR8 *)BhyveSmbiosEntryPointStructure->IntermediateAnchorString, "_DMI_", 5) &&
|
||||
IsEntryPointStructureValid (BhyveSmbiosEntryPointStructure))
|
||||
{
|
||||
return BhyveSmbiosEntryPointStructure;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
SMBIOS_TABLE_TYPE0 Base;
|
||||
UINT8 Strings[sizeof(TYPE0_STRINGS)];
|
||||
UINT8 Strings[sizeof (TYPE0_STRINGS)];
|
||||
} OVMF_TYPE0;
|
||||
#pragma pack()
|
||||
|
||||
@ -34,7 +34,7 @@ STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
|
||||
},
|
||||
1, // SMBIOS_TABLE_STRING Vendor
|
||||
2, // SMBIOS_TABLE_STRING BiosVersion
|
||||
0xE800,// UINT16 BiosSegment
|
||||
0xE800, // UINT16 BiosSegment
|
||||
3, // SMBIOS_TABLE_STRING BiosReleaseDate
|
||||
0, // UINT8 BiosSize
|
||||
{ // MISC_BIOS_CHARACTERISTICS BiosCharacteristics
|
||||
@ -58,7 +58,6 @@ STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
|
||||
TYPE0_STRINGS
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Validates the SMBIOS entry point structure
|
||||
|
||||
@ -78,12 +77,12 @@ IsEntryPointStructureValid (
|
||||
UINT8 Checksum;
|
||||
UINT8 *BytePtr;
|
||||
|
||||
BytePtr = (UINT8*) EntryPointStructure;
|
||||
BytePtr = (UINT8 *)EntryPointStructure;
|
||||
Length = EntryPointStructure->EntryPointLength;
|
||||
Checksum = 0;
|
||||
|
||||
for (Index = 0; Index < Length; Index++) {
|
||||
Checksum = Checksum + (UINT8) BytePtr[Index];
|
||||
Checksum = Checksum + (UINT8)BytePtr[Index];
|
||||
}
|
||||
|
||||
if (Checksum != 0) {
|
||||
@ -93,7 +92,6 @@ IsEntryPointStructureValid (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get SMBIOS record length.
|
||||
|
||||
@ -114,14 +112,14 @@ SmbiosTableLength (
|
||||
// Each structure shall be terminated by a double-null (SMBIOS spec.7.1)
|
||||
//
|
||||
while ((*AChar != 0) || (*(AChar + 1) != 0)) {
|
||||
AChar ++;
|
||||
AChar++;
|
||||
}
|
||||
|
||||
Length = ((UINTN)AChar - (UINTN)SmbiosTable.Raw + 2);
|
||||
|
||||
return Length;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Install all structures from the given SMBIOS structures block
|
||||
|
||||
@ -156,7 +154,7 @@ InstallAllStructures (
|
||||
Smbios,
|
||||
NULL,
|
||||
&SmbiosHandle,
|
||||
(EFI_SMBIOS_TABLE_HEADER*) SmbiosTable.Raw
|
||||
(EFI_SMBIOS_TABLE_HEADER *)SmbiosTable.Raw
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -179,7 +177,7 @@ InstallAllStructures (
|
||||
Smbios,
|
||||
NULL,
|
||||
&SmbiosHandle,
|
||||
(EFI_SMBIOS_TABLE_HEADER*) &mOvmfDefaultType0
|
||||
(EFI_SMBIOS_TABLE_HEADER *)&mOvmfDefaultType0
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
@ -187,7 +185,6 @@ InstallAllStructures (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Installs SMBIOS information for OVMF
|
||||
|
||||
@ -216,7 +213,7 @@ SmbiosTablePublishEntry (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiSmbiosProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&Smbios
|
||||
(VOID **)&Smbios
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@ -227,7 +224,7 @@ SmbiosTablePublishEntry (
|
||||
//
|
||||
EntryPointStructure = GetBhyveSmbiosTables ();
|
||||
if (EntryPointStructure != NULL) {
|
||||
SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
|
||||
SmbiosTables = (UINT8 *)(UINTN)EntryPointStructure->TableAddress;
|
||||
}
|
||||
|
||||
if (SmbiosTables != NULL) {
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
|
||||
/**
|
||||
Locates the bhyve SMBIOS data if it exists
|
||||
|
||||
@ -33,7 +32,6 @@ GetBhyveSmbiosTables (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Validates the SMBIOS entry point structure
|
||||
|
||||
|
@ -74,18 +74,21 @@ GetCompatEntryPoint (
|
||||
PeCompatEnd = (UINTN)(VOID *)PeCompat + Section->Misc.VirtualSize;
|
||||
|
||||
while (PeCompat->Type != 0 && (UINTN)(VOID *)PeCompat < PeCompatEnd) {
|
||||
if (PeCompat->Type == 1 &&
|
||||
PeCompat->Size >= sizeof (PE_COMPAT_TYPE1) &&
|
||||
EFI_IMAGE_MACHINE_TYPE_SUPPORTED (PeCompat->MachineType)) {
|
||||
|
||||
if ((PeCompat->Type == 1) &&
|
||||
(PeCompat->Size >= sizeof (PE_COMPAT_TYPE1)) &&
|
||||
EFI_IMAGE_MACHINE_TYPE_SUPPORTED (PeCompat->MachineType))
|
||||
{
|
||||
return (EFI_IMAGE_ENTRY_POINT)((UINTN)ImageBase + PeCompat->EntryPoint);
|
||||
}
|
||||
|
||||
PeCompat = (PE_COMPAT_TYPE1 *)((UINTN)PeCompat + PeCompat->Size);
|
||||
ASSERT ((UINTN)(VOID *)PeCompat < PeCompatEnd);
|
||||
}
|
||||
}
|
||||
|
||||
Section++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -136,8 +139,10 @@ CompatImageLoaderDxeEntryPoint (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
return gBS->InstallProtocolInterface (&ImageHandle,
|
||||
return gBS->InstallProtocolInterface (
|
||||
&ImageHandle,
|
||||
&gEdkiiPeCoffImageEmulatorProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mCompatLoaderPeCoffEmuProtocol);
|
||||
&mCompatLoaderPeCoffEmuProtocol
|
||||
);
|
||||
}
|
||||
|
@ -123,14 +123,21 @@ ProcessHotAddedCpus (
|
||||
//
|
||||
for (CheckSlot = 0;
|
||||
CheckSlot < mCpuHotPlugData->ArrayLength;
|
||||
CheckSlot++) {
|
||||
CheckSlot++)
|
||||
{
|
||||
if (mCpuHotPlugData->ApicId[CheckSlot] == NewApicId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckSlot < mCpuHotPlugData->ArrayLength) {
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: APIC ID " FMT_APIC_ID " was hot-plugged "
|
||||
"before; ignoring it\n", __FUNCTION__, NewApicId));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: APIC ID " FMT_APIC_ID " was hot-plugged "
|
||||
"before; ignoring it\n",
|
||||
__FUNCTION__,
|
||||
NewApicId
|
||||
));
|
||||
PluggedIdx++;
|
||||
continue;
|
||||
}
|
||||
@ -139,12 +146,18 @@ ProcessHotAddedCpus (
|
||||
// Find the first empty slot in CPU_HOT_PLUG_DATA.
|
||||
//
|
||||
while (NewSlot < mCpuHotPlugData->ArrayLength &&
|
||||
mCpuHotPlugData->ApicId[NewSlot] != MAX_UINT64) {
|
||||
mCpuHotPlugData->ApicId[NewSlot] != MAX_UINT64)
|
||||
{
|
||||
NewSlot++;
|
||||
}
|
||||
|
||||
if (NewSlot == mCpuHotPlugData->ArrayLength) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: no room for APIC ID " FMT_APIC_ID "\n",
|
||||
__FUNCTION__, NewApicId));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: no room for APIC ID " FMT_APIC_ID "\n",
|
||||
__FUNCTION__,
|
||||
NewApicId
|
||||
));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
@ -156,8 +169,11 @@ ProcessHotAddedCpus (
|
||||
//
|
||||
// Relocate the SMBASE of the new CPU.
|
||||
//
|
||||
Status = SmbaseRelocate (NewApicId, mCpuHotPlugData->SmBase[NewSlot],
|
||||
mPostSmmPenAddress);
|
||||
Status = SmbaseRelocate (
|
||||
NewApicId,
|
||||
mCpuHotPlugData->SmBase[NewSlot],
|
||||
mPostSmmPenAddress
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto RevokeNewSlot;
|
||||
}
|
||||
@ -165,18 +181,31 @@ ProcessHotAddedCpus (
|
||||
//
|
||||
// Add the new CPU with EFI_SMM_CPU_SERVICE_PROTOCOL.
|
||||
//
|
||||
Status = mMmCpuService->AddProcessor (mMmCpuService, NewApicId,
|
||||
&NewProcessorNumberByProtocol);
|
||||
Status = mMmCpuService->AddProcessor (
|
||||
mMmCpuService,
|
||||
NewApicId,
|
||||
&NewProcessorNumberByProtocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: AddProcessor(" FMT_APIC_ID "): %r\n",
|
||||
__FUNCTION__, NewApicId, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: AddProcessor(" FMT_APIC_ID "): %r\n",
|
||||
__FUNCTION__,
|
||||
NewApicId,
|
||||
Status
|
||||
));
|
||||
goto RevokeNewSlot;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: hot-added APIC ID " FMT_APIC_ID ", SMBASE 0x%Lx, "
|
||||
"EFI_SMM_CPU_SERVICE_PROTOCOL assigned number %Lu\n", __FUNCTION__,
|
||||
NewApicId, (UINT64)mCpuHotPlugData->SmBase[NewSlot],
|
||||
(UINT64)NewProcessorNumberByProtocol));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: hot-added APIC ID " FMT_APIC_ID ", SMBASE 0x%Lx, "
|
||||
"EFI_SMM_CPU_SERVICE_PROTOCOL assigned number %Lu\n",
|
||||
__FUNCTION__,
|
||||
NewApicId,
|
||||
(UINT64)mCpuHotPlugData->SmBase[NewSlot],
|
||||
(UINT64)NewProcessorNumberByProtocol
|
||||
));
|
||||
|
||||
NewSlot++;
|
||||
PluggedIdx++;
|
||||
@ -258,7 +287,7 @@ EjectCpu (
|
||||
//
|
||||
// Tell QEMU to context-switch it out.
|
||||
//
|
||||
QemuCpuhpWriteCpuSelector (mMmCpuIo, (UINT32) QemuSelector);
|
||||
QemuCpuhpWriteCpuSelector (mMmCpuIo, (UINT32)QemuSelector);
|
||||
QemuCpuhpWriteCpuStatus (mMmCpuIo, QEMU_CPUHP_STAT_EJECT);
|
||||
|
||||
//
|
||||
@ -277,8 +306,14 @@ EjectCpu (
|
||||
mCpuHotEjectData->QemuSelectorMap[Idx] =
|
||||
CPU_EJECT_QEMU_SELECTOR_INVALID;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Unplugged ProcessorNum %u, "
|
||||
"QemuSelector %Lu\n", __FUNCTION__, Idx, QemuSelector));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Unplugged ProcessorNum %u, "
|
||||
"QemuSelector %Lu\n",
|
||||
__FUNCTION__,
|
||||
Idx,
|
||||
QemuSelector
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,7 +365,7 @@ EjectCpu (
|
||||
//
|
||||
// Keep them penned here until the BSP tells QEMU to eject them.
|
||||
//
|
||||
for (;;) {
|
||||
for ( ; ;) {
|
||||
DisableInterrupts ();
|
||||
CpuSleep ();
|
||||
}
|
||||
@ -404,7 +439,8 @@ UnplugCpus (
|
||||
|
||||
for (ProcessorNum = 0;
|
||||
ProcessorNum < mCpuHotPlugData->ArrayLength;
|
||||
ProcessorNum++) {
|
||||
ProcessorNum++)
|
||||
{
|
||||
if (mCpuHotPlugData->ApicId[ProcessorNum] == RemoveApicId) {
|
||||
break;
|
||||
}
|
||||
@ -414,8 +450,13 @@ UnplugCpus (
|
||||
// Ignore the unplug if APIC ID not found
|
||||
//
|
||||
if (ProcessorNum == mCpuHotPlugData->ArrayLength) {
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: did not find APIC ID " FMT_APIC_ID
|
||||
" to unplug\n", __FUNCTION__, RemoveApicId));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: did not find APIC ID " FMT_APIC_ID
|
||||
" to unplug\n",
|
||||
__FUNCTION__,
|
||||
RemoveApicId
|
||||
));
|
||||
ToUnplugIdx++;
|
||||
continue;
|
||||
}
|
||||
@ -425,13 +466,19 @@ UnplugCpus (
|
||||
//
|
||||
Status = mMmCpuService->RemoveProcessor (mMmCpuService, ProcessorNum);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: RemoveProcessor(" FMT_APIC_ID "): %r\n",
|
||||
__FUNCTION__, RemoveApicId, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: RemoveProcessor(" FMT_APIC_ID "): %r\n",
|
||||
__FUNCTION__,
|
||||
RemoveApicId,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (mCpuHotEjectData->QemuSelectorMap[ProcessorNum] !=
|
||||
CPU_EJECT_QEMU_SELECTOR_INVALID) {
|
||||
CPU_EJECT_QEMU_SELECTOR_INVALID)
|
||||
{
|
||||
//
|
||||
// mCpuHotEjectData->QemuSelectorMap[ProcessorNum] is set to
|
||||
// CPU_EJECT_QEMU_SELECTOR_INVALID when mCpuHotEjectData->QemuSelectorMap
|
||||
@ -442,9 +489,15 @@ UnplugCpus (
|
||||
// never match more than one APIC ID -- nor, by transitivity, designate
|
||||
// more than one QemuSelector -- in a single invocation of UnplugCpus().
|
||||
//
|
||||
DEBUG ((DEBUG_ERROR, "%a: ProcessorNum %Lu maps to QemuSelector %Lu, "
|
||||
"cannot also map to %u\n", __FUNCTION__, (UINT64)ProcessorNum,
|
||||
mCpuHotEjectData->QemuSelectorMap[ProcessorNum], QemuSelector));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: ProcessorNum %Lu maps to QemuSelector %Lu, "
|
||||
"cannot also map to %u\n",
|
||||
__FUNCTION__,
|
||||
(UINT64)ProcessorNum,
|
||||
mCpuHotEjectData->QemuSelectorMap[ProcessorNum],
|
||||
QemuSelector
|
||||
));
|
||||
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
@ -454,9 +507,15 @@ UnplugCpus (
|
||||
//
|
||||
mCpuHotEjectData->QemuSelectorMap[ProcessorNum] = (UINT64)QemuSelector;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Started hot-unplug on ProcessorNum %Lu, APIC ID "
|
||||
FMT_APIC_ID ", QemuSelector %u\n", __FUNCTION__, (UINT64)ProcessorNum,
|
||||
RemoveApicId, QemuSelector));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Started hot-unplug on ProcessorNum %Lu, APIC ID "
|
||||
FMT_APIC_ID ", QemuSelector %u\n",
|
||||
__FUNCTION__,
|
||||
(UINT64)ProcessorNum,
|
||||
RemoveApicId,
|
||||
QemuSelector
|
||||
));
|
||||
|
||||
EjectCount++;
|
||||
ToUnplugIdx++;
|
||||
@ -565,11 +624,20 @@ CpuHotplugMmi (
|
||||
// Read the MMI command value from the APM Control Port, to see if this is an
|
||||
// MMI we should care about.
|
||||
//
|
||||
Status = mMmCpuIo->Io.Read (mMmCpuIo, MM_IO_UINT8, ICH9_APM_CNT, 1,
|
||||
&ApmControl);
|
||||
Status = mMmCpuIo->Io.Read (
|
||||
mMmCpuIo,
|
||||
MM_IO_UINT8,
|
||||
ICH9_APM_CNT,
|
||||
1,
|
||||
&ApmControl
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: failed to read ICH9_APM_CNT: %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: failed to read ICH9_APM_CNT: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
//
|
||||
// We couldn't even determine if the MMI was for us or not.
|
||||
//
|
||||
@ -628,7 +696,6 @@ Fatal:
|
||||
return EFI_INTERRUPT_PENDING;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Entry point function of this driver.
|
||||
//
|
||||
@ -663,17 +730,28 @@ CpuHotplugEntry (
|
||||
// First, collect the protocols needed later. All of these protocols are
|
||||
// listed in our module DEPEX.
|
||||
//
|
||||
Status = gMmst->MmLocateProtocol (&gEfiMmCpuIoProtocolGuid,
|
||||
NULL /* Registration */, (VOID **)&mMmCpuIo);
|
||||
Status = gMmst->MmLocateProtocol (
|
||||
&gEfiMmCpuIoProtocolGuid,
|
||||
NULL /* Registration */,
|
||||
(VOID **)&mMmCpuIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: locate MmCpuIo: %r\n", __FUNCTION__, Status));
|
||||
goto Fatal;
|
||||
}
|
||||
Status = gMmst->MmLocateProtocol (&gEfiSmmCpuServiceProtocolGuid,
|
||||
NULL /* Registration */, (VOID **)&mMmCpuService);
|
||||
|
||||
Status = gMmst->MmLocateProtocol (
|
||||
&gEfiSmmCpuServiceProtocolGuid,
|
||||
NULL /* Registration */,
|
||||
(VOID **)&mMmCpuService
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: locate MmCpuService: %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: locate MmCpuService: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto Fatal;
|
||||
}
|
||||
|
||||
@ -692,6 +770,7 @@ CpuHotplugEntry (
|
||||
DEBUG ((DEBUG_ERROR, "%a: CPU_HOT_PLUG_DATA: %r\n", __FUNCTION__, Status));
|
||||
goto Fatal;
|
||||
}
|
||||
|
||||
//
|
||||
// If the possible CPU count is 1, there's nothing for this driver to do.
|
||||
//
|
||||
@ -706,6 +785,7 @@ CpuHotplugEntry (
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: CPU_HOT_EJECT_DATA: %r\n", __FUNCTION__, Status));
|
||||
goto Fatal;
|
||||
@ -716,25 +796,38 @@ CpuHotplugEntry (
|
||||
//
|
||||
if (RETURN_ERROR (SafeUintnSub (mCpuHotPlugData->ArrayLength, 1, &Len)) ||
|
||||
RETURN_ERROR (SafeUintnMult (sizeof (APIC_ID), Len, &Size)) ||
|
||||
RETURN_ERROR (SafeUintnMult (sizeof (UINT32), Len, &SizeSel))) {
|
||||
RETURN_ERROR (SafeUintnMult (sizeof (UINT32), Len, &SizeSel)))
|
||||
{
|
||||
Status = EFI_ABORTED;
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid CPU_HOT_PLUG_DATA\n", __FUNCTION__));
|
||||
goto Fatal;
|
||||
}
|
||||
Status = gMmst->MmAllocatePool (EfiRuntimeServicesData, Size,
|
||||
(VOID **)&mPluggedApicIds);
|
||||
|
||||
Status = gMmst->MmAllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
Size,
|
||||
(VOID **)&mPluggedApicIds
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __FUNCTION__, Status));
|
||||
goto Fatal;
|
||||
}
|
||||
Status = gMmst->MmAllocatePool (EfiRuntimeServicesData, Size,
|
||||
(VOID **)&mToUnplugApicIds);
|
||||
|
||||
Status = gMmst->MmAllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
Size,
|
||||
(VOID **)&mToUnplugApicIds
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __FUNCTION__, Status));
|
||||
goto ReleasePluggedApicIds;
|
||||
}
|
||||
Status = gMmst->MmAllocatePool (EfiRuntimeServicesData, SizeSel,
|
||||
(VOID **)&mToUnplugSelectors);
|
||||
|
||||
Status = gMmst->MmAllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
SizeSel,
|
||||
(VOID **)&mToUnplugSelectors
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __FUNCTION__, Status));
|
||||
goto ReleaseToUnplugApicIds;
|
||||
@ -743,8 +836,10 @@ CpuHotplugEntry (
|
||||
//
|
||||
// Allocate the Post-SMM Pen for hot-added CPUs.
|
||||
//
|
||||
Status = SmbaseAllocatePostSmmPen (&mPostSmmPenAddress,
|
||||
SystemTable->BootServices);
|
||||
Status = SmbaseAllocatePostSmmPen (
|
||||
&mPostSmmPenAddress,
|
||||
SystemTable->BootServices
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ReleaseToUnplugSelectors;
|
||||
}
|
||||
@ -776,8 +871,12 @@ CpuHotplugEntry (
|
||||
QemuCpuhpWriteCommand (mMmCpuIo, QEMU_CPUHP_CMD_GET_PENDING);
|
||||
if (QemuCpuhpReadCommandData2 (mMmCpuIo) != 0) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
DEBUG ((DEBUG_ERROR, "%a: modern CPU hotplug interface: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: modern CPU hotplug interface: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto ReleasePostSmmPen;
|
||||
}
|
||||
|
||||
@ -790,8 +889,12 @@ CpuHotplugEntry (
|
||||
&mDispatchHandle
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: MmiHandlerRegister(): %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: MmiHandlerRegister(): %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto ReleasePostSmmPen;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ QemuCpuhpReadCommandData2 (
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
return CommandData2;
|
||||
}
|
||||
|
||||
@ -64,6 +65,7 @@ QemuCpuhpReadCpuStatus (
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
return CpuStatus;
|
||||
}
|
||||
|
||||
@ -88,6 +90,7 @@ QemuCpuhpReadCommandData (
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
return CommandData;
|
||||
}
|
||||
|
||||
@ -218,7 +221,7 @@ QemuCpuhpCollectApicIds (
|
||||
{
|
||||
UINT32 CurrentSelector;
|
||||
|
||||
if (PossibleCpuCount == 0 || ApicIdCount == 0) {
|
||||
if ((PossibleCpuCount == 0) || (ApicIdCount == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -259,10 +262,17 @@ QemuCpuhpCollectApicIds (
|
||||
QemuCpuhpWriteCommand (MmCpuIo, QEMU_CPUHP_CMD_GET_PENDING);
|
||||
PendingSelector = QemuCpuhpReadCommandData (MmCpuIo);
|
||||
if (PendingSelector < CurrentSelector) {
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u PendingSelector=%u: "
|
||||
"wrap-around\n", __FUNCTION__, CurrentSelector, PendingSelector));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: CurrentSelector=%u PendingSelector=%u: "
|
||||
"wrap-around\n",
|
||||
__FUNCTION__,
|
||||
CurrentSelector,
|
||||
PendingSelector
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
CurrentSelector = PendingSelector;
|
||||
|
||||
//
|
||||
@ -274,16 +284,26 @@ QemuCpuhpCollectApicIds (
|
||||
// The "insert" event guarantees the "enabled" status; plus it excludes
|
||||
// the "fw_remove" event.
|
||||
//
|
||||
if ((CpuStatus & QEMU_CPUHP_STAT_ENABLED) == 0 ||
|
||||
(CpuStatus & QEMU_CPUHP_STAT_FW_REMOVE) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: CurrentSelector=%u CpuStatus=0x%x: "
|
||||
"inconsistent CPU status\n", __FUNCTION__, CurrentSelector,
|
||||
CpuStatus));
|
||||
if (((CpuStatus & QEMU_CPUHP_STAT_ENABLED) == 0) ||
|
||||
((CpuStatus & QEMU_CPUHP_STAT_FW_REMOVE) != 0))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: CurrentSelector=%u CpuStatus=0x%x: "
|
||||
"inconsistent CPU status\n",
|
||||
__FUNCTION__,
|
||||
CurrentSelector,
|
||||
CpuStatus
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: insert\n", __FUNCTION__,
|
||||
CurrentSelector));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: CurrentSelector=%u: insert\n",
|
||||
__FUNCTION__,
|
||||
CurrentSelector
|
||||
));
|
||||
|
||||
ExtendIds = PluggedApicIds;
|
||||
ExtendSels = NULL;
|
||||
@ -293,14 +313,23 @@ QemuCpuhpCollectApicIds (
|
||||
// "fw_remove" event guarantees "enabled".
|
||||
//
|
||||
if ((CpuStatus & QEMU_CPUHP_STAT_ENABLED) == 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: CurrentSelector=%u CpuStatus=0x%x: "
|
||||
"inconsistent CPU status\n", __FUNCTION__, CurrentSelector,
|
||||
CpuStatus));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: CurrentSelector=%u CpuStatus=0x%x: "
|
||||
"inconsistent CPU status\n",
|
||||
__FUNCTION__,
|
||||
CurrentSelector,
|
||||
CpuStatus
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: fw_remove\n",
|
||||
__FUNCTION__, CurrentSelector));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: CurrentSelector=%u: fw_remove\n",
|
||||
__FUNCTION__,
|
||||
CurrentSelector
|
||||
));
|
||||
|
||||
ExtendIds = ToUnplugApicIds;
|
||||
ExtendSels = ToUnplugSelectors;
|
||||
@ -309,15 +338,23 @@ QemuCpuhpCollectApicIds (
|
||||
//
|
||||
// Let the OSPM deal with the "remove" event.
|
||||
//
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: remove (ignored)\n",
|
||||
__FUNCTION__, CurrentSelector));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: CurrentSelector=%u: remove (ignored)\n",
|
||||
__FUNCTION__,
|
||||
CurrentSelector
|
||||
));
|
||||
|
||||
ExtendIds = NULL;
|
||||
ExtendSels = NULL;
|
||||
ExtendCount = NULL;
|
||||
} else {
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: no event\n",
|
||||
__FUNCTION__, CurrentSelector));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: CurrentSelector=%u: no event\n",
|
||||
__FUNCTION__,
|
||||
CurrentSelector
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -334,15 +371,22 @@ QemuCpuhpCollectApicIds (
|
||||
DEBUG ((DEBUG_ERROR, "%a: APIC ID array too small\n", __FUNCTION__));
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
QemuCpuhpWriteCommand (MmCpuIo, QEMU_CPUHP_CMD_GET_ARCH_ID);
|
||||
NewApicId = QemuCpuhpReadCommandData (MmCpuIo);
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: ApicId=" FMT_APIC_ID "\n", __FUNCTION__,
|
||||
NewApicId));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: ApicId=" FMT_APIC_ID "\n",
|
||||
__FUNCTION__,
|
||||
NewApicId
|
||||
));
|
||||
if (ExtendSels != NULL) {
|
||||
ExtendSels[(*ExtendCount)] = CurrentSelector;
|
||||
}
|
||||
|
||||
ExtendIds[(*ExtendCount)++] = NewApicId;
|
||||
}
|
||||
|
||||
//
|
||||
// We've processed the CPU with (known) pending events, but we must never
|
||||
// clear events. Therefore we need to advance past this CPU manually;
|
||||
@ -352,7 +396,12 @@ QemuCpuhpCollectApicIds (
|
||||
CurrentSelector++;
|
||||
} while (CurrentSelector < PossibleCpuCount);
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: PluggedCount=%u ToUnplugCount=%u\n",
|
||||
__FUNCTION__, *PluggedCount, *ToUnplugCount));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: PluggedCount=%u ToUnplugCount=%u\n",
|
||||
__FUNCTION__,
|
||||
*PluggedCount,
|
||||
*ToUnplugCount
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -59,14 +59,23 @@ SmbaseAllocatePostSmmPen (
|
||||
//
|
||||
if (mPostSmmPenSize >= EFI_PAGE_SIZE) {
|
||||
Status = EFI_BAD_BUFFER_SIZE;
|
||||
DEBUG ((DEBUG_ERROR, "%a: mPostSmmPenSize=%u: %r\n", __FUNCTION__,
|
||||
mPostSmmPenSize, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: mPostSmmPenSize=%u: %r\n",
|
||||
__FUNCTION__,
|
||||
mPostSmmPenSize,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Address = BASE_1MB - 1;
|
||||
Status = BootServices->AllocatePages (AllocateMaxAddress,
|
||||
EfiReservedMemoryType, 1, &Address);
|
||||
Status = BootServices->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiReservedMemoryType,
|
||||
1,
|
||||
&Address
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: AllocatePages(): %r\n", __FUNCTION__, Status));
|
||||
return Status;
|
||||
@ -135,8 +144,11 @@ SmbaseInstallFirstSmiHandler (
|
||||
{
|
||||
FIRST_SMI_HANDLER_CONTEXT *Context;
|
||||
|
||||
CopyMem ((VOID *)(UINTN)(SMM_DEFAULT_SMBASE + SMM_HANDLER_OFFSET),
|
||||
mFirstSmiHandler, mFirstSmiHandlerSize);
|
||||
CopyMem (
|
||||
(VOID *)(UINTN)(SMM_DEFAULT_SMBASE + SMM_HANDLER_OFFSET),
|
||||
mFirstSmiHandler,
|
||||
mFirstSmiHandlerSize
|
||||
);
|
||||
|
||||
Context = (VOID *)(UINTN)SMM_DEFAULT_SMBASE;
|
||||
Context->ApicIdGate = MAX_UINT64;
|
||||
@ -196,8 +208,14 @@ SmbaseRelocate (
|
||||
|
||||
if (Smbase > MAX_UINT32) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
DEBUG ((DEBUG_ERROR, "%a: ApicId=" FMT_APIC_ID " Smbase=0x%Lx: %r\n",
|
||||
__FUNCTION__, ApicId, (UINT64)Smbase, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: ApicId=" FMT_APIC_ID " Smbase=0x%Lx: %r\n",
|
||||
__FUNCTION__,
|
||||
ApicId,
|
||||
(UINT64)Smbase,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -261,12 +279,21 @@ SmbaseRelocate (
|
||||
//
|
||||
// Un-gate SMBASE relocation for the hot-added CPU whose APIC ID is ApicId.
|
||||
//
|
||||
ExchangeResult = InterlockedCompareExchange64 (&Context->ApicIdGate,
|
||||
MAX_UINT64, ApicId);
|
||||
ExchangeResult = InterlockedCompareExchange64 (
|
||||
&Context->ApicIdGate,
|
||||
MAX_UINT64,
|
||||
ApicId
|
||||
);
|
||||
if (ExchangeResult != MAX_UINT64) {
|
||||
Status = EFI_PROTOCOL_ERROR;
|
||||
DEBUG ((DEBUG_ERROR, "%a: ApicId=" FMT_APIC_ID " ApicIdGate=0x%Lx: %r\n",
|
||||
__FUNCTION__, ApicId, ExchangeResult, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: ApicId=" FMT_APIC_ID " ApicIdGate=0x%Lx: %r\n",
|
||||
__FUNCTION__,
|
||||
ApicId,
|
||||
ExchangeResult,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,7 @@ AllocateZeroPages (
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
Callback function executed when the EndOfDxe event group is signaled.
|
||||
|
||||
@ -113,7 +114,7 @@ CpuS3DataOnEndOfDxe (
|
||||
EFI_STATUS Status;
|
||||
ACPI_CPU_DATA_EX *AcpiCpuDataEx;
|
||||
|
||||
AcpiCpuDataEx = (ACPI_CPU_DATA_EX *) Context;
|
||||
AcpiCpuDataEx = (ACPI_CPU_DATA_EX *)Context;
|
||||
//
|
||||
// Allocate a 4KB reserved page below 1MB
|
||||
//
|
||||
@ -178,7 +179,7 @@ CpuS3DataInitialize (
|
||||
//
|
||||
// Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA structure
|
||||
//
|
||||
OldAcpiCpuData = (ACPI_CPU_DATA *) (UINTN) PcdGet64 (PcdCpuS3DataAddress);
|
||||
OldAcpiCpuData = (ACPI_CPU_DATA *)(UINTN)PcdGet64 (PcdCpuS3DataAddress);
|
||||
|
||||
AcpiCpuDataEx = AllocateZeroPages (sizeof (ACPI_CPU_DATA_EX));
|
||||
ASSERT (AcpiCpuDataEx != NULL);
|
||||
@ -209,6 +210,7 @@ CpuS3DataInitialize (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
AcpiCpuData->NumberOfCpus = (UINT32)NumberOfCpus;
|
||||
|
||||
//
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 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.
|
||||
|
||||
@ -529,4 +520,5 @@ BOOLEAN
|
||||
HasChildHandle (
|
||||
IN EFI_HANDLE Controller
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -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.
|
||||
@ -137,7 +137,6 @@ BiosVideoComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
@ -151,12 +150,11 @@ 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,
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)BiosVideoComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)BiosVideoComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mBiosVideoDriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
|
@ -188,33 +188,33 @@ typedef struct {
|
||||
} 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 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 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 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 ExtensionFlag; // Number of (optional) 128-byte EDID extension blocks to follow
|
||||
UINT8 Checksum;
|
||||
} VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK;
|
||||
|
||||
@ -420,8 +420,8 @@ typedef struct {
|
||||
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
|
||||
MemRGB = 6, // Direct color RGB memory model
|
||||
MemYUV = 7 // Direct color YUV memory model
|
||||
} VESA_BIOS_EXTENSIONS_MEMORY_MODELS;
|
||||
|
||||
//
|
||||
|
@ -29,4 +29,3 @@ CsmSupportLibConstructor (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -46,4 +46,3 @@ LegacyBiosPlatformInstall (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -31,7 +31,6 @@ STATIC EFI_LEGACY_INTERRUPT_PROTOCOL mLegacyInterrupt = {
|
||||
|
||||
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,7 +92,7 @@ GetAddress (
|
||||
UINT8 PirqNumber
|
||||
)
|
||||
{
|
||||
return PCI_LIB_ADDRESS(
|
||||
return PCI_LIB_ADDRESS (
|
||||
LEGACY_INT_BUS,
|
||||
mLegacyInterruptDevice,
|
||||
LEGACY_INT_FUNC,
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <OvmfPlatforms.h>
|
||||
|
||||
|
||||
#define LEGACY_INT_BUS 0
|
||||
#define LEGACY_INT_DEV_PIIX4 0x01
|
||||
#define LEGACY_INT_DEV_Q35 0x1f
|
||||
@ -114,4 +113,3 @@ WritePirq (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -39,13 +39,13 @@ 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}
|
||||
{ 0x0B, 0 },
|
||||
{ 0x09, 0 },
|
||||
{ 0x0A, 0 },
|
||||
{ 0x05, 0 },
|
||||
{ 0x07, 0 },
|
||||
{ 0x00, 0 },
|
||||
{ 0x00, 0 }
|
||||
};
|
||||
|
||||
//
|
||||
@ -76,12 +76,24 @@ 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 },
|
||||
}
|
||||
};
|
||||
|
||||
@ -126,7 +138,7 @@ FindAllDeviceTypes (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiLegacyBiosProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&LegacyBios
|
||||
(VOID **)&LegacyBios
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -144,7 +156,7 @@ FindAllDeviceTypes (
|
||||
gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID**)&PciIo
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
PciIo->Pci.Read (
|
||||
PciIo,
|
||||
@ -155,7 +167,8 @@ FindAllDeviceTypes (
|
||||
);
|
||||
for (Index2 = 0; PciClasses[Index2].Class != 0xff; Index2++) {
|
||||
if ((PciConfigHeader.Hdr.ClassCode[2] == PciClasses[Index2].Class) &&
|
||||
(PciConfigHeader.Hdr.ClassCode[1] == PciClasses[Index2].SubClass)) {
|
||||
(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++;
|
||||
}
|
||||
}
|
||||
@ -255,7 +269,7 @@ GetSelectedVgaDeviceInfo (
|
||||
//
|
||||
HandleCount = 0;
|
||||
HandleBuffer = NULL;
|
||||
SelectedAddress = PCI_LIB_ADDRESS(0xff, 0x1f, 0x7, 0);
|
||||
SelectedAddress = PCI_LIB_ADDRESS (0xff, 0x1f, 0x7, 0);
|
||||
|
||||
//
|
||||
// The bus range to search for a VGA device in.
|
||||
@ -279,13 +293,13 @@ GetSelectedVgaDeviceInfo (
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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,7 +335,7 @@ 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];
|
||||
@ -330,7 +346,6 @@ GetSelectedVgaDeviceInfo (
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns a buffer of handles for the requested subfunction.
|
||||
|
||||
@ -384,7 +399,7 @@ GetPlatformHandle (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiLegacyBiosProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&LegacyBios
|
||||
(VOID **)&LegacyBios
|
||||
);
|
||||
|
||||
//
|
||||
@ -402,7 +417,7 @@ GetPlatformHandle (
|
||||
case EfiGetPlatformIdeHandle:
|
||||
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,7 +464,7 @@ GetPlatformHandle (
|
||||
//
|
||||
PriorityIndex = 0;
|
||||
for (Index = 0; Index < LocalIndex; Index++) {
|
||||
if (LocalDevice[Index].Handle == IdeHandle && PriorityIndex == 0) {
|
||||
if ((LocalDevice[Index].Handle == IdeHandle) && (PriorityIndex == 0)) {
|
||||
TempDevice = LocalDevice[PriorityIndex];
|
||||
LocalDevice[PriorityIndex] = LocalDevice[Index];
|
||||
LocalDevice[Index] = TempDevice;
|
||||
@ -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,
|
||||
@ -529,6 +546,7 @@ GetPlatformHandle (
|
||||
HddInfo[HddIndex].ControlBaseAddress = 0x3f6;
|
||||
HddInfo[HddIndex].BusMasterAddress = 0;
|
||||
}
|
||||
|
||||
HddIndex++;
|
||||
|
||||
//
|
||||
@ -548,22 +566,24 @@ GetPlatformHandle (
|
||||
HddInfo[HddIndex].ControlBaseAddress = 0x376;
|
||||
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;
|
||||
}
|
||||
@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -631,7 +652,7 @@ PlatformHooks (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiLegacyBiosProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&LegacyBios
|
||||
(VOID **)&LegacyBios
|
||||
);
|
||||
|
||||
//
|
||||
@ -646,7 +667,7 @@ PlatformHooks (
|
||||
case EfiPlatformHookAfterRomInit:
|
||||
default:
|
||||
return EFI_UNSUPPORTED;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -699,7 +720,7 @@ GetRoutingTable (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiLegacyInterruptProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&LegacyInterrupt
|
||||
(VOID **)&LegacyInterrupt
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
LegacyInterrupt->GetLocation (
|
||||
@ -714,23 +735,24 @@ 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);
|
||||
Checksum = (UINT8)(Checksum + (UINT8)*Ptr);
|
||||
Ptr += 1;
|
||||
}
|
||||
Checksum = (UINT8) (0x00 - Checksum);
|
||||
|
||||
Checksum = (UINT8)(0x00 - Checksum);
|
||||
PirqTableHead.PirqTable.Checksum = Checksum;
|
||||
|
||||
//
|
||||
// Update return values.
|
||||
//
|
||||
*LocalPirqTable = (VOID *) (&PirqTableHead);
|
||||
*LocalPirqTable = (VOID *)(&PirqTableHead);
|
||||
*PirqTableSize = PTableSize;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -849,15 +872,16 @@ TranslatePirq (
|
||||
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,7 +891,8 @@ TranslatePirq (
|
||||
while (PirqData == 0) {
|
||||
for (Index1 = 0; Index1 < MAX_IRQ_PRIORITY_ENTRIES; Index1++) {
|
||||
if ((IrqPriorityTable[Index1].Used == MatchData) &&
|
||||
(IrqPriorityTable[Index1].Irq != 0)) {
|
||||
(IrqPriorityTable[Index1].Irq != 0))
|
||||
{
|
||||
PirqData = IrqPriorityTable[Index1].Irq;
|
||||
IrqPriorityTable[Index1].Used = 0xff;
|
||||
LegacyInterrupt->WritePirq (
|
||||
@ -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.
|
||||
@ -933,7 +956,7 @@ PrepareToBoot (
|
||||
// Initialize values
|
||||
//
|
||||
Priority = 0;
|
||||
Legacy16BootTable = (EFI_TO_COMPATIBILITY16_BOOT_TABLE*) EfiToLegacy16BootTable;
|
||||
Legacy16BootTable = (EFI_TO_COMPATIBILITY16_BOOT_TABLE *)EfiToLegacy16BootTable;
|
||||
|
||||
//
|
||||
// Set how Gate A20 is gated by hardware
|
||||
@ -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
|
||||
|
||||
|
@ -95,4 +95,3 @@ typedef struct {
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -30,51 +30,51 @@
|
||||
// 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}
|
||||
{ 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;
|
||||
@ -112,11 +112,12 @@ LegacyRegionManipulationInternal (
|
||||
//
|
||||
// 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;
|
||||
@ -189,20 +193,21 @@ LegacyRegionGetInfoInternal (
|
||||
//
|
||||
// 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);
|
||||
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.
|
||||
|
||||
@ -292,7 +296,6 @@ LegacyRegion2BootLock (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Modify the hardware to disallow memory writes in a region.
|
||||
|
||||
@ -328,7 +331,6 @@ LegacyRegion2Lock (
|
||||
return LegacyRegionManipulationInternal (Start, Length, NULL, &WriteEnable, Granularity);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Modify the hardware to allow memory writes in a region.
|
||||
|
||||
@ -420,6 +422,7 @@ LegacyRegionGetInfo (
|
||||
} else {
|
||||
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;
|
||||
@ -477,8 +481,12 @@ LegacyRegionInit (
|
||||
mRegisterValues = mRegisterValuesQ35;
|
||||
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 RETURN_UNSUPPORTED;
|
||||
}
|
||||
@ -488,11 +496,11 @@ LegacyRegionInit (
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mHandle,
|
||||
&gEfiLegacyRegion2ProtocolGuid, &mLegacyRegion2,
|
||||
&gEfiLegacyRegion2ProtocolGuid,
|
||||
&mLegacyRegion2,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -200,4 +200,3 @@ LegacyRegionGetInfo (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -37,5 +37,4 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
///
|
||||
#define FRAMEWORK_EFI_BOOT_SCRIPT_TERMINATE_OPCODE 0xFF
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -167,4 +167,3 @@ typedef struct {
|
||||
#define EFI_EVENT_SIGNAL_LEGACY_BOOT 0x00000204
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,7 @@ 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)) \
|
||||
)
|
||||
|
@ -96,7 +96,6 @@ typedef UINT16 STRING_REF;
|
||||
///
|
||||
#define EFI_IFR_FLAG_CREATED 128
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
// IFR Structure definitions
|
||||
@ -236,7 +235,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId;///< The ID designating what the question is about...
|
||||
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.
|
||||
|
@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef _FIRMWARE_VOLUME_H_
|
||||
#define _FIRMWARE_VOLUME_H_
|
||||
|
||||
|
||||
//
|
||||
// Firmware Volume Protocol GUID definition
|
||||
//
|
||||
|
@ -105,7 +105,7 @@ typedef struct {
|
||||
|
||||
///
|
||||
/// 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;
|
||||
|
||||
@ -363,7 +363,6 @@ typedef enum {
|
||||
Legacy16InstallPciHandler = 0x0008
|
||||
} EFI_COMPATIBILITY_FUNCTIONS;
|
||||
|
||||
|
||||
///
|
||||
/// EFI_DISPATCH_OPROM_TABLE
|
||||
///
|
||||
@ -382,7 +381,6 @@ typedef struct {
|
||||
///< 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;
|
||||
|
||||
///
|
||||
@ -462,7 +460,7 @@ typedef struct {
|
||||
#define DEVICE_SERIAL_MODE_ASK_IR 0x02
|
||||
#define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
|
||||
#define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
|
||||
///@)
|
||||
/// @)
|
||||
|
||||
///
|
||||
/// DEVICE_PRODUCER_PARALLEL.
|
||||
@ -1017,23 +1015,23 @@ typedef struct _EFI_LEGACY_BIOS_PROTOCOL EFI_LEGACY_BIOS_PROTOCOL;
|
||||
/// 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;
|
||||
|
||||
///
|
||||
@ -1061,21 +1059,21 @@ typedef struct {
|
||||
/// 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;
|
||||
|
||||
///
|
||||
|
@ -147,56 +147,56 @@ 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,
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
@ -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.
|
||||
@ -496,7 +496,6 @@ typedef struct {
|
||||
UINT8 Checksum;
|
||||
} EFI_LEGACY_PIRQ_TABLE_HEADER;
|
||||
|
||||
|
||||
typedef struct {
|
||||
///
|
||||
/// If nonzero, a value assigned by the IBV.
|
||||
@ -533,7 +532,6 @@ typedef struct {
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
/**
|
||||
Finds the binary data or other platform information.
|
||||
|
||||
|
@ -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 } \
|
||||
|
@ -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.
|
||||
|
||||
@ -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,12 +321,15 @@ 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;
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -431,8 +438,8 @@ LegacyBiosGetBbsInfo (
|
||||
LEGACY_BIOS_INSTANCE *Private;
|
||||
EFI_IA32_REGISTER_SET Regs;
|
||||
EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
|
||||
// HDD_INFO *LocalHddInfo;
|
||||
// IN BBS_TABLE *LocalBbsTable;
|
||||
// HDD_INFO *LocalHddInfo;
|
||||
// IN BBS_TABLE *LocalBbsTable;
|
||||
UINTN NumHandles;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
@ -443,8 +450,8 @@ LegacyBiosGetBbsInfo (
|
||||
|
||||
Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
|
||||
EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
|
||||
// LocalHddInfo = EfiToLegacy16BootTable->HddInfo;
|
||||
// LocalBbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
|
||||
// LocalHddInfo = EfiToLegacy16BootTable->HddInfo;
|
||||
// LocalBbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
|
||||
|
||||
if (!mBbsTableDoneFlag) {
|
||||
mBbsTable = Private->BbsTablePtr;
|
||||
@ -475,7 +482,6 @@ LegacyBiosGetBbsInfo (
|
||||
// PCI bus driver enumerate all subsequent handles
|
||||
//
|
||||
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, FALSE);
|
||||
|
||||
}
|
||||
|
||||
LegacyBiosBuildBbs (Private, mBbsTable);
|
||||
@ -491,9 +497,9 @@ 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,
|
||||
@ -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;
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ LegacyBiosInitBda (
|
||||
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);
|
||||
|
@ -64,7 +64,7 @@ AllocateLegacyMemory (
|
||||
//
|
||||
// Allocate Pages of memory less <= StartPageAddress
|
||||
//
|
||||
MemPage = (EFI_PHYSICAL_ADDRESS) (UINTN) StartPageAddress;
|
||||
MemPage = (EFI_PHYSICAL_ADDRESS)(UINTN)StartPageAddress;
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateType,
|
||||
MemoryType,
|
||||
@ -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.
|
||||
@ -133,7 +133,6 @@ LegacyBiosGetLegacyRegion (
|
||||
OUT VOID **LegacyMemoryAddress
|
||||
)
|
||||
{
|
||||
|
||||
LEGACY_BIOS_INSTANCE *Private;
|
||||
EFI_IA32_REGISTER_SET Regs;
|
||||
EFI_STATUS Status;
|
||||
@ -144,9 +143,9 @@ LegacyBiosGetLegacyRegion (
|
||||
|
||||
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,
|
||||
@ -157,7 +156,7 @@ LegacyBiosGetLegacyRegion (
|
||||
);
|
||||
|
||||
if (Regs.X.AX == 0) {
|
||||
*LegacyMemoryAddress = (VOID *) (((UINTN) Regs.X.DS << 4) + Regs.X.BX);
|
||||
*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().
|
||||
@ -193,15 +191,16 @@ LegacyBiosCopyLegacyRegion (
|
||||
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
|
||||
@ -314,9 +312,9 @@ ShadowAndStartLegacy16 (
|
||||
return Status;
|
||||
}
|
||||
|
||||
Private->BiosStart = (UINT32) (0x100000 - LegacyBiosImageSize);
|
||||
Private->BiosStart = (UINT32)(0x100000 - LegacyBiosImageSize);
|
||||
Private->OptionRom = 0xc0000;
|
||||
Private->LegacyBiosImageSize = (UINT32) LegacyBiosImageSize;
|
||||
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;
|
||||
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;
|
||||
@ -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,17 +421,17 @@ 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,
|
||||
@ -447,7 +445,7 @@ ShadowAndStartLegacy16 (
|
||||
//
|
||||
// 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,7 +467,7 @@ 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,
|
||||
@ -480,14 +478,15 @@ ShadowAndStartLegacy16 (
|
||||
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.
|
||||
//
|
||||
@ -511,6 +510,7 @@ ShadowAndStartLegacy16 (
|
||||
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,10 +527,9 @@ 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,
|
||||
@ -541,21 +540,21 @@ ShadowAndStartLegacy16 (
|
||||
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
|
||||
@ -564,7 +563,7 @@ ShadowAndStartLegacy16 (
|
||||
ZeroMem ((VOID *)BbsTable, sizeof (Private->IntThunk->BbsTable));
|
||||
|
||||
EfiToLegacy16BootTable->BbsTable = (UINT32)(UINTN)BbsTable;
|
||||
Private->BbsTablePtr = (VOID *) 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;
|
||||
@ -684,6 +684,7 @@ GetPciInterfaceVersion (
|
||||
PciInterfaceVersion = Reg.X.BX;
|
||||
}
|
||||
}
|
||||
|
||||
return PciInterfaceVersion;
|
||||
}
|
||||
|
||||
@ -717,7 +718,7 @@ InstallSmbiosEventCallback (
|
||||
return;
|
||||
}
|
||||
|
||||
EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) mRuntimeSmbiosEntryPoint;
|
||||
EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)mRuntimeSmbiosEntryPoint;
|
||||
|
||||
//
|
||||
// Allocate memory for SMBIOS Entry Point Structure.
|
||||
@ -731,18 +732,20 @@ InstallSmbiosEventCallback (
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiReservedMemoryType,
|
||||
EFI_SIZE_TO_PAGES ((UINTN) (EntryPointStructure->EntryPointLength)),
|
||||
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
|
||||
//
|
||||
@ -768,13 +771,14 @@ InstallSmbiosEventCallback (
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePages (
|
||||
mReserveSmbiosEntryPoint,
|
||||
EFI_SIZE_TO_PAGES ((UINTN) (EntryPointStructure->EntryPointLength))
|
||||
EFI_SIZE_TO_PAGES ((UINTN)(EntryPointStructure->EntryPointLength))
|
||||
);
|
||||
mReserveSmbiosEntryPoint = 0;
|
||||
mStructureTableAddress = 0;
|
||||
mStructureTablePages = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Allocate memory for Smbios Structure Table\n"));
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
@ -994,15 +1001,15 @@ 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);
|
||||
);
|
||||
|
||||
//
|
||||
@ -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
|
||||
@ -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,13 +1143,14 @@ 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,
|
||||
(VOID *)(UINTN)InterruptRedirectionTemplate,
|
||||
sizeof (Private->IntThunk->InterruptRedirectionCode)
|
||||
);
|
||||
|
||||
@ -1149,18 +1158,19 @@ LegacyBiosInstall (
|
||||
// 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);
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
//
|
||||
// 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
|
||||
@ -1206,9 +1216,11 @@ LegacyBiosInstall (
|
||||
);
|
||||
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;
|
||||
|
@ -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>
|
||||
@ -591,10 +590,8 @@ typedef struct {
|
||||
// CSM16 PCI Interface Version
|
||||
//
|
||||
UINT16 Csm16PciInterfaceVersion;
|
||||
|
||||
} LEGACY_BIOS_INSTANCE;
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/*
|
||||
@ -699,7 +696,6 @@ LegacyBiosInt86 (
|
||||
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
|
||||
@ -729,7 +725,6 @@ LegacyBiosFarCall86 (
|
||||
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.
|
||||
@ -755,7 +750,6 @@ LegacyBiosCheckPciRom (
|
||||
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.
|
||||
@ -777,7 +771,6 @@ LegacyBiosPrepareToBootEfi (
|
||||
OUT BBS_TABLE **BbsTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
To boot from an unconventional device like parties and/or execute
|
||||
HDD diagnostics.
|
||||
@ -803,7 +796,6 @@ LegacyBiosBootUnconventionalDevice (
|
||||
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,7 +826,7 @@ LegacyBiosBootUnconventionalDevice (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
LegacyBiosInstallPciRom (
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL * This,
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL *This,
|
||||
IN EFI_HANDLE PciHandle,
|
||||
IN VOID **RomImage,
|
||||
OUT UINTN *Flags,
|
||||
@ -844,7 +836,6 @@ LegacyBiosInstallPciRom (
|
||||
OUT UINT32 *RomShadowedSize OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Fill in the standard BDA for Keyboard LEDs
|
||||
|
||||
@ -861,7 +852,6 @@ LegacyBiosUpdateKeyboardLedStatus (
|
||||
IN UINT8 Leds
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Get all BBS info
|
||||
|
||||
@ -886,7 +876,6 @@ LegacyBiosGetBbsInfo (
|
||||
OUT BBS_TABLE **BbsTable
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Shadow all legacy16 OPROMs that haven't been shadowed.
|
||||
Warning: Use this with caution. This routine disconnects all EFI
|
||||
@ -904,7 +893,6 @@ LegacyBiosShadowAllLegacyOproms (
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL *This
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Attempt to legacy boot the BootOption. If the EFI contexted has been
|
||||
compromised this function will not return.
|
||||
@ -926,7 +914,6 @@ LegacyBiosLegacyBoot (
|
||||
IN VOID *LoadOptions
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Allocate memory < 1 MB and copy the thunker code into low memory. Se up
|
||||
all the descriptors.
|
||||
@ -941,7 +928,6 @@ LegacyBiosInitializeThunk (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Fill in the standard BDA and EBDA stuff before Legacy16 load
|
||||
|
||||
@ -955,7 +941,6 @@ LegacyBiosInitBda (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Collect IDE Inquiry data from the IDE disks
|
||||
|
||||
@ -973,7 +958,6 @@ LegacyBiosBuildIdeData (
|
||||
IN UINT16 Flag
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Enable ide controller. This gets disabled when LegacyBoot.c is about
|
||||
to run the Option ROMs.
|
||||
@ -987,7 +971,6 @@ EnableIdeController (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
If the IDE channel is in compatibility (legacy) mode, remove all
|
||||
PCI I/O BAR addresses from the controller.
|
||||
@ -1001,7 +984,6 @@ InitLegacyIdeController (
|
||||
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.
|
||||
@ -1017,7 +999,6 @@ PciProgramAllInterruptLineRegisters (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Collect EFI Info about legacy devices.
|
||||
|
||||
@ -1031,7 +1012,6 @@ LegacyBiosBuildSioData (
|
||||
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
|
||||
@ -1048,7 +1028,6 @@ PciShadowRoms (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Fill in the standard BDA and EBDA stuff prior to legacy Boot
|
||||
|
||||
@ -1062,7 +1041,6 @@ LegacyBiosCompleteBdaBeforeBoot (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Fill in the standard CMOS stuff before Legacy16 load
|
||||
|
||||
@ -1076,7 +1054,6 @@ LegacyBiosInitCmos (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Fill in the standard CMOS stuff prior to legacy Boot
|
||||
|
||||
@ -1090,7 +1067,6 @@ LegacyBiosCompleteStandardCmosBeforeBoot (
|
||||
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.
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,7 +131,7 @@ PrintHddInfo (
|
||||
|
||||
DEBUG ((DEBUG_INFO, "\n"));
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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) {
|
||||
@ -271,11 +283,11 @@ UpdateSioData (
|
||||
|
||||
Private->LegacyBiosPlatform->GetRoutingTable (
|
||||
Private->LegacyBiosPlatform,
|
||||
(VOID *) &RoutingTable,
|
||||
(VOID *)&RoutingTable,
|
||||
&RoutingTableEntries,
|
||||
NULL,
|
||||
NULL,
|
||||
(VOID **) &IrqPriorityTable,
|
||||
(VOID **)&IrqPriorityTable,
|
||||
&NumberPriorityEntries
|
||||
);
|
||||
//
|
||||
@ -284,7 +296,7 @@ UpdateSioData (
|
||||
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;
|
||||
}
|
||||
@ -304,7 +316,7 @@ UpdateSioData (
|
||||
// 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,
|
||||
@ -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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,6 +376,7 @@ CalculateIdentifyDriveChecksum (
|
||||
{
|
||||
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.
|
||||
|
||||
@ -406,11 +416,12 @@ UpdateIdentifyDriveData (
|
||||
// Status indicates if Integrity byte is correct. Checksum should be
|
||||
// 0 if valid.
|
||||
//
|
||||
ReadInfo = (ATAPI_IDENTIFY *) IdentifyDriveData;
|
||||
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).
|
||||
//
|
||||
@ -427,10 +438,10 @@ UpdateIdentifyDriveData (
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -512,7 +523,7 @@ EnableIdeController (
|
||||
Status = gBS->HandleProtocol (
|
||||
IdeController,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
ByteBuffer = 0x1f;
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@ -521,7 +532,6 @@ EnableIdeController (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Enable ide controller. This gets disabled when LegacyBoot.c is about
|
||||
to run the Option ROMs.
|
||||
@ -563,7 +573,7 @@ EnableAllControllers (
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -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);
|
||||
@ -660,7 +670,7 @@ LegacyGetDataOrTable (
|
||||
Status = LegacyBiosPlatform->GetPlatformInfo (
|
||||
LegacyBiosPlatform,
|
||||
Id,
|
||||
(VOID *) &Table,
|
||||
(VOID *)&Table,
|
||||
&TableSize,
|
||||
&Location,
|
||||
&Alignment,
|
||||
@ -684,9 +694,9 @@ 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,
|
||||
@ -703,13 +713,14 @@ LegacyGetDataOrTable (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Phase 2 Call routine second time with address to allow address adjustment
|
||||
//
|
||||
Status = LegacyBiosPlatform->GetPlatformInfo (
|
||||
LegacyBiosPlatform,
|
||||
Id,
|
||||
(VOID *) &Table,
|
||||
(VOID *)&Table,
|
||||
&TableSize,
|
||||
&Location,
|
||||
&Alignment,
|
||||
@ -719,7 +730,7 @@ LegacyGetDataOrTable (
|
||||
switch (Id) {
|
||||
case EfiGetPlatformBinaryMpTable:
|
||||
{
|
||||
Legacy16Table->MpTablePtr = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
|
||||
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;
|
||||
@ -727,7 +738,6 @@ LegacyGetDataOrTable (
|
||||
|
||||
case EfiGetPlatformBinaryOemIntData:
|
||||
{
|
||||
|
||||
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));
|
||||
@ -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
|
||||
);
|
||||
@ -787,17 +798,18 @@ CreateSmbiosTableInReservedMemory (
|
||||
|
||||
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
|
||||
);
|
||||
@ -806,16 +818,16 @@ CreateSmbiosTableInReservedMemory (
|
||||
// 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
|
||||
@ -825,11 +837,11 @@ CreateSmbiosTableInReservedMemory (
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -911,6 +923,7 @@ GenericLegacyBoot (
|
||||
IdeController = HandleBuffer[0];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Unlock the Legacy BIOS region
|
||||
//
|
||||
@ -928,9 +941,9 @@ 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,
|
||||
@ -940,25 +953,25 @@ GenericLegacyBoot (
|
||||
0
|
||||
);
|
||||
|
||||
Private->Legacy16Table->E820Pointer = (UINT32) (Regs.X.DS * 16 + Regs.X.BX);
|
||||
Private->Legacy16Table->E820Length = (UINT32) CopySize;
|
||||
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,6 +980,7 @@ GenericLegacyBoot (
|
||||
if (mReserveSmbiosEntryPoint == 0) {
|
||||
DEBUG ((DEBUG_INFO, "Smbios table is not found!\n"));
|
||||
}
|
||||
|
||||
CreateSmbiosTableInReservedMemory ();
|
||||
EfiToLegacy16BootTable->SmbiosTable = (UINT32)(UINTN)mReserveSmbiosEntryPoint;
|
||||
|
||||
@ -981,12 +995,14 @@ GenericLegacyBoot (
|
||||
&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,6 +1050,7 @@ GenericLegacyBoot (
|
||||
if ((mBootMode == BOOT_LEGACY_OS) || (mBootMode == BOOT_UNCONVENTIONAL_DEVICE)) {
|
||||
UpdateSioData (Private);
|
||||
}
|
||||
|
||||
//
|
||||
// Setup BDA and EBDA standard areas before Legacy Boot
|
||||
//
|
||||
@ -1072,7 +1089,7 @@ GenericLegacyBoot (
|
||||
//
|
||||
LocalTime = (LocalTime * 182) / 10;
|
||||
ACCESS_PAGE0_CODE (
|
||||
BdaPtr = (UINT32 *) (UINTN)0x46C;
|
||||
BdaPtr = (UINT32 *)(UINTN)0x46C;
|
||||
*BdaPtr = LocalTime;
|
||||
);
|
||||
|
||||
@ -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
|
||||
//
|
||||
@ -1229,6 +1251,7 @@ GenericLegacyBoot (
|
||||
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,13 +1347,14 @@ 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);
|
||||
if (Private->ThunkSeg == (UINT16)(BaseVectorMaster[Index] >> 16)) {
|
||||
BaseVectorMaster[Index] = (UINT32)(Private->BiosUnexpectedInt);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
|
||||
@ -1343,12 +1370,14 @@ 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++) {
|
||||
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.
|
||||
@ -1395,8 +1423,8 @@ LegacyBiosPrepareToBootEfi (
|
||||
mBootMode = BOOT_EFI_OS;
|
||||
mBbsDevicePathPtr = NULL;
|
||||
Status = GenericLegacyBoot (This);
|
||||
*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 Status;
|
||||
}
|
||||
|
||||
@ -1449,17 +1477,19 @@ 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 (
|
||||
UcdTable = (UD_TABLE *)AllocatePool (
|
||||
sizeof (UD_TABLE)
|
||||
);
|
||||
if (NULL == UcdTable) {
|
||||
@ -1468,39 +1498,41 @@ LegacyBiosBootUnconventionalDevice (
|
||||
|
||||
EfiToLegacy16BootTable->UnconventionalDeviceTable = (UINT32)(UINTN)UcdTable;
|
||||
UcdTable->Attributes = Attributes;
|
||||
UcdTable->BbsTableEntryNumberForParentDevice = (UINT8) BbsEntry;
|
||||
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,7 +1555,7 @@ 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;
|
||||
@ -1537,15 +1569,15 @@ 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);
|
||||
UcdTable->BbsTableEntryNumberForBoot = (UINT8)(EfiToLegacy16BootTable->NumberBbsEntries - 1);
|
||||
BbsTable[EfiToLegacy16BootTable->NumberBbsEntries].BootPriority = BootPriority;
|
||||
|
||||
//
|
||||
@ -1553,6 +1585,7 @@ LegacyBiosBootUnconventionalDevice (
|
||||
//
|
||||
mBbsDevicePathNode.DeviceType = BBS_TYPE_FLOPPY;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the BBS Device Path for this boot selection
|
||||
//
|
||||
@ -1689,7 +1722,7 @@ LegacyBiosBuildE820 (
|
||||
UINTN Above1MIndex;
|
||||
UINT64 MemoryBlockLength;
|
||||
|
||||
E820Table = (EFI_E820_ENTRY64 *) Private->E820Table;
|
||||
E820Table = (EFI_E820_ENTRY64 *)Private->E820Table;
|
||||
|
||||
//
|
||||
// Get the EFI memory map.
|
||||
@ -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,
|
||||
@ -1737,7 +1770,7 @@ LegacyBiosBuildE820 (
|
||||
//
|
||||
ACCESS_PAGE0_CODE (
|
||||
E820Table[0].BaseAddr = 0;
|
||||
E820Table[0].Length = (UINT64) ((*(UINT16 *) (UINTN)0x40E) << 4);
|
||||
E820Table[0].Length = (UINT64)((*(UINT16 *)(UINTN)0x40E) << 4);
|
||||
E820Table[0].Type = EfiAcpiAddressRangeMemory;
|
||||
);
|
||||
|
||||
@ -1745,7 +1778,7 @@ LegacyBiosBuildE820 (
|
||||
// Second entry is (640k - EBDA) to 640k
|
||||
//
|
||||
E820Table[1].BaseAddr = E820Table[0].Length;
|
||||
E820Table[1].Length = (UINT64) ((640 * 1024) - E820Table[0].Length);
|
||||
E820Table[1].Length = (UINT64)((640 * 1024) - E820Table[0].Length);
|
||||
E820Table[1].Type = EfiAcpiAddressRangeReserved;
|
||||
|
||||
//
|
||||
@ -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) {
|
||||
@ -1792,9 +1825,9 @@ LegacyBiosBuildE820 (
|
||||
}
|
||||
|
||||
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
|
||||
@ -1828,6 +1861,7 @@ LegacyBiosBuildE820 (
|
||||
E820Table[Index].Type = TempType;
|
||||
}
|
||||
}
|
||||
|
||||
EfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
|
||||
}
|
||||
|
||||
@ -1837,13 +1871,14 @@ 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_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;
|
||||
@ -1852,11 +1887,11 @@ LegacyBiosBuildE820 (
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
*Size = (UINTN)(Index * sizeof (EFI_E820_ENTRY64));
|
||||
|
||||
//
|
||||
// Sort E820Table from low to high
|
||||
@ -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))) {
|
||||
(E820Table[TempIndex].BaseAddr +E820Table[TempIndex].Length)))
|
||||
{
|
||||
//
|
||||
//Overlap range is found
|
||||
// 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;
|
||||
E820Table[TempIndex].Type = (EFI_ACPI_MEMORY_TYPE)0;
|
||||
Index--;
|
||||
break;
|
||||
} else {
|
||||
for (IndexSort = TempIndex; IndexSort < Index - 1; IndexSort ++) {
|
||||
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));
|
||||
*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
|
||||
|
||||
@ -1973,7 +2010,7 @@ LegacyBiosCompleteBdaBeforeBoot (
|
||||
UINT16 MachineConfig;
|
||||
DEVICE_PRODUCER_DATA_HEADER *SioPtr;
|
||||
|
||||
Bda = (BDA_STRUC *) ((UINTN) 0x400);
|
||||
Bda = (BDA_STRUC *)((UINTN)0x400);
|
||||
MachineConfig = 0;
|
||||
|
||||
SioPtr = &(Private->IntThunk->EfiToLegacy16BootTable.SioData);
|
||||
@ -2014,9 +2051,9 @@ 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);
|
||||
MachineConfig = (UINT16)(MachineConfig + 0x01 + (SioPtr->Floppy.NumberOfFloppy - 1) * 0x40);
|
||||
Bda->FloppyXRate = 0x07;
|
||||
}
|
||||
|
||||
@ -2028,7 +2065,7 @@ LegacyBiosCompleteBdaBeforeBoot (
|
||||
//
|
||||
// Force VGA and Coprocessor, indicate 101/102 keyboard
|
||||
//
|
||||
MachineConfig = (UINT16) (MachineConfig + 0x00 + 0x02 + (SioPtr->MousePresent * 0x04));
|
||||
MachineConfig = (UINT16)(MachineConfig + 0x00 + 0x02 + (SioPtr->MousePresent * 0x04));
|
||||
Bda->MachineConfig = MachineConfig;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -2058,13 +2095,13 @@ LegacyBiosUpdateKeyboardLedStatus (
|
||||
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);
|
||||
);
|
||||
|
||||
//
|
||||
@ -2086,7 +2123,6 @@ LegacyBiosUpdateKeyboardLedStatus (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Fill in the standard CMOS stuff prior to legacy Boot
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -66,7 +66,7 @@ LegacyBiosBuildIdeData (
|
||||
0,
|
||||
&HandleBuffer,
|
||||
&HandleCount,
|
||||
(VOID *) &LocalHddInfo
|
||||
(VOID *)&LocalHddInfo
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
IdeController = HandleBuffer[0];
|
||||
@ -93,7 +93,7 @@ LegacyBiosBuildIdeData (
|
||||
0,
|
||||
&HandleBuffer,
|
||||
&HandleCount,
|
||||
(VOID *) &LocalHddInfo
|
||||
(VOID *)&LocalHddInfo
|
||||
);
|
||||
}
|
||||
|
||||
@ -110,12 +110,12 @@ LegacyBiosBuildIdeData (
|
||||
&HandleBuffer
|
||||
);
|
||||
|
||||
Private->IdeDriveCount = (UINT8) HandleCount;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -192,7 +195,7 @@ LegacyBiosBuildIdeData (
|
||||
&InquiryDataSize
|
||||
);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
InquiryData = (UINT8 *) AllocatePool (
|
||||
InquiryData = (UINT8 *)AllocatePool (
|
||||
InquiryDataSize
|
||||
);
|
||||
if (InquiryData != NULL) {
|
||||
@ -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.
|
||||
@ -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;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
||||
@ -81,24 +82,24 @@ LegacyBiosBuildSioDataFromSio (
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
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);
|
||||
IrqResource = (EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR *)Resources.SmallHeader;
|
||||
Irq = (UINT8)LowBitSet32 (IrqResource->Mask);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -106,11 +107,11 @@ LegacyBiosBuildSioDataFromSio (
|
||||
}
|
||||
|
||||
if (Resources.SmallHeader->Bits.Type == 0) {
|
||||
Resources.SmallHeader = (ACPI_SMALL_RESOURCE_HEADER *) ((UINT8 *) 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 = (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,9 +157,10 @@ 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;
|
||||
@ -172,14 +174,15 @@ 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) {
|
||||
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;
|
||||
@ -187,12 +190,13 @@ LegacyBiosBuildSioDataFromSio (
|
||||
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;
|
||||
@ -202,6 +206,7 @@ LegacyBiosBuildSioDataFromSio (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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,7 +303,8 @@ LegacyBiosBuildSioDataFromIsaIo (
|
||||
for (ResourceIndex = 0;
|
||||
ResourceList->ResourceItem[ResourceIndex].Type != EfiIsaAcpiResourceEndOfList;
|
||||
ResourceIndex++
|
||||
) {
|
||||
)
|
||||
{
|
||||
switch (ResourceList->ResourceItem[ResourceIndex].Type) {
|
||||
case EfiIsaAcpiResourceIo:
|
||||
IoResource = &ResourceList->ResourceItem[ResourceIndex];
|
||||
@ -319,17 +325,18 @@ LegacyBiosBuildSioDataFromIsaIo (
|
||||
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,16 +349,17 @@ 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->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
|
||||
) {
|
||||
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->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->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
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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
|
||||
@ -237,13 +237,16 @@ InternalLegacyBiosFarCall (
|
||||
if (Status == EFI_ALREADY_STARTED) {
|
||||
Count++;
|
||||
}
|
||||
|
||||
if (Status == EFI_SUCCESS) {
|
||||
Private->Cpu->RegisterInterruptHandler (Private->Cpu, Vector, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
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,8 +267,8 @@ InternalLegacyBiosFarCall (
|
||||
CopyMem (Stack16, Stack, StackSize);
|
||||
}
|
||||
|
||||
ThunkRegSet.E.SS = (UINT16) (((UINTN) Stack16 >> 16) << 12);
|
||||
ThunkRegSet.E.ESP = (UINT16) (UINTN) Stack16;
|
||||
ThunkRegSet.E.SS = (UINT16)(((UINTN)Stack16 >> 16) << 12);
|
||||
ThunkRegSet.E.ESP = (UINT16)(UINTN)Stack16;
|
||||
ThunkRegSet.E.CS = Segment;
|
||||
ThunkRegSet.E.Eip = Offset;
|
||||
|
||||
@ -279,7 +282,7 @@ InternalLegacyBiosFarCall (
|
||||
|
||||
AsmThunk16 (&mThunkContext);
|
||||
|
||||
if (Stack != NULL && StackSize != 0) {
|
||||
if ((Stack != NULL) && (StackSize != 0)) {
|
||||
//
|
||||
// Copy low memory stack to Stack
|
||||
//
|
||||
@ -316,7 +319,7 @@ InternalLegacyBiosFarCall (
|
||||
UINTN ReservedEbdaBaseAddress;
|
||||
|
||||
ACCESS_PAGE0_CODE (
|
||||
EbdaBaseAddress = (*(UINT16 *) (UINTN) 0x40E) << 4;
|
||||
EbdaBaseAddress = (*(UINT16 *)(UINTN)0x40E) << 4;
|
||||
ReservedEbdaBaseAddress = CONVENTIONAL_MEMORY_TOP
|
||||
- PcdGet32 (PcdEbdaReservedMemorySize);
|
||||
ASSERT (ReservedEbdaBaseAddress <= EbdaBaseAddress);
|
||||
@ -343,7 +346,7 @@ InternalLegacyBiosFarCall (
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -364,9 +367,9 @@ LegacyBiosInitializeThunk (
|
||||
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;
|
||||
|
||||
|
@ -7,22 +7,20 @@ 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};
|
||||
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_SIGNATURE,
|
||||
{NULL},
|
||||
{ NULL },
|
||||
0
|
||||
};
|
||||
|
||||
@ -31,7 +29,7 @@ LEGACY_MENU_OPTION LegacyFDMenu = {
|
||||
///
|
||||
LEGACY_MENU_OPTION LegacyHDMenu = {
|
||||
LEGACY_MENU_OPTION_SIGNATURE,
|
||||
{NULL},
|
||||
{ NULL },
|
||||
0
|
||||
};
|
||||
|
||||
@ -40,7 +38,7 @@ LEGACY_MENU_OPTION LegacyHDMenu = {
|
||||
///
|
||||
LEGACY_MENU_OPTION LegacyCDMenu = {
|
||||
LEGACY_MENU_OPTION_SIGNATURE,
|
||||
{NULL},
|
||||
{ NULL },
|
||||
0
|
||||
};
|
||||
|
||||
@ -49,7 +47,7 @@ LEGACY_MENU_OPTION LegacyCDMenu = {
|
||||
///
|
||||
LEGACY_MENU_OPTION LegacyNETMenu = {
|
||||
LEGACY_MENU_OPTION_SIGNATURE,
|
||||
{NULL},
|
||||
{ NULL },
|
||||
0
|
||||
};
|
||||
|
||||
@ -58,35 +56,34 @@ LEGACY_MENU_OPTION LegacyNETMenu = {
|
||||
///
|
||||
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;
|
||||
|
||||
|
||||
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.
|
||||
@ -152,7 +148,7 @@ OrderLegacyBootOption4SameType (
|
||||
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);
|
||||
}
|
||||
|
||||
@ -211,6 +208,7 @@ OrderLegacyBootOption4SameType (
|
||||
(*EnBootOption)[*EnBootOptionCount] = BootOrder[Index];
|
||||
(*EnBootOptionCount)++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -278,37 +276,36 @@ UpdateBBSOption (
|
||||
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;
|
||||
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;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyHDMenu;
|
||||
LegacyDev = NVMapData->LegacyHD;
|
||||
InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyHD;
|
||||
|
||||
@ -316,14 +313,14 @@ UpdateBBSOption (
|
||||
break;
|
||||
|
||||
case BBS_CDROM:
|
||||
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyCDMenu;
|
||||
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;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyNETMenu;
|
||||
LegacyDev = NVMapData->LegacyNET;
|
||||
InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyNET;
|
||||
BufferSize = sizeof (NVMapData->LegacyNET);
|
||||
@ -331,7 +328,7 @@ UpdateBBSOption (
|
||||
|
||||
default:
|
||||
ASSERT (mBbsType[CurrentType] == BBS_BEV_DEVICE);
|
||||
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyBEVMenu;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyBEVMenu;
|
||||
LegacyDev = NVMapData->LegacyBEV;
|
||||
InitialLegacyDev = mLegacyBootOptionPrivate->MaintainMapData->InitialNvData.LegacyBEV;
|
||||
BufferSize = sizeof (NVMapData->LegacyBEV);
|
||||
@ -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++;
|
||||
}
|
||||
}
|
||||
@ -413,7 +410,7 @@ UpdateBBSOption (
|
||||
&DisBootOption,
|
||||
&DisBootOptionCount
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
@ -422,9 +419,9 @@ UpdateBBSOption (
|
||||
//
|
||||
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);
|
||||
|
||||
@ -517,9 +513,10 @@ LegacyBootOptionExtractConfig (
|
||||
OUT EFI_STRING *Results
|
||||
)
|
||||
{
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
if ((Progress == NULL) || (Results == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*Progress = Request;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
@ -553,8 +550,7 @@ LegacyBootOptionRouteConfig (
|
||||
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;
|
||||
@ -584,7 +580,7 @@ LegacyBootOptionRouteConfig (
|
||||
Status = ConfigRouting->ConfigToBlock (
|
||||
ConfigRouting,
|
||||
Configuration,
|
||||
(UINT8 *) CurrentNVMapData,
|
||||
(UINT8 *)CurrentNVMapData,
|
||||
&BufferSize,
|
||||
Progress
|
||||
);
|
||||
@ -610,6 +606,7 @@ RefreshLegacyUpdateData (
|
||||
if (mLegacyStartOpCodeHandle != NULL) {
|
||||
HiiFreeOpCodeHandle (mLegacyStartOpCodeHandle);
|
||||
}
|
||||
|
||||
if (mLegacyEndOpCodeHandle != NULL) {
|
||||
HiiFreeOpCodeHandle (mLegacyEndOpCodeHandle);
|
||||
}
|
||||
@ -623,7 +620,7 @@ RefreshLegacyUpdateData (
|
||||
//
|
||||
// Create Hii Extend Label OpCode as the start opcode
|
||||
//
|
||||
mLegacyStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
|
||||
mLegacyStartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
|
||||
mLegacyStartOpCodeHandle,
|
||||
&gEfiIfrTianoGuid,
|
||||
NULL,
|
||||
@ -636,7 +633,7 @@ RefreshLegacyUpdateData (
|
||||
//
|
||||
// Create Hii Extend Label OpCode as the start opcode
|
||||
//
|
||||
mLegacyEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
|
||||
mLegacyEndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
|
||||
mLegacyEndOpCodeHandle,
|
||||
&gEfiIfrTianoGuid,
|
||||
NULL,
|
||||
@ -645,7 +642,6 @@ RefreshLegacyUpdateData (
|
||||
mLegacyEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||
|
||||
mLegacyEndLabel->Number = FORM_BOOT_LEGACY_LABEL_END;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -756,15 +752,15 @@ 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;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyFDMenu;
|
||||
Key = (UINT16)LEGACY_FD_QUESTION_ID;
|
||||
TypeStr = STR_FLOPPY;
|
||||
TypeStrHelp = STR_FLOPPY_HELP;
|
||||
FormTitle = STR_FLOPPY_TITLE;
|
||||
@ -772,8 +768,8 @@ UpdateLegacyDeviceOrderPage (
|
||||
break;
|
||||
|
||||
case FORM_HARDDISK_BOOT_ID:
|
||||
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyHDMenu;
|
||||
Key = (UINT16) LEGACY_HD_QUESTION_ID;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyHDMenu;
|
||||
Key = (UINT16)LEGACY_HD_QUESTION_ID;
|
||||
TypeStr = STR_HARDDISK;
|
||||
TypeStrHelp = STR_HARDDISK_HELP;
|
||||
FormTitle = STR_HARDDISK_TITLE;
|
||||
@ -781,8 +777,8 @@ UpdateLegacyDeviceOrderPage (
|
||||
break;
|
||||
|
||||
case FORM_CDROM_BOOT_ID:
|
||||
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyCDMenu;
|
||||
Key = (UINT16) LEGACY_CD_QUESTION_ID;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyCDMenu;
|
||||
Key = (UINT16)LEGACY_CD_QUESTION_ID;
|
||||
TypeStr = STR_CDROM;
|
||||
TypeStrHelp = STR_CDROM_HELP;
|
||||
FormTitle = STR_CDROM_TITLE;
|
||||
@ -790,8 +786,8 @@ UpdateLegacyDeviceOrderPage (
|
||||
break;
|
||||
|
||||
case FORM_NET_BOOT_ID:
|
||||
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyNETMenu;
|
||||
Key = (UINT16) LEGACY_NET_QUESTION_ID;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyNETMenu;
|
||||
Key = (UINT16)LEGACY_NET_QUESTION_ID;
|
||||
TypeStr = STR_NET;
|
||||
TypeStrHelp = STR_NET_HELP;
|
||||
FormTitle = STR_NET_TITLE;
|
||||
@ -799,8 +795,8 @@ UpdateLegacyDeviceOrderPage (
|
||||
break;
|
||||
|
||||
case FORM_BEV_BOOT_ID:
|
||||
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyBEVMenu;
|
||||
Key = (UINT16) LEGACY_BEV_QUESTION_ID;
|
||||
OptionMenu = (LEGACY_MENU_OPTION *)&LegacyBEVMenu;
|
||||
Key = (UINT16)LEGACY_BEV_QUESTION_ID;
|
||||
TypeStr = STR_BEV;
|
||||
TypeStrHelp = STR_BEV_HELP;
|
||||
FormTitle = STR_BEV_TITLE;
|
||||
@ -812,14 +808,13 @@ UpdateLegacyDeviceOrderPage (
|
||||
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.
|
||||
|
||||
@ -936,27 +930,27 @@ 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);
|
||||
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;
|
||||
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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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;
|
||||
}
|
||||
@ -984,7 +978,7 @@ AdjustOptionValue (
|
||||
//
|
||||
Pos = OldValue / 8;
|
||||
Bit = 7 - (OldValue % 8);
|
||||
DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
|
||||
DisMap[Pos] = (UINT8)(DisMap[Pos] | (UINT8)(1 << Bit));
|
||||
for (Index2 = Index; Index2 < Number - 1; Index2++) {
|
||||
CurrentVal[Index2] = CurrentVal[Index2 + 1];
|
||||
}
|
||||
@ -1027,7 +1021,7 @@ AdjustOptionValue (
|
||||
//
|
||||
Pos = NewValue / 8;
|
||||
Bit = 7 - (NewValue % 8);
|
||||
DisMap[Pos] = (UINT8) (DisMap[Pos] & (~ (UINT8) (1 << Bit)));
|
||||
DisMap[Pos] = (UINT8)(DisMap[Pos] & (~(UINT8)(1 << Bit)));
|
||||
if (0xFF != OldValue) {
|
||||
//
|
||||
// Because NewValue is a item that was disabled before
|
||||
@ -1036,10 +1030,11 @@ AdjustOptionValue (
|
||||
//
|
||||
Pos = OldValue / 8;
|
||||
Bit = 7 - (OldValue % 8);
|
||||
DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
|
||||
DisMap[Pos] = (UINT8)(DisMap[Pos] | (UINT8)(1 << Bit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// To prevent DISABLE appears in the middle of the list
|
||||
// we should perform a re-ordering
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1112,7 +1107,7 @@ LegacyBootOptionCallback (
|
||||
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.
|
||||
//
|
||||
@ -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.
|
||||
|
||||
@ -1229,10 +1224,10 @@ 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:
|
||||
@ -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));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1343,22 +1338,24 @@ 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) {
|
||||
switch (((BBS_BBS_DEVICE_PATH *)BootOption[Index].FilePath)->DeviceType) {
|
||||
case BBS_TYPE_FLOPPY:
|
||||
InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link);
|
||||
FDNum++;
|
||||
@ -1395,7 +1392,6 @@ GetLegacyOptions (
|
||||
LegacyBEVMenu.MenuNumber = BEVNum;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Install Boot Manager Menu driver.
|
||||
@ -1418,7 +1414,7 @@ LegacyBootMaintUiLibConstructor (
|
||||
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
|
||||
@ -1483,7 +1479,7 @@ LegacyBootMaintUiLibDestructor (
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
@ -52,14 +50,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
#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
|
||||
//
|
||||
@ -96,14 +92,11 @@ typedef struct {
|
||||
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 {
|
||||
|
@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _EFI_LEGACY_BOOT_OPTION_VFR_H_
|
||||
#define _EFI_LEGACY_BOOT_OPTION_VFR_H_
|
||||
|
||||
@ -18,23 +17,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#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_BOOT_LEGACY_DEVICE_ID 0x9000
|
||||
#define FORM_BOOT_LEGACY_LABEL_END 0x9001
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
///
|
||||
|
@ -27,7 +27,7 @@ EFIAPI
|
||||
LegacyBootManagerLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
)
|
||||
{
|
||||
EfiBootManagerRegisterLegacyBootSupport (
|
||||
LegacyBmRefreshAllBootOption,
|
||||
@ -48,9 +48,11 @@ LegacyBmDeviceType (
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,10 +169,11 @@ LegacyBmBuildLegacyDevNameString (
|
||||
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
|
||||
@ -186,7 +189,7 @@ LegacyBmBuildLegacyDevNameString (
|
||||
// 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 {
|
||||
@ -216,13 +219,14 @@ LegacyBmFuzzyMatch (
|
||||
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;
|
||||
}
|
||||
|
||||
@ -299,34 +304,38 @@ LegacyBmUpdateBbsIndex (
|
||||
LEGACY_DEV_ORDER_ENTRY *Entry;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (((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;
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
@ -406,7 +415,7 @@ LegacyBmDeleteAllInvalidBootOptions (
|
||||
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;
|
||||
}
|
||||
|
||||
@ -536,7 +554,7 @@ LegacyBmCreateLegacyBootOption (
|
||||
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);
|
||||
@ -602,7 +620,7 @@ LegacyBmFillDevOrderBuf (
|
||||
continue;
|
||||
}
|
||||
|
||||
*Buf = (UINT16) (Index & 0xFF);
|
||||
*Buf = (UINT16)(Index & 0xFF);
|
||||
Buf++;
|
||||
}
|
||||
|
||||
@ -697,29 +715,30 @@ LegacyBmCreateDevOrder (
|
||||
if (NULL == DevOrder) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
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.
|
||||
@ -798,7 +817,7 @@ LegacyBmUpdateDevOrder (
|
||||
BEVIndex = 0;
|
||||
NewDevPtr = NULL;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
|
||||
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
|
||||
//
|
||||
@ -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++) {
|
||||
@ -993,13 +1023,14 @@ LegacyBmUpdateDevOrder (
|
||||
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)++;
|
||||
}
|
||||
}
|
||||
@ -1062,26 +1094,26 @@ LegacyBmSetPriorityForSameTypeDev (
|
||||
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.
|
||||
//
|
||||
@ -1135,19 +1169,19 @@ 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))
|
||||
(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))
|
||||
);
|
||||
}
|
||||
|
||||
@ -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,17 +1249,19 @@ 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;
|
||||
BbsIndex = ((LEGACY_BM_BOOT_OPTION_BBS_DATA *)BootOption->OptionalData)->BbsIndex;
|
||||
Status = LegacyBmSetPriorityForSameTypeDev (
|
||||
DevType,
|
||||
BbsIndex,
|
||||
@ -1236,6 +1272,7 @@ LegacyBmRefreshBbsTableForBoot (
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// we have to set the boot priority for other BBS entries with different device types
|
||||
//
|
||||
@ -1246,7 +1283,8 @@ LegacyBmRefreshBbsTableForBoot (
|
||||
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();
|
||||
DEBUG_CODE_BEGIN ();
|
||||
LegacyBmPrintBbsTable (LocalBbsTable, BbsCount);
|
||||
DEBUG_CODE_END();
|
||||
DEBUG_CODE_END ();
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Boot the legacy system with the boot option.
|
||||
|
||||
@ -1301,7 +1340,7 @@ LegacyBmBoot (
|
||||
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
|
||||
);
|
||||
@ -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;
|
||||
}
|
||||
@ -1413,8 +1453,9 @@ LegacyBmFindBootOption (
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1445,11 +1486,12 @@ LegacyBmRefreshAllBootOption (
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION *ExistingBootOptions;
|
||||
UINTN ExistingBootOptionCount;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
|
||||
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **)&LegacyBios);
|
||||
if (EFI_ERROR (Status)) {
|
||||
LegacyBmDeleteAllBootOptions ();
|
||||
return;
|
||||
}
|
||||
|
||||
PERF_START (NULL, "LegacyBootOptionEnum", "BDS", 0);
|
||||
|
||||
//
|
||||
@ -1504,11 +1546,12 @@ LegacyBmRefreshAllBootOption (
|
||||
|
||||
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
|
||||
));
|
||||
|
@ -82,7 +82,6 @@ EFI_FW_VOL_BLOCK_DEVICE mEmuVarsFvb = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
|
||||
|
||||
@ -103,7 +102,6 @@ FvbVirtualAddressChangeEvent (
|
||||
EfiConvertPointer (0x0, &mEmuVarsFvb.BufferPtr);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// FVB protocol APIs
|
||||
//
|
||||
@ -136,12 +134,11 @@ FvbProtocolGetPhysicalAddress (
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
*Address = (EFI_PHYSICAL_ADDRESS)(UINTN) FvbDevice->BufferPtr;
|
||||
*Address = (EFI_PHYSICAL_ADDRESS)(UINTN)FvbDevice->BufferPtr;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The GetBlockSize() function retrieves the size of the requested
|
||||
block. It also returns the number of additional blocks with
|
||||
@ -191,7 +188,6 @@ FvbProtocolGetBlockSize (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The GetAttributes() function retrieves the attributes and
|
||||
current settings of the block. Status Codes Returned
|
||||
@ -215,7 +211,7 @@ FvbProtocolGetAttributes (
|
||||
)
|
||||
{
|
||||
*Attributes =
|
||||
(EFI_FVB_ATTRIBUTES_2) (
|
||||
(EFI_FVB_ATTRIBUTES_2)(
|
||||
EFI_FVB2_READ_ENABLED_CAP |
|
||||
EFI_FVB2_READ_STATUS |
|
||||
EFI_FVB2_WRITE_ENABLED_CAP |
|
||||
@ -226,7 +222,6 @@ FvbProtocolGetAttributes (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The SetAttributes() function sets configurable firmware volume
|
||||
attributes and returns the new settings of the firmware volume.
|
||||
@ -259,7 +254,6 @@ FvbProtocolSetAttributes (
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Erases and initializes a firmware volume block.
|
||||
|
||||
@ -333,14 +327,17 @@ FvbProtocolEraseBlocks (
|
||||
if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
|
||||
break;
|
||||
}
|
||||
|
||||
NumOfLba = VA_ARG (Args, UINTN);
|
||||
|
||||
if (StartingLba > EMU_FVB_NUM_TOTAL_BLOCKS ||
|
||||
NumOfLba > EMU_FVB_NUM_TOTAL_BLOCKS - StartingLba) {
|
||||
if ((StartingLba > EMU_FVB_NUM_TOTAL_BLOCKS) ||
|
||||
(NumOfLba > EMU_FVB_NUM_TOTAL_BLOCKS - StartingLba))
|
||||
{
|
||||
VA_END (Args);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
VA_END (Args);
|
||||
|
||||
//
|
||||
@ -352,6 +349,7 @@ FvbProtocolEraseBlocks (
|
||||
if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
|
||||
break;
|
||||
}
|
||||
|
||||
NumOfLba = VA_ARG (Args, UINTN);
|
||||
|
||||
ErasePtr = FvbDevice->BufferPtr;
|
||||
@ -360,6 +358,7 @@ FvbProtocolEraseBlocks (
|
||||
|
||||
SetMem (ErasePtr, EraseSize, ERASED_UINT8);
|
||||
} while (1);
|
||||
|
||||
VA_END (Args);
|
||||
|
||||
//
|
||||
@ -372,7 +371,6 @@ FvbProtocolEraseBlocks (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Writes the specified number of bytes from the input buffer to the block.
|
||||
|
||||
@ -448,8 +446,9 @@ FvbProtocolWrite (
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
if (Lba >= EMU_FVB_NUM_TOTAL_BLOCKS ||
|
||||
Offset > FvbDevice->BlockSize) {
|
||||
if ((Lba >= EMU_FVB_NUM_TOTAL_BLOCKS) ||
|
||||
(Offset > FvbDevice->BlockSize))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -468,7 +467,6 @@ FvbProtocolWrite (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads the specified number of bytes into a buffer from the specified block.
|
||||
|
||||
@ -532,8 +530,9 @@ FvbProtocolRead (
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
if (Lba >= EMU_FVB_NUM_TOTAL_BLOCKS ||
|
||||
Offset > FvbDevice->BlockSize) {
|
||||
if ((Lba >= EMU_FVB_NUM_TOTAL_BLOCKS) ||
|
||||
(Offset > FvbDevice->BlockSize))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -552,7 +551,6 @@ FvbProtocolRead (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check the integrity of firmware volume header.
|
||||
|
||||
@ -578,14 +576,16 @@ ValidateFvHeader (
|
||||
(FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||
|
||||
(FwVolHeader->FvLength != EMU_FVB_SIZE) ||
|
||||
(FwVolHeader->HeaderLength != EMU_FV_HEADER_LENGTH)
|
||||
) {
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "EMU Variable FVB: Basic FV headers were invalid\n"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Verify the header checksum
|
||||
//
|
||||
Checksum = CalculateSum16((VOID*) FwVolHeader, FwVolHeader->HeaderLength);
|
||||
Checksum = CalculateSum16 ((VOID *)FwVolHeader, FwVolHeader->HeaderLength);
|
||||
|
||||
if (Checksum != 0) {
|
||||
DEBUG ((DEBUG_INFO, "EMU Variable FVB: FV checksum was invalid\n"));
|
||||
@ -595,7 +595,6 @@ ValidateFvHeader (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initializes the FV Header and Variable Store Header
|
||||
to support variable operations.
|
||||
@ -638,7 +637,7 @@ InitializeFvAndVariableStoreHeaders (
|
||||
0,
|
||||
|
||||
// UINT8 Reserved[1];
|
||||
{0},
|
||||
{ 0 },
|
||||
|
||||
// UINT8 Revision;
|
||||
EFI_FVH_REVISION,
|
||||
@ -691,7 +690,7 @@ InitializeFvAndVariableStoreHeaders (
|
||||
//
|
||||
// Update the checksum for the FV header
|
||||
//
|
||||
Fv = (EFI_FIRMWARE_VOLUME_HEADER*) Ptr;
|
||||
Fv = (EFI_FIRMWARE_VOLUME_HEADER *)Ptr;
|
||||
Fv->Checksum = CalculateCheckSum16 (Ptr, Fv->HeaderLength);
|
||||
}
|
||||
|
||||
@ -724,21 +723,27 @@ FvbInitialize (
|
||||
//
|
||||
// Verify that the PCD's are set correctly.
|
||||
//
|
||||
ASSERT (FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) %
|
||||
EMU_FVB_BLOCK_SIZE == 0);
|
||||
ASSERT (
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) %
|
||||
EMU_FVB_BLOCK_SIZE == 0
|
||||
);
|
||||
if (
|
||||
(PcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
PcdGet32 (PcdFlashNvStorageFtwWorkingSize)
|
||||
) >
|
||||
EMU_FVB_NUM_SPARE_BLOCKS * EMU_FVB_BLOCK_SIZE
|
||||
) {
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "EMU Variable invalid PCD sizes\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
|
||||
DEBUG ((DEBUG_INFO, "Disabling EMU Variable FVB since "
|
||||
"flash variables appear to be supported.\n"));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"Disabling EMU Variable FVB since "
|
||||
"flash variables appear to be supported.\n"
|
||||
));
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
@ -752,7 +757,7 @@ FvbInitialize (
|
||||
//
|
||||
Initialize = TRUE;
|
||||
if (PcdGet64 (PcdEmuVariableNvStoreReserved) != 0) {
|
||||
Ptr = (VOID*)(UINTN) PcdGet64 (PcdEmuVariableNvStoreReserved);
|
||||
Ptr = (VOID *)(UINTN)PcdGet64 (PcdEmuVariableNvStoreReserved);
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"EMU Variable FVB: Using pre-reserved block at %p\n",
|
||||
@ -776,30 +781,35 @@ FvbInitialize (
|
||||
SetMem (Ptr, EMU_FVB_SIZE, ERASED_UINT8);
|
||||
InitializeFvAndVariableStoreHeaders (Ptr);
|
||||
}
|
||||
PcdStatus = PcdSet64S (PcdFlashNvStorageVariableBase64, (UINT32)(UINTN) Ptr);
|
||||
|
||||
PcdStatus = PcdSet64S (PcdFlashNvStorageVariableBase64, (UINT32)(UINTN)Ptr);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
//
|
||||
// Initialize the Fault Tolerant Write data area
|
||||
//
|
||||
SubPtr = (VOID*) ((UINT8*) Ptr + PcdGet32 (PcdFlashNvStorageVariableSize));
|
||||
PcdStatus = PcdSet32S (PcdFlashNvStorageFtwWorkingBase,
|
||||
(UINT32)(UINTN) SubPtr);
|
||||
SubPtr = (VOID *)((UINT8 *)Ptr + PcdGet32 (PcdFlashNvStorageVariableSize));
|
||||
PcdStatus = PcdSet32S (
|
||||
PcdFlashNvStorageFtwWorkingBase,
|
||||
(UINT32)(UINTN)SubPtr
|
||||
);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
//
|
||||
// Initialize the Fault Tolerant Write spare block
|
||||
//
|
||||
SubPtr = (VOID*) ((UINT8*) Ptr +
|
||||
SubPtr = (VOID *)((UINT8 *)Ptr +
|
||||
EMU_FVB_NUM_SPARE_BLOCKS * EMU_FVB_BLOCK_SIZE);
|
||||
PcdStatus = PcdSet32S (PcdFlashNvStorageFtwSpareBase,
|
||||
(UINT32)(UINTN) SubPtr);
|
||||
PcdStatus = PcdSet32S (
|
||||
PcdFlashNvStorageFtwSpareBase,
|
||||
(UINT32)(UINTN)SubPtr
|
||||
);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
//
|
||||
// Setup FVB device path
|
||||
//
|
||||
Address = (EFI_PHYSICAL_ADDRESS)(UINTN) Ptr;
|
||||
Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Ptr;
|
||||
mEmuVarsFvb.DevicePath.MemMapDevPath.StartingAddress = Address;
|
||||
mEmuVarsFvb.DevicePath.MemMapDevPath.EndingAddress = Address + EMU_FVB_SIZE - 1;
|
||||
|
||||
@ -833,5 +843,3 @@ FvbInitialize (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,11 +25,9 @@ Abstract:
|
||||
#pragma pack (1)
|
||||
|
||||
typedef struct {
|
||||
|
||||
EFI_FIRMWARE_VOLUME_HEADER FvHdr;
|
||||
EFI_FV_BLOCK_MAP_ENTRY EndBlockMap;
|
||||
VARIABLE_STORE_HEADER VarHdr;
|
||||
|
||||
} FVB_FV_HDR_AND_VARS_TEMPLATE;
|
||||
|
||||
typedef struct {
|
||||
@ -48,7 +46,6 @@ typedef struct {
|
||||
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
|
||||
} EFI_FW_VOL_BLOCK_DEVICE;
|
||||
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "EnrollDefaultKeys.h"
|
||||
|
||||
|
||||
//
|
||||
// Second KEK: "Microsoft Corporation KEK CA 2011".
|
||||
// SHA1: 31:59:0b:fd:89:c9:d7:4e:d0:87:df:ac:66:33:4b:39:31:25:4b:30
|
||||
@ -137,7 +136,6 @@ CONST UINT8 mMicrosoftKek[] = {
|
||||
|
||||
CONST UINTN mSizeOfMicrosoftKek = sizeof mMicrosoftKek;
|
||||
|
||||
|
||||
//
|
||||
// First DB entry: "Microsoft Windows Production PCA 2011"
|
||||
// SHA1: 58:0a:6f:4c:c4:e4:b6:69:b9:eb:dc:1b:2b:3e:08:7b:80:d0:67:8d
|
||||
@ -266,7 +264,6 @@ CONST UINT8 mMicrosoftPca[] = {
|
||||
|
||||
CONST UINTN mSizeOfMicrosoftPca = sizeof mMicrosoftPca;
|
||||
|
||||
|
||||
//
|
||||
// Second DB entry: "Microsoft Corporation UEFI CA 2011"
|
||||
// SHA1: 46:de:f6:3b:5c:e6:1c:f8:ba:0d:e2:e6:63:9c:10:19:d0:ed:14:f3
|
||||
@ -398,7 +395,6 @@ CONST UINT8 mMicrosoftUefiCa[] = {
|
||||
|
||||
CONST UINTN mSizeOfMicrosoftUefiCa = sizeof mMicrosoftUefiCa;
|
||||
|
||||
|
||||
//
|
||||
// The Microsoft.UefiSecureBootLogo.Tests.OutOfBoxConfirmDBXisPresent test case
|
||||
// of the Secure Boot Logo Test in the Microsoft Hardware Certification Kit
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "EnrollDefaultKeys.h"
|
||||
|
||||
|
||||
/**
|
||||
Fetch the X509 certificate (to be used as Platform Key and first Key Exchange
|
||||
Key) from SMBIOS.
|
||||
@ -75,14 +74,21 @@ GetPkKek1 (
|
||||
//
|
||||
// Format the application prefix, for OEM String matching.
|
||||
//
|
||||
AsciiSPrint (OvmfPkKek1AppPrefix, sizeof OvmfPkKek1AppPrefix, "%g:",
|
||||
&gOvmfPkKek1AppPrefixGuid);
|
||||
AsciiSPrint (
|
||||
OvmfPkKek1AppPrefix,
|
||||
sizeof OvmfPkKek1AppPrefix,
|
||||
"%g:",
|
||||
&gOvmfPkKek1AppPrefixGuid
|
||||
);
|
||||
|
||||
//
|
||||
// Scan all "OEM Strings" tables.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL,
|
||||
(VOID **)&Smbios);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiSmbiosProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&Smbios
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AsciiPrint ("error: failed to locate EFI_SMBIOS_PROTOCOL: %r\n", Status);
|
||||
return Status;
|
||||
@ -92,7 +98,8 @@ GetPkKek1 (
|
||||
Type = SMBIOS_TYPE_OEM_STRINGS;
|
||||
for (Status = Smbios->GetNext (Smbios, &Handle, &Type, &Header, NULL);
|
||||
!EFI_ERROR (Status);
|
||||
Status = Smbios->GetNext (Smbios, &Handle, &Type, &Header, NULL)) {
|
||||
Status = Smbios->GetNext (Smbios, &Handle, &Type, &Header, NULL))
|
||||
{
|
||||
CONST CHAR8 *OemString;
|
||||
UINTN Idx;
|
||||
|
||||
@ -102,6 +109,7 @@ GetPkKek1 (
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
OemStringsTable = (SMBIOS_TABLE_TYPE11 *)Header;
|
||||
|
||||
//
|
||||
@ -115,8 +123,12 @@ GetPkKek1 (
|
||||
//
|
||||
// NUL-terminate the candidate prefix for case-insensitive comparison.
|
||||
//
|
||||
AsciiStrnCpyS (CandidatePrefix, sizeof CandidatePrefix, OemString,
|
||||
GUID_STRING_LENGTH + 1);
|
||||
AsciiStrnCpyS (
|
||||
CandidatePrefix,
|
||||
sizeof CandidatePrefix,
|
||||
OemString,
|
||||
GUID_STRING_LENGTH + 1
|
||||
);
|
||||
if (AsciiStriCmp (OvmfPkKek1AppPrefix, CandidatePrefix) == 0) {
|
||||
//
|
||||
// The current string matches the prefix.
|
||||
@ -124,6 +136,7 @@ GetPkKek1 (
|
||||
Base64Cert = OemString + GUID_STRING_LENGTH + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
OemString += AsciiStrSize (OemString);
|
||||
}
|
||||
|
||||
@ -139,8 +152,11 @@ GetPkKek1 (
|
||||
//
|
||||
// No table with a matching string has been found.
|
||||
//
|
||||
AsciiPrint ("error: OEM String with app prefix %g not found: %r\n",
|
||||
&gOvmfPkKek1AppPrefixGuid, Status);
|
||||
AsciiPrint (
|
||||
"error: OEM String with app prefix %g not found: %r\n",
|
||||
&gOvmfPkKek1AppPrefixGuid,
|
||||
Status
|
||||
);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -157,12 +173,16 @@ GetPkKek1 (
|
||||
ASSERT (DecodedCertSize > 0);
|
||||
break;
|
||||
case EFI_SUCCESS:
|
||||
AsciiPrint ("error: empty certificate after app prefix %g\n",
|
||||
&gOvmfPkKek1AppPrefixGuid);
|
||||
AsciiPrint (
|
||||
"error: empty certificate after app prefix %g\n",
|
||||
&gOvmfPkKek1AppPrefixGuid
|
||||
);
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
default:
|
||||
AsciiPrint ("error: invalid base64 string after app prefix %g\n",
|
||||
&gOvmfPkKek1AppPrefixGuid);
|
||||
AsciiPrint (
|
||||
"error: invalid base64 string after app prefix %g\n",
|
||||
&gOvmfPkKek1AppPrefixGuid
|
||||
);
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -178,8 +198,12 @@ GetPkKek1 (
|
||||
//
|
||||
// Decoding will succeed at this point.
|
||||
//
|
||||
Status = Base64Decode (Base64Cert, Base64CertLen, DecodedCert,
|
||||
&DecodedCertSize);
|
||||
Status = Base64Decode (
|
||||
Base64Cert,
|
||||
Base64CertLen,
|
||||
DecodedCert,
|
||||
&DecodedCertSize
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
*PkKek1 = DecodedCert;
|
||||
@ -187,7 +211,6 @@ GetPkKek1 (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Enroll a set of certificates in a global variable, overwriting it.
|
||||
|
||||
@ -259,25 +282,30 @@ EnrollListOfCerts (
|
||||
VA_START (Marker, CertType);
|
||||
for (Cert = VA_ARG (Marker, CONST UINT8 *);
|
||||
Cert != NULL;
|
||||
Cert = VA_ARG (Marker, CONST UINT8 *)) {
|
||||
Cert = VA_ARG (Marker, CONST UINT8 *))
|
||||
{
|
||||
UINTN CertSize;
|
||||
|
||||
CertSize = VA_ARG (Marker, UINTN);
|
||||
(VOID)VA_ARG (Marker, CONST EFI_GUID *);
|
||||
|
||||
if (CertSize == 0 ||
|
||||
CertSize > MAX_UINT32 - sizeof *RepeatingHeader ||
|
||||
DataSize > MAX_UINT32 - sizeof *RepeatingHeader - CertSize) {
|
||||
if ((CertSize == 0) ||
|
||||
(CertSize > MAX_UINT32 - sizeof *RepeatingHeader) ||
|
||||
(DataSize > MAX_UINT32 - sizeof *RepeatingHeader - CertSize))
|
||||
{
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
DataSize += sizeof *RepeatingHeader + CertSize;
|
||||
}
|
||||
|
||||
VA_END (Marker);
|
||||
|
||||
if (DataSize == sizeof *SingleHeader) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Out;
|
||||
}
|
||||
@ -295,14 +323,15 @@ EnrollListOfCerts (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreeData;
|
||||
}
|
||||
|
||||
SingleHeader->TimeStamp.Pad1 = 0;
|
||||
SingleHeader->TimeStamp.Nanosecond = 0;
|
||||
SingleHeader->TimeStamp.TimeZone = 0;
|
||||
SingleHeader->TimeStamp.Daylight = 0;
|
||||
SingleHeader->TimeStamp.Pad2 = 0;
|
||||
#if 0
|
||||
#if 0
|
||||
SingleHeader->dwLength = DataSize - sizeof SingleHeader->TimeStamp;
|
||||
#else
|
||||
#else
|
||||
//
|
||||
// This looks like a bug in edk2. According to the UEFI specification,
|
||||
// dwLength is "The length of the entire certificate, including the length of
|
||||
@ -311,7 +340,7 @@ EnrollListOfCerts (
|
||||
//
|
||||
SingleHeader->dwLength = sizeof *SingleHeader
|
||||
- sizeof SingleHeader->TimeStamp;
|
||||
#endif
|
||||
#endif
|
||||
SingleHeader->wRevision = 0x0200;
|
||||
SingleHeader->wCertificateType = WIN_CERT_TYPE_EFI_GUID;
|
||||
CopyGuid (&SingleHeader->CertType, &gEfiCertPkcs7Guid);
|
||||
@ -320,7 +349,8 @@ EnrollListOfCerts (
|
||||
VA_START (Marker, CertType);
|
||||
for (Cert = VA_ARG (Marker, CONST UINT8 *);
|
||||
Cert != NULL;
|
||||
Cert = VA_ARG (Marker, CONST UINT8 *)) {
|
||||
Cert = VA_ARG (Marker, CONST UINT8 *))
|
||||
{
|
||||
UINTN CertSize;
|
||||
CONST EFI_GUID *OwnerGuid;
|
||||
|
||||
@ -340,29 +370,39 @@ EnrollListOfCerts (
|
||||
CopyMem (Position, Cert, CertSize);
|
||||
Position += CertSize;
|
||||
}
|
||||
|
||||
VA_END (Marker);
|
||||
|
||||
ASSERT (Data + DataSize == Position);
|
||||
|
||||
Status = gRT->SetVariable (VariableName, VendorGuid,
|
||||
Status = gRT->SetVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(EFI_VARIABLE_NON_VOLATILE |
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
EFI_VARIABLE_RUNTIME_ACCESS |
|
||||
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS),
|
||||
DataSize, Data);
|
||||
DataSize,
|
||||
Data
|
||||
);
|
||||
|
||||
FreeData:
|
||||
FreePool (Data);
|
||||
|
||||
Out:
|
||||
if (EFI_ERROR (Status)) {
|
||||
AsciiPrint ("error: %a(\"%s\", %g): %r\n", __FUNCTION__, VariableName,
|
||||
VendorGuid, Status);
|
||||
AsciiPrint (
|
||||
"error: %a(\"%s\", %g): %r\n",
|
||||
__FUNCTION__,
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read a UEFI variable into a caller-allocated buffer, enforcing an exact size.
|
||||
|
||||
@ -417,26 +457,35 @@ GetExact (
|
||||
Size = DataSize;
|
||||
Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &Size, Data);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_NOT_FOUND && AllowMissing) {
|
||||
if ((Status == EFI_NOT_FOUND) && AllowMissing) {
|
||||
ZeroMem (Data, DataSize);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
AsciiPrint ("error: GetVariable(\"%s\", %g): %r\n", VariableName,
|
||||
VendorGuid, Status);
|
||||
AsciiPrint (
|
||||
"error: GetVariable(\"%s\", %g): %r\n",
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Status
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Size != DataSize) {
|
||||
AsciiPrint ("error: GetVariable(\"%s\", %g): expected size 0x%Lx, "
|
||||
"got 0x%Lx\n", VariableName, VendorGuid, (UINT64)DataSize, (UINT64)Size);
|
||||
AsciiPrint (
|
||||
"error: GetVariable(\"%s\", %g): expected size 0x%Lx, "
|
||||
"got 0x%Lx\n",
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(UINT64)DataSize,
|
||||
(UINT64)Size
|
||||
);
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Populate a SETTINGS structure from the underlying UEFI variables.
|
||||
|
||||
@ -469,37 +518,60 @@ GetSettings (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = GetExact (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid,
|
||||
&Settings->SetupMode, sizeof Settings->SetupMode, FALSE);
|
||||
Status = GetExact (
|
||||
EFI_SETUP_MODE_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Settings->SetupMode,
|
||||
sizeof Settings->SetupMode,
|
||||
FALSE
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = GetExact (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid,
|
||||
&Settings->SecureBoot, sizeof Settings->SecureBoot, FALSE);
|
||||
Status = GetExact (
|
||||
EFI_SECURE_BOOT_MODE_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Settings->SecureBoot,
|
||||
sizeof Settings->SecureBoot,
|
||||
FALSE
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = GetExact (EFI_SECURE_BOOT_ENABLE_NAME,
|
||||
&gEfiSecureBootEnableDisableGuid, &Settings->SecureBootEnable,
|
||||
sizeof Settings->SecureBootEnable, TRUE);
|
||||
Status = GetExact (
|
||||
EFI_SECURE_BOOT_ENABLE_NAME,
|
||||
&gEfiSecureBootEnableDisableGuid,
|
||||
&Settings->SecureBootEnable,
|
||||
sizeof Settings->SecureBootEnable,
|
||||
TRUE
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = GetExact (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid,
|
||||
&Settings->CustomMode, sizeof Settings->CustomMode, FALSE);
|
||||
Status = GetExact (
|
||||
EFI_CUSTOM_MODE_NAME,
|
||||
&gEfiCustomModeEnableGuid,
|
||||
&Settings->CustomMode,
|
||||
sizeof Settings->CustomMode,
|
||||
FALSE
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = GetExact (EFI_VENDOR_KEYS_VARIABLE_NAME, &gEfiGlobalVariableGuid,
|
||||
&Settings->VendorKeys, sizeof Settings->VendorKeys, FALSE);
|
||||
Status = GetExact (
|
||||
EFI_VENDOR_KEYS_VARIABLE_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Settings->VendorKeys,
|
||||
sizeof Settings->VendorKeys,
|
||||
FALSE
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Print the contents of a SETTINGS structure to the UEFI console.
|
||||
|
||||
@ -511,12 +583,17 @@ PrintSettings (
|
||||
IN CONST SETTINGS *Settings
|
||||
)
|
||||
{
|
||||
AsciiPrint ("info: SetupMode=%d SecureBoot=%d SecureBootEnable=%d "
|
||||
"CustomMode=%d VendorKeys=%d\n", Settings->SetupMode, Settings->SecureBoot,
|
||||
Settings->SecureBootEnable, Settings->CustomMode, Settings->VendorKeys);
|
||||
AsciiPrint (
|
||||
"info: SetupMode=%d SecureBoot=%d SecureBootEnable=%d "
|
||||
"CustomMode=%d VendorKeys=%d\n",
|
||||
Settings->SetupMode,
|
||||
Settings->SecureBoot,
|
||||
Settings->SecureBootEnable,
|
||||
Settings->CustomMode,
|
||||
Settings->VendorKeys
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Entry point function of this shell application.
|
||||
**/
|
||||
@ -534,7 +611,7 @@ ShellAppMain (
|
||||
UINTN SizeOfPkKek1;
|
||||
BOOLEAN NoDefault;
|
||||
|
||||
if (Argc == 2 && StrCmp (Argv[1], L"--no-default") == 0) {
|
||||
if ((Argc == 2) && (StrCmp (Argv[1], L"--no-default") == 0)) {
|
||||
NoDefault = TRUE;
|
||||
} else {
|
||||
NoDefault = FALSE;
|
||||
@ -552,6 +629,7 @@ ShellAppMain (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
PrintSettings (&Settings);
|
||||
|
||||
if (Settings.SetupMode != 1) {
|
||||
@ -581,13 +659,21 @@ ShellAppMain (
|
||||
//
|
||||
if (Settings.CustomMode != CUSTOM_SECURE_BOOT_MODE) {
|
||||
Settings.CustomMode = CUSTOM_SECURE_BOOT_MODE;
|
||||
Status = gRT->SetVariable (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid,
|
||||
Status = gRT->SetVariable (
|
||||
EFI_CUSTOM_MODE_NAME,
|
||||
&gEfiCustomModeEnableGuid,
|
||||
(EFI_VARIABLE_NON_VOLATILE |
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS),
|
||||
sizeof Settings.CustomMode, &Settings.CustomMode);
|
||||
sizeof Settings.CustomMode,
|
||||
&Settings.CustomMode
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AsciiPrint ("error: SetVariable(\"%s\", %g): %r\n", EFI_CUSTOM_MODE_NAME,
|
||||
&gEfiCustomModeEnableGuid, Status);
|
||||
AsciiPrint (
|
||||
"error: SetVariable(\"%s\", %g): %r\n",
|
||||
EFI_CUSTOM_MODE_NAME,
|
||||
&gEfiCustomModeEnableGuid,
|
||||
Status
|
||||
);
|
||||
goto FreePkKek1;
|
||||
}
|
||||
}
|
||||
@ -600,17 +686,26 @@ ShellAppMain (
|
||||
EFI_IMAGE_SECURITY_DATABASE,
|
||||
&gEfiImageSecurityDatabaseGuid,
|
||||
&gEfiCertX509Guid,
|
||||
PkKek1, SizeOfPkKek1, &gEfiCallerIdGuid,
|
||||
NULL);
|
||||
PkKek1,
|
||||
SizeOfPkKek1,
|
||||
&gEfiCallerIdGuid,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
Status = EnrollListOfCerts (
|
||||
EFI_IMAGE_SECURITY_DATABASE,
|
||||
&gEfiImageSecurityDatabaseGuid,
|
||||
&gEfiCertX509Guid,
|
||||
mMicrosoftPca, mSizeOfMicrosoftPca, &gMicrosoftVendorGuid,
|
||||
mMicrosoftUefiCa, mSizeOfMicrosoftUefiCa, &gMicrosoftVendorGuid,
|
||||
NULL);
|
||||
mMicrosoftPca,
|
||||
mSizeOfMicrosoftPca,
|
||||
&gMicrosoftVendorGuid,
|
||||
mMicrosoftUefiCa,
|
||||
mSizeOfMicrosoftUefiCa,
|
||||
&gMicrosoftVendorGuid,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreePkKek1;
|
||||
}
|
||||
@ -622,8 +717,11 @@ ShellAppMain (
|
||||
EFI_IMAGE_SECURITY_DATABASE1,
|
||||
&gEfiImageSecurityDatabaseGuid,
|
||||
&gEfiCertSha256Guid,
|
||||
mSha256OfDevNull, mSizeOfSha256OfDevNull, &gEfiCallerIdGuid,
|
||||
NULL);
|
||||
mSha256OfDevNull,
|
||||
mSizeOfSha256OfDevNull,
|
||||
&gEfiCallerIdGuid,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreePkKek1;
|
||||
}
|
||||
@ -636,17 +734,26 @@ ShellAppMain (
|
||||
EFI_KEY_EXCHANGE_KEY_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&gEfiCertX509Guid,
|
||||
PkKek1, SizeOfPkKek1, &gEfiCallerIdGuid,
|
||||
NULL);
|
||||
PkKek1,
|
||||
SizeOfPkKek1,
|
||||
&gEfiCallerIdGuid,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
Status = EnrollListOfCerts (
|
||||
EFI_KEY_EXCHANGE_KEY_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&gEfiCertX509Guid,
|
||||
PkKek1, SizeOfPkKek1, &gEfiCallerIdGuid,
|
||||
mMicrosoftKek, mSizeOfMicrosoftKek, &gMicrosoftVendorGuid,
|
||||
NULL);
|
||||
PkKek1,
|
||||
SizeOfPkKek1,
|
||||
&gEfiCallerIdGuid,
|
||||
mMicrosoftKek,
|
||||
mSizeOfMicrosoftKek,
|
||||
&gMicrosoftVendorGuid,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreePkKek1;
|
||||
}
|
||||
@ -658,8 +765,11 @@ ShellAppMain (
|
||||
EFI_PLATFORM_KEY_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&gEfiCertX509Guid,
|
||||
PkKek1, SizeOfPkKek1, &gEfiGlobalVariableGuid,
|
||||
NULL);
|
||||
PkKek1,
|
||||
SizeOfPkKek1,
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreePkKek1;
|
||||
}
|
||||
@ -669,12 +779,20 @@ ShellAppMain (
|
||||
// signatures.
|
||||
//
|
||||
Settings.CustomMode = STANDARD_SECURE_BOOT_MODE;
|
||||
Status = gRT->SetVariable (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid,
|
||||
Status = gRT->SetVariable (
|
||||
EFI_CUSTOM_MODE_NAME,
|
||||
&gEfiCustomModeEnableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof Settings.CustomMode, &Settings.CustomMode);
|
||||
sizeof Settings.CustomMode,
|
||||
&Settings.CustomMode
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AsciiPrint ("error: SetVariable(\"%s\", %g): %r\n", EFI_CUSTOM_MODE_NAME,
|
||||
&gEfiCustomModeEnableGuid, Status);
|
||||
AsciiPrint (
|
||||
"error: SetVariable(\"%s\", %g): %r\n",
|
||||
EFI_CUSTOM_MODE_NAME,
|
||||
&gEfiCustomModeEnableGuid,
|
||||
Status
|
||||
);
|
||||
goto FreePkKek1;
|
||||
}
|
||||
|
||||
@ -713,11 +831,13 @@ ShellAppMain (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreePkKek1;
|
||||
}
|
||||
|
||||
PrintSettings (&Settings);
|
||||
|
||||
if (Settings.SetupMode != 0 || Settings.SecureBoot != 1 ||
|
||||
Settings.SecureBootEnable != 1 || Settings.CustomMode != 0 ||
|
||||
Settings.VendorKeys != 0) {
|
||||
if ((Settings.SetupMode != 0) || (Settings.SecureBoot != 1) ||
|
||||
(Settings.SecureBootEnable != 1) || (Settings.CustomMode != 0) ||
|
||||
(Settings.VendorKeys != 0))
|
||||
{
|
||||
AsciiPrint ("error: unexpected\n");
|
||||
goto FreePkKek1;
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ typedef struct {
|
||||
} REPEATING_HEADER;
|
||||
#pragma pack ()
|
||||
|
||||
|
||||
//
|
||||
// A structure that collects the values of UEFI variables related to Secure
|
||||
// Boot.
|
||||
@ -119,7 +118,6 @@ typedef struct {
|
||||
UINT8 VendorKeys;
|
||||
} SETTINGS;
|
||||
|
||||
|
||||
//
|
||||
// Refer to "AuthData.c" for details on the following objects.
|
||||
//
|
||||
|
@ -51,21 +51,34 @@ MapGcdMmioSpace (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gDS->AddMemorySpace (EfiGcdMemoryTypeMemoryMappedIo, Base, Size,
|
||||
EFI_MEMORY_UC);
|
||||
Status = gDS->AddMemorySpace (
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
Base,
|
||||
Size,
|
||||
EFI_MEMORY_UC
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: failed to add GCD memory space for region [0x%Lx+0x%Lx)\n",
|
||||
__FUNCTION__, Base, Size));
|
||||
__FUNCTION__,
|
||||
Base,
|
||||
Size
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gDS->SetMemorySpaceAttributes (Base, Size, EFI_MEMORY_UC);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: failed to set memory space attributes for region [0x%Lx+0x%Lx)\n",
|
||||
__FUNCTION__, Base, Size));
|
||||
__FUNCTION__,
|
||||
Base,
|
||||
Size
|
||||
));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -114,16 +127,24 @@ ProcessPciHost (
|
||||
*Mmio64Size = 0;
|
||||
IoTranslation = 0;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNode (FdtClient, "pci-host-ecam-generic",
|
||||
&Node);
|
||||
Status = FdtClient->FindCompatibleNode (
|
||||
FdtClient,
|
||||
"pci-host-ecam-generic",
|
||||
&Node
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: No 'pci-host-ecam-generic' compatible DT node found\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -134,15 +155,22 @@ ProcessPciHost (
|
||||
// A DT can legally describe multiple PCI host bridges, but we are not
|
||||
// equipped to deal with that. So assert that there is only one.
|
||||
//
|
||||
Status = FdtClient->FindNextCompatibleNode (FdtClient,
|
||||
"pci-host-ecam-generic", Node, &Tmp);
|
||||
Status = FdtClient->FindNextCompatibleNode (
|
||||
FdtClient,
|
||||
"pci-host-ecam-generic",
|
||||
Node,
|
||||
&Tmp
|
||||
);
|
||||
ASSERT (Status == EFI_NOT_FOUND);
|
||||
);
|
||||
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg", &Prop, &Len);
|
||||
if (EFI_ERROR (Status) || Len != 2 * sizeof (UINT64)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: 'reg' property not found or invalid\n",
|
||||
__FUNCTION__));
|
||||
if (EFI_ERROR (Status) || (Len != 2 * sizeof (UINT64))) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: 'reg' property not found or invalid\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -155,13 +183,22 @@ ProcessPciHost (
|
||||
//
|
||||
// Fetch the bus range (note: inclusive).
|
||||
//
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "bus-range", &Prop,
|
||||
&Len);
|
||||
if (EFI_ERROR (Status) || Len != 2 * sizeof (UINT32)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: 'bus-range' not found or invalid\n",
|
||||
__FUNCTION__));
|
||||
Status = FdtClient->GetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"bus-range",
|
||||
&Prop,
|
||||
&Len
|
||||
);
|
||||
if (EFI_ERROR (Status) || (Len != 2 * sizeof (UINT32))) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: 'bus-range' not found or invalid\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
*BusMin = SwapBytes32 (((CONST UINT32 *)Prop)[0]);
|
||||
*BusMax = SwapBytes32 (((CONST UINT32 *)Prop)[1]);
|
||||
|
||||
@ -169,10 +206,14 @@ ProcessPciHost (
|
||||
// Sanity check: the config space must accommodate all 4K register bytes of
|
||||
// all 8 functions of all 32 devices of all buses.
|
||||
//
|
||||
if (*BusMax < *BusMin || *BusMax - *BusMin == MAX_UINT32 ||
|
||||
DivU64x32 (ConfigSize, SIZE_4KB * 8 * 32) < *BusMax - *BusMin + 1) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: invalid 'bus-range' and/or 'reg'\n",
|
||||
__FUNCTION__));
|
||||
if ((*BusMax < *BusMin) || (*BusMax - *BusMin == MAX_UINT32) ||
|
||||
(DivU64x32 (ConfigSize, SIZE_4KB * 8 * 32) < *BusMax - *BusMin + 1))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: invalid 'bus-range' and/or 'reg'\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -180,14 +221,16 @@ ProcessPciHost (
|
||||
// Iterate over "ranges".
|
||||
//
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "ranges", &Prop, &Len);
|
||||
if (EFI_ERROR (Status) || Len == 0 ||
|
||||
Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0) {
|
||||
if (EFI_ERROR (Status) || (Len == 0) ||
|
||||
(Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0))
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "%a: 'ranges' not found or invalid\n", __FUNCTION__));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
for (RecordIdx = 0; RecordIdx < Len / sizeof (DTB_PCI_HOST_RANGE_RECORD);
|
||||
++RecordIdx) {
|
||||
++RecordIdx)
|
||||
{
|
||||
CONST DTB_PCI_HOST_RANGE_RECORD *Record;
|
||||
|
||||
Record = (CONST DTB_PCI_HOST_RANGE_RECORD *)Prop + RecordIdx;
|
||||
@ -205,8 +248,9 @@ ProcessPciHost (
|
||||
*Mmio32Size = SwapBytes64 (Record->Size);
|
||||
Mmio32Translation = SwapBytes64 (Record->CpuBase) - *Mmio32Base;
|
||||
|
||||
if (*Mmio32Base > MAX_UINT32 || *Mmio32Size > MAX_UINT32 ||
|
||||
*Mmio32Base + *Mmio32Size > SIZE_4GB) {
|
||||
if ((*Mmio32Base > MAX_UINT32) || (*Mmio32Size > MAX_UINT32) ||
|
||||
(*Mmio32Base + *Mmio32Size > SIZE_4GB))
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "%a: MMIO32 space invalid\n", __FUNCTION__));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
@ -214,8 +258,13 @@ ProcessPciHost (
|
||||
ASSERT (PcdGet64 (PcdPciMmio32Translation) == Mmio32Translation);
|
||||
|
||||
if (Mmio32Translation != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: unsupported nonzero MMIO32 translation "
|
||||
"0x%Lx\n", __FUNCTION__, Mmio32Translation));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: unsupported nonzero MMIO32 translation "
|
||||
"0x%Lx\n",
|
||||
__FUNCTION__,
|
||||
Mmio32Translation
|
||||
));
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@ -229,17 +278,27 @@ ProcessPciHost (
|
||||
ASSERT (PcdGet64 (PcdPciMmio64Translation) == Mmio64Translation);
|
||||
|
||||
if (Mmio64Translation != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: unsupported nonzero MMIO64 translation "
|
||||
"0x%Lx\n", __FUNCTION__, Mmio64Translation));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: unsupported nonzero MMIO64 translation "
|
||||
"0x%Lx\n",
|
||||
__FUNCTION__,
|
||||
Mmio64Translation
|
||||
));
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*IoSize == 0 || *Mmio32Size == 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: %a space empty\n", __FUNCTION__,
|
||||
(*IoSize == 0) ? "IO" : "MMIO32"));
|
||||
|
||||
if ((*IoSize == 0) || (*Mmio32Size == 0)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: %a space empty\n",
|
||||
__FUNCTION__,
|
||||
(*IoSize == 0) ? "IO" : "MMIO32"
|
||||
));
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
@ -249,10 +308,23 @@ ProcessPciHost (
|
||||
//
|
||||
ASSERT (PcdGet64 (PcdPciExpressBaseAddress) == ConfigBase);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Config[0x%Lx+0x%Lx) Bus[0x%x..0x%x] "
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Config[0x%Lx+0x%Lx) Bus[0x%x..0x%x] "
|
||||
"Io[0x%Lx+0x%Lx)@0x%Lx Mem32[0x%Lx+0x%Lx)@0x0 Mem64[0x%Lx+0x%Lx)@0x0\n",
|
||||
__FUNCTION__, ConfigBase, ConfigSize, *BusMin, *BusMax, *IoBase, *IoSize,
|
||||
IoTranslation, *Mmio32Base, *Mmio32Size, *Mmio64Base, *Mmio64Size));
|
||||
__FUNCTION__,
|
||||
ConfigBase,
|
||||
ConfigSize,
|
||||
*BusMin,
|
||||
*BusMax,
|
||||
*IoBase,
|
||||
*IoSize,
|
||||
IoTranslation,
|
||||
*Mmio32Base,
|
||||
*Mmio32Size,
|
||||
*Mmio64Base,
|
||||
*Mmio64Size
|
||||
));
|
||||
|
||||
// Map the ECAM space in the GCD memory map
|
||||
Status = MapGcdMmioSpace (ConfigBase, ConfigSize);
|
||||
@ -307,11 +379,23 @@ PciHostBridgeGetRootBridges (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = ProcessPciHost (&IoBase, &IoSize, &Mmio32Base, &Mmio32Size,
|
||||
&Mmio64Base, &Mmio64Size, &BusMin, &BusMax);
|
||||
Status = ProcessPciHost (
|
||||
&IoBase,
|
||||
&IoSize,
|
||||
&Mmio32Base,
|
||||
&Mmio32Size,
|
||||
&Mmio64Base,
|
||||
&Mmio64Size,
|
||||
&BusMin,
|
||||
&BusMax
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: failed to discover PCI host bridge: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: failed to discover PCI host bridge: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
*Count = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -55,14 +55,16 @@ GetPciIoTranslation (
|
||||
// Iterate over "ranges".
|
||||
//
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "ranges", &Prop, &Len);
|
||||
if (EFI_ERROR (Status) || Len == 0 ||
|
||||
Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0) {
|
||||
if (EFI_ERROR (Status) || (Len == 0) ||
|
||||
(Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0))
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "%a: 'ranges' not found or invalid\n", __FUNCTION__));
|
||||
return RETURN_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
for (RecordIdx = 0; RecordIdx < Len / sizeof (DTB_PCI_HOST_RANGE_RECORD);
|
||||
++RecordIdx) {
|
||||
++RecordIdx)
|
||||
{
|
||||
CONST DTB_PCI_HOST_RANGE_RECORD *Record;
|
||||
UINT32 Type;
|
||||
|
||||
@ -75,6 +77,7 @@ GetPciIoTranslation (
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return RETURN_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -106,19 +109,30 @@ FdtPciPcdProducerLibConstructor (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
PciExpressBaseAddress = 0;
|
||||
Status = FdtClient->FindCompatibleNode (FdtClient, "pci-host-ecam-generic",
|
||||
&Node);
|
||||
Status = FdtClient->FindCompatibleNode (
|
||||
FdtClient,
|
||||
"pci-host-ecam-generic",
|
||||
&Node
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",
|
||||
(CONST VOID **)&Reg, &RegSize);
|
||||
Status = FdtClient->GetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"reg",
|
||||
(CONST VOID **)&Reg,
|
||||
&RegSize
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status) && RegSize == 2 * sizeof (UINT64)) {
|
||||
if (!EFI_ERROR (Status) && (RegSize == 2 * sizeof (UINT64))) {
|
||||
PciExpressBaseAddress = SwapBytes64 (*Reg);
|
||||
|
||||
PcdStatus = PcdSetBoolS (PcdPciDisableBusEnumeration, FALSE);
|
||||
@ -135,9 +149,11 @@ FdtPciPcdProducerLibConstructor (
|
||||
// to abort in the general case. So leave it up to the actual driver to
|
||||
// complain about this if it wants to, and just issue a warning here.
|
||||
//
|
||||
DEBUG ((DEBUG_WARN,
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: 'pci-host-ecam-generic' device encountered with no I/O range\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,24 +36,42 @@ InitializeHighMemDxe (
|
||||
UINT64 Attributes;
|
||||
EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL,
|
||||
(VOID **)&Cpu);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiCpuArchProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&Cpu
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Check for memory node and add the memory spaces except the lowest one
|
||||
//
|
||||
for (FindNodeStatus = FdtClient->FindMemoryNodeReg (FdtClient, &Node,
|
||||
(CONST VOID **) &Reg, &AddressCells,
|
||||
&SizeCells, &RegSize);
|
||||
for (FindNodeStatus = FdtClient->FindMemoryNodeReg (
|
||||
FdtClient,
|
||||
&Node,
|
||||
(CONST VOID **)&Reg,
|
||||
&AddressCells,
|
||||
&SizeCells,
|
||||
&RegSize
|
||||
);
|
||||
!EFI_ERROR (FindNodeStatus);
|
||||
FindNodeStatus = FdtClient->FindNextMemoryNodeReg (FdtClient, Node,
|
||||
&Node, (CONST VOID **) &Reg, &AddressCells,
|
||||
&SizeCells, &RegSize)) {
|
||||
FindNodeStatus = FdtClient->FindNextMemoryNodeReg (
|
||||
FdtClient,
|
||||
Node,
|
||||
&Node,
|
||||
(CONST VOID **)&Reg,
|
||||
&AddressCells,
|
||||
&SizeCells,
|
||||
&RegSize
|
||||
))
|
||||
{
|
||||
ASSERT (AddressCells <= 2);
|
||||
ASSERT (SizeCells <= 2);
|
||||
|
||||
@ -62,36 +80,60 @@ InitializeHighMemDxe (
|
||||
if (AddressCells > 1) {
|
||||
CurBase = (CurBase << 32) | SwapBytes32 (*Reg++);
|
||||
}
|
||||
|
||||
CurSize = SwapBytes32 (*Reg++);
|
||||
if (SizeCells > 1) {
|
||||
CurSize = (CurSize << 32) | SwapBytes32 (*Reg++);
|
||||
}
|
||||
|
||||
RegSize -= (AddressCells + SizeCells) * sizeof (UINT32);
|
||||
|
||||
Status = gDS->GetMemorySpaceDescriptor (CurBase, &GcdDescriptor);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN,
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: Region 0x%lx - 0x%lx not found in the GCD memory space map\n",
|
||||
__FUNCTION__, CurBase, CurBase + CurSize - 1));
|
||||
__FUNCTION__,
|
||||
CurBase,
|
||||
CurBase + CurSize - 1
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (GcdDescriptor.GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
|
||||
Status = gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, CurBase,
|
||||
CurSize, EFI_MEMORY_WB);
|
||||
Status = gDS->AddMemorySpace (
|
||||
EfiGcdMemoryTypeSystemMemory,
|
||||
CurBase,
|
||||
CurSize,
|
||||
EFI_MEMORY_WB
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Failed to add System RAM @ 0x%lx - 0x%lx (%r)\n",
|
||||
__FUNCTION__, CurBase, CurBase + CurSize - 1, Status));
|
||||
__FUNCTION__,
|
||||
CurBase,
|
||||
CurBase + CurSize - 1,
|
||||
Status
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = gDS->SetMemorySpaceAttributes (CurBase, CurSize,
|
||||
EFI_MEMORY_WB);
|
||||
Status = gDS->SetMemorySpaceAttributes (
|
||||
CurBase,
|
||||
CurSize,
|
||||
EFI_MEMORY_WB
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN,
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: gDS->SetMemorySpaceAttributes() failed on region 0x%lx - 0x%lx (%r)\n",
|
||||
__FUNCTION__, CurBase, CurBase + CurSize - 1, Status));
|
||||
__FUNCTION__,
|
||||
CurBase,
|
||||
CurBase + CurSize - 1,
|
||||
Status
|
||||
));
|
||||
}
|
||||
|
||||
//
|
||||
@ -107,19 +149,30 @@ InitializeHighMemDxe (
|
||||
//
|
||||
Attributes = EFI_MEMORY_WB;
|
||||
if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) &
|
||||
(1U << (UINT32)EfiConventionalMemory)) != 0) {
|
||||
(1U << (UINT32)EfiConventionalMemory)) != 0)
|
||||
{
|
||||
Attributes |= EFI_MEMORY_XP;
|
||||
}
|
||||
|
||||
Status = Cpu->SetMemoryAttributes (Cpu, CurBase, CurSize, Attributes);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Failed to set System RAM @ 0x%lx - 0x%lx attribute (%r)\n",
|
||||
__FUNCTION__, CurBase, CurBase + CurSize - 1, Status));
|
||||
__FUNCTION__,
|
||||
CurBase,
|
||||
CurBase + CurSize - 1,
|
||||
Status
|
||||
));
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "%a: Add System RAM @ 0x%lx - 0x%lx\n",
|
||||
__FUNCTION__, CurBase, CurBase + CurSize - 1));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Add System RAM @ 0x%lx - 0x%lx\n",
|
||||
__FUNCTION__,
|
||||
CurBase,
|
||||
CurBase + CurSize - 1
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,21 +44,40 @@ InitializeVirtioFdtDxe (
|
||||
EFI_HANDLE Handle;
|
||||
UINT64 RegBase;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
for (FindNodeStatus = FdtClient->FindCompatibleNode (FdtClient,
|
||||
"virtio,mmio", &Node);
|
||||
for (FindNodeStatus = FdtClient->FindCompatibleNode (
|
||||
FdtClient,
|
||||
"virtio,mmio",
|
||||
&Node
|
||||
);
|
||||
!EFI_ERROR (FindNodeStatus);
|
||||
FindNodeStatus = FdtClient->FindNextCompatibleNode (FdtClient,
|
||||
"virtio,mmio", Node, &Node)) {
|
||||
|
||||
Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",
|
||||
(CONST VOID **)&Reg, &RegSize);
|
||||
FindNodeStatus = FdtClient->FindNextCompatibleNode (
|
||||
FdtClient,
|
||||
"virtio,mmio",
|
||||
Node,
|
||||
&Node
|
||||
))
|
||||
{
|
||||
Status = FdtClient->GetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"reg",
|
||||
(CONST VOID **)&Reg,
|
||||
&RegSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: GetNodeProperty () failed (Status == %r)\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -71,7 +90,8 @@ InitializeVirtioFdtDxe (
|
||||
DevicePath = (VIRTIO_TRANSPORT_DEVICE_PATH *)CreateDeviceNode (
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
sizeof (VIRTIO_TRANSPORT_DEVICE_PATH));
|
||||
sizeof (VIRTIO_TRANSPORT_DEVICE_PATH)
|
||||
);
|
||||
if (DevicePath == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Out of memory\n", __FUNCTION__));
|
||||
continue;
|
||||
@ -79,39 +99,62 @@ InitializeVirtioFdtDxe (
|
||||
|
||||
CopyGuid (&DevicePath->Vendor.Guid, &gVirtioMmioTransportGuid);
|
||||
DevicePath->PhysBase = RegBase;
|
||||
SetDevicePathNodeLength (&DevicePath->Vendor,
|
||||
sizeof (*DevicePath) - sizeof (DevicePath->End));
|
||||
SetDevicePathNodeLength (
|
||||
&DevicePath->Vendor,
|
||||
sizeof (*DevicePath) - sizeof (DevicePath->End)
|
||||
);
|
||||
SetDevicePathEndNode (&DevicePath->End);
|
||||
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (&Handle,
|
||||
&gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
|
||||
DevicePath);
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
DevicePath
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Failed to install the EFI_DEVICE_PATH "
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Failed to install the EFI_DEVICE_PATH "
|
||||
"protocol on a new handle (Status == %r)\n",
|
||||
__FUNCTION__, Status));
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
FreePool (DevicePath);
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = VirtioMmioInstallDevice (RegBase, Handle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Failed to install VirtIO transport @ 0x%Lx "
|
||||
"on handle %p (Status == %r)\n", __FUNCTION__, RegBase,
|
||||
Handle, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Failed to install VirtIO transport @ 0x%Lx "
|
||||
"on handle %p (Status == %r)\n",
|
||||
__FUNCTION__,
|
||||
RegBase,
|
||||
Handle,
|
||||
Status
|
||||
));
|
||||
|
||||
Status = gBS->UninstallProtocolInterface (Handle,
|
||||
&gEfiDevicePathProtocolGuid, DevicePath);
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
DevicePath
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
FreePool (DevicePath);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (EFI_ERROR (FindNodeStatus) && FindNodeStatus != EFI_NOT_FOUND) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Error occurred while iterating DT nodes "
|
||||
"(FindNodeStatus == %r)\n", __FUNCTION__, FindNodeStatus));
|
||||
if (EFI_ERROR (FindNodeStatus) && (FindNodeStatus != EFI_NOT_FOUND)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Error occurred while iterating DT nodes "
|
||||
"(FindNodeStatus == %r)\n",
|
||||
__FUNCTION__,
|
||||
FindNodeStatus
|
||||
));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/** @file
|
||||
/** @file
|
||||
UEFI Configuration Table for exposing the SEV Launch Secret location to UEFI
|
||||
applications (boot loaders).
|
||||
|
||||
|
@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __E820_H__
|
||||
#define __E820_H__
|
||||
|
||||
|
@ -107,18 +107,18 @@ typedef struct {
|
||||
} MPT_SCSI_IO_REQUEST;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Length: 24;
|
||||
UINT32 EndOfList: 1;
|
||||
UINT32 Is64BitAddress: 1;
|
||||
UINT32 Length : 24;
|
||||
UINT32 EndOfList : 1;
|
||||
UINT32 Is64BitAddress : 1;
|
||||
//
|
||||
// True when the buffer contains data to be transfered. Otherwise it's the
|
||||
// destination buffer
|
||||
//
|
||||
UINT32 BufferContainsData: 1;
|
||||
UINT32 LocalAddress: 1;
|
||||
UINT32 ElementType: 2;
|
||||
UINT32 EndOfBuffer: 1;
|
||||
UINT32 LastElement: 1;
|
||||
UINT32 BufferContainsData : 1;
|
||||
UINT32 LocalAddress : 1;
|
||||
UINT32 ElementType : 2;
|
||||
UINT32 EndOfBuffer : 1;
|
||||
UINT32 LastElement : 1;
|
||||
UINT64 DataBufferAddress;
|
||||
} MPT_SG_ENTRY_SIMPLE;
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
//
|
||||
typedef union {
|
||||
struct {
|
||||
UINT8 BitB:1;
|
||||
UINT8 BitX:1;
|
||||
UINT8 BitR:1;
|
||||
UINT8 BitW:1;
|
||||
UINT8 Rex:4;
|
||||
UINT8 BitB : 1;
|
||||
UINT8 BitX : 1;
|
||||
UINT8 BitR : 1;
|
||||
UINT8 BitW : 1;
|
||||
UINT8 Rex : 4;
|
||||
} Bits;
|
||||
|
||||
UINT8 Uint8;
|
||||
@ -32,9 +32,9 @@ typedef union {
|
||||
//
|
||||
typedef union {
|
||||
struct {
|
||||
UINT8 Rm:3;
|
||||
UINT8 Reg:3;
|
||||
UINT8 Mod:2;
|
||||
UINT8 Rm : 3;
|
||||
UINT8 Reg : 3;
|
||||
UINT8 Mod : 2;
|
||||
} Bits;
|
||||
|
||||
UINT8 Uint8;
|
||||
@ -45,9 +45,9 @@ typedef union {
|
||||
//
|
||||
typedef union {
|
||||
struct {
|
||||
UINT8 Base:3;
|
||||
UINT8 Index:3;
|
||||
UINT8 Scale:2;
|
||||
UINT8 Base : 3;
|
||||
UINT8 Index : 3;
|
||||
UINT8 Scale : 2;
|
||||
} Bits;
|
||||
|
||||
UINT8 Uint8;
|
||||
|
@ -87,11 +87,11 @@ struct screen_info {
|
||||
UINT8 orig_video_cols; /* 0x07 */
|
||||
UINT8 flags; /* 0x08 */
|
||||
UINT8 unused2; /* 0x09 */
|
||||
UINT16 orig_video_ega_bx;/* 0x0a */
|
||||
UINT16 orig_video_ega_bx; /* 0x0a */
|
||||
UINT16 unused3; /* 0x0c */
|
||||
UINT8 orig_video_lines; /* 0x0e */
|
||||
UINT8 orig_video_isVGA; /* 0x0f */
|
||||
UINT16 orig_video_points;/* 0x10 */
|
||||
UINT16 orig_video_points; /* 0x10 */
|
||||
|
||||
/* VESA graphic mode -- linear frame buffer */
|
||||
UINT16 lfb_width; /* 0x12 */
|
||||
@ -138,7 +138,7 @@ struct boot_params {
|
||||
UINT8 edd_mbr_sig_buf_entries;
|
||||
UINT8 _pad6[6];
|
||||
struct setup_header hdr;
|
||||
UINT8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
|
||||
UINT8 _pad7[0x290-0x1f1-sizeof (struct setup_header)];
|
||||
UINT32 edd_mbr_sig_buffer[16];
|
||||
struct e820_entry e820_map[128];
|
||||
UINT8 _pad8[48];
|
||||
@ -153,6 +153,9 @@ typedef struct {
|
||||
|
||||
#pragma pack()
|
||||
|
||||
extern EFI_STATUS setup_graphics(struct boot_params *buf);
|
||||
extern EFI_STATUS
|
||||
setup_graphics (
|
||||
struct boot_params *buf
|
||||
);
|
||||
|
||||
#endif /* __LINUX_BZIMAGE_H__ */
|
||||
|
@ -4,6 +4,7 @@
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MICROVM_H__
|
||||
#define __MICROVM_H__
|
||||
|
||||
|
@ -25,21 +25,21 @@
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 Present:1; // 0 = Not present in memory,
|
||||
UINT64 Present : 1; // 0 = Not present in memory,
|
||||
// 1 = Present in memory
|
||||
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough:1; // 0 = Write-Back caching,
|
||||
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor : 1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough : 1; // 0 = Write-Back caching,
|
||||
// 1 = Write-Through caching
|
||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed:1; // 0 = Not accessed,
|
||||
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed : 1; // 0 = Not accessed,
|
||||
// 1 = Accessed (set by CPU)
|
||||
UINT64 Reserved:1; // Reserved
|
||||
UINT64 MustBeZero:2; // Must Be Zero
|
||||
UINT64 Available:3; // Available for use by system software
|
||||
UINT64 PageTableBaseAddress:40; // Page Table Base Address
|
||||
UINT64 AvabilableHigh:11; // Available for use by system software
|
||||
UINT64 Nx:1; // No Execute bit
|
||||
UINT64 Reserved : 1; // Reserved
|
||||
UINT64 MustBeZero : 2; // Must Be Zero
|
||||
UINT64 Available : 3; // Available for use by system software
|
||||
UINT64 PageTableBaseAddress : 40; // Page Table Base Address
|
||||
UINT64 AvabilableHigh : 11; // Available for use by system software
|
||||
UINT64 Nx : 1; // No Execute bit
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
} PAGE_MAP_AND_DIRECTORY_POINTER;
|
||||
@ -49,24 +49,24 @@ typedef union {
|
||||
//
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 Present:1; // 0 = Not present in memory,
|
||||
UINT64 Present : 1; // 0 = Not present in memory,
|
||||
// 1 = Present in memory
|
||||
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough:1; // 0 = Write-Back caching,
|
||||
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor : 1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough : 1; // 0 = Write-Back caching,
|
||||
// 1 = Write-Through caching
|
||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed:1; // 0 = Not accessed,
|
||||
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed : 1; // 0 = Not accessed,
|
||||
// 1 = Accessed (set by CPU)
|
||||
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by
|
||||
UINT64 Dirty : 1; // 0 = Not Dirty, 1 = written by
|
||||
// processor on access to page
|
||||
UINT64 PAT:1; //
|
||||
UINT64 Global:1; // 0 = Not global page, 1 = global page
|
||||
UINT64 PAT : 1; //
|
||||
UINT64 Global : 1; // 0 = Not global page, 1 = global page
|
||||
// TLB not cleared on CR3 write
|
||||
UINT64 Available:3; // Available for use by system software
|
||||
UINT64 PageTableBaseAddress:40; // Page Table Base Address
|
||||
UINT64 AvabilableHigh:11; // Available for use by system software
|
||||
UINT64 Nx:1; // 0 = Execute Code,
|
||||
UINT64 Available : 3; // Available for use by system software
|
||||
UINT64 PageTableBaseAddress : 40; // Page Table Base Address
|
||||
UINT64 AvabilableHigh : 11; // Available for use by system software
|
||||
UINT64 Nx : 1; // 0 = Execute Code,
|
||||
// 1 = No Code Execution
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
@ -77,26 +77,26 @@ typedef union {
|
||||
//
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 Present:1; // 0 = Not present in memory,
|
||||
UINT64 Present : 1; // 0 = Not present in memory,
|
||||
// 1 = Present in memory
|
||||
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough:1; // 0 = Write-Back caching,
|
||||
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor : 1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough : 1; // 0 = Write-Back caching,
|
||||
// 1=Write-Through caching
|
||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed:1; // 0 = Not accessed,
|
||||
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed : 1; // 0 = Not accessed,
|
||||
// 1 = Accessed (set by CPU)
|
||||
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by
|
||||
UINT64 Dirty : 1; // 0 = Not Dirty, 1 = written by
|
||||
// processor on access to page
|
||||
UINT64 MustBe1:1; // Must be 1
|
||||
UINT64 Global:1; // 0 = Not global page, 1 = global page
|
||||
UINT64 MustBe1 : 1; // Must be 1
|
||||
UINT64 Global : 1; // 0 = Not global page, 1 = global page
|
||||
// TLB not cleared on CR3 write
|
||||
UINT64 Available:3; // Available for use by system software
|
||||
UINT64 PAT:1; //
|
||||
UINT64 MustBeZero:8; // Must be zero;
|
||||
UINT64 PageTableBaseAddress:31; // Page Table Base Address
|
||||
UINT64 AvabilableHigh:11; // Available for use by system software
|
||||
UINT64 Nx:1; // 0 = Execute Code,
|
||||
UINT64 Available : 3; // Available for use by system software
|
||||
UINT64 PAT : 1; //
|
||||
UINT64 MustBeZero : 8; // Must be zero;
|
||||
UINT64 PageTableBaseAddress : 31; // Page Table Base Address
|
||||
UINT64 AvabilableHigh : 11; // Available for use by system software
|
||||
UINT64 Nx : 1; // 0 = Execute Code,
|
||||
// 1 = No Code Execution
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
@ -107,26 +107,26 @@ typedef union {
|
||||
//
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 Present:1; // 0 = Not present in memory,
|
||||
UINT64 Present : 1; // 0 = Not present in memory,
|
||||
// 1 = Present in memory
|
||||
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough:1; // 0 = Write-Back caching,
|
||||
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor : 1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough : 1; // 0 = Write-Back caching,
|
||||
// 1 = Write-Through caching
|
||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed:1; // 0 = Not accessed,
|
||||
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed : 1; // 0 = Not accessed,
|
||||
// 1 = Accessed (set by CPU)
|
||||
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by
|
||||
UINT64 Dirty : 1; // 0 = Not Dirty, 1 = written by
|
||||
// processor on access to page
|
||||
UINT64 MustBe1:1; // Must be 1
|
||||
UINT64 Global:1; // 0 = Not global page, 1 = global page
|
||||
UINT64 MustBe1 : 1; // Must be 1
|
||||
UINT64 Global : 1; // 0 = Not global page, 1 = global page
|
||||
// TLB not cleared on CR3 write
|
||||
UINT64 Available:3; // Available for use by system software
|
||||
UINT64 PAT:1; //
|
||||
UINT64 MustBeZero:17; // Must be zero;
|
||||
UINT64 PageTableBaseAddress:22; // Page Table Base Address
|
||||
UINT64 AvabilableHigh:11; // Available for use by system software
|
||||
UINT64 Nx:1; // 0 = Execute Code,
|
||||
UINT64 Available : 3; // Available for use by system software
|
||||
UINT64 PAT : 1; //
|
||||
UINT64 MustBeZero : 17; // Must be zero;
|
||||
UINT64 PageTableBaseAddress : 22; // Page Table Base Address
|
||||
UINT64 AvabilableHigh : 11; // Available for use by system software
|
||||
UINT64 Nx : 1; // 0 = Execute Code,
|
||||
// 1 = No Code Execution
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
|
@ -80,7 +80,6 @@ typedef enum {
|
||||
QemuFwCfgItemX86Irq0Override = 0x8002,
|
||||
QemuFwCfgItemX86E820Table = 0x8003,
|
||||
QemuFwCfgItemX86HpetData = 0x8004,
|
||||
|
||||
} FIRMWARE_CONFIG_ITEM;
|
||||
|
||||
//
|
||||
|
@ -35,7 +35,6 @@
|
||||
#define VIRTIO_VENDOR_ID 0x1AF4
|
||||
#define VIRTIO_MMIO_MAGIC 0x74726976 // "virt"
|
||||
|
||||
|
||||
//
|
||||
// VirtIo Device Specific Configuration Offsets
|
||||
//
|
||||
@ -104,7 +103,6 @@ typedef struct {
|
||||
volatile UINT16 *UsedEvent; // unused as per negotiation
|
||||
} VRING_AVAIL;
|
||||
|
||||
|
||||
//
|
||||
// virtio-0.9.5, 2.3.5 Used Ring
|
||||
//
|
||||
@ -124,7 +122,6 @@ typedef struct {
|
||||
volatile UINT16 *AvailEvent; // unused as per negotiation
|
||||
} VRING_USED;
|
||||
|
||||
|
||||
//
|
||||
// virtio-0.9.5, 2.3.2 Descriptor Table
|
||||
//
|
||||
@ -165,5 +162,4 @@ typedef struct {
|
||||
#define VIRTIO_F_RING_INDIRECT_DESC BIT28
|
||||
#define VIRTIO_F_RING_EVENT_IDX BIT29
|
||||
|
||||
|
||||
#endif // _VIRTIO_0_9_5_H_
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <IndustryStandard/Virtio.h>
|
||||
|
||||
|
||||
//
|
||||
// virtio-0.9.5, Appendix D: Block Device
|
||||
//
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <IndustryStandard/Virtio.h>
|
||||
|
||||
|
||||
//
|
||||
// virtio-0.9.5, Appendix I: SCSI Host Device
|
||||
//
|
||||
|
@ -184,67 +184,66 @@
|
||||
_sxghr_tmp->q = 0; \
|
||||
_sxghr_tmp->p = val; \
|
||||
} while ( 0 )
|
||||
#ifdef __XEN_TOOLS__
|
||||
#ifdef __XEN_TOOLS__
|
||||
#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
|
||||
#endif
|
||||
#endif
|
||||
#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
#if defined (__GNUC__) && !defined (__STRICT_ANSI__)
|
||||
/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */
|
||||
# define __DECL_REG(n64, n32) union { \
|
||||
#define __DECL_REG(n64, n32) union { \
|
||||
UINT64 n64; \
|
||||
UINT32 n32; \
|
||||
}
|
||||
#else
|
||||
#else
|
||||
/* Non-gcc sources must always use the proper 64-bit name (e.g., x0). */
|
||||
#define __DECL_REG(n64, n32) UINT64 n64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct vcpu_guest_core_regs
|
||||
{
|
||||
struct vcpu_guest_core_regs {
|
||||
/* Aarch64 Aarch32 */
|
||||
__DECL_REG(x0, r0_usr);
|
||||
__DECL_REG(x1, r1_usr);
|
||||
__DECL_REG(x2, r2_usr);
|
||||
__DECL_REG(x3, r3_usr);
|
||||
__DECL_REG(x4, r4_usr);
|
||||
__DECL_REG(x5, r5_usr);
|
||||
__DECL_REG(x6, r6_usr);
|
||||
__DECL_REG(x7, r7_usr);
|
||||
__DECL_REG(x8, r8_usr);
|
||||
__DECL_REG(x9, r9_usr);
|
||||
__DECL_REG(x10, r10_usr);
|
||||
__DECL_REG(x11, r11_usr);
|
||||
__DECL_REG(x12, r12_usr);
|
||||
__DECL_REG (x0, r0_usr);
|
||||
__DECL_REG (x1, r1_usr);
|
||||
__DECL_REG (x2, r2_usr);
|
||||
__DECL_REG (x3, r3_usr);
|
||||
__DECL_REG (x4, r4_usr);
|
||||
__DECL_REG (x5, r5_usr);
|
||||
__DECL_REG (x6, r6_usr);
|
||||
__DECL_REG (x7, r7_usr);
|
||||
__DECL_REG (x8, r8_usr);
|
||||
__DECL_REG (x9, r9_usr);
|
||||
__DECL_REG (x10, r10_usr);
|
||||
__DECL_REG (x11, r11_usr);
|
||||
__DECL_REG (x12, r12_usr);
|
||||
|
||||
__DECL_REG(x13, sp_usr);
|
||||
__DECL_REG(x14, lr_usr);
|
||||
__DECL_REG (x13, sp_usr);
|
||||
__DECL_REG (x14, lr_usr);
|
||||
|
||||
__DECL_REG(x15, __unused_sp_hyp);
|
||||
__DECL_REG (x15, __unused_sp_hyp);
|
||||
|
||||
__DECL_REG(x16, lr_irq);
|
||||
__DECL_REG(x17, sp_irq);
|
||||
__DECL_REG (x16, lr_irq);
|
||||
__DECL_REG (x17, sp_irq);
|
||||
|
||||
__DECL_REG(x18, lr_svc);
|
||||
__DECL_REG(x19, sp_svc);
|
||||
__DECL_REG (x18, lr_svc);
|
||||
__DECL_REG (x19, sp_svc);
|
||||
|
||||
__DECL_REG(x20, lr_abt);
|
||||
__DECL_REG(x21, sp_abt);
|
||||
__DECL_REG (x20, lr_abt);
|
||||
__DECL_REG (x21, sp_abt);
|
||||
|
||||
__DECL_REG(x22, lr_und);
|
||||
__DECL_REG(x23, sp_und);
|
||||
__DECL_REG (x22, lr_und);
|
||||
__DECL_REG (x23, sp_und);
|
||||
|
||||
__DECL_REG(x24, r8_fiq);
|
||||
__DECL_REG(x25, r9_fiq);
|
||||
__DECL_REG(x26, r10_fiq);
|
||||
__DECL_REG(x27, r11_fiq);
|
||||
__DECL_REG(x28, r12_fiq);
|
||||
__DECL_REG (x24, r8_fiq);
|
||||
__DECL_REG (x25, r9_fiq);
|
||||
__DECL_REG (x26, r10_fiq);
|
||||
__DECL_REG (x27, r11_fiq);
|
||||
__DECL_REG (x28, r12_fiq);
|
||||
|
||||
__DECL_REG(x29, sp_fiq);
|
||||
__DECL_REG(x30, lr_fiq);
|
||||
__DECL_REG (x29, sp_fiq);
|
||||
__DECL_REG (x30, lr_fiq);
|
||||
|
||||
/* Return address and mode */
|
||||
__DECL_REG(pc64, pc32); /* ELR_EL2 */
|
||||
__DECL_REG (pc64, pc32); /* ELR_EL2 */
|
||||
UINT32 cpsr; /* SPSR_EL2 */
|
||||
|
||||
union {
|
||||
@ -259,10 +258,11 @@ struct vcpu_guest_core_regs
|
||||
UINT64 sp_el0;
|
||||
UINT64 sp_el1, elr_el1;
|
||||
};
|
||||
typedef struct vcpu_guest_core_regs vcpu_guest_core_regs_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);
|
||||
|
||||
#undef __DECL_REG
|
||||
typedef struct vcpu_guest_core_regs vcpu_guest_core_regs_t;
|
||||
DEFINE_XEN_GUEST_HANDLE (vcpu_guest_core_regs_t);
|
||||
|
||||
#undef __DECL_REG
|
||||
|
||||
typedef UINT64 xen_pfn_t;
|
||||
#define PRI_xen_pfn PRIx64
|
||||
@ -274,10 +274,10 @@ typedef UINT64 xen_pfn_t;
|
||||
typedef UINT64 xen_ulong_t;
|
||||
#define PRI_xen_ulong PRIx64
|
||||
|
||||
#if defined(__XEN__) || defined(__XEN_TOOLS__)
|
||||
#if defined (__XEN__) || defined (__XEN_TOOLS__)
|
||||
struct vcpu_guest_context {
|
||||
#define _VGCF_online 0
|
||||
#define VGCF_online (1<<_VGCF_online)
|
||||
#define _VGCF_online 0
|
||||
#define VGCF_online (1<<_VGCF_online)
|
||||
UINT32 flags; /* VGCF_* */
|
||||
|
||||
struct vcpu_guest_core_regs user_regs; /* Core CPU registers */
|
||||
@ -285,22 +285,25 @@ struct vcpu_guest_context {
|
||||
UINT32 sctlr;
|
||||
UINT64 ttbcr, ttbr0, ttbr1;
|
||||
};
|
||||
|
||||
typedef struct vcpu_guest_context vcpu_guest_context_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
|
||||
#endif
|
||||
DEFINE_XEN_GUEST_HANDLE (vcpu_guest_context_t);
|
||||
#endif
|
||||
|
||||
struct arch_vcpu_info {
|
||||
};
|
||||
|
||||
typedef struct arch_vcpu_info arch_vcpu_info_t;
|
||||
|
||||
struct arch_shared_info {
|
||||
};
|
||||
|
||||
typedef struct arch_shared_info arch_shared_info_t;
|
||||
typedef UINT64 xen_callback_t;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__XEN__) || defined(__XEN_TOOLS__)
|
||||
#if defined (__XEN__) || defined (__XEN_TOOLS__)
|
||||
|
||||
/* PSR bits (CPSR, SPSR)*/
|
||||
|
||||
@ -325,7 +328,7 @@ typedef UINT64 xen_callback_t;
|
||||
#define PSR_MODE_SYS 0x1f
|
||||
|
||||
/* 64 bit modes */
|
||||
#define PSR_MODE_BIT 0x10 /* Set iff AArch32 */
|
||||
#define PSR_MODE_BIT 0x10/* Set iff AArch32 */
|
||||
#define PSR_MODE_EL3h 0x0d
|
||||
#define PSR_MODE_EL3t 0x0c
|
||||
#define PSR_MODE_EL2h 0x09
|
||||
|
@ -26,6 +26,7 @@ struct arch_vcpu_info {
|
||||
UINTN cr2;
|
||||
UINTN pad[5]; /* sizeof(vcpu_info_t) == 64 */
|
||||
};
|
||||
|
||||
typedef struct arch_vcpu_info arch_vcpu_info_t;
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
@ -26,6 +26,7 @@ struct arch_vcpu_info {
|
||||
UINTN cr2;
|
||||
UINTN pad; /* sizeof(vcpu_info_t) == 64 */
|
||||
};
|
||||
|
||||
typedef struct arch_vcpu_info arch_vcpu_info_t;
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
@ -14,13 +14,13 @@
|
||||
#define __XEN_PUBLIC_ARCH_X86_XEN_H__
|
||||
|
||||
/* Structural guest handles introduced in 0x00030201. */
|
||||
#if __XEN_INTERFACE_VERSION__ >= 0x00030201
|
||||
#if __XEN_INTERFACE_VERSION__ >= 0x00030201
|
||||
#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
|
||||
typedef struct { type *p; } __guest_handle_ ## name
|
||||
#else
|
||||
#else
|
||||
#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
|
||||
typedef type * __guest_handle_ ## name
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XEN_GUEST_HANDLE represents a guest pointer, when passed as a field
|
||||
@ -38,37 +38,37 @@
|
||||
#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
|
||||
#define XEN_GUEST_HANDLE_PARAM(name) XEN_GUEST_HANDLE(name)
|
||||
#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0)
|
||||
#ifdef __XEN_TOOLS__
|
||||
#ifdef __XEN_TOOLS__
|
||||
#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
|
||||
#endif
|
||||
#endif
|
||||
#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
|
||||
|
||||
#if defined(MDE_CPU_IA32)
|
||||
#include "xen-x86_32.h"
|
||||
#elif defined(MDE_CPU_X64)
|
||||
#include "xen-x86_64.h"
|
||||
#endif
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#include "xen-x86_32.h"
|
||||
#elif defined (MDE_CPU_X64)
|
||||
#include "xen-x86_64.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifndef __ASSEMBLY__
|
||||
typedef UINTN xen_pfn_t;
|
||||
#define PRI_xen_pfn "lx"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define XEN_HAVE_PV_UPCALL_MASK 1
|
||||
|
||||
/* Maximum number of virtual CPUs in legacy multi-processor guests. */
|
||||
#define XEN_LEGACY_MAX_VCPUS 32
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
typedef UINTN xen_ulong_t;
|
||||
#define PRI_xen_ulong "lx"
|
||||
|
||||
typedef UINT64 tsc_timestamp_t; /* RDTSC timestamp */
|
||||
|
||||
#ifdef MDE_CPU_IA32
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
#ifdef MDE_CPU_IA32
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
struct arch_shared_info {
|
||||
UINTN max_pfn; /* max pfn that appears in table */
|
||||
/* Frame containing list of mfns containing list of mfns containing p2m. */
|
||||
@ -76,12 +76,13 @@ struct arch_shared_info {
|
||||
UINTN nmi_reason;
|
||||
UINT64 pad[32];
|
||||
};
|
||||
typedef struct arch_shared_info arch_shared_info_t;
|
||||
#ifdef MDE_CPU_IA32
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
typedef struct arch_shared_info arch_shared_info_t;
|
||||
#ifdef MDE_CPU_IA32
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* __XEN_PUBLIC_ARCH_X86_XEN_H__ */
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
/* ` } */
|
||||
|
||||
typedef UINT32 evtchn_port_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(evtchn_port_t);
|
||||
DEFINE_XEN_GUEST_HANDLE (evtchn_port_t);
|
||||
|
||||
/*
|
||||
* EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
|
||||
@ -66,6 +66,7 @@ struct evtchn_alloc_unbound {
|
||||
/* OUT parameters */
|
||||
evtchn_port_t port;
|
||||
};
|
||||
|
||||
typedef struct evtchn_alloc_unbound evtchn_alloc_unbound_t;
|
||||
|
||||
/*
|
||||
@ -77,6 +78,7 @@ struct evtchn_close {
|
||||
/* IN parameters. */
|
||||
evtchn_port_t port;
|
||||
};
|
||||
|
||||
typedef struct evtchn_close evtchn_close_t;
|
||||
|
||||
/*
|
||||
@ -87,6 +89,7 @@ struct evtchn_send {
|
||||
/* IN parameters. */
|
||||
evtchn_port_t port;
|
||||
};
|
||||
|
||||
typedef struct evtchn_send evtchn_send_t;
|
||||
|
||||
#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
|
||||
|
@ -117,12 +117,14 @@ struct grant_entry_v1 {
|
||||
UINT16 flags;
|
||||
/* The domain being granted foreign privileges. [GST] */
|
||||
domid_t domid;
|
||||
|
||||
/*
|
||||
* GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
|
||||
* GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
|
||||
*/
|
||||
UINT32 frame;
|
||||
};
|
||||
|
||||
typedef struct grant_entry_v1 grant_entry_v1_t;
|
||||
|
||||
/* The first few grant table entries will be preserved across grant table
|
||||
@ -197,6 +199,7 @@ typedef struct grant_entry_v1 grant_entry_v1_t;
|
||||
* on the grant table version in use by the other domain.
|
||||
*/
|
||||
#if __XEN_INTERFACE_VERSION__ >= 0x0003020a
|
||||
|
||||
/*
|
||||
* Version 1 and version 2 grant entries share a common prefix. The
|
||||
* fields of the prefix are documented as part of struct
|
||||
@ -206,6 +209,7 @@ struct grant_entry_header {
|
||||
UINT16 flags;
|
||||
domid_t domid;
|
||||
};
|
||||
|
||||
typedef struct grant_entry_header grant_entry_header_t;
|
||||
|
||||
/*
|
||||
@ -259,6 +263,7 @@ union grant_entry_v2 {
|
||||
|
||||
UINT32 __spacer[4]; /* Pad to a power of two */
|
||||
};
|
||||
|
||||
typedef union grant_entry_v2 grant_entry_v2_t;
|
||||
|
||||
typedef UINT16 grant_status_t;
|
||||
@ -317,8 +322,9 @@ struct gnttab_map_grant_ref {
|
||||
grant_handle_t handle;
|
||||
UINT64 dev_bus_addr;
|
||||
};
|
||||
|
||||
typedef struct gnttab_map_grant_ref gnttab_map_grant_ref_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(gnttab_map_grant_ref_t);
|
||||
DEFINE_XEN_GUEST_HANDLE (gnttab_map_grant_ref_t);
|
||||
|
||||
/*
|
||||
* GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
|
||||
@ -339,22 +345,24 @@ struct gnttab_unmap_grant_ref {
|
||||
/* OUT parameters. */
|
||||
INT16 status; /* => enum grant_status */
|
||||
};
|
||||
|
||||
typedef struct gnttab_unmap_grant_ref gnttab_unmap_grant_ref_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t);
|
||||
DEFINE_XEN_GUEST_HANDLE (gnttab_unmap_grant_ref_t);
|
||||
|
||||
/*
|
||||
* Bitfield values for gnttab_map_grant_ref.flags.
|
||||
*/
|
||||
/* Map the grant entry for access by I/O devices. */
|
||||
/* Map the grant entry for access by I/O devices. */
|
||||
#define _GNTMAP_device_map (0)
|
||||
#define GNTMAP_device_map (1<<_GNTMAP_device_map)
|
||||
/* Map the grant entry for access by host CPUs. */
|
||||
/* Map the grant entry for access by host CPUs. */
|
||||
#define _GNTMAP_host_map (1)
|
||||
#define GNTMAP_host_map (1<<_GNTMAP_host_map)
|
||||
/* Accesses to the granted frame will be restricted to read-only access. */
|
||||
/* Accesses to the granted frame will be restricted to read-only access. */
|
||||
#define _GNTMAP_readonly (2)
|
||||
#define GNTMAP_readonly (1<<_GNTMAP_readonly)
|
||||
/*
|
||||
|
||||
/*
|
||||
* GNTMAP_host_map subflag:
|
||||
* 0 => The host mapping is usable only by the guest OS.
|
||||
* 1 => The host mapping is usable by guest OS + current application.
|
||||
@ -362,7 +370,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t);
|
||||
#define _GNTMAP_application_map (3)
|
||||
#define GNTMAP_application_map (1<<_GNTMAP_application_map)
|
||||
|
||||
/*
|
||||
/*
|
||||
* GNTMAP_contains_pte subflag:
|
||||
* 0 => This map request contains a host virtual address.
|
||||
* 1 => This map request contains the machine address of the PTE to update.
|
||||
|
@ -15,7 +15,8 @@ struct xen_hvm_param {
|
||||
UINT32 index; /* IN */
|
||||
UINT64 value; /* IN/OUT */
|
||||
};
|
||||
|
||||
typedef struct xen_hvm_param xen_hvm_param_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t);
|
||||
DEFINE_XEN_GUEST_HANDLE (xen_hvm_param_t);
|
||||
|
||||
#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define HVM_PARAM_BUFIOREQ_PFN 6
|
||||
#define HVM_PARAM_BUFIOREQ_EVTCHN 26
|
||||
|
||||
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
|
||||
#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
|
||||
|
||||
/* Expose Viridian interfaces to this HVM guest? */
|
||||
#define HVM_PARAM_VIRIDIAN 9
|
||||
|
@ -417,6 +417,7 @@
|
||||
*/
|
||||
#define BLKIF_OP_READ 0
|
||||
#define BLKIF_OP_WRITE 1
|
||||
|
||||
/*
|
||||
* All writes issued prior to a request with the BLKIF_OP_WRITE_BARRIER
|
||||
* operation code ("barrier request") must be completed prior to the
|
||||
@ -426,6 +427,7 @@
|
||||
* Optional. See "feature-barrier" XenBus node documentation above.
|
||||
*/
|
||||
#define BLKIF_OP_WRITE_BARRIER 2
|
||||
|
||||
/*
|
||||
* Commit any uncommitted contents of the backing device's volatile cache
|
||||
* to stable storage.
|
||||
@ -433,11 +435,13 @@
|
||||
* Optional. See "feature-flush-cache" XenBus node documentation above.
|
||||
*/
|
||||
#define BLKIF_OP_FLUSH_DISKCACHE 3
|
||||
|
||||
/*
|
||||
* Used in SLES sources for device specific command packet
|
||||
* contained within the request. Reserved for that purpose.
|
||||
*/
|
||||
#define BLKIF_OP_RESERVED_1 4
|
||||
|
||||
/*
|
||||
* Indicate to the backend device that a region of storage is no longer in
|
||||
* use, and may be discarded at any time without impact to the client. If
|
||||
@ -514,22 +518,23 @@ struct blkif_request_segment {
|
||||
/*
|
||||
* Starting ring element for any I/O request.
|
||||
*/
|
||||
#if defined(MDE_CPU_IA32)
|
||||
#if defined (MDE_CPU_IA32)
|
||||
//
|
||||
// pack(4) is necessary when these structs are compiled for Ia32.
|
||||
// Without it, the struct will have a different alignment than the one
|
||||
// a backend expect for a 32bit guest.
|
||||
//
|
||||
#pragma pack(4)
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
struct blkif_request {
|
||||
UINT8 operation; /* BLKIF_OP_??? */
|
||||
UINT8 nr_segments; /* number of segments */
|
||||
blkif_vdev_t handle; /* only for read/write requests */
|
||||
UINT64 id; /* private guest value, echoed in resp */
|
||||
blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
|
||||
blkif_sector_t sector_number; /* start sector idx on disk (r/w only) */
|
||||
struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
|
||||
};
|
||||
|
||||
typedef struct blkif_request blkif_request_t;
|
||||
|
||||
/*
|
||||
@ -539,12 +544,13 @@ typedef struct blkif_request blkif_request_t;
|
||||
struct blkif_request_discard {
|
||||
UINT8 operation; /* BLKIF_OP_DISCARD */
|
||||
UINT8 flag; /* BLKIF_DISCARD_SECURE or zero */
|
||||
#define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */
|
||||
#define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */
|
||||
blkif_vdev_t handle; /* same as for read/write requests */
|
||||
UINT64 id; /* private guest value, echoed in resp */
|
||||
blkif_sector_t sector_number;/* start sector idx on disk */
|
||||
blkif_sector_t sector_number; /* start sector idx on disk */
|
||||
UINT64 nr_sectors; /* number of contiguous sectors to discard*/
|
||||
};
|
||||
|
||||
typedef struct blkif_request_discard blkif_request_discard_t;
|
||||
|
||||
struct blkif_request_indirect {
|
||||
@ -552,13 +558,14 @@ struct blkif_request_indirect {
|
||||
UINT8 indirect_op; /* BLKIF_OP_{READ/WRITE} */
|
||||
UINT16 nr_segments; /* number of segments */
|
||||
UINT64 id; /* private guest value, echoed in resp */
|
||||
blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
|
||||
blkif_sector_t sector_number; /* start sector idx on disk (r/w only) */
|
||||
blkif_vdev_t handle; /* same as for read/write requests */
|
||||
grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
|
||||
#ifdef MDE_CPU_IA32
|
||||
#ifdef MDE_CPU_IA32
|
||||
UINT64 pad; /* Make it 64 byte aligned on i386 */
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct blkif_request_indirect blkif_request_indirect_t;
|
||||
|
||||
struct blkif_response {
|
||||
@ -566,25 +573,26 @@ struct blkif_response {
|
||||
UINT8 operation; /* copied from request */
|
||||
INT16 status; /* BLKIF_RSP_??? */
|
||||
};
|
||||
|
||||
typedef struct blkif_response blkif_response_t;
|
||||
#if defined(MDE_CPU_IA32)
|
||||
#pragma pack()
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* STATUS RETURN CODES.
|
||||
*/
|
||||
/* Operation not supported (only happens on barrier writes). */
|
||||
/* Operation not supported (only happens on barrier writes). */
|
||||
#define BLKIF_RSP_EOPNOTSUPP -2
|
||||
/* Operation failed for some unspecified reason (-EIO). */
|
||||
/* Operation failed for some unspecified reason (-EIO). */
|
||||
#define BLKIF_RSP_ERROR -1
|
||||
/* Operation completed successfully. */
|
||||
/* Operation completed successfully. */
|
||||
#define BLKIF_RSP_OKAY 0
|
||||
|
||||
/*
|
||||
* Generate blkif ring structures and types.
|
||||
*/
|
||||
DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
|
||||
DEFINE_RING_TYPES (blkif, struct blkif_request, struct blkif_response);
|
||||
|
||||
#define VDISK_CDROM 0x1
|
||||
#define VDISK_REMOVABLE 0x2
|
||||
|
@ -11,14 +11,14 @@
|
||||
#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"
|
||||
#define XEN_IO_PROTO_ABI_ARM "arm-abi"
|
||||
|
||||
#if defined(MDE_CPU_IA32)
|
||||
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
|
||||
#elif defined(MDE_CPU_X64)
|
||||
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
|
||||
#elif defined (MDE_CPU_X64)
|
||||
#define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
|
||||
#elif defined (__arm__) || defined (__aarch64__)
|
||||
#define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
|
||||
#else
|
||||
# error arch fixup needed here
|
||||
#error arch fixup needed here
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user