2 Protected Processor Inventory Number(PPIN) feature.
4 Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "CpuCommonFeatures.h"
12 Detects if Protected Processor Inventory Number feature supported on current
15 @param[in] ProcessorNumber The index of the CPU executing this function.
16 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
17 structure for the CPU executing this function.
18 @param[in] ConfigData A pointer to the configuration buffer returned
19 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
20 CPU_FEATURE_GET_CONFIG_DATA was not provided in
23 @retval TRUE Protected Processor Inventory Number feature is supported.
24 @retval FALSE Protected Processor Inventory Number feature is not supported.
26 @note This service could be called by BSP/APs.
31 IN UINTN ProcessorNumber
,
32 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
33 IN VOID
*ConfigData OPTIONAL
36 MSR_IVY_BRIDGE_PLATFORM_INFO_1_REGISTER PlatformInfo
;
38 if ((CpuInfo
->DisplayFamily
== 0x06) &&
39 ((CpuInfo
->DisplayModel
== 0x3E) || // Xeon E5 V2
40 (CpuInfo
->DisplayModel
== 0x56) || // Xeon Processor D Product
41 (CpuInfo
->DisplayModel
== 0x4F) || // Xeon E5 v4, E7 v4
42 (CpuInfo
->DisplayModel
== 0x55) || // Xeon Processor Scalable
43 (CpuInfo
->DisplayModel
== 0x57) || // Xeon Phi processor 3200, 5200, 7200 series.
44 (CpuInfo
->DisplayModel
== 0x85) // Future Xeon phi processor
47 // Check whether platform support this feature.
49 PlatformInfo
.Uint64
= AsmReadMsr64 (MSR_IVY_BRIDGE_PLATFORM_INFO_1
);
50 return (PlatformInfo
.Bits
.PPIN_CAP
!= 0);
57 Initializes Protected Processor Inventory Number feature to specific state.
59 @param[in] ProcessorNumber The index of the CPU executing this function.
60 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
61 structure for the CPU executing this function.
62 @param[in] ConfigData A pointer to the configuration buffer returned
63 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
64 CPU_FEATURE_GET_CONFIG_DATA was not provided in
66 @param[in] State If TRUE, then the Protected Processor Inventory
67 Number feature must be enabled.
68 If FALSE, then the Protected Processor Inventory
69 Number feature must be disabled.
71 @retval RETURN_SUCCESS Protected Processor Inventory Number feature is
73 @retval RETURN_DEVICE_ERROR Device can't change state because it has been
80 IN UINTN ProcessorNumber
,
81 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
82 IN VOID
*ConfigData
, OPTIONAL
86 MSR_IVY_BRIDGE_PPIN_CTL_REGISTER MsrPpinCtrl
;
89 // Check whether device already lock this register.
90 // If already locked, just base on the request state and
91 // the current state to return the status.
93 MsrPpinCtrl
.Uint64
= AsmReadMsr64 (MSR_IVY_BRIDGE_PPIN_CTL
);
94 if (MsrPpinCtrl
.Bits
.LockOut
!= 0) {
95 return MsrPpinCtrl
.Bits
.Enable_PPIN
== State
? RETURN_SUCCESS
: RETURN_DEVICE_ERROR
;
99 // Support function already check the processor which support PPIN feature, so this function not need
100 // to check the processor again.
102 // The scope of the MSR_IVY_BRIDGE_PPIN_CTL is package level, only program MSR_IVY_BRIDGE_PPIN_CTL for
103 // thread 0 core 0 in each package.
105 if ((CpuInfo
->ProcessorInfo
.Location
.Thread
!= 0) || (CpuInfo
->ProcessorInfo
.Location
.Core
!= 0)) {
106 return RETURN_SUCCESS
;
109 CPU_REGISTER_TABLE_WRITE_FIELD (
112 MSR_IVY_BRIDGE_PPIN_CTL
,
113 MSR_IVY_BRIDGE_PPIN_CTL_REGISTER
,
118 return RETURN_SUCCESS
;