public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v5 00/11] Add CPU features driver
@ 2017-03-20  8:19 Jeff Fan
  2017-03-20  8:19 ` [PATCH v5 03/11] UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0 Jeff Fan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jeff Fan @ 2017-03-20  8:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Feng Tian, Michael Kinney

This serial of patches will add CPU featuers initialization on boot time.

1) One new Register CPU Features Library and instances are added to provide the
   capability to register CPU feature's detect/initialize services.
2) One new NULL class CPU Commong Features Library instance is added to provide
   detect/initialize servcies of CPU features defined in SDM.
3) New CPU features PEI/DXE drivers are added to initialize CPU features in PEI
   phase or DXE phase, by consuming Register CPU Features Library.

https://bugzilla.tianocore.org/show_bug.cgi?id=421

The whole updated UefiCpuPkg v5 could be accessed at
https://github.com/JeffFan/edk2/tree/CpuFeaturesV5/UefiCpuPkg for review.

v2:
  #9: Format debug messages.
  #10:
    1. Using MSR_IA32_EFER to enable/disable NX feature instead of using
       MSR_IA32_MISC_ENABLE.
    2. Fix bug that SMX and VMX feature is swapped.

v3:
  #9:  Trim white space at end of line.
  #10: Add AesniGetConfigData() to get current register state.

v4:
  #3, #8, #9: Fix GCC complied issue.

v5:
  #3:  Set DestinationRegisterTableList[Index].RegisterTableEntry before
       RegisterTableEntry is updated.
  #10: Move MSR reading from AesniGetConfigData() to AesniSupport().

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>

Jeff Fan (11):
  UefiCpuPkg/AcpiCpuData: Update RegisterTableEntry type
  UefiCpuPkg/CpuS3DataDxe: Consume the existing PcdCpuS3DataAddress
  UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0
  UefiCpuPkg/Msr: Add CPUID signature check MACROs
  UefiCpuPkg/UefiCpuPkg.dec: Add a set of CPU features PCDs
  UefiCpuPkg: Add GUID gEdkiiCpuFeaturesSetDoneGuid
  UefiCpuPkg: Add GUID gEdkiiCpuFeaturesInitDoneGuid
  UefiCpuPkg/Include/Library: Add Register CPU Features Library
  UefiCpuPkg: Add PEI/DXE Register CPU Features Library instances
  UefiCpuPkg: Add NULL CPU Common Features Library instance
  UefiCpuPkg: Add CPU Features PEI/DXE drivers

 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.c            | 122 +++
 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.inf          |  53 ++
 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.uni          |  22 +
 UefiCpuPkg/CpuFeatures/CpuFeaturesDxeExtra.uni     |  20 +
 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.c            |  75 ++
 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.inf          |  49 ++
 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.uni          |  22 +
 UefiCpuPkg/CpuFeatures/CpuFeaturesPeiExtra.uni     |  20 +
 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c                |  56 +-
 UefiCpuPkg/Include/AcpiCpuData.h                   |   6 +-
 UefiCpuPkg/Include/Guid/CpuFeaturesInitDone.h      |  26 +
 UefiCpuPkg/Include/Guid/CpuFeaturesSetDone.h       |  26 +
 .../Include/Library/RegisterCpuFeaturesLib.h       | 516 ++++++++++++
 UefiCpuPkg/Include/Register/Msr/AtomMsr.h          |  22 +-
 UefiCpuPkg/Include/Register/Msr/BroadwellMsr.h     |  21 +-
 UefiCpuPkg/Include/Register/Msr/Core2Msr.h         |  19 +-
 UefiCpuPkg/Include/Register/Msr/CoreMsr.h          |  18 +-
 UefiCpuPkg/Include/Register/Msr/GoldmontMsr.h      |  18 +-
 UefiCpuPkg/Include/Register/Msr/HaswellEMsr.h      |  18 +-
 UefiCpuPkg/Include/Register/Msr/HaswellMsr.h       |  20 +-
 UefiCpuPkg/Include/Register/Msr/IvyBridgeMsr.h     |  18 +-
 UefiCpuPkg/Include/Register/Msr/NehalemMsr.h       |  21 +-
 UefiCpuPkg/Include/Register/Msr/P6Msr.h            |  23 +-
 UefiCpuPkg/Include/Register/Msr/Pentium4Msr.h      |  15 +-
 UefiCpuPkg/Include/Register/Msr/PentiumMMsr.h      |  18 +-
 UefiCpuPkg/Include/Register/Msr/PentiumMsr.h       |  20 +-
 UefiCpuPkg/Include/Register/Msr/SandyBridgeMsr.h   |  19 +-
 UefiCpuPkg/Include/Register/Msr/SilvermontMsr.h    |  22 +-
 UefiCpuPkg/Include/Register/Msr/SkylakeMsr.h       |  19 +-
 UefiCpuPkg/Include/Register/Msr/Xeon5600Msr.h      |  19 +-
 UefiCpuPkg/Include/Register/Msr/XeonDMsr.h         |  19 +-
 UefiCpuPkg/Include/Register/Msr/XeonE7Msr.h        |  18 +-
 UefiCpuPkg/Include/Register/Msr/XeonPhiMsr.h       |  18 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c    | 127 +++
 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c      |  79 ++
 .../Library/CpuCommonFeaturesLib/ClockModulation.c | 106 +++
 .../CpuCommonFeaturesLib/CpuCommonFeatures.h       | 867 +++++++++++++++++++++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.c    | 227 ++++++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf  |  68 ++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni  |  25 +
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c     |  81 ++
 .../Library/CpuCommonFeaturesLib/ExecuteDisable.c  |  91 +++
 .../Library/CpuCommonFeaturesLib/FastStrings.c     |  52 ++
 .../Library/CpuCommonFeaturesLib/FeatureControl.c  | 314 ++++++++
 .../CpuCommonFeaturesLib/LimitCpuIdMaxval.c        |  82 ++
 .../Library/CpuCommonFeaturesLib/MachineCheck.c    | 231 ++++++
 .../Library/CpuCommonFeaturesLib/MonitorMwait.c    |  79 ++
 .../Library/CpuCommonFeaturesLib/PendingBreak.c    |  90 +++
 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   |  81 ++
 .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 745 ++++++++++++++++++
 .../DxeRegisterCpuFeaturesLib.c                    | 266 +++++++
 .../DxeRegisterCpuFeaturesLib.inf                  |  62 ++
 .../PeiRegisterCpuFeaturesLib.c                    | 390 +++++++++
 .../PeiRegisterCpuFeaturesLib.inf                  |  64 ++
 .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h   | 193 +++++
 .../RegisterCpuFeaturesDxe.uni                     |  22 +
 .../RegisterCpuFeaturesLib.c                       | 770 ++++++++++++++++++
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c                  |  32 +-
 UefiCpuPkg/UefiCpuPkg.dec                          |  50 +-
 UefiCpuPkg/UefiCpuPkg.dsc                          |  14 +-
 60 files changed, 6545 insertions(+), 61 deletions(-)
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.c
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.inf
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.uni
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxeExtra.uni
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.c
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.inf
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.uni
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPeiExtra.uni
 create mode 100644 UefiCpuPkg/Include/Guid/CpuFeaturesInitDone.h
 create mode 100644 UefiCpuPkg/Include/Guid/CpuFeaturesSetDone.h
 create mode 100644 UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesDxe.uni
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c

-- 
2.9.3.windows.2



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v5 03/11] UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0
  2017-03-20  8:19 [PATCH v5 00/11] Add CPU features driver Jeff Fan
@ 2017-03-20  8:19 ` Jeff Fan
  2017-03-20  8:19 ` [PATCH v5 10/11] UefiCpuPkg: Add NULL CPU Common Features Library instance Jeff Fan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jeff Fan @ 2017-03-20  8:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Feng Tian, Michael Kinney

Needn't to copy register table if AllocatedSize is 0.

v4:
  Fix potential uninitialized variable issue.

v5:
  Set DestinationRegisterTableList[Index].RegisterTableEntry before
  RegisterTableEntry is updated.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
index 12efc1f..c3280b8 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -826,21 +826,25 @@ CopyRegisterTable (
 
   CopyMem (DestinationRegisterTableList, SourceRegisterTableList, NumberOfCpus * sizeof (CPU_REGISTER_TABLE));
   for (Index = 0; Index < NumberOfCpus; Index++) {
-    RegisterTableEntry = AllocatePool (DestinationRegisterTableList[Index].AllocatedSize);
-    ASSERT (RegisterTableEntry != NULL);
-    CopyMem (RegisterTableEntry, (VOID *)(UINTN)SourceRegisterTableList[Index].RegisterTableEntry, DestinationRegisterTableList[Index].AllocatedSize);
-    //
-    // Go though all MSRs in register table to initialize MSR spin lock
-    //
-    for (Index1 = 0; Index1 < DestinationRegisterTableList[Index].TableLength; Index1++, RegisterTableEntry++) {
-      if ((RegisterTableEntry->RegisterType == Msr) && (RegisterTableEntry->ValidBitLength < 64)) {
-        //
-        // Initialize MSR spin lock only for those MSRs need bit field writing
-        //
-        InitMsrSpinLockByIndex (RegisterTableEntry->Index);
+    if (DestinationRegisterTableList[Index].AllocatedSize != 0) {
+      RegisterTableEntry = AllocateCopyPool (
+        DestinationRegisterTableList[Index].AllocatedSize,
+        (VOID *)(UINTN)SourceRegisterTableList[Index].RegisterTableEntry
+        );
+      ASSERT (RegisterTableEntry != NULL);
+      DestinationRegisterTableList[Index].RegisterTableEntry = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTableEntry;
+      //
+      // Go though all MSRs in register table to initialize MSR spin lock
+      //
+      for (Index1 = 0; Index1 < DestinationRegisterTableList[Index].TableLength; Index1++, RegisterTableEntry++) {
+        if ((RegisterTableEntry->RegisterType == Msr) && (RegisterTableEntry->ValidBitLength < 64)) {
+          //
+          // Initialize MSR spin lock only for those MSRs need bit field writing
+          //
+          InitMsrSpinLockByIndex (RegisterTableEntry->Index);
+        }
       }
     }
-    DestinationRegisterTableList[Index].RegisterTableEntry = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTableEntry;
   }
 }
 
-- 
2.9.3.windows.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v5 10/11] UefiCpuPkg: Add NULL CPU Common Features Library instance
  2017-03-20  8:19 [PATCH v5 00/11] Add CPU features driver Jeff Fan
  2017-03-20  8:19 ` [PATCH v5 03/11] UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0 Jeff Fan
