From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.12737.1683713516044746980 for ; Wed, 10 May 2023 03:11:56 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=bg/wtMPF; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: vincentx.ke@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683713516; x=1715249516; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=THAB2unjbfgFAd1H2Tou/8C+vHnyoVoRQryBvK44Q9Q=; b=bg/wtMPFWbKghTokp9gYuaWXHXVhkkX/HweHjhSjUOXwSrnzQBe+YKn5 V+WFh0ddpoCzVKLTCPcrcGFFAVG8ahHpz1OFORSr8EPwrJM3+u7woN1eY mXDzVLw0kv3eOIcHdq3+1xjth4lhZFk7AoxHrtMXOqjP4WkWqFAsC+G6T q/jhpLHo2DACBFCY12IsqyUk15EblLbejEfUmEjnOH/FmCJA6rFFeuaS+ aPA5t8+pEb2QhsxlGzd8Cw4XceR2Y/+dr/Jk9sy4hj3vJBhFV4qP4BC/B whdzzBmKI/a+JMBIfQhrGUuO4IbRqB7o1DxG1BZrBRnOreAO/3aGBmOsP A==; X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="349008729" X-IronPort-AV: E=Sophos;i="5.99,264,1677571200"; d="scan'208";a="349008729" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2023 03:11:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="702207572" X-IronPort-AV: E=Sophos;i="5.99,264,1677571200"; d="scan'208";a="702207572" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga007.fm.intel.com with ESMTP; 10 May 2023 03:11:53 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 03:11:52 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 03:11:52 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Wed, 10 May 2023 03:11:52 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.106) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Wed, 10 May 2023 03:11:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iALd7UVNILm8GNoGQRwGjlKWC/31dL09bzMuAlv0Fk85i16MUw70McTnmksXYbO1RRSkkqCxAEWh6d6cGjCOWm1RmMYTi2M1Qf+2RwprjE4ggC/iQCSOTwwZG4ZD03De0FpM2aki6xhbdixHSM9J/b1emmib3KqUJPeo7k+CypwTxubgsG3o4HBgZfWNP3inOisvTyQLS7TUErtvvZGmf9ujddCoCz1l2/m9x0oXLNQqv+3hRyqNUzfF+fwgZOQZq1w6DPl0qSFQasq3IglqLhIeP4uWJ30t8XfBnisQBjVHG87iZqyJXIgQe0iM4e5il6FHBqtspKMatS7V9P842A== 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=Vy47oGRjv8nAU68hqD21Yy/HEWsLDIe/bjMmRj7T6RQ=; b=LwnGYIT+xmCxmix+q2Xg2+JbfxKt43UT4ppjIz73G5r2igR0XOKKZC7PTBropld6Y8MmtdgTdRUbIHhYITdxLcuqDMwhKQW3VOXg0TRPx0m6YaMo8h05QKb1/UfSyFFL8LRL0M96CYZjb+cdqC/SlRdAOuMBvoVxuYxVIQRZ2mZsIvQ+HwDij7T6AldRxwpOLy64ApmSLJ6Wzrt/r/5q+bRr8COpSZstqL3AtFqMp/F6w4XHV0co0kms50iblxDGahGpwS90lqMDuJ5kCsZhC/kYzJ33JeKc8s5tZm6h7kjmLnHNE6QJIc95T0iYfzsuh9pqS7L97BUL0aQfysN2Ug== 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 DM4PR11MB5487.namprd11.prod.outlook.com (2603:10b6:5:39f::22) by CH0PR11MB5235.namprd11.prod.outlook.com (2603:10b6:610:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Wed, 10 May 2023 10:11:49 +0000 Received: from DM4PR11MB5487.namprd11.prod.outlook.com ([fe80::5b26:2660:6aaf:37f9]) by DM4PR11MB5487.namprd11.prod.outlook.com ([fe80::5b26:2660:6aaf:37f9%3]) with mapi id 15.20.6363.032; Wed, 10 May 2023 10:11:43 +0000 From: "VincentX Ke" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , "Desimone, Nathaniel L" , "Oram, Isaac W" , "Gao, Liming" , "Dong, Eric" , "Sinha, Ankit" Subject: Re: [edk2-devel] [PATCH v5] MinPlatformPkg: Update HWSignature filed in FACS Thread-Topic: [edk2-devel] [PATCH v5] MinPlatformPkg: Update HWSignature filed in FACS Thread-Index: AQHZfWiRUPMiuGUOlE2YzfV/7Zev069Pvf+AgAOV40A= Date: Wed, 10 May 2023 10:11:42 +0000 Message-ID: References: <20230503023954.119-1-vincentx.ke@intel.com> In-Reply-To: Accept-Language: zh-TW, 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: DM4PR11MB5487:EE_|CH0PR11MB5235:EE_ x-ms-office365-filtering-correlation-id: a23a274a-4b9e-42c3-1ccd-08db513ef410 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: U4dVqKcOMbCDTHXlnDZrDutLo/03W8aS930+PGdRoW54ZejpvwDjGQuo6Urxh4d2qWvswFgbsc7fOJMJ5EAaoA3MigAda8Ziix90bmJD+T82zvG9aypC2wZbTRvseov9XVExF3+tUkOt4zQyYREZ1PDgK4g4snh8RRSJ+oZRxqSPkAPUaeWguzGPJT+47YuLjox/vDANHp8u+nbdicz7rG9IIqwN8l6S1MmmTB1drabyBmMXpBb1ebta0LuRBMN1Na9CVmPNM6DNHL/vF2pciN5MKkVedeTvfU5zBSSzUdEP+2Dyk6Va8sSfeoL1q81nLbGbhNNyDRVvM9SeobjBVPsjtJ9I8O1LQD+aFMb/ExGwtxjZN8CTX1E4dQW0lIIdl/nGlGggXLdYXL0pq6u1gcim5XJi2o5Ni4iQeUvEPQdTxdKkveaO9M3aUmNAhp7pqai66OLGYCdNXKMiHutzAfV1c/smPKUdYmJ+bvZml1mFe1GRUE02U3lBP+t+9UQzV0iOZC+fZpHgtSMKe6a0Cn06ExM1sFGUqS1L3a4kZlnmVUFm+W0/Al8Fb7Q/3jz9TtQHwTJNKW7VBX3PCFwN/5hG+HJIVEipw0hj4ryslfyz1aemo8Cp30xw+utiHa9+9aRVBKXDsVbdTOnv3w9tAWSDvJppzI3x0tXFf+6LJY1f7uzAc5cMOaNwqXTSENk2 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5487.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(366004)(376002)(346002)(136003)(39860400002)(451199021)(122000001)(33656002)(41300700001)(2906002)(30864003)(26005)(53546011)(15650500001)(107886003)(186003)(9686003)(66899021)(6506007)(5660300002)(71200400001)(52536014)(38100700002)(38070700005)(82960400001)(8936002)(55016003)(8676002)(110136005)(54906003)(478600001)(83380400001)(966005)(7696005)(86362001)(66556008)(66476007)(66446008)(64756008)(76116006)(66946007)(316002)(4326008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0HJxE9FQEPi6H612QjbrxYL9gbOWDhsNaz/VqOm6p8i5eic0oOoRylDPooFv?= =?us-ascii?Q?xLJj6Z3qM4QH+vANPqMTpWae6XjKWQ2sROmjlzrFj3gZOjg/ULhvTtzXE5kc?= =?us-ascii?Q?U5sakp7xlCgwc0IDqDAfgQoXUU41ogyfQuwV+et8ulxW8Eqn8GfgzH2nCY4h?= =?us-ascii?Q?zFDC1i1/3sz7kQz30GkiEwMYwlr9KnKwR5TK+iMm8pQNEXohDfDfj8yt7KTp?= =?us-ascii?Q?50qrL3swrA6TrOKiE9GW+NCDbhpZ5zXyZFrbQhzqM4UJdjIYxH8mPioNUyV/?= =?us-ascii?Q?GPr/Sgy/SJBHrBJEi0qIkuw9QSLaYqA1QzkRo9eguCBr8Cd4JTHUqAGVj5nM?= =?us-ascii?Q?QHoHGzKJ4Gf8FzPJDkeW7pE0eQUaoSh6J5Yy7E8Q3PsYHlxIAlUWWFGcmFbg?= =?us-ascii?Q?RG8rS/KWjt+8gRVn/Cpx/zY/5WnylE1ogdU1Fj+Tmk6xG0I612l7oxwyCiK2?= =?us-ascii?Q?JPMBxI6jPOFoNOsA6BkxNtf6n9/vCwHMdhffzUdLqlJylEzSRwo/v3zm4u8T?= =?us-ascii?Q?bUWUDOqCrGqgQOoBdCMufqSBQmV2fC7YobKhj6s/mU6LRK6zIdNTo/shbFPm?= =?us-ascii?Q?eMPtzYv1F0weHai4WXEz7g7Gz7DIsvdSQ1KfIqjgSRTxmEECtXN+nrEP7Iyo?= =?us-ascii?Q?awL3TiCM0H6wOr3htKS+Xm689wbot68D4bnRAwUWYVS9hogc0iYbpD5oCYx6?= =?us-ascii?Q?t3MDzZfljEWW00xhE9y7NrFrU9vcksqqsJmHNekH4N+rt55a0ANF/nN7wJ1G?= =?us-ascii?Q?gMzr+fJhBQ+UB0pwEdLqFvXj5YpL6KrR3gR3H4+imFGwrtsgoB5joBwkZmuL?= =?us-ascii?Q?5oC/J/Jnk3DxUwg6mlEV30pt3Ir/5YefE6C5jGG4g5yG7w3eOBz1UbtWs5R3?= =?us-ascii?Q?T7j/bOdrbsaB1jV+igqikyv3VZvXTiCypIP2dlfj744RQT3BgRERAB2N6n3A?= =?us-ascii?Q?lQ5VUq45yFl07Z3l9o0KQRz9JVhmfHgueV+GreXpRpFAA4dSU4Y4dpuLOpFP?= =?us-ascii?Q?5cqfupmbnHSo0/PXuEw2YVLaxpQZe7/vYq34rzA1H04OZv6N+7h3feOzkts5?= =?us-ascii?Q?nMPONC230IrcEH3a8AqY0GFP3MuBycA/m1hFQVAwCv/PC9BrBmg90aN+j1wD?= =?us-ascii?Q?sQIoS7bAYZ2EEdcZuwKP5jxOMReQDghMOM4jj4/BsZRHjQI/wyzrRmoZbhQs?= =?us-ascii?Q?LAIRxPaq4jAXvWbwviWsEtbbGpqojdPfWYM5n8Jwhpa43/al3jI+0mKVZCTn?= =?us-ascii?Q?8csm/86Ax4p8rqljnKC2V3YXHY6g5jSw4+wVrcRnnhSLrbQt2a8guMoSOqo1?= =?us-ascii?Q?7wmREFE6X1a/HyN2mM7F3I4Td6/AQoX5YQaPfKz+mjaqhlUOb3gm8LLkkLOC?= =?us-ascii?Q?KGf9DYCNZRSwC/J6qO9mbinSZXd2S2WjAz9ni8rvR1sNp8vkytNKU5A3fx86?= =?us-ascii?Q?RQr66jq8sSEBT2ZZ6qktkuWSDUC82O7hDiqVRCSMjEuQtjbxibxcoXoCzABC?= =?us-ascii?Q?9SsecobN36MaBtYttaTHFp+LQGr6cVDVg72S8AajYBxweNGZxcbkkTPgZhjN?= =?us-ascii?Q?E3jGW6NdZzGm1LoMFFSOf/uPUgbzEl7y/KvCs7o4?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5487.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a23a274a-4b9e-42c3-1ccd-08db513ef410 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2023 10:11:42.6970 (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: XDhek79H69nAUJpvmcgJ+BsuZHWx89sp575b5G3ZtD8mTcSCTvZPpjmGWegHeZa9gyjvEgQbtm6WAd9o+Gob5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR11MB5235 Return-Path: vincentx.ke@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Ray To fix the concern you mentioned. [Patch V6] updated with https://edk2.groups.io/g/devel/message/104537 Please kindly code review and let me know your suggestion.=20 Thanks a lot. Vincent -----Original Message----- From: Ni, Ray =20 Sent: Monday, May 8, 2023 11:23 AM To: devel@edk2.groups.io; Ke, VincentX Cc: Chiu, Chasel ; Desimone, Nathaniel L ; Oram, Isaac W ; Gao, Liming = ; Dong, Eric ; Sinha, Ankit = Subject: RE: [edk2-devel] [PATCH v5] MinPlatformPkg: Update HWSignature fil= ed in FACS Vincent, I don't quite understand your code logic. For example: 1. Why you use XSDT only? What if there is only RSDT? 2. Why there is a do-while in AcpiTableCrcCalculator()? 3. Why (VOID *) is converted to (UINTN) then to (EFI_ACPI_DESCRIPTION_HEAD= ER*)? 4. Why you "measure" the XSDT and RSDT table? The two tables only contain p= ointers. 5. Can you please review " MdePkg/Library/UefiLib/Acpi.c" which contains l= ogic that iterates the acpi tables? Thanks, Ray > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of=20 > VincentX Ke > Sent: Wednesday, May 3, 2023 10:40 AM > To: devel@edk2.groups.io > Cc: Ke, VincentX ; Chiu, Chasel=20 > ; Desimone, Nathaniel L=20 > ; Oram, Isaac W=20 > ; Gao, Liming ;=20 > Dong, Eric > Subject: [edk2-devel] [PATCH v5] MinPlatformPkg: Update HWSignature=20 > filed in FACS >=20 > From: VincentX Ke >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4428 >=20 > Calculating CRC based on each ACPI table. > Update HWSignature filed in FACS based on CRC while ACPI table changed. >=20 > Change-Id: Ic0ca66ff10cda0fbcd0683020fab1bc9aea9b78c > Signed-off-by: VincentX Ke > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Isaac Oram > Cc: Liming Gao > Cc: Eric Dong > Signed-off-by: VincentX Ke > --- > Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 182 > +++++++++++++------- > Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf | 1 + > 2 files changed, 118 insertions(+), 65 deletions(-) >=20 > diff --git=20 > a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > index e967031a3b..a940424ced 100644 > --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > @@ -1191,98 +1191,150 @@ PlatformUpdateTables ( } >=20 >=20 >=20 > /** >=20 > - This function calculates RCR based on PCI Device ID and Vendor ID=20 > from the devices >=20 > - available on the platform. >=20 > - It also includes other instances of BIOS change to calculate CRC=20 > and provides as >=20 > - HWSignature filed in FADT table. >=20 > + This function calculates CRC based on each offset in the ACPI table. >=20 > + >=20 > + @param[in] Table The pointer to ACPI table that >=20 > + required to calculate CRC. >=20 > + >=20 > + @retval CRC A pointer to allocate UINT32 that >=20 > + contains the CRC32 data. >=20 > +**/ >=20 > +UINT32 >=20 > +AcpiTableCrcCalculator ( >=20 > + IN VOID *Table >=20 > + ) >=20 > +{ >=20 > + UINT32 CRC; >=20 > + >=20 > + CRC =3D 0; >=20 > + >=20 > + // >=20 > + // Calculate CRC value. >=20 > + // >=20 > + if (((EFI_ACPI_6_5_COMMON_HEADER *)(UINTN)Table)->Signature =3D=3D > EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) { >=20 > + // >=20 > + // Zero HardwareSignature field before Calculating FACS CRC >=20 > + // >=20 > + do { >=20 > + ((EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE > *)(UINTN)Table)->HardwareSignature =3D 0; >=20 > + } while (((EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE > *)(UINTN)Table)->HardwareSignature); >=20 > + >=20 > + gBS->CalculateCrc32 ((UINT8 *)Table, > (UINTN)((EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE > *)(UINTN)Table)->Length, &CRC); >=20 > + } else { >=20 > + gBS->CalculateCrc32 ((UINT8 *)Table, > (UINTN)((EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Table)->Length, &CRC); >=20 > + } >=20 > + >=20 > + return CRC; >=20 > +} >=20 > + >=20 > +/** >=20 > + This function calculates CRC based on each ACPI table. >=20 > + It also calculates CRC and provides as HWSignature filed in FACS. >=20 > **/ >=20 > VOID >=20 > -IsHardwareChange ( >=20 > +IsAcpiTableChange ( >=20 > VOID >=20 > ) >=20 > { >=20 > - EFI_STATUS Status; >=20 > - UINTN Index; >=20 > - UINTN HandleCount; >=20 > - EFI_HANDLE *HandleBuffer; >=20 > - EFI_PCI_IO_PROTOCOL *PciIo; >=20 > - UINT32 CRC; >=20 > - UINT32 *HWChange; >=20 > - UINTN HWChangeSize; >=20 > - UINT32 PciId; >=20 > - UINTN Handle; >=20 > - EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr; >=20 > - EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE *pFADT; >=20 > - >=20 > - HandleCount =3D 0; >=20 > - HandleBuffer =3D NULL; >=20 > - >=20 > - Status =3D gBS->LocateHandleBuffer ( >=20 > - ByProtocol, >=20 > - &gEfiPciIoProtocolGuid, >=20 > - NULL, >=20 > - &HandleCount, >=20 > - &HandleBuffer >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return; // PciIO protocol not installed yet! >=20 > + EFI_STATUS Status; >=20 > + UINTN Index; >=20 > + UINTN AcpiTableCount; >=20 > + UINT32 Table; >=20 > + UINT32 HWSignature; >=20 > + UINT32 *AcpiTableCrc; >=20 > + EFI_ACPI_6_5_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; >=20 > + EFI_ACPI_DESCRIPTION_HEADER *Rsdt; >=20 > + EFI_ACPI_DESCRIPTION_HEADER *Xsdt; >=20 > + EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr; >=20 > + EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *pFADT; >=20 > + >=20 > + AcpiTableCount =3D 0; >=20 > + AcpiTableCrc =3D NULL; >=20 > + Rsdp =3D NULL; >=20 > + Rsdt =3D NULL; >=20 > + Xsdt =3D NULL; >=20 > + FacsPtr =3D NULL; >=20 > + pFADT =3D NULL; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "%a() - Start\n", __FUNCTION__)); >=20 > + >=20 > + Status =3D EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID > **)&Rsdp); >=20 > + if (EFI_ERROR (Status) || (Rsdp =3D=3D NULL)) { >=20 > + return; >=20 > } >=20 >=20 >=20 > // >=20 > - // Allocate memory for HWChange and add additional entrie for >=20 > - // pFADT->XDsdt >=20 > + // ACPI table count starts with 2 as RSDT and XSDT are already located= . >=20 > + // Then add ACPI tables found by XSDT and FADT. >=20 > // >=20 > - HWChangeSize =3D HandleCount + 1; >=20 > - HWChange =3D AllocateZeroPool (sizeof(UINT32) * HWChangeSize); >=20 > - ASSERT(HWChange !=3D NULL); >=20 > + Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp- > >RsdtAddress; >=20 > + Xsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp- > >XsdtAddress; >=20 > + AcpiTableCount +=3D 2; >=20 > + AcpiTableCount =3D AcpiTableCount + (Xsdt->Length - sizeof > (EFI_ACPI_DESCRIPTION_HEADER))/sizeof (UINT64); >=20 >=20 >=20 > - if (HWChange =3D=3D NULL) return; >=20 > + for (Index =3D sizeof (EFI_ACPI_DESCRIPTION_HEADER); Index < (Xsdt- > >Length); Index =3D Index + sizeof (UINT64)) { >=20 > + Table =3D *((UINT32 *)((UINT8 *)Xsdt + Index)); >=20 > + if (((EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Table)->Signature =3D=3D > EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { >=20 > + pFADT =3D (EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE > *)(UINTN)Table; >=20 > + if (pFADT->FirmwareCtrl) { >=20 > + AcpiTableCount++; >=20 > + } >=20 >=20 >=20 > - // >=20 > - // add HWChange inputs: PCI devices >=20 > - // >=20 > - for (Index =3D 0; HandleCount > 0; HandleCount--) { >=20 > - PciId =3D 0; >=20 > - Status =3D gBS->HandleProtocol (HandleBuffer[Index], > &gEfiPciIoProtocolGuid, (VOID **) &PciIo); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Status =3D PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, 1, &Pci= Id); >=20 > - if (EFI_ERROR (Status)) { >=20 > - continue; >=20 > + if ((pFADT->XDsdt) || (pFADT->Dsdt)) { >=20 > + AcpiTableCount++; >=20 > } >=20 > - HWChange[Index++] =3D PciId; >=20 > } >=20 > } >=20 >=20 >=20 > // >=20 > - // Locate FACP Table >=20 > + // Allocate memory for founded ACPI tables. >=20 > // >=20 > - Handle =3D 0; >=20 > - Status =3D LocateAcpiTableBySignature ( >=20 > - EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, >=20 > - (EFI_ACPI_DESCRIPTION_HEADER **) &pFADT, >=20 > - &Handle >=20 > - ); >=20 > - if (EFI_ERROR (Status) || (pFADT =3D=3D NULL)) { >=20 > - return; //Table not found or out of memory resource for pFADT table >=20 > + AcpiTableCrc =3D AllocateZeroPool (sizeof (UINT32) * AcpiTableCount); >=20 > + if (AcpiTableCrc =3D=3D NULL) { >=20 > + return; >=20 > + } >=20 > + >=20 > + AcpiTableCount =3D 0; >=20 > + AcpiTableCrc[AcpiTableCount++] =3D AcpiTableCrcCalculator ((VOID > *)(UINTN)Rsdt); >=20 > + AcpiTableCrc[AcpiTableCount++] =3D AcpiTableCrcCalculator ((VOID > *)(UINTN)Xsdt); >=20 > + >=20 > + for (Index =3D sizeof (EFI_ACPI_DESCRIPTION_HEADER); Index < (Xsdt- > >Length); Index =3D Index + sizeof (UINT64)) { >=20 > + Table =3D *((UINT32 *)((UINT8 *)Xsdt + Inde= x)); >=20 > + AcpiTableCrc[AcpiTableCount++] =3D AcpiTableCrcCalculator ((VOID > *)(UINTN)Table); >=20 > + if (((EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Table)->Signature =3D=3D > EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { >=20 > + pFADT =3D (EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE > *)(UINTN)Table; >=20 > + if (pFADT->FirmwareCtrl) { >=20 > + AcpiTableCrc[AcpiTableCount++] =3D AcpiTableCrcCalculator=20 > + ((VOID > *)(UINTN)pFADT->FirmwareCtrl); >=20 > + } >=20 > + >=20 > + if (pFADT->XDsdt) { >=20 > + AcpiTableCrc[AcpiTableCount++] =3D AcpiTableCrcCalculator=20 > + ((VOID > *)(UINTN)pFADT->XDsdt); >=20 > + } else { >=20 > + AcpiTableCrc[AcpiTableCount++] =3D AcpiTableCrcCalculator=20 > + ((VOID > *)(UINTN)pFADT->Dsdt); >=20 > + } >=20 > + } >=20 > } >=20 >=20 >=20 > // >=20 > - // add HWChange inputs: others >=20 > + // pFADT table not found. >=20 > // >=20 > - HWChange[Index++] =3D (UINT32)pFADT->XDsdt; >=20 > + if (pFADT =3D=3D NULL) { >=20 > + return; >=20 > + } >=20 >=20 >=20 > // >=20 > - // Calculate CRC value with HWChange data. >=20 > + // Calculate HWSignature data. >=20 > // >=20 > - Status =3D gBS->CalculateCrc32(HWChange, HWChangeSize, &CRC); >=20 > - DEBUG ((DEBUG_INFO, "CRC =3D %x and Status =3D %r\n", CRC, Status)); >=20 > + Status =3D gBS->CalculateCrc32 (AcpiTableCrc, AcpiTableCount, > &HWSignature); >=20 > + DEBUG ((DEBUG_INFO, "HardwareSignature =3D %x and Status =3D %r\n", > HWSignature, Status)); >=20 >=20 >=20 > // >=20 > // Set HardwareSignature value based on CRC value. >=20 > // >=20 > - FacsPtr =3D (EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE > *)(UINTN)pFADT->FirmwareCtrl; >=20 > - FacsPtr->HardwareSignature =3D CRC; >=20 > - FreePool (HWChange); >=20 > + FacsPtr =3D > (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)pFADT- > >FirmwareCtrl; >=20 > + FacsPtr->HardwareSignature =3D HWSignature; >=20 > + FreePool (AcpiTableCrc); >=20 > + DEBUG ((DEBUG_INFO, "%a() - End\n", __FUNCTION__)); >=20 > } >=20 >=20 >=20 > VOID >=20 > @@ -1329,7 +1381,7 @@ AcpiEndOfDxeEvent ( > // >=20 > // Calculate Hardware Signature value based on current platform=20 > configurations >=20 > // >=20 > - IsHardwareChange (); >=20 > + IsAcpiTableChange (); >=20 > } >=20 >=20 >=20 > /** >=20 > diff --git=20 > a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf > b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf > index 694492112b..f47cc3908d 100644 > --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf > +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf > @@ -128,6 +128,7 @@ > gEfiGlobalVariableGuid ## CONSUMES >=20 > gEfiHobListGuid ## CONSUMES >=20 > gEfiEndOfDxeEventGroupGuid ## CONSUMES >=20 > + gEfiAcpiTableGuid ## CONSUMES >=20 >=20 >=20 > [Depex] >=20 > gEfiAcpiTableProtocolGuid AND >=20 > -- > 2.39.2.windows.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#103877): > https://edk2.groups.io/g/devel/message/103877 > Mute This Topic: https://groups.io/mt/98654282/1712937 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com]=20 > -=3D-=3D-=3D-=3D-=3D-=3D >=20