TianoCore EDK2 master
|
#include <PiDxe.h>
#include <IndustryStandard/Tpm2Acpi.h>
#include <Guid/TpmInstance.h>
#include <Guid/TpmNvsMm.h>
#include <Guid/PiSmmCommunicationRegionTable.h>
#include <Guid/Tcg2AcpiCommunicateBuffer.h>
#include <Protocol/AcpiTable.h>
#include <Protocol/Tcg2Protocol.h>
#include <Protocol/MmCommunication.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DxeServicesLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/PrintLib.h>
#include <Library/TpmMeasurementLib.h>
#include <Library/Tpm2DeviceLib.h>
#include <Library/Tpm2CommandLib.h>
#include <Library/UefiLib.h>
#include <Library/HobLib.h>
Go to the source code of this file.
Data Structures | |
struct | EFI_TPM2_ACPI_TABLE_V4 |
Macros | |
#define | PHYSICAL_PRESENCE_VERSION_TAG "$PV" |
#define | PHYSICAL_PRESENCE_VERSION_SIZE 4 |
#define | TPM_HID_TAG "NNNN0000" |
#define | TPM_HID_PNP_SIZE 8 |
#define | TPM_HID_ACPI_SIZE 9 |
#define | TPM_PRS_RESL "RESL" |
#define | TPM_PRS_RESS "RESS" |
#define | TPM_PRS_RES_NAME_SIZE 4 |
#define | TPM_POS_RES_TEMPLATE_MIN_SIZE (1 + 1 + 2 + 12 + 5 + 2) |
#define | MAX_PRS_INT_BUF_SIZE (15*4) |
Functions | |
VOID * | AssignOpRegion (EFI_ACPI_DESCRIPTION_HEADER *Table, UINT32 Name, UINT16 Size) |
EFI_STATUS EFIAPI | ExchangeCommonBuffer (IN OUT TCG_NVS *TcgNvs) |
EFI_STATUS | UpdatePPVersion (EFI_ACPI_DESCRIPTION_HEADER *Table, CHAR8 *PPVer) |
EFI_STATUS | UpdatePossibleResource (IN OUT EFI_ACPI_DESCRIPTION_HEADER *Table, IN UINT32 *IrqBuffer, IN UINT32 IrqBuffserSize, OUT BOOLEAN *IsShortFormPkgLength) |
EFI_STATUS | UpdateHID (EFI_ACPI_DESCRIPTION_HEADER *Table) |
EFI_STATUS | PublishAcpiTable (VOID) |
EFI_STATUS | PublishTpm2 (VOID) |
EFI_STATUS EFIAPI | InitializeTcgAcpi (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
Variables | |
EFI_TPM2_ACPI_TABLE_V4 | mTpm2AcpiTemplate |
TCG_NVS * | mTcgNvs |
This driver implements TPM 2.0 definition block in ACPI table and populates registered SMI callback functions for Tcg2 physical presence and MemoryClear to handle the requests for ACPI method. It needs to be used together with Tcg2 MM drivers to exchange information on registered SwSmiValue and allocated NVS region address.
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.
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Tcg2Acpi.c.
#define MAX_PRS_INT_BUF_SIZE (15*4) |
Definition at line 75 of file Tcg2Acpi.c.
#define PHYSICAL_PRESENCE_VERSION_SIZE 4 |
Definition at line 48 of file Tcg2Acpi.c.
#define PHYSICAL_PRESENCE_VERSION_TAG "$PV" |
Definition at line 47 of file Tcg2Acpi.c.
#define TPM_HID_ACPI_SIZE 9 |
Definition at line 55 of file Tcg2Acpi.c.
#define TPM_HID_PNP_SIZE 8 |
Definition at line 54 of file Tcg2Acpi.c.
#define TPM_HID_TAG "NNNN0000" |
Definition at line 53 of file Tcg2Acpi.c.
#define TPM_POS_RES_TEMPLATE_MIN_SIZE (1 + 1 + 2 + 12 + 5 + 2) |
Definition at line 69 of file Tcg2Acpi.c.
#define TPM_PRS_RES_NAME_SIZE 4 |
Definition at line 59 of file Tcg2Acpi.c.
#define TPM_PRS_RESL "RESL" |
Definition at line 57 of file Tcg2Acpi.c.
#define TPM_PRS_RESS "RESS" |
Definition at line 58 of file Tcg2Acpi.c.
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.
[in,out] | Table | The TPM item in ACPI table. |
[in] | Name | The name string to find in TPM table. |
[in] | Size | The size of the region to find. |
Definition at line 124 of file Tcg2Acpi.c.
EFI_STATUS EFIAPI ExchangeCommonBuffer | ( | IN OUT TCG_NVS * | TcgNvs | ) |
Locate the MM communication buffer and protocol, then use it to exchange information with Tcg2StandaloneMmm on NVS address and SMI value.
[in,out] | TcgNvs | The NVS subject to send to MM environment. |
Definition at line 178 of file Tcg2Acpi.c.
EFI_STATUS EFIAPI InitializeTcgAcpi | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The driver's entry point.
It patches and installs ACPI tables used for handling TPM physical presence and Memory Clear requests through ACPI method.
[in] | ImageHandle | The firmware allocated handle for the EFI image. |
[in] | SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The entry point is executed successfully. |
Others | Some error occurs when executing this entry point. |
Definition at line 887 of file Tcg2Acpi.c.
EFI_STATUS PublishAcpiTable | ( | VOID | ) |
Initialize and publish TPM items in ACPI table.
EFI_SUCCESS | The TCG ACPI table is published successfully. |
Others | The TCG ACPI table is not published. |
Definition at line 662 of file Tcg2Acpi.c.
EFI_STATUS PublishTpm2 | ( | VOID | ) |
Publish TPM2 ACPI table
EFI_SUCCESS | The TPM2 ACPI table is published successfully. |
Others | The TPM2 ACPI table is not published. |
Definition at line 779 of file Tcg2Acpi.c.
EFI_STATUS UpdateHID | ( | EFI_ACPI_DESCRIPTION_HEADER * | Table | ) |
Patch TPM2 device HID string. The initial string tag in TPM2 ACPI table is "NNN0000".
[in,out] | Table | The TPM2 SSDT ACPI table. |
Definition at line 559 of file Tcg2Acpi.c.
EFI_STATUS UpdatePossibleResource | ( | IN OUT EFI_ACPI_DESCRIPTION_HEADER * | Table, |
IN UINT32 * | IrqBuffer, | ||
IN UINT32 | IrqBuffserSize, | ||
OUT BOOLEAN * | IsShortFormPkgLength | ||
) |
Patch interrupt resources returned by TPM _PRS. ResourceTemplate to patch is determined by input interrupt buffer size. BufferSize, PkgLength and interrupt descriptor in ByteList need to be patched
[in,out] | Table | The TPM item in ACPI table. |
[in] | IrqBuffer | Input new IRQ buffer. |
[in] | IrqBuffserSize | Input new IRQ buffer size. |
[out] | IsShortFormPkgLength | If _PRS returns Short length Package(ACPI spec 20.2.4). |
Definition at line 313 of file Tcg2Acpi.c.
EFI_STATUS UpdatePPVersion | ( | EFI_ACPI_DESCRIPTION_HEADER * | Table, |
CHAR8 * | PPVer | ||
) |
Patch version string of Physical Presence interface supported by platform. The initial string tag in TPM ACPI table is "$PV".
[in,out] | Table | The TPM item in ACPI table. |
[in] | PPVer | Version string of Physical Presence interface supported by platform. |
Definition at line 275 of file Tcg2Acpi.c.
TCG_NVS* mTcgNvs |
Definition at line 110 of file Tcg2Acpi.c.
EFI_TPM2_ACPI_TABLE_V4 mTpm2AcpiTemplate |
Definition at line 94 of file Tcg2Acpi.c.