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

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI PhysicalPresenceCallback (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize)
 
EFI_STATUS EFIAPI MemoryClearCallback (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize)
 
VOID * AssignOpRegion (EFI_ACPI_DESCRIPTION_HEADER *Table, UINT32 Name, UINT16 Size)
 
EFI_STATUS PublishAcpiTable (VOID)
 
EFI_STATUS EFIAPI InitializeTcgSmm (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_SMM_VARIABLE_PROTOCOLmSmmVariable
 
TCG_NVSmTcgNvs
 

Detailed Description

It updates TPM items in ACPI table and registers SMI callback functions for physical presence and ClearMemory.

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) 2011 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file TcgSmm.c.

Function Documentation

◆ AssignOpRegion()

VOID * AssignOpRegion ( EFI_ACPI_DESCRIPTION_HEADER Table,
UINT32  Name,
UINT16  Size 
)

Find the operation region in TCG ACPI table by given Name and Size, and initialize it if the region is found.

Parameters
[in,out]TableThe TPM item in ACPI table.
[in]NameThe name string to find in TPM table.
[in]SizeThe size of the region to find.
Returns
The allocated address for the found region.

Definition at line 313 of file TcgSmm.c.

◆ InitializeTcgSmm()

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

The driver's entry point.

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

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.
OthersSome error occurs when executing this entry point.

Definition at line 426 of file TcgSmm.c.

◆ MemoryClearCallback()

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

Software SMI callback for MemoryClear 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 245 of file TcgSmm.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 40 of file TcgSmm.c.

◆ PublishAcpiTable()

EFI_STATUS PublishAcpiTable ( VOID  )

Initialize and publish TPM items in ACPI table.

Return values
EFI_SUCCESSThe TCG ACPI table is published successfully.
OthersThe TCG ACPI table is not published.

Definition at line 357 of file TcgSmm.c.

Variable Documentation

◆ mSmmVariable

Definition at line 18 of file TcgSmm.c.

◆ mTcgNvs

TCG_NVS* mTcgNvs

Definition at line 19 of file TcgSmm.c.