From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.6918.1685510582651390406 for ; Tue, 30 May 2023 22:23:02 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=GNyLjQnb; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685510582; x=1717046582; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=Ln1E/9JSVjim2B7XXOeKvkmcUJsywlD3Son53RpqB0s=; b=GNyLjQnbZzA8AqvTPvtI69xTsigzFKfTrfvXwGsptPZUYl+fDayHZ80t GX+Gwx41G5nsz36jgs8J/Ly9XovSskJZNcmeRwVTYM+T0jY9pOb52OW8g I+CukgUfgiV9fzg9fh5M+jjPAtgFiAfPHKEYZRJ3YA77ZJR8OL0WLQLw8 Kt48D1tbEf1O66O3dMnHXnGNbU3/xzGp+DwE2MSjzyYd9Fg+4hbCvaX7u z+xkPg4D3jznzf05K1lInGtxrekSK5hZj6HR+FLqjf7/2+7SDETDd9INU cdr7dZ6VIHJPSDxqtfp/uDcx++Bm2/7KXLh//QXyum90A+mLkbG/PuFpQ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="334758496" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208,217";a="334758496" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 22:23:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="851069476" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208,217";a="851069476" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP; 30 May 2023 22:23:02 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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 22:23:01 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 22:23:01 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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 22:23:01 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.48) by edgegateway.intel.com (192.55.55.71) 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 22:23:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bpx74eZmGPpA5YehJZAvwBYzt11sVa5Yo4bnVZid/JEnN+twaOsDjkzah8zxr9P7taHGFwshroElr7GTs1385UkX74+fGJL9ZAftse5jwJKh7j1iQh6aW7QKPbZ3PLaCh/Qd6oHdjp7OhJLmKw6hWmRKlqyuV3OdmuL8POIBws/06/aXNPIocatw1xUxor0aiEK2on58N4vPQsqG31pKi6lYBoWcr+HT5MBVcXhXEEE1vZPDsZWMH9shzJ4PBxo6PsXx3XAf+C//rUu0JEI+eFR2YLeSxxCFdcvQvr8y46O+vy/eey92xinpCEcaC0DEdcjzCz9TnXOqp6mD4l9O/Q== 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=mRG08FzkxR510mwSlRPSy4rbWxeQT6bdCk+JNSDl3mE=; b=MRzETgJ3fc4GN/lVvqX7QbbOqG2r5KNqkJGg810VtcIRcFORra9Dctp6C6m+huOJaJui4CI0mn4CToGY8tdEmwN317pwmIghQ5wPI+IlgZcXgh3z41kkmv8dpg4e5g/HzkjKS7eMvSQV3EQNapGPBJLzug8ZMGSbL4ScLfK96hlI+xVzBXZKzv/fWPOwncTbaDODymgNZuwZSxBSl/d4QM1W4tyLGOrA9Ys5qAdsfWKpx84I8aHEGBrECRFSsXpKTM1qrtmnyiP75+afrhgMK96UYECPF+ubXiuXVx3atv/VZVvbeetsoij4L3ktz530P6VmjBW4P2+yeJ1shtst9Q== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by DM8PR11MB5573.namprd11.prod.outlook.com (2603:10b6:8:3b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Wed, 31 May 2023 05:22:56 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d%5]) with mapi id 15.20.6433.018; Wed, 31 May 2023 05:22:55 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Ke, VincentX" CC: "Ke, VincentX" , "Chiu, Chasel" , "Desimone, Nathaniel L" , "Oram, Isaac W" , "Gao, Liming" , "Dong, Eric" , "Sinha, Ankit" Subject: Re: [edk2-devel] [PATCH v10] MinPlatformPkg: Update HWSignature field in FACS Thread-Topic: [edk2-devel] [PATCH v10] MinPlatformPkg: Update HWSignature field in FACS Thread-Index: AQHZk2ptRqPpbpGpy0ChYsasIlY/oa9z2Nkw Date: Wed, 31 May 2023 05:22:55 +0000 Message-ID: References: <20230531024806.374-1-vincentx.ke@intel.com> In-Reply-To: <20230531024806.374-1-vincentx.ke@intel.com> 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: MN6PR11MB8244:EE_|DM8PR11MB5573:EE_ x-ms-office365-filtering-correlation-id: dfa8d250-cbc3-4778-917d-08db619716a9 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: THpZf8IzKXSMGypwOP8ODWg/bRnjiaju3CKaYZsFujLxAxKrcYowpo/U8Cuou1frjNxlzCXF7h3lfWIaS3cibKEtctGNxD53bwqSR6nEaJxSzeYtsYFBOm1qGaC3HEan3yVuNDOiKILnGMAoQBk1/jk5kxrJzv0QevTnrbQAwLR87KIHacnG5QIf1vEb6xkC5ikD9adT42PtjoEXHOw0ysHptJ6LGjNNmD9c+HdQQFQOTzqU0crRnEsrD5BgXTAOFZtFlDtgqIN3HlDvtfip3CCyZaPqO+iylCjJ36J26elBjaSdMXYKfzCaTxIgROuWpRthlIYL5zcnOUNrAj3H217ol0viO73PDrLLI124VzKo6aKS+iA/y67BEts8YCc3X9xUhdCtZBAo4JD6NP248hbW7vgu5sZmml+IhdDVd/dIGSikkkrvhlhjyjupmmBJq1ojHfodUQAhxWww4FvViteAQUtjYSGXXQMZAowbuQ0roNzVguvL7/rvSI1lFDujskoHm3u3ujLh0pr0mlrtP+XOXR3a5usWXtlfTtb3JAT2JIkvuugg3q/CmS4uS4hvtOM1wqtOxsb7DO+tx0lutEaDy2YLFxXwXsMNYZqvbcyvQvjcrNm0BT9Fdyt9szzkJYfdw+KRqKPfriY+p8Grcg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(346002)(136003)(376002)(396003)(39860400002)(451199021)(5660300002)(52536014)(6506007)(53546011)(9686003)(66899021)(166002)(26005)(107886003)(66946007)(76116006)(64756008)(966005)(66446008)(66556008)(66476007)(91956017)(122000001)(38100700002)(6636002)(4326008)(82960400001)(33656002)(8676002)(8936002)(83380400001)(86362001)(41300700001)(54906003)(316002)(110136005)(71200400001)(7696005)(55016003)(186003)(15650500001)(30864003)(2906002)(478600001)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?kyhlI7fbJMu2RnoqEweoOoJLYTS82GGKa8nbaqmLZIPrDvXBSoCzJSz0hxd+?= =?us-ascii?Q?ZOU/qev/Gt1RaFVAUKxB/wXWKiGzp0+O+77ttSkf78ktyDUj7umiALpHVrAn?= =?us-ascii?Q?aHFN5nRZXfpNuWzllOQ1CW1n+tjs2wEj20zUEqOeAYh1k4gVP1N26NJmzn8D?= =?us-ascii?Q?DNOJY6niJqxHLxLyPua0zihXQXfXiBDZ0w5ZqkeG/snBzQcnYcoji+hgWoHz?= =?us-ascii?Q?GK7WI0psKAJv8oWC/czI+XOVxXssGUNtVzNX0pOgsh0nzY7trlr6id4Trvph?= =?us-ascii?Q?cU+us+C/wrJ7mXdrIPsMcaYcfcO52UGsl2L8Dz6CqCLQzt1qVpJfKFL/rZ0s?= =?us-ascii?Q?IWryqKh7DzawbHw0Crp/vyXLnGXQ2VgDgokaw4H7KNvmo57d2oqi/TfdoJIc?= =?us-ascii?Q?7rpGwW/kP3vO4Rd0GCnbWt/1kSASZ9gwR/t074Dks2c2rGpQYpwGEXRLJ9Rz?= =?us-ascii?Q?Fpxef1gO5DfiDQwpNuNXNDXpqd6QVEPjsL84Vpxh4YQhO+lcAltThIujEUFb?= =?us-ascii?Q?aUEZMbXYfeK4yfpaBDjuPfHdxSXzZgx6QjEV/z3XS+Yspl6qw0Rv09gW/Og9?= =?us-ascii?Q?e4XGx6nfUltXno+6kblY4S8dv2AJm/D6yAazhN7ebjirt1zapf5otdTORBo7?= =?us-ascii?Q?pTUD1K0T7P4gBNf42g1/gWXiFvPy5iKEBRBIDzip5yyDoK94HfxqGZKLtC+0?= =?us-ascii?Q?pRpHm4o6Oxkv6Yn+rBJ4VX5vA2bMJ48dVvPgLXhVmtmQONDdAL5H7nf8qr3Q?= =?us-ascii?Q?Tdz5sbkdPl//oSPFmVayBQKQvqt9KUMbkqjFCUVxzkpDEDcbgDzQ5IVT7/DC?= =?us-ascii?Q?D7s3iDF6ifIQyoptG20W7eZoTz7rwuMU92Os6yNiDD/Z1acAhMQyENyw+Aa7?= =?us-ascii?Q?iJFtlewaoXCW2bmTYYJ24wb0iRKp4gf7LlIGHZS/TT/5x0CYTabTfSEu0/rg?= =?us-ascii?Q?JpW5J7EePeblSxkxXhdCMd84PjMwbp7Wo9xFxwu9HqJjPBbofoUjmeJW6qKU?= =?us-ascii?Q?7uXwyOyhq8Q2uY6pzlnfafo1dWSo5u1QlU5UHYmYuw28ZshVV70HbmaJFogE?= =?us-ascii?Q?ZmssDrTxBPrCtsbkWvTZ/lBmwQEY3DVbMsNHFomkcZYjmqH+Ky3evH/u3U8H?= =?us-ascii?Q?GImQn1whBdgaSXsVZps38gMpSiGnVbHAnuzPhCVJl/dqRmYPeiI2i7LR+r76?= =?us-ascii?Q?kGuEqjCgIOIbaA7jSPVfZWb5ia/UCPsWF24bvfDkCB5jyzte7cKojpSF+m/t?= =?us-ascii?Q?mPqSlwF4fENtDo/NWtMbofzRKwReswlw1XRiDXU0J4pzEUiFuuSLF8lUlhSe?= =?us-ascii?Q?6ZRXWCynDnAmwDdsvsZsLtrw2KRCqykyWGbeSrD8Y/LHvXkr3XiAQAcTOzLc?= =?us-ascii?Q?1dKD2m0Q+z0+DVa3XHT4F1oaI+5xAnyXG5hUMhJaaSs4PJNVD++SMhTU5WV4?= =?us-ascii?Q?YBR9DjFeH6iOumo8Kwac738VEbKB+yrNGGPXgnVLjSmt0cvGsjgx4nDhJjSK?= =?us-ascii?Q?6VHU3dfKZuy3Q3SBKG0N63JHDsAjueg5TSXVU4SLsEuZE1wmidF7zO3rUvtN?= =?us-ascii?Q?PUR18IcGp9ptJqpiulx3R/jHNwX27SfLc7MzuDNDfMVNCQrXYxFU0Sss2hXj?= =?us-ascii?Q?Uw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfa8d250-cbc3-4778-917d-08db619716a9 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2023 05:22:55.1062 (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: Ddc3eU2hVj7JMFRVqqPPbAwdTRWkLPekXvNfb7ekzESr/o7acssn2b896SL/5ofP82N5isQqHsSSeIZWPrjQGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5573 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB8244F3FA28637BFA219EA1EC8C489MN6PR11MB8244namp_" --_000_MN6PR11MB8244F3FA28637BFA219EA1EC8C489MN6PR11MB8244namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni thanks, ray ________________________________ From: devel@edk2.groups.io on behalf of VincentX Ke = Sent: Wednesday, May 31, 2023 10:48:06 AM To: devel@edk2.groups.io Cc: Ke, VincentX ; Chiu, Chasel ; Desimone, Nathaniel L ; Oram, Isaac W = ; Gao, Liming ; Dong, Eri= c ; Sinha, Ankit Subject: [edk2-devel] [PATCH v10] MinPlatformPkg: Update HWSignature field = in FACS From: VincentX Ke REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4428 Calculating CRC based on each ACPI table. Update HWSignature field in FACS based on CRC while ACPI table changed. 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(-) diff --git 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 ( } /** - This function calculates RCR based on PCI Device ID and Vendor ID from t= he devices - available on the platform. - It also includes other instances of BIOS change to calculate CRC and pro= vides as - HWSignature filed in FADT table. + Function prototype for GetAcpiTableCount/CalculateAcpiTableCrc. + + @param[in] Table The pointer to ACPI table. + @param[in] TableIndex The ACPI table index. + @param[in] Context The pointer to UINTN for GetAcpiTableCount. + The pointer to UINT32 array for CalculateAcpiTab= leCrc. **/ +typedef VOID -IsHardwareChange ( - VOID +(EFIAPI *ACPI_TABLE_CALLBACK)( + IN EFI_ACPI_COMMON_HEADER *Table, + IN UINTN TableIndex, + IN VOID *Context + ); + +/** + Enumerate all ACPI tables in RSDT/XSDT. + + @param[in] Sdt ACPI XSDT/RSDT. + @param[in] TablePointerSize Size of table pointer: + 4(RSDT) or 8(XSDT). + @param[in] CallbackFunction The pointer to GetAcpiTableCount/Calculate= AcpiTableCrc. + @param[in] Context The pointer to UINTN for GetAcpiTableCount= . + The pointer to UINT32 array for CalculateA= cpiTableCrc. +**/ +VOID +EnumerateAllAcpiTables ( + IN EFI_ACPI_DESCRIPTION_HEADER *Sdt, + IN UINTN TablePointerSize, + IN ACPI_TABLE_CALLBACK CallbackFunction, + IN VOID *Context ) { - EFI_STATUS Status; - UINTN Index; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - EFI_PCI_IO_PROTOCOL *PciIo; - UINT32 CRC; - UINT32 *HWChange; - UINTN HWChangeSize; - UINT32 PciId; - UINTN Handle; - EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr; - EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *pFADT; - - HandleCount =3D 0; - HandleBuffer =3D NULL; - - Status =3D gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciIoProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - return; // PciIO protocol not installed yet! + UINTN Index; + UINTN TableIndex; + UINTN EntryCount; + UINT64 EntryPtr; + UINTN BasePtr; + EFI_ACPI_COMMON_HEADER *Table; + EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *FadtPtr; + + Index =3D 0; + TableIndex =3D 0; + EntryCount =3D (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / Ta= blePointerSize; + EntryPtr =3D 0; + BasePtr =3D (UINTN)(Sdt + 1); + Table =3D NULL; + FadtPtr =3D NULL; + + if (Sdt =3D=3D NULL) { + ASSERT (Sdt !=3D NULL); + return; } - // - // Allocate memory for HWChange and add additional entrie for - // pFADT->XDsdt - // - HWChangeSize =3D HandleCount + 1; - HWChange =3D AllocateZeroPool (sizeof(UINT32) * HWChangeSize); - ASSERT(HWChange !=3D NULL); + for (Index =3D 0; Index < EntryCount; Index++) { + EntryPtr =3D 0; + Table =3D NULL; + CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * TablePointerSize), Tabl= ePointerSize); + Table =3D (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr)); + if (Table !=3D NULL) { + CallbackFunction (Table, TableIndex++, Context); + } + + if (Table->Signature =3D=3D EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_= SIGNATURE) { + FadtPtr =3D (EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *)Table; + if (FadtPtr->Header.Revision < EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_T= ABLE_REVISION) { + // + // Locate FACS/DSDT in FADT + // + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->Firmwa= reCtrl, TableIndex++, Context); + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->Dsdt, = TableIndex++, Context); + } else { + // + // Locate FACS in FADT + // + if (FadtPtr->XFirmwareCtrl !=3D 0) { + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->XFir= mwareCtrl, TableIndex++, Context); + } else { + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->Firm= wareCtrl, TableIndex++, Context); + } + + // + // Locate DSDT in FADT + // + if (FadtPtr->XDsdt !=3D 0) { + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->XDsd= t, TableIndex++, Context); + } else { + CallbackFunction ((EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->Dsdt= , TableIndex++, Context); + } + } + } + } +} + +/** + Count the number of ACPI tables. + + @param[in] Table The pointer to ACPI table. + @param[in] TableIndex The ACPI table index. + @param[in] Context The pointer to UINTN. +**/ +VOID +EFIAPI +GetAcpiTableCount ( + IN EFI_ACPI_COMMON_HEADER *Table, + IN UINTN TableIndex, + IN VOID *Context + ) +{ + UINTN *TableCount; + + TableCount =3D (UINTN *)Context; + + if (Table =3D=3D NULL) { + ASSERT (Table !=3D NULL); + return; + } + + (*TableCount)++; +} - if (HWChange =3D=3D NULL) return; +/** + Calculate CRC based on each offset in the ACPI table. + + @param[in] Table The pointer to ACPI table. + @param[in] TableIndex The ACPI table index. + @param[in] Context The pointer to UINT32 array. +**/ +VOID +EFIAPI +CalculateAcpiTableCrc ( + IN EFI_ACPI_COMMON_HEADER *Table, + IN UINTN TableIndex, + IN VOID *Context + ) +{ + UINT32 *TableCrcRecord; + + TableCrcRecord =3D (UINT32 *)Context; + + if (Table =3D=3D NULL) { + ASSERT (Table !=3D NULL); + return; + } // - // add HWChange inputs: PCI devices + // Calculate CRC value. // - for (Index =3D 0; HandleCount > 0; HandleCount--) { - PciId =3D 0; - Status =3D gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtoco= lGuid, (VOID **) &PciIo); - if (!EFI_ERROR (Status)) { - Status =3D PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, 1, &PciId= ); - if (EFI_ERROR (Status)) { - continue; - } - HWChange[Index++] =3D PciId; + if (Table->Signature =3D=3D EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE= _SIGNATURE) { + // + // Zero HardwareSignature field before Calculating FACS CRC + // + ((EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)Table)->HardwareSigna= ture =3D 0; + } + + gBS->CalculateCrc32 ((UINT8 *)Table, (UINTN)Table->Length, &TableCrcReco= rd[TableIndex]); +} + +/** + This function calculates CRC based on each ACPI table. + It also calculates CRC and provides as HardwareSignature field in FACS. +**/ +VOID +IsAcpiTableChange ( + VOID + ) +{ + EFI_STATUS Status; + BOOLEAN IsRsdt; + UINTN AcpiTableCount; + UINT32 *TableCrcRecord; + EFI_ACPI_6_5_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; + EFI_ACPI_DESCRIPTION_HEADER *Rsdt; + EFI_ACPI_DESCRIPTION_HEADER *Xsdt; + EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr; + + IsRsdt =3D FALSE; + AcpiTableCount =3D 0; + TableCrcRecord =3D NULL; + Rsdp =3D NULL; + Rsdt =3D NULL; + Xsdt =3D NULL; + FacsPtr =3D NULL; + + DEBUG ((DEBUG_INFO, "%a() - Start\n", __FUNCTION__)); + + Status =3D EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **)= &Rsdp); + if (EFI_ERROR (Status) || (Rsdp =3D=3D NULL)) { + return; + } + + Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress; + Xsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress; + if (Xsdt =3D=3D NULL) { + if (Rsdt !=3D NULL) { + IsRsdt =3D TRUE; + } else { + return; } } + FacsPtr =3D (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)EfiLocateFir= stAcpiTable (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE); + if (FacsPtr =3D=3D NULL) { + return; + } + // - // Locate FACP Table + // Count the ACPI tables found by RSDT/XSDT and FADT. // - Handle =3D 0; - Status =3D LocateAcpiTableBySignature ( - EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, - (EFI_ACPI_DESCRIPTION_HEADER **) &pFADT, - &Handle - ); - if (EFI_ERROR (Status) || (pFADT =3D=3D NULL)) { - return; //Table not found or out of memory resource for pFADT table + if (IsRsdt) { + EnumerateAllAcpiTables (Rsdt, sizeof (UINT32), GetAcpiTableCount, (VOI= D *)&AcpiTableCount); + } else { + EnumerateAllAcpiTables (Xsdt, sizeof (UINT64), GetAcpiTableCount, (VOI= D *)&AcpiTableCount); } // - // add HWChange inputs: others + // Allocate memory for founded ACPI tables. // - HWChange[Index++] =3D (UINT32)pFADT->XDsdt; + TableCrcRecord =3D AllocateZeroPool (sizeof (UINT32) * AcpiTableCount); + if (TableCrcRecord =3D=3D NULL) { + return; + } // - // Calculate CRC value with HWChange data. + // Calculate CRC for each ACPI table and set record. // - Status =3D gBS->CalculateCrc32(HWChange, HWChangeSize, &CRC); - DEBUG ((DEBUG_INFO, "CRC =3D %x and Status =3D %r\n", CRC, Status)); + if (IsRsdt) { + EnumerateAllAcpiTables (Rsdt, sizeof (UINT32), CalculateAcpiTableCrc, = (VOID *)TableCrcRecord); + } else { + EnumerateAllAcpiTables (Xsdt, sizeof (UINT64), CalculateAcpiTableCrc, = (VOID *)TableCrcRecord); + } // - // Set HardwareSignature value based on CRC value. + // Calculate and set HardwareSignature data. // - FacsPtr =3D (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN) pFAD= T->FirmwareCtrl; - FacsPtr->HardwareSignature =3D CRC; - FreePool (HWChange); + Status =3D gBS->CalculateCrc32 ((UINT8 *)TableCrcRecord, AcpiTableCount,= &(FacsPtr->HardwareSignature)); + DEBUG ((DEBUG_INFO, "HardwareSignature =3D %x and Status =3D %r\n", Facs= Ptr->HardwareSignature, Status)); + + FreePool (TableCrcRecord); + DEBUG ((DEBUG_INFO, "%a() - End\n", __FUNCTION__)); } VOID @@ -1329,7 +1477,7 @@ AcpiEndOfDxeEvent ( // // Calculate Hardware Signature value based on current platform configur= ations // - IsHardwareChange (); + IsAcpiTableChange (); } /** diff --git 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 gEfiHobListGuid ## CONSUMES gEfiEndOfDxeEventGroupGuid ## CONSUMES + gEfiAcpiTableGuid ## CONSUMES [Depex] gEfiAcpiTableProtocolGuid AND -- 2.39.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105475): https://edk2.groups.io/g/devel/message/105475 Mute This Topic: https://groups.io/mt/99234717/1712937 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] -=3D-=3D-=3D-=3D-=3D-=3D --_000_MN6PR11MB8244F3FA28637BFA219EA1EC8C489MN6PR11MB8244namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Ray Ni <Ray.ni@intel.com>

