2 LimitCpuidMaxval 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 LimitCpuidMaxval feature supported on current processor.
14 @param[in] ProcessorNumber The index of the CPU executing this function.
15 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
16 structure for the CPU executing this function.
17 @param[in] ConfigData A pointer to the configuration buffer returned
18 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
19 CPU_FEATURE_GET_CONFIG_DATA was not provided in
22 @retval TRUE LimitCpuidMaxval feature is supported.
23 @retval FALSE LimitCpuidMaxval feature is not supported.
25 @note This service could be called by BSP/APs.
29 LimitCpuidMaxvalSupport (
30 IN UINTN ProcessorNumber
,
31 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
32 IN VOID
*ConfigData OPTIONAL
37 AsmCpuid (CPUID_SIGNATURE
, &Eax
, NULL
, NULL
, NULL
);
42 Initializes LimitCpuidMaxval feature to specific state.
44 @param[in] ProcessorNumber The index of the CPU executing this function.
45 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
46 structure for the CPU executing this function.
47 @param[in] ConfigData A pointer to the configuration buffer returned
48 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
49 CPU_FEATURE_GET_CONFIG_DATA was not provided in
51 @param[in] State If TRUE, then the LimitCpuidMaxval feature must be enabled.
52 If FALSE, then the LimitCpuidMaxval feature must be disabled.
54 @retval RETURN_SUCCESS LimitCpuidMaxval feature is initialized.
56 @note This service could be called by BSP only.
60 LimitCpuidMaxvalInitialize (
61 IN UINTN ProcessorNumber
,
62 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
63 IN VOID
*ConfigData OPTIONAL
,
68 // The scope of LimitCpuidMaxval bit in the MSR_IA32_MISC_ENABLE is core for below
69 // processor type, only program MSR_IA32_MISC_ENABLE for thread 0 in each core.
71 if (IS_PENTIUM_4_PROCESSOR (CpuInfo
->DisplayFamily
, CpuInfo
->DisplayModel
) ||
72 IS_SILVERMONT_PROCESSOR (CpuInfo
->DisplayFamily
, CpuInfo
->DisplayModel
) ||
73 IS_GOLDMONT_PROCESSOR (CpuInfo
->DisplayFamily
, CpuInfo
->DisplayModel
) ||
74 IS_CORE_PROCESSOR (CpuInfo
->DisplayFamily
, CpuInfo
->DisplayModel
) ||
75 IS_CORE2_PROCESSOR (CpuInfo
->DisplayFamily
, CpuInfo
->DisplayModel
)) {
76 if (CpuInfo
->ProcessorInfo
.Location
.Thread
!= 0) {
77 return RETURN_SUCCESS
;
81 CPU_REGISTER_TABLE_WRITE_FIELD (
85 MSR_IA32_MISC_ENABLE_REGISTER
,
86 Bits
.LimitCpuidMaxval
,
89 return RETURN_SUCCESS
;