@ 2017-03-20  8:19 ` Jeff Fan
  2017-03-20  8:26 ` Do edk2 have plan to implement EFI_REST_PROTOCOL ? wang xiaofeng
  2017-03-21  8:07 ` [PATCH v5 00/11] Add CPU features driver Tian, Feng
  3 siblings, 0 replies; 5+ messages in thread
From: Jeff Fan @ 2017-03-20  8:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Feng Tian, Michael Kinney

This NULL CPU common Features Library instance will register some CPU features
defined in Intel(R) 64 and IA-32 Architectures Software Developer's Manual,
Volume 3, September 2016, Chapter 35 Model-Specific-Registers (MSR).

Add PCD PcdCpuClockModulationDutyCycle and PcdIsPowerOnReset consumed by NULL
CPU Common Features Library instance.

v2:
  1. Using MSR_IA32_EFER to enable/disable NX feature instead of using
     MSR_IA32_MISC_ENABLE.
  2. Fix bug that SMX and VMX feature is swapped.

v3:
  1. Add AesniGetConfigData() to get current register state.

v5:
  1. Move MSR reading from AesniGetConfigData() to AesniSupport().

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c    | 127 +++
 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c      |  79 ++
 .../Library/CpuCommonFeaturesLib/ClockModulation.c | 106 +++
 .../CpuCommonFeaturesLib/CpuCommonFeatures.h       | 867 +++++++++++++++++++++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.c    | 227 ++++++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf  |  68 ++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni  |  25 +
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c     |  81 ++
 .../Library/CpuCommonFeaturesLib/ExecuteDisable.c  |  91 +++
 .../Library/CpuCommonFeaturesLib/FastStrings.c     |  52 ++
 .../Library/CpuCommonFeaturesLib/FeatureControl.c  | 314 ++++++++
 .../CpuCommonFeaturesLib/LimitCpuIdMaxval.c        |  82 ++
 .../Library/CpuCommonFeaturesLib/MachineCheck.c    | 231 ++++++
 .../Library/CpuCommonFeaturesLib/MonitorMwait.c    |  79 ++
 .../Library/CpuCommonFeaturesLib/PendingBreak.c    |  90 +++
 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   |  81 ++
 UefiCpuPkg/UefiCpuPkg.dec                          |  11 +
 17 files changed, 2611 insertions(+)
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c

diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
new file mode 100644
index 0000000..d889410
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
@@ -0,0 +1,127 @@
+/** @file
+  AESNI feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Prepares for the data used by CPU feature detection and initialization.
+
+  @param[in]  NumberOfProcessors  The number of CPUs in the platform.
+
+  @return  Pointer to a buffer of CPU related configuration data.
+
+  @note This service could be called by BSP only.
+**/
+VOID *
+EFIAPI
+AesniGetConfigData (
+  IN UINTN  NumberOfProcessors
+  )
+{
+  UINT64                            *ConfigData;
+
+  ConfigData = AllocateZeroPool (sizeof (UINT64) * NumberOfProcessors);
+  ASSERT (ConfigData != NULL);
+  return ConfigData;
+}
+
+/**
+  Detects if AESNI feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     AESNI feature is supported.
+  @retval FALSE    AESNI feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+AesniSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER   *MsrFeatureConfig;
+
+  if (IS_SANDY_BRIDGE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_SILVERMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_XEON_5600_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_XEON_E7_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
+    MsrFeatureConfig = (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) ConfigData;
+    MsrFeatureConfig[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_SANDY_BRIDGE_FEATURE_CONFIG);
+    return (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1);
+  }
+  return FALSE;
+}
+
+/**
+  Initializes AESNI feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the AESNI feature must be enabled.
+                               If FALSE, then the AESNI feature must be disabled.
+
+  @retval RETURN_SUCCESS       AESNI feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+AesniInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER   *MsrFeatureConfig;
+
+  //
+  // SANDY_BRIDGE, SILVERMONT, XEON_5600, XEON_7, and XEON_PHI have the same MSR index,
+  // Simply use MSR_SANDY_BRIDGE_FEATURE_CONFIG here
+  //
+  // The scope of the MSR_SANDY_BRIDGE_FEATURE_CONFIG is Core, only program MSR_FEATURE_CONFIG for thread 0
+  // of each core. Otherwise, once a thread in the core disabled AES, the other thread will cause GP when
+  // programming it.
+  //
+  if (CpuInfo->ProcessorInfo.Location.Thread == 0) {
+    MsrFeatureConfig = (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) ConfigData;
+    if ((MsrFeatureConfig[ProcessorNumber].Bits.AESConfiguration & BIT0) == 0) {
+      CPU_REGISTER_TABLE_WRITE_FIELD (
+        ProcessorNumber,
+        Msr,
+        MSR_SANDY_BRIDGE_FEATURE_CONFIG,
+        MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER,
+        Bits.AESConfiguration,
+        BIT1 | ((State) ? 0 : BIT0)
+        );
+    }
+  }
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
new file mode 100644
index 0000000..116590f
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
@@ -0,0 +1,79 @@
+/** @file
+  C1E feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if C1E feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     C1E feature is supported.
+  @retval FALSE    C1E feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+C1eSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  return IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel);
+}
+
+/**
+  Initializes C1E feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the C1E feature must be enabled.
+                               If FALSE, then the C1E feature must be disabled.
+
+  @retval RETURN_SUCCESS       C1E feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+C1eInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_NEHALEM_POWER_CTL,
+    MSR_NEHALEM_POWER_CTL_REGISTER,
+    Bits.C1EEnable,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c
new file mode 100644
index 0000000..adbe075
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c
@@ -0,0 +1,106 @@
+/** @file
+  Clock Modulation feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if Clock Modulation feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Clock Modulation feature is supported.
+  @retval FALSE    Clock Modulation feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+ClockModulationSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  return (CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1);
+}
+
+/**
+  Initializes Clock Modulation feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Clock Modulation feature must be enabled.
+                               If FALSE, then the Clock Modulation feature must be disabled.
+
+  @retval RETURN_SUCCESS       Clock Modulation feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+ClockModulationInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  if (IS_SANDY_BRIDGE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_SANDY_BRIDGE_IA32_CLOCK_MODULATION,
+      MSR_SANDY_BRIDGE_IA32_CLOCK_MODULATION_REGISTER,
+      Bits.OnDemandClockModulationDutyCycle,
+      PcdGet8 (PcdCpuClockModulationDutyCycle)
+      );
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_SANDY_BRIDGE_IA32_CLOCK_MODULATION,
+      MSR_SANDY_BRIDGE_IA32_CLOCK_MODULATION_REGISTER,
+      Bits.OnDemandClockModulationEnable,
+      (State) ? 1 : 0
+      );
+  } else {
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_CLOCK_MODULATION,
+      MSR_IA32_CLOCK_MODULATION_REGISTER,
+      Bits.OnDemandClockModulationDutyCycle,
+      PcdGet8 (PcdCpuClockModulationDutyCycle)
+      );
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_CLOCK_MODULATION,
+      MSR_IA32_CLOCK_MODULATION_REGISTER,
+      Bits.OnDemandClockModulationEnable,
+      (State) ? 1 : 0
+      );
+  }
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
new file mode 100644
index 0000000..63fc03d
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
@@ -0,0 +1,867 @@
+/** @file
+  CPU Common features library header file.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _CPU_COMMON_FEATURES_H_
+#define _CPU_COMMON_FEATURES_H_
+
+#include <PiDxe.h>
+
+#include <Library/BaseLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DebugLib.h>
+#include <Library/RegisterCpuFeaturesLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/LocalApicLib.h>
+
+#include <Register/CpuId.h>
+#include <Register/Msr.h>
+
+/**
+  Prepares for the data used by CPU feature detection and initialization.
+
+  @param[in]  NumberOfProcessors  The number of CPUs in the platform.
+
+  @return  Pointer to a buffer of CPU related configuration data.
+
+  @note This service could be called by BSP only.
+**/
+VOID *
+EFIAPI
+AesniGetConfigData (
+  IN UINTN  NumberOfProcessors
+  );
+
+/**
+  Detects if AESNI feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     AESNI feature is supported.
+  @retval FALSE    AESNI feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+AesniSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes AESNI feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the AESNI feature must be enabled.
+                               If FALSE, then the AESNI feature must be disabled.
+
+  @retval RETURN_SUCCESS       AESNI feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+AesniInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if Clock Modulation feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Clock Modulation feature is supported.
+  @retval FALSE    Clock Modulation feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+ClockModulationSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes Clock Modulation feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Clock Modulation feature must be enabled.
+                               If FALSE, then the Clock Modulation feature must be disabled.
+
+  @retval RETURN_SUCCESS       Clock Modulation feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+ClockModulationInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if Enhanced Intel SpeedStep feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Enhanced Intel SpeedStep feature is supported.
+  @retval FALSE    Enhanced Intel SpeedStep feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+EistSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes Enhanced Intel SpeedStep feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Enhanced Intel SpeedStep feature
+                               must be enabled.
+                               If FALSE, then the Enhanced Intel SpeedStep feature
+                               must be disabled.
+
+  @retval RETURN_SUCCESS       Enhanced Intel SpeedStep feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+EistInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if Execute Disable feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Execute Disable feature is supported.
+  @retval FALSE    Execute Disable feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+ExecuteDisableSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes Execute Disable feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Execute Disable feature must be enabled.
+                               If FALSE, then the Execute Disable feature must be disabled.
+
+  @retval RETURN_SUCCESS       Execute Disable feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+ExecuteDisableInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Initializes Fast-Strings feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Fast-Strings feature must be enabled.
+                               If FALSE, then the Fast-Strings feature must be disabled.
+
+  @retval RETURN_SUCCESS       Fast-Strings feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+FastStringsInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if MONITOR/MWAIT feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     MONITOR/MWAIT feature is supported.
+  @retval FALSE    MONITOR/MWAIT feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+MonitorMwaitSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes MONITOR/MWAIT feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the MONITOR/MWAIT feature must be enabled.
+                               If FALSE, then the MONITOR/MWAIT feature must be disabled.
+
+  @retval RETURN_SUCCESS       MONITOR/MWAIT feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+MonitorMwaitInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if VMX feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     VMX feature is supported.
+  @retval FALSE    VMX feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+VmxSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes VMX inside SMX feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the VMX inside SMX feature must be enabled.
+                               If FALSE, then the VMX inside SMX feature must be disabled.
+
+  @retval RETURN_SUCCESS       VMX inside SMX feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+VmxInsideSmxInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Initializes SENTER feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the SENTER feature must be enabled.
+                               If FALSE, then the SENTER feature must be disabled.
+
+  @retval RETURN_SUCCESS       SENTER feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+SenterInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if Lock Feature Control Register feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Lock Feature Control Register feature is supported.
+  @retval FALSE    Lock Feature Control Register feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+LockFeatureControlRegisterSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes Lock Feature Control Register feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Lock Feature Control Register feature must be enabled.
+                               If FALSE, then the Lock Feature Control Register feature must be disabled.
+
+  @retval RETURN_SUCCESS       Lock Feature Control Register feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+LockFeatureControlRegisterInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if SMX feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     SMX feature is supported.
+  @retval FALSE    SMX feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+SmxSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes VMX outside SMX feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the VMX outside SMX feature must be enabled.
+                               If FALSE, then the VMX outside SMX feature must be disabled.
+
+  @retval RETURN_SUCCESS       VMX outside SMX feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+VmxOutsideSmxInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if LimitCpuidMaxval feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     LimitCpuidMaxval feature is supported.
+  @retval FALSE    LimitCpuidMaxval feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+LimitCpuidMaxvalSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes LimitCpuidMaxval feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the LimitCpuidMaxval feature must be enabled.
+                               If FALSE, then the LimitCpuidMaxval feature must be disabled.
+
+  @retval RETURN_SUCCESS       LimitCpuidMaxval feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+LimitCpuidMaxvalInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if Machine Check Exception feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Machine Check Exception feature is supported.
+  @retval FALSE    Machine Check Exception feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+MceSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes Machine Check Exception feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Machine Check Exception feature must be enabled.
+                               If FALSE, then the Machine Check Exception feature must be disabled.
+
+  @retval RETURN_SUCCESS       Machine Check Exception feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+MceInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if Machine Check Architecture feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Machine Check Architecture feature is supported.
+  @retval FALSE    Machine Check Architecture feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+McaSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes Machine Check Architecture feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Machine Check Architecture feature must be enabled.
+                               If FALSE, then the Machine Check Architecture feature must be disabled.
+
+  @retval RETURN_SUCCESS       Machine Check Architecture feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+McaInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if IA32_MCG_CTL feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     IA32_MCG_CTL feature is supported.
+  @retval FALSE    IA32_MCG_CTL feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+McgCtlSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes IA32_MCG_CTL feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the IA32_MCG_CTL feature must be enabled.
+                               If FALSE, then the IA32_MCG_CTL feature must be disabled.
+
+  @retval RETURN_SUCCESS       IA32_MCG_CTL feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+McgCtlInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if Pending Break feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Pending Break feature is supported.
+  @retval FALSE    Pending Break feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+PendingBreakSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes Pending Break feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Pending Break feature must be enabled.
+                               If FALSE, then the Pending Break feature must be disabled.
+
+  @retval RETURN_SUCCESS       Pending Break feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+PendingBreakInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if C1E feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     C1E feature is supported.
+  @retval FALSE    C1E feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+C1eSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes C1E feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the C1E feature must be enabled.
+                               If FALSE, then the C1E feature must be disabled.
+
+  @retval RETURN_SUCCESS       C1E feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+C1eInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Detects if X2Apci feature supported on current processor.
+
+  Detect if X2Apci has been already enabled.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     X2Apci feature is supported.
+  @retval FALSE    X2Apci feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+X2ApicSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  );
+
+/**
+  Initializes X2Apci feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the X2Apci feature must be enabled.
+                               If FALSE, then the X2Apci feature must be disabled.
+
+  @retval RETURN_SUCCESS       X2Apci feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+X2ApicInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  );
+
+/**
+  Prepares for the data used by CPU feature detection and initialization.
+
+  @param[in]  NumberOfProcessors  The number of CPUs in the platform.
+
+  @return  Pointer to a buffer of CPU related configuration data.
+
+  @note This service could be called by BSP only.
+**/
+VOID *
+EFIAPI
+FeatureControlGetConfigData (
+  IN UINTN               NumberOfProcessors
+  );
+
+#endif
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c
new file mode 100644
index 0000000..65ed756
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c
@@ -0,0 +1,227 @@
+/** @file
+  This library registers CPU features defined in Intel(R) 64 and IA-32
+  Architectures Software Developer's Manual.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Register CPU features.
+
+  @retval  RETURN_SUCCESS            Register successfully
+**/
+RETURN_STATUS
+EFIAPI
+CpuCommonFeaturesLibConstructor (
+  VOID
+  )
+{
+  RETURN_STATUS         Status;
+
+  if (IsCpuFeatureSupported (CPU_FEATURE_AESNI)) {
+    Status = RegisterCpuFeature (
+               "AESNI",
+               AesniGetConfigData,
+               AesniSupport,
+               AesniInitialize,
+               CPU_FEATURE_AESNI,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_MWAIT)) {
+    Status = RegisterCpuFeature (
+               "MWAIT",
+               NULL,
+               MonitorMwaitSupport,
+               MonitorMwaitInitialize,
+               CPU_FEATURE_MWAIT,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_ACPI)) {
+    Status = RegisterCpuFeature (
+               "ACPI",
+               NULL,
+               ClockModulationSupport,
+               ClockModulationInitialize,
+               CPU_FEATURE_ACPI,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_EIST)) {
+    Status = RegisterCpuFeature (
+               "EIST",
+               NULL,
+               EistSupport,
+               EistInitialize,
+               CPU_FEATURE_EIST,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_XD)) {
+    Status = RegisterCpuFeature (
+               "Execute Disable",
+               NULL,
+               ExecuteDisableSupport,
+               ExecuteDisableInitialize,
+               CPU_FEATURE_XD,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_FASTSTRINGS)) {
+    Status = RegisterCpuFeature (
+               "FastStrings",
+               NULL,
+               NULL,
+               FastStringsInitialize,
+               CPU_FEATURE_FASTSTRINGS,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER)) {
+    Status = RegisterCpuFeature (
+               "Lock Feature Control Register",
+               FeatureControlGetConfigData,
+               LockFeatureControlRegisterSupport,
+               LockFeatureControlRegisterInitialize,
+               CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_SENTER)) {
+    Status = RegisterCpuFeature (
+               "SENTER",
+               FeatureControlGetConfigData,
+               VmxSupport,
+               SenterInitialize,
+               CPU_FEATURE_SENTER,
+               CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_BEFORE,
+               CPU_FEATURE_SMX | CPU_FEATURE_AFTER,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_SMX)) {
+    Status = RegisterCpuFeature (
+               "SMX",
+               FeatureControlGetConfigData,
+               SmxSupport,
+               VmxInsideSmxInitialize,
+               CPU_FEATURE_SMX,
+               CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_BEFORE,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_VMX)) {
+    Status = RegisterCpuFeature (
+               "VMX",
+               FeatureControlGetConfigData,
+               SmxSupport,
+               VmxOutsideSmxInitialize,
+               CPU_FEATURE_VMX,
+               CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_BEFORE,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_LIMIT_CPUID_MAX_VAL)) {
+    Status = RegisterCpuFeature (
+               "Limit CpuId Maximum Value",
+               NULL,
+               LimitCpuidMaxvalSupport,
+               LimitCpuidMaxvalInitialize,
+               CPU_FEATURE_LIMIT_CPUID_MAX_VAL,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_MCE)) {
+    Status = RegisterCpuFeature (
+               "Machine Check Enable",
+               NULL,
+               MceSupport,
+               MceInitialize,
+               CPU_FEATURE_MCE,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_MCA)) {
+    Status = RegisterCpuFeature (
+               "Machine Check Architect",
+               NULL,
+               McaSupport,
+               McaInitialize,
+               CPU_FEATURE_MCA,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_MCG_CTL)) {
+    Status = RegisterCpuFeature (
+               "MCG_CTL",
+               NULL,
+               McgCtlSupport,
+               McgCtlInitialize,
+               CPU_FEATURE_MCG_CTL,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_PENDING_BREAK)) {
+    Status = RegisterCpuFeature (
+               "Pending Break",
+               NULL,
+               PendingBreakSupport,
+               PendingBreakInitialize,
+               CPU_FEATURE_PENDING_BREAK,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_C1E)) {
+    Status = RegisterCpuFeature (
+               "C1E",
+               NULL,
+               C1eSupport,
+               C1eInitialize,
+               CPU_FEATURE_C1E,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+  if (IsCpuFeatureSupported (CPU_FEATURE_X2APIC)) {
+    Status = RegisterCpuFeature (
+               "X2Apic",
+               NULL,
+               X2ApicSupport,
+               X2ApicInitialize,
+               CPU_FEATURE_X2APIC,
+               CPU_FEATURE_END
+               );
+    ASSERT_EFI_ERROR (Status);
+  }
+
+  return RETURN_SUCCESS;
+}
+
+
+
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
new file mode 100644
index 0000000..7287d4e
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
@@ -0,0 +1,68 @@
+## @file
+#  NULL instance to register CPU features.
+#
+#  This library registers CPU features defined in Intel(R) 64 and IA-32
+#  Architectures Software Developer's Manual.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = CpuCommonFeaturesLib
+  MODULE_UNI_FILE                = CpuCommonFeaturesLib.uni
+  FILE_GUID                      = 387A2490-81FC-4E7C-8E0A-3E58C30FCD0B
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = NULL
+
+  CONSTRUCTOR                    = CpuCommonFeaturesLibConstructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  CpuCommonFeaturesLib.c
+  CpuCommonFeatures.h
+  Aesni.c
+  C1e.c
+  ClockModulation.c
+  Eist.c
+  ExecuteDisable.c
+  FastStrings.c
+  FeatureControl.c
+  LimitCpuIdMaxval.c
+  MachineCheck.c
+  MonitorMwait.c
+  PendingBreak.c
+  X2Apic.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  PcdLib
+  DebugLib
+  RegisterCpuFeaturesLib
+  BaseMemoryLib
+  MemoryAllocationLib
+  LocalApicLib
+
+[Pcd]
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport            # CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuClockModulationDutyCycle   # SOMETIME_CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdIsPowerOnReset                # SOMETIME_CONSUMES
+
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni
new file mode 100644
index 0000000..620766e
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni
@@ -0,0 +1,25 @@
+// /** @file
+// Dxe Crc32 Guided Section Extract library.
+//
+// This library doesn't produce any library class. The constructor function uses
+// ExtractGuidedSectionLib service to register CRC32 guided section handler
+// that parses CRC32 encapsulation section and extracts raw data.
+//
+// It uses UEFI boot service CalculateCrc32 to authenticate 32 bit CRC value.
+//
+// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// This program and the accompanying materials
+// are licensed and made available under the terms and conditions of the BSD License
+// which accompanies this distribution. The full text of the license may be found at
+// http://opensource.org/licenses/bsd-license.php
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT             #language en-US "Dxe Crc32 Guided Section Extract library."
+
+#string STR_MODULE_DESCRIPTION          #language en-US "This library doesn't produce any library class. The constructor function uses ExtractGuidedSectionLib service to register CRC32 guided section handler that parses CRC32 encapsulation section and extracts raw data. It uses UEFI boot service CalculateCrc32 to authenticate 32 bit CRC value."
+
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c
new file mode 100644
index 0000000..e1d3d42
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c
@@ -0,0 +1,81 @@
+/** @file
+  Enhanced Intel SpeedStep feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if Enhanced Intel SpeedStep feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Enhanced Intel SpeedStep feature is supported.
+  @retval FALSE    Enhanced Intel SpeedStep feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+EistSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  return (CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1);
+}
+
+/**
+  Initializes Enhanced Intel SpeedStep feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Enhanced Intel SpeedStep feature
+                               must be enabled.
+                               If FALSE, then the Enhanced Intel SpeedStep feature
+                               must be disabled.
+
+  @retval RETURN_SUCCESS       Enhanced Intel SpeedStep feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+EistInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_IA32_MISC_ENABLE,
+    MSR_IA32_MISC_ENABLE_REGISTER,
+    Bits.EIST,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c
new file mode 100644
index 0000000..dd4293e
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c
@@ -0,0 +1,91 @@
+/** @file
+  Execute Disable feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if Execute Disable feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Execute Disable feature is supported.
+  @retval FALSE    Execute Disable feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+ExecuteDisableSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  UINT32                         Eax;
+  CPUID_EXTENDED_CPU_SIG_EDX     Edx;
+
+  AsmCpuid (CPUID_EXTENDED_FUNCTION, &Eax, NULL, NULL, NULL);
+  if (Eax <= CPUID_EXTENDED_FUNCTION) {
+    //
+    // Extended CPUID functions are not supported on this processor.
+    //
+    return FALSE;
+  }
+
+  AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, NULL, &Edx.Uint32);
+  return (Edx.Bits.NX != 0);
+}
+
+/**
+  Initializes Execute Disable feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Execute Disable feature must be enabled.
+                               If FALSE, then the Execute Disable feature must be disabled.
+
+  @retval RETURN_SUCCESS       Execute Disable feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+ExecuteDisableInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_IA32_EFER,
+    MSR_IA32_EFER_REGISTER,
+    Bits.NXE,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c
new file mode 100644
index 0000000..4c3000d
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c
@@ -0,0 +1,52 @@
+/** @file
+  Fast-Strings feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Initializes Fast-Strings feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Fast-Strings feature must be enabled.
+                               If FALSE, then the Fast-Strings feature must be disabled.
+
+  @retval RETURN_SUCCESS       Fast-Strings feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+FastStringsInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_IA32_MISC_ENABLE,
+    MSR_IA32_MISC_ENABLE_REGISTER,
+    Bits.FastStrings,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
new file mode 100644
index 0000000..e627a65
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
@@ -0,0 +1,314 @@
+/** @file
+  Features in MSR_IA32_FEATURE_CONTROL register.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Prepares for the data used by CPU feature detection and initialization.
+
+  @param[in]  NumberOfProcessors  The number of CPUs in the platform.
+
+  @return  Pointer to a buffer of CPU related configuration data.
+
+  @note This service could be called by BSP only.
+**/
+VOID *
+EFIAPI
+FeatureControlGetConfigData (
+  IN UINTN               NumberOfProcessors
+  )
+{
+  VOID          *ConfigData;
+
+  ConfigData = AllocateZeroPool (sizeof (MSR_IA32_FEATURE_CONTROL_REGISTER) * NumberOfProcessors);
+  ASSERT (ConfigData != NULL);
+  return ConfigData;
+}
+
+/**
+  Detects if VMX feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     VMX feature is supported.
+  @retval FALSE    VMX feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+VmxSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
+
+  ASSERT (ConfigData != NULL);
+  MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData;
+  MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL);
+  return (CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1);
+}
+
+/**
+  Initializes VMX inside SMX feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the VMX inside SMX feature must be enabled.
+                               If FALSE, then the VMX inside SMX feature must be disabled.
+
+  @retval RETURN_SUCCESS       VMX inside SMX feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+VmxInsideSmxInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
+
+  ASSERT (ConfigData != NULL);
+  MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData;
+  if (MsrRegister[ProcessorNumber].Bits.Lock == 0) {
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_FEATURE_CONTROL,
+      MSR_IA32_FEATURE_CONTROL_REGISTER,
+      Bits.EnableVmxInsideSmx,
+      (State) ? 1 : 0
+      );
+  }
+  return RETURN_SUCCESS;
+}
+
+/**
+  Initializes SENTER feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the SENTER feature must be enabled.
+                               If FALSE, then the SENTER feature must be disabled.
+
+  @retval RETURN_SUCCESS       SENTER feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+SenterInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
+
+  ASSERT (ConfigData != NULL);
+  MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData;
+  if (MsrRegister[ProcessorNumber].Bits.Lock == 0) {
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_FEATURE_CONTROL,
+      MSR_IA32_FEATURE_CONTROL_REGISTER,
+      Bits.SenterLocalFunctionEnables,
+      (State) ? 0x7F : 0
+      );
+
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_FEATURE_CONTROL,
+      MSR_IA32_FEATURE_CONTROL_REGISTER,
+      Bits.SenterGlobalEnable,
+      (State) ? 1 : 0
+      );
+  }
+  return RETURN_SUCCESS;
+}
+
+/**
+  Detects if Lock Feature Control Register feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Lock Feature Control Register feature is supported.
+  @retval FALSE    Lock Feature Control Register feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+LockFeatureControlRegisterSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
+
+  ASSERT (ConfigData != NULL);
+  MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData;
+  MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL);
+  return TRUE;
+}
+
+/**
+  Initializes Lock Feature Control Register feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Lock Feature Control Register feature must be enabled.
+                               If FALSE, then the Lock Feature Control Register feature must be disabled.
+
+  @retval RETURN_SUCCESS       Lock Feature Control Register feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+LockFeatureControlRegisterInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
+
+  ASSERT (ConfigData != NULL);
+  MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData;
+  if (MsrRegister[ProcessorNumber].Bits.Lock == 0) {
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_FEATURE_CONTROL,
+      MSR_IA32_FEATURE_CONTROL_REGISTER,
+      Bits.Lock,
+      1
+      );
+  }
+  return RETURN_SUCCESS;
+}
+
+/**
+  Detects if SMX feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     SMX feature is supported.
+  @retval FALSE    SMX feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+SmxSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
+
+  ASSERT (ConfigData != NULL);
+  MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData;
+  MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL);
+  return (CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1);
+}
+
+/**
+  Initializes VMX outside SMX feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the VMX outside SMX feature must be enabled.
+                               If FALSE, then the VMX outside SMX feature must be disabled.
+
+  @retval RETURN_SUCCESS       VMX outside SMX feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+VmxOutsideSmxInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
+
+  ASSERT (ConfigData != NULL);
+  MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData;
+  if (MsrRegister[ProcessorNumber].Bits.Lock == 0) {
+    CPU_REGISTER_TABLE_WRITE_FIELD (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_FEATURE_CONTROL,
+      MSR_IA32_FEATURE_CONTROL_REGISTER,
+      Bits.EnableVmxOutsideSmx,
+      (State) ? 1 : 0
+      );
+  }
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
new file mode 100644
index 0000000..0f51fb3
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
@@ -0,0 +1,82 @@
+/** @file
+  LimitCpuidMaxval Feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if LimitCpuidMaxval feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     LimitCpuidMaxval feature is supported.
+  @retval FALSE    LimitCpuidMaxval feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+LimitCpuidMaxvalSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  UINT32  Eax;
+
+  AsmCpuid (CPUID_SIGNATURE, &Eax, NULL, NULL, NULL);
+  return (Eax > 3);
+}
+
+/**
+  Initializes LimitCpuidMaxval feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the LimitCpuidMaxval feature must be enabled.
+                               If FALSE, then the LimitCpuidMaxval feature must be disabled.
+
+  @retval RETURN_SUCCESS       LimitCpuidMaxval feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+LimitCpuidMaxvalInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_IA32_MISC_ENABLE,
+    MSR_IA32_MISC_ENABLE_REGISTER,
+    Bits.LimitCpuidMaxval,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c
new file mode 100644
index 0000000..2d9501b
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c
@@ -0,0 +1,231 @@
+/** @file
+  Machine Check features.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if Machine Check Exception feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Machine Check Exception feature is supported.
+  @retval FALSE    Machine Check Exception feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+MceSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1);
+}
+
+/**
+  Initializes Machine Check Exception feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Machine Check Exception feature must be enabled.
+                               If FALSE, then the Machine Check Exception feature must be disabled.
+
+  @retval RETURN_SUCCESS       Machine Check Exception feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+MceInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  //
+  // Set MCE bit in CR4
+  //
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    ControlRegister,
+    4,
+    IA32_CR4,
+    Bits.MCE,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
+
+/**
+  Detects if Machine Check Architecture feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Machine Check Architecture feature is supported.
+  @retval FALSE    Machine Check Architecture feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+McaSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1);
+}
+
+/**
+  Initializes Machine Check Architecture feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Machine Check Architecture feature must be enabled.
+                               If FALSE, then the Machine Check Architecture feature must be disabled.
+
+  @retval RETURN_SUCCESS       Machine Check Architecture feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+McaInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  MSR_IA32_MCG_CAP_REGISTER  McgCap;
+  UINT32                     BankIndex;
+
+  McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP);
+  for (BankIndex = 0; BankIndex < (UINT32) McgCap.Bits.Count; BankIndex++) {
+    CPU_REGISTER_TABLE_WRITE64 (
+      ProcessorNumber,
+      Msr,
+      MSR_IA32_MC0_CTL + BankIndex * 4,
+      MAX_UINT64
+      );
+  }
+
+  if (PcdGetBool (PcdIsPowerOnReset)) {
+    for (BankIndex = 0; BankIndex < (UINTN) McgCap.Bits.Count; BankIndex++) {
+      CPU_REGISTER_TABLE_WRITE64 (
+        ProcessorNumber,
+        Msr,
+        MSR_IA32_MC0_STATUS + BankIndex * 4,
+        0
+        );
+    }
+  }
+
+  return RETURN_SUCCESS;
+}
+
+/**
+  Detects if IA32_MCG_CTL feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     IA32_MCG_CTL feature is supported.
+  @retval FALSE    IA32_MCG_CTL feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+McgCtlSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  MSR_IA32_MCG_CAP_REGISTER  McgCap;
+
+  if (!McaSupport (ProcessorNumber, CpuInfo, ConfigData)) {
+    return FALSE;
+  }
+  McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP);
+  return (McgCap.Bits.MCG_CTL_P == 1);
+}
+
+/**
+  Initializes IA32_MCG_CTL feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the IA32_MCG_CTL feature must be enabled.
+                               If FALSE, then the IA32_MCG_CTL feature must be disabled.
+
+  @retval RETURN_SUCCESS       IA32_MCG_CTL feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+McgCtlInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  CPU_REGISTER_TABLE_WRITE64 (
+    ProcessorNumber,
+    Msr,
+    MSR_IA32_MCG_CTL,
+    (State)? MAX_UINT64 : 0
+    );
+  return RETURN_SUCCESS;
+}
+
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c
new file mode 100644
index 0000000..b1c18bc
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c
@@ -0,0 +1,79 @@
+/** @file
+  MonitorMwait feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if MONITOR/MWAIT feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     MONITOR/MWAIT feature is supported.
+  @retval FALSE    MONITOR/MWAIT feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+MonitorMwaitSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  return (CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1);
+}
+
+/**
+  Initializes MONITOR/MWAIT feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the MONITOR/MWAIT feature must be enabled.
+                               If FALSE, then the MONITOR/MWAIT feature must be disabled.
+
+  @retval RETURN_SUCCESS       MONITOR/MWAIT feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+MonitorMwaitInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_IA32_MISC_ENABLE,
+    MSR_IA32_MISC_ENABLE_REGISTER,
+    Bits.MONITOR,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c
new file mode 100644
index 0000000..2a1fd95
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c
@@ -0,0 +1,90 @@
+/** @file
+  Pending Break feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if Pending Break feature supported on current processor.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     Pending Break feature is supported.
+  @retval FALSE    Pending Break feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+PendingBreakSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  if (IS_ATOM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_CORE2_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
+      IS_PENTIUM_M_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
+    return (CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1);
+  }
+  return FALSE;
+}
+
+/**
+  Initializes Pending Break feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the Pending Break feature must be enabled.
+                               If FALSE, then the Pending Break feature must be disabled.
+
+  @retval RETURN_SUCCESS       Pending Break feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+PendingBreakInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  //
+  // ATOM, CORE2, CORE, PENTIUM_4 and IS_PENTIUM_M_PROCESSOR have the same MSR index,
+  // Simply use MSR_ATOM_IA32_MISC_ENABLE here
+  //
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_ATOM_IA32_MISC_ENABLE,
+    MSR_ATOM_IA32_MISC_ENABLE_REGISTER,
+    Bits.FERR,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c
new file mode 100644
index 0000000..7720540
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c
@@ -0,0 +1,81 @@
+/** @file
+  X2Apic feature.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "CpuCommonFeatures.h"
+
+/**
+  Detects if X2Apci feature supported on current processor.
+
+  Detect if X2Apci has been already enabled.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+
+  @retval TRUE     X2Apci feature is supported.
+  @retval FALSE    X2Apci feature is not supported.
+
+  @note This service could be called by BSP/APs.
+**/
+BOOLEAN
+EFIAPI
+X2ApicSupport (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData  OPTIONAL
+  )
+{
+  return (GetApicMode () == LOCAL_APIC_MODE_X2APIC);
+}
+
+/**
+  Initializes X2Apci feature to specific state.
+
+  @param[in]  ProcessorNumber  The index of the CPU executing this function.
+  @param[in]  CpuInfo          A pointer to the REGISTER_CPU_FEATURE_INFORMATION
+                               structure for the CPU executing this function.
+  @param[in]  ConfigData       A pointer to the configuration buffer returned
+                               by CPU_FEATURE_GET_CONFIG_DATA.  NULL if
+                               CPU_FEATURE_GET_CONFIG_DATA was not provided in
+                               RegisterCpuFeature().
+  @param[in]  State            If TRUE, then the X2Apci feature must be enabled.
+                               If FALSE, then the X2Apci feature must be disabled.
+
+  @retval RETURN_SUCCESS       X2Apci feature is initialized.
+
+  @note This service could be called by BSP only.
+**/
+RETURN_STATUS
+EFIAPI
+X2ApicInitialize (
+  IN UINTN                             ProcessorNumber,
+  IN REGISTER_CPU_FEATURE_INFORMATION  *CpuInfo,
+  IN VOID                              *ConfigData,  OPTIONAL
+  IN BOOLEAN                           State
+  )
+{
+  PRE_SMM_CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    Msr,
+    MSR_IA32_APIC_BASE,
+    MSR_IA32_APIC_BASE_REGISTER,
+    Bits.EXTD,
+    (State) ? 1 : 0
+    );
+  return RETURN_SUCCESS;
+}
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 04c7c1e..745f986 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -245,6 +245,17 @@
   # @Prompt User settings for enabling/disabling processor features.
   gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000017
 
+  ## Specifies the On-demand clock modulation duty cycle when ACPI feature is enabled.
+  # @Prompt The encoded values for target duty cycle modulation.
+  # @ValidRange  0x80000001 | 0 - 15
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuClockModulationDutyCycle|0x0|UINT8|0x0000001A
+
+  ## Indicates if the current boot is a power-on reset.<BR><BR>
+  #   TRUE  - Current boot is a power-on reset.<BR>
+  #   FALSE - Current boot is not a power-on reset.<BR>
+  # @Prompt Current boot is a power-on reset.
+  gUefiCpuPkgTokenSpaceGuid.PcdIsPowerOnReset|FALSE|BOOLEAN|0x0000001B
+
 [PcdsDynamic, PcdsDynamicEx]
   ## Contains the pointer to a CPU S3 data buffer of structure ACPI_CPU_DATA.
   # @Prompt The pointer to a CPU S3 data buffer.
-- 
2.9.3.windows.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Do edk2 have plan to implement EFI_REST_PROTOCOL ?
  2017-03-20  8:19 [PATCH v5 00/11] Add CPU features driver Jeff Fan
  2017-03-20  8:19 ` [PATCH v5 03/11] UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0 Jeff Fan
  2017-03-20  8:19 ` [PATCH v5 10/11] UefiCpuPkg: Add NULL CPU Common Features Library instance Jeff Fan
@ 2017-03-20  8:26 ` wang xiaofeng
  2017-03-21  8:07 ` [PATCH v5 00/11] Add CPU features driver Tian, Feng
  3 siblings, 0 replies; 5+ messages in thread
From: wang xiaofeng @ 2017-03-20  8:26 UTC (permalink / raw)
  To: edk2-devel

Hi ,
    Anyone knows whether edk2 have plan to implement EFI_REST_PROTOCOL ? Currently I only see Rest.h but no real module install the prorocol. Thanks in advance!
     

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v5 00/11] Add CPU features driver
  2017-03-20  8:19 [PATCH v5 00/11] Add CPU features driver Jeff Fan
                   ` (2 preceding siblings ...)
  2017-03-20  8:26 ` Do edk2 have plan to implement EFI_REST_PROTOCOL ? wang xiaofeng
@ 2017-03-21  8:07 ` Tian, Feng
  3 siblings, 0 replies; 5+ messages in thread
