]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.c
OvmfPkg EmuVariableFvb: Use 64-bit NV storage PCD
[mirror_edk2.git] / MdeModulePkg / Universal / FaultTolerantWriteDxe / FaultTolerantWriteSmmDxe.c
CommitLineData
f3b80a8e 1/** @file\r
2\r
3 Implement the Fault Tolerant Write (FTW) protocol based on SMM FTW \r
4 module.\r
5\r
6Copyright (c) 2011, Intel Corporation. All rights reserved. <BR>\r
7This program and the accompanying materials \r
8are licensed and made available under the terms and conditions of the BSD License \r
9which accompanies this distribution. The full text of the license may be found at \r
10http://opensource.org/licenses/bsd-license.php \r
11 \r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
14\r
15**/\r
16\r
17#include "FaultTolerantWriteSmmDxe.h"\r
18\r
19EFI_HANDLE mHandle = NULL;\r
20EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;\r
21UINTN mPrivateDataSize = 0;\r
22\r
23EFI_FAULT_TOLERANT_WRITE_PROTOCOL mFaultTolerantWriteDriver = {\r
24 FtwGetMaxBlockSize,\r
25 FtwAllocate,\r
26 FtwWrite,\r
27 FtwRestart,\r
28 FtwAbort,\r
29 FtwGetLastWrite\r
30};\r
31\r
32/**\r
33 Initialize the communicate buffer using DataSize and Function number.\r
34\r
35 @param[out] CommunicateBuffer The communicate buffer. Caller should free it after use.\r
36 @param[out] DataPtr Points to the data in the communicate buffer. Caller should not free it.\r
37 @param[in] DataSize The payload size.\r
38 @param[in] Function The function number used to initialize the communicate header.\r
39\r
40**/\r
41VOID\r
42InitCommunicateBuffer (\r
43 OUT VOID **CommunicateBuffer,\r
44 OUT VOID **DataPtr,\r
45 IN UINTN DataSize,\r
46 IN UINTN Function\r
47 )\r
48{\r
49 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; \r
50 SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader; \r
51\r
52 //\r
53 // The whole buffer size: SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE + DataSize.\r
54 //\r
55 SmmCommunicateHeader = AllocateZeroPool (DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE);\r
56 ASSERT (SmmCommunicateHeader != NULL);\r
57 \r
58 //\r
59 // Prepare data buffer.\r
60 //\r
61 CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmFaultTolerantWriteProtocolGuid);\r
62 SmmCommunicateHeader->MessageLength = DataSize + SMM_FTW_COMMUNICATE_HEADER_SIZE;\r
63 \r
64 SmmFtwFunctionHeader = (SMM_FTW_COMMUNICATE_FUNCTION_HEADER *) SmmCommunicateHeader->Data;\r
65 SmmFtwFunctionHeader->Function = Function;\r
66\r
67 *CommunicateBuffer = SmmCommunicateHeader;\r
68 if (DataPtr != NULL) {\r
69 *DataPtr = SmmFtwFunctionHeader->Data;\r
70 } \r
71}\r
72\r
73\r
74/**\r
75 Send the data in communicate buffer to SMI handler and get response.\r
76\r
77 @param[out] SmmCommunicateHeader The communicate buffer.\r
78 @param[in] DataSize The payload size.\r
79 \r
80**/\r
81EFI_STATUS\r
82SendCommunicateBuffer (\r
83 IN EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader,\r
84 IN UINTN DataSize\r
85 )\r
86{\r
87 EFI_STATUS Status;\r
88 UINTN CommSize;\r
89 SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader; \r
90 \r
91 CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE;\r
92 Status = mSmmCommunication->Communicate (mSmmCommunication, SmmCommunicateHeader, &CommSize);\r
93 ASSERT_EFI_ERROR (Status);\r
94\r
95 SmmFtwFunctionHeader = (SMM_FTW_COMMUNICATE_FUNCTION_HEADER *) SmmCommunicateHeader->Data;\r
96 return SmmFtwFunctionHeader->ReturnStatus;\r
97}\r
98\r
99\r
100/**\r
101 Get the FvbBaseAddress and FvbAttributes from the FVB handle FvbHandle.\r
102\r
103 @param[in] FvBlockHandle The handle of FVB protocol that provides services.\r
104 @param[in] FvbBaseAddress The base address of the FVB attached with FvBlockHandle.\r
105 @param[out] FvbAttributes The attributes of the FVB attached with FvBlockHandle.\r
106 \r
107 @retval EFI_SUCCESS The function completed successfully.\r
108 @retval Others The function could not complete successfully.\r
109\r
110**/\r
111EFI_STATUS\r
112ConvertFvbHandle (\r
113 IN EFI_HANDLE FvbHandle,\r
114 OUT EFI_PHYSICAL_ADDRESS *FvbBaseAddress,\r
115 OUT EFI_FVB_ATTRIBUTES_2 *FvbAttributes\r
116 )\r
117{\r
118 EFI_STATUS Status;\r
119 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;\r
120\r
121 Status = gBS->HandleProtocol (FvbHandle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **) &Fvb);\r
122 if (EFI_ERROR (Status)) {\r
123 return Status;\r
124 }\r
125 \r
126 Status = Fvb->GetPhysicalAddress (Fvb, FvbBaseAddress);\r
127 if (EFI_ERROR (Status)) {\r
128 return Status;\r
129 }\r
130\r
131 Status = Fvb->GetAttributes (Fvb, FvbAttributes);\r
132 return Status; \r
133}\r
134\r
135\r
136/**\r
137 Get the size of the largest block that can be updated in a fault-tolerant manner.\r
138\r
139 @param[in] This Indicates a pointer to the calling context.\r
140 @param[out] BlockSize A pointer to a caller-allocated UINTN that is\r
141 updated to indicate the size of the largest block\r
142 that can be updated.\r
143\r
144 @retval EFI_SUCCESS The function completed successfully.\r
145 @retval EFI_ABORTED The function could not complete successfully.\r
146\r
147**/\r
148EFI_STATUS\r
149EFIAPI\r
150FtwGetMaxBlockSize (\r
151 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r
152 OUT UINTN *BlockSize\r
153 )\r
154{\r
155 EFI_STATUS Status;\r
156 UINTN PayloadSize;\r
157 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; \r
158 SMM_FTW_GET_MAX_BLOCK_SIZE_HEADER *SmmFtwBlockSizeHeader;\r
159\r
160 //\r
161 // Initialize the communicate buffer.\r
162 //\r
163 PayloadSize = sizeof (SMM_FTW_GET_MAX_BLOCK_SIZE_HEADER);\r
164 InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwBlockSizeHeader, PayloadSize, FTW_FUNCTION_GET_MAX_BLOCK_SIZE);\r
165 \r
166 //\r
167 // Send data to SMM.\r
168 //\r
169 Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);\r
170\r
171 //\r
172 // Get data from SMM\r
173 //\r
174 *BlockSize = SmmFtwBlockSizeHeader->BlockSize; \r
175 FreePool (SmmCommunicateHeader);\r
176 \r
177 return Status;\r
178}\r
179\r
180\r
181/**\r
182 Allocates space for the protocol to maintain information about writes.\r
183 Since writes must be completed in a fault-tolerant manner and multiple\r
184 writes require more resources to be successful, this function\r
185 enables the protocol to ensure that enough space exists to track\r
186 information about upcoming writes.\r
187\r
188 @param[in] This A pointer to the calling context.\r
189 @param[in] CallerId The GUID identifying the write.\r
190 @param[in] PrivateDataSize The size of the caller's private data that must be\r
191 recorded for each write.\r
192 @param[in] NumberOfWrites The number of fault tolerant block writes that will\r
193 need to occur.\r
194\r
195 @retval EFI_SUCCESS The function completed successfully\r
196 @retval EFI_ABORTED The function could not complete successfully.\r
197 @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All\r
198 writes must be completed or aborted before another\r
199 fault tolerant write can occur.\r
200\r
201**/\r
202EFI_STATUS\r
203EFIAPI\r
204FtwAllocate (\r
205 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r
206 IN EFI_GUID *CallerId,\r
207 IN UINTN PrivateDataSize,\r
208 IN UINTN NumberOfWrites\r
209 )\r
210{\r
211 EFI_STATUS Status;\r
212 UINTN PayloadSize;\r
213 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; \r
214 SMM_FTW_ALLOCATE_HEADER *SmmFtwAllocateHeader;\r
215\r
216 //\r
217 // Initialize the communicate buffer.\r
218 //\r
219 PayloadSize = sizeof (SMM_FTW_ALLOCATE_HEADER);\r
220 InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwAllocateHeader, PayloadSize, FTW_FUNCTION_ALLOCATE);\r
221 CopyGuid (&SmmFtwAllocateHeader->CallerId, CallerId);\r
222 SmmFtwAllocateHeader->PrivateDataSize = PrivateDataSize;\r
223 SmmFtwAllocateHeader->NumberOfWrites = NumberOfWrites; \r
224 \r
225 //\r
226 // Send data to SMM.\r
227 //\r
228 Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);\r
229 if (!EFI_ERROR( Status)) {\r
230 mPrivateDataSize = PrivateDataSize;\r
231 }\r
232\r
233 FreePool (SmmCommunicateHeader);\r
234 return Status;\r
235}\r
236\r
237\r
238/**\r
239 Starts a target block update. This records information about the write\r
240 in fault tolerant storage, and will complete the write in a recoverable\r
241 manner, ensuring at all times that either the original contents or\r
242 the modified contents are available.\r
243\r
244 @param[in] This The calling context.\r
245 @param[in] Lba The logical block address of the target block.\r
246 @param[in] Offset The offset within the target block to place the\r
247 data.\r
248 @param[in] Length The number of bytes to write to the target block.\r
249 @param[in] PrivateData A pointer to private data that the caller requires\r
250 to complete any pending writes in the event of a\r
251 fault.\r
252 @param[in] FvBlockHandle The handle of FVB protocol that provides services\r
253 for reading, writing, and erasing the target block.\r
254 @param[in] Buffer The data to write.\r
255\r
256 @retval EFI_SUCCESS The function completed successfully.\r
257 @retval EFI_ABORTED The function could not complete successfully.\r
258 @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not\r
259 a valid action.\r
260 @retval EFI_ACCESS_DENIED No writes have been allocated.\r
261 @retval EFI_NOT_READY The last write has not been completed. Restart()\r
262 must be called to complete it.\r
263\r
264**/\r
265EFI_STATUS\r
266EFIAPI\r
267FtwWrite (\r
268 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r
269 IN EFI_LBA Lba,\r
270 IN UINTN Offset,\r
271 IN UINTN Length,\r
272 IN VOID *PrivateData,\r
273 IN EFI_HANDLE FvBlockHandle,\r
274 IN VOID *Buffer\r
275 )\r
276{\r
277 EFI_STATUS Status;\r
278 UINTN PayloadSize;\r
279 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; \r
280 SMM_FTW_WRITE_HEADER *SmmFtwWriteHeader;\r
281\r
282 //\r
283 // Initialize the communicate buffer.\r
284 //\r
285 PayloadSize = OFFSET_OF (SMM_FTW_WRITE_HEADER, Data) + Length;\r
286 if (PrivateData != NULL) {\r
287 //\r
288 // The private data buffer size should be the same one in FtwAllocate API.\r
289 //\r
290 PayloadSize += mPrivateDataSize;\r
291 }\r
292 InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwWriteHeader, PayloadSize, FTW_FUNCTION_WRITE);\r
293\r
294 //\r
295 // FvBlockHandle can not be used in SMM environment. Here we get the FVB protocol first, then get FVB base address \r
296 // and its attribute. Send these information to SMM handler, the SMM handler will find the proper FVB to write data.\r
297 //\r
298 Status = ConvertFvbHandle (FvBlockHandle, &SmmFtwWriteHeader->FvbBaseAddress, &SmmFtwWriteHeader->FvbAttributes);\r
299 if (EFI_ERROR (Status)) {\r
300 FreePool (SmmCommunicateHeader);\r
301 return EFI_ABORTED;\r
302 }\r
303 \r
304 SmmFtwWriteHeader->Lba = Lba;\r
305 SmmFtwWriteHeader->Offset = Offset; \r
306 SmmFtwWriteHeader->Length = Length;\r
307 CopyMem (SmmFtwWriteHeader->Data, Buffer, Length);\r
308 if (PrivateData == NULL) {\r
309 SmmFtwWriteHeader->PrivateDataSize = 0;\r
310 } else {\r
311 SmmFtwWriteHeader->PrivateDataSize = mPrivateDataSize;\r
312 CopyMem (&SmmFtwWriteHeader->Data[Length], PrivateData, mPrivateDataSize);\r
313 }\r
314\r
315 //\r
316 // Send data to SMM.\r
317 //\r
318 Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);\r
319 FreePool (SmmCommunicateHeader); \r
320 return Status;\r
321}\r
322\r
323\r
324/**\r
325 Restarts a previously interrupted write. The caller must provide the\r
326 block protocol needed to complete the interrupted write.\r
327\r
328 @param[in] This The calling context.\r
329 @param[in] FvBlockHandle The handle of FVB protocol that provides services.\r
330\r
331 @retval EFI_SUCCESS The function completed successfully.\r
332 @retval EFI_ABORTED The function could not complete successfully.\r
333 @retval EFI_ACCESS_DENIED No pending writes exist.\r
334\r
335**/\r
336EFI_STATUS\r
337EFIAPI\r
338FtwRestart (\r
339 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r
340 IN EFI_HANDLE FvBlockHandle\r
341 )\r
342{\r
343 EFI_STATUS Status;\r
344 UINTN PayloadSize;\r
345 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; \r
346 SMM_FTW_RESTART_HEADER *SmmFtwRestartHeader;\r
347 \r
348 //\r
349 // Initialize the communicate buffer.\r
350 //\r
351 PayloadSize = sizeof (SMM_FTW_RESTART_HEADER);\r
352 InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwRestartHeader, PayloadSize, FTW_FUNCTION_RESTART); \r
353\r
354 //\r
355 // FvBlockHandle can not be used in SMM environment. Here we get the FVB protocol first, then get FVB base address \r
356 // and its attribute. Send these information to SMM handler, the SMM handler will find the proper FVB to write data.\r
357 //\r
358 Status = ConvertFvbHandle (FvBlockHandle, &SmmFtwRestartHeader->FvbBaseAddress, &SmmFtwRestartHeader->FvbAttributes);\r
359 if (EFI_ERROR (Status)) {\r
360 FreePool (SmmCommunicateHeader); \r
361 return EFI_ABORTED;\r
362 }\r
363\r
364 //\r
365 // Send data to SMM.\r
366 //\r
367 Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);\r
368 FreePool (SmmCommunicateHeader); \r
369 return Status;\r
370}\r
371\r
372\r
373/**\r
374 Aborts all previously allocated writes.\r
375\r
376 @param[in] This The calling context.\r
377\r
378 @retval EFI_SUCCESS The function completed successfully.\r
379 @retval EFI_ABORTED The function could not complete successfully.\r
380 @retval EFI_NOT_FOUND No allocated writes exist.\r
381\r
382**/\r
383EFI_STATUS\r
384EFIAPI\r
385FtwAbort (\r
386 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This\r
387 )\r
388{\r
389 EFI_STATUS Status;\r
390 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; \r
391 \r
392 //\r
393 // Initialize the communicate buffer.\r
394 //\r
395 InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, NULL, 0, FTW_FUNCTION_ABORT);\r
396 \r
397 //\r
398 // Send data to SMM.\r
399 //\r
400 Status = SendCommunicateBuffer (SmmCommunicateHeader, 0);\r
401\r
402 FreePool (SmmCommunicateHeader); \r
403 return Status;\r
404}\r
405\r
406\r
407/**\r
408 Starts a target block update. This function records information about the write\r
409 in fault-tolerant storage and completes the write in a recoverable\r
410 manner, ensuring at all times that either the original contents or\r
411 the modified contents are available.\r
412\r
413 @param[in] This Indicates a pointer to the calling context.\r
414 @param[out] CallerId The GUID identifying the last write.\r
415 @param[out] Lba The logical block address of the last write.\r
416 @param[out] Offset The offset within the block of the last write.\r
417 @param[out] Length The length of the last write.\r
418 @param[in, out] PrivateDataSize On input, the size of the PrivateData buffer. On\r
419 output, the size of the private data stored for\r
420 this write.\r
421 @param[out] PrivateData A pointer to a buffer. The function will copy\r
422 PrivateDataSize bytes from the private data stored\r
423 for this write.\r
424 @param[out] Complete A Boolean value with TRUE indicating that the write\r
425 was completed.\r
426\r
427 @retval EFI_SUCCESS The function completed successfully.\r
428 @retval EFI_ABORTED The function could not complete successfully.\r
429 @retval EFI_NOT_FOUND No allocated writes exist.\r
430\r
431**/\r
432EFI_STATUS\r
433EFIAPI\r
434FtwGetLastWrite (\r
435 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r
436 OUT EFI_GUID *CallerId,\r
437 OUT EFI_LBA *Lba,\r
438 OUT UINTN *Offset,\r
439 OUT UINTN *Length,\r
440 IN OUT UINTN *PrivateDataSize,\r
441 OUT VOID *PrivateData,\r
442 OUT BOOLEAN *Complete\r
443 )\r
444{\r
445 EFI_STATUS Status;\r
446 UINTN PayloadSize;\r
447 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; \r
448 SMM_FTW_GET_LAST_WRITE_HEADER *SmmFtwGetLastWriteHeader;\r
449\r
450 //\r
451 // Initialize the communicate buffer.\r
452 //\r
453 PayloadSize = OFFSET_OF (SMM_FTW_GET_LAST_WRITE_HEADER, Data) + *PrivateDataSize;\r
454 InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwGetLastWriteHeader, PayloadSize, FTW_FUNCTION_GET_LAST_WRITE);\r
455 SmmFtwGetLastWriteHeader->PrivateDataSize = *PrivateDataSize;\r
456\r
457 //\r
458 // Send data to SMM.\r
459 //\r
460 Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);\r
461\r
462 //\r
463 // Get data from SMM\r
464 //\r
465 *PrivateDataSize = SmmFtwGetLastWriteHeader->PrivateDataSize;\r
466 if (!EFI_ERROR (Status)) {\r
467 *Lba = SmmFtwGetLastWriteHeader->Lba;\r
468 *Offset = SmmFtwGetLastWriteHeader->Offset; \r
469 *Length = SmmFtwGetLastWriteHeader->Length;\r
470 *Complete = SmmFtwGetLastWriteHeader->Complete;\r
471 CopyGuid (CallerId, &SmmFtwGetLastWriteHeader->CallerId);\r
472 CopyMem (PrivateData, SmmFtwGetLastWriteHeader->Data, *PrivateDataSize);\r
473 }\r
474\r
475 FreePool (SmmCommunicateHeader); \r
476 return Status;\r
477}\r
478\r
479/**\r
480 SMM Fault Tolerant Write Protocol notification event handler.\r
481\r
482 Install Fault Tolerant Write Protocol.\r
483\r
484 @param[in] Event Event whose notification function is being invoked.\r
485 @param[in] Context Pointer to the notification function's context.\r
486**/\r
487VOID\r
488EFIAPI\r
489SmmFtwReady (\r
490 IN EFI_EVENT Event,\r
491 IN VOID *Context\r
492 )\r
493{\r
494 EFI_STATUS Status;\r
495 EFI_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;\r
496\r
497 //\r
498 // Just return to avoid install SMM FaultTolerantWriteProtocol again\r
499 // if Fault Tolerant Write protocol had been installed.\r
500 // \r
501 Status = gBS->LocateProtocol (&gEfiFaultTolerantWriteProtocolGuid, NULL, (VOID **)&FtwProtocol);\r
502 if (!EFI_ERROR (Status)) {\r
503 return;\r
504 }\r
505 \r
506 Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);\r
507 ASSERT_EFI_ERROR (Status);\r
508\r
509 //\r
510 // Install protocol interface\r
511 //\r
512 Status = gBS->InstallProtocolInterface (\r
513 &mHandle,\r
514 &gEfiFaultTolerantWriteProtocolGuid,\r
515 EFI_NATIVE_INTERFACE,\r
516 &mFaultTolerantWriteDriver\r
517 );\r
518 ASSERT_EFI_ERROR (Status);\r
519 \r
520 Status = gBS->CloseEvent (Event);\r
521 ASSERT_EFI_ERROR (Status); \r
522}\r
523\r
524\r
525/**\r
526 The driver entry point for Fault Tolerant Write driver.\r
527\r
528 The function does the necessary initialization work.\r
529\r
530 @param[in] ImageHandle The firmware allocated handle for the UEFI image.\r
531 @param[in] SystemTable A pointer to the EFI system table.\r
532\r
533 @retval EFI_SUCCESS This funtion always return EFI_SUCCESS.\r
534\r
535**/\r
536EFI_STATUS\r
537EFIAPI\r
538FaultTolerantWriteSmmInitialize (\r
539 IN EFI_HANDLE ImageHandle,\r
540 IN EFI_SYSTEM_TABLE *SystemTable\r
541 )\r
542{\r
543 VOID *SmmFtwRegistration;\r
544\r
545 //\r
546 // Smm FTW driver is ready\r
547 //\r
548 EfiCreateProtocolNotifyEvent (\r
549 &gEfiSmmFaultTolerantWriteProtocolGuid,\r
550 TPL_CALLBACK, \r
551 SmmFtwReady, \r
552 NULL, \r
553 &SmmFtwRegistration\r
554 );\r
555 \r
556 return EFI_SUCCESS;\r
557}\r
558\r