]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/SmmCpuFeaturesLib: Split into two files
authorMichael Kinney <michael.d.kinney@intel.com>
Fri, 18 Nov 2016 04:54:19 +0000 (20:54 -0800)
committerFeng Tian <feng.tian@intel.com>
Mon, 19 Dec 2016 01:32:38 +0000 (09:32 +0800)
Split the default implementation of the SmmCpuFeaturesLib
into two files to prepare for the addition of the STM
specific SmmCpuFeaturesLib implementation.  The STM
specific implementation installs a different SMI entry
handler and initialize the MSEG specific MSR at the end
of SmmCpuFeaturesInitializeProcessor().

This patch does not introduce any functional changes
to the default implementation of the SmmCpuFeaturesLib.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c [new file with mode: 0644]

index 1754f2df5f5789fd41be6f6f98fdffe7b895f1cd..31d73cd0b865b4f65d201287eeeb66ef5b2c2bc1 100644 (file)
@@ -41,6 +41,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define SMM_FEATURES_LIB_IA32_MCA_CAP              0x17D\r
 #define   SMM_CODE_ACCESS_CHK_BIT                  BIT58\r
 \r
+/**\r
+  Internal worker function that is called to complete CPU initialization at the\r
+  end of SmmCpuFeaturesInitializeProcessor()\r
+\r
+**/\r
+VOID\r
+FinishSmmCpuFeaturesInitializeProcessor (\r
+  VOID\r
+  );\r
+\r
 //\r
 // Set default value to assume SMRR is not supported\r
 //\r
@@ -257,7 +267,7 @@ SmmCpuFeaturesInitializeProcessor (
       // Print message and halt if CPU is Monarch\r
       //\r
       if (IsMonarch) {\r
-        DEBUG ((EFI_D_ERROR, "SMM Base/Size does not meet alignment/size requirement!\n"));\r
+        DEBUG ((DEBUG_ERROR, "SMM Base/Size does not meet alignment/size requirement!\n"));\r
         CpuDeadLoop ();\r
       }\r
     } else {\r
@@ -296,6 +306,11 @@ SmmCpuFeaturesInitializeProcessor (
       }\r
     }\r
   }\r
