From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.14705.1679711850010700558 for ; Fri, 24 Mar 2023 19:37:30 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=JsFSMBGJ; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: jiewen.yao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679711850; x=1711247850; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=WUxM6ujrbY9fuJh+O3quE2OfSYf2ph3lOuxAw6izdBs=; b=JsFSMBGJdl76mhhQNsKKOeTTylb5ke7WvfOIigY7ZwpepWF3fI2IYpMC I/oBS6SZjSLxwmC2AVHcSJwJgRcz5h3GKucohaD4Oju8msfl9Xg9r6div QKzQ6RNyNTlRBRdoAy7OCkma48vGAKFwiP6w6AAYJhOOxKBRUSLXHEWQM XT9RKwwm7gsVVHKWQ4CxNY0KVBZfcFbhOPF/NuXIRr+T/JO0an1hmFbdH RI2uCwftKEF4D1UoCD89ayN3tX1AX1XR4HORXsQj7IgqSbhqSXZbgC3GH 5QW7s6U+bxoa8Vc35IKQZzXekQcUacgCp95g8RTlmrhqHwmr7vRbL40vK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10659"; a="426189112" X-IronPort-AV: E=Sophos;i="5.98,289,1673942400"; d="scan'208";a="426189112" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2023 19:37:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10659"; a="682883392" X-IronPort-AV: E=Sophos;i="5.98,289,1673942400"; d="scan'208";a="682883392" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga002.jf.intel.com with ESMTP; 24 Mar 2023 19:37:21 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 24 Mar 2023 19:37:21 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Fri, 24 Mar 2023 19:37:21 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.171) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Fri, 24 Mar 2023 19:37:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MohCUYOQ2aDMmGDuq+orf8GKs9LsrMgRWF/PYLKS2VMf4mccspLWCD9PO8SDniZl5rYZ2ZDZ5UJFTz5A6yHqwehyhWOQjYF+Tn7zB0LnjMWyYog22A0hNZRF5oxOlAV4UffjIBdQs5tpgaYqopPQl672Xec+KBEVL+v5hvv0PF5NQX1dK11gF2jymZt+woq2EM6vH49VPBpa9MWi2rwz/j98zi5LWwHK4Axcm8aRS7/Pr36jOHq8y0jyp2q/0ZOE28B55Wmqm9rDn0t0HsvJbe0hjwLOy52qkldJJQiHtPSh5efwEP+qTvUdpHBXQxp9yreN6Q9AXViQAsLmyedQlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T9Y3i93nFovz3oEkE9CSc/LE48CuTktuUE/6tlBAA28=; b=BwnUkdGkr34AzCtUkxjGIX0eEXTp2gXamWfUhilPCpcoRExu7f3RIYmXddbNSE7PC3B24B+KT0o14vsSvjfy1iitv8CKp83ayZudo4phejdg9xPP/dNv7oXOjT0/1232LkbVR3Ck0VtZBekFesfeT5qMgKv/7xFu5aup2qIQIWWT4gF9sWI6KOS29xq57FxWS6uQIcrSsfXfjXuImDpJLe0ofdr7TMIy+FrcUSH4U4sXsKb9ho2efmXI7opYTB3HFtBEPHgThDIYA9QfEUuSEmVkTwaCch85OmppIgvo1jh3keBPFaUWuu0X+MmQQK1INPTkDg8u2DHAVndfZ+WL2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by SN7PR11MB6972.namprd11.prod.outlook.com (2603:10b6:806:2ac::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Sat, 25 Mar 2023 02:36:58 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::c0c0:4b46:1dd4:80d6]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::c0c0:4b46:1dd4:80d6%5]) with mapi id 15.20.6178.037; Sat, 25 Mar 2023 02:36:58 +0000 From: "Yao, Jiewen" To: "Lakkimsetti, Subash" , "devel@edk2.groups.io" CC: "Zhang, Qi1" , "Kumar, Rahul R" Subject: Re: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI if present Thread-Topic: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI if present Thread-Index: AQHZXMPYMG43trHrJkuXyyadFfNGwa8GzsLggAD6EwCAAwEkkA== Date: Sat, 25 Mar 2023 02:36:57 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5872:EE_|SN7PR11MB6972:EE_ x-ms-office365-filtering-correlation-id: ac17a007-5b0b-4496-be74-08db2cd9ce06 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BDL/3QJHe5zofEc/MZt/twleBI5v9XAg9zrV8qwgGPhKhtYzALfdbOEI1gnMy8s6eoJ767o+YgXnWt5Mf5RJ3bdqneEKFyP4WEi6h26g+zr4Buu2LOIt9OhsnmD1VPQYgjSe9h4ifSeKXKQirHzH0CHdimkVApx3lvHZz08WvlT3xyjKr/4YYypTuUe3N/fGQ+AcCbMG/pnoHCSnPRQV5xsGaKsiSP1mIvLw2FI7qTdhynkSHwnuF0ajMzh989pt/J1uvcVtcvHOGqxyEvzTbWbp2WK+WE+IcVnLT3iVMEjkOSD7o65ZpFXYgV3wTS9oXmIPa8Rz9pKULiaKj5S4zAc6XG3hv+JBFa6qOKyCy38a18tevKHm560CzPUTGALbGyEE61uL/RZrBIGU4hemiJSnjYacLCAogDQ3w7hX5goPuqkS9Hq///ZewQswW2Ap3462wSUJsMoGkMy0KKzvkxxYnqitFgz6KBLS0w25Z0kMmKTJ9j2y9LNvd+whOErTR+Y2Wr3yKOBlGmhfc2LXyogsgwio6OLgs2vw+8rRxG69qtqbYuWNipv6YOowY7Oyvw7LFnjvWiV0y0WAnu3EXBcwRc7NdmtLMW4Z1wZBS8rqJ1OW6j/ACCyeNO1y/qrJiLVxcXhb8kEUhjDlcIB4Bw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5872.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(346002)(366004)(376002)(136003)(396003)(451199021)(66899021)(54906003)(5660300002)(8676002)(478600001)(966005)(122000001)(7696005)(110136005)(2906002)(107886003)(30864003)(6506007)(71200400001)(316002)(19627235002)(86362001)(38070700005)(64756008)(82960400001)(9686003)(66476007)(52536014)(66946007)(186003)(53546011)(38100700002)(26005)(66446008)(41300700001)(76116006)(8936002)(33656002)(66556008)(83380400001)(4326008)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?q+R2srXPOdKZbseGWyTjthf4DoYlNpbYJjdMZ5Sdi/noWYWJfnjWwiVlYhED?= =?us-ascii?Q?NLF3o4acKBEgmvaqL+PPq7QnVcT/5YYUEZrw5Z0fV/98f2ZDVSoNxwJ0x5/b?= =?us-ascii?Q?AC1LSDsXXu1PQkWtAwE51UOrF1bTvtITfNRipFFPkPuZ/K7Q16nmsnWv+9vk?= =?us-ascii?Q?6IHdymnUEBK49VxQqjVGfHzpEw2z/9A9Wtrvo1Uxpbs1AXx/sm0rkLnuR/24?= =?us-ascii?Q?iIeUWURYMmx6I87KEU5Nj30/o8PpF6BWKbSyhzgeYe3wNFhHCKQ7PWRwQWmO?= =?us-ascii?Q?VVaQQFFd0lsDzAe4mHmPi6B8JzyFybLJkyMjGqhbowR2xvcxfLWA9YF8ohbx?= =?us-ascii?Q?bFJfH4GnW9oJcP3rKq4mq0Y0tjvDTHZRL6dQCDgldqXy/XO9dXQnzBPLumk+?= =?us-ascii?Q?Qv2CyAhVhkJpu9J/RjsjCAgqgh5lZlpY0hmrDcFu88xeNilwMjl+TVjupWX7?= =?us-ascii?Q?Yo1nmiQ8yyLZtdZyQaP1h9LWYrgfc/fgT/ga/MdCS2efi2rLnxddH0q6I82w?= =?us-ascii?Q?obwO9WfimcFoP370CySd9FmyjKjGzu2N8SSlRkT+iLfXqJpRexZSBd+KXHd9?= =?us-ascii?Q?Y3TAcYixwzzXa2uE3DV3u13vETbdh6e3TGI6jUWHJDr5CqW/DKM9L+ORl0kc?= =?us-ascii?Q?GFebSUO4qEb21jXK9cAPXJx+JpjftruoLjps3wH3svMkgKdQCDQCkhrSy7bx?= =?us-ascii?Q?tcyszZ/anAKU7b/hrRnvXhzrvtFCmDHxgbObkQ3bwV0/Y9NOWyDeMhwk3Tap?= =?us-ascii?Q?SX7yg0nWqi8OMKq1qWg4Ef+9LE9IajHOfbrg2C10x6wONEzcB85yC30d1mTo?= =?us-ascii?Q?Ykkckv2xLJMgw0gBTXfJOjvEVE4FkjriRAgZQPvxrMsC6wRdyR+DU/vri69G?= =?us-ascii?Q?tJvwRIzDv8TBxe5wt2BDNwrLSh8nj49BQtI3gS/AVUViArX2MHF0f2wd09hH?= =?us-ascii?Q?9mjhVpEjKOgHOUg2c+yfLl+swy/f1t0JBJCJQIUQXAn5d4CvqxT+fhSPZRTN?= =?us-ascii?Q?zUu6tKDklqn44FbQ3P6jj9fZY37HfAMlsaR348lXk3Yfz1KTLgsbXTuo/mGm?= =?us-ascii?Q?DMvBAe5yD4gwDOd4U2/ubO77dFExdIA/79DVHNXpRsPaB2z5O6IEOev1XC1n?= =?us-ascii?Q?JRV8nOPYQeFwjc09OlWTmdLzUk5kV28GCKpXa00Snqd3JXkL3ykD3/g7icwA?= =?us-ascii?Q?W8PLePbwvHeMS8e8958orn9fxC5vfoqbG9fnxhlBo/Wh0peN3361TCoz759Q?= =?us-ascii?Q?6KvkntpOjH8ApTIsBBL2jCqGTi2QhnbEFMTY1wu0xXfNvqtle/CHyUmhQHIN?= =?us-ascii?Q?fAR7s8j3fp2cldoew0JrLUDVKq3cgwngA+wczroWKC/WPoYDpXooPXM479eV?= =?us-ascii?Q?T7x0/TLQdCpyi2KkeeJNLGohEMZ7PLztVMz6Q8Nw1Qpv93k4XDebhseZ+LTV?= =?us-ascii?Q?SSZau61JyB4G1rjZAPIZbzGc+hjAi6bB6WqpP8ATQzP1B6wupQupDYJbdOPq?= =?us-ascii?Q?cye80b41C1dYcrbnoLG0pgPNVBZbb2MW/2+pOL7yZ+jsnxKGuQc917HVjQ2z?= =?us-ascii?Q?fWpMCBQHUV7ZtsOM/Dykl/5BIfqs7Z9HDKwSKe4s?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac17a007-5b0b-4496-be74-08db2cd9ce06 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2023 02:36:57.8505 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pNxc1aaxxs2yjNZVFsQa2W0dxL4cYMiSQ2c8txqvx8xYaDMTcdmyaz7I18zwSChY6lj86IBO7TqM1oUBnMA+Rw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6972 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable If there are two drivers to produce same resource, it should be a platform = policy decision for which one takes precedent. Maybe a platform wants to say: The ACPI is there, I want to skip myself, in= stead of override. I feel uncomfortable to include such policy in TCG2 ACPI driver, to enforce= the policy to override. My suggestion is to keep SecurityPkg as is. Yes, coreboot and slimboot will populate ACPI table. But it does not mean U= niversalPayloadPkg must install them. I still believe that work should be d= one in UniversalPayloadPkg. > -----Original Message----- > From: Lakkimsetti, Subash > Sent: Thursday, March 23, 2023 12:38 PM > To: Yao, Jiewen ; devel@edk2.groups.io > Cc: Zhang, Qi1 ; Kumar, Rahul R > > Subject: RE: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACP= I > if present >=20 > Hi Jiewen, >=20 > Bootloaders as SBL, coreboot supports multiple payloads and they would > have TPM acpi tables populated at bootloader phase. > These tables gets populated in bootloaders well before the payload gets > loaded. Its population cannot be avoided due to generic implementations. >=20 > Uninstallation from universal payload package need a separate module to > handle this. > It is dependent on gEfiAcpiTableProtocolGuid & gEfiAcpiSdtProtocolGuid > which are populated from AcpiTableDxe. >=20 > We might need add a dependency in TCG2ACPI on this module. Otherwise > TPM2tables published from TCG2ACPI can be installed as per the dispatch > order. >=20 > In order to adapt the TCG drivers for UEFI payload, TCG2ACPI has to updat= ed > to support payload. We can either follow one of the methods, > * Uninstall the TPM2 ACPI tables if they get published from bootloader > phase. The current patch address it. > * Another method, Modify the ACPI tables updated from bootloader as > per the EDK2 requirements. This also has to be done in TCG2ACPI. >=20 > Regards, > Subash >=20 > -----Original Message----- > From: Yao, Jiewen > Sent: Wednesday, March 22, 2023 6:43 AM > To: devel@edk2.groups.io; Lakkimsetti, Subash > > Cc: Zhang, Qi1 ; Kumar, Rahul R > > Subject: RE: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACP= I > if present >=20 > Question: Why not uninstall it in the universal payload package? or even = not > populate it? >=20 >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Subash > > Lakkimsetti > > Sent: Wednesday, March 22, 2023 1:59 PM > > To: devel@edk2.groups.io > > Cc: Lakkimsetti, Subash ; Zhang, Qi1 > > ; Kumar, Rahul R > > Subject: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI > > if present > > > > From: Subash Lakkimsetti > > > > Bootloader supports multiple payload and TPM2 ACPI tables are updated > > at bootloader phase. When UEFI is used payload these will be duplicates= . > > The tables are to be uninstalled before updating the TCG2ACPI tables > > to avoid duplicates. > > > > Cc: Qi Zhang > > Cc: Rahul Kumar > > Signed-off-by: Subash Lakkimsetti > > --- > > SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c | 251 > > ++++++++++++++++++++++++++ > > SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf | 3 + > > 2 files changed, 254 insertions(+) > > > > diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c > > b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c > > index e8822cbeb0..4b35796ba7 100644 > > --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c > > +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c > > @@ -39,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > #include > > > > #include > > > > #include > > > > +#include > > > > +#include > > > > > > > > // > > > > // Physical Presence Interface Version supported by Platform > > > > @@ -867,6 +869,245 @@ PublishTpm2 ( > > return Status; > > > > } > > > > > > > > +/** > > > > + Uninstall TPM2 SSDT ACPI table > > > > + > > > > + This performs uninstallation of TPM2 SSDT tables published by > > > > + bootloaders. > > > > + > > > > + @retval EFI_SUCCESS The TPM2 ACPI table is uninstalled success= fully > if > > found. > > > > + @retval Others Operation error. > > > > + > > > > +**/ > > > > +EFI_STATUS > > > > +UnInstallTpm2SSDTAcpiTables ( > > > > + ) > > > > +{ > > > > + UINTN TableIndex; > > > > + UINTN TableKey; > > > > + EFI_ACPI_TABLE_VERSION TableVersion; > > > > + VOID *TableHeader; > > > > + EFI_STATUS Status; > > > > + EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol; > > > > + EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol; > > > > + CHAR8 TableIdString[8]; > > > > + UINT64 TableIdSignature; > > > > + > > > > + // > > > > + // Determine whether there is a TPM2 SSDT already in the ACPI table. > > > > + // > > > > + Status =3D EFI_SUCCESS; > > > > + TableIndex =3D 0; > > > > + TableKey =3D 0; > > > > + TableHeader =3D NULL; > > > > + mAcpiTableProtocol =3D NULL; > > > > + mAcpiSdtProtocol =3D NULL; > > > > + > > > > + // > > > > + // Locate the EFI_ACPI_TABLE_PROTOCOL. > > > > + // > > > > + Status =3D gBS->LocateProtocol ( > > > > + &gEfiAcpiTableProtocolGuid, > > > > + NULL, > > > > + (VOID **)&mAcpiTableProtocol > > > > + ); > > > > + if (EFI_ERROR (Status)) { > > > > + DEBUG (( > > > > + DEBUG_INFO, > > > > + "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Table > > Protocol \n " > > > > + )); > > > > + return Status; > > > > + } > > > > + > > > > + // > > > > + // Locate the EFI_ACPI_SDT_PROTOCOL. > > > > + // > > > > + Status =3D gBS->LocateProtocol ( > > > > + &gEfiAcpiSdtProtocolGuid, > > > > + NULL, > > > > + (VOID **)&mAcpiSdtProtocol > > > > + ); > > > > + if (EFI_ERROR (Status)) { > > > > + DEBUG (( > > > > + DEBUG_INFO, > > > > + "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Sdt > > + Protocol, > > " > > > > + "\n" > > > > + )); > > > > + return Status; > > > > + } > > > > + > > > > + while (!EFI_ERROR (Status)) { > > > > + Status =3D mAcpiSdtProtocol->GetAcpiTable ( > > > > + TableIndex, > > > > + (EFI_ACPI_SDT_HEADER > > + **)&TableHeader, > > > > + &TableVersion, > > > > + &TableKey > > > > + ); > > > > + > > > > + if (!EFI_ERROR (Status)) { > > > > + TableIndex++; > > > > + > > > > + if (((EFI_ACPI_SDT_HEADER *)TableHeader)->Signature =3D=3D > > SIGNATURE_32 ('S', 'S', 'D', 'T')) { > > > > + CopyMem ((VOID *)TableIdString, (VOID *)((EFI_ACPI_SDT_HEADER > > *)TableHeader)->OemTableId, sizeof (TableIdString)); > > > > + > > > > + TableIdSignature =3D SIGNATURE_64 ( > > > > + TableIdString[0], > > > > + TableIdString[1], > > > > + TableIdString[2], > > > > + TableIdString[3], > > > > + TableIdString[4], > > > > + TableIdString[5], > > > > + TableIdString[6], > > > > + TableIdString[7] > > > > + ); > > > > + > > > > + if (TableIdSignature =3D=3D SIGNATURE_64 ('T', 'p', 'm', '2', > > + 'T', 'a', 'b', 'l')) { > > > > + DEBUG ((DEBUG_INFO, "Found Tpm2 SSDT Table for Physical > > Presence\n")); > > > > + break; > > > > + } > > > > + } > > > > + } > > > > + } > > > > + > > > > + if (!EFI_ERROR (Status)) { > > > > + // > > > > + // A TPM2 SSDT is already in the ACPI table. > > > > + // > > > > + DEBUG (( > > > > + DEBUG_INFO, > > > > + "A TPM2 SSDT is already exist in the ACPI Table.\n" > > > > + )); > > > > + > > > > + // > > > > + // Uninstall the origin TPM2 SSDT from the ACPI table. > > > > + // > > > > + Status =3D mAcpiTableProtocol->UninstallAcpiTable ( > > > > + mAcpiTableProtocol, > > > > + TableKey > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + if (EFI_ERROR (Status)) { > > > > + DEBUG ((DEBUG_INFO, "UnInstall Tpm2SSDTAcpiTables failed \n > > + ")); > > > > + > > > > + return Status; > > > > + } > > > > + } > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > + > > > > +/** > > > > + Uninstall TPM2 table > > > > + > > > > + This performs uninstallation of TPM2 tables published by > > > > + bootloaders. > > > > + > > > > + @retval EFI_SUCCESS The TPM2 table is uninstalled successfully= if its > > found. > > > > + @retval Others Operation error. > > > > + > > > > +**/ > > > > +EFI_STATUS > > > > +UnInstallTpm2Tables ( > > > > + ) > > > > +{ > > > > + UINTN TableIndex; > > > > + UINTN TableKey; > > > > + EFI_ACPI_TABLE_VERSION TableVersion; > > > > + VOID *TableHeader; > > > > + EFI_STATUS Status; > > > > + EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol; > > > > + EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol; > > > > + > > > > + // > > > > + // Determine whether there is a TPM2 SSDT already in the ACPI table. > > > > + // > > > > + Status =3D EFI_SUCCESS; > > > > + TableIndex =3D 0; > > > > + TableKey =3D 0; > > > > + TableHeader =3D NULL; > > > > + mAcpiTableProtocol =3D NULL; > > > > + mAcpiSdtProtocol =3D NULL; > > > > + > > > > + // > > > > + // Locate the EFI_ACPI_TABLE_PROTOCOL. > > > > + // > > > > + Status =3D gBS->LocateProtocol ( > > > > + &gEfiAcpiTableProtocolGuid, > > > > + NULL, > > > > + (VOID **)&mAcpiTableProtocol > > > > + ); > > > > + if (EFI_ERROR (Status)) { > > > > + DEBUG (( > > > > + DEBUG_INFO, > > > > + "UnInstallTpm2Tables: Cannot locate the EFI ACPI Table Protocol = \n " > > > > + )); > > > > + return Status; > > > > + } > > > > + > > > > + // > > > > + // Locate the EFI_ACPI_SDT_PROTOCOL. > > > > + // > > > > + Status =3D gBS->LocateProtocol ( > > > > + &gEfiAcpiSdtProtocolGuid, > > > > + NULL, > > > > + (VOID **)&mAcpiSdtProtocol > > > > + ); > > > > + if (EFI_ERROR (Status)) { > > > > + DEBUG (( > > > > + DEBUG_INFO, > > > > + "UnInstallTpm2Tables: Cannot locate the EFI ACPI Sdt Protocol, " > > > > + "\n" > > > > + )); > > > > + return Status; > > > > + } > > > > + > > > > + while (!EFI_ERROR (Status)) { > > > > + Status =3D mAcpiSdtProtocol->GetAcpiTable ( > > > > + TableIndex, > > > > + (EFI_ACPI_SDT_HEADER > > + **)&TableHeader, > > > > + &TableVersion, > > > > + &TableKey > > > > + ); > > > > + > > > > + if (!EFI_ERROR (Status)) { > > > > + TableIndex++; > > > > + > > > > + if (((EFI_ACPI_SDT_HEADER *)TableHeader)->Signature =3D=3D > > EFI_ACPI_5_0_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE ) > { > > > > + DEBUG ((DEBUG_INFO, "Found Tpm2 Table ..\n")); > > > > + break; > > > > + } > > > > + } > > > > + } > > > > + > > > > + if (!EFI_ERROR (Status)) { > > > > + // > > > > + // A TPM2 SSDT is already in the ACPI table. > > > > + // > > > > + DEBUG (( > > > > + DEBUG_INFO, > > > > + "A TPM2 table is already exist in the ACPI Table.\n" > > > > + )); > > > > + > > > > + // > > > > + // Uninstall the origin TPM2 SSDT from the ACPI table. > > > > + // > > > > + Status =3D mAcpiTableProtocol->UninstallAcpiTable ( > > > > + mAcpiTableProtocol, > > > > + TableKey > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + if (EFI_ERROR (Status)) { > > > > + DEBUG ((DEBUG_INFO, "UnInstall Tpm2Tables failed \n ")); > > > > + > > > > + return Status; > > > > + } > > > > + } > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > + > > > > /** > > > > The driver's entry point. > > > > > > > > @@ -894,6 +1135,16 @@ InitializeTcgAcpi ( > > return EFI_UNSUPPORTED; > > > > } > > > > > > > > + // > > > > + // Bootloader might pulish the TPM2 ACPT tables > > > > + // Uninstall TPM tables if it exists > > > > + // > > > > + Status =3D UnInstallTpm2SSDTAcpiTables (); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + Status =3D UnInstallTpm2Tables (); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > Status =3D PublishAcpiTable (); > > > > ASSERT_EFI_ERROR (Status); > > > > > > > > diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf > > b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf > > index f1c6ae5b1c..7e639b0522 100644 > > --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf > > +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf > > @@ -63,10 +63,13 @@ > > gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRO= DUCES > > ## GUID # TPM device identifier > > > > gTpmNvsMmGuid ## CON= SUMES > > > > gEdkiiPiSmmCommunicationRegionTableGuid ## CON= SUMES > > > > + gEfiAcpiTableGuid > > > > > > > > [Protocols] > > > > gEfiAcpiTableProtocolGuid ## CON= SUMES > > > > gEfiMmCommunicationProtocolGuid ## CON= SUMES > > > > + gEfiAcpiSdtProtocolGuid ## CONSUMES > > > > + > > > > > > > > [FixedPcd] > > > > gEfiSecurityPkgTokenSpaceGuid.PcdSmiCommandIoPort ## > > CONSUMES > > > > -- > > 2.39.1.windows.1 > > > > > > > > -=3D-=3D-=3D-=3D-=3D-=3D > > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#101580): > > https://edk2.groups.io/g/devel/message/101580 > > Mute This Topic: https://groups.io/mt/97777996/1772286 > > Group Owner: devel+owner@edk2.groups.io > > Unsubscribe: https://edk2.groups.io/g/devel/unsub > > [jiewen.yao@intel.com] -=3D-=3D-=3D-=3D-=3D-=3D > >