]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Library/CpuCommonFeaturesLib/FastStrings.c
UefiCpuPkg: Replace BSD License with BSD+Patent License
[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
0acd8697 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
80c4b236
JF
6\r
7**/\r
8\r
9#include "CpuCommonFeatures.h"\r
10\r
11/**\r
12 Initializes Fast-Strings feature to specific state.\r
13\r
14 @param[in] ProcessorNumber The index of the CPU executing this function.\r
15 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r
16 structure for the CPU executing this function.\r
17 @param[in] ConfigData A pointer to the configuration buffer returned\r
18 by CPU_FEATURE_GET_CONFIG_DATA. NULL if\r
19 CPU_FEATURE_GET_CONFIG_DATA was not provided in\r
20 RegisterCpuFeature().\r
21 @param[in] State If TRUE, then the Fast-Strings feature must be enabled.\r
22 If FALSE, then the Fast-Strings feature must be disabled.\r
23\r
24 @retval RETURN_SUCCESS Fast-Strings feature is initialized.\r
25\r
26 @note This service could be called by BSP only.\r
27**/\r
28RETURN_STATUS\r
29EFIAPI\r
30FastStringsInitialize (\r
31 IN UINTN ProcessorNumber,\r
32 IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,\r
33 IN VOID *ConfigData, OPTIONAL\r
34 IN BOOLEAN State\r
35 )\r
36{\r
d28daadd
ED
37 //\r
38 // The scope of FastStrings bit in the MSR_IA32_MISC_ENABLE is core for below processor type, only program\r
39 // MSR_IA32_MISC_ENABLE for thread 0 in each core.\r
40 //\r
41 if (IS_SILVERMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||\r
42 IS_GOLDMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||\r
43 IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {\r
44 if (CpuInfo->ProcessorInfo.Location.Thread != 0) {\r
45 return RETURN_SUCCESS;\r
46 }\r
47 }\r
48\r
80c4b236
JF
49 CPU_REGISTER_TABLE_WRITE_FIELD (\r
50 ProcessorNumber,\r
51 Msr,\r
52 MSR_IA32_MISC_ENABLE,\r
53 MSR_IA32_MISC_ENABLE_REGISTER,\r
54 Bits.FastStrings,\r
55 (State) ? 1 : 0\r
56 );\r
57 return RETURN_SUCCESS;\r
58}\r