From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by mx.groups.io with SMTP id smtpd.web12.10976.1641922628326531885 for ; Tue, 11 Jan 2022 09:37:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=rL/AlVSG; spf=pass (domain: quicinc.com, ip: 199.106.114.38, mailfrom: quic_rcran@quicinc.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1641922628; x=1673458628; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=I/LTWagBDV3qNForHWADjEFbCgvZxhMFXr30q5K0rgs=; b=rL/AlVSG+E63SyyypP7iZX5Nh2IaRx3u1lK8z+6g84Pn+AIr82pylpNW bV90i5aX1tEE5akxF64NlRhuKbjFrOAW5j7vSXzFSYJ9yG5UBdAMdHL26 EyfXNc0Ck1Q+Rm394FiQFvyc/YKS63AIEzwW43vP4rC0SluoGuctbsNiL w=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 11 Jan 2022 09:37:07 -0800 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2022 09:37:06 -0800 Received: from [10.110.26.69] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Tue, 11 Jan 2022 09:37:06 -0800 Message-ID: Date: Tue, 11 Jan 2022 10:37:05 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [edk2-devel] [PATCH 1/3] DynamicTablesPkg: Add Memory32Fixed function To: Pierre Gondois , , Sami Mujawar , Alexei Fedorov , Leif Lindholm References: <20220108215748.2173-1-quic_rcran@quicinc.com> <20220108215748.2173-2-quic_rcran@quicinc.com> <99d5745b-3ed6-356c-2f5f-7708b95cc2d5@arm.com> From: "Rebecca Cran" In-Reply-To: <99d5745b-3ed6-356c-2f5f-7708b95cc2d5@arm.com> Return-Path: quic_rcran@quicinc.com X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) Content-Language: en-US Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Thanks. I've fixed these issues in the v2 patch which I'll send out soon. -- Rebecca Cran On 1/11/22 04:34, Pierre Gondois wrote: > Hello Rebecca, > > On 1/8/22 10:57 PM, Rebecca Cran via groups.io wrote: >> 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/DynamicTablesPkg/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 >> ); >> >> +/** 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 object. >> + If provided, append the new resource data >> + node to the list of resource data elements >> + 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. >> >> The Resource Data effectively created is a Word Address Space Resource >> diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.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 ( >> ); >> } >> >> +/** Code generation for the "Memory32Fixed ()" ASL macro. >> + >> + The Resource Data effectively created is a 32-bit Memory Resource > I think there are 2 spaces for the indentation (instead of 1 above). >> + 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 object. >> + If provided, append the new resource data >> + node to the list of resource data elements >> + 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] = 0x86; >> + Data[1] = 0x09; >> + Data[2] = 0x00; >> + Data[3] = IsReadWrite; > Is it possible to use BITx instead as this is a bit field, as: > > = IsReadWrite ? BIT0 : 0; > >> + Data[4] = Address & 0xFF; >> + Data[5] = (Address & 0xFF00) >> 8; >> + Data[6] = (Address & 0xFF0000) >> 16; >> + Data[7] = (Address & 0xFF000000) >> 24; >> + Data[8] = RangeLength & 0xFF; >> + Data[9] = (RangeLength & 0xFF00) >> 8; >> + Data[10] = (RangeLength & 0xFF0000) >> 16; >> + Data[11] = (RangeLength & 0xFF000000) >> 24; > Is it possible to use a EFI_ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR structure instead of a raw buffer ? >> + >> + Status = 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. >> >> The Resource Data effectively created is a Word Address Space Resource > Thanks for the patch, > > Regards, > > Pierre >