From nobody Fri Apr 26 12:38:45 2024 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+85426+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+85426+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1641679094; cv=none; d=zohomail.com; s=zohoarc; b=BwG/5zHAQMwIqN/GmWpGf5xEMtj79VEYEeyX1SsZkExE2RNQECbe99SPyuhiToYd+N/5+S5+bXwlH1jP2HzVDt4Nm20hM/HZFfbGyYESr8+A5b/e8y7MyNb5LFZfcWSbiJ6RPr3A8n5yqaf7N0A4KCcudCDXMON01NRmsf4Gttg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641679094; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=0kpinlfxGhndt8N95dak+j2wp2DP3tBuIcW4q/LdpUY=; b=GiktMnimJLcScVDBCf7YbOF+YxbRtyNr2jtW2M2BTmWPRRFQ6eMSy0hPyx4Siocak6TOWG2Lx1Z+xlL0C3xzQ99/qL5Vs9A+O9Cp3bARSMmD3LpalfKkT5DAoybjuRTAoCFMVB+I6/2RpXR31ltc7Uk26OvTSy6oFPDfVosJs5Y= 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+85426+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 1641679094398765.4997772120491; Sat, 8 Jan 2022 13:58:14 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2VIkYY1788612x5OUjg4bH05; Sat, 08 Jan 2022 13:58:14 -0800 X-Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by mx.groups.io with SMTP id smtpd.web10.11379.1641679093598495708 for ; Sat, 08 Jan 2022 13:58:13 -0800 X-Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 08 Jan 2022 13:58:13 -0800 X-QCInternal: smtphost X-Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2022 13:57:57 -0800 X-Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sat, 8 Jan 2022 13:57:57 -0800 X-Received: from linbox.ba.nuviainc.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sat, 8 Jan 2022 13:57:56 -0800 From: "Rebecca Cran" To: , Sami Mujawar , "Alexei Fedorov" , Leif Lindholm CC: Rebecca Cran Subject: [edk2-devel] [PATCH 1/3] DynamicTablesPkg: Add Memory32Fixed function Date: Sat, 8 Jan 2022 14:57:46 -0700 Message-ID: <20220108215748.2173-2-quic_rcran@quicinc.com> In-Reply-To: <20220108215748.2173-1-quic_rcran@quicinc.com> References: <20220108215748.2173-1-quic_rcran@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) 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,quic_rcran@quicinc.com X-Gm-Message-State: 035wO8jpINtbdda7KbH6lmUQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1641679094; bh=Fnr4UDS106YF346MDsDMAq08ZbY8pOfD1+VzdZ9FqT4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=nBV19zYI6l9MA/tbIYtSUsqVXu7qUOCPb9WlOHK2uQSYrH/rbWY2rWf2+pZygg8yFI2 BBHABLvc5VmmCH3G7k+7Lqx72f5A6VEJ6ofD/T8mS91U+yrhYm8ZMVYx4RirXT24Gq2aA cH557S20O+Ad5sg5HqYiVaZ0gPoRuEVMuCQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1641679095512100002 Content-Type: text/plain; charset="utf-8" Add a Memory32Fixed function to generate code for the corresponding Memory32Fixed macro in AML. Signed-off-by: Rebecca Cran --- DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h | = 33 +++++++++++ DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c | = 59 ++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index af18bf8e4871..8b3e80b61466 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -592,6 +592,39 @@ AmlCodeGenRdDWordMemory ( OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL ); =20 +/** Code generation for the "Memory32Fixed ()" ASL macro. + + The Resource Data effectively created is a 32-bit Memory Resource + Data. Cf ACPI 6.4: + - s19.6.83 "Memory Resource Descriptor Macro". + - s19.2.8 "Memory32FixedTerm". + + See ACPI 6.4 spec, s19.2.8 for more. + + @param [in] IsReadWrite ReadAndWrite parameter. + @param [in] Address AddressBase parameter. + @param [in] RangeLength Range length. + @param [in] NameOpNode NameOp object node defining a named ob= ject. + If provided, append the new resource d= ata + node to the list of resource data elem= ents + of this node. + @param [out] NewMemNode If provided and success, + contain the created node. + + @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 +AmlCodeGenMemory32Fixed ( + BOOLEAN IsReadWrite, + UINT32 Address, + UINT32 RangeLength, + AML_OBJECT_NODE_HANDLE NameOpNode, + AML_DATA_NODE_HANDLE *NewMemNode + ); + /** Code generation for the "WordBusNumber ()" ASL function. =20 The Resource Data effectively created is a Word Address Space Resource diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceData= CodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataC= odeGen.c index 40d8c2b07ae3..b9e8429cc6ca 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen= .c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen= .c @@ -609,6 +609,65 @@ AmlCodeGenRdDWordMemory ( ); } =20 +/** Code generation for the "Memory32Fixed ()" ASL macro. + + The Resource Data effectively created is a 32-bit Memory Resource + Data. Cf ACPI 6.4: + - s19.6.83 "Memory Resource Descriptor Macro". + - s19.2.8 "Memory32FixedTerm". + + See ACPI 6.4 spec, s19.2.8 for more. + + @param [in] IsReadWrite ReadAndWrite parameter. + @param [in] Addres AddressBase parameter. + @param [in] RangeLength Range length. + @param [in] NameOpNode NameOp object node defining a named ob= ject. + If provided, append the new resource d= ata + node to the list of resource data elem= ents + of this node. + @param [out] NewMemNode If provided and success, + contain the created node. + + @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 +AmlCodeGenMemory32Fixed ( + BOOLEAN IsReadWrite, + UINT32 Address, + UINT32 RangeLength, + AML_OBJECT_NODE_HANDLE NameOpNode, + AML_DATA_NODE_HANDLE *NewMemNode + ) +{ + EFI_STATUS Status; + AML_DATA_NODE *MemNode; + UINT8 Data[12]; + + Data[0] =3D 0x86; + Data[1] =3D 0x09; + Data[2] =3D 0x00; + Data[3] =3D IsReadWrite; + Data[4] =3D Address & 0xFF; + Data[5] =3D (Address & 0xFF00) >> 8; + Data[6] =3D (Address & 0xFF0000) >> 16; + Data[7] =3D (Address & 0xFF000000) >> 24; + Data[8] =3D RangeLength & 0xFF; + Data[9] =3D (RangeLength & 0xFF00) >> 8; + Data[10] =3D (RangeLength & 0xFF0000) >> 16; + Data[11] =3D (RangeLength & 0xFF000000) >> 24; + + Status =3D AmlCreateDataNode (EAmlNodeDataTypeResourceData, Data, sizeof= (Data), &MemNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + return LinkRdNode (MemNode, NameOpNode, NewMemNode); +} + /** Code generation for the "WordSpace ()" ASL function. =20 The Resource Data effectively created is a Word Address Space Resource --=20 2.31.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 (#85426): https://edk2.groups.io/g/devel/message/85426 Mute This Topic: https://groups.io/mt/88291904/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- From nobody Fri Apr 26 12:38:45 2024 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+85424+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+85424+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1641679080; cv=none; d=zohomail.com; s=zohoarc; b=FEO9SBKDznyKpEKreRzdOHpcnYE1aiZLl5IloUEmyQa/ogoK+RvKgA0iRVB9lhHkyAVG/xY6ZrJEZQU6x6mOO7FxJrmEJLSbAhUqduFuMpHE+3D5+OB5ZZP9rR5cgyAhmeVyrqINi2X7AXmlQ9D+otHU2BxC+8Yk1K9QCiamiqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641679080; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=F9IC/0ad9I0U/z9ae5Z8j5N734OVeC6c7BvxNDpv4+A=; b=JjGMZPnLF4rkRuvfwdX8YdvbbfpPlBLPqDu2OVSH6WN8AriJ5CQSLuxcExT7L4+1gHIlcanq5Oyfac1V7OQvsRJZOHg/Z11nZ5FFM33sSF0CAEMRI8t2r1fPCr5+rak7jkRvVxf6ihy2BluLsjxgv8wvy37pw/1AwJt5F6BP1hE= 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+85424+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 1641679080083111.77524305492341; Sat, 8 Jan 2022 13:58:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id QNXIYY1788612xEnmiTKIFqz; Sat, 08 Jan 2022 13:57:59 -0800 X-Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by mx.groups.io with SMTP id smtpd.web12.11299.1641679076470695746 for ; Sat, 08 Jan 2022 13:57:59 -0800 X-Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 08 Jan 2022 13:57:59 -0800 X-QCInternal: smtphost X-Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2022 13:57:58 -0800 X-Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sat, 8 Jan 2022 13:57:58 -0800 X-Received: from linbox.ba.nuviainc.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sat, 8 Jan 2022 13:57:57 -0800 From: "Rebecca Cran" To: , Sami Mujawar , "Alexei Fedorov" , Leif Lindholm CC: Rebecca Cran Subject: [edk2-devel] [PATCH 2/3] DynamicTablesPkg: Remove redundant cast in AmlCodeGenReturn Date: Sat, 8 Jan 2022 14:57:47 -0700 Message-ID: <20220108215748.2173-3-quic_rcran@quicinc.com> In-Reply-To: <20220108215748.2173-1-quic_rcran@quicinc.com> References: <20220108215748.2173-1-quic_rcran@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) 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,quic_rcran@quicinc.com X-Gm-Message-State: TeH6FgpEL28xiSyLzNB4vIWqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1641679079; bh=RkIpOKLuQPOBo5WrACMcZ/+bE/6WMKvGwKsJdoLhOrI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=QBjSu7oSmCwPiWdcWhtstyqhwdLY7TO6tsjxiCfDXOne1HAhTqPEqRqWg48Dx1vxXwt pvXeP1X5gaT5nS2TmWM2ri69oqmWvxy+s6Ar0hPsNW4t2QwRwlaJkCfdPcMNTgmMAcaVU uj6Xn/K8LbpsHlzxngyWi4GVRV8jRkgXqe8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1641679080629100006 Content-Type: text/plain; charset="utf-8" In AmlCodeGenReturn, the cast to AML_NODE_HEADER* in the call to AmlSetFixedArgument is redundant because ReturnNode is already a AML_NODE_HEADER* . Signed-off-by: Rebecca Cran Reviewed-by: Pierre Gondois --- DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index d245848ce3fa..838a892c6b58 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1564,7 +1564,7 @@ AmlCodeGenReturn ( Status =3D AmlSetFixedArgument ( ObjectNode, EAmlParseIndexTerm0, - (AML_NODE_HEADER *)ReturnNode + ReturnNode ); if (EFI_ERROR (Status)) { ASSERT (0); --=20 2.31.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 (#85424): https://edk2.groups.io/g/devel/message/85424 Mute This Topic: https://groups.io/mt/88291890/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- From nobody Fri Apr 26 12:38:45 2024 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+85425+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+85425+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1641679081; cv=none; d=zohomail.com; s=zohoarc; b=HIUiqYfHeSZSAgotutlkNZ0Kx3hXA6HyvrSiuUZh8avp3ulULaAdo5Ii15SE0hBlBgWTA/ZyhIC/7PmQRi3e+tPIrgHtSZD/UET9bZ+/0oV1AJ7rOAyN+Yh9rDr3Dx6KChsyRDNsAStDOWw4Ba2JI9YW5dJESCpqo0edvpjTUCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641679081; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=izDB+Mpq7I2unmJJVLFxeuUzJxYqTfhqUq57QNM9Jjw=; b=INXuzG3AKkHoDO0ksnO6kkgXOZuQN3aOU9/krQbu1zwJ0ZCJ9QLkmf69b+M8C1dls/M1SNAAq8l5mhDkyaVZAfLApCMxN660k0y9S99iQDlFimjk4p7iKUopD4JdfHm2pi9YYHi1lXDIiJkFupeL/V4Uy4GFd2qPDXcHJjAq0s4= 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+85425+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 1641679081586253.73709316172028; Sat, 8 Jan 2022 13:58:01 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id hGMQYY1788612xfiYT3zp9ez; Sat, 08 Jan 2022 13:58:01 -0800 X-Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by mx.groups.io with SMTP id smtpd.web12.11299.1641679076470695746 for ; Sat, 08 Jan 2022 13:58:00 -0800 X-Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 08 Jan 2022 13:58:00 -0800 X-QCInternal: smtphost X-Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2022 13:58:00 -0800 X-Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sat, 8 Jan 2022 13:57:59 -0800 X-Received: from linbox.ba.nuviainc.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sat, 8 Jan 2022 13:57:59 -0800 From: "Rebecca Cran" To: , Sami Mujawar , "Alexei Fedorov" , Leif Lindholm CC: Rebecca Cran Subject: [edk2-devel] [PATCH 3/3] DynamicTablesPkg: Add AmlCodeGenMethodRetInteger function Date: Sat, 8 Jan 2022 14:57:48 -0700 Message-ID: <20220108215748.2173-4-quic_rcran@quicinc.com> In-Reply-To: <20220108215748.2173-1-quic_rcran@quicinc.com> References: <20220108215748.2173-1-quic_rcran@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) 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,quic_rcran@quicinc.com X-Gm-Message-State: t6bo64Z9qqEU8m8chF2IxXhix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1641679081; bh=zAhZbxjwKgxlj/eXG8fHpWKf2WsC4QW4OaxCLzAX+kM=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=NTsJNe0E4PVlMsQDQEnrX8bgLe8VKhPdH8dw86ONyR/vMZyGCCRYTq3uOr+mwyenxVG md+3wCVEgCj+cud8/NtEwTDOy/0r7/2Uge+3pyein3x/CWI8UZz9fBlhWMQFwTaZ6m12j Y9wsWG6RDx7x6MGauVpU59S3qnNpSwT50Zg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1641679082668100009 Content-Type: text/plain; charset="utf-8" Add AmlCodeGenMethodRetInteger function to generate AML code for a Method returning an Integer. Signed-off-by: Rebecca Cran Reviewed-by: Pierre Gondois --- DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h | 47 ++++++ DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c | 156 ++++++++= ++++++++++++ 2 files changed, 203 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index 8b3e80b61466..e47cf99eaa37 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1118,6 +1118,53 @@ AmlCodeGenMethodRetNameString ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); =20 +/** AML code generation for a method returning an Integer. + + AmlCodeGenMethodRetInteger ( + "_CBA", 0, 1, TRUE, 3, ParentNode, NewObjectNode + ); + is equivalent of the following ASL code: + Method(_CBA, 1, Serialized, 3) { + Return (0) + } + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. + Must be a NULL-terminated ASL NameStri= ng + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] ReturnedInteger The value of the integer returned by t= he + method. + @param [in] NumArgs Number of arguments. + Must be 0 <=3D NumArgs <=3D 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. + FALSE is equivalent to NotSerialized. + Default is NotSerialized in ASL spec. + @param [in] SyncLevel Synchronization level for the method. + Must be 0 <=3D SyncLevel <=3D 15. + Default is 0 in ASL. + @param [in] ParentNode If provided, set ParentNode as the par= ent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenMethodRetInteger ( + IN CONST CHAR8 *MethodNameString, + IN UINT64 ReturnedInteger, + IN UINT8 NumArgs, + IN BOOLEAN IsSerialized, + IN UINT8 SyncLevel, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** Create a _LPI name. =20 AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 838a892c6b58..07822ead5b70 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1685,6 +1685,61 @@ exit_handler: return Status; } =20 +/** AML code generation for a Return object node, + returning an Integer. + + AmlCodeGenReturn (0), ParentNode, NewObjectNode) is + equivalent of the following ASL code: + Return (0) + + The ACPI 6.3 specification, 20.2.8 "Statement Opcodes Encoding" states: + DefReturn :=3D ReturnOp ArgObject + ReturnOp :=3D 0xA4 + ArgObject :=3D TermArg =3D> DataRefObject + + Thus, the ReturnNode must be evaluated as a DataRefObject. + + The ReturnNode must be generated inside a Method body scope. + + @param [in] Integer The integer is returned by the Return + ASL statement. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + Must be a MethodOp node. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +AmlCodeGenReturnInteger ( + IN UINT64 Integer, + IN AML_NODE_HEADER *ParentNode OPTIONAL, + OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *IntNode; + + IntNode =3D NULL; + + Status =3D AmlCodeGenInteger (Integer, &IntNode); + ASSERT_EFI_ERROR (Status); + + // AmlCodeGenReturn() deletes DataNode if error. + Status =3D AmlCodeGenReturn ( + (AML_NODE_HEADER *)IntNode, + ParentNode, + NewObjectNode + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + /** AML code generation for a method returning a NameString. =20 AmlCodeGenMethodRetNameString ( @@ -1793,6 +1848,107 @@ error_handler: return Status; } =20 +/** AML code generation for a method returning an Integer. + + AmlCodeGenMethodRetInteger ( + "_CBA", 0, 1, TRUE, 3, ParentNode, NewObjectNode + ); + is equivalent of the following ASL code: + Method(_CBA, 1, Serialized, 3) { + Return (0) + } + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. + Must be a NULL-terminated ASL NameStri= ng + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] ReturnedInteger The value of the integer returned by t= he + method. + @param [in] NumArgs Number of arguments. + Must be 0 <=3D NumArgs <=3D 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. + FALSE is equivalent to NotSerialized. + Default is NotSerialized in ASL spec. + @param [in] SyncLevel Synchronization level for the method. + Must be 0 <=3D SyncLevel <=3D 15. + Default is 0 in ASL. + @param [in] ParentNode If provided, set ParentNode as the par= ent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenMethodRetInteger ( + IN CONST CHAR8 *MethodNameString, + IN UINT64 ReturnedInteger, + IN UINT8 NumArgs, + IN BOOLEAN IsSerialized, + IN UINT8 SyncLevel, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE_HANDLE MethodNode; + + if ((MethodNameString =3D=3D NULL) || + ((ParentNode =3D=3D NULL) && (NewObjectNode =3D=3D NULL))) + { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + // Create a Method named MethodNameString. + Status =3D AmlCodeGenMethod ( + MethodNameString, + NumArgs, + IsSerialized, + SyncLevel, + NULL, + &MethodNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Status =3D AmlCodeGenReturnInteger ( + ReturnedInteger, + (AML_NODE_HANDLE)MethodNode, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D LinkNode ( + MethodNode, + ParentNode, + NewObjectNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + return Status; + +error_handler: + if (MethodNode !=3D NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)MethodNode); + } + + return Status; +} + /** Create a _LPI name. =20 AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is --=20 2.31.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 (#85425): https://edk2.groups.io/g/devel/message/85425 Mute This Topic: https://groups.io/mt/88291891/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-