TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmLockBoxMmLib.c File Reference

Go to the source code of this file.

Functions

SMM_LOCK_BOX_CONTEXTInternalGetSmmLockBoxContext (VOID)
 
EFI_STATUS EFIAPI SmmLockBoxSmmReadyToLockNotify (IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
 
EFI_STATUS EFIAPI SmmLockBoxS3EntryCallBack (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmLockBoxSmmEndOfDxeNotify (IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
 
EFI_STATUS EFIAPI SmmLockBoxEndOfS3ResumeNotify (IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
 
EFI_STATUS SmmLockBoxMmConstructor (VOID)
 
EFI_STATUS SmmLockBoxMmDestructor (VOID)
 
LIST_ENTRYInternalGetLockBoxQueue (VOID)
 
SMM_LOCK_BOX_DATAInternalFindLockBoxByGuid (IN EFI_GUID *Guid)
 
RETURN_STATUS EFIAPI SaveLockBox (IN GUID *Guid, IN VOID *Buffer, IN UINTN Length)
 
RETURN_STATUS EFIAPI SetLockBoxAttributes (IN GUID *Guid, IN UINT64 Attributes)
 
RETURN_STATUS EFIAPI UpdateLockBox (IN GUID *Guid, IN UINTN Offset, IN VOID *Buffer, IN UINTN Length)
 
RETURN_STATUS EFIAPI RestoreLockBox (IN GUID *Guid, IN VOID *Buffer OPTIONAL, IN OUT UINTN *Length OPTIONAL)
 
RETURN_STATUS EFIAPI RestoreAllLockBoxInPlace (VOID)
 

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
 

Detailed Description

Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmmLockBoxMmLib.c.

Function Documentation

◆ InternalFindLockBoxByGuid()

SMM_LOCK_BOX_DATA * InternalFindLockBoxByGuid ( IN EFI_GUID Guid)

This function find LockBox by GUID.

Parameters
GuidThe guid to indentify the LockBox
Returns
LockBoxData

Definition at line 374 of file SmmLockBoxMmLib.c.

◆ InternalGetLockBoxQueue()

LIST_ENTRY * InternalGetLockBoxQueue ( VOID  )

This function return SmmLockBox queue address.

Returns
SmmLockBox queue address.

Definition at line 351 of file SmmLockBoxMmLib.c.

◆ InternalGetSmmLockBoxContext()

SMM_LOCK_BOX_CONTEXT * InternalGetSmmLockBoxContext ( VOID  )

This function return SmmLockBox context from SMST.

Returns
SmmLockBox context from SMST.

Definition at line 43 of file SmmLockBoxMmLib.c.

◆ RestoreAllLockBoxInPlace()

RETURN_STATUS EFIAPI RestoreAllLockBoxInPlace ( VOID  )

This function will restore confidential information from all lockbox which have RestoreInPlace attribute.

Return values
RETURN_SUCCESSthe information is restored successfully.
RETURN_NOT_STARTEDit is too early to invoke this interface
RETURN_UNSUPPORTEDthe service is not supported by implementaion.

Definition at line 840 of file SmmLockBoxMmLib.c.

◆ RestoreLockBox()

RETURN_STATUS EFIAPI RestoreLockBox ( IN GUID Guid,
IN VOID *Buffer  OPTIONAL,
IN OUT UINTN *Length  OPTIONAL 
)

This function will restore confidential information from lockbox.

Parameters
Guidthe guid to identify the confidential information
Bufferthe address of the restored confidential information NULL means restored to original address, Length MUST be NULL at same time.
Lengththe length of the restored confidential information
Return values
RETURN_SUCCESSthe information is restored successfully.
RETURN_INVALID_PARAMETERthe Guid is NULL, or one of Buffer and Length is NULL.
RETURN_WRITE_PROTECTEDBuffer and Length are NULL, but the LockBox has no LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.
RETURN_BUFFER_TOO_SMALLthe Length is too small to hold the confidential information.
RETURN_NOT_FOUNDthe requested GUID not found.
RETURN_NOT_STARTEDit is too early to invoke this interface
RETURN_ACCESS_DENIEDnot allow to restore to the address
RETURN_UNSUPPORTEDthe service is not supported by implementaion.

Definition at line 738 of file SmmLockBoxMmLib.c.

◆ SaveLockBox()

RETURN_STATUS EFIAPI SaveLockBox ( IN GUID Guid,
IN VOID *  Buffer,
IN UINTN  Length 
)

This function will save confidential information to lockbox.

Parameters
Guidthe guid to identify the confidential information
Bufferthe address of the confidential information
Lengththe length of the confidential information
Return values
RETURN_SUCCESSthe information is saved successfully.
RETURN_INVALID_PARAMETERthe Guid is NULL, or Buffer is NULL, or Length is 0
RETURN_ALREADY_STARTEDthe requested GUID already exist.
RETURN_OUT_OF_RESOURCESno enough resource to save the information.
RETURN_ACCESS_DENIEDit is too late to invoke this interface
RETURN_NOT_STARTEDit is too early to invoke this interface
RETURN_UNSUPPORTEDthe service is not supported by implementaion.

Definition at line 419 of file SmmLockBoxMmLib.c.

◆ SetLockBoxAttributes()

RETURN_STATUS EFIAPI SetLockBoxAttributes ( IN GUID Guid,
IN UINT64  Attributes 
)

This function will set lockbox attributes.

Parameters
Guidthe guid to identify the confidential information
Attributesthe attributes of the lockbox
Return values
RETURN_SUCCESSthe information is saved successfully.
RETURN_INVALID_PARAMETERattributes is invalid.
RETURN_NOT_FOUNDthe requested GUID not found.
RETURN_ACCESS_DENIEDit is too late to invoke this interface
RETURN_NOT_STARTEDit is too early to invoke this interface
RETURN_UNSUPPORTEDthe service is not supported by implementaion.

Definition at line 528 of file SmmLockBoxMmLib.c.

◆ SmmLockBoxEndOfS3ResumeNotify()

EFI_STATUS EFIAPI SmmLockBoxEndOfS3ResumeNotify ( IN CONST EFI_GUID Protocol,
IN VOID *  Interface,
IN EFI_HANDLE  Handle 
)

Notification for SMM EndOfS3Resume protocol.

Parameters
[in]ProtocolPoints to the protocol's unique identifier.
[in]InterfacePoints to the interface instance.
[in]HandleThe handle on which the interface was installed.
Return values
EFI_SUCCESSNotification runs successfully.

Definition at line 180 of file SmmLockBoxMmLib.c.

◆ SmmLockBoxMmConstructor()

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.

Return values
EFI_SUCEESS
Returns
Others Some error occurs.

Definition at line 198 of file SmmLockBoxMmLib.c.

◆ SmmLockBoxMmDestructor()

EFI_STATUS SmmLockBoxMmDestructor ( VOID  )

Destructor for SmmLockBox library. This is used to uninstall SmmLockBoxCommunication configuration table if it has been installed in Constructor.

Return values
EFI_SUCEESSThe destructor always returns EFI_SUCCESS.

Definition at line 287 of file SmmLockBoxMmLib.c.

◆ SmmLockBoxS3EntryCallBack()

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.

Parameters
[in]DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
[in]ContextPoints to an optional handler context which was specified when the handler was registered.
[in,out]CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
[in,out]CommBufferSizeThe size of the CommBuffer.
Return values
EFI_SUCCESSThe interrupt was handled and quiesced. No other handlers should still be called.
EFI_WARN_INTERRUPT_SOURCE_QUIESCEDThe interrupt has been quiesced but other handlers should still be called.
EFI_WARN_INTERRUPT_SOURCE_PENDINGThe interrupt is still pending and other handlers should still be called.
EFI_INTERRUPT_PENDINGThe interrupt could not be quiesced.

Definition at line 109 of file SmmLockBoxMmLib.c.

◆ SmmLockBoxSmmEndOfDxeNotify()

EFI_STATUS EFIAPI SmmLockBoxSmmEndOfDxeNotify ( IN CONST EFI_GUID Protocol,
IN VOID *  Interface,
IN EFI_HANDLE  Handle 
)

Notification for SMM EndOfDxe protocol.

Parameters
[in]ProtocolPoints to the protocol's unique identifier.
[in]InterfacePoints to the interface instance.
[in]HandleThe handle on which the interface was installed.
Return values
EFI_SUCCESSNotification runs successfully.

Definition at line 131 of file SmmLockBoxMmLib.c.

◆ SmmLockBoxSmmReadyToLockNotify()

EFI_STATUS EFIAPI SmmLockBoxSmmReadyToLockNotify ( IN CONST EFI_GUID Protocol,
IN VOID *  Interface,
IN EFI_HANDLE  Handle 
)

Notification for SMM ReadyToLock protocol.

Parameters
[in]ProtocolPoints to the protocol's unique identifier.
[in]InterfacePoints to the interface instance.
[in]HandleThe handle on which the interface was installed.
Return values
EFI_SUCCESSNotification runs successfully.

Definition at line 79 of file SmmLockBoxMmLib.c.

◆ UpdateLockBox()

RETURN_STATUS EFIAPI UpdateLockBox ( IN GUID Guid,
IN UINTN  Offset,
IN VOID *  Buffer,
IN UINTN  Length 
)

This function will update confidential information to lockbox.

Parameters
Guidthe guid to identify the original confidential information
Offsetthe offset of the original confidential information
Bufferthe address of the updated confidential information
Lengththe length of the updated confidential information
Return values
RETURN_SUCCESSthe information is saved successfully.
RETURN_INVALID_PARAMETERthe Guid is NULL, or Buffer is NULL, or Length is 0.
RETURN_NOT_FOUNDthe requested GUID not found.
RETURN_BUFFER_TOO_SMALLfor lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, the original buffer to too small to hold new information.
RETURN_OUT_OF_RESOURCESfor lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, no enough resource to save the information.
RETURN_ACCESS_DENIEDit is too late to invoke this interface
RETURN_NOT_STARTEDit is too early to invoke this interface
RETURN_UNSUPPORTEDthe service is not supported by implementaion.

Definition at line 609 of file SmmLockBoxMmLib.c.

Variable Documentation

◆ mLockBoxQueue

LIST_ENTRY mLockBoxQueue = INITIALIZE_LIST_HEAD_VARIABLE (mLockBoxQueue)

Definition at line 28 of file SmmLockBoxMmLib.c.

◆ mSmmConfigurationTableInstalled

BOOLEAN mSmmConfigurationTableInstalled = FALSE

Definition at line 30 of file SmmLockBoxMmLib.c.

◆ mSmmLockBoxContext

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.

◆ mSmmLockBoxDuringS3Resume

BOOLEAN mSmmLockBoxDuringS3Resume = FALSE

Definition at line 35 of file SmmLockBoxMmLib.c.

◆ mSmmLockBoxRegistrationEndOfS3Resume

VOID* mSmmLockBoxRegistrationEndOfS3Resume = NULL

Definition at line 33 of file SmmLockBoxMmLib.c.

◆ mSmmLockBoxRegistrationSmmEndOfDxe

VOID* mSmmLockBoxRegistrationSmmEndOfDxe = NULL

Definition at line 31 of file SmmLockBoxMmLib.c.

◆ mSmmLockBoxRegistrationSmmReadyToLock

VOID* mSmmLockBoxRegistrationSmmReadyToLock = NULL

Definition at line 32 of file SmmLockBoxMmLib.c.

◆ mSmmLockBoxSmmReadyToLock

BOOLEAN mSmmLockBoxSmmReadyToLock = FALSE

Definition at line 34 of file SmmLockBoxMmLib.c.