+\r
+  //\r
+  //  Call internal worker function that completes the CPU initialization\r
+  //\r
+  FinishSmmCpuFeaturesInitializeProcessor ();\r
 }\r
 \r
 /**\r
@@ -356,66 +371,6 @@ SmmCpuFeaturesSmmRelocationComplete (
 {\r
 }\r
 \r
-/**\r
-  Return the size, in bytes, of a custom SMI Handler in bytes.  If 0 is\r
-  returned, then a custom SMI handler is not provided by this library,\r
-  and the default SMI handler must be used.\r
-\r
-  @retval 0    Use the default SMI handler.\r
-  @retval > 0  Use the SMI handler installed by SmmCpuFeaturesInstallSmiHandler()\r
-               The caller is required to allocate enough SMRAM for each CPU to\r
-               support the size of the custom SMI handler.\r
-**/\r
-UINTN\r
-EFIAPI\r
-SmmCpuFeaturesGetSmiHandlerSize (\r
-  VOID\r
-  )\r
-{\r
-  return 0;\r
-}\r
-\r
-/**\r
-  Install a custom SMI handler for the CPU specified by CpuIndex.  This function\r
-  is only called if SmmCpuFeaturesGetSmiHandlerSize() returns a size is greater\r
-  than zero and is called by the CPU that was elected as monarch during System\r
-  Management Mode initialization.\r
-\r
-  @param[in] CpuIndex   The index of the CPU to install the custom SMI handler.\r
-                        The value must be between 0 and the NumberOfCpus field\r
-                        in the System Management System Table (SMST).\r
-  @param[in] SmBase     The SMBASE address for the CPU specified by CpuIndex.\r
-  @param[in] SmiStack   The stack to use when an SMI is processed by the\r
-                        the CPU specified by CpuIndex.\r
-  @param[in] StackSize  The size, in bytes, if the stack used when an SMI is\r
-                        processed by the CPU specified by CpuIndex.\r
-  @param[in] GdtBase    The base address of the GDT to use when an SMI is\r
-                        processed by the CPU specified by CpuIndex.\r
-  @param[in] GdtSize    The size, in bytes, of the GDT used when an SMI is\r
-                        processed by the CPU specified by CpuIndex.\r
-  @param[in] IdtBase    The base address of the IDT to use when an SMI is\r
-                        processed by the CPU specified by CpuIndex.\r
-  @param[in] IdtSize    The size, in bytes, of the IDT used when an SMI is\r
-                        processed by the CPU specified by CpuIndex.\r
-  @param[in] Cr3        The base address of the page tables to use when an SMI\r
-                        is processed by the CPU specified by CpuIndex.\r
-**/\r
-VOID\r
-EFIAPI\r
-SmmCpuFeaturesInstallSmiHandler (\r
-  IN UINTN   CpuIndex,\r
-  IN UINT32  SmBase,\r
-  IN VOID    *SmiStack,\r
-  IN UINTN   StackSize,\r
-  IN UINTN   GdtBase,\r
-  IN UINTN   GdtSize,\r
-  IN UINTN   IdtBase,\r
-  IN UINTN   IdtSize,\r
-  IN UINT32  Cr3\r
-  )\r
-{\r
-}\r
-\r
 /**\r
   Determines if MTRR registers must be configured to set SMRAM cache-ability\r
   when executing in System Management Mode.\r
index 1735062b17e3d98223f5a7635912434c3ccb20a7..77908b03661bc2eaf3f758950baee9a5419bddf4 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  The CPU specific programming for PiSmmCpuDxeSmm module.\r
 #\r
-#  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
@@ -24,6 +24,7 @@
 \r
 [Sources]\r
   SmmCpuFeaturesLib.c\r
+  SmmCpuFeaturesLibNoStm.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c
new file mode 100644 (file)
index 0000000..e872eec
--- /dev/null
@@ -0,0 +1,89 @@
+/** @file\r
+The CPU specific programming for PiSmmCpuDxeSmm module when STM support\r
+is not included.\r
+\r
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <PiSmm.h>\r
+#include <Library/SmmCpuFeaturesLib.h>\r
+\r
+/**\r
+  Internal worker function that is called to complete CPU initialization at the\r
+  end of SmmCpuFeaturesInitializeProcessor()\r
+\r
+**/\r
+VOID\r
+FinishSmmCpuFeaturesInitializeProcessor (\r
+  VOID\r
+  )\r
+{\r
+}\r
+\r
+/**\r
+  Return the size, in bytes, of a custom SMI Handler in bytes.  If 0 is\r
+  returned, then a custom SMI handler is not provided by this library,\r
+  and the default SMI handler must be used.\r
+\r
+  @retval 0    Use the default SMI handler.\r
+  @retval > 0  Use the SMI handler installed by SmmCpuFeaturesInstallSmiHandler()\r
+               The caller is required to allocate enough SMRAM for each CPU to\r
+               support the size of the custom SMI handler.\r
+**/\r
+UINTN\r
+EFIAPI\r
+SmmCpuFeaturesGetSmiHandlerSize (\r
+  VOID\r
+  )\r
+{\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Install a custom SMI handler for the CPU specified by CpuIndex.  This function\r
+  is only called if SmmCpuFeaturesGetSmiHandlerSize() returns a size is greater\r
+  than zero and is called by the CPU that was elected as monarch during System\r
+  Management Mode initialization.\r
+\r
+  @param[in] CpuIndex   The index of the CPU to install the custom SMI handler.\r
+                        The value must be between 0 and the NumberOfCpus field\r
+                        in the System Management System Table (SMST).\r
+  @param[in] SmBase     The SMBASE address for the CPU specified by CpuIndex.\r
+  @param[in] SmiStack   The stack to use when an SMI is processed by the\r
+                        the CPU specified by CpuIndex.\r
+  @param[in] StackSize  The size, in bytes, if the stack used when an SMI is\r
+                        processed by the CPU specified by CpuIndex.\r
+  @param[in] GdtBase    The base address of the GDT to use when an SMI is\r
+                        processed by the CPU specified by CpuIndex.\r
+  @param[in] GdtSize    The size, in bytes, of the GDT used when an SMI is\r
+                        processed by the CPU specified by CpuIndex.\r
+  @param[in] IdtBase    The base address of the IDT to use when an SMI is\r
+                        processed by the CPU specified by CpuIndex.\r
+  @param[in] IdtSize    The size, in bytes, of the IDT used when an SMI is\r
+                        processed by the CPU specified by CpuIndex.\r
+  @param[in] Cr3        The base address of the page tables to use when an SMI\r
+                        is processed by the CPU specified by CpuIndex.\r
+**/\r
+VOID\r
+EFIAPI\r
+SmmCpuFeaturesInstallSmiHandler (\r
+  IN UINTN   CpuIndex,\r
+  IN UINT32  SmBase,\r
+  IN VOID    *SmiStack,\r
+  IN UINTN   StackSize,\r
+  IN UINTN   GdtBase,\r
+  IN UINTN   GdtSize,\r
+  IN UINTN   IdtBase,\r
+  IN UINTN   IdtSize,\r
+  IN UINT32  Cr3\r
+  )\r
+{\r
+}\r