From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by mx.groups.io with SMTP id smtpd.web10.11377.1641923691452449165 for ; Tue, 11 Jan 2022 09:54:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Zb2vO9J/; spf=pass (domain: quicinc.com, ip: 129.46.98.28, 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=1641923691; x=1673459691; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=idEuqIQVVxCvU9QQXbLbHzFu1H0tJyMmbNxZrdRDvhI=; b=Zb2vO9J/8TNQ1yfO3l/ftyBpfqE1AqVU97XAI7UCG8jw7ofBNtPHW/bp qxGiQEj5BChDcd7vLMpN6hA0bRkv3t7bpgPo2RlDv9RNKheQf1tdiGI3F xo9oOu7GjkTHFYCAM4GWWW2fPEzf7xoRvZfEfQVqp9vprJGR9Hlc0hVC/ A=; Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 11 Jan 2022 09:54:51 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2022 09:54:51 -0800 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; Tue, 11 Jan 2022 09:54:50 -0800 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; Tue, 11 Jan 2022 09:54:49 -0800 From: "Rebecca Cran" To: , Sami Mujawar , PierreGondois , Alexei Fedorov , "Leif Lindholm" CC: Rebecca Cran Subject: [PATCH v2 1/3] DynamicTablesPkg: Add Memory32Fixed function Date: Tue, 11 Jan 2022 10:54:33 -0700 Message-ID: <20220111175435.14695-2-quic_rcran@quicinc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111175435.14695-1-quic_rcran@quicinc.com> References: <20220111175435.14695-1-quic_rcran@quicinc.com> MIME-Version: 1.0 Return-Path: quic_rcran@quicinc.com 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) Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 | 57 ++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index af18bf8e4871..2491ade397c6 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..19fb76dc5b45 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c @@ -609,6 +609,63 @@ AmlCodeGenRdDWordMemory ( ); } +/** 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 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; + EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR RangeDesc; + + RangeDesc.Header.Header.Byte = 0x86; + RangeDesc.Header.Length = 0x09; + RangeDesc.Information = IsReadWrite ? BIT0 : 0; + RangeDesc.BaseAddress = Address; + RangeDesc.Length = RangeLength; + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeResourceData, + (UINT8 *)&RangeDesc, + sizeof (RangeDesc), + &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 -- 2.31.1