]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Handle the case when OpROM wants to completely remove itself.
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 24 Sep 2012 02:57:47 +0000 (02:57 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 24 Sep 2012 02:57:47 +0000 (02:57 +0000)
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

IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c

index 1d09bb879d41f3e51fa711c3091eb97ddc369f5f..5e155f07050138a469bd3c99805ae5eb5da66982 100644 (file)
@@ -2536,7 +2536,16 @@ LegacyBiosInstallRom (
   //\r
   // The ROM could have updated it's size so we need to read again.\r
   //\r
-  *RuntimeImageLength = ((EFI_LEGACY_EXPANSION_ROM_HEADER *) (RuntimeAddress))->Size512 * 512;\r
+  if ((((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) &&\r
+      (((EFI_LEGACY_EXPANSION_ROM_HEADER *) InitAddress)->Size512 == 0)) {\r
+    //\r
+    // The INIT function didn't copy the RUNTIME code to RuntimeAddress\r
+    //\r
+    *RuntimeImageLength = 0;\r
+  } else {\r
+    *RuntimeImageLength = ((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Size512 * 512;\r
+  }\r
+\r
   DEBUG ((EFI_D_INFO, " fsize = %x\n", *RuntimeImageLength));\r
 \r
   //\r