TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuCommonFeaturesLib.c
Go to the documentation of this file.
1
10#include "CpuCommonFeatures.h"
11
17RETURN_STATUS
18EFIAPI
20 VOID
21 )
22{
23 RETURN_STATUS Status;
24
26 Status = RegisterCpuFeature (
27 "AESNI",
32 CPU_FEATURE_END
33 );
34 ASSERT_EFI_ERROR (Status);
35 }
36
37 if (IsCpuFeatureSupported (CPU_FEATURE_MWAIT)) {
38 Status = RegisterCpuFeature (
39 "MWAIT",
40 NULL,
43 CPU_FEATURE_MWAIT,
44 CPU_FEATURE_END
45 );
46 ASSERT_EFI_ERROR (Status);
47 }
48
49 if (IsCpuFeatureSupported (CPU_FEATURE_ACPI)) {
50 Status = RegisterCpuFeature (
51 "ACPI",
55 CPU_FEATURE_ACPI,
56 CPU_FEATURE_END
57 );
58 ASSERT_EFI_ERROR (Status);
59 }
60
61 if (IsCpuFeatureSupported (CPU_FEATURE_EIST)) {
62 Status = RegisterCpuFeature (
63 "EIST",
64 NULL,
67 CPU_FEATURE_EIST,
68 CPU_FEATURE_END
69 );
70 ASSERT_EFI_ERROR (Status);
71 }
72
73 if (IsCpuFeatureSupported (CPU_FEATURE_FASTSTRINGS)) {
74 Status = RegisterCpuFeature (
75 "FastStrings",
76 NULL,
77 NULL,
79 CPU_FEATURE_FASTSTRINGS,
80 CPU_FEATURE_END
81 );
82 ASSERT_EFI_ERROR (Status);
83 }
84
85 if (IsCpuFeatureSupported (CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER)) {
86 Status = RegisterCpuFeature (
87 "Lock Feature Control Register",
88 NULL,
91 CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER,
92 CPU_FEATURE_END
93 );
94 ASSERT_EFI_ERROR (Status);
95 }
96
97 if (IsCpuFeatureSupported (CPU_FEATURE_SMX)) {
98 Status = RegisterCpuFeature (
99 "SMX",
100 NULL,
103 CPU_FEATURE_SMX,
104 CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_THREAD_BEFORE,
105 CPU_FEATURE_END
106 );
107 ASSERT_EFI_ERROR (Status);
108 }
109
110 if (IsCpuFeatureSupported (CPU_FEATURE_VMX)) {
111 Status = RegisterCpuFeature (
112 "VMX",
113 NULL,
116 CPU_FEATURE_VMX,
117 CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_THREAD_BEFORE,
118 CPU_FEATURE_END
119 );
120 ASSERT_EFI_ERROR (Status);
121 }
122
123 if (IsCpuFeatureSupported (CPU_FEATURE_LIMIT_CPUID_MAX_VAL)) {
124 Status = RegisterCpuFeature (
125 "Limit CpuId Maximum Value",
126 NULL,
129 CPU_FEATURE_LIMIT_CPUID_MAX_VAL,
130 CPU_FEATURE_END
131 );
132 ASSERT_EFI_ERROR (Status);
133 }
134
135 if (IsCpuFeatureSupported (CPU_FEATURE_MCE)) {
136 Status = RegisterCpuFeature (
137 "Machine Check Enable",
138 NULL,
141 CPU_FEATURE_MCE,
142 CPU_FEATURE_END
143 );
144 ASSERT_EFI_ERROR (Status);
145 }
146
147 if (IsCpuFeatureSupported (CPU_FEATURE_MCA)) {
148 Status = RegisterCpuFeature (
149 "Machine Check Architect",
150 NULL,
153 CPU_FEATURE_MCA,
154 CPU_FEATURE_END
155 );
156 ASSERT_EFI_ERROR (Status);
157 }
158
159 if (IsCpuFeatureSupported (CPU_FEATURE_MCG_CTL)) {
160 Status = RegisterCpuFeature (
161 "MCG_CTL",
162 NULL,
165 CPU_FEATURE_MCG_CTL,
166 CPU_FEATURE_END
167 );
168 ASSERT_EFI_ERROR (Status);
169 }
170
171 if (IsCpuFeatureSupported (CPU_FEATURE_PENDING_BREAK)) {
172 Status = RegisterCpuFeature (
173 "Pending Break",
174 NULL,
177 CPU_FEATURE_PENDING_BREAK,
178 CPU_FEATURE_END
179 );
180 ASSERT_EFI_ERROR (Status);
181 }
182
183 if (IsCpuFeatureSupported (CPU_FEATURE_C1E)) {
184 Status = RegisterCpuFeature (
185 "C1E",
186 NULL,
189 CPU_FEATURE_C1E,
190 CPU_FEATURE_END
191 );
192 ASSERT_EFI_ERROR (Status);
193 }
194
195 if (IsCpuFeatureSupported (CPU_FEATURE_X2APIC)) {
196 Status = RegisterCpuFeature (
197 "X2Apic",
201 CPU_FEATURE_X2APIC,
202 CPU_FEATURE_END
203 );
204 ASSERT_EFI_ERROR (Status);
205 }
206
207 if (IsCpuFeatureSupported (CPU_FEATURE_PPIN)) {
208 Status = RegisterCpuFeature (
209 "PPIN",
213 CPU_FEATURE_PPIN,
214 CPU_FEATURE_END
215 );
216 ASSERT_EFI_ERROR (Status);
217 }
218
219 if (IsCpuFeatureSupported (CPU_FEATURE_LMCE)) {
220 Status = RegisterCpuFeature (
221 "LMCE",
222 NULL,
225 CPU_FEATURE_LMCE,
226 CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_THREAD_BEFORE,
227 CPU_FEATURE_END
228 );
229 ASSERT_EFI_ERROR (Status);
230 }
231
232 if (IsCpuFeatureSupported (CPU_FEATURE_PROC_TRACE)) {
233 Status = RegisterCpuFeature (
234 "Proc Trace",
238 CPU_FEATURE_PROC_TRACE,
239 CPU_FEATURE_END
240 );
241 ASSERT_EFI_ERROR (Status);
242 }
243
244 return RETURN_SUCCESS;
245}
VOID *EFIAPI AesniGetConfigData(IN UINTN NumberOfProcessors)
Definition: Aesni.c:22
BOOLEAN EFIAPI AesniSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: Aesni.c:51
RETURN_STATUS EFIAPI AesniInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: Aesni.c:88
BOOLEAN EFIAPI C1eSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: C1e.c:29
RETURN_STATUS EFIAPI C1eInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: C1e.c:57
RETURN_STATUS EFIAPI ClockModulationInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
VOID *EFIAPI ClockModulationGetConfigData(IN UINTN NumberOfProcessors)
BOOLEAN EFIAPI ClockModulationSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
RETURN_STATUS EFIAPI McaInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: MachineCheck.c:128
RETURN_STATUS EFIAPI FastStringsInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: FastStrings.c:30
BOOLEAN EFIAPI McgCtlSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: MachineCheck.c:209
RETURN_STATUS EFIAPI X2ApicInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: X2Apic.c:90
VOID *EFIAPI ProcTraceGetConfigData(IN UINTN NumberOfProcessors)
Definition: ProcTrace.c:71
BOOLEAN EFIAPI PpinSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: Ppin.c:52
BOOLEAN EFIAPI PendingBreakSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: PendingBreak.c:29
RETURN_STATUS EFIAPI MonitorMwaitInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: MonitorMwait.c:57
RETURN_STATUS EFIAPI ProcTraceInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: ProcTrace.c:176
RETURN_STATUS EFIAPI McgCtlInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: MachineCheck.c:244
BOOLEAN EFIAPI LimitCpuidMaxvalSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
RETURN_STATUS EFIAPI MceInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: MachineCheck.c:57
RETURN_STATUS EFIAPI LimitCpuidMaxvalInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
RETURN_STATUS EFIAPI LockFeatureControlRegisterInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
RETURN_STATUS EFIAPI VmxInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
BOOLEAN EFIAPI SmxSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
BOOLEAN EFIAPI VmxSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
BOOLEAN EFIAPI EistSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: Eist.c:29
VOID *EFIAPI X2ApicGetConfigData(IN UINTN NumberOfProcessors)
Definition: X2Apic.c:22
RETURN_STATUS EFIAPI PendingBreakInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: PendingBreak.c:66
BOOLEAN EFIAPI X2ApicSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: X2Apic.c:53
RETURN_STATUS EFIAPI LmceInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: MachineCheck.c:316
BOOLEAN EFIAPI LmceSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: MachineCheck.c:279
BOOLEAN EFIAPI MceSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: MachineCheck.c:29
BOOLEAN EFIAPI McaSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: MachineCheck.c:96
VOID *EFIAPI PpinGetConfigData(IN UINTN NumberOfProcessors)
Definition: Ppin.c:22
BOOLEAN EFIAPI ProcTraceSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: ProcTrace.c:109
BOOLEAN EFIAPI LockFeatureControlRegisterSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
BOOLEAN EFIAPI MonitorMwaitSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
Definition: MonitorMwait.c:29
RETURN_STATUS EFIAPI PpinInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: Ppin.c:109
RETURN_STATUS EFIAPI EistInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
Definition: Eist.c:59
RETURN_STATUS EFIAPI SmxInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
RETURN_STATUS EFIAPI CpuCommonFeaturesLibConstructor(VOID)
#define NULL
Definition: Base.h:319
#define RETURN_SUCCESS
Definition: Base.h:1066
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
BOOLEAN EFIAPI IsCpuFeatureSupported(IN UINT32 Feature)
#define CPU_FEATURE_AESNI
RETURN_STATUS EFIAPI RegisterCpuFeature(IN CHAR8 *FeatureName OPTIONAL, IN CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc OPTIONAL, IN CPU_FEATURE_SUPPORT SupportFunc OPTIONAL, IN CPU_FEATURE_INITIALIZE InitializeFunc OPTIONAL,...)