From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.7126.1685511473894791639 for ; Tue, 30 May 2023 22:37:53 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=OcYXxSoF; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: chasel.chiu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685511473; x=1717047473; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=pyZpGUyJDNFXd+gUcvE+6L/QYiV2aLOXFoPtrZUMNT0=; b=OcYXxSoFgvZNfZloxK5cZHxRO/jjuRfc3JSppCMxsInxXcgmyY9gF9Yh a0H2bPvihOnsaU0CQteN5JN0iB8lwJe7AQn0nwCSUjJHeXCHVk125lbAe MlyKNq9tz0OrERInpK9IOYUaw3DKbuyrJvl1BVEzk0xGt4AbgyIiuilOZ 5VWiDSw7sKVtjDDXDWZbrTHxvGm6I8+uuOcymhW1/3Zj4D0KJ1k2ZZLXC q6C3LSpPDlAAOh8bUyYTwXRGNBrP+IeMVb76dvN9vdq9Qrqcto011W8i+ g4otqPt5QWGawGHKXxkJAjlTvRRQI7hD0vcwYdZ33MHAK18CSKgFlRgYu A==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="383402430" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="383402430" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 22:37:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="881038584" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="881038584" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga005.jf.intel.com with ESMTP; 30 May 2023 22:37:52 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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:37:51 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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:37:51 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.104) by edgegateway.intel.com (192.55.55.70) 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:37:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TL4pWY6UVBgWo9JEmuaC3VzeHAC6XmmkuNE+s26R2tISPeSUZxZB3r9y0URztOE7MwQmR82c0TibjR8aZAk4Z2rdhSgiAqn/Cqk18xFRvfevdJA4pVmVf+c3eYyNYuLvWzh0WVDbNJ0a7bBXWpkp1MJRMzYkLk8PH6TzO934Rj/2pbWTY3DN2YGFxlEfEP9BJz7R19vtQxyUGK+WHCp3DTLeyhy/H/b87q9nK8Dxv6zrsa5K7w5h1dJtjxTHYXFdnebjAByoK47Qn4T2iCBtr7B+0fR4Z2eTnS/txC9bKQsY45dqxadQG0UNZYJIRTihpRO0JCyjtPHaofgZWDRoRw== 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=FOrRSyyXqMGFlSFpu+5NCUQNySlRWnU825IL0GU3w4M=; b=OYwCIl8mEGVw7UEUU9fkc5NH0Mh1vFmnpujvbhQWygTqLyEKo5E8a2qJpegOwn0TXMHUTPxdhoX0/KOMmWZPu//M7A+oMEP+FmMnK4kcU90xFzSArj4dO/4G7OiLERVX6ZPz1SHMs/A0BG6/lj9ho+OMZ4+hYacd2Dpdinb1RB7U/kzx9xIFr/EbT6TMskwstUA/6EDTMK6ONxZexaTYuYrHHCMxmOljugSs8VulNNuWKZkhCKgQs1EWeg0YakJx8tciVkRT3/Mgdao+3bYrcu3QIe+1uv/YteQzy6r5wgR+eSG8riQCvsli/Ysb97PzzUn3L6v5oYeOEUrKFhorAw== 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 CH0PR11MB5475.namprd11.prod.outlook.com (2603:10b6:610:d6::21) by SJ2PR11MB7520.namprd11.prod.outlook.com (2603:10b6:a03:4c2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Wed, 31 May 2023 05:37:48 +0000 Received: from CH0PR11MB5475.namprd11.prod.outlook.com ([fe80::3e21:b089:38bd:7ab2]) by CH0PR11MB5475.namprd11.prod.outlook.com ([fe80::3e21:b089:38bd:7ab2%5]) with mapi id 15.20.6433.024; Wed, 31 May 2023 05:37:48 +0000 From: "Chiu, Chasel" To: "Ke, VincentX" , "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: AQHZk2pbZLkmHsyAokKgITgUZK2dKa9z3RsQ Date: Wed, 31 May 2023 05:37:47 +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: CH0PR11MB5475:EE_|SJ2PR11MB7520:EE_ x-ms-office365-filtering-correlation-id: 005f57a1-4f57-44f5-50f2-08db61992ad9 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: 3a0bM6a53wgMHpgK8vISBxvP8sCjmZL/jG+JEIfeFLCIfSuJ7+hQPmaAq6zjoA0z9/XR9aRNezNtvxQYBo/fuL3HjmGSGsvDbyui2kyb8Z7KZ8vkcGX60KngVBwaXiUNyPfZAh0dmghOeTuDnN3VxVH3WsOtMLHTK6uoSyvGa9HQRgPiYHCkswyusY/kI9jNYwJMkjHzfRRJmkJaHXsHg55sCj5NrYvyAL2gFiLM2g/uVxgK+1vTdBl0avZazpDxNgVrwg6O1GOrvW2Cgi4ij9FBuMfYtfgJXRoHho20fIoK6nqonicdzhLb11T0zvexx6HeT3ytepGjzSjBrzaIOvl4I5kNqAIWv8ZlWYU3wWfl4FJFXWALhxhR6ebHcKRmkj2RMp0TYqDmGxy6oL2D/tj+5R0I2HJmx+92w5K2SDFWFzjl6qDW1E/NPzy1+I9tKIQKDYth7raln6/sVAxkPlgVD/pPMDtauI8qTnCRszAZwITD9WMfbFmhbgik1j7ckpQ/NwKeetLSIAHKwx0YSKjcidYQQBsh4o02mvw3UluNbH1+jFyNPrurdqJ4nHVIIb78U1w+t4m7w1Dr1XVtfmwaij901PnvTE6lDUJm74YOgWMmbKosZDiXyWVdLJA4smY19hU6WAPiynVNedHZMw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR11MB5475.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(376002)(39860400002)(136003)(396003)(451199021)(110136005)(316002)(76116006)(966005)(66476007)(66946007)(64756008)(66556008)(66446008)(478600001)(54906003)(4326008)(33656002)(86362001)(53546011)(9686003)(6506007)(26005)(186003)(41300700001)(30864003)(52536014)(8936002)(8676002)(15650500001)(5660300002)(83380400001)(2906002)(7696005)(71200400001)(55016003)(82960400001)(38100700002)(122000001)(38070700005)(107886003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hYeL9ZvH0VAFxFy8kSopqKxbt318lWlFrQGJIO12eTyGr4oWHLq5wRgC3ABu?= =?us-ascii?Q?e4btRb7hk7PKxqLTvsmv9D9MJcj9fwDWDcMqmApc7wX23HSQ+XvS3SzafUth?= =?us-ascii?Q?d8uyYjL6idyowcK5J/tc9fTpso3SdJKs5wmeA9rMsVFUZYJeeM1xkqf6mwC/?= =?us-ascii?Q?B8zhr3Mz5QDyYgIcWRIC6n4qx9CXgvRpdDciUJcgh/Jc+uUELlIEbY1aEIho?= =?us-ascii?Q?iK78ZhIIza8FZXa7cNAHkvhC7jjBt2O03d5cCqkAzUxlEeezDs1ADLfZnwRK?= =?us-ascii?Q?WYNAiNCBRNi1h7O/yPROVDY3XouhPgdw94ZsqfHhuulbcVV3/996jvkNy3P/?= =?us-ascii?Q?O2zzUdtzRcUNPydklBntecqBdY0GAIey8MIM17RkAtqJMnlGKZYE4AyC+QzP?= =?us-ascii?Q?g9S0S7re5kfW+EhBA53DxMaSEMw4W3s1kvUzZIVcbUtl5rf1af3HU4PSj0iN?= =?us-ascii?Q?pljJ0N5MWIMGeZ5PKvr8+9phmvmQJSsFI3GmFa+cWswOZ/FRYvKlADsAdCaY?= =?us-ascii?Q?+8E12XldCfTNp8SDdCNPT/wUZumJx0/yiPRSKH+4dAemcdyT4nv3ZRFsY647?= =?us-ascii?Q?oyZQE5SP+loNN5D0+NPsJg5r1CBqVWH5+fF8eZQR8AC+yRJxkrnt/0Fj5m0+?= =?us-ascii?Q?takdo2T1ZkUzj1NHz1+kzdyv1oEHT38vs55JSTRbP+RNiWy7gpEMgn9FmDyl?= =?us-ascii?Q?PYFJyr2y9H8mLpfnMqfhXv7+2LmKJ+Xizqnc7tsmCfssnTGu8s6Kn8vUqUAb?= =?us-ascii?Q?4YQkljAQJzCgHdmcvzg1kTKfBslyFSVVVn0gnF9rAGO5aTD6UaRYgaSgx2DW?= =?us-ascii?Q?Vs080c1ihSniS/vrxOqDe4EjEnFbNO3AH9wVl0GfKiPmvAlKrXH99lBS+tmE?= =?us-ascii?Q?p9G0huC1GXAfn+9QY2y6gKJxaY6mqu41jVLGDk9nSplKpFaC7dMFv0AZFmAs?= =?us-ascii?Q?s4rB6g0pQ90FgpfVNEIElXQgyJRXnwPMeH4eCapctHwjp/AMUz6u5M6d+NeB?= =?us-ascii?Q?X/2luaPpBg6JoJvlK4uVbiofWpj+8o9yIZU5YGBcYOvbeHBc3Q7AnfPk20nz?= =?us-ascii?Q?wKLheFlqE+2c2w6QrknyftP7PxCkdtp3vosvaD1tfWfzpofk7glQCEVwooJB?= =?us-ascii?Q?+Dg1nxGXB1rEEDQ53kw7uPw7i4sPGVS/92CfXN6rRzdAacDFyXIRc/JcHHSe?= =?us-ascii?Q?+PmYWc3meBpGNiDbp1BgPVJ6d020ESYoHhU1c1eGLhyZrnyfHXF+pg+NbLRQ?= =?us-ascii?Q?DLZ+HsAgXvzXQCGysmri7ktUWM6M0HnkrQJiQhl8S9RWQoqAo7UL40xwW9j3?= =?us-ascii?Q?lhMhamJUqr6TlXaP86CPnAlhQHZBej+/pjz/P5FP0HJn201volxyGL4NZFHz?= =?us-ascii?Q?4J35CyvQtDJTebnJ2J7Ok9qid/Moub3l9pvNDVAuue5BDUx4FI4n3g9NQK+v?= =?us-ascii?Q?w8kBDG/L5771m54sMMUZc/lKOgm0/fPHy5unEItImpHdssanjhdrZCtOXgAS?= =?us-ascii?Q?6m7t5bqCqYIt78PSIfZq1kI/GOgvFcd+DALCIC6bPHZW78Ih9DG7EAGEKha7?= =?us-ascii?Q?W+SspVh8ROUbrZ+5bWPppmseYiyfUbUnIPliwKJ3?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH0PR11MB5475.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 005f57a1-4f57-44f5-50f2-08db61992ad9 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2023 05:37:47.9260 (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: WqLObQlEnZQ/f5he9mn50itVj1Qun6aQ6OqunT7OqAab9wf/vMlqPiYIzP2gWzZAvVdcinHFCoXZmNOG6UCbAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7520 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 > ; Desimone, Nathaniel L > ; Oram, Isaac W ; > Gao, Liming ; 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 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 from= the > devices >=20 > - available on the platform. >=20 > - It also includes other instances of BIOS change to calculate CRC and p= rovides > 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 *)(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 *)(UINTN)FadtPtr->Ds= dt, > 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, (V= OID > *)&AcpiTableCount); >=20 > + } else { >=20 > + EnumerateAllAcpiTables (Xsdt, sizeof (UINT64), GetAcpiTableCount, (V= OID > *)&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) * 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), CalculateAcpiTableCrc= , (VOID > *)TableCrcRecord); >=20 > + } else { >=20 > + EnumerateAllAcpiTables (Xsdt, sizeof (UINT64), 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, AcpiTableCoun= t, > &(FacsPtr->HardwareSignature)); >=20 > + DEBUG ((DEBUG_INFO, "HardwareSignature =3D %x and Status =3D %r\n", Fa= csPtr- > >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 > configurations >=20 > // >=20 > - IsHardwareChange (); >=20 > + IsAcpiTableChange (); >=20 > } >=20 >=20 >=20 > /** >=20 > diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.i= nf > 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