From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.7367.1685512984853266059 for ; Tue, 30 May 2023 23:03:05 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=IVoHls+G; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1685512984; x=1717048984; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=HJjpulsqBysm8kJ9irkWkIN0qznW13s7MZB7w6nO5NQ=; b=IVoHls+GzyVNj7E/tCgK/dXUGiqEkMh19s/CNZDHEUCiEifBC5JBg6zt qmzKjnuw7Ja6btGXnJUMYHVexEZiazjMZKJLoKYfgpjRJ4yyEgof3gTPF UN+U4kYh1Kz9C2NEmUw6eAZQbdG1hl0+jRZLsXE9iYSrlaVBuDViRCk/E 7HtV/opIhF1GpdXXel6/pUZXmBpOWKXN+/pnSUgnVeQEnnLXpFAeF6nV6 jWmv2398ko4Wj1/+LdaryuPc2k21u+/Zyxnq9K7cbQzaoGw1EdaMW0J24 8gSvdMkxjKwaMmF84yO867sSRGJe/pOqVVVy2sWpx1a5CS4q9gnY5L4eG w==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="352643344" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="352643344" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 23:03:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="1036907927" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="1036907927" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga005.fm.intel.com with ESMTP; 30 May 2023 23:03:04 -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.23; Tue, 30 May 2023 23:03:03 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.23; Tue, 30 May 2023 23:03:03 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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; Tue, 30 May 2023 23:03:03 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.102) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Tue, 30 May 2023 23:03:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y9but0sIDXc+TrXqxu4zWy6wCM/PPDNkzgOG3uQdoZBse5eeWYAlj59sGoYvCxSDkWWS+x1IXz/59IDvB20dpKWeR4cn4U12Mhg+k8KmIlgUMzuO/tmkBaQ4M5Sh+1wraAjj8P0OU2lm/k5kOcgS8JruiSXaPOUB+H/ufVD3iGu419bkYUyqcupf/iPKP58vTtYWE+VDH7nKwDK5QtLuFpDE9IjEdy5sv7++soHEQdNMl5+cY8Q7eP5DB/RGCtyS0rmh2H8LCbk3Gm9M01zPw1+ikg/7eBTCrdVVfJHWJvVBEI+lt5CmFp57ohXrD0R/CdNHG0Z2sQ5eDZXeqdBZnQ== 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=8n1KtVrWgZrmdU4hGp4fBRz4k4bMLr2v4Qy+VPOFrJA=; b=ExCli2LdqLSbuMfGDzk/l1okyGhzKrgVrQeU9wT3XNK2TmmnnT1ZrNw1atLOoiZlpODjpS4q0Oi9ng+HgqiYlvaFDVONJTE6vTD6hTZwPlp19ITPHIr0Wvv7Fihm5gDYolOTim+/10KG91Hm864lVQSHYiB4xFvOaGg0pSxIkefOGIwF1xs6UmMJ9mui+L11rFjoW4vSebDEQx1KAqkJ/qfxPATe4tOq5L42fHe8BLYamO4KO2BMtydTW4NOe9d+RhVAVLZVh6HNeJTtB7vjfUW+JC2mNSrhIAmSZ1jic5TYI6R7eXWKv2J8uWTX/Xkn+m+6BXE7ZtRPa0ux1KgcjQ== 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 PH7PR11MB7124.namprd11.prod.outlook.com (2603:10b6:510:20f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.22; Wed, 31 May 2023 06:02:55 +0000 Received: from DM4PR11MB5487.namprd11.prod.outlook.com ([fe80::32e5:b110:3d8a:5c3]) by DM4PR11MB5487.namprd11.prod.outlook.com ([fe80::32e5:b110:3d8a:5c3%3]) with mapi id 15.20.6433.022; Wed, 31 May 2023 06:02:55 +0000 From: "VincentX Ke" To: "Chiu, Chasel" , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Oram, Isaac W" , "Gao, Liming" , "Dong, Eric" , "Sinha, Ankit" , "Ni, Ray" Subject: Re: [PATCH v10] MinPlatformPkg: Update HWSignature field in FACS Thread-Topic: [PATCH v10] MinPlatformPkg: Update HWSignature field in FACS Thread-Index: AQHZk2pbzZN5Jv3BOUyRvHkJzIBoca9z3TqAgAAG5aA= Date: Wed, 31 May 2023 06:02:55 +0000 Message-ID: References: <20230531024806.374-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_|PH7PR11MB7124:EE_ x-ms-office365-filtering-correlation-id: 1bc93ba4-b792-4606-4257-08db619cad4a 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: YgA8H8YQg44n2ao/RNna68tqinrw/ah0exCDG9p7NsdiNdDSjT6TNcWaqRgU+9LQJci8ShBofldA/zpMoOe9tIwlA243ADL5xS+P+w5fWmPo/OP4Q29AkMgL5tniIf/IvR03bueCg5vyL4+uLLym9OixMyPGnF963QB31ZJdRyt2Gt41L3o4cDIKONH324oyn1kCEP/jpeuTFpNxsA4cVvCAH2sCltdEEVkR6Wlui4xJf01GBodbyd7PJZ+Ock51BAlCzOdYOPj14Tq2mbw3iYJYlJoONtksHfFjlJCMQzaPtb6dIoQpXXiHHcPdZzybwBSl+ScBpD5M83HEDAVcos+j/BJFTeOJlNU+oZj1o4J6HGnzul/jelv71IgQZdKtd/oPpjFWxH8+9dGIS0OVf9nRctx7MK/C9EpIf8c7zf0/DGwQyA4I3isEJmyXLa4kSJXMXwDGg8zLD8QHsY8wFw83kpr6/nNIJ+7F+1gRkRAypmu/oooiSXTlOfDd5GiiE5vO0ibXih/IRdcYY7pqfXxjh7i9sj1AbuLo/ZU1U7rE3GO2BcK55jlGxUTTWtdKkzbATWgKIMF45rGW8yZNvtlcUhNxvhMUtOwlBQI1gDmRA765baYyJQ0WL0p8NVxaQ0UTv/Vq08ASOXbuuHQx+w== 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)(136003)(376002)(346002)(366004)(39860400002)(396003)(451199021)(83380400001)(86362001)(33656002)(71200400001)(76116006)(66476007)(64756008)(5660300002)(66446008)(66946007)(316002)(38070700005)(4326008)(52536014)(66556008)(107886003)(82960400001)(8676002)(41300700001)(38100700002)(8936002)(966005)(122000001)(7696005)(55016003)(30864003)(53546011)(110136005)(54906003)(2906002)(6506007)(9686003)(186003)(15650500001)(478600001)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?A8AEqD3nx8c755+NqZp+AqA009axJ5D+6Y761DieswXyAmxhgbZArLArVX4g?= =?us-ascii?Q?tV7AvX6jRB7MwH8ipxRl5CPRp7MfZCIqEGYYNwqHOB71KlfALn2heweTju2l?= =?us-ascii?Q?K6FDHPNjl5dnC+oDd5DMd7K/lr7rcDpanAPNiq3OdYdJxbJOqpq2ksrNZkxC?= =?us-ascii?Q?wACx2BTBqajfUzgg/Jk0ywCdUWOzb6JbcUq5fmtV/g0eSW0guZZxGySkFPUh?= =?us-ascii?Q?AyENiaCqXn2jlsMjOw0QHz439dybZBW/AjllwBemZRaFfXhulPbxkvdntP6p?= =?us-ascii?Q?R17yioY3dIOG8AzteyYuI8e/VyFrkmLjWLnY20X5URBIxy7zvD+U+s5u/+Nt?= =?us-ascii?Q?AvXjHZ8O0UkYjy+dCXHogjow/4RVKrPyxpFMAGWAYpwSwh0P19T9iYYA2pnh?= =?us-ascii?Q?8FDQTn0b/+n1m7IB/+Vam+6bRMjJ9j7csPPg2azUo7EcSUrs5cfxF0qsUuSA?= =?us-ascii?Q?jW95DL0IwEb412e87PMSUiRz5FylJx38m4C5Z8YbgTfwKVtMSrHwn9w9GvS5?= =?us-ascii?Q?nlf0VtxXw2DMiHcPvkIyS05brzV6e6woYGVZSWmcZxOwnVkdx6TMDKp2q5sk?= =?us-ascii?Q?xTpweLyb9rahB32wCcJaXpFtKIm8EVqzvEe/DDD3GkqgmP2CeB7qxzTsLBv7?= =?us-ascii?Q?dx0Wk8AApdARpGd9w3Sd3KwfBJcAbn6+Rk6Ymlt1gC3GtdE5ajYJfyUE7Rvo?= =?us-ascii?Q?h+n8t4WvcWlj8m/dUlz9QsFbZMr3NjcUYf2zuOTSap3xpMjyPSUhFaUgYjS5?= =?us-ascii?Q?NsSKjempdQfbz2zpRhG9wNbONG1IjXUo4FMdFGknk02XKFnQFS1WR7W41g3B?= =?us-ascii?Q?f/oo7f37vAEmQkkBkQNhv8rvS78lB5KysdzkOiV8j5Nf1eew2L8ijVCJdbdV?= =?us-ascii?Q?R+5lelMVhBQxlmpBIMmhXKyJ6nxFqZAu7kLCn8Ww0I+JpCT8K2chs+DAUNaS?= =?us-ascii?Q?Vj31QgKfVgWmaSK4W2w1zBKAH4NtLQ4LArFiV+uG6wD9JpeuYo0Z6Kkepd9p?= =?us-ascii?Q?YeYeFJzg97EYKA+/whkOdG6PGQk4QhGtiyobDbsFiUzzYHk6tzzI7FRNZMog?= =?us-ascii?Q?fvoYOL2CAijMV7ogHlU4s9Dti7jvUisFC0uoWw5v1ozg28YeCFYqFQaleLiA?= =?us-ascii?Q?6VrBCsIQILHG33boTpGaH6BZNK+t0tknum/sf5ofoKqDbKT44kli/Wm8GnPU?= =?us-ascii?Q?L4QN6Zlo+A+fP6gzKcUf0ho2eDJPVUCsHtEZC3nM9GH4rm+u8qGr6j0mRSW+?= =?us-ascii?Q?Z/fYl4gYgSDXqhDZ8kUks2rj5pasDH+wjtRrX+ciOVgnCTt4q5MAAnBAW2It?= =?us-ascii?Q?Oyml7dqX1gAkyv6iY3VLO7cvBf/rqUZAtMakYbas/16+kA1YEyEuU8F/KgD2?= =?us-ascii?Q?kohunSS59DmL4E3gN0hPnf2l0uSeXPWa+CN1DcYeV+Y+bnll6ccDhwNO+L1n?= =?us-ascii?Q?RSXRBxV4QSV4kR39P+Ew0K96aoqkTx4pxrO/Y4YqYaXA4xBecoKEs/PSL047?= =?us-ascii?Q?XHxn/S+TO6toQvkrfoM662p2vIjkjVJ9NQsZtwcA45Ml7nSigMRRzrTB6b/I?= =?us-ascii?Q?W+RfdmgJQB5N0ZWdDQuaW9VFQXG/0l6bEKLwQzw6?= 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: 1bc93ba4-b792-4606-4257-08db619cad4a X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2023 06:02:55.2556 (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: sYaEjm33NfJ/+KOJAt6cEiYj3rJRLsv4RBLOHtdA/0+LaBK+HjjwNEblDaj57BuibExC+dJ8tcKJw5Oe0dNhNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7124 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 Thanks for review and merge. -----Original Message----- From: Chiu, Chasel =20 Sent: Wednesday, May 31, 2023 1:38 PM To: Ke, VincentX ; devel@edk2.groups.io Cc: Desimone, Nathaniel L ; Oram, Isaac W <= isaac.w.oram@intel.com>; Gao, Liming ; Dong, Eric= ; Sinha, Ankit ; Ni, Ray Subject: RE: [PATCH v10] MinPlatformPkg: Update HWSignature field in FACS Patch merged: https://github.com/tianocore/edk2-platforms/commit/1a7bd150d39007bfb72c4727= feda3184c23efe96 Thanks, Chasel > -----Original Message----- > From: Ke, VincentX > Sent: Tuesday, May 30, 2023 7:48 PM > To: devel@edk2.groups.io > Cc: Ke, VincentX ; Chiu, Chasel=20 > ; Desimone, Nathaniel L=20 > ; Oram, Isaac W=20 > ; Gao, Liming ;=20 > Dong, Eric ; Sinha, Ankit > Subject: [PATCH v10] MinPlatformPkg: Update HWSignature field 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 field 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 > Cc: Ankit Sinha > Signed-off-by: VincentX Ke > --- > Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 284 > +++++++++++++++----- > Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf | 1 + > 2 files changed, 217 insertions(+), 68 deletions(-) >=20 > diff --git=20 > a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > index 2f2c96f907..2a833ec99c 100644 > --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > @@ -1191,98 +1191,246 @@ 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 > + Function prototype for GetAcpiTableCount/CalculateAcpiTableCrc. >=20 > + >=20 > + @param[in] Table The pointer to ACPI table. >=20 > + @param[in] TableIndex The ACPI table index. >=20 > + @param[in] Context The pointer to UINTN for GetAcpiTableCount. >=20 > + The pointer to UINT32 array for CalculateAcpiT= ableCrc. >=20 > **/ >=20 > +typedef >=20 > VOID >=20 > -IsHardwareChange ( >=20 > - VOID >=20 > +(EFIAPI *ACPI_TABLE_CALLBACK)( >=20 > + IN EFI_ACPI_COMMON_HEADER *Table, >=20 > + IN UINTN TableIndex, >=20 > + IN VOID *Context >=20 > + ); >=20 > + >=20 > +/** >=20 > + Enumerate all ACPI tables in RSDT/XSDT. >=20 > + >=20 > + @param[in] Sdt ACPI XSDT/RSDT. >=20 > + @param[in] TablePointerSize Size of table pointer: >=20 > + 4(RSDT) or 8(XSDT). >=20 > + @param[in] CallbackFunction The pointer to > GetAcpiTableCount/CalculateAcpiTableCrc. >=20 > + @param[in] Context The pointer to UINTN for GetAcpiTableCou= nt. >=20 > + The pointer to UINT32 array for Calculat= eAcpiTableCrc. >=20 > +**/ >=20 > +VOID >=20 > +EnumerateAllAcpiTables ( >=20 > + IN EFI_ACPI_DESCRIPTION_HEADER *Sdt, >=20 > + IN UINTN TablePointerSize, >=20 > + IN ACPI_TABLE_CALLBACK CallbackFunction, >=20 > + IN VOID *Context >=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_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr; >=20 > - EFI_ACPI_6_5_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 > + UINTN Index; >=20 > + UINTN TableIndex; >=20 > + UINTN EntryCount; >=20 > + UINT64 EntryPtr; >=20 > + UINTN BasePtr; >=20 > + EFI_ACPI_COMMON_HEADER *Table; >=20 > + EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *FadtPtr; >=20 > + >=20 > + Index =3D 0; >=20 > + TableIndex =3D 0; >=20 > + EntryCount =3D (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / > TablePointerSize; >=20 > + EntryPtr =3D 0; >=20 > + BasePtr =3D (UINTN)(Sdt + 1); >=20 > + Table =3D NULL; >=20 > + FadtPtr =3D NULL; >=20 > + >=20 > + if (Sdt =3D=3D NULL) { >=20 > + ASSERT (Sdt !=3D NULL); >=20 > + return; >=20 > } >=20 >=20 >=20 > - // >=20 > - // Allocate memory for HWChange and add additional entrie for >=20 > - // pFADT->XDsdt >=20 > - // >=20 > - HWChangeSize =3D HandleCount + 1; >=20 > - HWChange =3D AllocateZeroPool (sizeof(UINT32) * HWChangeSize); >=20 > - ASSERT(HWChange !=3D NULL); >=20 > + for (Index =3D 0; Index < EntryCount; Index++) { >=20 > + EntryPtr =3D 0; >=20 > + Table =3D NULL; >=20 > + CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * TablePointerSize), > TablePointerSize); >=20 > + Table =3D (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr)); >=20 > + if (Table !=3D NULL) { >=20 > + CallbackFunction (Table, TableIndex++, Context); >=20 > + } >=20 > + >=20 > + if (Table->Signature =3D=3D > EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { >=20 > + FadtPtr =3D (EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *)Table; >=20 > + if (FadtPtr->Header.Revision < > EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) { >=20 > + // >=20 > + // Locate FACS/DSDT in FADT >=20 > + // >=20 > + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr- > >FirmwareCtrl, TableIndex++, Context); >=20 > + CallbackFunction ((EFI_ACPI_COMMON_HEADER=20 > + *)(UINTN)FadtPtr->Dsdt, > TableIndex++, Context); >=20 > + } else { >=20 > + // >=20 > + // Locate FACS in FADT >=20 > + // >=20 > + if (FadtPtr->XFirmwareCtrl !=3D 0) { >=20 > + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr- > >XFirmwareCtrl, TableIndex++, Context); >=20 > + } else { >=20 > + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr- > >FirmwareCtrl, TableIndex++, Context); >=20 > + } >=20 > + >=20 > + // >=20 > + // Locate DSDT in FADT >=20 > + // >=20 > + if (FadtPtr->XDsdt !=3D 0) { >=20 > + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr- > >XDsdt, TableIndex++, Context); >=20 > + } else { >=20 > + CallbackFunction ((EFI_ACPI_COMMON_HEADER=20 > + *)(UINTN)FadtPtr->Dsdt, > TableIndex++, Context); >=20 > + } >=20 > + } >=20 > + } >=20 > + } >=20 > +} >=20 > + >=20 > +/** >=20 > + Count the number of ACPI tables. >=20 > + >=20 > + @param[in] Table The pointer to ACPI table. >=20 > + @param[in] TableIndex The ACPI table index. >=20 > + @param[in] Context The pointer to UINTN. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +GetAcpiTableCount ( >=20 > + IN EFI_ACPI_COMMON_HEADER *Table, >=20 > + IN UINTN TableIndex, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + UINTN *TableCount; >=20 > + >=20 > + TableCount =3D (UINTN *)Context; >=20 > + >=20 > + if (Table =3D=3D NULL) { >=20 > + ASSERT (Table !=3D NULL); >=20 > + return; >=20 > + } >=20 > + >=20 > + (*TableCount)++; >=20 > +} >=20 >=20 >=20 > - if (HWChange =3D=3D NULL) return; >=20 > +/** >=20 > + Calculate CRC based on each offset in the ACPI table. >=20 > + >=20 > + @param[in] Table The pointer to ACPI table. >=20 > + @param[in] TableIndex The ACPI table index. >=20 > + @param[in] Context The pointer to UINT32 array. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +CalculateAcpiTableCrc ( >=20 > + IN EFI_ACPI_COMMON_HEADER *Table, >=20 > + IN UINTN TableIndex, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + UINT32 *TableCrcRecord; >=20 > + >=20 > + TableCrcRecord =3D (UINT32 *)Context; >=20 > + >=20 > + if (Table =3D=3D NULL) { >=20 > + ASSERT (Table !=3D NULL); >=20 > + return; >=20 > + } >=20 >=20 >=20 > // >=20 > - // add HWChange inputs: PCI devices >=20 > + // Calculate CRC value. >=20 > // >=20 > - for (Index =3D 0; HandleCount > 0; HandleCount--) { >=20 > - PciId =3D 0; >=20 > - Status =3D gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProto= colGuid, > (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 > - } >=20 > - HWChange[Index++] =3D PciId; >=20 > + if (Table->Signature =3D=3D > EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) { >=20 > + // >=20 > + // Zero HardwareSignature field before Calculating FACS CRC >=20 > + // >=20 > + ((EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)Table)- > >HardwareSignature =3D 0; >=20 > + } >=20 > + >=20 > + gBS->CalculateCrc32 ((UINT8 *)Table, (UINTN)Table->Length, > &TableCrcRecord[TableIndex]); >=20 > +} >=20 > + >=20 > +/** >=20 > + This function calculates CRC based on each ACPI table. >=20 > + It also calculates CRC and provides as HardwareSignature field in FACS= . >=20 > +**/ >=20 > +VOID >=20 > +IsAcpiTableChange ( >=20 > + VOID >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + BOOLEAN IsRsdt; >=20 > + UINTN AcpiTableCount; >=20 > + UINT32 *TableCrcRecord; >=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 > + >=20 > + IsRsdt =3D FALSE; >=20 > + AcpiTableCount =3D 0; >=20 > + TableCrcRecord =3D NULL; >=20 > + Rsdp =3D NULL; >=20 > + Rsdt =3D NULL; >=20 > + Xsdt =3D NULL; >=20 > + FacsPtr =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 > + Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress; >=20 > + Xsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress; >=20 > + if (Xsdt =3D=3D NULL) { >=20 > + if (Rsdt !=3D NULL) { >=20 > + IsRsdt =3D TRUE; >=20 > + } else { >=20 > + return; >=20 > } >=20 > } >=20 >=20 >=20 > + FacsPtr =3D (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE > *)EfiLocateFirstAcpiTable > (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE); >=20 > + if (FacsPtr =3D=3D NULL) { >=20 > + return; >=20 > + } >=20 > + >=20 > // >=20 > - // Locate FACP Table >=20 > + // Count the ACPI tables found by RSDT/XSDT and FADT. >=20 > // >=20 > - Handle =3D 0; >=20 > - Status =3D LocateAcpiTableBySignature ( >=20 > - EFI_ACPI_6_5_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 > + if (IsRsdt) { >=20 > + EnumerateAllAcpiTables (Rsdt, sizeof (UINT32), GetAcpiTableCount,=20 > + (VOID > *)&AcpiTableCount); >=20 > + } else { >=20 > + EnumerateAllAcpiTables (Xsdt, sizeof (UINT64), GetAcpiTableCount,=20 > + (VOID > *)&AcpiTableCount); >=20 > } >=20 >=20 >=20 > // >=20 > - // add HWChange inputs: others >=20 > + // Allocate memory for founded ACPI tables. >=20 > // >=20 > - HWChange[Index++] =3D (UINT32)pFADT->XDsdt; >=20 > + TableCrcRecord =3D AllocateZeroPool (sizeof (UINT32) *=20 > + AcpiTableCount); >=20 > + if (TableCrcRecord =3D=3D NULL) { >=20 > + return; >=20 > + } >=20 >=20 >=20 > // >=20 > - // Calculate CRC value with HWChange data. >=20 > + // Calculate CRC for each ACPI table and set record. >=20 > // >=20 > - Status =3D gBS->CalculateCrc32(HWChange, HWChangeSize, &CRC); >=20 > - DEBUG ((DEBUG_INFO, "CRC =3D %x and Status =3D %r\n", CRC, Status)); >=20 > + if (IsRsdt) { >=20 > + EnumerateAllAcpiTables (Rsdt, sizeof (UINT32),=20 > + CalculateAcpiTableCrc, (VOID > *)TableCrcRecord); >=20 > + } else { >=20 > + EnumerateAllAcpiTables (Xsdt, sizeof (UINT64),=20 > + CalculateAcpiTableCrc, (VOID > *)TableCrcRecord); >=20 > + } >=20 >=20 >=20 > // >=20 > - // Set HardwareSignature value based on CRC value. >=20 > + // Calculate and set HardwareSignature data. >=20 > // >=20 > - FacsPtr =3D (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN) > pFADT->FirmwareCtrl; >=20 > - FacsPtr->HardwareSignature =3D CRC; >=20 > - FreePool (HWChange); >=20 > + Status =3D gBS->CalculateCrc32 ((UINT8 *)TableCrcRecord,=20 > + AcpiTableCount, > &(FacsPtr->HardwareSignature)); >=20 > + DEBUG ((DEBUG_INFO, "HardwareSignature =3D %x and Status =3D %r\n",=20 > + FacsPtr- > >HardwareSignature, Status)); >=20 > + >=20 > + FreePool (TableCrcRecord); >=20 > + DEBUG ((DEBUG_INFO, "%a() - End\n", __FUNCTION__)); >=20 > } >=20 >=20 >=20 > VOID >=20 > @@ -1329,7 +1477,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