From 7f446eba268ceed7c3ca4bc93db1673c3b353128 Mon Sep 17 00:00:00 2001 From: niruiyu Date: Mon, 24 Sep 2012 02:57:47 +0000 Subject: Handle the case when OpROM wants to completely remove itself. Signed-off-by: Ruiyu Ni Reviewed-by: Elvin Li git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13736 6f19259b-4bc3-4df7-8a09-765794883524 --- IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'IntelFrameworkModulePkg/Csm/LegacyBiosDxe') 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)); // -- cgit v1.2.3