]>
Commit | Line | Data |
---|---|---|
80c4b236 JF |
1 | /** @file\r |
2 | Register CPU Features Library to register and manage CPU features.\r | |
3 | \r | |
79be3d27 | 4 | Copyright (c) 2017 - 2019, 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 | #ifndef __REGISTER_CPU_FEATURES_LIB_H__\r | |
10 | #define __REGISTER_CPU_FEATURES_LIB_H__\r | |
11 | \r | |
12 | #include <AcpiCpuData.h>\r | |
13 | #include <Register/Cpuid.h>\r | |
14 | #include <Protocol/MpService.h>\r | |
15 | \r | |
16 | ///\r | |
17 | /// Defines used to identify a CPU feature. The lower 16-bits are used to\r | |
18 | /// identify a unique CPU feature and the value represents a bit number in\r | |
19 | /// a bit mask. The upper 16-bits are bit mask values that are used as\r | |
20 | /// modifiers of a CPU feature. When used in a list, the define value\r | |
21 | /// CPU_FEATURE_END is used to terminate a list of CPU feature values.\r | |
22 | /// @{\r | |
23 | #define CPU_FEATURE_AESNI 0\r | |
24 | #define CPU_FEATURE_TURBO_MODE 1\r | |
25 | #define CPU_FEATURE_MWAIT 2\r | |
26 | #define CPU_FEATURE_ACPI 3\r | |
27 | #define CPU_FEATURE_EIST 4\r | |
28 | #define CPU_FEATURE_XD 5\r | |
29 | #define CPU_FEATURE_FASTSTRINGS 6\r | |
30 | #define CPU_FEATURE_VMX 7\r | |
31 | #define CPU_FEATURE_SMX 8\r | |
ac36ef87 | 32 | #define CPU_FEATURE_LMCE 9\r |
80c4b236 JF |
33 | #define CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER 10\r |
34 | #define CPU_FEATURE_LIMIT_CPUID_MAX_VAL 11\r | |
35 | #define CPU_FEATURE_MCE 12\r | |
36 | #define CPU_FEATURE_MCA 13\r | |
37 | #define CPU_FEATURE_MCG_CTL 14\r | |
38 | #define CPU_FEATURE_PENDING_BREAK 15\r | |
39 | #define CPU_FEATURE_C1E 16\r | |
40 | #define CPU_FEATURE_C1_AUTO_DEMOTION 17\r | |
41 | #define CPU_FEATURE_C3_AUTO_DEMOTION 18\r | |
bea7af27 JF |
42 | #define CPU_FEATURE_C1_UNDEMOTION 19\r |
43 | #define CPU_FEATURE_C3_UNDEMOTION 20\r | |
80c4b236 JF |
44 | #define CPU_FEATURE_C_STATE 21\r |
45 | #define CPU_FEATURE_TM 22\r | |
46 | #define CPU_FEATURE_TM2 23\r | |
47 | #define CPU_FEATURE_X2APIC 24\r | |
48 | #define CPU_FEATURE_RESERVED_25 25\r | |
49 | #define CPU_FEATURE_RESERVED_26 26\r | |
50 | #define CPU_FEATURE_RESERVED_27 27\r | |
51 | #define CPU_FEATURE_RESERVED_28 28\r | |
52 | #define CPU_FEATURE_RESERVED_29 29\r | |
53 | #define CPU_FEATURE_RESERVED_30 30\r | |
54 | #define CPU_FEATURE_RESERVED_31 31\r | |
55 | \r | |
56 | #define CPU_FEATURE_L2_PREFETCHER (32+0)\r | |
57 | #define CPU_FEATURE_L1_DATA_PREFETCHER (32+1)\r | |
58 | #define CPU_FEATURE_HARDWARE_PREFETCHER (32+2)\r | |
59 | #define CPU_FEATURE_ADJACENT_CACHE_LINE_PREFETCH (32+3)\r | |
60 | #define CPU_FEATURE_DCU_PREFETCHER (32+4)\r | |
61 | #define CPU_FEATURE_IP_PREFETCHER (32+5)\r | |
62 | #define CPU_FEATURE_MLC_STREAMER_PREFETCHER (32+6)\r | |
63 | #define CPU_FEATURE_MLC_SPATIAL_PREFETCHER (32+7)\r | |
e85cfa2f | 64 | #define CPU_FEATURE_THREE_STRIKE_COUNTER (32+8)\r |
80c4b236 JF |
65 | #define CPU_FEATURE_APIC_TPR_UPDATE_MESSAGE (32+9)\r |
66 | #define CPU_FEATURE_ENERGY_PERFORMANCE_BIAS (32+10)\r | |
f1a68ab2 | 67 | #define CPU_FEATURE_PPIN (32+11)\r |
a7e2a253 | 68 | #define CPU_FEATURE_PROC_TRACE (32+12)\r |
80c4b236 | 69 | \r |
87e93951 ED |
70 | #define CPU_FEATURE_BEFORE_ALL BIT23\r |
71 | #define CPU_FEATURE_AFTER_ALL BIT24\r | |
72 | //\r | |
73 | // CPU_FEATURE_BEFORE and CPU_FEATURE_AFTER only mean Thread scope\r | |
74 | // before and Thread scope after.\r | |
75 | // It will be replace with CPU_FEATURE_THREAD_BEFORE and\r | |
76 | // CPU_FEATURE_THREAD_AFTER, and should not be used anymore.\r | |
77 | //\r | |
78 | #define CPU_FEATURE_BEFORE BIT25\r | |
79 | #define CPU_FEATURE_AFTER BIT26\r | |
80 | \r | |
81 | #define CPU_FEATURE_THREAD_BEFORE CPU_FEATURE_BEFORE\r | |
82 | #define CPU_FEATURE_THREAD_AFTER CPU_FEATURE_AFTER\r | |
83 | #define CPU_FEATURE_CORE_BEFORE BIT27\r | |
84 | #define CPU_FEATURE_CORE_AFTER BIT28\r | |
85 | #define CPU_FEATURE_PACKAGE_BEFORE BIT29\r | |
86 | #define CPU_FEATURE_PACKAGE_AFTER BIT30\r | |
80c4b236 JF |
87 | #define CPU_FEATURE_END MAX_UINT32\r |
88 | /// @}\r | |
89 | \r | |
90 | ///\r | |
91 | /// CPU Information passed into the SupportFunc and InitializeFunc of the\r | |
92 | /// RegisterCpuFeature() library function. This structure contains information\r | |
93 | /// that is commonly used during CPU feature detection and initialization.\r | |
94 | ///\r | |
95 | typedef struct {\r | |
96 | ///\r | |
97 | /// The package that the CPU resides\r | |
98 | ///\r | |
99 | EFI_PROCESSOR_INFORMATION ProcessorInfo;\r | |
100 | ///\r | |
101 | /// The Display Family of the CPU computed from CPUID leaf CPUID_VERSION_INFO\r | |
102 | ///\r | |
103 | UINT32 DisplayFamily;\r | |
104 | ///\r | |
105 | /// The Display Model of the CPU computed from CPUID leaf CPUID_VERSION_INFO\r | |
106 | ///\r | |
107 | UINT32 DisplayModel;\r | |
108 | ///\r | |
109 | /// The Stepping ID of the CPU computed from CPUID leaf CPUID_VERSION_INFO\r | |
110 | ///\r | |
111 | UINT32 SteppingId;\r | |
112 | ///\r | |
113 | /// The Processor Type of the CPU computed from CPUID leaf CPUID_VERSION_INFO\r | |
114 | ///\r | |
115 | UINT32 ProcessorType;\r | |
116 | ///\r | |
117 | /// Bit field structured returned in ECX from CPUID leaf CPUID_VERSION_INFO\r | |
118 | ///\r | |
119 | CPUID_VERSION_INFO_ECX CpuIdVersionInfoEcx;\r | |
120 | ///\r | |
121 | /// Bit field structured returned in EDX from CPUID leaf CPUID_VERSION_INFO\r | |
122 | ///\r | |
123 | CPUID_VERSION_INFO_EDX CpuIdVersionInfoEdx;\r | |
124 | } REGISTER_CPU_FEATURE_INFORMATION;\r | |
125 | \r | |
126 | /**\r | |
127 | Determines if a CPU feature is enabled in PcdCpuFeaturesSupport bit mask.\r | |
128 | If a CPU feature is disabled in PcdCpuFeaturesSupport then all the code/data\r | |
129 | associated with that feature should be optimized away if compiler\r | |
130 | optimizations are enabled.\r | |
131 | \r | |
132 | @param[in] Feature The bit number of the CPU feature to check in the PCD\r | |
133 | PcdCpuFeaturesSupport.\r | |
134 | \r | |
135 | @retval TRUE The CPU feature is set in PcdCpuFeaturesSupport.\r | |
136 | @retval FALSE The CPU feature is not set in PcdCpuFeaturesSupport.\r | |
137 | \r | |
138 | @note This service could be called by BSP only.\r | |
139 | **/\r | |
140 | BOOLEAN\r | |
141 | EFIAPI\r | |
142 | IsCpuFeatureSupported (\r | |
143 | IN UINT32 Feature\r | |
144 | );\r | |
145 | \r | |
146 | /**\r | |
147 | Determines if a CPU feature is set in PcdCpuFeaturesSetting bit mask.\r | |
148 | \r | |
149 | @param[in] Feature The bit number of the CPU feature to check in the PCD\r | |
150 | PcdCpuFeaturesSetting.\r | |
151 | \r | |
152 | @retval TRUE The CPU feature is set in PcdCpuFeaturesSetting.\r | |
153 | @retval FALSE The CPU feature is not set in PcdCpuFeaturesSetting.\r | |
154 | \r | |
155 | @note This service could be called by BSP only.\r | |
156 | **/\r | |
157 | BOOLEAN\r | |
158 | EFIAPI\r | |
159 | IsCpuFeatureInSetting (\r | |
160 | IN UINT32 Feature\r | |
161 | );\r | |
162 | \r | |
80c4b236 JF |
163 | /**\r |
164 | Prepares for the data used by CPU feature detection and initialization.\r | |
165 | \r | |
166 | @param[in] NumberOfProcessors The number of CPUs in the platform.\r | |
167 | \r | |
168 | @return Pointer to a buffer of CPU related configuration data.\r | |
169 | \r | |
170 | @note This service could be called by BSP only.\r | |
171 | **/\r | |
172 | typedef\r | |
173 | VOID *\r | |
174 | (EFIAPI *CPU_FEATURE_GET_CONFIG_DATA)(\r | |
175 | IN UINTN NumberOfProcessors\r | |
176 | );\r | |
177 | \r | |
178 | /**\r | |
179 | Detects if CPU feature supported on current processor.\r | |
180 | \r | |
181 | @param[in] ProcessorNumber The index of the CPU executing this function.\r | |
182 | @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r | |
183 | structure for the CPU executing this function.\r | |
184 | @param[in] ConfigData A pointer to the configuration buffer returned\r | |
185 | by CPU_FEATURE_GET_CONFIG_DATA. NULL if\r | |
186 | CPU_FEATURE_GET_CONFIG_DATA was not provided in\r | |
187 | RegisterCpuFeature().\r | |
188 | \r | |
189 | @retval TRUE CPU feature is supported.\r | |
190 | @retval FALSE CPU feature is not supported.\r | |
191 | \r | |
192 | @note This service could be called by BSP/APs.\r | |
193 | **/\r | |
194 | typedef\r | |
195 | BOOLEAN\r | |
196 | (EFIAPI *CPU_FEATURE_SUPPORT)(\r | |
197 | IN UINTN ProcessorNumber,\r | |
198 | IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,\r | |
199 | IN VOID *ConfigData OPTIONAL\r | |
200 | );\r | |
201 | \r | |
202 | /**\r | |
203 | Initializes CPU feature to specific state.\r | |
204 | \r | |
205 | This service does not initialize hardware and only produces entries in the\r | |
206 | Register Table for specified processor. Hardware initialization on BSP/APs\r | |
207 | will be done in CpuFeaturesInitialize().\r | |
208 | \r | |
209 | @param[in] ProcessorNumber The index of the CPU executing this function.\r | |
210 | @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION\r | |
211 | structure for the CPU executing this function.\r | |
212 | @param[in] ConfigData A pointer to the configuration buffer returned\r | |
213 | by CPU_FEATURE_GET_CONFIG_DATA. NULL if\r | |
214 | CPU_FEATURE_GET_CONFIG_DATA was not provided in\r | |
215 | RegisterCpuFeature().\r | |
216 | @param[in] State If TRUE, then the CPU feature must be enabled.\r | |
217 | If FALSE, then the CPU feature must be disabled.\r | |
218 | \r | |
219 | @retval RETURN_SUCCESS CPU feature is initialized.\r | |
220 | \r | |
221 | @note This service could be called by BSP only.\r | |
222 | **/\r | |
223 | typedef\r | |
224 | RETURN_STATUS\r | |
225 | (EFIAPI *CPU_FEATURE_INITIALIZE)(\r | |
226 | IN UINTN ProcessorNumber,\r | |
227 | IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,\r | |
228 | IN VOID *ConfigData, OPTIONAL\r | |
229 | IN BOOLEAN State\r | |
230 | );\r | |
231 | \r | |
232 | /**\r | |
233 | Registers a CPU Feature.\r | |
234 | \r | |
235 | @param[in] FeatureName A Null-terminated Ascii string indicates CPU feature\r | |
236 | name.\r | |
237 | @param[in] GetConfigDataFunc CPU feature get configuration data function. This\r | |
238 | is an optional parameter that may be NULL. If NULL,\r | |
239 | then the most recently registered function for the\r | |
240 | CPU feature is used. If no functions are registered\r | |
241 | for a CPU feature, then the CPU configuration data\r | |
242 | for the registered feature is NULL.\r | |
243 | @param[in] SupportFunc CPU feature support function. This is an optional\r | |
244 | parameter that may be NULL. If NULL, then the most\r | |
245 | recently registered function for the CPU feature is\r | |
246 | used. If no functions are registered for a CPU\r | |
247 | feature, then the CPU feature is assumed to be\r | |
248 | supported by all CPUs.\r | |
249 | @param[in] InitializeFunc CPU feature initialize function. This is an optional\r | |
250 | parameter that may be NULL. If NULL, then the most\r | |
251 | recently registered function for the CPU feature is\r | |
252 | used. If no functions are registered for a CPU\r | |
253 | feature, then the CPU feature initialization is\r | |
254 | skipped.\r | |
255 | @param[in] ... Variable argument list of UINT32 CPU feature value.\r | |
256 | Values with no modifiers are the features provided\r | |
257 | by the registered functions.\r | |
258 | Values with CPU_FEATURE_BEFORE modifier are features\r | |
259 | that must be initialized after the features provided\r | |
260 | by the registered functions are used.\r | |
261 | Values with CPU_FEATURE_AFTER modifier are features\r | |
262 | that must be initialized before the features provided\r | |
263 | by the registered functions are used.\r | |
264 | The last argument in this variable argument list must\r | |
265 | always be CPU_FEATURE_END.\r | |
266 | \r | |
267 | @retval RETURN_SUCCESS The CPU feature was successfully registered.\r | |
268 | @retval RETURN_OUT_OF_RESOURCES There are not enough resources to register\r | |
269 | the CPU feature.\r | |
270 | @retval RETURN_UNSUPPORTED Registration of the CPU feature is not\r | |
271 | supported due to a circular dependency between\r | |
272 | BEFORE and AFTER features.\r | |
273 | \r | |
274 | @note This service could be called by BSP only.\r | |
275 | **/\r | |
276 | RETURN_STATUS\r | |
277 | EFIAPI\r | |
278 | RegisterCpuFeature (\r | |
279 | IN CHAR8 *FeatureName, OPTIONAL\r | |
280 | IN CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc, OPTIONAL\r | |
281 | IN CPU_FEATURE_SUPPORT SupportFunc, OPTIONAL\r | |
282 | IN CPU_FEATURE_INITIALIZE InitializeFunc, OPTIONAL\r | |
283 | ...\r | |
284 | );\r | |
285 | \r | |
286 | /**\r | |
287 | Performs CPU features detection.\r | |
288 | \r | |
289 | This service will invoke MP service to check CPU features'\r | |
290 | capabilities on BSP/APs.\r | |
291 | \r | |
292 | @note This service could be called by BSP only.\r | |
293 | **/\r | |
294 | VOID\r | |
295 | EFIAPI\r | |
296 | CpuFeaturesDetect (\r | |
297 | VOID\r | |
298 | );\r | |
299 | \r | |
300 | /**\r | |
301 | Performs CPU features Initialization.\r | |
302 | \r | |
303 | This service will invoke MP service to perform CPU features\r | |
304 | initialization on BSP/APs per user configuration.\r | |
305 | \r | |
306 | @note This service could be called by BSP only.\r | |
307 | **/\r | |
308 | VOID\r | |
309 | EFIAPI\r | |
310 | CpuFeaturesInitialize (\r | |
311 | VOID\r | |
312 | );\r | |
313 | \r | |
314 | /**\r | |
315 | Switches to assigned BSP after CPU features initialization.\r | |
316 | \r | |
317 | @param[in] ProcessorNumber The index of the CPU executing this function.\r | |
318 | \r | |
319 | @note This service could be called by BSP only.\r | |
320 | **/\r | |
321 | VOID\r | |
322 | EFIAPI\r | |
323 | SwitchBspAfterFeaturesInitialize (\r | |
324 | IN UINTN ProcessorNumber\r | |
325 | );\r | |
326 | \r | |
327 | /**\r | |
328 | Adds an entry in specified register table.\r | |
329 | \r | |
330 | This function adds an entry in specified register table, with given register type,\r | |
331 | register index, bit section and value.\r | |
332 | \r | |
333 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
334 | @param[in] RegisterType Type of the register to program\r | |
335 | @param[in] Index Index of the register to program\r | |
336 | @param[in] ValueMask Mask of bits in register to write\r | |
337 | @param[in] Value Value to write\r | |
338 | \r | |
339 | @note This service could be called by BSP only.\r | |
340 | **/\r | |
341 | VOID\r | |
342 | EFIAPI\r | |
343 | CpuRegisterTableWrite (\r | |
344 | IN UINTN ProcessorNumber,\r | |
345 | IN REGISTER_TYPE RegisterType,\r | |
346 | IN UINT64 Index,\r | |
347 | IN UINT64 ValueMask,\r | |
348 | IN UINT64 Value\r | |
349 | );\r | |
350 | \r | |
351 | /**\r | |
352 | Adds an entry in specified Pre-SMM register table.\r | |
353 | \r | |
354 | This function adds an entry in specified register table, with given register type,\r | |
355 | register index, bit section and value.\r | |
356 | \r | |
357 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
358 | @param[in] RegisterType Type of the register to program\r | |
359 | @param[in] Index Index of the register to program\r | |
360 | @param[in] ValueMask Mask of bits in register to write\r | |
361 | @param[in] Value Value to write\r | |
362 | \r | |
363 | @note This service could be called by BSP only.\r | |
364 | **/\r | |
365 | VOID\r | |
366 | EFIAPI\r | |
367 | PreSmmCpuRegisterTableWrite (\r | |
368 | IN UINTN ProcessorNumber,\r | |
369 | IN REGISTER_TYPE RegisterType,\r | |
370 | IN UINT64 Index,\r | |
371 | IN UINT64 ValueMask,\r | |
372 | IN UINT64 Value\r | |
373 | );\r | |
374 | \r | |
375 | /**\r | |
376 | Adds a 32-bit register write entry in specified register table.\r | |
377 | \r | |
378 | This macro adds an entry in specified register table, with given register type,\r | |
379 | register index, and value.\r | |
380 | \r | |
381 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
382 | @param[in] RegisterType Type of the register to program\r | |
383 | @param[in] Index Index of the register to program\r | |
384 | @param[in] Value Value to write\r | |
385 | \r | |
386 | @note This service could be called by BSP only.\r | |
387 | **/\r | |
388 | #define CPU_REGISTER_TABLE_WRITE32(ProcessorNumber, RegisterType, Index, Value) \\r | |
389 | do { \\r | |
390 | CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \\r | |
391 | } while(FALSE);\r | |
392 | \r | |
393 | /**\r | |
394 | Adds a 64-bit register write entry in specified register table.\r | |
395 | \r | |
396 | This macro adds an entry in specified register table, with given register type,\r | |
397 | register index, and value.\r | |
398 | \r | |
399 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
400 | @param[in] RegisterType Type of the register to program\r | |
401 | @param[in] Index Index of the register to program\r | |
402 | @param[in] Value Value to write\r | |
403 | \r | |
404 | @note This service could be called by BSP only.\r | |
405 | **/\r | |
406 | #define CPU_REGISTER_TABLE_WRITE64(ProcessorNumber, RegisterType, Index, Value) \\r | |
407 | do { \\r | |
408 | CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \\r | |
409 | } while(FALSE);\r | |
410 | \r | |
411 | /**\r | |
412 | Adds a bit field write entry in specified register table.\r | |
413 | \r | |
414 | This macro adds an entry in specified register table, with given register type,\r | |
415 | register index, bit field section, and value.\r | |
416 | \r | |
417 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
418 | @param[in] RegisterType Type of the register to program.\r | |
419 | @param[in] Index Index of the register to program.\r | |
420 | @param[in] Type The data type name of a register structure.\r | |
421 | @param[in] Field The bit fiel name in register structure to write.\r | |
422 | @param[in] Value Value to write to the bit field.\r | |
423 | \r | |
424 | @note This service could be called by BSP only.\r | |
425 | **/\r | |
426 | #define CPU_REGISTER_TABLE_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value) \\r | |
427 | do { \\r | |
428 | UINT64 ValueMask; \\r | |
429 | ValueMask = MAX_UINT64; \\r | |
430 | ((Type *)(&ValueMask))->Field = 0; \\r | |
431 | CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \\r | |
432 | } while(FALSE);\r | |
433 | \r | |
434 | /**\r | |
435 | Adds a 32-bit register write entry in specified register table.\r | |
436 | \r | |
437 | This macro adds an entry in specified register table, with given register type,\r | |
438 | register index, and value.\r | |
439 | \r | |
440 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
441 | @param[in] RegisterType Type of the register to program\r | |
442 | @param[in] Index Index of the register to program\r | |
443 | @param[in] Value Value to write\r | |
444 | \r | |
445 | @note This service could be called by BSP only.\r | |
446 | **/\r | |
447 | #define PRE_SMM_CPU_REGISTER_TABLE_WRITE32(ProcessorNumber, RegisterType, Index, Value) \\r | |
448 | do { \\r | |
449 | PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \\r | |
450 | } while(FALSE);\r | |
451 | \r | |
452 | /**\r | |
453 | Adds a 64-bit register write entry in specified register table.\r | |
454 | \r | |
455 | This macro adds an entry in specified register table, with given register type,\r | |
456 | register index, and value.\r | |
457 | \r | |
458 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
459 | @param[in] RegisterType Type of the register to program\r | |
460 | @param[in] Index Index of the register to program\r | |
461 | @param[in] Value Value to write\r | |
462 | \r | |
463 | @note This service could be called by BSP only.\r | |
464 | **/\r | |
465 | #define PRE_SMM_CPU_REGISTER_TABLE_WRITE64(ProcessorNumber, RegisterType, Index, Value) \\r | |
466 | do { \\r | |
467 | PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \\r | |
468 | } while(FALSE);\r | |
469 | \r | |
470 | /**\r | |
471 | Adds a bit field write entry in specified register table.\r | |
472 | \r | |
473 | This macro adds an entry in specified register table, with given register type,\r | |
474 | register index, bit field section, and value.\r | |
475 | \r | |
476 | @param[in] ProcessorNumber The index of the CPU to add a register table entry.\r | |
477 | @param[in] RegisterType Type of the register to program.\r | |
478 | @param[in] Index Index of the register to program.\r | |
479 | @param[in] Type The data type name of a register structure.\r | |
480 | @param[in] Field The bit fiel name in register structure to write.\r | |
481 | @param[in] Value Value to write to the bit field.\r | |
482 | \r | |
483 | @note This service could be called by BSP only.\r | |
484 | **/\r | |
485 | #define PRE_SMM_CPU_REGISTER_TABLE_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value) \\r | |
486 | do { \\r | |
487 | UINT64 ValueMask; \\r | |
488 | ValueMask = MAX_UINT64; \\r | |
489 | ((Type *)(&ValueMask))->Field = 0; \\r | |
490 | PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \\r | |
491 | } while(FALSE);\r | |
492 | \r | |
493 | #endif\r |