From ce256e9ca87aa49192b8059ab4a58ae6460b817d Mon Sep 17 00:00:00 2001 From: "Zhang, Chao B" Date: Wed, 4 Jan 2017 10:29:28 +0800 Subject: SecurityPkg: Tcg2Smm: Update HID patch logic Update HID patch logic. NOOP in ASL template may cause syntax error when disassembled and recompiled. Cc: Long Qin Cc: Yao Jiewen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang Reviewed-by: Long Qin Reviewed-by: Yao Jiewen Conflicts: SecurityPkg/Tcg/Tcg2Smm/Tpm.asl --- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 9 +++++---- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h | 4 ++-- SecurityPkg/Tcg/Tcg2Smm/Tpm.asl | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c index 6b0821f..b62961a 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -9,7 +9,7 @@ PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check. -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 @@ -321,7 +321,6 @@ UpdateHID ( // Initialize HID with Default PNP string // ZeroMem(HID, TPM_HID_ACPI_SIZE); - CopyMem(HID, TPM_HID_TAG, TPM_HID_PNP_SIZE); // // Get Manufacturer ID @@ -381,10 +380,12 @@ UpdateHID ( if (AsciiStrCmp((CHAR8 *)DataPtr, TPM_HID_TAG) == 0) { if (PnpHID) { CopyMem(DataPtr, HID, TPM_HID_PNP_SIZE); - } else { // - // NOOP will be patched to '\0' + // if HID is PNP ID, patch the last byte in HID TAG to Noop // + *(DataPtr + TPM_HID_PNP_SIZE) = AML_NOOP_OP; + } else { + CopyMem(DataPtr, HID, TPM_HID_ACPI_SIZE); } DEBUG((EFI_D_INFO, "TPM2 ACPI _HID updated to %a\n", HID)); diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h index 37f414c..4a7bf68 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h @@ -1,7 +1,7 @@ /** @file The header file for Tcg2 SMM driver. -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 @@ -97,7 +97,7 @@ typedef struct { // // PNP _HID for TPM2 device // -#define TPM_HID_TAG "NNN0000" +#define TPM_HID_TAG "NNNN0000" #define TPM_HID_PNP_SIZE 8 #define TPM_HID_ACPI_SIZE 9 diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl index 8cc80b7..745f22c 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl +++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl @@ -2,7 +2,7 @@ The TPM2 definition block in ACPI table for TCG2 physical presence and MemoryClear. -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 @@ -29,11 +29,11 @@ DefinitionBlock ( // // TCG2 // - Name (_HID, "NNN0000") + // - // Reserve 1 more byte for ACPI HID + // TAG for patching TPM2.0 _HID // - Noop + Name (_HID, "NNNN0000") Name (_CID, "MSFT0101") -- cgit v1.1