]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c
UefiCpuPkg/CpuCommonFeaturesLib: Register MSR base on scope Info.
[mirror_edk2.git] / UefiCpuPkg / Library / CpuCommonFeaturesLib / FastStrings.c
CommitLineData
80c4b236
JF
1/** @file\r
2 Fast-Strings feature.\r
3\r
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "CpuCommonFeatures.h"\r
16\r
17/**\r
18 Initializes Fast-Strings feature to specific state.\r
19\r
20 @param[in] ProcessorNumber The index of the CPU executing this function.\r
21 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
22 structure for the CPU executing this function.\r
23 @param[in] ConfigData A pointer to the configuration buffer returned\r
24 by CPU_FEATURE_GET_CONFIG_DATA. NULL if\r
25 CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
26 RegisterCpuFeature().\r
27 @param[in] State If TRUE, then the Fast-Strings feature must be enabled.\r
28 If FALSE, then the Fast-Strings feature must be disabled.\r
29\r
30 @retval RETURN_SUCCESS Fast-Strings feature is initialized.\r
31\r
32 @note This service could be called by BSP only.\r
33**/\r
34RETURN_STATUS\r
35EFIAPI\r
36FastStringsInitialize (\r
37 IN UINTN ProcessorNumber,\r
38 IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,\r
39 IN VOID *ConfigData, OPTIONAL\r
40 IN BOOLEAN State\r
41 )\r
42{\r
d28daadd
ED
43 //\r
44 // The scope of FastStrings bit in the MSR_IA32_MISC_ENABLE is core for below processor type, only program\r
45 // MSR_IA32_MISC_ENABLE for thread 0 in each core.\r
46 //\r
47 if (IS_SILVERMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||\r
48 IS_GOLDMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||\r
49 IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {\r
50 if (CpuInfo->ProcessorInfo.Location.Thread != 0) {\r
51 return RETURN_SUCCESS;\r
52 }\r
53 }\r
54\r
80c4b236
JF
55 CPU_REGISTER_TABLE_WRITE_FIELD (\r
56 ProcessorNumber,\r
57 Msr,\r
58 MSR_IA32_MISC_ENABLE,\r
59 MSR_IA32_MISC_ENABLE_REGISTER,\r
60 Bits.FastStrings,\r
61 (State) ? 1 : 0\r
62 );\r
63 return RETURN_SUCCESS;\r
64}\r