summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c')
-rw-r--r--IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
index 7299fc0e6b..9d84ab0000 100644
--- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
+++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -2284,6 +2284,7 @@ LegacyBiosInstallRom (
UINT32 LocalTime;
UINT32 StartBbsIndex;
UINT32 EndBbsIndex;
+ UINT32 MaxRomAddr;
UINTN TempData;
UINTN InitAddress;
UINTN RuntimeAddress;
@@ -2299,6 +2300,15 @@ LegacyBiosInstallRom (
Function = 0;
VideoMode = 0;
PhysicalAddress = 0;
+ MaxRomAddr = PcdGet32 (PcdEndOpromShadowAddress);
+
+ if ((Private->Legacy16Table->TableLength >= OFFSET_OF(EFI_COMPATIBILITY16_TABLE, HiPermanentMemoryAddress)) &&
+ (Private->Legacy16Table->UmaAddress != 0) &&
+ (Private->Legacy16Table->UmaSize != 0) &&
+ (MaxRomAddr > (Private->Legacy16Table->UmaAddress))) {
+ MaxRomAddr = Private->Legacy16Table->UmaAddress;
+ }
+
PciProgramAllInterruptLineRegisters (Private);
@@ -2331,7 +2341,7 @@ LegacyBiosInstallRom (
// then test if there is enough space for its RT code
//
RuntimeAddress = Private->OptionRom;
- if (RuntimeAddress + *RuntimeImageLength > PcdGet32 (PcdEndOpromShadowAddress)) {
+ if (RuntimeAddress + *RuntimeImageLength > MaxRomAddr) {
DEBUG ((EFI_D_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", __LINE__));
gBS->FreePages (PhysicalAddress, EFI_SIZE_TO_PAGES (ImageSize));
//
@@ -2349,7 +2359,7 @@ LegacyBiosInstallRom (
// test if there is enough space for its INIT code
//
InitAddress = PCI_START_ADDRESS (Private->OptionRom);
- if (InitAddress + ImageSize > PcdGet32 (PcdEndOpromShadowAddress)) {
+ if (InitAddress + ImageSize > MaxRomAddr) {
DEBUG ((EFI_D_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", __LINE__));
//
// Report Status Code to indicate that there is no enough space for OpROM