VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c@ 85716

Last change on this file since 85716 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/** @file
2 Enhanced Intel SpeedStep feature.
3
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "CpuCommonFeatures.h"
10
11/**
12 Detects if Enhanced Intel SpeedStep feature supported on current processor.
13
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
20 RegisterCpuFeature().
21
22 @retval TRUE Enhanced Intel SpeedStep feature is supported.
23 @retval FALSE Enhanced Intel SpeedStep feature is not supported.
24
25 @note This service could be called by BSP/APs.
26**/
27BOOLEAN
28EFIAPI
29EistSupport (
30 IN UINTN ProcessorNumber,
31 IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
32 IN VOID *ConfigData OPTIONAL
33 )
34{
35 return (CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1);
36}
37
38/**
39 Initializes Enhanced Intel SpeedStep feature to specific state.
40
41 @param[in] ProcessorNumber The index of the CPU executing this function.
42 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
43 structure for the CPU executing this function.
44 @param[in] ConfigData A pointer to the configuration buffer returned
45 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
46 CPU_FEATURE_GET_CONFIG_DATA was not provided in
47 RegisterCpuFeature().
48 @param[in] State If TRUE, then the Enhanced Intel SpeedStep feature
49 must be enabled.
50 If FALSE, then the Enhanced Intel SpeedStep feature
51 must be disabled.
52
53 @retval RETURN_SUCCESS Enhanced Intel SpeedStep feature is initialized.
54
55 @note This service could be called by BSP only.
56**/
57RETURN_STATUS
58EFIAPI
59EistInitialize (
60 IN UINTN ProcessorNumber,
61 IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
62 IN VOID *ConfigData, OPTIONAL
63 IN BOOLEAN State
64 )
65{
66 //
67 // The scope of the MSR_IA32_MISC_ENABLE is core for below processor type, only program
68 // MSR_IA32_MISC_ENABLE for thread 0 in each core.
69 //
70 if (IS_ATOM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
71 IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
72 IS_CORE2_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
73 if (CpuInfo->ProcessorInfo.Location.Thread != 0) {
74 return RETURN_SUCCESS;
75 }
76 }
77
78 CPU_REGISTER_TABLE_WRITE_FIELD (
79 ProcessorNumber,
80 Msr,
81 MSR_IA32_MISC_ENABLE,
82 MSR_IA32_MISC_ENABLE_REGISTER,
83 Bits.EIST,
84 (State) ? 1 : 0
85 );
86 return RETURN_SUCCESS;
87}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette