It's good to me!

Reviewed-by: Jeff Fan <jeff....@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Michael 
Kinney
Sent: Saturday, October 31, 2015 2:03 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH] UefiCpuPkg: PiSmmCpuDxeSmm: Remove Framework 
compatibility

The PiSmmCpuDxeSmm module is using PcdFrameworkCompatibilitySupport to provide 
compatibility with the SMM support in the IntelFrameworkPkg.
This change removes the Framework compatibility and requires all SMM modules 
that provide SMI handlers to follow the PI Specification.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kin...@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c   | 60 ++++------------------------
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h   |  1 -
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf |  3 --
 3 files changed, 8 insertions(+), 56 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index e210c8d..7e4d0d9 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -74,17 +74,10 @@ EFI_SMM_CPU_PROTOCOL  mSmmCpu  = {
   SmmWriteSaveState
 };
 
 EFI_CPU_INTERRUPT_HANDLER   mExternalVectorTable[EXCEPTION_VECTOR_NUMBER];
 
-///
-/// SMM CPU Save State Protocol instance -/// -EFI_SMM_CPU_SAVE_STATE_PROTOCOL 
 mSmmCpuSaveState = {
-  NULL
-};
-
 //
 // SMM stack information
 //
 UINTN mSmmStackArrayBase;
 UINTN mSmmStackArrayEnd;
@@ -528,42 +521,32 @@ SmmRestoreCpu (
     //
     InitializeDebugAgent (DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64, (VOID 
*)&Ia32Idtr, NULL);
   }
 
   //
-  // Do below CPU things for native platform only
+  // Skip initialization if mAcpiCpuData is not valid
   //
