]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: SmmIplEntry(): don't suppress SMM core startup failure
authorLaszlo Ersek <lersek@redhat.com>
Tue, 12 May 2015 01:48:34 +0000 (01:48 +0000)
committererictian <erictian@Edk2>
Tue, 12 May 2015 01:48:34 +0000 (01:48 +0000)
When the ExecuteSmmCoreFromSmram() function fails, SmmIplEntry()
restores the SMRAM range to EFI_MEMORY_UC. However, it saves the
return value of gDS->SetMemorySpaceAttributes() in the same Status
variable that gDS->contains the return value of ExecuteSmmCoreFromSmram().

Therefore, if gDS->SetMemorySpaceAttributes() succeeds, the failure
of ExecuteSmmCoreFromSmram() is masked, and Bad Things Happen (TM).

Introduce a temporary variable just for the return value of
gDS->SetMemorySpaceAttributes().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17417 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c

index 4759579cab51626ccfd1469d6b429b3fe7486fbd..64565e937d30192f36af825387df77e7a29e98f5 100644 (file)
@@ -1042,6 +1042,7 @@ SmmIplEntry (
   UINT64                          SmmCodeSize;\r
   EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE    *LMFAConfigurationTable;\r
   EFI_CPU_ARCH_PROTOCOL           *CpuArch;\r
+  EFI_STATUS                      SetAttrStatus;\r
 \r
   //\r
   // Fill in the image handle of the SMM IPL so the SMM Core can use this as the \r
@@ -1213,12 +1214,12 @@ SmmIplEntry (
       // Attempt to reset SMRAM cacheability to UC\r
       //\r
       if (CpuArch != NULL) {\r
-        Status = gDS->SetMemorySpaceAttributes(\r
-                        mSmramCacheBase, \r
-                        mSmramCacheSize,\r
-                        EFI_MEMORY_UC\r
-                        );\r
-        if (EFI_ERROR (Status)) {\r
+        SetAttrStatus = gDS->SetMemorySpaceAttributes(\r
+                               mSmramCacheBase, \r
+                               mSmramCacheSize,\r
+                               EFI_MEMORY_UC\r
+                               );\r
+        if (EFI_ERROR (SetAttrStatus)) {\r
           DEBUG ((DEBUG_WARN, "SMM IPL failed to reset SMRAM window to EFI_MEMORY_UC\n"));\r
         }  \r
       }\r