EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Functions | Variables

MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.c File Reference

#include <PiSmm.h>
#include <Library/SmmServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/LockBoxLib.h>
#include <Library/DebugLib.h>
#include <Guid/SmmLockBox.h>
#include "SmmLockBoxLibPrivate.h"

Go to the source code of this file.

Functions

SMM_LOCK_BOX_CONTEXTInternalGetSmmLockBoxContext (VOID)
EFI_STATUS EFIAPI SmmLockBoxSmmConstructuor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
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)

Detailed Description

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

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file SmmLockBoxSmmLib.c.


Function Documentation

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 153 of file SmmLockBoxSmmLib.c.

LIST_ENTRY* InternalGetLockBoxQueue ( VOID  )

This function return SmmLockBox queue address.

Returns:
SmmLockBox queue address.

Definition at line 131 of file SmmLockBoxSmmLib.c.

SMM_LOCK_BOX_CONTEXT* InternalGetSmmLockBoxContext ( VOID  )

This function return SmmLockBox context from SMST.

Returns:
SmmLockBox context from SMST.

Definition at line 39 of file SmmLockBoxSmmLib.c.

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 505 of file SmmLockBoxSmmLib.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.

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 417 of file SmmLockBoxSmmLib.c.

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 196 of file SmmLockBoxSmmLib.c.

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 296 of file SmmLockBoxSmmLib.c.

EFI_STATUS EFIAPI SmmLockBoxSmmConstructuor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Constructor for SmmLockBox library. This is used to set SmmLockBox context, which will be used in PEI phase in S3 boot path later.

Parameters:
[in]ImageHandleImage handle of this driver.
[in]SystemTableA Pointer to the EFI System Table.
Return values:
EFI_SUCEESS
Returns:
Others Some error occurs.

Definition at line 76 of file SmmLockBoxSmmLib.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.

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_SMALLthe original buffer to too small to hold new 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 353 of file SmmLockBoxSmmLib.c.


Variable Documentation

LIST_ENTRY mLockBoxQueue = INITIALIZE_LIST_HEAD_VARIABLE (mLockBoxQueue)

Definition at line 31 of file SmmLockBoxSmmLib.c.

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 30 of file SmmLockBoxSmmLib.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines