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.178.1588801996317437209 for ; Wed, 06 May 2020 14:53:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=KpSbR+3a; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: rangasai.v.chaganty@intel.com) IronPort-SDR: HcUkMXPpTkEodWQfcld84iJd2EVlwB8yG1R1TKtxfo9V2AJvp68mN4er3yNcECpDIhKTnhOct2 fIkItaTMfkjw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 14:53:15 -0700 IronPort-SDR: pYzwa7Cy2SF0EgU5jlF1UjmHbWexQMFeuFecfU4Ux+vI/9ogUky4VGZm8TAB33aB3GVh8Ue8MS p+cR7YT5IQNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,360,1583222400"; d="scan'208";a="249903194" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga007.fm.intel.com with ESMTP; 06 May 2020 14:53:15 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 6 May 2020 14:53:15 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 May 2020 14:53:14 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 6 May 2020 14:53:14 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.54) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 6 May 2020 14:53:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VEZ696E+3p2xqvlsvyHtnFEldXe54EB7/HcAccRsF811/3Ug4n4jdIcaWlNEUc1eaGkrb/N0OsDcrMdoUHQ7JK7QVqvaqCVGupQuvUDq3QadQRxQtQh438WJHwRkaQ8OTKShWwtTGbQP+dZjG9zUVVRbvCGZIGTNSNek4fCBNiwJAn1t2Vb2PfekNxA2MN//YI6dc1UuU9TQF67+eX0yWzEZDfh65pAZhBQshqlRq4Kd2Ru9HR8gDXl7ZUNcO1eMKGEui7aOhiSClriMNZZ/XqpHWqR3IIcSNLFYl6Vh5UkSAM8T7J/0FbIGLKEtWQMpPlwTUe57pF6TpxfmIairGg== 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=x7qB2wvg20wgTh8U0jb80hl+S1KI6nfI77eiydT/rhg=; b=lNI9NEmNOVHTLBMbgRe88OAeUWTGFMULr6o/G6r8QvWsHWK6AkK1wJvps/hdWYpMBnxs+iXG2lVhvRB4m2YYHbcnWPNb0fNDJkxpOiQ1FbsoWmYZw08Elvi9U3xHcPCR0OQ4JxaN3wYPJDWkOfyJoVJVNrLFkDPB4+29MUYtnCBBWZt4WfLwGvffDaQXm2zLox5z7lOyDqVMTiRniq2H5YbSy2XS6RTgILLVv+moxhqXwPoeYslWAwr+oZwTh5/JOHhN8lBE67md2sWIDZ3psTGXYZmjOiG14WRvnFTenkrYgdGsUYo7gq3UdGda1GCsmqiBOhr2QzFy49Lf87okPQ== 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=x7qB2wvg20wgTh8U0jb80hl+S1KI6nfI77eiydT/rhg=; b=KpSbR+3amyNu1FE+FZB5lv8Ua/9nj8MrWkvJeptlcnOQuRLhbq4AZidcerQcVO2Vf0vfyuS0eBDBZ+Ix5IbX14RFCMSIox5dYmXac2WX7dnf1kol+FQYoPDIJc0v3dRQdzEWNiUSishV/787tuznVSh3BetSbSycn98wO30oU7k= 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:09 +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:09 +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 4/7] MinPlatformPkg/DxeAslUpdateLib: Cleans up APIs Thread-Topic: [edk2-platforms:PATCH v5 4/7] MinPlatformPkg/DxeAslUpdateLib: Cleans up APIs Thread-Index: AQHWI1TvAZNztNNczk+9sotJooEmQqibmrhw Date: Wed, 6 May 2020 21:53:08 +0000 Message-ID: References: <20200506031650.55020-1-miki.shindo@intel.com> <20200506031650.55020-5-miki.shindo@intel.com> In-Reply-To: <20200506031650.55020-5-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: d3eaede7-7c1d-4f35-e762-08d7f207dd7e 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:4714; x-forefront-prvs: 03950F25EC x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vXJqpG2zJdbM77CI2m5KAMH8zY1fR+tIJbqCxo+ZrRHgf6Zezr01RYEmekN2yiEOnVnFeKnodVBd4lVPG+1+qZgDcqNQ4zKg6bYbbEjiqWSPjsgcR5ggBDcPgICym9s6zuQe25IejaJFulKQqgcNMMXVmFHt0LNWFcoH0mOt7U0dLislFF8hlCgziIj9diRUu3ymSo7TWBnJttAdi0cGvix8uQDpz5q9vt0lDRfiQvEHYfLTmRYdUA8jPpB9yDdkALH9pCIFBe2vnZfwSK7/ch1qCA4CrneyFYpl/QOCQBKWlkxWRo4BpiFmUjzM2s3d0A1bY50bmaRLbWSJLw7IZOuKthcrZivTehrQ1I0LZQkmZPRbQvcvYJBo2bg0ewIaPiFtEwXrRm283TjnAQ1qCjPsQ9v/fxJTrZZPw+qBTtwmX3l3PP677Kmn/3yvGmDwFoXunekvDj6dLPrdnonLXF2Pmf4OBHfgdyuSxiYZhqx57ywaMZpbpAJ9+LVvb90Mqfa8gm1a140XBUtoqRFn003hoKlcq4DpnKaARireZnAblC8eFmV3HiUKvHl/PhKRtbSAIVMJkGRYjJm52O+MKdlKqEmRCDpm2Du3/bBxOiA= 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);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: tX0tz6Xw938jbMUvfWq6NG2VyMlaemLKBD33KYhU5uXOcVwq9C9iMcCrmdt9uoFVs8TOT33TrvViX0a9nIOJqZvglW+KlTGBkgnwFkVbfHSmkEIpAEMJ617Ock/aW26d1by4DGc17+hkRpop/cepe4ZW19/Gy7/ofdLXe5KN1SAqWvbers6j9h3so65n5y533G/4Oo2owOEbEYrghgI0GwWRpNCdM1wEog3iXG0vQrRtvk5ptV376+DkGFzTDEbSeZfx+OghbOTa6XurzXABS65CWNy9DhJ1TIx+bDsEtpnr0RJ0rudwrxW2Rx8skiaS6rIB3cLSQimVh0jB5yA6ojKbmwfp19xsQ7GKNlHWjqCXtEFaJRICaSP0PPcB5xcVw9Wx/Hwm3zMCE2cn9Gjnn9F8AUxeF7FfN/zuWzdiu8ucyz2rpgJBwfG4L7eCFxM3sqrcJRRCOvJonwBp8LxEKT7kk9sujI0fwfc93PBe4yNRsspUwzJ8KXPnf8L7GL2GMOJv01OvnLOM1PIbDPRaGDT9ak5+d0Qqr5n7X0uv9VLmcMJz1lPJ2F1mF3vrKVkiFN8yycLCLkoc/bcn5cOUStGcREHJweChJWA8PbBDVlPaNi+kfw3c0tSWXutt8k1TY6q4pJVCwbGGOpeq7j+OEyMN4z6BvjKidpir5v+niVruXrKXRGLUv+miYCk8OpjwtxhqmQB4lbWXXW4h7Fd2xBgKT7GqfOn0xKu0JmzycjElQziTa+X/7bAPz7GZCObf1r3KyHUCEPVyVfKIpd/yuqjsCGI9SBO0YxYnM/wiQjo= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d3eaede7-7c1d-4f35-e762-08d7f207dd7e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2020 21:53:09.0159 (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: 1wgC4igePxrCsiLieRu1jubOaCunvoN2g0lLYMCHUaPSXTkJkw21NDs+KfDl0becAWQH11PkYm2ouExPMbcTW6dRen0cxG0u1hb8ET0q+P8= 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 4/7] MinPlatformPkg/DxeAslUpdateLib: Clea= ns 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 makes it an internal cal= l. LocateAcpiTableByOemTableId() is unreferenced externally so this commit = makes 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 --- Platform/Intel/MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/DxeAslUpdateLib= .c | 215 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++------------------------------= -------------------------------------------------------------------------- Platform/Intel/MinPlatformPkg/Include/Library/AslUpdateLib.h = | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------= --------------------------------------------------------------------- 2 files changed, 165 insertions(+), 185 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/Dxe= AslUpdateLib.c b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxeAslUpdateLib= /DxeAslUpdateLib.c index e6ab43db6d..57df18d664 100644 --- a/Platform/Intel/MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/DxeAslUpda= teLib.c +++ b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/DxeAslU +++ pdateLib.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 **/ @@ -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,17 +50,76 @@ 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 @param[in] Length - length of data to be overwritten =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, @@ -149,11 +208,57 @@ UpdateNameAslCode ( return EFI_NOT_FOUND; } =20 +/** + 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 + will consider it a match if the first Tab= leIdSize bytes match + @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_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 + ) +{ + return EFI_UNSUPPORTED; +} + +/** + This procedure will update the name of ASL Method. + + @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_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 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 =20 + a matching signature. =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 @@ -161,8 +266,11 @@ UpdateNameAslCode ( @param[in, out] Version - The version of the table desired =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 LocateAcpiTableBySignature ( IN UINT32 Signature, IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table, @@ -205,104 +313,3 @@ LocateAcpiTableBySignature ( /// return Status; } - -/** - 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 - @param[in, out] Version - See AcpiSupport protocol, GetAcpiTable fu= nction for use - - @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 - ) -{ - 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; -} - -/** - 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/Platform/Intel/MinPlatformPkg/Include/Library/AslUpdateLib.h b= /Platform/Intel/MinPlatformPkg/Include/Library/AslUpdateLib.h index d58b6d6458..a7f898aee5 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Library/AslUpdateLib.h +++ b/Platform/Intel/MinPlatformPkg/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,98 @@ 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() - /** - 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 **/ 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