mirror of https://github.com/acidanthera/audk.git
OVMF: Support greater than 2GB of memory
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10928 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
3d131d1a20
commit
55cdb67acb
|
@ -54,7 +54,7 @@ GetSystemMemorySize (
|
|||
Cmos0x34 = (UINT8) CmosRead8 (0x34);
|
||||
Cmos0x35 = (UINT8) CmosRead8 (0x35);
|
||||
|
||||
return ((((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
|
||||
return (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ GetSystemMemorySize (
|
|||
@return EFI_SUCCESS The PEIM initialized successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
MemDetect (
|
||||
)
|
||||
{
|
||||
|
@ -103,6 +103,6 @@ MemDetect (
|
|||
AddMemoryRangeHob (BASE_1MB, MemoryBase);
|
||||
AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
return MemoryBase + MemorySize;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ AddMemoryRangeHob (
|
|||
|
||||
VOID
|
||||
MemMapInitialization (
|
||||
EFI_PHYSICAL_ADDRESS TopOfMemory
|
||||
)
|
||||
{
|
||||
//
|
||||
|
@ -129,22 +130,26 @@ MemMapInitialization (
|
|||
//
|
||||
// Add PCI MMIO space available to PCI resource allocations
|
||||
//
|
||||
AddIoMemoryBaseSizeHob (0x80000000, 0xFEC00000 - 0x80000000);
|
||||
if (TopOfMemory < BASE_2GB) {
|
||||
AddIoMemoryBaseSizeHob (BASE_2GB, 0xFEC00000 - BASE_2GB);
|
||||
} else {
|
||||
AddIoMemoryBaseSizeHob (TopOfMemory, 0xFEC00000 - TopOfMemory);
|
||||
}
|
||||
|
||||
//
|
||||
// Local APIC range
|
||||
//
|
||||
AddIoMemoryBaseSizeHob (0xFEC80000, 0x80000);
|
||||
AddIoMemoryBaseSizeHob (0xFEC80000, SIZE_512KB);
|
||||
|
||||
//
|
||||
// I/O APIC range
|
||||
//
|
||||
AddIoMemoryBaseSizeHob (0xFEC00000, 0x80000);
|
||||
AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_512KB);
|
||||
|
||||
//
|
||||
// Video memory + Legacy BIOS region
|
||||
//
|
||||
AddIoMemoryRangeHob (0x0A0000, 0x100000);
|
||||
AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,7 +160,7 @@ MiscInitialization (
|
|||
//
|
||||
// Disable A20 Mask
|
||||
//
|
||||
IoWrite8 (0x92, (UINT8) (IoRead8 (0x92) | 0x02));
|
||||
IoOr8 (0x92, BIT1);
|
||||
|
||||
//
|
||||
// Build the CPU hob with 36-bit addressing and 16-bits of IO space.
|
||||
|
@ -206,15 +211,17 @@ InitializePlatform (
|
|||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
{
|
||||
EFI_PHYSICAL_ADDRESS TopOfMemory;
|
||||
|
||||
DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));
|
||||
|
||||
MemDetect ();
|
||||
TopOfMemory = MemDetect ();
|
||||
|
||||
ReserveEmuVariableNvStore ();
|
||||
|
||||
PeiFvInitialization ();
|
||||
|
||||
MemMapInitialization ();
|
||||
MemMapInitialization (TopOfMemory);
|
||||
|
||||
MiscInitialization ();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ AddMemoryRangeHob (
|
|||
EFI_PHYSICAL_ADDRESS MemoryLimit
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
MemDetect (
|
||||
VOID
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue