TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmLockBoxPeiLib.c
Go to the documentation of this file.
1
9#include <PiPei.h>
10#include <PiDxe.h>
11#include <PiSmm.h>
14#include <Library/BaseLib.h>
16#include <Library/LockBoxLib.h>
17#include <Library/HobLib.h>
18#include <Library/DebugLib.h>
19#include <Library/PcdLib.h>
22#include <Ppi/SmmAccess.h>
23#include <Guid/AcpiS3Context.h>
24#include <Guid/SmmLockBox.h>
25
27
28#if defined (MDE_CPU_IA32)
29typedef struct _LIST_ENTRY64 LIST_ENTRY64;
30struct _LIST_ENTRY64 {
31 LIST_ENTRY64 *ForwardLink;
32 UINT32 Reserved1;
33 LIST_ENTRY64 *BackLink;
34 UINT32 Reserved2;
35};
36
37typedef struct {
39 UINT64 SmmFirmwareVendor;
40 UINT64 SmmFirmwareRevision;
42 UINT64 SmmIoMemRead;
43 UINT64 SmmIoMemWrite;
44 UINT64 SmmIoIoRead;
45 UINT64 SmmIoIoWrite;
46 UINT64 SmmAllocatePool;
47 UINT64 SmmFreePool;
48 UINT64 SmmAllocatePages;
49 UINT64 SmmFreePages;
50 UINT64 SmmStartupThisAp;
51 UINT64 CurrentlyExecutingCpu;
52 UINT64 NumberOfCpus;
53 UINT64 CpuSaveStateSize;
54 UINT64 CpuSaveState;
55 UINT64 NumberOfTableEntries;
56 UINT64 SmmConfigurationTable;
57} EFI_SMM_SYSTEM_TABLE2_64;
58
59typedef struct {
60 EFI_GUID VendorGuid;
61 UINT64 VendorTable;
62} EFI_CONFIGURATION_TABLE64;
63#endif
64
65#if defined (MDE_CPU_X64)
66typedef LIST_ENTRY LIST_ENTRY64;
67typedef EFI_SMM_SYSTEM_TABLE2 EFI_SMM_SYSTEM_TABLE2_64;
68typedef EFI_CONFIGURATION_TABLE EFI_CONFIGURATION_TABLE64;
69#endif
70
80 IN LIST_ENTRY *LinkList
81 )
82{
83 if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
84 //
85 // 32 PEI + 64 DXE
86 //
87 return (LIST_ENTRY *)(((LIST_ENTRY64 *)LinkList)->ForwardLink);
88 } else {
89 return LinkList->ForwardLink;
90 }
91}
92
102 IN LIST_ENTRY *Link
103 )
104{
105 if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
106 //
107 // 32 PEI + 64 DXE
108 //
109 return (LIST_ENTRY *)(((LIST_ENTRY64 *)Link)->ForwardLink);
110 } else {
111 return Link->ForwardLink;
112 }
113}
114
125 IN LIST_ENTRY *LockBoxQueue,
126 IN EFI_GUID *Guid
127 )
128{
129 LIST_ENTRY *Link;
130 SMM_LOCK_BOX_DATA *LockBox;
131
132 for (Link = InternalInitLinkDxe (LockBoxQueue);
133 Link != LockBoxQueue;
134 Link = InternalNextLinkDxe (Link))
135 {
136 LockBox = BASE_CR (
137 Link,
139 Link
140 );
141 if (CompareGuid (&LockBox->Guid, Guid)) {
142 return LockBox;
143 }
144 }
145
146 return NULL;
147}
148
158VOID *
160 IN UINT64 Signature,
162 IN EFI_GUID *VendorGuid
163 )
164{
165 EFI_CONFIGURATION_TABLE *SmmConfigurationTable;
166 UINTN NumberOfTableEntries;
167 UINTN Index;
168 EFI_SMM_SYSTEM_TABLE2_64 *Smst64;
169 EFI_CONFIGURATION_TABLE64 *SmmConfigurationTable64;
170
171 if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
172 //
173 // 32 PEI + 64 DXE
174 //
175 Smst64 = (EFI_SMM_SYSTEM_TABLE2_64 *)Smst;
176 SmmConfigurationTable64 = (EFI_CONFIGURATION_TABLE64 *)(UINTN)Smst64->SmmConfigurationTable;
177 NumberOfTableEntries = (UINTN)Smst64->NumberOfTableEntries;
178 for (Index = 0; Index < NumberOfTableEntries; Index++) {
179 if (CompareGuid (&SmmConfigurationTable64[Index].VendorGuid, VendorGuid)) {
180 return (VOID *)(UINTN)SmmConfigurationTable64[Index].VendorTable;
181 }
182 }
183
184 return NULL;
185 } else {
186 SmmConfigurationTable = Smst->SmmConfigurationTable;
187 NumberOfTableEntries = Smst->NumberOfTableEntries;
188 for (Index = 0; Index < NumberOfTableEntries; Index++) {
189 if (CompareGuid (&SmmConfigurationTable[Index].VendorGuid, VendorGuid)) {
190 return (VOID *)SmmConfigurationTable[Index].VendorTable;
191 }
192 }
193
194 return NULL;
195 }
196}
197
205 VOID
206 )
207{
208 EFI_SMRAM_DESCRIPTOR *SmramDescriptor;
209 SMM_S3_RESUME_STATE *SmmS3ResumeState;
210 VOID *GuidHob;
211 SMM_LOCK_BOX_CONTEXT *SmmLockBoxContext;
212
213 GuidHob = GetFirstGuidHob (&gEfiAcpiVariableGuid);
214 ASSERT (GuidHob != NULL);
215 SmramDescriptor = (EFI_SMRAM_DESCRIPTOR *)GET_GUID_HOB_DATA (GuidHob);
216 SmmS3ResumeState = (SMM_S3_RESUME_STATE *)(UINTN)SmramDescriptor->CpuStart;
217
219 SmmS3ResumeState->Signature,
220 (EFI_SMM_SYSTEM_TABLE2 *)(UINTN)SmmS3ResumeState->Smst,
221 &gEfiSmmLockBoxCommunicationGuid
222 );
223 ASSERT (SmmLockBoxContext != NULL);
224
225 return SmmLockBoxContext;
226}
227
244 IN GUID *Guid,
245 IN VOID *Buffer OPTIONAL,
246 IN OUT UINTN *Length OPTIONAL
247 )
248{
249 PEI_SMM_ACCESS_PPI *SmmAccess;
250 UINTN Index;
251 EFI_STATUS Status;
252 SMM_LOCK_BOX_CONTEXT *SmmLockBoxContext;
253 LIST_ENTRY *LockBoxQueue;
254 SMM_LOCK_BOX_DATA *LockBox;
255 VOID *RestoreBuffer;
256
257 //
258 // Get needed resource
259 //
260 Status = PeiServicesLocatePpi (
261 &gPeiSmmAccessPpiGuid,
262 0,
263 NULL,
264 (VOID **)&SmmAccess
265 );
266 if (!EFI_ERROR (Status)) {
267 for (Index = 0; !EFI_ERROR (Status); Index++) {
268 Status = SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
269 }
270 }
271
272 //
273 // Get LockBox context
274 //
275 SmmLockBoxContext = InternalGetSmmLockBoxContext ();
276 LockBoxQueue = (LIST_ENTRY *)(UINTN)SmmLockBoxContext->LockBoxDataAddress;
277
278 //
279 // We do NOT check Buffer address in SMRAM, because if SMRAM not locked, we trust the caller.
280 //
281
282 //
283 // Restore this, Buffer and Length MUST be both NULL or both non-NULL
284 //
285
286 //
287 // Find LockBox
288 //
289 LockBox = InternalFindLockBoxByGuidFromSmram (LockBoxQueue, Guid);
290 if (LockBox == NULL) {
291 //
292 // Not found
293 //
294 return EFI_NOT_FOUND;
295 }
296
297 //
298 // Set RestoreBuffer
299 //
300 if (Buffer != NULL) {
301 //
302 // restore to new buffer
303 //
304 RestoreBuffer = Buffer;
305 } else {
306 //
307 // restore to original buffer
308 //
309 if ((LockBox->Attributes & LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE) == 0) {
310 return EFI_WRITE_PROTECTED;
311 }
312
313 RestoreBuffer = (VOID *)(UINTN)LockBox->Buffer;
314 }
315
316 //
317 // Set RestoreLength
318 //
319 if (Length != NULL) {
320 if (*Length < (UINTN)LockBox->Length) {
321 //
322 // Input buffer is too small to hold all data.
323 //
324 *Length = (UINTN)LockBox->Length;
325 return EFI_BUFFER_TOO_SMALL;
326 }
327
328 *Length = (UINTN)LockBox->Length;
329 }
330
331 //
332 // Restore data
333 //
334 CopyMem (RestoreBuffer, (VOID *)(UINTN)LockBox->SmramBuffer, (UINTN)LockBox->Length);
335
336 //
337 // Done
338 //
339 return EFI_SUCCESS;
340}
341
349 VOID
350 )
351{
352 PEI_SMM_ACCESS_PPI *SmmAccess;
353 UINTN Index;
354 EFI_STATUS Status;
355 SMM_LOCK_BOX_CONTEXT *SmmLockBoxContext;
356 LIST_ENTRY *LockBoxQueue;
357 SMM_LOCK_BOX_DATA *LockBox;
358 LIST_ENTRY *Link;
359
360 //
361 // Get needed resource
362 //
363 Status = PeiServicesLocatePpi (
364 &gPeiSmmAccessPpiGuid,
365 0,
366 NULL,
367 (VOID **)&SmmAccess
368 );
369 if (!EFI_ERROR (Status)) {
370 for (Index = 0; !EFI_ERROR (Status); Index++) {
371 Status = SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
372 }
373 }
374
375 //
376 // Get LockBox context
377 //
378 SmmLockBoxContext = InternalGetSmmLockBoxContext ();
379 LockBoxQueue = (LIST_ENTRY *)(UINTN)SmmLockBoxContext->LockBoxDataAddress;
380
381 //
382 // We do NOT check Buffer address in SMRAM, because if SMRAM not locked, we trust the caller.
383 //
384
385 //
386 // Restore all, Buffer and Length MUST be NULL
387 //
388 for (Link = InternalInitLinkDxe (LockBoxQueue);
389 Link != LockBoxQueue;
390 Link = InternalNextLinkDxe (Link))
391 {
392 LockBox = BASE_CR (
393 Link,
395 Link
396 );
397 if ((LockBox->Attributes & LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE) != 0) {
398 //
399 // Restore data
400 //
401 CopyMem ((VOID *)(UINTN)LockBox->Buffer, (VOID *)(UINTN)LockBox->SmramBuffer, (UINTN)LockBox->Length);
402 }
403 }
404
405 //
406 // Done
407 //
408 return EFI_SUCCESS;
409}
410
426RETURN_STATUS
427EFIAPI
429 IN GUID *Guid,
430 IN VOID *Buffer,
431 IN UINTN Length
432 )
433{
434 ASSERT (FALSE);
435
436 //
437 // No support to save at PEI phase
438 //
439 return RETURN_UNSUPPORTED;
440}
441
455RETURN_STATUS
456EFIAPI
458 IN GUID *Guid,
459 IN UINT64 Attributes
460 )
461{
462 ASSERT (FALSE);
463
464 //
465 // No support to save at PEI phase
466 //
467 return RETURN_UNSUPPORTED;
468}
469
489RETURN_STATUS
490EFIAPI
492 IN GUID *Guid,
493 IN UINTN Offset,
494 IN VOID *Buffer,
495 IN UINTN Length
496 )
497{
498 ASSERT (FALSE);
499
500 //
501 // No support to update at PEI phase
502 //
503 return RETURN_UNSUPPORTED;
504}
505
524RETURN_STATUS
525EFIAPI
527 IN GUID *Guid,
528 IN VOID *Buffer OPTIONAL,
529 IN OUT UINTN *Length OPTIONAL
530 )
531{
532 EFI_STATUS Status;
533 EFI_PEI_SMM_COMMUNICATION_PPI *SmmCommunicationPpi;
534 EFI_SMM_LOCK_BOX_PARAMETER_RESTORE *LockBoxParameterRestore;
535 EFI_SMM_COMMUNICATE_HEADER *CommHeader;
536 UINT8 CommBuffer[sizeof (EFI_GUID) + sizeof (UINT64) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE)];
537 UINTN CommSize;
538 UINT64 MessageLength;
539
540 //
541 // Please aware that there is UINTN in EFI_SMM_COMMUNICATE_HEADER. It might be UINT64 in DXE, while it is UINT32 in PEI.
542 // typedef struct {
543 // EFI_GUID HeaderGuid;
544 // UINTN MessageLength;
545 // UINT8 Data[1];
546 // } EFI_SMM_COMMUNICATE_HEADER;
547 //
548
549 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib RestoreLockBox - Enter\n"));
550
551 //
552 // Basic check
553 //
554 if ((Guid == NULL) ||
555 ((Buffer == NULL) && (Length != NULL)) ||
556 ((Buffer != NULL) && (Length == NULL)))
557 {
558 return EFI_INVALID_PARAMETER;
559 }
560
561 //
562 // Get needed resource
563 //
564 Status = PeiServicesLocatePpi (
565 &gEfiPeiSmmCommunicationPpiGuid,
566 0,
567 NULL,
568 (VOID **)&SmmCommunicationPpi
569 );
570 if (EFI_ERROR (Status)) {
571 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib LocatePpi - (%r)\n", Status));
572 Status = InternalRestoreLockBoxFromSmram (Guid, Buffer, Length);
573 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib RestoreLockBox - Exit (%r)\n", Status));
574 return Status;
575 }
576
577 //
578 // Prepare parameter
579 //
580 CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
581 CopyMem (&CommHeader->HeaderGuid, &gEfiSmmLockBoxCommunicationGuid, sizeof (gEfiSmmLockBoxCommunicationGuid));
582 if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
583 MessageLength = sizeof (*LockBoxParameterRestore);
584 CopyMem (&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, MessageLength)], &MessageLength, sizeof (MessageLength));
585 } else {
586 CommHeader->MessageLength = sizeof (*LockBoxParameterRestore);
587 }
588
589 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib CommBuffer - %x\n", &CommBuffer[0]));
590 if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
591 LockBoxParameterRestore = (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, MessageLength) + sizeof (UINT64)];
592 } else {
593 LockBoxParameterRestore = (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, MessageLength) + sizeof (UINTN)];
594 }
595
596 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib LockBoxParameterRestore - %x\n", LockBoxParameterRestore));
597 LockBoxParameterRestore->Header.Command = EFI_SMM_LOCK_BOX_COMMAND_RESTORE;
598 LockBoxParameterRestore->Header.DataLength = sizeof (*LockBoxParameterRestore);
599 LockBoxParameterRestore->Header.ReturnStatus = (UINT64)-1;
600 if (Guid != 0) {
601 CopyMem (&LockBoxParameterRestore->Guid, Guid, sizeof (*Guid));
602 } else {
603 ZeroMem (&LockBoxParameterRestore->Guid, sizeof (*Guid));
604 }
605
606 LockBoxParameterRestore->Buffer = (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer;
607 if (Length != NULL) {
608 LockBoxParameterRestore->Length = (EFI_PHYSICAL_ADDRESS)*Length;
609 } else {
610 LockBoxParameterRestore->Length = 0;
611 }
612
613 //
614 // Send command
615 //
616 CommSize = sizeof (CommBuffer);
617 Status = SmmCommunicationPpi->Communicate (
618 SmmCommunicationPpi,
619 &CommBuffer[0],
620 &CommSize
621 );
622 if (Status == EFI_NOT_STARTED) {
623 //
624 // Pei SMM communication not ready yet, so we access SMRAM directly
625 //
626 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib Communicate - (%r)\n", Status));
627 Status = InternalRestoreLockBoxFromSmram (Guid, Buffer, Length);
628 LockBoxParameterRestore->Header.ReturnStatus = (UINT64)Status;
629 if (Length != NULL) {
630 LockBoxParameterRestore->Length = (UINT64)*Length;
631 }
632 }
633
634 if (Length != NULL) {
635 *Length = (UINTN)LockBoxParameterRestore->Length;
636 }
637
638 Status = (EFI_STATUS)LockBoxParameterRestore->Header.ReturnStatus;
639 if (Status != EFI_SUCCESS) {
640 // Need or MAX_BIT, because there might be case that SMM is X64 while PEI is IA32.
641 Status |= MAX_BIT;
642 }
643
644 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib RestoreLockBox - Exit (%r)\n", Status));
645
646 //
647 // Done
648 //
649 return Status;
650}
651
659RETURN_STATUS
660EFIAPI
662 VOID
663 )
664{
665 EFI_STATUS Status;
666 EFI_PEI_SMM_COMMUNICATION_PPI *SmmCommunicationPpi;
667 EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE *LockBoxParameterRestoreAllInPlace;
668 EFI_SMM_COMMUNICATE_HEADER *CommHeader;
669 UINT8 CommBuffer[sizeof (EFI_GUID) + sizeof (UINT64) + sizeof (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE)];
670 UINTN CommSize;
671 UINT64 MessageLength;
672
673 //
674 // Please aware that there is UINTN in EFI_SMM_COMMUNICATE_HEADER. It might be UINT64 in DXE, while it is UINT32 in PEI.
675 // typedef struct {
676 // EFI_GUID HeaderGuid;
677 // UINTN MessageLength;
678 // UINT8 Data[1];
679 // } EFI_SMM_COMMUNICATE_HEADER;
680 //
681
682 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib RestoreAllLockBoxInPlace - Enter\n"));
683
684 //
685 // Get needed resource
686 //
687 Status = PeiServicesLocatePpi (
688 &gEfiPeiSmmCommunicationPpiGuid,
689 0,
690 NULL,
691 (VOID **)&SmmCommunicationPpi
692 );
693 if (EFI_ERROR (Status)) {
694 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib LocatePpi - (%r)\n", Status));
696 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib RestoreAllLockBoxInPlace - Exit (%r)\n", Status));
697 return Status;
698 }
699
700 //
701 // Prepare parameter
702 //
703 CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
704 CopyMem (&CommHeader->HeaderGuid, &gEfiSmmLockBoxCommunicationGuid, sizeof (gEfiSmmLockBoxCommunicationGuid));
705 if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
706 MessageLength = sizeof (*LockBoxParameterRestoreAllInPlace);
707 CopyMem (&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, MessageLength)], &MessageLength, sizeof (MessageLength));
708 } else {
709 CommHeader->MessageLength = sizeof (*LockBoxParameterRestoreAllInPlace);
710 }
711
712 if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
713 LockBoxParameterRestoreAllInPlace = (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, MessageLength) + sizeof (UINT64)];
714 } else {
715 LockBoxParameterRestoreAllInPlace = (EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, MessageLength) + sizeof (UINTN)];
716 }
717
718 LockBoxParameterRestoreAllInPlace->Header.Command = EFI_SMM_LOCK_BOX_COMMAND_RESTORE_ALL_IN_PLACE;
719 LockBoxParameterRestoreAllInPlace->Header.DataLength = sizeof (*LockBoxParameterRestoreAllInPlace);
720 LockBoxParameterRestoreAllInPlace->Header.ReturnStatus = (UINT64)-1;
721
722 //
723 // Send command
724 //
725 CommSize = sizeof (CommBuffer);
726 Status = SmmCommunicationPpi->Communicate (
727 SmmCommunicationPpi,
728 &CommBuffer[0],
729 &CommSize
730 );
731 if (Status == EFI_NOT_STARTED) {
732 //
733 // Pei SMM communication not ready yet, so we access SMRAM directly
734 //
735 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib Communicate - (%r)\n", Status));
737 LockBoxParameterRestoreAllInPlace->Header.ReturnStatus = (UINT64)Status;
738 }
739
740 ASSERT_EFI_ERROR (Status);
741
742 Status = (EFI_STATUS)LockBoxParameterRestoreAllInPlace->Header.ReturnStatus;
743 if (Status != EFI_SUCCESS) {
744 // Need or MAX_BIT, because there might be case that SMM is X64 while PEI is IA32.
745 Status |= MAX_BIT;
746 }
747
748 DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib RestoreAllLockBoxInPlace - Exit (%r)\n", Status));
749
750 //
751 // Done
752 //
753 return Status;
754}
#define MAX_BIT
UINT64 UINTN
CONST EFI_PEI_SERVICES **EFIAPI GetPeiServicesTablePointer(VOID)
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
Definition: HobLib.c:215
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
EFI_STATUS EFIAPI SmmInstallConfigurationTable(IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable, IN CONST EFI_GUID *Guid, IN VOID *Table, IN UINTN TableSize)
EFI_STATUS EFIAPI SmmFreePages(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
Definition: Page.c:934
EFI_STATUS EFIAPI SmmAllocatePages(IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN NumberOfPages, OUT EFI_PHYSICAL_ADDRESS *Memory)
Definition: Page.c:723
#define NULL
Definition: Base.h:319
#define RETURN_UNSUPPORTED
Definition: Base.h:1081
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
#define BASE_CR(Record, TYPE, Field)
Definition: Base.h:891
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define FeaturePcdGet(TokenName)
Definition: PcdLib.h:50
EFI_STATUS EFIAPI SmmFreePool(IN VOID *Buffer)
Definition: Pool.c:445
EFI_STATUS EFIAPI SmmAllocatePool(IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer)
Definition: Pool.c:338
RETURN_STATUS EFIAPI SetLockBoxAttributes(IN GUID *Guid, IN UINT64 Attributes)
RETURN_STATUS EFIAPI RestoreLockBox(IN GUID *Guid, IN VOID *Buffer OPTIONAL, IN OUT UINTN *Length OPTIONAL)
VOID * InternalSmstGetVendorTableByGuid(IN UINT64 Signature, IN EFI_SMM_SYSTEM_TABLE2 *Smst, IN EFI_GUID *VendorGuid)
LIST_ENTRY * InternalInitLinkDxe(IN LIST_ENTRY *LinkList)
RETURN_STATUS EFIAPI RestoreAllLockBoxInPlace(VOID)
SMM_LOCK_BOX_DATA * InternalFindLockBoxByGuidFromSmram(IN LIST_ENTRY *LockBoxQueue, IN EFI_GUID *Guid)
RETURN_STATUS EFIAPI UpdateLockBox(IN GUID *Guid, IN UINTN Offset, IN VOID *Buffer, IN UINTN Length)
EFI_STATUS InternalRestoreAllLockBoxInPlaceFromSmram(VOID)
LIST_ENTRY * InternalNextLinkDxe(IN LIST_ENTRY *Link)
RETURN_STATUS EFIAPI SaveLockBox(IN GUID *Guid, IN VOID *Buffer, IN UINTN Length)
EFI_STATUS InternalRestoreLockBoxFromSmram(IN GUID *Guid, IN VOID *Buffer OPTIONAL, IN OUT UINTN *Length OPTIONAL)
SMM_LOCK_BOX_CONTEXT * InternalGetSmmLockBoxContext(VOID)
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
GUID EFI_GUID
Definition: UefiBaseType.h:25
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_STATUS EFIAPI SmmStartupThisAp(IN EFI_AP_PROCEDURE Procedure, IN UINTN CpuIndex, IN OUT VOID *ProcArguments OPTIONAL)
Definition: MpService.c:1434
EFI_PHYSICAL_ADDRESS CpuStart
Definition: PiMultiPhase.h:127
Definition: Base.h:213