From: Tian, Feng @ 2017-03-21  8:07 UTC (permalink / raw)
  To: Fan, Jeff, edk2-devel@lists.01.org; +Cc: Kinney, Michael D, Tian, Feng

Series Reviewed-by: Feng Tian <feng.tian@intel.com>

Thanks
Feng

-----Original Message-----
From: Fan, Jeff 
Sent: Monday, March 20, 2017 4:20 PM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [PATCH v5 00/11] Add CPU features driver

This serial of patches will add CPU featuers initialization on boot time.

1) One new Register CPU Features Library and instances are added to provide the
   capability to register CPU feature's detect/initialize services.
2) One new NULL class CPU Commong Features Library instance is added to provide
   detect/initialize servcies of CPU features defined in SDM.
3) New CPU features PEI/DXE drivers are added to initialize CPU features in PEI
   phase or DXE phase, by consuming Register CPU Features Library.

https://bugzilla.tianocore.org/show_bug.cgi?id=421

The whole updated UefiCpuPkg v5 could be accessed at https://github.com/JeffFan/edk2/tree/CpuFeaturesV5/UefiCpuPkg for review.

v2:
  #9: Format debug messages.
  #10:
    1. Using MSR_IA32_EFER to enable/disable NX feature instead of using
       MSR_IA32_MISC_ENABLE.
    2. Fix bug that SMX and VMX feature is swapped.

