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