thanks,
ray

From: devel@edk2.groups.io = <devel@edk2.groups.io> on behalf of VincentX Ke <vincentx.ke@intel= .com>
Sent: Wednesday, May 31, 2023 10:48:06 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ke, VincentX <vincentx.ke@intel.com>; Chiu, Chasel <cha= sel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@inte= l.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Gao, Liming <ga= oliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>; Sinha, Ankit <ankit.sinha@intel.com>
Subject: [edk2-devel] [PATCH v10] MinPlatformPkg: Update HWSignature= field in FACS
 
From: VincentX Ke <vincentx.ke@intel.com>
REF: http= s://bugzilla.tianocore.org/show_bug.cgi?id=3D4428

Calculating CRC based on each ACPI table.
Update HWSignature field in FACS based on CRC while ACPI table changed.

Change-Id: Ic0ca66ff10cda0fbcd0683020fab1bc9aea9b78c
Signed-off-by: VincentX Ke <vincentx.ke@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ankit Sinha<ankit.sinha@intel.com>
Signed-off-by: VincentX Ke <vincentx.ke@intel.com>
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c &nb= sp; | 284 +++++++++++++++-----
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf | = ;  1 +
 2 files changed, 217 insertions(+), 68 deletions(-)

diff --git 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 (
 }

 

 /**

-  This function calculates RCR based on PCI Device ID and Vendor ID f= rom the devices

-  available on the platform.

-  It also includes other instances of BIOS change to calculate CRC an= d provides as

-  HWSignature filed in FADT table.

+  Function prototype for GetAcpiTableCount/CalculateAcpiTableCrc.

+

+  @param[in] Table        The poin= ter to ACPI table.

+  @param[in] TableIndex   The ACPI table index.

+  @param[in] Context      The pointer to UIN= TN for GetAcpiTableCount.

+            &n= bsp;            = ; The pointer to UINT32 array for CalculateAcpiTableCrc.

 **/