v3:
  #9:  Trim white space at end of line.
  #10: Add AesniGetConfigData() to get current register state.

v4:
  #3, #8, #9: Fix GCC complied issue.

v5:
  #3:  Set DestinationRegisterTableList[Index].RegisterTableEntry before
       RegisterTableEntry is updated.
  #10: Move MSR reading from AesniGetConfigData() to AesniSupport().

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>

Jeff Fan (11):
  UefiCpuPkg/AcpiCpuData: Update RegisterTableEntry type
  UefiCpuPkg/CpuS3DataDxe: Consume the existing PcdCpuS3DataAddress
  UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0
  UefiCpuPkg/Msr: Add CPUID signature check MACROs
  UefiCpuPkg/UefiCpuPkg.dec: Add a set of CPU features PCDs
  UefiCpuPkg: Add GUID gEdkiiCpuFeaturesSetDoneGuid
  UefiCpuPkg: Add GUID gEdkiiCpuFeaturesInitDoneGuid
  UefiCpuPkg/Include/Library: Add Register CPU Features Library
  UefiCpuPkg: Add PEI/DXE Register CPU Features Library instances
  UefiCpuPkg: Add NULL CPU Common Features Library instance
  UefiCpuPkg: Add CPU Features PEI/DXE drivers

 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.c            | 122 +++
 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.inf          |  53 ++
 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.uni          |  22 +
 UefiCpuPkg/CpuFeatures/CpuFeaturesDxeExtra.uni     |  20 +
 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.c            |  75 ++
 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.inf          |  49 ++
 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.uni          |  22 +
 UefiCpuPkg/CpuFeatures/CpuFeaturesPeiExtra.uni     |  20 +
 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c                |  56 +-
 UefiCpuPkg/Include/AcpiCpuData.h                   |   6 +-
 UefiCpuPkg/Include/Guid/CpuFeaturesInitDone.h      |  26 +
 UefiCpuPkg/Include/Guid/CpuFeaturesSetDone.h       |  26 +
 .../Include/Library/RegisterCpuFeaturesLib.h       | 516 ++++++++++++
 UefiCpuPkg/Include/Register/Msr/AtomMsr.h          |  22 +-
 UefiCpuPkg/Include/Register/Msr/BroadwellMsr.h     |  21 +-
 UefiCpuPkg/Include/Register/Msr/Core2Msr.h         |  19 +-
 UefiCpuPkg/Include/Register/Msr/CoreMsr.h          |  18 +-
 UefiCpuPkg/Include/Register/Msr/GoldmontMsr.h      |  18 +-
 UefiCpuPkg/Include/Register/Msr/HaswellEMsr.h      |  18 +-
 UefiCpuPkg/Include/Register/Msr/HaswellMsr.h       |  20 +-
 UefiCpuPkg/Include/Register/Msr/IvyBridgeMsr.h     |  18 +-
 UefiCpuPkg/Include/Register/Msr/NehalemMsr.h       |  21 +-
 UefiCpuPkg/Include/Register/Msr/P6Msr.h            |  23 +-
 UefiCpuPkg/Include/Register/Msr/Pentium4Msr.h      |  15 +-
 UefiCpuPkg/Include/Register/Msr/PentiumMMsr.h      |  18 +-
 UefiCpuPkg/Include/Register/Msr/PentiumMsr.h       |  20 +-
 UefiCpuPkg/Include/Register/Msr/SandyBridgeMsr.h   |  19 +-
 UefiCpuPkg/Include/Register/Msr/SilvermontMsr.h    |  22 +-
 UefiCpuPkg/Include/Register/Msr/SkylakeMsr.h       |  19 +-
 UefiCpuPkg/Include/Register/Msr/Xeon5600Msr.h      |  19 +-
 UefiCpuPkg/Include/Register/Msr/XeonDMsr.h         |  19 +-
 UefiCpuPkg/Include/Register/Msr/XeonE7Msr.h        |  18 +-
 UefiCpuPkg/Include/Register/Msr/XeonPhiMsr.h       |  18 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c    | 127 +++
 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c      |  79 ++
 .../Library/CpuCommonFeaturesLib/ClockModulation.c | 106 +++
 .../CpuCommonFeaturesLib/CpuCommonFeatures.h       | 867 +++++++++++++++++++++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.c    | 227 ++++++
 .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf  |  68 ++  .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni  |  25 +
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c     |  81 ++
 .../Library/CpuCommonFeaturesLib/ExecuteDisable.c  |  91 +++
 .../Library/CpuCommonFeaturesLib/FastStrings.c     |  52 ++
 .../Library/CpuCommonFeaturesLib/FeatureControl.c  | 314 ++++++++
 .../CpuCommonFeaturesLib/LimitCpuIdMaxval.c        |  82 ++
 .../Library/CpuCommonFeaturesLib/MachineCheck.c    | 231 ++++++
 .../Library/CpuCommonFeaturesLib/MonitorMwait.c    |  79 ++
 .../Library/CpuCommonFeaturesLib/PendingBreak.c    |  90 +++
 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   |  81 ++
 .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 745 ++++++++++++++++++
 .../DxeRegisterCpuFeaturesLib.c                    | 266 +++++++
 .../DxeRegisterCpuFeaturesLib.inf                  |  62 ++
 .../PeiRegisterCpuFeaturesLib.c                    | 390 +++++++++
 .../PeiRegisterCpuFeaturesLib.inf                  |  64 ++
 .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h   | 193 +++++
 .../RegisterCpuFeaturesDxe.uni                     |  22 +
 .../RegisterCpuFeaturesLib.c                       | 770 ++++++++++++++++++
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c                  |  32 +-
 UefiCpuPkg/UefiCpuPkg.dec                          |  50 +-
 UefiCpuPkg/UefiCpuPkg.dsc                          |  14 +-
 60 files changed, 6545 insertions(+), 61 deletions(-)  create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.c
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.inf
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxe.uni
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesDxeExtra.uni
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.c
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.inf
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPei.uni
 create mode 100644 UefiCpuPkg/CpuFeatures/CpuFeaturesPeiExtra.uni
 create mode 100644 UefiCpuPkg/Include/Guid/CpuFeaturesInitDone.h
 create mode 100644 UefiCpuPkg/Include/Guid/CpuFeaturesSetDone.h
 create mode 100644 UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.uni
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c
 create mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesDxe.uni
 create mode 100644 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c

--
2.9.3.windows.2



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-21  8:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-20  8:19 [PATCH v5 00/11] Add CPU features driver Jeff Fan
2017-03-20  8:19 ` [PATCH v5 03/11] UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0 Jeff Fan
2017-03-20  8:19 ` [PATCH v5 10/11] UefiCpuPkg: Add NULL CPU Common Features Library instance Jeff Fan
2017-03-20  8:26 ` Do edk2 have plan to implement EFI_REST_PROTOCOL ? wang xiaofeng
2017-03-21  8:07 ` [PATCH v5 00/11] Add CPU features driver Tian, Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox