Revision: 17131
http://sourceforge.net/p/edk2/code/17131
Author: li-elvin
Date: 2015-04-08 01:44:22 +0000 (Wed, 08 Apr 2015)
Log Message:
-----------
IntelFrameworkModulePkg: Update LegacyBiosDxe to use UmaAddress and UmaSize in
CSM 0.98.
The UmaAddress/UmaSize fields allows the CSM to have writable memory
between the top of the option ROMs and the start of its read-only code segment.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <[email protected]>
Reviewed-by: Elvin Li <[email protected]>
Modified Paths:
--------------
trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
Modified:
trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
2015-04-08 01:40:47 UTC (rev 17130)
+++ trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
2015-04-08 01:44:22 UTC (rev 17131)
@@ -1238,6 +1238,24 @@
0x40000,
&Granularity
);
+
+ if ((Private->Legacy16Table->TableLength >= OFFSET_OF
(EFI_COMPATIBILITY16_TABLE, HiPermanentMemoryAddress)) &&
+ ((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((EFI_D_INFO, "Unlocking UMB RAM region 0x%x-0x%x\n",
Private->Legacy16Table->UmaAddress,
+ Private->Legacy16Table->UmaAddress +
Private->Legacy16Table->UmaSize));
+
+ Private->LegacyRegion->UnLock (
+ Private->LegacyRegion,
+ Private->Legacy16Table->UmaAddress,
+ Private->Legacy16Table->UmaSize,
+ &Granularity
+ );
+ }
+
//
// Lock attributes of the Legacy Region if chipset supports
//
Modified: trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
2015-04-08 01:40:47 UTC (rev 17130)
+++ trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
2015-04-08 01:44:22 UTC (rev 17131)
@@ -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 @@
UINT32 LocalTime;
UINT32 StartBbsIndex;
UINT32 EndBbsIndex;
+ UINT32 MaxRomAddr;
UINTN TempData;
UINTN InitAddress;
UINTN RuntimeAddress;
@@ -2299,7 +2300,16 @@
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);
if ((OpromRevision >= 3) && (Private->Csm16PciInterfaceVersion >= 0x0300)) {
@@ -2331,7 +2341,7 @@
// 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 @@
// 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
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits