summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-24 02:57:47 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-24 02:57:47 +0000
commit7f446eba268ceed7c3ca4bc93db1673c3b353128 (patch)
tree9faf213833c4f26da9afd16289e9036116988b5f
parenta9c12422ff2b4d8c4aec3d940302fc61b4ee39f7 (diff)
downloadedk2-platforms-7f446eba268ceed7c3ca4bc93db1673c3b353128.tar.xz
Handle the case when OpROM wants to completely remove itself.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> Reviewed-by: Elvin Li<elvin.li@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13736 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
index 1d09bb879d..5e155f0705 100644
--- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
+++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
@@ -2536,7 +2536,16 @@ LegacyBiosInstallRom (
//
// The ROM could have updated it's size so we need to read again.
//
- *RuntimeImageLength = ((EFI_LEGACY_EXPANSION_ROM_HEADER *) (RuntimeAddress))->Size512 * 512;
+ if ((((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) &&
+ (((EFI_LEGACY_EXPANSION_ROM_HEADER *) InitAddress)->Size512 == 0)) {
+ //
+ // The INIT function didn't copy the RUNTIME code to RuntimeAddress
+ //
+ *RuntimeImageLength = 0;
+ } else {
+ *RuntimeImageLength = ((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Size512 * 512;
+ }
+
DEBUG ((EFI_D_INFO, " fsize = %x\n", *RuntimeImageLength));
//