+typedef

 VOID

-IsHardwareChange (

-  VOID

+(EFIAPI *ACPI_TABLE_CALLBACK)(

+  IN  EFI_ACPI_COMMON_HEADER  *Table,

+  IN  UINTN         = ;          TableIndex,

+  IN  VOID         =            *Context

+  );

+

+/**

+  Enumerate all ACPI tables in RSDT/XSDT.

+

+  @param[in] Sdt         = ;       ACPI XSDT/RSDT.

+  @param[in] TablePointerSize   Size of table pointer:

+            &n= bsp;            = ;       4(RSDT) or 8(XSDT).

+  @param[in] CallbackFunction   The pointer to GetAcpiTable= Count/CalculateAcpiTableCrc.

+  @param[in] Context        &= nbsp;   The pointer to UINTN for GetAcpiTableCount.

+            &n= bsp;            = ;       The pointer to UINT32 array for Calcu= lateAcpiTableCrc.

+**/

+VOID

+EnumerateAllAcpiTables (

+  IN  EFI_ACPI_DESCRIPTION_HEADER  *Sdt,

+  IN  UINTN         = ;            &n= bsp;  TablePointerSize,

+  IN  ACPI_TABLE_CALLBACK      &nb= sp;   CallbackFunction,

+  IN  VOID         =             &nb= sp;   *Context

   )

 {

-  EFI_STATUS         &nb= sp;            =              St= atus;

-  UINTN          &n= bsp;            = ;            &n= bsp;    Index;

-  UINTN          &n= bsp;            = ;            &n= bsp;    HandleCount;

-  EFI_HANDLE         &nb= sp;            =              *H= andleBuffer;

-  EFI_PCI_IO_PROTOCOL        =             &nb= sp;     *PciIo;

-  UINT32          &= nbsp;           &nbs= p;            &= nbsp;   CRC;

-  UINT32          &= nbsp;           &nbs= p;            &= nbsp;   *HWChange;

-  UINTN          &n= bsp;            = ;            &n= bsp;    HWChangeSize;

-  UINT32          &= nbsp;           &nbs= p;            &= nbsp;   PciId;

-  UINTN          &n= bsp;            = ;            &n= bsp;    Handle;

-  EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr;

-  EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE    *pFADT;=

-

-  HandleCount  =3D 0;

-  HandleBuffer =3D NULL;

-

-  Status =3D gBS->LocateHandleBuffer (

-            &n= bsp;     ByProtocol,

-            &n= bsp;     &gEfiPciIoProtocolGuid,

-            &n= bsp;     NULL,

-            &n= bsp;     &HandleCount,

-            &n= bsp;     &HandleBuffer

-            &n= bsp;     );

-  if (EFI_ERROR (Status)) {

-    return; // PciIO protocol not installed yet!

+  UINTN          &n= bsp;            = ;            &n= bsp;  Index;

+  UINTN          &n= bsp;            = ;            &n= bsp;  TableIndex;

+  UINTN          &n= bsp;            = ;            &n= bsp;  EntryCount;

+  UINT64          &= nbsp;           &nbs= p;            &= nbsp; EntryPtr;

+  UINTN          &n= bsp;            = ;            &n= bsp;  BasePtr;

+  EFI_ACPI_COMMON_HEADER       &nb= sp;            = *Table;

+  EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE  *FadtPtr;

+

+  Index      =3D 0;

+  TableIndex =3D 0;

+  EntryCount =3D (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADE= R)) / TablePointerSize;

+  EntryPtr   =3D 0;

+  BasePtr    =3D (UINTN)(Sdt + 1);

+  Table      =3D NULL;

+  FadtPtr    =3D NULL;

+

+  if (Sdt =3D=3D NULL) {

+    ASSERT (Sdt !=3D NULL);

+    return;

   }

 

-  //

-  // Allocate memory for HWChange and add additional entrie for

-  // pFADT->XDsdt

-  //

-  HWChangeSize =3D HandleCount + 1;

-  HWChange =3D AllocateZeroPool (sizeof(UINT32) * HWChangeSize);

-  ASSERT(HWChange !=3D NULL);

+  for (Index =3D 0; Index < EntryCount; Index++) {

+    EntryPtr =3D 0;

+    Table    =3D NULL;

+    CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * Tabl= ePointerSize), TablePointerSize);

+    Table =3D (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr))= ;

