summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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));
//