]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / Library / CpuCommonFeaturesLib / CpuCommonFeatures.h
index 9c6e0b4e674165e3afb98b8286b4013292d011ee..5434a45f6a84be6314f88656b21bf0a0c8e48150 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   CPU Common features library header file.\r
 \r
-  Copyright (c) 2017, 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
+  Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -25,8 +19,8 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/LocalApicLib.h>\r
 \r
-#include <Register/Cpuid.h>\r
-#include <Register/Msr.h>\r
+#include <Register/Intel/Cpuid.h>\r
+#include <Register/Intel/Msr.h>\r
 \r
 /**\r
   Prepares for the data used by CPU feature detection and initialization.\r
@@ -89,10 +83,25 @@ EFIAPI
 AesniInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
+/**\r
+  Prepares for the data used by CPU feature detection and initialization.\r
+\r
+  @param[in]  NumberOfProcessors  The number of CPUs in the platform.\r
+\r
+  @return  Pointer to a buffer of CPU related configuration data.\r
+\r
+  @note This service could be called by BSP only.\r
+**/\r
+VOID *\r
+EFIAPI\r
+ClockModulationGetConfigData (\r
+  IN UINTN  NumberOfProcessors\r
+  );\r
+\r
 /**\r
   Detects if Clock Modulation feature supported on current processor.\r
 \r
@@ -139,7 +148,7 @@ EFIAPI
 ClockModulationInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -191,7 +200,7 @@ EFIAPI
 EistInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -241,7 +250,7 @@ EFIAPI
 ExecuteDisableInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -267,7 +276,7 @@ EFIAPI
 FastStringsInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -317,7 +326,7 @@ EFIAPI
 MonitorMwaitInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -367,7 +376,7 @@ EFIAPI
 VmxInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -417,7 +426,7 @@ EFIAPI
 LockFeatureControlRegisterInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -468,7 +477,7 @@ EFIAPI
 SmxInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -518,7 +527,7 @@ EFIAPI
 LimitCpuidMaxvalInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -568,7 +577,7 @@ EFIAPI
 MceInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -618,7 +627,7 @@ EFIAPI
 McaInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -668,7 +677,7 @@ EFIAPI
 McgCtlInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -718,7 +727,7 @@ EFIAPI
 PendingBreakInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -768,7 +777,7 @@ EFIAPI
 C1eInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -835,7 +844,7 @@ EFIAPI
 X2ApicInitialize (\r
   IN UINTN                             ProcessorNumber,\r
   IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
-  IN VOID                              *ConfigData,  OPTIONAL\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
   IN BOOLEAN                           State\r
   );\r
 \r
@@ -850,8 +859,181 @@ X2ApicInitialize (
 **/\r
 VOID *\r
 EFIAPI\r
