From nobody Tue Feb 10 03:40:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76938+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76938+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1624446360; cv=none; d=zohomail.com; s=zohoarc; b=NKfKzSy8C6P0uP+jBIc5PoDBeGRBSVhLIxkCbhRfQVOcdowciQldQthiy136ZgF0zbKT80SA2+E8w1AkB33c5jL2URpqUiHtyp8UyiErzA0zG+99t6QFlK6DfYW0a0THWxRqbU/+1gXn1kA0yUrbb1qDaYKiI5qrB6PZFmuZlJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624446360; h=Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=3QXU5jybDw8PAsPq3m2m7zm68XI3iyDHiTrNCkRm4qo=; b=Y32DiT6232FMPnpIWQBjN08OyVHtABzYyGCITEuXEE+xf+KAskwKxqPc9lRd0nUEOe5GdITkXl7ZoSnOHI6kjqeY6OiYJXgMYTrujmGqGoN8eN3V6InzevrluX1W6jtt9eKxKRbkdaptPRmVG/vAaIdC7UNLkiEF9emJ5YI5rfY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76938+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624446360074671.8169153227884; Wed, 23 Jun 2021 04:06:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id XC24YY1788612x9ZqrzKAmEz; Wed, 23 Jun 2021 04:05:59 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5938.1624446354038169996 for ; Wed, 23 Jun 2021 04:05:54 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B523731B; Wed, 23 Jun 2021 04:05:53 -0700 (PDT) X-Received: from e120189.arm.com (unknown [10.57.78.245]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D1B9E3F719; Wed, 23 Jun 2021 04:05:52 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io, Sami.Mujawar@arm.com, Alexei.Fedorov@arm.com Subject: [edk2-devel] [PATCH v1 09/10] DynamicTablesPkg: Deprecate Crs specific methods in AmlLib Date: Wed, 23 Jun 2021 12:05:23 +0100 Message-Id: <20210623110525.6171-10-Pierre.Gondois@arm.com> In-Reply-To: <20210623110525.6171-1-Pierre.Gondois@arm.com> References: <20210623110525.6171-1-Pierre.Gondois@arm.com> Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com X-Gm-Message-State: eI62n2FognJweWpfJMrIjrwGx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624446359; bh=b6vv2Q1pljh1ms5fe5ZucQVGZFEURuiNBxLzIgZwdtY=; h=Date:From:Reply-To:Subject:To; b=rAzq3xxuH+QovngwyXT5VdrjB/oHO/5bW4b/AA5vi37ltHQsRGw/sMJfhCwOfe/awfJ tJdvPXSG071QNoT3s/bRQc9iTkq7yQiJCvkzKW1qaD3TPi7/RhnAEvu4sGz8nhfcTi3/n hVQ88zkyjaGgBkWC5MWSKmwdPE2loo4NeG8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois Some functions in the AmlLib have 'Crs' in their name and can only be applied to '_CRS' AML objects. To re-use them on AML objects that have different names: - Rename them and remove the '_CRS' name check. - Create aliases having of the 'Crs' function prototypes. These aliases are available when DISABLE_NEW_DEPRECATED_INTERFACES is not defined. They will be deprecated in a near future. Signed-off-by: Pierre Gondois Reviewed-by: Sami Mujawar --- .../Include/Library/AmlLib/AmlLib.h | 189 +++++++++++++++--- .../SsdtCmn600Generator.c | 6 +- .../Library/Common/AmlLib/Api/AmlApi.c | 147 +++++++++++--- .../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 105 ++++++++-- .../SsdtSerialPortFixupLib.c | 4 +- 5 files changed, 371 insertions(+), 80 deletions(-) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index 1dcb93861436..c40808343fce 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1,7 +1,7 @@ /** @file AML Lib. =20 - Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
+ Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -301,7 +301,7 @@ AmlNameOpUpdateString ( IN CONST CHAR8 * NewName ); =20 -/** Get the first Resource Data element contained in a "_CRS" object. +/** Get the first Resource Data element contained in a named object. =20 In the following ASL code, the function will return the Resource Data node corresponding to the "QWordMemory ()" ASL macro. @@ -312,27 +312,26 @@ AmlNameOpUpdateString ( ) =20 Note: - - The "_CRS" object must be declared using ASL "Name (Declare Named Obj= ect)". - - "_CRS" declared using ASL "Method (Declare Control Method)" is not - supported. + "_CRS" names defined as methods are not handled by this function. + They must be defined as names, using the "Name ()" statement. =20 @ingroup UserApis =20 - @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object. - Must have an OpCode=3DAML_NAME_OP, SubOpCode= =3D0. - NameOp object nodes are defined in ASL - using the "Name ()" function. - @param [out] OutRdNode Pointer to the first Resource Data element of - the "_CRS" object. A Resource Data element - is stored in a data node. + @param [in] NameOpNode NameOp object node defining a named object. + Must have an OpCode=3DAML_NAME_OP, SubOpCode= =3D0. + NameOp object nodes are defined in ASL + using the "Name ()" function. + @param [out] OutRdNode Pointer to the first Resource Data element of + the named object. A Resource Data element + is stored in a data node. =20 @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. **/ EFI_STATUS EFIAPI -AmlNameOpCrsGetFirstRdNode ( - IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, +AmlNameOpGetFirstRdNode ( + IN AML_OBJECT_NODE_HANDLE NameOpNode, OUT AML_DATA_NODE_HANDLE * OutRdNode ); =20 @@ -347,13 +346,14 @@ AmlNameOpCrsGetFirstRdNode ( } ) =20 - The CurrRdNode Resource Data node must be defined in an object named "_C= RS" - and defined by a "Name ()" ASL function. + Note: + "_CRS" names defined as methods are not handled by this function. + They must be defined as names, using the "Name ()" statement. =20 @ingroup UserApis =20 @param [in] CurrRdNode Pointer to the current Resource Data element = of - the "_CRS" variable. + the named object. @param [out] OutRdNode Pointer to the Resource Data element following the CurrRdNode. Contain a NULL pointer if CurrRdNode is the @@ -366,7 +366,7 @@ AmlNameOpCrsGetFirstRdNode ( **/ EFI_STATUS EFIAPI -AmlNameOpCrsGetNextRdNode ( +AmlNameOpGetNextRdNode ( IN AML_DATA_NODE_HANDLE CurrRdNode, OUT AML_DATA_NODE_HANDLE * OutRdNode ); @@ -423,7 +423,7 @@ AmlUpdateRdQWord ( This function creates a Resource Data element corresponding to the "Interrupt ()" ASL function, stores it in an AML Data Node. =20 - It then adds it after the input CurrRdNode in the list of resource data + It then adds it after the input NameOpNode in the list of resource data element. =20 The Resource Data effectively created is an Extended Interrupt Resource @@ -437,14 +437,9 @@ AmlUpdateRdQWord ( - attach this node to an AML tree; - delete this node. =20 - Note: The _CRS node must be defined using the ASL Name () function. - e.g. Name (_CRS, ResourceTemplate () { - ... - } + @ingroup CodeGenApis =20 - @ingroup UserApis - - @param [in] NameOpCrsNode NameOp object node defining a "_CRS" obje= ct. + @param [in] NameOpNode NameOp object node defining a named objec= t. Must have an OpCode=3DAML_NAME_OP, SubOpC= ode=3D0. NameOp object nodes are defined in ASL using the "Name ()" function. @@ -465,8 +460,8 @@ AmlUpdateRdQWord ( **/ EFI_STATUS EFIAPI -AmlCodeGenCrsAddRdInterrupt ( - IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, +AmlCodeGenAddRdInterrupt ( + IN AML_OBJECT_NODE_HANDLE NameOpNode, IN BOOLEAN ResourceConsumer, IN BOOLEAN EdgeTriggered, IN BOOLEAN ActiveLow, @@ -628,4 +623,142 @@ AmlCodeGenScope ( OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL ); =20 +// DEPRECATED APIS +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES + +/** DEPRECATED API + + Get the first Resource Data element contained in a "_CRS" object. + + In the following ASL code, the function will return the Resource Data + node corresponding to the "QWordMemory ()" ASL macro. + Name (_CRS, ResourceTemplate() { + QWordMemory (...) {...}, + Interrupt (...) {...} + } + ) + + Note: + - The "_CRS" object must be declared using ASL "Name (Declare Named Obj= ect)". + - "_CRS" declared using ASL "Method (Declare Control Method)" is not + supported. + + @ingroup UserApis + + @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object. + Must have an OpCode=3DAML_NAME_OP, SubOpCode= =3D0. + NameOp object nodes are defined in ASL + using the "Name ()" function. + @param [out] OutRdNode Pointer to the first Resource Data element of + the "_CRS" object. A Resource Data element + is stored in a data node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +EFI_STATUS +EFIAPI +AmlNameOpCrsGetFirstRdNode ( + IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, + OUT AML_DATA_NODE_HANDLE * OutRdNode + ); + +/** DEPRECATED API + + Get the Resource Data element following the CurrRdNode Resource Data. + + In the following ASL code, if CurrRdNode corresponds to the first + "QWordMemory ()" ASL macro, the function will return the Resource Data + node corresponding to the "Interrupt ()" ASL macro. + Name (_CRS, ResourceTemplate() { + QwordMemory (...) {...}, + Interrupt (...) {...} + } + ) + + The CurrRdNode Resource Data node must be defined in an object named "_C= RS" + and defined by a "Name ()" ASL function. + + @ingroup UserApis + + @param [in] CurrRdNode Pointer to the current Resource Data element = of + the "_CRS" variable. + @param [out] OutRdNode Pointer to the Resource Data element following + the CurrRdNode. + Contain a NULL pointer if CurrRdNode is the + last Resource Data element in the list. + The "End Tag" is not considered as a resource + data element and is not returned. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +EFI_STATUS +EFIAPI +AmlNameOpCrsGetNextRdNode ( + IN AML_DATA_NODE_HANDLE CurrRdNode, + OUT AML_DATA_NODE_HANDLE * OutRdNode + ); + +/** DEPRECATED API + + Add an Interrupt Resource Data node. + + This function creates a Resource Data element corresponding to the + "Interrupt ()" ASL function, stores it in an AML Data Node. + + It then adds it after the input CurrRdNode in the list of resource data + element. + + The Resource Data effectively created is an Extended Interrupt Resource + Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descripto= r" + for more information about Extended Interrupt Resource Data. + + The Extended Interrupt contains one single interrupt. + + This function allocates memory to create a data node. It is the caller's + responsibility to either: + - attach this node to an AML tree; + - delete this node. + + Note: The _CRS node must be defined using the ASL Name () function. + e.g. Name (_CRS, ResourceTemplate () { + ... + } + + @ingroup CodeGenApis + + @param [in] NameOpCrsNode NameOp object node defining a "_CRS" obje= ct. + Must have an OpCode=3DAML_NAME_OP, SubOpC= ode=3D0. + NameOp object nodes are defined in ASL + using the "Name ()" function. + @param [in] ResourceConsumer The device consumes the specified interru= pt + or produces it for use by a child device. + @param [in] EdgeTriggered The interrupt is edge triggered or + level triggered. + @param [in] ActiveLow The interrupt is active-high or active-lo= w. + @param [in] Shared The interrupt can be shared with other + devices or not (Exclusive). + @param [in] IrqList Interrupt list. Must be non-NULL. + @param [in] IrqCount Interrupt count. Must be non-zero. + + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenCrsAddRdInterrupt ( + IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, + IN BOOLEAN ResourceConsumer, + IN BOOLEAN EdgeTriggered, + IN BOOLEAN ActiveLow, + IN BOOLEAN Shared, + IN UINT32 * IrqList, + IN UINT8 IrqCount + ); + +#endif // DISABLE_NEW_DEPRECATED_INTERFACES + #endif // AML_LIB_H_ diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn= 600Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/Ssd= tCmn600Generator.c index cc730cd90fea..fb93a5d2e70c 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Gene= rator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Gene= rator.c @@ -286,7 +286,7 @@ FixupCmn600Info ( =20 // Get the first Rd node in the "_CRS" object. // This is the PERIPHBASE node. - Status =3D AmlNameOpCrsGetFirstRdNode (NameOpCrsNode, &CmnPeriphBaseRdNo= de); + Status =3D AmlNameOpGetFirstRdNode (NameOpCrsNode, &CmnPeriphBaseRdNode); if (EFI_ERROR (Status)) { goto error_handler; } @@ -309,7 +309,7 @@ FixupCmn600Info ( // Get the QWord node corresponding to the ROOTNODEBASE. // It is the second Resource Data element in the BufferNode's // variable list of arguments. - Status =3D AmlNameOpCrsGetNextRdNode ( + Status =3D AmlNameOpGetNextRdNode ( CmnPeriphBaseRdNode, &CmnRootNodeBaseRdNode ); @@ -338,7 +338,7 @@ FixupCmn600Info ( // Resource Data nodes. for (Index =3D 0; Index < Cmn600Info->DtcCount; Index++) { DtcInt =3D &Cmn600Info->DtcInterrupt[Index]; - Status =3D AmlCodeGenCrsAddRdInterrupt ( + Status =3D AmlCodeGenAddRdInterrupt ( NameOpCrsNode, ((DtcInt->Flags & EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) = !=3D 0), diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c b/DynamicT= ablesPkg/Library/Common/AmlLib/Api/AmlApi.c index fdf04acc6212..6f9e3f6f2805 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c @@ -1,7 +1,7 @@ /** @file AML Api. =20 - Copyright (c) 2020, Arm Limited. All rights reserved.
+ Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -222,7 +222,7 @@ AmlNameOpUpdateString ( return Status; } =20 -/** Get the first Resource Data element contained in a "_CRS" object. +/** Get the first Resource Data element contained in a named object. =20 In the following ASL code, the function will return the Resource Data node corresponding to the "QWordMemory ()" ASL macro. @@ -233,35 +233,33 @@ AmlNameOpUpdateString ( ) =20 Note: - - The "_CRS" object must be declared using ASL "Name (Declare Named Obj= ect)". - - "_CRS" declared using ASL "Method (Declare Control Method)" is not - supported. + "_CRS" names defined as methods are not handled by this function. + They must be defined as names, using the "Name ()" statement. =20 - @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object. - Must have an OpCode=3DAML_NAME_OP, SubOpCode= =3D0. - NameOp object nodes are defined in ASL - using the "Name ()" function. - @param [out] OutRdNode Pointer to the first Resource Data element of - the "_CRS" object. A Resource Data element - is stored in a data node. + @param [in] NameOpNode NameOp object node defining a named object. + Must have an OpCode=3DAML_NAME_OP, SubOpCode= =3D0. + NameOp object nodes are defined in ASL + using the "Name ()" function. + @param [out] OutRdNode Pointer to the first Resource Data element of + the named object. A Resource Data element + is stored in a data node. =20 @retval EFI_SUCCESS The function completed successfully. @retval EFI_INVALID_PARAMETER Invalid parameter. **/ EFI_STATUS EFIAPI -AmlNameOpCrsGetFirstRdNode ( - IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, +AmlNameOpGetFirstRdNode ( + IN AML_OBJECT_NODE_HANDLE NameOpNode, OUT AML_DATA_NODE_HANDLE * OutRdNode ) { AML_OBJECT_NODE_HANDLE BufferOpNode; AML_DATA_NODE_HANDLE FirstRdNode; =20 - if ((NameOpCrsNode =3D=3D NULL) = || - (AmlGetNodeType ((AML_NODE_HANDLE)NameOpCrsNode) !=3D EAmlNodeObject= ) || - (!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) = || - (!AmlNameOpCompareName (NameOpCrsNode, "_CRS")) = || + if ((NameOpNode =3D=3D NULL) = || + (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) !=3D EAmlNodeObject) = || + (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) || (OutRdNode =3D=3D NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; @@ -269,10 +267,10 @@ AmlNameOpCrsGetFirstRdNode ( =20 *OutRdNode =3D NULL; =20 - // Get the _CRS value which is represented as a BufferOp object node - // which is the 2nd fixed argument (i.e. index 1). + // Get the value of the variable which is represented as a BufferOp obje= ct + // node which is the 2nd fixed argument (i.e. index 1). BufferOpNode =3D (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( - NameOpCrsNode, + NameOpNode, EAmlParseIndexTerm1 ); if ((BufferOpNode =3D=3D NULL) = || @@ -310,11 +308,12 @@ AmlNameOpCrsGetFirstRdNode ( } ) =20 - The CurrRdNode Resource Data node must be defined in an object named "_C= RS" - and defined by a "Name ()" ASL function. + Note: + "_CRS" names defined as methods are not handled by this function. + They must be defined as names, using the "Name ()" statement. =20 @param [in] CurrRdNode Pointer to the current Resource Data element = of - the "_CRS" object. + the named object. @param [out] OutRdNode Pointer to the Resource Data element following the CurrRdNode. Contain a NULL pointer if CurrRdNode is the @@ -327,12 +326,12 @@ AmlNameOpCrsGetFirstRdNode ( **/ EFI_STATUS EFIAPI -AmlNameOpCrsGetNextRdNode ( +AmlNameOpGetNextRdNode ( IN AML_DATA_NODE_HANDLE CurrRdNode, OUT AML_DATA_NODE_HANDLE * OutRdNode ) { - AML_OBJECT_NODE_HANDLE NameOpCrsNode; + AML_OBJECT_NODE_HANDLE NameOpNode; AML_OBJECT_NODE_HANDLE BufferOpNode; =20 if ((CurrRdNode =3D=3D NULL) = || @@ -356,12 +355,11 @@ AmlNameOpCrsGetNextRdNode ( } =20 // The parent of the BufferOpNode must be a NameOp node. - NameOpCrsNode =3D (AML_OBJECT_NODE_HANDLE)AmlGetParent ( - (AML_NODE_HANDLE)BufferOpNode - ); - if ((NameOpCrsNode =3D=3D NULL) || - (!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) || - (!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) { + NameOpNode =3D (AML_OBJECT_NODE_HANDLE)AmlGetParent ( + (AML_NODE_HANDLE)BufferOpNode + ); + if ((NameOpNode =3D=3D NULL) || + (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) { ASSERT (0); return EFI_INVALID_PARAMETER; } @@ -380,3 +378,88 @@ AmlNameOpCrsGetNextRdNode ( =20 return EFI_SUCCESS; } + +// DEPRECATED APIS +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES + +/** DEPRECATED API + + Get the first Resource Data element contained in a "_CRS" object. + + In the following ASL code, the function will return the Resource Data + node corresponding to the "QWordMemory ()" ASL macro. + Name (_CRS, ResourceTemplate() { + QWordMemory (...) {...}, + Interrupt (...) {...} + } + ) + + Note: + - The "_CRS" object must be declared using ASL "Name (Declare Named Obj= ect)". + - "_CRS" declared using ASL "Method (Declare Control Method)" is not + supported. + + @ingroup UserApis + + @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object. + Must have an OpCode=3DAML_NAME_OP, SubOpCode= =3D0. + NameOp object nodes are defined in ASL + using the "Name ()" function. + @param [out] OutRdNode Pointer to the first Resource Data element of + the "_CRS" object. A Resource Data element + is stored in a data node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +EFI_STATUS +EFIAPI +AmlNameOpCrsGetFirstRdNode ( + IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, + OUT AML_DATA_NODE_HANDLE * OutRdNode + ) +{ + return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode); +} + +/** DEPRECATED API + + Get the Resource Data element following the CurrRdNode Resource Data. + + In the following ASL code, if CurrRdNode corresponds to the first + "QWordMemory ()" ASL macro, the function will return the Resource Data + node corresponding to the "Interrupt ()" ASL macro. + Name (_CRS, ResourceTemplate() { + QwordMemory (...) {...}, + Interrupt (...) {...} + } + ) + + The CurrRdNode Resource Data node must be defined in an object named "_C= RS" + and defined by a "Name ()" ASL function. + + @ingroup UserApis + + @param [in] CurrRdNode Pointer to the current Resource Data element = of + the "_CRS" variable. + @param [out] OutRdNode Pointer to the Resource Data element following + the CurrRdNode. + Contain a NULL pointer if CurrRdNode is the + last Resource Data element in the list. + The "End Tag" is not considered as a resource + data element and is not returned. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +EFI_STATUS +EFIAPI +AmlNameOpCrsGetNextRdNode ( + IN AML_DATA_NODE_HANDLE CurrRdNode, + OUT AML_DATA_NODE_HANDLE * OutRdNode + ) +{ + return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode); +} + +#endif // DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceData= CodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataC= odeGen.c index d40a27410dd6..c7348aa5daf7 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen= .c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen= .c @@ -1,7 +1,7 @@ /** @file AML Resource Data Code Generation. =20 - Copyright (c) 2020, Arm Limited. All rights reserved.
+ Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -161,7 +161,7 @@ AmlCodeGenInterrupt ( This function creates a Resource Data element corresponding to the "Interrupt ()" ASL function, stores it in an AML Data Node. =20 - It then adds it after the input CurrRdNode in the list of resource data + It then adds it after the input NameOpNode in the list of resource data element. =20 The Resource Data effectively created is an Extended Interrupt Resource @@ -175,12 +175,12 @@ AmlCodeGenInterrupt ( - attach this node to an AML tree; - delete this node. =20 - Note: The _CRS node must be defined using the ASL Name () function. - e.g. Name (_CRS, ResourceTemplate () { - ... - } + Note: + The named node must be defined using the ASL "Name ()" statement. + E.g. Name (_CRS, ResourceTemplate () { ... }) + Methods cannot be modified with this function. =20 - @param [in] NameOpCrsNode NameOp object node defining a "_CRS" obje= ct. + @param [in] NameOpNode NameOp object node defining a named objec= t. Must have an OpCode=3DAML_NAME_OP, SubOpC= ode=3D0. NameOp object nodes are defined in ASL using the "Name ()" function. @@ -201,8 +201,8 @@ AmlCodeGenInterrupt ( **/ EFI_STATUS EFIAPI -AmlCodeGenCrsAddRdInterrupt ( - IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, +AmlCodeGenAddRdInterrupt ( + IN AML_OBJECT_NODE_HANDLE NameOpNode, IN BOOLEAN ResourceConsumer, IN BOOLEAN EdgeTriggered, IN BOOLEAN ActiveLow, @@ -215,18 +215,17 @@ AmlCodeGenCrsAddRdInterrupt ( =20 AML_OBJECT_NODE_HANDLE BufferOpNode; =20 - if ((IrqList =3D=3D NULL) = || - (IrqCount =3D=3D 0) = || - (!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) = || - (!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) { + if ((IrqList =3D=3D NULL) || + (IrqCount =3D=3D 0) || + (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) { ASSERT (0); return EFI_INVALID_PARAMETER; } =20 - // Get the _CRS value which is represented as a BufferOp object node + // Get the value which is represented as a BufferOp object node // which is the 2nd fixed argument (i.e. index 1). BufferOpNode =3D (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( - NameOpCrsNode, + NameOpNode, EAmlParseIndexTerm1 ); if ((BufferOpNode =3D=3D NULL) = || @@ -254,3 +253,79 @@ AmlCodeGenCrsAddRdInterrupt ( =20 return Status; } + +// DEPRECATED APIS +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES + +/** DEPRECATED API + + Add an Interrupt Resource Data node. + + This function creates a Resource Data element corresponding to the + "Interrupt ()" ASL function, stores it in an AML Data Node. + + It then adds it after the input CurrRdNode in the list of resource data + element. + + The Resource Data effectively created is an Extended Interrupt Resource + Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descripto= r" + for more information about Extended Interrupt Resource Data. + + The Extended Interrupt contains one single interrupt. + + This function allocates memory to create a data node. It is the caller's + responsibility to either: + - attach this node to an AML tree; + - delete this node. + + Note: The _CRS node must be defined using the ASL Name () function. + e.g. Name (_CRS, ResourceTemplate () { + ... + } + + @ingroup UserApis + + @param [in] NameOpCrsNode NameOp object node defining a "_CRS" obje= ct. + Must have an OpCode=3DAML_NAME_OP, SubOpC= ode=3D0. + NameOp object nodes are defined in ASL + using the "Name ()" function. + @param [in] ResourceConsumer The device consumes the specified interru= pt + or produces it for use by a child device. + @param [in] EdgeTriggered The interrupt is edge triggered or + level triggered. + @param [in] ActiveLow The interrupt is active-high or active-lo= w. + @param [in] Shared The interrupt can be shared with other + devices or not (Exclusive). + @param [in] IrqList Interrupt list. Must be non-NULL. + @param [in] IrqCount Interrupt count. Must be non-zero. + + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenCrsAddRdInterrupt ( + IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, + IN BOOLEAN ResourceConsumer, + IN BOOLEAN EdgeTriggered, + IN BOOLEAN ActiveLow, + IN BOOLEAN Shared, + IN UINT32 * IrqList, + IN UINT8 IrqCount + ) +{ + return AmlCodeGenAddRdInterrupt ( + NameOpCrsNode, + NameOpNode, + ResourceConsumer, + EdgeTriggered, + ActiveLow, + Shared, + IrqList, + IrqCount + ); +} + +#endif // DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSer= ialPortFixupLib.c b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/= SsdtSerialPortFixupLib.c index 8c77f172b795..6966410b2c34 100644 --- a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= FixupLib.c +++ b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= FixupLib.c @@ -275,7 +275,7 @@ FixupCrs ( } =20 // Get the first Rd node in the "_CRS" object. - Status =3D AmlNameOpCrsGetFirstRdNode (NameOpCrsNode, &QWordRdNode); + Status =3D AmlNameOpGetFirstRdNode (NameOpCrsNode, &QWordRdNode); if (EFI_ERROR (Status)) { return Status; } @@ -298,7 +298,7 @@ FixupCrs ( // Get the Interrupt node. // It is the second Resource Data element in the NameOpCrsNode's // variable list of arguments. - Status =3D AmlNameOpCrsGetNextRdNode (QWordRdNode, &InterruptRdNode); + Status =3D AmlNameOpGetNextRdNode (QWordRdNode, &InterruptRdNode); if (EFI_ERROR (Status)) { return Status; } --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76938): https://edk2.groups.io/g/devel/message/76938 Mute This Topic: https://groups.io/mt/83735192/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-