2 Protected Processor Inventory Number(PPIN) feature.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "CpuCommonFeatures.h"
18 Detects if Protected Processor Inventory Number feature supported on current
21 @param[in] ProcessorNumber The index of the CPU executing this function.
22 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
23 structure for the CPU executing this function.
24 @param[in] ConfigData A pointer to the configuration buffer returned
25 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
26 CPU_FEATURE_GET_CONFIG_DATA was not provided in
29 @retval TRUE Protected Processor Inventory Number feature is supported.
30 @retval FALSE Protected Processor Inventory Number feature is not supported.
32 @note This service could be called by BSP/APs.
37 IN UINTN ProcessorNumber
,
38 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
39 IN VOID
*ConfigData OPTIONAL
42 MSR_IVY_BRIDGE_PLATFORM_INFO_1_REGISTER PlatformInfo
;
44 if ((CpuInfo
->DisplayFamily
== 0x06) &&
45 ((CpuInfo
->DisplayModel
== 0x3E) || // Xeon E5 V2
46 (CpuInfo
->DisplayModel
== 0x56) || // Xeon Processor D Product
47 (CpuInfo
->DisplayModel
== 0x4F) || // Xeon E5 v4, E7 v4
48 (CpuInfo
->DisplayModel
== 0x55) || // Xeon Processor Scalable
49 (CpuInfo
->DisplayModel
== 0x57) || // Xeon Phi processor 3200, 5200, 7200 series.
50 (CpuInfo
->DisplayModel
== 0x85) // Future Xeon phi processor
53 // Check whether platform support this feature.
55 PlatformInfo
.Uint64
= AsmReadMsr64 (MSR_IVY_BRIDGE_PLATFORM_INFO_1
);
56 return (PlatformInfo
.Bits
.PPIN_CAP
!= 0);
63 Initializes Protected Processor Inventory Number feature to specific state.
65 @param[in] ProcessorNumber The index of the CPU executing this function.
66 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
67 structure for the CPU executing this function.
68 @param[in] ConfigData A pointer to the configuration buffer returned
69 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
70 CPU_FEATURE_GET_CONFIG_DATA was not provided in
72 @param[in] State If TRUE, then the Protected Processor Inventory
73 Number feature must be enabled.
74 If FALSE, then the Protected Processor Inventory
75 Number feature must be disabled.
77 @retval RETURN_SUCCESS Protected Processor Inventory Number feature is
79 @retval RETURN_DEVICE_ERROR Device can't change state because it has been
86 IN UINTN ProcessorNumber
,
87 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
88 IN VOID
*ConfigData
, OPTIONAL
92 MSR_IVY_BRIDGE_PPIN_CTL_REGISTER MsrPpinCtrl
;
95 // Check whether device already lock this register.
96 // If already locked, just base on the request state and
97 // the current state to return the status.
99 MsrPpinCtrl
.Uint64
= AsmReadMsr64 (MSR_IVY_BRIDGE_PPIN_CTL
);
100 if (MsrPpinCtrl
.Bits
.LockOut
!= 0) {
101 return MsrPpinCtrl
.Bits
.Enable_PPIN
== State
? RETURN_SUCCESS
: RETURN_DEVICE_ERROR
;
104 CPU_REGISTER_TABLE_WRITE_FIELD (
107 MSR_IVY_BRIDGE_PPIN_CTL
,
108 MSR_IVY_BRIDGE_PPIN_CTL_REGISTER
,
113 return RETURN_SUCCESS
;