-FeatureControlGetConfigData (\r
-  IN UINTN               NumberOfProcessors\r
+PpinGetConfigData (\r
+  IN UINTN  NumberOfProcessors\r
+  );\r
+\r
+/**\r
+  Detects if Protected Processor Inventory Number feature supported on current\r
+  processor.\r
+\r
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.\r
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
+                               structure for the CPU executing this function.\r
+  @param[in]  ConfigData       A pointer to the configuration buffer returned\r
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if\r
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
+                               RegisterCpuFeature().\r
+\r
+  @retval TRUE     Protected Processor Inventory Number feature is supported.\r
+  @retval FALSE    Protected Processor Inventory Number feature is not supported.\r
+\r
+  @note This service could be called by BSP/APs.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+PpinSupport (\r
+  IN UINTN                             ProcessorNumber,\r
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
+  IN VOID                              *ConfigData  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Initializes Protected Processor Inventory Number feature to specific state.\r
+\r
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.\r
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
+                               structure for the CPU executing this function.\r
+  @param[in]  ConfigData       A pointer to the configuration buffer returned\r
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if\r
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
+                               RegisterCpuFeature().\r
+  @param[in]  State            If TRUE, then the Protected Processor Inventory\r
+                               Number feature must be enabled.\r
+                               If FALSE, then the Protected Processor Inventory\r
+                               Number feature must be disabled.\r
+\r
+  @retval RETURN_SUCCESS       Protected Processor Inventory Number feature is\r
+                               initialized.\r
+  @retval RETURN_DEVICE_ERROR  Device can't change state because it has been\r
+                               locked.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PpinInitialize (\r
+  IN UINTN                             ProcessorNumber,\r
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
+  IN BOOLEAN                           State\r
+  );\r
+\r
+/**\r
+  Detects if Local machine check exception feature supported on current\r
+  processor.\r
+\r
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.\r
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
+                               structure for the CPU executing this function.\r
+  @param[in]  ConfigData       A pointer to the configuration buffer returned\r
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if\r
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
+                               RegisterCpuFeature().\r
+\r
+  @retval TRUE     Local machine check exception feature is supported.\r
+  @retval FALSE    Local machine check exception feature is not supported.\r
+\r
+  @note This service could be called by BSP/APs.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+LmceSupport (\r
+  IN UINTN                             ProcessorNumber,\r
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
+  IN VOID                              *ConfigData  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Initializes Local machine check exception feature to specific state.\r
+\r
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.\r
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
+                               structure for the CPU executing this function.\r
+  @param[in]  ConfigData       A pointer to the configuration buffer returned\r
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if\r
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
+                               RegisterCpuFeature().\r
+  @param[in]  State            If TRUE, then the Local machine check exception\r
+                               feature must be enabled.\r
+                               If FALSE, then the Local machine check exception\r
+                               feature must be disabled.\r
+\r
+  @retval RETURN_SUCCESS       Local machine check exception feature is initialized.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LmceInitialize (\r
+  IN UINTN                             ProcessorNumber,\r
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
+  IN BOOLEAN                           State\r
+  );\r
+\r
+/**\r
+  Prepares for the data used by CPU feature detection and initialization.\r
+\r
+  @param[in]  NumberOfProcessors  The number of CPUs in the platform.\r
+\r
+  @return  Pointer to a buffer of CPU related configuration data.\r
+\r
+  @note This service could be called by BSP only.\r
+**/\r
+VOID *\r
+EFIAPI\r
+ProcTraceGetConfigData (\r
+  IN UINTN  NumberOfProcessors\r
+  );\r
+\r
+/**\r
+  Detects if Intel Processor Trace feature supported on current processor.\r
+\r
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.\r
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
+                               structure for the CPU executing this function.\r
+  @param[in]  ConfigData       A pointer to the configuration buffer returned\r
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if\r
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
+                               RegisterCpuFeature().\r
+\r
+  @retval TRUE     Processor Trace feature is supported.\r
+  @retval FALSE    Processor Trace feature is not supported.\r
+\r
+  @note This service could be called by BSP/APs.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ProcTraceSupport (\r
+  IN UINTN                             ProcessorNumber,\r
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
+  IN VOID                              *ConfigData  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Initializes Intel Processor Trace feature to specific state.\r
+\r
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.\r
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
+                               structure for the CPU executing this function.\r
+  @param[in]  ConfigData       A pointer to the configuration buffer returned\r
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if\r
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
+                               RegisterCpuFeature().\r
+  @param[in]  State            If TRUE, then the Processor Trace feature must be\r
+                               enabled.\r
+                               If FALSE, then the Processor Trace feature must be\r
+                               disabled.\r
+\r
+  @retval RETURN_SUCCESS       Intel Processor Trace feature is initialized.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ProcTraceInitialize (\r
+  IN UINTN                             ProcessorNumber,\r
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,\r
+  IN VOID                              *ConfigData   OPTIONAL,\r
+  IN BOOLEAN                           State\r
   );\r
 \r
 #endif\r