]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Library / SmmLockBoxLib / SmmLockBoxDxeLib.c
1 /** @file
2
3 Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <PiDxe.h>
10 #include <Library/UefiBootServicesTableLib.h>
11 #include <Library/UefiRuntimeServicesTableLib.h>
12 #include <Library/BaseLib.h>
13 #include <Library/BaseMemoryLib.h>
14 #include <Library/LockBoxLib.h>
15 #include <Library/DebugLib.h>
16 #include <Library/UefiLib.h>
17 #include <Protocol/SmmCommunication.h>
18 #include <Guid/SmmLockBox.h>
19 #include <Guid/PiSmmCommunicationRegionTable.h>
20
21 #include "SmmLockBoxLibPrivate.h"
22
23 EFI_SMM_COMMUNICATION_PROTOCOL *mLockBoxSmmCommProtocol = NULL;
24 UINT8 *mLockBoxSmmCommBuffer = NULL;
25
26 /**
27 Get smm communication protocol for lockbox.
28
29 @return Pointer to smm communication protocol, NULL if not found.
30
31 **/
32 EFI_SMM_COMMUNICATION_PROTOCOL *
33 LockBoxGetSmmCommProtocol (
34 VOID
35 )
36 {
37 EFI_STATUS Status;
38
39 //
40 // If the protocol has been got previously, return it.
41 //
42 if (mLockBoxSmmCommProtocol != NULL) {
43 return mLockBoxSmmCommProtocol;
44 }
45
46 Status = gBS->LocateProtocol (
47 &gEfiSmmCommunicationProtocolGuid,
48 NULL,
49 (VOID **)&mLockBoxSmmCommProtocol
50 );
51 if (EFI_ERROR (Status)) {
52 mLockBoxSmmCommProtocol = NULL;
53 }
54
55 return mLockBoxSmmCommProtocol;
56 }
57
58 /**
59 Get smm communication buffer for lockbox.
60
61 @return Pointer to smm communication buffer, NULL if not found.
62
63 **/
64 UINT8 *
65 LockBoxGetSmmCommBuffer (
66 VOID
67 )
68 {
69 EFI_STATUS Status;
70 UINTN MinimalSizeNeeded;
71 EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
72 UINT32 Index;
73 EFI_MEMORY_DESCRIPTOR *Entry;
74 UINTN Size;
75
76 //
77 // If the buffer has been got previously, return it.
78 //
79 if (mLockBoxSmmCommBuffer != NULL) {
80 return mLockBoxSmmCommBuffer;
81 }
82
83 MinimalSizeNeeded = sizeof (EFI_GUID) +
84 sizeof (UINTN) +
85 MAX (
86 sizeof (EFI_SMM_LOCK_BOX_PARAMETER_SAVE),
87 MAX (
88 sizeof (EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES),
89 MAX (
90 sizeof (EFI_SMM_LOCK_BOX_PARAMETER_UPDATE),
91 MAX (
92 sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE),
93 sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE)
94 )
95 )
96 )
97 );
98
99 Status = EfiGetSystemConfigurationTable (
100 &gEdkiiPiSmmCommunicationRegionTableGuid,
101 (VOID **)&PiSmmCommunicationRegionTable
102 );
103 if (EFI_ERROR (Status)) {
104 mLockBoxSmmCommBuffer = NULL;
105 return mLockBoxSmmCommBuffer;
106 }
107
108 ASSERT (PiSmmCommunicationRegionTable != NULL);
109 Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1);
110 Size = 0;
111 for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) {
112 if (Entry->Type == EfiConventionalMemory) {
113 Size = EFI_PAGES_TO_SIZE ((UINTN)Entry->NumberOfPages);
114 if (Size >= MinimalSizeNeeded) {
115 break;
116 }
117 }
118
119 Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize);
120 }
121
122 if (Index >= PiSmmCommunicationRegionTable->NumberOfEntries) {
123 mLockBoxSmmCommBuffer = NULL;
124 } else {
125 mLockBoxSmmCommBuffer = (UINT8 *)(UINTN)Entry->PhysicalStart;
126 }
127
128 return mLockBoxSmmCommBuffer;
129 }
130
131 /**
132 This function will save confidential information to lockbox.
133
134 @param Guid the guid to identify the confidential information
135 @param Buffer the address of the confidential information
136 @param Length the length of the confidential information
137
138 @retval RETURN_SUCCESS the information is saved successfully.
139 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0
140 @retval RETURN_ALREADY_STARTED the requested GUID already exist.
141 @retval RETURN_OUT_OF_RESOURCES no enough resource to save the information.
142 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
143 @retval RETURN_NOT_STARTED it is too early to invoke this interface
144 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
145 **/
146 RETURN_STATUS
147 EFIAPI
148 SaveLockBox (
149 IN GUID *Guid,
150 IN VOID *Buffer,
151 IN UINTN Length
152 )
153 {
154 EFI_STATUS Status;
155 EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
156 EFI_SMM_LOCK_BOX_PARAMETER_SAVE *LockBoxParameterSave;
157 EFI_SMM_COMMUNICATE_HEADER *CommHeader;
158 UINT8 TempCommBuffer[sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_SAVE)];
159 UINT8 *CommBuffer;
160 UINTN CommSize;
161
162 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib SaveLockBox - Enter\n"));
163
164 //
165 // Basic check
166 //
167 if ((Guid == NULL) || (Buffer == NULL) || (Length == 0)) {
168 return EFI_INVALID_PARAMETER;
169 }
170
171 SmmCommunication = LockBoxGetSmmCommProtocol ();
172 if (SmmCommunication == NULL) {
173 return EFI_NOT_STARTED;
174 }
175
176 //
177 // Prepare parameter
178 //
179 CommBuffer = LockBoxGetSmmCommBuffer ();
180 if (CommBuffer == NULL) {
181 CommBuffer = &TempCommBuffer[0];
182 }
183
184 CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
185 CopyMem (&CommHeader->HeaderGuid, &gEfiSmmLockBoxCommunicationGuid, sizeof (gEfiSmmLockBoxCommunicationGuid));
186 CommHeader->MessageLength = sizeof (*LockBoxParameterSave);
187
188 LockBoxParameterSave = (EFI_SMM_LOCK_BOX_PARAMETER_SAVE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
189 LockBoxParameterSave->Header.Command = EFI_SMM_LOCK_BOX_COMMAND_SAVE;
190 LockBoxParameterSave->Header.DataLength = sizeof (*LockBoxParameterSave);
191 LockBoxParameterSave->Header.ReturnStatus = (UINT64)-1;
192 CopyMem (&LockBoxParameterSave->Guid, Guid, sizeof (*Guid));
193 LockBoxParameterSave->Buffer = (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer;
194 LockBoxParameterSave->Length = (UINT64)Length;
195
196 //
197 // Send command
198 //
199 CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_SAVE);
200 Status = SmmCommunication->Communicate (
201 SmmCommunication,
202 &CommBuffer[0],
203 &CommSize
204 );
205 ASSERT_EFI_ERROR (Status);
206
207 Status = (EFI_STATUS)LockBoxParameterSave->Header.ReturnStatus;
208
209 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib SaveLockBox - Exit (%r)\n", Status));
210
211 //
212 // Done
213 //
214 return Status;
215 }
216
217 /**
218 This function will set lockbox attributes.
219
220 @param Guid the guid to identify the confidential information
221 @param Attributes the attributes of the lockbox
222
223 @retval RETURN_SUCCESS the information is saved successfully.
224 @retval RETURN_INVALID_PARAMETER attributes is invalid.
225 @retval RETURN_NOT_FOUND the requested GUID not found.
226 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
227 @retval RETURN_NOT_STARTED it is too early to invoke this interface
228 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
229 **/
230 RETURN_STATUS
231 EFIAPI
232 SetLockBoxAttributes (
233 IN GUID *Guid,
234 IN UINT64 Attributes
235 )
236 {
237 EFI_STATUS Status;
238 EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
239 EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES *LockBoxParameterSetAttributes;
240 EFI_SMM_COMMUNICATE_HEADER *CommHeader;
241 UINT8 TempCommBuffer[sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES)];
242 UINT8 *CommBuffer;
243 UINTN CommSize;
244
245 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib SetLockBoxAttributes - Enter\n"));
246
247 //
248 // Basic check
249 //
250 if ((Guid == NULL) ||
251 ((Attributes & ~(LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE | LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY)) != 0))
252 {
253 return EFI_INVALID_PARAMETER;
254 }
255
256 SmmCommunication = LockBoxGetSmmCommProtocol ();
257 if (SmmCommunication == NULL) {
258 return EFI_NOT_STARTED;
259 }
260
261 //
262 // Prepare parameter
263 //
264 CommBuffer = LockBoxGetSmmCommBuffer ();
265 if (CommBuffer == NULL) {
266 CommBuffer = &TempCommBuffer[0];
267 }
268
269 CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
270 CopyMem (&CommHeader->HeaderGuid, &gEfiSmmLockBoxCommunicationGuid, sizeof (gEfiSmmLockBoxCommunicationGuid));
271 CommHeader->MessageLength = sizeof (*LockBoxParameterSetAttributes);
272
273 LockBoxParameterSetAttributes = (EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
274 LockBoxParameterSetAttributes->Header.Command = EFI_SMM_LOCK_BOX_COMMAND_SET_ATTRIBUTES;
275 LockBoxParameterSetAttributes->Header.DataLength = sizeof (*LockBoxParameterSetAttributes);
276 LockBoxParameterSetAttributes->Header.ReturnStatus = (UINT64)-1;
277 CopyMem (&LockBoxParameterSetAttributes->Guid, Guid, sizeof (*Guid));
278 LockBoxParameterSetAttributes->Attributes = (UINT64)Attributes;
279
280 //
281 // Send command
282 //
283 CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES);
284 Status = SmmCommunication->Communicate (
285 SmmCommunication,
286 &CommBuffer[0],
287 &CommSize
288 );
289 ASSERT_EFI_ERROR (Status);
290
291 Status = (EFI_STATUS)LockBoxParameterSetAttributes->Header.ReturnStatus;
292
293 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib SetLockBoxAttributes - Exit (%r)\n", Status));
294
295 //
296 // Done
297 //
298 return Status;
299 }
300
301 /**
302 This function will update confidential information to lockbox.
303
304 @param Guid the guid to identify the original confidential information
305 @param Offset the offset of the original confidential information
306 @param Buffer the address of the updated confidential information
307 @param Length the length of the updated confidential information
308
309 @retval RETURN_SUCCESS the information is saved successfully.
310 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0.
311 @retval RETURN_NOT_FOUND the requested GUID not found.
312 @retval RETURN_BUFFER_TOO_SMALL for lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,
313 the original buffer to too small to hold new information.
314 @retval RETURN_OUT_OF_RESOURCES for lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,
315 no enough resource to save the information.
316 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
317 @retval RETURN_NOT_STARTED it is too early to invoke this interface
318 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
319 **/
320 RETURN_STATUS
321 EFIAPI
322 UpdateLockBox (
323 IN GUID *Guid,
324 IN UINTN Offset,
325 IN VOID *Buffer,
326 IN UINTN Length
327 )
328 {
329 EFI_STATUS Status;
330 EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
331 EFI_SMM_LOCK_BOX_PARAMETER_UPDATE *LockBoxParameterUpdate;
332 EFI_SMM_COMMUNICATE_HEADER *CommHeader;
333 UINT8 TempCommBuffer[sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_UPDATE)];
334 UINT8 *CommBuffer;
335 UINTN CommSize;
336
337 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib UpdateLockBox - Enter\n"));
338
339 //
340 // Basic check
341 //
342 if ((Guid == NULL) || (Buffer == NULL) || (Length == 0)) {
343 return EFI_INVALID_PARAMETER;
344 }
345
346 SmmCommunication = LockBoxGetSmmCommProtocol ();
347 if (SmmCommunication == NULL) {
348 return EFI_NOT_STARTED;
349 }
350
351 //
352 // Prepare parameter
353 //
354 CommBuffer = LockBoxGetSmmCommBuffer ();
355 if (CommBuffer == NULL) {
356 CommBuffer = &TempCommBuffer[0];
357 }
358
359 CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
360 CopyMem (&CommHeader->HeaderGuid, &gEfiSmmLockBoxCommunicationGuid, sizeof (gEfiSmmLockBoxCommunicationGuid));
361 CommHeader->MessageLength = sizeof (*LockBoxParameterUpdate);
362
363 LockBoxParameterUpdate = (EFI_SMM_LOCK_BOX_PARAMETER_UPDATE *)(UINTN)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
364 LockBoxParameterUpdate->Header.Command = EFI_SMM_LOCK_BOX_COMMAND_UPDATE;
365 LockBoxParameterUpdate->Header.DataLength = sizeof (*LockBoxParameterUpdate);
366 LockBoxParameterUpdate->Header.ReturnStatus = (UINT64)-1;
367 CopyMem (&LockBoxParameterUpdate->Guid, Guid, sizeof (*Guid));
368 LockBoxParameterUpdate->Offset = (UINT64)Offset;
369 LockBoxParameterUpdate->Buffer = (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer;
370 LockBoxParameterUpdate->Length = (UINT64)Length;
371
372 //
373 // Send command
374 //
375 CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_UPDATE);
376 Status = SmmCommunication->Communicate (
377 SmmCommunication,
378 &CommBuffer[0],
379 &CommSize
380 );
381 ASSERT_EFI_ERROR (Status);
382
383 Status = (EFI_STATUS)LockBoxParameterUpdate->Header.ReturnStatus;
384
385 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib UpdateLockBox - Exit (%r)\n", Status));
386
387 //
388 // Done
389 //
390 return Status;
391 }
392
393 /**
394 This function will restore confidential information from lockbox.
395
396 @param Guid the guid to identify the confidential information
397 @param Buffer the address of the restored confidential information
398 NULL means restored to original address, Length MUST be NULL at same time.
399 @param Length the length of the restored confidential information
400
401 @retval RETURN_SUCCESS the information is restored successfully.
402 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or one of Buffer and Length is NULL.
403 @retval RETURN_WRITE_PROTECTED Buffer and Length are NULL, but the LockBox has no
404 LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.
405 @retval RETURN_BUFFER_TOO_SMALL the Length is too small to hold the confidential information.
406 @retval RETURN_NOT_FOUND the requested GUID not found.
407 @retval RETURN_NOT_STARTED it is too early to invoke this interface
408 @retval RETURN_ACCESS_DENIED not allow to restore to the address
409 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
410 **/
411 RETURN_STATUS
412 EFIAPI
413 RestoreLockBox (
414 IN GUID *Guid,
415 IN VOID *Buffer OPTIONAL,
416 IN OUT UINTN *Length OPTIONAL
417 )
418 {
419 EFI_STATUS Status;
420 EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
421 EFI_SMM_LOCK_BOX_PARAMETER_RESTORE *LockBoxParameterRestore;
422 EFI_SMM_COMMUNICATE_HEADER *CommHeader;
423 UINT8 TempCommBuffer[sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE)];
424 UINT8 *CommBuffer;
425 UINTN CommSize;
426
427 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib RestoreLockBox - Enter\n"));
428
429 //
430 // Basic check
431 //
432 if ((Guid == NULL) ||
433 ((Buffer == NULL) && (Length != NULL)) ||
434 ((Buffer != NULL) && (Length == NULL)))
435 {
436 return EFI_INVALID_PARAMETER;
437 }
438
439 SmmCommunication = LockBoxGetSmmCommProtocol ();
440 if (SmmCommunication == NULL) {
441 return EFI_NOT_STARTED;
442 }
443
444 //
445 // Prepare parameter
446 //
447 CommBuffer = LockBoxGetSmmCommBuffer ();
448 if (CommBuffer == NULL) {
449 CommBuffer = &TempCommBuffer[0];
450 }
451
452 CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
453 CopyMem (&CommHeader->HeaderGuid, &gEfiSmmLockBoxCommunicationGuid, sizeof (gEfiSmmLockBoxCommunicationGuid));
454 CommHeader->MessageLength = sizeof (*LockBoxParameterRestore);
455
456 LockBoxParameterRestore = (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
457 LockBoxParameterRestore->Header.Command = EFI_SMM_LOCK_BOX_COMMAND_RESTORE;
458 LockBoxParameterRestore->Header.DataLength = sizeof (*LockBoxParameterRestore);
459 LockBoxParameterRestore->Header.ReturnStatus = (UINT64)-1;
460 CopyMem (&LockBoxParameterRestore->Guid, Guid, sizeof (*Guid));
461 LockBoxParameterRestore->Buffer = (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer;
462 if (Length != NULL) {
463 LockBoxParameterRestore->Length = (EFI_PHYSICAL_ADDRESS)*Length;
464 } else {
465 LockBoxParameterRestore->Length = 0;
466 }
467
468 //
469 // Send command
470 //
471 CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE);
472 Status = SmmCommunication->Communicate (
473 SmmCommunication,
474 &CommBuffer[0],
475 &CommSize
476 );
477 ASSERT_EFI_ERROR (Status);
478
479 if (Length != NULL) {
480 *Length = (UINTN)LockBoxParameterRestore->Length;
481 }
482
483 Status = (EFI_STATUS)LockBoxParameterRestore->Header.ReturnStatus;
484
485 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib RestoreLockBox - Exit (%r)\n", Status));
486
487 //
488 // Done
489 //
490 return Status;
491 }
492
493 /**
494 This function will restore confidential information from all lockbox which have RestoreInPlace attribute.
495
496 @retval RETURN_SUCCESS the information is restored successfully.
497 @retval RETURN_NOT_STARTED it is too early to invoke this interface
498 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
499 **/
500 RETURN_STATUS
501 EFIAPI
502 RestoreAllLockBoxInPlace (
503 VOID
504 )
505 {
506 EFI_STATUS Status;
507 EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
508 EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE *LockBoxParameterRestoreAllInPlace;
509 EFI_SMM_COMMUNICATE_HEADER *CommHeader;
510 UINT8 TempCommBuffer[sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE)];
511 UINT8 *CommBuffer;
512 UINTN CommSize;
513
514 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib RestoreAllLockBoxInPlace - Enter\n"));
515
516 SmmCommunication = LockBoxGetSmmCommProtocol ();
517 if (SmmCommunication == NULL) {
518 return EFI_NOT_STARTED;
519 }
520
521 //
522 // Prepare parameter
523 //
524 CommBuffer = LockBoxGetSmmCommBuffer ();
525 if (CommBuffer == NULL) {
526 CommBuffer = &TempCommBuffer[0];
527 }
528
529 CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
530 CopyMem (&CommHeader->HeaderGuid, &gEfiSmmLockBoxCommunicationGuid, sizeof (gEfiSmmLockBoxCommunicationGuid));
531 CommHeader->MessageLength = sizeof (*LockBoxParameterRestoreAllInPlace);
532
533 LockBoxParameterRestoreAllInPlace = (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
534 LockBoxParameterRestoreAllInPlace->Header.Command = EFI_SMM_LOCK_BOX_COMMAND_RESTORE_ALL_IN_PLACE;
535 LockBoxParameterRestoreAllInPlace->Header.DataLength = sizeof (*LockBoxParameterRestoreAllInPlace);
536 LockBoxParameterRestoreAllInPlace->Header.ReturnStatus = (UINT64)-1;
537
538 //
539 // Send command
540 //
541 CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE);
542 Status = SmmCommunication->Communicate (
543 SmmCommunication,
544 &CommBuffer[0],
545 &CommSize
546 );
547 ASSERT_EFI_ERROR (Status);
548
549 Status = (EFI_STATUS)LockBoxParameterRestoreAllInPlace->Header.ReturnStatus;
550
551 DEBUG ((DEBUG_INFO, "SmmLockBoxDxeLib RestoreAllLockBoxInPlace - Exit (%r)\n", Status));
552
553 //
554 // Done
555 //
556 return Status;
557 }