SecurityPkg/TcgDxe: Replace TpmCommLib with Tpm12DeviceLib

Update TCG drivers for TPM 1.2 devices to use Tpm12DeviceLib instead
of TpmCommLib.  This is required to support TPM 1.2 hardware devices
that are not on LPC bus.

The current versions of the TCG PEIM and DXE driver contain
MMIO reads/writes to a TPM attached to an LPC bus.  In order
to support TPMs that are connected to other bus types, the
TGC PEIM and DXE drivers must be updated to not perform any
direct register accesses to any TPMs.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19722 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Michael Kinney
2016-01-21 19:29:28 +00:00
committed by mdkinney
parent b558f8bceb
commit 7cb1b15bea
5 changed files with 82 additions and 191 deletions

View File

@@ -46,7 +46,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/TpmCommLib.h>
#include <Library/Tpm12DeviceLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiLib.h>
#include <Library/ReportStatusCodeLib.h>
@@ -63,7 +63,6 @@ typedef struct _TCG_DXE_DATA {
EFI_TCG_SERVER_ACPI_TABLE *TcgServerAcpiTable;
UINTN EventLogSize;
UINT8 *LastEvent;
TIS_TPM_HANDLE TpmHandle;
} TCG_DXE_DATA;
@@ -114,7 +113,7 @@ EFI_TCG_SERVER_ACPI_TABLE mTcgServerAcpiTemplate = {
0,
0,
EFI_ACPI_3_0_BYTE,
TPM_BASE_ADDRESS // Base Address
0 // Base Address
},
0, // Reserved
{0}, // Configuration Address
@@ -455,7 +454,6 @@ TcgDxePassThroughToTpm (
TcgData = TCG_DXE_DATA_FROM_THIS (This);
return TisPcExecute (
TcgData->TpmHandle,
"%r%/%r",
TpmInputParameterBlock,
(UINTN) TpmInputParameterBlockSize,
@@ -509,7 +507,6 @@ TcgDxeHashLogExtendEventI (
}
Status = TpmCommExtend (
TcgData->TpmHandle,
&NewEventHdr->Digest,
NewEventHdr->PCRIndex,
NULL
@@ -623,7 +620,6 @@ TCG_DXE_DATA mTcgDxeData = {
&mTcgClientAcpiTemplate,
&mTcgServerAcpiTemplate,
0,
NULL,
NULL
};
@@ -1183,6 +1179,7 @@ InstallAcpiTable (
Checksum = CalculateCheckSum8 ((UINT8 *)&mTcgServerAcpiTemplate, sizeof (mTcgServerAcpiTemplate));
mTcgServerAcpiTemplate.Header.Checksum = Checksum;
mTcgServerAcpiTemplate.BaseAddress.Address = PcdGet64 (PcdTpmBaseAddress);
Status = AcpiTable->InstallAcpiTable (
AcpiTable,
&mTcgServerAcpiTemplate,
@@ -1282,7 +1279,6 @@ GetTpmStatus (
TPM_STCLEAR_FLAGS VFlags;
Status = TpmCommGetFlags (
mTcgDxeData.TpmHandle,
TPM_CAP_FLAG_VOLATILE,
&VFlags,
sizeof (VFlags)
@@ -1327,8 +1323,7 @@ DriverEntry (
return EFI_DEVICE_ERROR;
}
mTcgDxeData.TpmHandle = (TIS_TPM_HANDLE)(UINTN)TPM_BASE_ADDRESS;
Status = TisPcRequestUseTpm (mTcgDxeData.TpmHandle);
Status = Tpm12RequestUseTpm ();
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TPM not detected!\n"));
return Status;