TianoCore EDK2 master
|
#include <PiMm.h>
#include <Library/MmServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/LockBoxLib.h>
#include <Library/DebugLib.h>
#include <Guid/SmmLockBox.h>
#include <Guid/EndOfS3Resume.h>
#include <Protocol/MmReadyToLock.h>
#include <Protocol/MmEndOfDxe.h>
#include <Protocol/SmmSxDispatch2.h>
#include "SmmLockBoxLibPrivate.h"
Go to the source code of this file.
Variables | |
SMM_LOCK_BOX_CONTEXT | mSmmLockBoxContext |
LIST_ENTRY | mLockBoxQueue = INITIALIZE_LIST_HEAD_VARIABLE (mLockBoxQueue) |
BOOLEAN | mSmmConfigurationTableInstalled = FALSE |
VOID * | mSmmLockBoxRegistrationSmmEndOfDxe = NULL |
VOID * | mSmmLockBoxRegistrationSmmReadyToLock = NULL |
VOID * | mSmmLockBoxRegistrationEndOfS3Resume = NULL |
BOOLEAN | mSmmLockBoxSmmReadyToLock = FALSE |
BOOLEAN | mSmmLockBoxDuringS3Resume = FALSE |
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SmmLockBoxMmLib.c.
SMM_LOCK_BOX_DATA * InternalFindLockBoxByGuid | ( | IN EFI_GUID * | Guid | ) |
This function find LockBox by GUID.
Guid | The guid to indentify the LockBox |
Definition at line 374 of file SmmLockBoxMmLib.c.
LIST_ENTRY * InternalGetLockBoxQueue | ( | VOID | ) |
This function return SmmLockBox queue address.
Definition at line 351 of file SmmLockBoxMmLib.c.
SMM_LOCK_BOX_CONTEXT * InternalGetSmmLockBoxContext | ( | VOID | ) |
This function return SmmLockBox context from SMST.
Definition at line 43 of file SmmLockBoxMmLib.c.
RETURN_STATUS EFIAPI RestoreAllLockBoxInPlace | ( | VOID | ) |
This function will restore confidential information from all lockbox which have RestoreInPlace attribute.
RETURN_SUCCESS | the information is restored successfully. |
RETURN_NOT_STARTED | it is too early to invoke this interface |
RETURN_UNSUPPORTED | the service is not supported by implementaion. |
Definition at line 840 of file SmmLockBoxMmLib.c.
RETURN_STATUS EFIAPI RestoreLockBox | ( | IN GUID * | Guid, |
IN VOID *Buffer | OPTIONAL, | ||
IN OUT UINTN *Length | OPTIONAL | ||
) |
This function will restore confidential information from lockbox.
Guid | the guid to identify the confidential information |
Buffer | the address of the restored confidential information NULL means restored to original address, Length MUST be NULL at same time. |
Length | the length of the restored confidential information |
RETURN_SUCCESS | the information is restored successfully. |
RETURN_INVALID_PARAMETER | the Guid is NULL, or one of Buffer and Length is NULL. |
RETURN_WRITE_PROTECTED | Buffer and Length are NULL, but the LockBox has no LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute. |
RETURN_BUFFER_TOO_SMALL | the Length is too small to hold the confidential information. |
RETURN_NOT_FOUND | the requested GUID not found. |
RETURN_NOT_STARTED | it is too early to invoke this interface |
RETURN_ACCESS_DENIED | not allow to restore to the address |
RETURN_UNSUPPORTED | the service is not supported by implementaion. |
Definition at line 738 of file SmmLockBoxMmLib.c.
This function will save confidential information to lockbox.
Guid | the guid to identify the confidential information |
Buffer | the address of the confidential information |
Length | the length of the confidential information |
RETURN_SUCCESS | the information is saved successfully. |
RETURN_INVALID_PARAMETER | the Guid is NULL, or Buffer is NULL, or Length is 0 |
RETURN_ALREADY_STARTED | the requested GUID already exist. |
RETURN_OUT_OF_RESOURCES | no enough resource to save the information. |
RETURN_ACCESS_DENIED | it is too late to invoke this interface |
RETURN_NOT_STARTED | it is too early to invoke this interface |
RETURN_UNSUPPORTED | the service is not supported by implementaion. |
Definition at line 419 of file SmmLockBoxMmLib.c.
This function will set lockbox attributes.
Guid | the guid to identify the confidential information |
Attributes | the attributes of the lockbox |
RETURN_SUCCESS | the information is saved successfully. |
RETURN_INVALID_PARAMETER | attributes is invalid. |
RETURN_NOT_FOUND | the requested GUID not found. |
RETURN_ACCESS_DENIED | it is too late to invoke this interface |
RETURN_NOT_STARTED | it is too early to invoke this interface |
RETURN_UNSUPPORTED | the service is not supported by implementaion. |
Definition at line 528 of file SmmLockBoxMmLib.c.
EFI_STATUS EFIAPI SmmLockBoxEndOfS3ResumeNotify | ( | IN CONST EFI_GUID * | Protocol, |
IN VOID * | Interface, | ||
IN EFI_HANDLE | Handle | ||
) |
Notification for SMM EndOfS3Resume protocol.
[in] | Protocol | Points to the protocol's unique identifier. |
[in] | Interface | Points to the interface instance. |
[in] | Handle | The handle on which the interface was installed. |
EFI_SUCCESS | Notification runs successfully. |
Definition at line 180 of file SmmLockBoxMmLib.c.
EFI_STATUS SmmLockBoxMmConstructor | ( | VOID | ) |
Constructor for SmmLockBox library. This is used to set SmmLockBox context, which will be used in PEI phase in S3 boot path later.
EFI_SUCEESS |
Definition at line 198 of file SmmLockBoxMmLib.c.
EFI_STATUS SmmLockBoxMmDestructor | ( | VOID | ) |
Destructor for SmmLockBox library. This is used to uninstall SmmLockBoxCommunication configuration table if it has been installed in Constructor.
EFI_SUCEESS | The destructor always returns EFI_SUCCESS. |
Definition at line 287 of file SmmLockBoxMmLib.c.
EFI_STATUS EFIAPI SmmLockBoxS3EntryCallBack | ( | IN EFI_HANDLE | DispatchHandle, |
IN CONST VOID *Context | OPTIONAL, | ||
IN OUT VOID *CommBuffer | OPTIONAL, | ||
IN OUT UINTN *CommBufferSize | OPTIONAL | ||
) |
Main entry point for an SMM handler dispatch or communicate-based callback.
[in] | DispatchHandle | The unique handle assigned to this handler by SmiHandlerRegister(). |
[in] | Context | Points to an optional handler context which was specified when the handler was registered. |
[in,out] | CommBuffer | A pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment. |
[in,out] | CommBufferSize | The size of the CommBuffer. |
EFI_SUCCESS | The interrupt was handled and quiesced. No other handlers should still be called. |
EFI_WARN_INTERRUPT_SOURCE_QUIESCED | The interrupt has been quiesced but other handlers should still be called. |
EFI_WARN_INTERRUPT_SOURCE_PENDING | The interrupt is still pending and other handlers should still be called. |
EFI_INTERRUPT_PENDING | The interrupt could not be quiesced. |
Definition at line 109 of file SmmLockBoxMmLib.c.
EFI_STATUS EFIAPI SmmLockBoxSmmEndOfDxeNotify | ( | IN CONST EFI_GUID * | Protocol, |
IN VOID * | Interface, | ||
IN EFI_HANDLE | Handle | ||
) |
Notification for SMM EndOfDxe protocol.
[in] | Protocol | Points to the protocol's unique identifier. |
[in] | Interface | Points to the interface instance. |
[in] | Handle | The handle on which the interface was installed. |
EFI_SUCCESS | Notification runs successfully. |
Definition at line 131 of file SmmLockBoxMmLib.c.
EFI_STATUS EFIAPI SmmLockBoxSmmReadyToLockNotify | ( | IN CONST EFI_GUID * | Protocol, |
IN VOID * | Interface, | ||
IN EFI_HANDLE | Handle | ||
) |
Notification for SMM ReadyToLock protocol.
[in] | Protocol | Points to the protocol's unique identifier. |
[in] | Interface | Points to the interface instance. |
[in] | Handle | The handle on which the interface was installed. |
EFI_SUCCESS | Notification runs successfully. |
Definition at line 79 of file SmmLockBoxMmLib.c.
RETURN_STATUS EFIAPI UpdateLockBox | ( | IN GUID * | Guid, |
IN UINTN | Offset, | ||
IN VOID * | Buffer, | ||
IN UINTN | Length | ||
) |
This function will update confidential information to lockbox.
Guid | the guid to identify the original confidential information |
Offset | the offset of the original confidential information |
Buffer | the address of the updated confidential information |
Length | the length of the updated confidential information |
RETURN_SUCCESS | the information is saved successfully. |
RETURN_INVALID_PARAMETER | the Guid is NULL, or Buffer is NULL, or Length is 0. |
RETURN_NOT_FOUND | the requested GUID not found. |
RETURN_BUFFER_TOO_SMALL | for lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, the original buffer to too small to hold new information. |
RETURN_OUT_OF_RESOURCES | for lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, no enough resource to save the information. |
RETURN_ACCESS_DENIED | it is too late to invoke this interface |
RETURN_NOT_STARTED | it is too early to invoke this interface |
RETURN_UNSUPPORTED | the service is not supported by implementaion. |
Definition at line 609 of file SmmLockBoxMmLib.c.
LIST_ENTRY mLockBoxQueue = INITIALIZE_LIST_HEAD_VARIABLE (mLockBoxQueue) |
Definition at line 28 of file SmmLockBoxMmLib.c.
BOOLEAN mSmmConfigurationTableInstalled = FALSE |
Definition at line 30 of file SmmLockBoxMmLib.c.
SMM_LOCK_BOX_CONTEXT mSmmLockBoxContext |
We need handle this library carefully. Only one library instance will construct the environment. Below 2 global variable can only be used in constructor. They should NOT be used in any other library functions.
Definition at line 27 of file SmmLockBoxMmLib.c.
BOOLEAN mSmmLockBoxDuringS3Resume = FALSE |
Definition at line 35 of file SmmLockBoxMmLib.c.
VOID* mSmmLockBoxRegistrationEndOfS3Resume = NULL |
Definition at line 33 of file SmmLockBoxMmLib.c.
VOID* mSmmLockBoxRegistrationSmmEndOfDxe = NULL |
Definition at line 31 of file SmmLockBoxMmLib.c.
VOID* mSmmLockBoxRegistrationSmmReadyToLock = NULL |
Definition at line 32 of file SmmLockBoxMmLib.c.
BOOLEAN mSmmLockBoxSmmReadyToLock = FALSE |
Definition at line 34 of file SmmLockBoxMmLib.c.