VirtualBox

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

Last change on this file since 99404 was 99404, checked in by vboxsync, 22 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 3.4 KB
Line 
1/** @file
2 Pending Break 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 Pending Break 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 Pending Break feature is supported.
23 @retval FALSE Pending Break feature is not supported.
24
25 @note This service could be called by BSP/APs.
26**/
27BOOLEAN
28EFIAPI
29PendingBreakSupport (
30 IN UINTN ProcessorNumber,
31 IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
32 IN VOID *ConfigData OPTIONAL
33 )
34{
35 if (IS_ATOM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
36 IS_CORE2_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
37 IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
38 IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
39 IS_PENTIUM_M_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel))
40 {
41 return (CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1);
42 }
43
44 return FALSE;
45}
46
47/**
48 Initializes Pending Break feature to specific state.
49
50 @param[in] ProcessorNumber The index of the CPU executing this function.
51 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
52 structure for the CPU executing this function.
53 @param[in] ConfigData A pointer to the configuration buffer returned
54 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
55 CPU_FEATURE_GET_CONFIG_DATA was not provided in
56 RegisterCpuFeature().
57 @param[in] State If TRUE, then the Pending Break feature must be enabled.
58 If FALSE, then the Pending Break feature must be disabled.
59
60 @retval RETURN_SUCCESS Pending Break feature is initialized.
61
62 @note This service could be called by BSP only.
63**/
64RETURN_STATUS
65EFIAPI
66PendingBreakInitialize (
67 IN UINTN ProcessorNumber,
68 IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
69 IN VOID *ConfigData OPTIONAL,
70 IN BOOLEAN State
71 )
72{
73 //
74 // The scope of the MSR_ATOM_IA32_MISC_ENABLE is core for below processor type, only program
75 // MSR_ATOM_IA32_MISC_ENABLE for thread 0 in each core.
76 //
77 // Support function has check the processer type for this feature, no need to check again
78 // here.
79 //
80 if (CpuInfo->ProcessorInfo.Location.Thread != 0) {
81 return RETURN_SUCCESS;
82 }
83
84 //
85 // ATOM, CORE2, CORE, PENTIUM_4 and IS_PENTIUM_M_PROCESSOR have the same MSR index,
86 // Simply use MSR_ATOM_IA32_MISC_ENABLE here
87 //
88 CPU_REGISTER_TABLE_WRITE_FIELD (
89 ProcessorNumber,
90 Msr,
91 MSR_ATOM_IA32_MISC_ENABLE,
92 MSR_ATOM_IA32_MISC_ENABLE_REGISTER,
93 Bits.FERR,
94 (State) ? 1 : 0
95 );
96 return RETURN_SUCCESS;
97}
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