/** @file\r
Code for Processor S3 restoration\r
\r
-Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
}\r
\r
//\r
- // Restore SMBASE for BSP and all APs\r
+ // Make sure the gSmmBaseHobGuid existence status is the same between normal and S3 boot.\r
//\r
- SmmRelocateBases ();\r
+ ASSERT (mSmmRelocated == (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL));\r
+ if (mSmmRelocated != (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL)) {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "gSmmBaseHobGuid %a produced in normal boot but %a in S3 boot!",\r
+ mSmmRelocated ? "is" : "is not",\r
+ mSmmRelocated ? "is not" : "is"\r
+ ));\r
+ CpuDeadLoop ();\r
+ }\r
+\r
+ //\r
+ // Check whether Smm Relocation is done or not.\r
+ // If not, will do the SmmBases Relocation here!!!\r
+ //\r
+ if (!mSmmRelocated) {\r
+ //\r
+ // Restore SMBASE for BSP and all APs\r
+ //\r
+ SmmRelocateBases ();\r
+ } else {\r
+ //\r
+ // Issue SMI IPI (All Excluding Self SMM IPI + BSP SMM IPI) to execute first SMI init.\r
+ //\r
+ ExecuteFirstSmiInit ();\r
+ }\r
\r
//\r
// Skip initialization if mAcpiCpuData is not valid\r