51 EndOfEntries = StartOfEntries + NumEntries;
52 if (mLockBoxGlobal->Signature != LOCK_BOX_GLOBAL_SIGNATURE) {
58 mLockBoxGlobal->Signature = LOCK_BOX_GLOBAL_SIGNATURE;
88 for (Header = StartOfEntries; Header < EndOfEntries; Header++) {
89 if ((Header->Size == 0) ||
CompareGuid (Guid, &Header->Guid)) {
127 "%a: Guid=%g Buffer=%p Length=0x%x\n",
134 if ((Guid ==
NULL) || (Buffer ==
NULL) || (Length == 0)) {
138 if (Length > 0xFFFFFFFF) {
143 if (Header ==
NULL) {
147 if (Header->Size > 0) {
152 if (CopyBuffer ==
NULL) {
160 Header->OrigAddress = (
UINTN)Buffer;
161 Header->CopyAddress = (
UINTN)CopyBuffer;
162 Header->Size = (UINT32)Length;
163 Header->Attributes = 0;
168 CopyMem (CopyBuffer, Buffer, Length);
198 "%a: Guid=%g Attributes=0x%Lx\n",
209 if (!Header || (Header->Size == 0)) {
213 Header->Attributes = Attributes;
255 "%a: Guid=%g Offset=0x%x Length=0x%x\n",
262 if ((Guid ==
NULL) || (Buffer ==
NULL) || (Length == 0)) {
267 if (!Header || (Header->Size == 0)) {
271 if ((Header->Size < Offset) ||
272 (Length > Header->Size - Offset))
277 CopyMem ((UINT8 *)(
UINTN)(Header->CopyAddress) + Offset, Buffer, Length);
309 IN VOID *Buffer OPTIONAL,
317 "%a: Guid=%g Buffer=%p\n",
323 if ((Guid ==
NULL) ||
324 ((Buffer ==
NULL) && (Length !=
NULL)) ||
325 ((Buffer !=
NULL) && (Length ==
NULL)))
327 return EFI_INVALID_PARAMETER;
331 if (!Header || (Header->Size == 0)) {
335 if (Buffer ==
NULL) {
336 if (!(Header->Attributes & LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE)) {
340 if (Header->OrigAddress + (Header->Size - 1) >
MAX_ADDRESS) {
344 Buffer = (VOID *)(
UINTN)Header->OrigAddress;
350 if (Length !=
NULL) {
351 if (Header->Size > *Length) {
355 *Length = Header->Size;
356 return EFI_BUFFER_TOO_SMALL;
359 *Length = Header->Size;
362 CopyMem (Buffer, (VOID *)(
UINTN)Header->CopyAddress, Header->Size);
384 for (Header = StartOfEntries;
385 Header < EndOfEntries && Header->Size > 0;
388 if (Header->Attributes & LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE) {
391 if (Header->OrigAddress + (Header->Size - 1) >
MAX_ADDRESS) {
395 Buffer = (VOID *)(
UINTN)Header->OrigAddress;
396 CopyMem (Buffer, (VOID *)(
UINTN)Header->CopyAddress, Header->Size);
399 "%a: Guid=%g Buffer=%p\n",
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI AllocateAcpiNvsPool(IN UINTN AllocationSize)
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)
RETURN_STATUS EFIAPI RestoreAllLockBoxInPlace(VOID)
STATIC LOCK_BOX_ENTRY *EFIAPI FindHeaderByGuid(IN CONST EFI_GUID *Guid)
RETURN_STATUS EFIAPI UpdateLockBox(IN GUID *Guid, IN UINTN Offset, IN VOID *Buffer, IN UINTN Length)
RETURN_STATUS EFIAPI SaveLockBox(IN GUID *Guid, IN VOID *Buffer, IN UINTN Length)
#define RETURN_BUFFER_TOO_SMALL
#define RETURN_WRITE_PROTECTED
#define RETURN_UNSUPPORTED
#define RETURN_OUT_OF_RESOURCES
#define RETURN_ALREADY_STARTED
#define RETURN_INVALID_PARAMETER
#define DEBUG(Expression)
#define PcdGet32(TokenName)
#define FeaturePcdGet(TokenName)
UINT64 EFI_PHYSICAL_ADDRESS