+    if (Table !=3D NULL) {

+      CallbackFunction (Table, TableIndex++, Cont= ext);

+    }

+

+    if (Table->Signature =3D=3D EFI_ACPI_6_5_FIXED_ACPI_= DESCRIPTION_TABLE_SIGNATURE) {

+      FadtPtr =3D (EFI_ACPI_6_5_FIXED_ACPI_DESCRI= PTION_TABLE *)Table;

+      if (FadtPtr->Header.Revision < EFI_AC= PI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {

+        //

+        // Locate FACS/DSDT in FADT

+        //

+        CallbackFunction ((EFI_ACPI_COM= MON_HEADER *)(UINTN)FadtPtr->FirmwareCtrl, TableIndex++, Context);

+        CallbackFunction ((EFI_ACPI_COM= MON_HEADER *)(UINTN)FadtPtr->Dsdt, TableIndex++, Context);

+      } else {

+        //

+        // Locate FACS in FADT

+        //

+        if (FadtPtr->XFirmwareCtrl != =3D 0) {

+          CallbackFunction ((= EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->XFirmwareCtrl, TableIndex++, Co= ntext);

+        } else {

+          CallbackFunction ((= EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->FirmwareCtrl, TableIndex++, Con= text);

+        }

+

+        //

+        // Locate DSDT in FADT

+        //

+        if (FadtPtr->XDsdt !=3D 0) {=

+          CallbackFunction ((= EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->XDsdt, TableIndex++, Context);<= br>
+        } else {

+          CallbackFunction ((= EFI_ACPI_COMMON_HEADER *)(UINTN)FadtPtr->Dsdt, TableIndex++, Context);
+        }

+      }

+    }

+  }

+}

+

+/**

+  Count the number of ACPI tables.

+

+  @param[in] Table        The poin= ter to ACPI table.

+  @param[in] TableIndex   The ACPI table index.

+  @param[in] Context      The pointer to UIN= TN.

+**/

+VOID

+EFIAPI

+GetAcpiTableCount (

+  IN  EFI_ACPI_COMMON_HEADER  *Table,

+  IN  UINTN         = ;          TableIndex,

+  IN  VOID         =            *Context

+  )

+{

+  UINTN  *TableCount;

+

+  TableCount =3D (UINTN *)Context;

+

+  if (Table =3D=3D NULL) {

+    ASSERT (Table !=3D NULL);

+    return;

+  }

+

+  (*TableCount)++;

+}

 

-  if (HWChange =3D=3D NULL) return;

+/**

+  Calculate CRC based on each offset in the ACPI table.

+

+  @param[in] Table        The poin= ter to ACPI table.

+  @param[in] TableIndex   The ACPI table index.

+  @param[in] Context      The pointer to UIN= T32 array.

+**/

+VOID

+EFIAPI

+CalculateAcpiTableCrc (

+  IN  EFI_ACPI_COMMON_HEADER  *Table,

+  IN  UINTN         = ;          TableIndex,

+  IN  VOID         =            *Context

+  )

+{

+  UINT32  *TableCrcRecord;

+

+  TableCrcRecord =3D (UINT32 *)Context;

+

+  if (Table =3D=3D NULL) {

+    ASSERT (Table !=3D NULL);

+    return;

+  }

 

   //

-  // add HWChange inputs: PCI devices

+  // Calculate CRC value.

   //

-  for (Index =3D 0; HandleCount > 0; HandleCount--) {

-    PciId =3D 0;

-    Status =3D gBS->HandleProtocol (HandleBuffer[Index],= &gEfiPciIoProtocolGuid, (VOID **) &PciIo);

-    if (!EFI_ERROR (Status)) {

-      Status =3D PciIo->Pci.Read (PciIo, EfiPc= iIoWidthUint32, 0, 1, &PciId);

-      if (EFI_ERROR (Status)) {

-        continue;

-      }

-      HWChange[Index++] =3D PciId;

+  if (Table->Signature =3D=3D EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_S= TRUCTURE_SIGNATURE) {

+    //

+    // Zero HardwareSignature field before Calculating FACS= CRC

+    //

+    ((EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)Table)= ->HardwareSignature =3D 0;

+  }

+

+  gBS->CalculateCrc32 ((UINT8 *)Table, (UINTN)Table->Length, &a= mp;TableCrcRecord[TableIndex]);

+}

+

+/**

+  This function calculates CRC based on each ACPI table.

+  It also calculates CRC and provides as HardwareSignature field in F= ACS.

+**/

+VOID

+IsAcpiTableChange (

+  VOID

+  )

+{

+  EFI_STATUS         &nb= sp;            =             &nb= sp; Status;

+  BOOLEAN          =             &nb= sp;            =     IsRsdt;

+  UINTN          &n= bsp;            = ;            &n= bsp;     AcpiTableCount;

+  UINT32          &= nbsp;           &nbs= p;            &= nbsp;    *TableCrcRecord;

+  EFI_ACPI_6_5_ROOT_SYSTEM_DESCRIPTION_POINTER  *Rsdp;

+  EFI_ACPI_DESCRIPTION_HEADER      &nbs= p;            *Rsdt;=

+  EFI_ACPI_DESCRIPTION_HEADER      &nbs= p;            *Xsdt;=

+  EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE  *FacsPtr;

+

+  IsRsdt         =3D FALSE;
+  AcpiTableCount =3D 0;

+  TableCrcRecord =3D NULL;

+  Rsdp           = =3D NULL;

+  Rsdt           = =3D NULL;

+  Xsdt           = =3D NULL;

+  FacsPtr        =3D NULL;

+

+  DEBUG ((DEBUG_INFO, "%a() - Start\n", __FUNCTION__));

+

+  Status =3D EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, = (VOID **)&Rsdp);

+  if (EFI_ERROR (Status) || (Rsdp =3D=3D NULL)) {

+    return;

+  }

+

+  Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress= ;

+  Xsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress= ;

+  if (Xsdt =3D=3D NULL) {

+    if (Rsdt !=3D NULL) {

+      IsRsdt =3D TRUE;

+    } else {

+      return;

     }

   }

 

+  FacsPtr =3D (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)EfiLoca= teFirstAcpiTable (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE);<= br>
+  if (FacsPtr =3D=3D NULL) {

+    return;

+  }

+

   //

-  // Locate FACP Table

+  // Count the ACPI tables found by RSDT/XSDT and FADT.

   //

-  Handle =3D 0;

-  Status =3D LocateAcpiTableBySignature (

-            &n= bsp; EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,

-            &n= bsp; (EFI_ACPI_DESCRIPTION_HEADER **) &pFADT,

-            &n= bsp; &Handle

-            &n= bsp; );

-  if (EFI_ERROR (Status) || (pFADT =3D=3D NULL)) {

-    return;  //Table not found or out of memory resour= ce for pFADT table

+  if (IsRsdt) {

+    EnumerateAllAcpiTables (Rsdt, sizeof (UINT32), GetAcpiT= ableCount, (VOID *)&AcpiTableCount);

+  } else {

+    EnumerateAllAcpiTables (Xsdt, sizeof (UINT64), GetAcpiT= ableCount, (VOID *)&AcpiTableCount);

   }

 

   //

-  // add HWChange inputs: others

+  // Allocate memory for founded ACPI tables.

   //

-  HWChange[Index++] =3D (UINT32)pFADT->XDsdt;

+  TableCrcRecord =3D AllocateZeroPool (sizeof (UINT32) * AcpiTableCou= nt);

+  if (TableCrcRecord =3D=3D NULL) {

+    return;

+  }

 

   //

-  // Calculate CRC value with HWChange data.

+  // Calculate CRC for each ACPI table and set record.

   //

-  Status =3D gBS->CalculateCrc32(HWChange, HWChangeSize, &CRC)= ;

-  DEBUG ((DEBUG_INFO, "CRC =3D %x and Status =3D %r\n", CRC= , Status));

+  if (IsRsdt) {

+    EnumerateAllAcpiTables (Rsdt, sizeof (UINT32), Calculat= eAcpiTableCrc, (VOID *)TableCrcRecord);

+  } else {

+    EnumerateAllAcpiTables (Xsdt, sizeof (UINT64), Calculat= eAcpiTableCrc, (VOID *)TableCrcRecord);

+  }

 

   //

-  // Set HardwareSignature value based on CRC value.

+  // Calculate and set HardwareSignature data.

   //

-  FacsPtr =3D (EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)= pFADT->FirmwareCtrl;

-  FacsPtr->HardwareSignature =3D CRC;

-  FreePool (HWChange);

+  Status =3D gBS->CalculateCrc32 ((UINT8 *)TableCrcRecord, AcpiTab= leCount, &(FacsPtr->HardwareSignature));

+  DEBUG ((DEBUG_INFO, "HardwareSignature =3D %x and Status =3D %= r\n", FacsPtr->HardwareSignature, Status));

+

+  FreePool (TableCrcRecord);

+  DEBUG ((DEBUG_INFO, "%a() - End\n", __FUNCTION__));

 }

 

 VOID

@@ -1329,7 +1477,7 @@ AcpiEndOfDxeEvent (
   //

   // Calculate Hardware Signature value based on current platfor= m configurations

   //

-  IsHardwareChange ();

+  IsAcpiTableChange ();

 }

 

 /**

diff --git 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      &nbs= p;            &= nbsp;    ## CONSUMES

   gEfiHobListGuid        = ;            &n= bsp;          ## CONSUMES

   gEfiEndOfDxeEventGroupGuid      =             &nb= sp; ## CONSUMES

+  gEfiAcpiTableGuid        &n= bsp;            = ;        ## CONSUMES

 

 [Depex]

   gEfiAcpiTableProtocolGuid      &= nbsp;    AND

--
2.39.2.windows.1



-=3D-=3D-=3D-=3D-=3D-=3D
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105475): https://edk2.groups.io/g/devel/message/105475
Mute This Topic: https://= groups.io/mt/99234717/1712937
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.= groups.io/g/devel/unsub [ray.ni@intel.com]
-=3D-=3D-=3D-=3D-=3D-=3D


--_000_MN6PR11MB8244F3FA28637BFA219EA1EC8C489MN6PR11MB8244namp_--