]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
UefiCpuPkg: Add SmmCpuFeaturesLib
[mirror_edk2.git] / UefiCpuPkg / Library / SmmCpuFeaturesLib / SmmCpuFeaturesLib.c
CommitLineData
a9764e68
MK
1/** @file\r
2The CPU specific programming for PiSmmCpuDxeSmm module.\r
3\r
4Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <PiSmm.h>\r
16#include <Library/SmmCpuFeaturesLib.h>\r
17#include <Library/BaseLib.h>\r
18#include <Library/MtrrLib.h>\r
19#include <Library/PcdLib.h>\r
20#include <Library/MemoryAllocationLib.h>\r
21#include <Library/DebugLib.h>\r
22#include <Register/Cpuid.h>\r
23#include <Register/SmramSaveStateMap.h>\r
24\r
25//\r
26// Machine Specific Registers (MSRs)\r
27//\r
28#define SMM_FEATURES_LIB_IA32_MTRR_CAP 0x0FE\r
29#define SMM_FEATURES_LIB_IA32_FEATURE_CONTROL 0x03A\r
30#define SMM_FEATURES_LIB_IA32_SMRR_PHYSBASE 0x1F2\r
31#define SMM_FEATURES_LIB_IA32_SMRR_PHYSMASK 0x1F3\r
32#define SMM_FEATURES_LIB_IA32_CORE_SMRR_PHYSBASE 0x0A0\r
33#define SMM_FEATURES_LIB_IA32_CORE_SMRR_PHYSMASK 0x0A1\r
34#define EFI_MSR_SMRR_MASK 0xFFFFF000\r
35#define EFI_MSR_SMRR_PHYS_MASK_VALID BIT11\r
36\r
37//\r
38// Set default value to assume SMRR is not supported\r
39//\r
40BOOLEAN mSmrrSupported = FALSE;\r
41\r
42//\r
43// Set default value to assume IA-32 Architectural MSRs are used\r
44//\r
45UINT32 mSmrrPhysBaseMsr = SMM_FEATURES_LIB_IA32_SMRR_PHYSBASE;\r
46UINT32 mSmrrPhysMaskMsr = SMM_FEATURES_LIB_IA32_SMRR_PHYSMASK;\r
47\r
48//\r
49// Set default value to assume MTRRs need to be configured on each SMI\r
50//\r
51BOOLEAN mNeedConfigureMtrrs = TRUE;\r
52\r
53//\r
54// Array for state of SMRR enable on all CPUs\r
55//\r
56BOOLEAN *mSmrrEnabled;\r
57\r
58/**\r
59 The constructor function\r
60\r
61 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
62 @param[in] SystemTable A pointer to the EFI System Table.\r
63\r
64 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
65\r
66**/\r
67EFI_STATUS\r
68EFIAPI\r
69SmmCpuFeaturesLibConstructor (\r
70 IN EFI_HANDLE ImageHandle,\r
71 IN EFI_SYSTEM_TABLE *SystemTable\r
72 )\r
73{\r
74 UINT32 RegEax;\r
75 UINT32 RegEdx;\r
76 UINTN FamilyId;\r
77 UINTN ModelId;\r
78\r
79 //\r
80 // Retrieve CPU Family and Model\r
81 //\r
82 AsmCpuid (CPUID_VERSION_INFO, &RegEax, NULL, NULL, &RegEdx);\r
83 FamilyId = (RegEax >> 8) & 0xf;\r
84 ModelId = (RegEax >> 4) & 0xf;\r
85 if (FamilyId == 0x06 || FamilyId == 0x0f) {\r
86 ModelId = ModelId | ((RegEax >> 12) & 0xf0);\r
87 }\r
88\r
89 //\r
90 // Check CPUID(CPUID_VERSION_INFO).EDX[12] for MTRR capability\r
91 //\r
92 if ((RegEdx & BIT12) != 0) {\r
93 //\r
94 // Check MTRR_CAP MSR bit 11 for SMRR support\r
95 //\r
96 if ((AsmReadMsr64 (SMM_FEATURES_LIB_IA32_MTRR_CAP) & BIT11) != 0) {\r
97 mSmrrSupported = TRUE;\r
98 }\r
99 }\r
100\r
101 //\r
102 // Intel(R) 64 and IA-32 Architectures Software Developer's Manual\r
103 // Volume 3C, Section 35.3 MSRs in the Intel(R) Atom(TM) Processor Family\r
104 //\r
105 // If CPU Family/Model is 06_1CH, 06_26H, 06_27H, 06_35H or 06_36H, then\r
106 // SMRR Physical Base and SMM Physical Mask MSRs are not available.\r
107 //\r
108 if (FamilyId == 0x06) {\r
109 if (ModelId == 0x1C || ModelId == 0x26 || ModelId == 0x27 || ModelId == 0x35 || ModelId == 0x36) {\r
110 mSmrrSupported = FALSE;\r
111 }\r
112 }\r
113\r
114 //\r
115 // Intel(R) 64 and IA-32 Architectures Software Developer's Manual\r
116 // Volume 3C, Section 35.2 MSRs in the Intel(R) Core(TM) 2 Processor Family\r
117 //\r
118 // If CPU Family/Model is 06_0F or 06_17, then use Intel(R) Core(TM) 2\r
119 // Processor Family MSRs\r
120 //\r
121 if (FamilyId == 0x06) {\r
122 if (ModelId == 0x17 || ModelId == 0x0f) {\r
123 mSmrrPhysBaseMsr = SMM_FEATURES_LIB_IA32_CORE_SMRR_PHYSBASE;\r
124 mSmrrPhysMaskMsr = SMM_FEATURES_LIB_IA32_CORE_SMRR_PHYSMASK;\r
125 }\r
126 }\r
127\r
128 //\r
129 // Intel(R) 64 and IA-32 Architectures Software Developer's Manual\r
130 // Volume 3C, Section 34.4.2 SMRAM Caching\r
131 // An IA-32 processor does not automatically write back and invalidate its\r
132 // caches before entering SMM or before exiting SMM. Because of this behavior,\r
133 // care must be taken in the placement of the SMRAM in system memory and in\r
134 // the caching of the SMRAM to prevent cache incoherence when switching back\r
135 // and forth between SMM and protected mode operation.\r
136 //\r
137 // An IA-32 processor is a processor that does not support the Intel 64\r
138 // Architecture. Support for the Intel 64 Architecture can be detected from\r
139 // CPUID(CPUID_EXTENDED_CPU_SIG).EDX[29]\r
140 //\r
141 // If an IA-32 processor is detected, then set mNeedConfigureMtrrs to TRUE,\r
142 // so caches are flushed on SMI entry and SMI exit, the interrupted code\r
143 // MTRRs are saved/restored, and MTRRs for SMM are loaded.\r
144 //\r
145 AsmCpuid (CPUID_EXTENDED_FUNCTION, &RegEax, NULL, NULL, NULL);\r
146 if (RegEax >= CPUID_EXTENDED_CPU_SIG) {\r
147 AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, NULL, &RegEdx);\r
148 if ((RegEdx & BIT29) != 0) {\r
149 mNeedConfigureMtrrs = FALSE;\r
150 }\r
151 }\r
152\r
153 //\r
154 // Allocate array for state of SMRR enable on all CPUs\r
155 //\r
156 mSmrrEnabled = (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * PcdGet32 (PcdCpuMaxLogicalProcessorNumber));\r
157 ASSERT (mSmrrEnabled != NULL);\r
158\r
159 return EFI_SUCCESS;\r
160}\r
161\r
162/**\r
163 Called during the very first SMI into System Management Mode to initialize\r
164 CPU features, including SMBASE, for the currently executing CPU. Since this\r
165 is the first SMI, the SMRAM Save State Map is at the default address of\r
166 SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET. The currently executing\r
167 CPU is specified by CpuIndex and CpuIndex can be used to access information\r
168 about the currently executing CPU in the ProcessorInfo array and the\r
169 HotPlugCpuData data structure.\r
170\r
171 @param[in] CpuIndex The index of the CPU to initialize. The value\r
172 must be between 0 and the NumberOfCpus field in\r
173 the System Management System Table (SMST).\r
174 @param[in] IsMonarch TRUE if the CpuIndex is the index of the CPU that\r
175 was elected as monarch during System Management\r
176 Mode initialization.\r
177 FALSE if the CpuIndex is not the index of the CPU\r
178 that was elected as monarch during System\r
179 Management Mode initialization.\r
180 @param[in] ProcessorInfo Pointer to an array of EFI_PROCESSOR_INFORMATION\r
181 structures. ProcessorInfo[CpuIndex] contains the\r
182 information for the currently executing CPU.\r
183 @param[in] CpuHotPlugData Pointer to the CPU_HOT_PLUG_DATA structure that\r
184 contains the ApidId and SmBase arrays.\r
185**/\r
186VOID\r
187EFIAPI\r
188SmmCpuFeaturesInitializeProcessor (\r
189 IN UINTN CpuIndex,\r
190 IN BOOLEAN IsMonarch,\r
191 IN EFI_PROCESSOR_INFORMATION *ProcessorInfo,\r
192 IN CPU_HOT_PLUG_DATA *CpuHotPlugData\r
193 )\r
194{\r
195 SMRAM_SAVE_STATE_MAP *CpuState;\r
196 UINT64 FeatureControl;\r
197\r
198 //\r
199 // Configure SMBASE.\r
200 //\r
201 CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);\r
202 CpuState->x86.SMBASE = (UINT32)CpuHotPlugData->SmBase[CpuIndex];\r
203\r
204 //\r
205 // Intel(R) 64 and IA-32 Architectures Software Developer's Manual\r
206 // Volume 3C, Section 35.2 MSRs in the Intel(R) Core(TM) 2 Processor Family\r
207 //\r
208 // If Intel(R) Core(TM) Core(TM) 2 Processor Family MSRs are being used, then\r
209 // make sure SMRR Enable(BIT3) of MSR_FEATURE_CONTROL MSR(0x3A) is set before\r
210 // accessing SMRR base/mask MSRs. If Lock(BIT0) of MSR_FEATURE_CONTROL MSR(0x3A)\r
211 // is set, then the MSR is locked and can not be modified.\r
212 //\r
213 if (mSmrrSupported && mSmrrPhysBaseMsr == SMM_FEATURES_LIB_IA32_CORE_SMRR_PHYSBASE) {\r
214 FeatureControl = AsmReadMsr64 (SMM_FEATURES_LIB_IA32_FEATURE_CONTROL);\r
215 if ((FeatureControl & BIT3) == 0) {\r
216 if ((FeatureControl & BIT0) == 0) {\r
217 AsmWriteMsr64 (SMM_FEATURES_LIB_IA32_FEATURE_CONTROL, FeatureControl | BIT3);\r
218 } else {\r
219 mSmrrSupported = FALSE;\r
220 }\r
221 }\r
222 }\r
223\r
224 //\r
225 // If SMRR is supported, then program SMRR base/mask MSRs.\r
226 // The EFI_MSR_SMRR_PHYS_MASK_VALID bit is not set until the first normal SMI.\r
227 // The code that initializes SMM environment is running in normal mode\r
228 // from SMRAM region. If SMRR is enabled here, then the SMRAM region\r
229 // is protected and the normal mode code execution will fail.\r
230 //\r
231 if (mSmrrSupported) {\r
232 AsmWriteMsr64 (mSmrrPhysBaseMsr, CpuHotPlugData->SmrrBase | MTRR_CACHE_WRITE_BACK);\r
233 AsmWriteMsr64 (mSmrrPhysMaskMsr, (~(CpuHotPlugData->SmrrSize - 1) & EFI_MSR_SMRR_MASK));\r
234 mSmrrEnabled[CpuIndex] = FALSE;\r
235 }\r
236}\r
237\r
238/**\r
239 This function updates the SMRAM save state on the currently executing CPU\r
240 to resume execution at a specific address after an RSM instruction. This\r
241 function must evaluate the SMRAM save state to determine the execution mode\r
242 the RSM instruction resumes and update the resume execution address with\r
243 either NewInstructionPointer32 or NewInstructionPoint. The auto HALT restart\r
244 flag in the SMRAM save state must always be cleared. This function returns\r
245 the value of the instruction pointer from the SMRAM save state that was\r
246 replaced. If this function returns 0, then the SMRAM save state was not\r
247 modified.\r
248\r
249 This function is called during the very first SMI on each CPU after\r
250 SmmCpuFeaturesInitializeProcessor() to set a flag in normal execution mode\r
251 to signal that the SMBASE of each CPU has been updated before the default\r
252 SMBASE address is used for the first SMI to the next CPU.\r
253\r
254 @param[in] CpuIndex The index of the CPU to hook. The value\r
255 must be between 0 and the NumberOfCpus\r
256 field in the System Management System Table\r
257 (SMST).\r
258 @param[in] CpuState Pointer to SMRAM Save State Map for the\r
259 currently executing CPU.\r
260 @param[in] NewInstructionPointer32 Instruction pointer to use if resuming to\r
261 32-bit execution mode from 64-bit SMM.\r
262 @param[in] NewInstructionPointer Instruction pointer to use if resuming to\r
263 same execution mode as SMM.\r
264\r
265 @retval 0 This function did modify the SMRAM save state.\r
266 @retval > 0 The original instruction pointer value from the SMRAM save state\r
267 before it was replaced.\r
268**/\r
269UINT64\r
270EFIAPI\r
271SmmCpuFeaturesHookReturnFromSmm (\r
272 IN UINTN CpuIndex,\r
273 IN SMRAM_SAVE_STATE_MAP *CpuState,\r
274 IN UINT64 NewInstructionPointer32,\r
275 IN UINT64 NewInstructionPointer\r
276 )\r
277{\r
278 return 0;\r
279}\r
280\r
281/**\r
282 Hook point in normal execution mode that allows the one CPU that was elected\r
283 as monarch during System Management Mode initialization to perform additional\r
284 initialization actions immediately after all of the CPUs have processed their\r
285 first SMI and called SmmCpuFeaturesInitializeProcessor() relocating SMBASE\r
286 into a buffer in SMRAM and called SmmCpuFeaturesHookReturnFromSmm().\r
287**/\r
288VOID\r
289EFIAPI\r
290SmmCpuFeaturesSmmRelocationComplete (\r
291 VOID\r
292 )\r
293{\r
294}\r
295\r
296/**\r
297 Return the size, in bytes, of a custom SMI Handler in bytes. If 0 is\r
298 returned, then a custom SMI handler is not provided by this library,\r
299 and the default SMI handler must be used.\r
300\r
301 @retval 0 Use the default SMI handler.\r
302 @retval > 0 Use the SMI handler installed by SmmCpuFeaturesInstallSmiHandler()\r
303 The caller is required to allocate enough SMRAM for each CPU to\r
304 support the size of the custom SMI handler.\r
305**/\r
306UINTN\r
307EFIAPI\r
308SmmCpuFeaturesGetSmiHandlerSize (\r
309 VOID\r
310 )\r
311{\r
312 return 0;\r
313}\r
314\r
315/**\r
316 Install a custom SMI handler for the CPU specified by CpuIndex. This function\r
317 is only called if SmmCpuFeaturesGetSmiHandlerSize() returns a size is greater\r
318 than zero and is called by the CPU that was elected as monarch during System\r
319 Management Mode initialization.\r
320\r
321 @param[in] CpuIndex The index of the CPU to install the custom SMI handler.\r
322 The value must be between 0 and the NumberOfCpus field\r
323 in the System Management System Table (SMST).\r
324 @param[in] SmBase The SMBASE address for the CPU specified by CpuIndex.\r
325 @param[in] SmiStack The stack to use when an SMI is processed by the\r
326 the CPU specified by CpuIndex.\r
327 @param[in] StackSize The size, in bytes, if the stack used when an SMI is\r
328 processed by the CPU specified by CpuIndex.\r
329 @param[in] GdtBase The base address of the GDT to use when an SMI is\r
330 processed by the CPU specified by CpuIndex.\r
331 @param[in] GdtSize The size, in bytes, of the GDT used when an SMI is\r
332 processed by the CPU specified by CpuIndex.\r
333 @param[in] IdtBase The base address of the IDT to use when an SMI is\r
334 processed by the CPU specified by CpuIndex.\r
335 @param[in] IdtSize The size, in bytes, of the IDT used when an SMI is\r
336 processed by the CPU specified by CpuIndex.\r
337 @param[in] Cr3 The base address of the page tables to use when an SMI\r
338 is processed by the CPU specified by CpuIndex.\r
339**/\r
340VOID\r
341EFIAPI\r
342SmmCpuFeaturesInstallSmiHandler (\r
343 IN UINTN CpuIndex,\r
344 IN UINT32 SmBase,\r
345 IN VOID *SmiStack,\r
346 IN UINTN StackSize,\r
347 IN UINTN GdtBase,\r
348 IN UINTN GdtSize,\r
349 IN UINTN IdtBase,\r
350 IN UINTN IdtSize,\r
351 IN UINT32 Cr3\r
352 )\r
353{\r
354}\r
355\r
356/**\r
357 Determines if MTRR registers must be configured to set SMRAM cache-ability\r
358 when executing in System Management Mode.\r
359\r
360 @retval TRUE MTRR registers must be configured to set SMRAM cache-ability.\r
361 @retval FALSE MTRR registers do not need to be configured to set SMRAM\r
362 cache-ability.\r
363**/\r
364BOOLEAN\r
365EFIAPI\r
366SmmCpuFeaturesNeedConfigureMtrrs (\r
367 VOID\r
368 )\r
369{\r
370 return mNeedConfigureMtrrs;\r
371}\r
372\r
373/**\r
374 Disable SMRR register if SMRR is supported and SmmCpuFeaturesNeedConfigureMtrrs()\r
375 returns TRUE.\r
376**/\r
377VOID\r
378EFIAPI\r
379SmmCpuFeaturesDisableSmrr (\r
380 VOID\r
381 )\r
382{\r
383 if (mSmrrSupported && mNeedConfigureMtrrs) {\r
384 AsmWriteMsr64 (mSmrrPhysMaskMsr, AsmReadMsr64(mSmrrPhysMaskMsr) & ~EFI_MSR_SMRR_PHYS_MASK_VALID);\r
385 }\r
386}\r
387\r
388/**\r
389 Enable SMRR register if SMRR is supported and SmmCpuFeaturesNeedConfigureMtrrs()\r
390 returns TRUE.\r
391**/\r
392VOID\r
393EFIAPI\r
394SmmCpuFeaturesReenableSmrr (\r
395 VOID\r
396 )\r
397{\r
398 if (mSmrrSupported && mNeedConfigureMtrrs) {\r
399 AsmWriteMsr64 (mSmrrPhysMaskMsr, AsmReadMsr64(mSmrrPhysMaskMsr) | EFI_MSR_SMRR_PHYS_MASK_VALID);\r
400 }\r
401}\r
402\r
403/**\r
404 Processor specific hook point each time a CPU enters System Management Mode.\r
405\r
406 @param[in] CpuIndex The index of the CPU that has entered SMM. The value\r
407 must be between 0 and the NumberOfCpus field in the\r
408 System Management System Table (SMST).\r
409**/\r
410VOID\r
411EFIAPI\r
412SmmCpuFeaturesRendezvousEntry (\r
413 IN UINTN CpuIndex\r
414 )\r
415{\r
416 //\r
417 // If SMRR is supported and this is the first normal SMI, then enable SMRR\r
418 //\r
419 if (mSmrrSupported && !mSmrrEnabled[CpuIndex]) {\r
420 AsmWriteMsr64 (mSmrrPhysMaskMsr, AsmReadMsr64 (mSmrrPhysMaskMsr) | EFI_MSR_SMRR_PHYS_MASK_VALID);\r
421 mSmrrEnabled[CpuIndex] = TRUE;\r
422 }\r
423}\r
424\r
425/**\r
426 Processor specific hook point each time a CPU exits System Management Mode.\r
427\r
428 @param[in] CpuIndex The index of the CPU that is exiting SMM. The value must\r
429 be between 0 and the NumberOfCpus field in the System\r
430 Management System Table (SMST).\r
431**/\r
432VOID\r
433EFIAPI\r
434SmmCpuFeaturesRendezvousExit (\r
435 IN UINTN CpuIndex\r
436 )\r
437{\r
438}\r
439\r
440/**\r
441 Check to see if an SMM register is supported by a specified CPU.\r
442\r
443 @param[in] CpuIndex The index of the CPU to check for SMM register support.\r
444 The value must be between 0 and the NumberOfCpus field\r
445 in the System Management System Table (SMST).\r
446 @param[in] RegName Identifies the SMM register to check for support.\r
447\r
448 @retval TRUE The SMM register specified by RegName is supported by the CPU\r
449 specified by CpuIndex.\r
450 @retval FALSE The SMM register specified by RegName is not supported by the\r
451 CPU specified by CpuIndex.\r
452**/\r
453BOOLEAN\r
454EFIAPI\r
455SmmCpuFeaturesIsSmmRegisterSupported (\r
456 IN UINTN CpuIndex,\r
457 IN SMM_REG_NAME RegName\r
458 )\r
459{\r
460 return FALSE;\r
461}\r
462\r
463/**\r
464 Returns the current value of the SMM register for the specified CPU.\r
465 If the SMM register is not supported, then 0 is returned.\r
466\r
467 @param[in] CpuIndex The index of the CPU to read the SMM register. The\r
468 value must be between 0 and the NumberOfCpus field in\r
469 the System Management System Table (SMST).\r
470 @param[in] RegName Identifies the SMM register to read.\r
471\r
472 @return The value of the SMM register specified by RegName from the CPU\r
473 specified by CpuIndex.\r
474**/\r
475UINT64\r
476EFIAPI\r
477SmmCpuFeaturesGetSmmRegister (\r
478 IN UINTN CpuIndex,\r
479 IN SMM_REG_NAME RegName\r
480 )\r
481{\r
482 return 0;\r
483}\r
484\r
485/**\r
486 Sets the value of an SMM register on a specified CPU.\r
487 If the SMM register is not supported, then no action is performed.\r
488\r
489 @param[in] CpuIndex The index of the CPU to write the SMM register. The\r
490 value must be between 0 and the NumberOfCpus field in\r
491 the System Management System Table (SMST).\r
492 @param[in] RegName Identifies the SMM register to write.\r
493 registers are read-only.\r
494 @param[in] Value The value to write to the SMM register.\r
495**/\r
496VOID\r
497EFIAPI\r
498SmmCpuFeaturesSetSmmRegister (\r
499 IN UINTN CpuIndex,\r
500 IN SMM_REG_NAME RegName,\r
501 IN UINT64 Value\r
502 )\r
503{\r
504}\r
505\r
506/**\r
507 Read an SMM Save State register on the target processor. If this function\r
508 returns EFI_UNSUPPORTED, then the caller is responsible for reading the\r
509 SMM Save Sate register.\r
510\r
511 @param[in] CpuIndex The index of the CPU to read the SMM Save State. The\r
512 value must be between 0 and the NumberOfCpus field in\r
513 the System Management System Table (SMST).\r
514 @param[in] Register The SMM Save State register to read.\r
515 @param[in] Width The number of bytes to read from the CPU save state.\r
516 @param[out] Buffer Upon return, this holds the CPU register value read\r
517 from the save state.\r
518\r
519 @retval EFI_SUCCESS The register was read from Save State.\r
520 @retval EFI_INVALID_PARAMTER Buffer is NULL.\r
521 @retval EFI_UNSUPPORTED This function does not support reading Register.\r
522\r
523**/\r
524EFI_STATUS\r
525EFIAPI\r
526SmmCpuFeaturesReadSaveStateRegister (\r
527 IN UINTN CpuIndex,\r
528 IN EFI_SMM_SAVE_STATE_REGISTER Register,\r
529 IN UINTN Width,\r
530 OUT VOID *Buffer\r
531 )\r
532{\r
533 return EFI_UNSUPPORTED;\r
534}\r
535\r
536/**\r
537 Writes an SMM Save State register on the target processor. If this function\r
538 returns EFI_UNSUPPORTED, then the caller is responsible for writing the\r
539 SMM Save Sate register.\r
540\r
541 @param[in] CpuIndex The index of the CPU to write the SMM Save State. The\r
542 value must be between 0 and the NumberOfCpus field in\r
543 the System Management System Table (SMST).\r
544 @param[in] Register The SMM Save State register to write.\r
545 @param[in] Width The number of bytes to write to the CPU save state.\r
546 @param[in] Buffer Upon entry, this holds the new CPU register value.\r
547\r
548 @retval EFI_SUCCESS The register was written to Save State.\r
549 @retval EFI_INVALID_PARAMTER Buffer is NULL.\r
550 @retval EFI_UNSUPPORTED This function does not support writing Register.\r
551**/\r
552EFI_STATUS\r
553EFIAPI\r
554SmmCpuFeaturesWriteSaveStateRegister (\r
555 IN UINTN CpuIndex,\r
556 IN EFI_SMM_SAVE_STATE_REGISTER Register,\r
557 IN UINTN Width,\r
558 IN CONST VOID *Buffer\r
559 )\r
560{\r
561 return EFI_UNSUPPORTED;\r
562}\r