TianoCore EDK2 master
Loading...
Searching...
No Matches
Tcg2Smm.c File Reference
#include "Tcg2Smm.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI TpmNvsCommunciate (IN EFI_HANDLE DispatchHandle, IN CONST VOID *RegisterContext, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize)
 
EFI_STATUS EFIAPI PhysicalPresenceCallback (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize)
 
EFI_STATUS EFIAPI TcgMmReadyToLock (IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
 
EFI_STATUS InitializeTcgCommon (VOID)
 

Variables

EFI_SMM_VARIABLE_PROTOCOLmSmmVariable = NULL
 
TCG_NVSmTcgNvs = NULL
 
UINTN mPpSoftwareSmi
 
UINTN mMcSoftwareSmi
 
EFI_HANDLE mReadyToLockHandle
 

Detailed Description

It updates TPM2 items in ACPI table and registers SMI2 callback functions for Tcg2 physical presence, ClearMemory, and sample for dTPM StartMethod.

Caution: This module requires additional review when modified. This driver will have external input - variable and ACPINvs data in SMM mode. This external input must be validated carefully to avoid security issue.

PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.

Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Tcg2Smm.c.

Function Documentation

◆ InitializeTcgCommon()

EFI_STATUS InitializeTcgCommon ( VOID  )

The driver's common initialization routine.

It install callbacks for TPM physical presence and MemoryClear, and locate SMM variable to be used in the callback function.

Return values
EFI_SUCCESSThe entry point is executed successfully.
OthersSome error occurs when executing this entry point.

Definition at line 214 of file Tcg2Smm.c.

◆ PhysicalPresenceCallback()

EFI_STATUS EFIAPI PhysicalPresenceCallback ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *  Context,
IN OUT VOID *  CommBuffer,
IN OUT UINTN CommBufferSize 
)

Software SMI callback for TPM physical presence which is called from ACPI method.

Caution: This function may receive untrusted input. Variable and ACPINvs are external input, so this function will validate its data structure to be valid value.

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 successfully.

Definition at line 135 of file Tcg2Smm.c.

◆ TcgMmReadyToLock()

EFI_STATUS EFIAPI TcgMmReadyToLock ( 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 185 of file Tcg2Smm.c.

◆ TpmNvsCommunciate()

EFI_STATUS EFIAPI TpmNvsCommunciate ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *  RegisterContext,
IN OUT VOID *  CommBuffer,
IN OUT UINTN CommBufferSize 
)

Communication service SMI Handler entry.

This handler takes requests to exchange Mmi channel and Nvs address between MM and DXE.

Caution: This function may receive untrusted input. Communicate buffer and buffer size are external input, so this function will do basic validation.

Parameters
[in]DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
[in]RegisterContextPoints 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_UNSUPPORTEDAn unknown test function was requested.
EFI_ACCESS_DENIEDPart of the communication buffer lies in an invalid region.

Definition at line 49 of file Tcg2Smm.c.

Variable Documentation

◆ mMcSoftwareSmi

UINTN mMcSoftwareSmi

Definition at line 23 of file Tcg2Smm.c.

◆ mPpSoftwareSmi

UINTN mPpSoftwareSmi

Definition at line 22 of file Tcg2Smm.c.

◆ mReadyToLockHandle

EFI_HANDLE mReadyToLockHandle

Definition at line 24 of file Tcg2Smm.c.

◆ mSmmVariable

Definition at line 20 of file Tcg2Smm.c.

◆ mTcgNvs

TCG_NVS* mTcgNvs = NULL

Definition at line 21 of file Tcg2Smm.c.