-  if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {
+  if (mAcpiCpuData.NumberOfCpus > 0) {
     //
-    // Skip initialization if mAcpiCpuData is not valid
+    // First time microcode load and restore MTRRs
     //
-    if (mAcpiCpuData.NumberOfCpus > 0) {
-      //
-      // First time microcode load and restore MTRRs
-      //
-      EarlyInitializeCpu ();
-    }
+    EarlyInitializeCpu ();
   }
 
   //
   // Restore SMBASE for BSP and all APs
   //
   SmmRelocateBases ();
 
   //
-  // Do below CPU things for native platform only
+  // Skip initialization if mAcpiCpuData is not valid
   //
-  if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {
+  if (mAcpiCpuData.NumberOfCpus > 0) {
     //
-    // Skip initialization if mAcpiCpuData is not valid
+    // Restore MSRs for BSP and all APs
     //
-    if (mAcpiCpuData.NumberOfCpus > 0) {
-      //
-      // Restore MSRs for BSP and all APs
-      //
-      InitializeCpu ();
-    }
+    InitializeCpu ();
   }
 
   //
   // Set a flag to restore SMM configuration in S3 path.
   //
@@ -685,17 +668,10 @@ SmmReadyToLockEventNotify (
   // Prevent use of mAcpiCpuData by initialize NumberOfCpus to 0
   //
   mAcpiCpuData.NumberOfCpus = 0;
 
   //
-  // If FrameworkCompatibilitySspport is enabled, then do not copy CPU S3 Data 
into SMRAM
-  //
-  if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {
-    goto Done;
-  }
-
-  //
   // If PcdCpuS3DataAddress was never set, then do not copy CPU S3 Data into 
SMRAM
   //
   AcpiCpuData = (ACPI_CPU_DATA *)(UINTN)PcdGet64 (PcdCpuS3DataAddress);
   if (AcpiCpuData == 0) {
     goto Done;
@@ -1007,11 +983,10 @@ PiCpuSmmEntry (
   gSmmCpuPrivate->CpuSaveState = (VOID **)AllocatePool (sizeof (VOID *) * 
mMaxNumberOfCpus);
   ASSERT (gSmmCpuPrivate->CpuSaveState != NULL);
 
   mSmmCpuPrivateData.SmmCoreEntryContext.CpuSaveStateSize = 
gSmmCpuPrivate->CpuSaveStateSize;
   mSmmCpuPrivateData.SmmCoreEntryContext.CpuSaveState     = 
gSmmCpuPrivate->CpuSaveState;
-  mSmmCpuSaveState.CpuSaveState = (EFI_SMM_CPU_STATE 
**)gSmmCpuPrivate->CpuSaveState;
 
   //
   // Allocate buffer for pointers to array in CPU_HOT_PLUG_DATA.
   //
   mCpuHotPlugData.ApicId = (UINT64 *)AllocatePool (sizeof (UINT64) * 
mMaxNumberOfCpus); @@ -1148,29 +1123,10 @@ PiCpuSmmEntry (
   // Initialize SMM CPU Services Support
   //
   Status = InitializeSmmCpuServices (mSmmCpuHandle);
   ASSERT_EFI_ERROR (Status);
 
-  if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {
-    //
-    // Install Framework SMM Save State Protocol into UEFI protocol database 
for backward compatibility
-    //
-    Status = SystemTable->BootServices->InstallMultipleProtocolInterfaces (
-                                          &gSmmCpuPrivate->SmmCpuHandle,
-                                          &gEfiSmmCpuSaveStateProtocolGuid,
-                                          &mSmmCpuSaveState,
-                                          NULL
-                                          );
-    ASSERT_EFI_ERROR (Status);
-    //
-    // The SmmStartupThisAp service in Framework SMST should always be 
non-null.
-    // Update SmmStartupThisAp pointer in PI SMST here so that PI/Framework 
SMM thunk
-    // can have it ready when constructing Framework SMST.
-    //
-    gSmst->SmmStartupThisAp = SmmStartupThisAp;
-  }
-
   //
   // register SMM Ready To Lock Protocol notification
   //
   Status = gSmst->SmmRegisterProtocolNotify (
                     &gEfiSmmReadyToLockProtocolGuid, diff --git 
a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index 162bdad..cfbf2ca 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -19,11 +19,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 #include <Protocol/MpService.h>
 #include <Protocol/SmmConfiguration.h>
 #include <Protocol/SmmCpu.h>
 #include <Protocol/SmmAccess2.h>
-#include <Protocol/SmmCpuSaveState.h>
 #include <Protocol/SmmReadyToLock.h>
 #include <Protocol/SmmCpuService.h>
 
 #include <Guid/AcpiS3Context.h>
 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
index f559947..a293a88 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
@@ -87,11 +87,10 @@
 
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   UefiCpuPkg/UefiCpuPkg.dec
-  IntelFrameworkPkg/IntelFrameworkPkg.dec
 
 [LibraryClasses]
   UefiDriverEntryPoint
   UefiRuntimeServicesTableLib
   CacheMaintenanceLib
@@ -124,20 +123,18 @@
   gEfiMpServiceProtocolGuid                ## CONSUMES
   gEfiSmmConfigurationProtocolGuid         ## PRODUCES
   gEfiSmmCpuProtocolGuid                   ## PRODUCES
   gEfiSmmReadyToLockProtocolGuid           ## NOTIFY
   gEfiSmmCpuServiceProtocolGuid            ## PRODUCES
-  gEfiSmmCpuSaveStateProtocolGuid          ## SOMETIMES_PRODUCES
 
 [Guids]
   gEfiAcpiVariableGuid                     ## SOMETIMES_CONSUMES ## HOB # it 
is used for S3 boot.
   gEfiGlobalVariableGuid                   ## SOMETIMES_PRODUCES ## 
Variable:L"SmmProfileData"
   gEfiAcpi20TableGuid                      ## SOMETIMES_CONSUMES ## SystemTable
   gEfiAcpi10TableGuid                      ## SOMETIMES_CONSUMES ## SystemTable
 
 [FeaturePcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport  ## CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmDebug                         ## CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmBlockStartupThisAp            ## CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection             ## CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport                   ## CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard                    ## CONSUMES
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to