mirror of https://github.com/acidanthera/audk.git
SecurityPkg/Tcg2Config: Remove use of IoLib
Remove the use of the IoLib and Mmioxx() calls to detect dTPM. This module calls the Tpm12DeviceLib to detect a TPM and the implementation of the Tpm12DeviceLib for dTPM performs the same Mmioxx() calls to detect a dTPM. This change makes this module more generic and portable by maximizing the use of the Tpm12DeviceLib abstraction for TPM detection. 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@19725 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
cc71e26372
commit
6d2eec0287
|
@ -4,7 +4,7 @@
|
||||||
# This module initializes TPM device type based on variable and detection.
|
# This module initializes TPM device type based on variable and detection.
|
||||||
# NOTE: This module is only for reference only, each platform should have its own setup page.
|
# NOTE: This module is only for reference only, each platform should have its own setup page.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -49,7 +49,6 @@
|
||||||
DebugLib
|
DebugLib
|
||||||
PcdLib
|
PcdLib
|
||||||
TimerLib
|
TimerLib
|
||||||
IoLib
|
|
||||||
Tpm12CommandLib
|
Tpm12CommandLib
|
||||||
Tpm12DeviceLib
|
Tpm12DeviceLib
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
TPM1.2/dTPM2.0 auto detection.
|
TPM1.2/dTPM2.0 auto detection.
|
||||||
|
|
||||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -18,7 +18,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/IoLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/PeiServicesLib.h>
|
#include <Library/PeiServicesLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
@ -28,29 +27,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
#include "Tcg2ConfigNvData.h"
|
#include "Tcg2ConfigNvData.h"
|
||||||
|
|
||||||
/**
|
|
||||||
This routine return if dTPM (1.2 or 2.0) present.
|
|
||||||
|
|
||||||
@retval TRUE dTPM present
|
|
||||||
@retval FALSE dTPM not present
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
IsDtpmPresent (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINT8 RegRead;
|
|
||||||
|
|
||||||
RegRead = MmioRead8 ((UINTN)PcdGet64 (PcdTpmBaseAddress));
|
|
||||||
if (RegRead == 0xFF) {
|
|
||||||
DEBUG ((EFI_D_ERROR, "DetectTpmDevice: Dtpm not present\n"));
|
|
||||||
return FALSE;
|
|
||||||
} else {
|
|
||||||
DEBUG ((EFI_D_INFO, "DetectTpmDevice: Dtpm present\n"));
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine check both SetupVariable and real TPM device, and return final TpmDevice configuration.
|
This routine check both SetupVariable and real TPM device, and return final TpmDevice configuration.
|
||||||
|
|
||||||
|
@ -100,10 +76,6 @@ DetectTpmDevice (
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((EFI_D_INFO, "DetectTpmDevice:\n"));
|
DEBUG ((EFI_D_INFO, "DetectTpmDevice:\n"));
|
||||||
if (!IsDtpmPresent ()) {
|
|
||||||
// dTPM not available
|
|
||||||
return TPM_DEVICE_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// dTPM available and not disabled by setup
|
// dTPM available and not disabled by setup
|
||||||
// We need check if it is TPM1.2 or TPM2.0
|
// We need check if it is TPM1.2 or TPM2.0
|
||||||
|
@ -111,7 +83,10 @@ DetectTpmDevice (
|
||||||
|
|
||||||
Status = Tpm12RequestUseTpm ();
|
Status = Tpm12RequestUseTpm ();
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return TPM_DEVICE_2_0_DTPM;
|
//
|
||||||
|
// dTPM not available
|
||||||
|
//
|
||||||
|
return TPM_DEVICE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BootMode == BOOT_ON_S3_RESUME) {
|
if (BootMode == BOOT_ON_S3_RESUME) {
|
||||||
|
|
Loading…
Reference in New Issue