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.web10.189.1588802030252334695 for ; Wed, 06 May 2020 14:53:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Ok8ImHp4; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: rangasai.v.chaganty@intel.com) IronPort-SDR: jWBujjYvIevgaQ+o4USXLQxzmf9LA/MqDM5oAjwz5OG4OwvJVyaRQvmxqKWrdJkcn0/Csq5Pis Pr9wpg00fecw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 14:53:49 -0700 IronPort-SDR: W+zBXIImbfENnuIRrkwM23KYMODJ1iT7upqwc4+dbj4+yGeEBJfDI5E4i7DYcSRxW1kR/cpf/w wIiAfZQns0Gw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,360,1583222400"; d="scan'208";a="461605148" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 06 May 2020 14:53:49 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 6 May 2020 14:53:48 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 6 May 2020 14:53:48 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.56) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 6 May 2020 14:53:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z6jadRXdOI5sdhCV+cYgh91GfSQIdKLXlw8pyKKt2ctEDQsfRvahj8T1VRemsuHN1d+F4Wb9Jyg0RBhrNgXpRIEoVy+x77+Guy/r2MHjTpZCdWNMR6VQuOOOnHZ3MkHwiGqdC7uIHvsK30n0EEFBlm6AshTsI9PFeFmK9Df522D6pbBFRJacrsLavgDJoQsdgVuT0KTrWTqijY5SdSmPVshCxhb04AM5tgwBrf7QPlkslHeKO1NJL1WefNa7eKjprrcVFwyU/ChGDGuBq6/DLUvX/vyiN30CUaQMywLioLMZLxZWD55Cl5VeGf837xg0yJSE5nIAaIj9xlDoVDd0Ig== 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-SenderADCheck; bh=LneyAejX08gZIdiUdN22dISzv513sg8Myq+yT8+ynAo=; b=CitTZg4pNHX6RFpX9Rz36EGFGYTmNJRwuANv5sxQFW2UxMzkM7TgxepeaKcKEl2JvmFHa2rXjWLvIel+rzoN7LTBYXAITydxJSOWQ3W0gRRL2VXUmNDiYmXMU2INhiYTzJouZbhXiZsE4XLNf1jTXWOGn8+w8YLY8D5bpPeJMwvMC77BAVnY3N3nWgr+m1fYtwWSoSxId67K5nM60qkYphbUR02qNAWjSSvvnhlNlypQYxUmFQmmNSPcK7CKfq08qKm2WNURPyU08zKQsh3qckYXdEMPdvsmScToaHQTNlJT4XVNevAxL2GvrNs5OQ/4zjzYrsAOcg1kyvdczuNFJg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LneyAejX08gZIdiUdN22dISzv513sg8Myq+yT8+ynAo=; b=Ok8ImHp4XNg1YlJna+S3gYtVHNJcB08WP3irHt0JwP0XJdagXkqIyz8delRxLHB/NoSanEdJ8YcprcL39+fqohzA65A7R8OFxe0ygdZoO9ksWI8d1U98eT7MJSvQcJjpq55YXEUDZHzSS/yojPob5saVZFLCIIX5YJ+7MsN0wBI= Received: from MWHPR11MB1886.namprd11.prod.outlook.com (2603:10b6:300:110::9) by MWHPR11MB1504.namprd11.prod.outlook.com (2603:10b6:301:c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.29; Wed, 6 May 2020 21:53:46 +0000 Received: from MWHPR11MB1886.namprd11.prod.outlook.com ([fe80::64d0:a918:94e9:d710]) by MWHPR11MB1886.namprd11.prod.outlook.com ([fe80::64d0:a918:94e9:d710%9]) with mapi id 15.20.2958.030; Wed, 6 May 2020 21:53:46 +0000 From: "Chaganty, Rangasai V" To: "Shindo, Miki" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , "Desimone, Nathaniel L" , "Agyeman, Prince" , "Ni, Ray" Subject: Re: [edk2-platforms:PATCH v5 5/7] KabylakeSiliconPkg/DxeAslUpdateLib: Cleans up APIs Thread-Topic: [edk2-platforms:PATCH v5 5/7] KabylakeSiliconPkg/DxeAslUpdateLib: Cleans up APIs Thread-Index: AQHWI1TwYGwjBXS6fEKMb6lVUy0tVaibmueQ Date: Wed, 6 May 2020 21:53:45 +0000 Message-ID: References: <20200506031650.55020-1-miki.shindo@intel.com> <20200506031650.55020-6-miki.shindo@intel.com> In-Reply-To: <20200506031650.55020-6-miki.shindo@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [50.45.159.74] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 86dbf049-8876-4e67-f7c9-08d7f207f37f x-ms-traffictypediagnostic: MWHPR11MB1504: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 03950F25EC x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EieEccfE3DZUEtaGoYORJIFrPzf9juyhGgEE+sSRDfOSOnFQxcgsh53TPLmgOFXMQ1SfHqfYFWRMzKwaPDgCFXcj//Ef+Fh+yjWzwTZNcAU7jFwRg8N2/IrwO4BYTNifI0+/RbsV/mkW7hxYld1A2GYrN45ME6WVX2w469Yyidd2C8Ywv8Hgd1sSTZZtWSZkAGgYEWdeE79dV5n8k06GhBwbi2WlmyFEg9RbWAxEY3U4t0Rj3JNmq+txIS29DZg1JqB0AW/1yZaGKiNYpHfalqyLlRrtJkSulN+xnz2h693RKNoTcytXj8rA2DGCC2AntG9HQtH7Q4bi7eDjBy6fAR08YZ1kxdMKjX4q2ivby7cPD/8+IsXKj+s75BBlDb1RWqBTeQSr+2+zmsK5IHL+e4VgARt3BDn2/XHkKkbLynp3k0orKvK4Bgl4AWEFj8A0sLU+6Nx79HWMFKjb0kptEjyfYM0l5VOPyJScmbhzONerdB4wvtehupuwOzqfElIcrOl5gpSLCtnpGTAvaOVf82tR4Yz9fRAI7y28EeKfEnEZsOTjmZCJJ0cFN6bWkMquryMZug2yv4QylgV1vAgF18WZF7alKG+gNPE84o2bMMc= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1886.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(136003)(396003)(346002)(366004)(376002)(39860400002)(33430700001)(30864003)(76116006)(5660300002)(53546011)(8936002)(66446008)(66476007)(4326008)(186003)(86362001)(52536014)(66556008)(8676002)(7696005)(64756008)(66946007)(26005)(6506007)(2906002)(33440700001)(55016002)(54906003)(966005)(110136005)(478600001)(107886003)(316002)(33656002)(71200400001)(9686003)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: faPBSNFPZV2yLHqA25+4+Xx/2NTx/KH0nGZT/WfEVbNdimVFBmu5jhErsukrSp5+2SrapKm7Re7/PgjXONjrWl+Abt+gUolXX+OzzA8yV0qlSU3mKy+4oiyTYGHHON9Ds/L479HEOv0b9DTT+W/jhYPd3iMaUE98seEbO96Enh7lspK/s7grH6CkgCoV+zA9k8opxdraRVazPg10DaX4HeZFR44NPolah51py8GLkD/HzgsXo4bf4wytV/Wf3lnsamCJO8U0eLZDhj3tFT4zhGVdH4bv7TRMH4tj6QLlj7NRJbAqNGDRVBRBIFGK8eZwsPtY3vcQgX/4n5HvXKT7LvKGzqqPY/eN1IALNrYgjdHCS1B6JXR9ff8wMoggVYJkNXwnZ6T6tcaPPOsriGueaAbaWROm/SoNDmNASric38JjG+4ZP+czSMJr78k7/njydDaCPAyP0fp2AhIU5OBoKsV6wg+8OyvIN5Jdx78f9eOIdUO049Oh9zUGYfkTDmvW88WaUU9aX/5UiwIJnLojhu/HonZsAFG/HfSjY/dwJypdu+6xO1cwxBRnl3wMgRniXGQ6MCfdjbVHZUUB18Zsmf4q5KDIMNDAcOUg46+fn3+gsm/d8y1b20+UNMYc4pAA927v1YF3IVbHV1rBpWzs66qIoknm5omxqeaCQN/uYrojnfIFSSXKF8j3wlHYUOWlfh5Vz+gbJpTLcnEQBZ91UD8MLemckMKKWZFBxmMZcIeZmXcKQuUIIJgnRMjkupTq0WONWpu4s1NYr75fijhujtHKiwEl4NZSbstI3+JW6ss= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 86dbf049-8876-4e67-f7c9-08d7f207f37f X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2020 21:53:45.9257 (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: pijgq89Pec80Bfka7sHNad8elr4jkiPQccl5+aj0Z850x3nxiMWzoN2lVI4jrlF3i9h8VpZ6YEFSKpK7ZPHkUYHCCMpwpLoxhw2vLUnCWZc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1504 Return-Path: rangasai.v.chaganty@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sai Chaganty -----Original Message----- From: Shindo, Miki =20 Sent: Tuesday, May 05, 2020 8:17 PM To: devel@edk2.groups.io Cc: Chaganty, Rangasai V ; Chiu, Chasel ; Desimone, Nathaniel L = ; Agyeman, Prince ; Ni, Ray Subject: [edk2-platforms:PATCH v5 5/7] KabylakeSiliconPkg/DxeAslUpdateLib: = Cleans up APIs REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2536 Callers of DxeAslUpdateLib don't have to call InitializeAslUpdateLib() but = the library itself runs it internally. This commit deletes the redundant ca= lls in caller side and makes it an internal call. LocateAcpiTableByOemTableId() is unreferenced externally so this commit mak= es it an internal call. PSS_PACKAGE_LAYOUT and AML_RESRC_TEMP_END_TAG are both unreferenced so they= are removed. AslUpdateLib.h is cleaned up accordingly. Signed-off-by: Miki Shindo Cc: Sai Chaganty Cc: Chasel Chiu Cc: Nate DeSimone Cc: Prince Agyeman Cc: Ray Ni Acked-by: Nate DeSimone Reviewed-by: Ray Ni Reviewed-by: Sai Chaganty Reviewed-by: Chasel Chiu --- Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c= | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++--------------------------= ---------------------------------------------------------------------------= --- Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLibNull/DxeAslUpdateL= ibNull.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++------------------------------------- Silicon/Intel/KabylakeSiliconPkg/Pch/PchInit/Dxe/PchAcpi.c = | 5 +---- Silicon/Intel/KabylakeSiliconPkg/Include/Library/AslUpdateLib.h = | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------= -------------------------------------------------------------------------- 4 files changed, 227 insertions(+), 225 deletions(-) diff --git a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAs= lUpdateLib.c b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/Dxe= AslUpdateLib.c index 87c6b15ed2..67507643ea 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdate= Lib.c +++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpd +++ ateLib.c @@ -6,7 +6,7 @@ =20 This library uses the ACPI Support protocol. =20 -Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -29,7 +29,7 @@ static EFI_ACPI_TABLE_PROTOCOL *mAcpiTable =3D NULL; =20 /** Initialize the ASL update library state. - This must be called prior to invoking other library functions. + This must be called at the beggining of the function calls in this libra= ry. =20 @retval EFI_SUCCESS - The function completed successfully. **/ @@ -50,9 +50,65 @@ InitializeAslUpdateLib ( return Status; } =20 +/** + This function uses the ACPI SDT protocol to locate an ACPI SSDT table. + + @param[in] TableId - Pointer to an ASCII string containing the= OEM Table ID from the ACPI table header + @param[in] TableIdSize - Length of the TableId to match. Table ID= are 8 bytes long, this function + will consider it a match if the first Tab= leIdSize bytes match + @param[in, out] Table - Updated with a pointer to the table + @param[in, out] Handle - AcpiSupport protocol table handle for the= table found + + @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_NOT_FOUND - Failed to locate AcpiTable. + @retval EFI_NOT_READY - Not ready to locate AcpiTable. +**/ +EFI_STATUS +LocateAcpiTableByOemTableId ( + IN UINT8 *TableId, + IN UINT8 TableIdSize, + IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, + IN OUT UINTN *Handle + ) +{ + EFI_STATUS Status; + INTN Index; + EFI_ACPI_TABLE_VERSION Version; + EFI_ACPI_DESCRIPTION_HEADER *OrgTable; + + if (mAcpiSdt =3D=3D NULL) { + InitializeAslUpdateLib (); + if (mAcpiSdt =3D=3D NULL) { + return EFI_NOT_READY; + } + } + /// + /// Locate table with matching ID + /// + Version =3D 0; + Index =3D 0; + do { + Status =3D mAcpiSdt->GetAcpiTable (Index, (EFI_ACPI_SDT_HEADER **)&Org= Table, &Version, Handle); + if (Status =3D=3D EFI_NOT_FOUND) { + break; + } + ASSERT_EFI_ERROR (Status); + Index++; + } while (CompareMem (&(OrgTable->OemTableId), TableId, TableIdSize)); + + if (Status !=3D EFI_NOT_FOUND) { + *Table =3D AllocateCopyPool (OrgTable->Length, OrgTable); + ASSERT (*Table); + } + + /// + /// If we found the table, there will be no error. + /// + return Status; +} =20 /** - This procedure will update immediate value assigned to a Name + This procedure will update immediate value assigned to a Name. =20 @param[in] AslSignature - The signature of Operation Region that we= want to update. @param[in] Buffer - source of data to be written over origina= l aml @@ -60,8 +116,10 @@ InitializeAslUpdateLib ( =20 @retval EFI_SUCCESS - The function completed successfully. @retval EFI_NOT_FOUND - Failed to locate AcpiTable. + @retval EFI_NOT_READY - Not ready to locate AcpiTable. **/ EFI_STATUS +EFIAPI UpdateNameAslCode ( IN UINT32 AslSignature, IN VOID *Buffer, @@ -155,79 +213,69 @@ UpdateNameAslCode ( return EFI_NOT_FOUND; } =20 - /** - This function uses the ACPI SDT protocol to locate an ACPI table. - It is really only useful for finding tables that only have a single inst= ance, - e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc. + This procedure will update immediate value assigned to a Name in SSDT ta= ble. =20 - @param[in] Signature - Pointer to an ASCII string containing t= he OEM Table ID from the ACPI table header - @param[in, out] Table - Updated with a pointer to the table - @param[in, out] Handle - AcpiSupport protocol table handle for t= he table found - @param[in, out] Version - The version of the table desired + @param[in] TableId - Pointer to an ASCII string containing the= OEM Table ID from the ACPI table header + @param[in] TableIdSize - Length of the TableId to match. Table ID = are 8 bytes long, this function + @param[in] AslSignature - The signature of Operation Region that we= want to update. + @param[in] Buffer - source of data to be written over origina= l aml + @param[in] Length - length of data to be overwritten =20 - @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_UNSUPPORTED The function is not supported in this lib= rary. **/ EFI_STATUS -LocateAcpiTableBySignature ( - IN UINT32 Signature, - IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, - IN OUT UINTN *Handle +EFIAPI +UpdateSsdtNameAslCode ( + IN UINT8 *TableId, + IN UINT8 TableIdSize, + IN UINT32 AslSignature, + IN VOID *Buffer, + IN UINTN Length ) { - EFI_STATUS Status; - INTN Index; - EFI_ACPI_TABLE_VERSION Version; - EFI_ACPI_DESCRIPTION_HEADER *OrgTable; - - if (mAcpiSdt =3D=3D NULL) { - InitializeAslUpdateLib (); - if (mAcpiSdt =3D=3D NULL) { - return EFI_NOT_READY; - } - } + return EFI_UNSUPPORTED; +} =20 - /// - /// Locate table with matching ID - /// - Version =3D 0; - Index =3D 0; - do { - Status =3D mAcpiSdt->GetAcpiTable (Index, (EFI_ACPI_SDT_HEADER **)&Org= Table, &Version, Handle); - if (Status =3D=3D EFI_NOT_FOUND) { - break; - } - ASSERT_EFI_ERROR (Status); - Index++; - } while (OrgTable->Signature !=3D Signature); +/** + This procedure will update the name of ASL Method. =20 - if (Status !=3D EFI_NOT_FOUND) { - *Table =3D AllocateCopyPool (OrgTable->Length, OrgTable); - ASSERT (*Table); - } + @param[in] AslSignature - The signature of Operation Region that we= want to update. + @param[in] Buffer - source of data to be written over origina= l aml + @param[in] Length - length of data to be overwritten =20 - /// - /// If we found the table, there will be no error. - /// - return Status; + @retval EFI_UNSUPPORTED The function is not supported in this lib= rary. +**/ +EFI_STATUS +EFIAPI +UpdateMethodAslCode ( + IN UINT32 AslSignature, + IN VOID *Buffer, + IN UINTN Length + ) +{ + return EFI_UNSUPPORTED; } =20 /** - This function uses the ACPI SDT protocol to locate an ACPI SSDT table. + This function uses the ACPI SDT protocol to locate an ACPI table. + It is really only useful for finding tables that only have a single=20 + instance, e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT,= etc. + Matches are determined by finding the table with ACPI table that has =20 + a matching signature. =20 - @param[in] TableId - Pointer to an ASCII string containing the= OEM Table ID from the ACPI table header - @param[in] TableIdSize - Length of the TableId to match. Table ID= are 8 bytes long, this function - will consider it a match if the first Tab= leIdSize bytes match - @param[in, out] Table - Updated with a pointer to the table - @param[in, out] Handle - AcpiSupport protocol table handle for the= table found - @param[in, out] Version - See AcpiSupport protocol, GetAcpiTable fu= nction for use + @param[in] Signature - Pointer to an ASCII string containing t= he OEM Table ID from the ACPI table header + @param[in, out] Table - Updated with a pointer to the table + @param[in, out] Handle - AcpiSupport protocol table handle for t= he table found =20 - @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_NOT_FOUND - Failed to locate AcpiTable. + @retval EFI_NOT_READY - Not ready to locate AcpiTable. **/ EFI_STATUS -LocateAcpiTableByOemTableId ( - IN UINT8 *TableId, - IN UINT8 TableIdSize, +EFIAPI +LocateAcpiTableBySignature ( + IN UINT32 Signature, IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, IN OUT UINTN *Handle ) @@ -243,6 +291,7 @@ LocateAcpiTableByOemTableId ( return EFI_NOT_READY; } } + /// /// Locate table with matching ID /// @@ -255,7 +304,7 @@ LocateAcpiTableByOemTableId ( } ASSERT_EFI_ERROR (Status); Index++; - } while (CompareMem (&(OrgTable->OemTableId), TableId, TableIdSize)); + } while (OrgTable->Signature !=3D Signature); =20 if (Status !=3D EFI_NOT_FOUND) { *Table =3D AllocateCopyPool (OrgTable->Length, OrgTable); @@ -268,47 += 317,3 @@ LocateAcpiTableByOemTableId ( return Status; } =20 -/** - This function calculates and updates an UINT8 checksum. - - @param[in] Buffer Pointer to buffer to checksum - @param[in] Size Number of bytes to checksum - @param[in] ChecksumOffset Offset to place the checksum result in - - @retval EFI_SUCCESS The function completed successfully. -**/ -EFI_STATUS -AcpiChecksum ( - IN VOID *Buffer, - IN UINTN Size, - IN UINTN ChecksumOffset - ) -{ - UINT8 Sum; - UINT8 *Ptr; - - Sum =3D 0; - /// - /// Initialize pointer - /// - Ptr =3D Buffer; - - /// - /// set checksum to 0 first - /// - Ptr[ChecksumOffset] =3D 0; - - /// - /// add all content of buffer - /// - while (Size--) { - Sum =3D (UINT8) (Sum + (*Ptr++)); - } - /// - /// set checksum - /// - Ptr =3D Buffer; - Ptr[ChecksumOffset] =3D (UINT8) (0xff - Sum + 1); - - return EFI_SUCCESS; -} diff --git a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLibNull/D= xeAslUpdateLibNull.c b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdat= eLibNull/DxeAslUpdateLibNull.c index 490a09ddb5..9c0447372d 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLibNull/DxeAslUp= dateLibNull.c +++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLibNull/DxeAs +++ lUpdateLibNull.c @@ -6,7 +6,7 @@ =20 This library uses the ACPI Support protocol. =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -27,7 +27,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 /** Initialize the ASL update library state. - This must be called prior to invoking other library functions. + This must be called at the beggining of the function calls in this libra= ry. =20 @retval EFI_SUCCESS - The function completed successfully. **/ @@ -39,9 +39,30 @@ InitializeAslUpdateLib ( return EFI_SUCCESS; } =20 +/** + This function uses the ACPI SDT protocol to locate an ACPI SSDT table. + + @param[in] TableId - Pointer to an ASCII string containing the= OEM Table ID from the ACPI table header + @param[in] TableIdSize - Length of the TableId to match. Table ID= are 8 bytes long, this function + will consider it a match if the first Tab= leIdSize bytes match + @param[in, out] Table - Updated with a pointer to the table + @param[in, out] Handle - AcpiSupport protocol table handle for the= table found + + @retval EFI_SUCCESS - The function completed successfully. +**/ +EFI_STATUS +LocateAcpiTableByOemTableId ( + IN UINT8 *TableId, + IN UINT8 TableIdSize, + IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, + IN OUT UINTN *Handle + ) +{ + return EFI_SUCCESS; +} =20 /** - This procedure will update immediate value assigned to a Name + This procedure will update immediate value assigned to a Name. =20 @param[in] AslSignature - The signature of Operation Region that we= want to update. @param[in] Buffer - source of data to be written over origina= l aml @@ -50,6 +71,7 @@ InitializeAslUpdateLib ( @retval EFI_SUCCESS - The function completed successfully. **/ EFI_STATUS +EFIAPI UpdateNameAslCode ( IN UINT32 AslSignature, IN VOID *Buffer, @@ -59,66 +81,70 @@ UpdateNameAslCode ( return EFI_SUCCESS; } =20 - /** - This function uses the ACPI SDT protocol to locate an ACPI table. - It is really only useful for finding tables that only have a single inst= ance, - e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc. + This procedure will update immediate value assigned to a Name in SSDT ta= ble. =20 - @param[in] Signature - Pointer to an ASCII string containing t= he OEM Table ID from the ACPI table header - @param[in, out] Table - Updated with a pointer to the table - @param[in, out] Handle - AcpiSupport protocol table handle for t= he table found - @param[in, out] Version - The version of the table desired + @param[in] TableId - Pointer to an ASCII string containing the= OEM Table ID from the ACPI table header + @param[in] TableIdSize - Length of the TableId to match. Table ID= are 8 bytes long, this function + @param[in] AslSignature - The signature of Operation Region that we= want to update. + @param[in] Buffer - source of data to be written over origina= l aml + @param[in] Length - length of data to be overwritten =20 - @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_SUCCESS - The function completed successfully. **/ EFI_STATUS -LocateAcpiTableBySignature ( - IN UINT32 Signature, - IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, - IN OUT UINTN *Handle +EFIAPI +UpdateSsdtNameAslCode ( + IN UINT8 *TableId, + IN UINT8 TableIdSize, + IN UINT32 AslSignature, + IN VOID *Buffer, + IN UINTN Length ) { return EFI_SUCCESS; } =20 /** - This function uses the ACPI SDT protocol to locate an ACPI SSDT table. + This procedure will update the name of ASL Method. =20 - @param[in] TableId - Pointer to an ASCII string containing the= OEM Table ID from the ACPI table header - @param[in] TableIdSize - Length of the TableId to match. Table ID= are 8 bytes long, this function - will consider it a match if the first Tab= leIdSize bytes match - @param[in, out] Table - Updated with a pointer to the table - @param[in, out] Handle - AcpiSupport protocol table handle for the= table found - @param[in, out] Version - See AcpiSupport protocol, GetAcpiTable fu= nction for use + @param[in] AslSignature - The signature of Operation Region that we= want to update. + @param[in] Buffer - source of data to be written over origina= l aml + @param[in] Length - length of data to be overwritten =20 @retval EFI_SUCCESS - The function completed successfully. **/ EFI_STATUS -LocateAcpiTableByOemTableId ( - IN UINT8 *TableId, - IN UINT8 TableIdSize, - IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, - IN OUT UINTN *Handle +EFIAPI +UpdateMethodAslCode ( + IN UINT32 AslSignature, + IN VOID *Buffer, + IN UINTN Length ) { return EFI_SUCCESS; } =20 + /** - This function calculates and updates an UINT8 checksum. + This function uses the ACPI SDT protocol to locate an ACPI table. + It is really only useful for finding tables that only have a single=20 + instance, e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT,= etc. + Matches are determined by finding the table with ACPI table that has =20 + a matching signature. =20 - @param[in] Buffer Pointer to buffer to checksum - @param[in] Size Number of bytes to checksum - @param[in] ChecksumOffset Offset to place the checksum result in + @param[in] Signature - Pointer to an ASCII string containing t= he OEM Table ID from the ACPI table header + @param[in, out] Table - Updated with a pointer to the table + @param[in, out] Handle - AcpiSupport protocol table handle for t= he table found =20 - @retval EFI_SUCCESS The function completed successfully. + @retval EFI_SUCCESS - The function completed successfully. **/ EFI_STATUS -AcpiChecksum ( - IN VOID *Buffer, - IN UINTN Size, - IN UINTN ChecksumOffset +EFIAPI +LocateAcpiTableBySignature ( + IN UINT32 Signature, + IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, + IN OUT UINTN *Handle ) { return EFI_SUCCESS; diff --git a/Silicon/Intel/KabylakeSiliconPkg/Pch/PchInit/Dxe/PchAcpi.c b/S= ilicon/Intel/KabylakeSiliconPkg/Pch/PchInit/Dxe/PchAcpi.c index a0e3996664..6cbaf9c067 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Pch/PchInit/Dxe/PchAcpi.c +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/PchInit/Dxe/PchAcpi.c @@ -1,7 +1,7 @@ /** @file This is the driver that initializes the Intel PCH. =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -443,9 +443,6 @@ PatchPchNvsAreaAddress ( UINT32 Address; UINT16 Length; =20 - Status =3D InitializeAslUpdateLib (); - ASSERT_EFI_ERROR (Status); - Address =3D (UINT32) (UINTN) mPchNvsAreaProtocol.Area; Length =3D (UINT16) sizeof (PCH_NVS_AREA); DEBUG ((DEBUG_INFO, "PatchPchNvsAreaAddress: PCH NVS Address %x Length %= x\n", Address, Length)); diff --git a/Silicon/Intel/KabylakeSiliconPkg/Incl= ude/Library/AslUpdateLib.h b/Silicon/Intel/KabylakeSiliconPkg/Include/Libra= ry/AslUpdateLib.h index d58b6d6458..c88004725a 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Include/Library/AslUpdateLib.h +++ b/Silicon/Intel/KabylakeSiliconPkg/Include/Library/AslUpdateLib.h @@ -5,7 +5,7 @@ Make sure you meet the requirements for the library (protocol dependenci= es, use restrictions, etc). =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -16,125 +16,99 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // I= nclude files // +#include #include #include #include =20 -// -// AML parsing definitions -// -#define AML_RESRC_TEMP_END_TAG 0x0079 - -// -// ASL PSS package structure layout -// -#pragma pack (1) -typedef struct { - UINT8 NameOp; // 12h ;First opcode is a NameOp. - UINT8 PackageLead; // 20h ;First opcode is a NameOp. - UINT8 NumEntries; // 06h ;First opcode is a NameOp. - UINT8 DwordPrefix1; // 0Ch - UINT32 CoreFrequency; // 00h - UINT8 DwordPrefix2; // 0Ch - UINT32 Power; // 00h - UINT8 DwordPrefix3; // 0Ch - UINT32 TransLatency; // 00h - UINT8 DwordPrefix4; // 0Ch - UINT32 BmLatency; // 00h - UINT8 DwordPrefix5; // 0Ch - UINT32 Control; // 00h - UINT8 DwordPrefix6; // 0Ch - UINT32 Status; // 00h -} PSS_PACKAGE_LAYOUT; -#pragma pack() =20 /** - Initialize the ASL update library state. - This must be called prior to invoking other library functions. + This procedure will update immediate value assigned to a Name. =20 + @param[in] AslSignature The signature of Operation Region = that we want to update. + @param[in] Buffer source of data to be written over = original aml + @param[in] Length length of data to be overwritten =20 @retval EFI_SUCCESS The function completed successfull= y. + @retval EFI_NOT_FOUND Failed to locate AcpiTable. + @retval EFI_NOT_READY Not ready to locate AcpiTable. + @retval EFI_UNSUPPORTED The function is not supported in t= his library. **/ EFI_STATUS -InitializeAslUpdateLib ( - VOID +EFIAPI +UpdateNameAslCode ( + IN UINT32 AslSignature, + IN VOID *Buffer, + IN UINTN Length ); =20 /** - This procedure will update immediate value assigned to a Name + This procedure will update immediate value assigned to a Name in SSDT ta= ble. + + @param[in] TableId - Pointer to an ASCII string containing the= OEM Table ID from the ACPI table header + @param[in] TableIdSize - Length of the TableId to match. Table ID= are 8 bytes long, this function + @param[in] AslSignature - The signature of Operation Region that we= want to update. + @param[in] Buffer - source of data to be written over origina= l aml + @param[in] Length - length of data to be overwritten + + @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_NOT_FOUND - Failed to locate AcpiTable. + @retval EFI_NOT_READY - Not ready to locate AcpiTable. + @retval EFI_UNSUPPORTED - The function is not supported in this lib= rary. +**/ +EFI_STATUS +EFIAPI +UpdateSsdtNameAslCode ( + IN UINT8 *TableId, + IN UINT8 TableIdSize, + IN UINT32 AslSignature, + IN VOID *Buffer, + IN UINTN Length + ); =20 - @param[in] AslSignature The signature of Operation Region = that we want to update. - @param[in] Buffer source of data to be written over = original aml - @param[in] Length length of data to be overwritten +/** + This procedure will update the name of ASL Method. =20 - @retval EFI_SUCCESS The function completed successfull= y. + @param[in] AslSignature - The signature of Operation Region that we= want to update. + @param[in] Buffer - source of data to be written over origina= l aml + @param[in] Length - length of data to be overwritten + + @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_NOT_FOUND - Failed to locate AcpiTable. + @retval EFI_NOT_READY - Not ready to locate AcpiTable. + @retval EFI_UNSUPPORTED - The function is not supported in this lib= rary. **/ EFI_STATUS -UpdateNameAslCode( +EFIAPI +UpdateMethodAslCode ( IN UINT32 AslSignature, IN VOID *Buffer, IN UINTN Length ); =20 /** - This function uses the ACPI support protocol to locate an ACPI table usi= ng the . + This function uses the ACPI support protocol to locate an ACPI table. It is really only useful for finding tables that only have a single inst= ance, e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc. Matches are determined by finding the table with ACPI table that has - a matching signature and version. + a matching signature. =20 @param[in] Signature Pointer to an ASCII string contain= ing the Signature to match @param[in, out] Table Updated with a pointer to the tabl= e @param[in, out] Handle AcpiSupport protocol table handle = for the table found - @param[in, out] Version On input, the version of the table= desired, - on output, the versions the table = belongs to @see AcpiSupport protocol for deta= ils =20 @retval EFI_SUCCESS The function completed successfull= y. + @retval EFI_NOT_FOUND Failed to locate AcpiTable. + @retval EFI_NOT_READY Not ready to locate AcpiTable. + @retval EFI_UNSUPPORTED The function is not supported in t= his library.s **/ EFI_STATUS +EFIAPI LocateAcpiTableBySignature ( IN UINT32 Signature, IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, IN OUT UINTN *Handle ); =20 -/** - This function uses the ACPI support protocol to locate an ACPI SSDT tabl= e. - The table is located by searching for a matching OEM Table ID field. - Partial match searches are supported via the TableIdSize parameter. - - @param[in] TableId Pointer to an ASCII string contain= ing the OEM Table ID from the ACPI table header - @param[in] TableIdSize Length of the TableId to match. T= able ID are 8 bytes long, this function - will consider it a match if the fi= rst TableIdSize bytes match - @param[in, out] Table Updated with a pointer to the tabl= e - @param[in, out] Handle AcpiSupport protocol table handle = for the table found - @param[in, out] Version See AcpiSupport protocol, GetAcpiT= able function for use - - @retval EFI_SUCCESS The function completed successfull= y. -**/ -EFI_STATUS -LocateAcpiTableByOemTableId ( - IN UINT8 *TableId, - IN UINT8 TableIdSize, - IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, - IN OUT UINTN *Handle - ); - -/** - This function calculates and updates an UINT8 checksum. - - @param[in] Buffer Pointer to buffer to checksum - @param[in] Size Number of bytes to checksum - @param[in] ChecksumOffset Offset to place the checksum resul= t in - - @retval EFI_SUCCESS The function completed successfull= y. -**/ -EFI_STATUS -AcpiChecksum ( - IN VOID *Buffer, - IN UINTN Size, - IN UINTN ChecksumOffset - ); - #endif -- 2.16.2.windows.1