diff options
author | Rebecca Cran <quic_rcran@quicinc.com> | 2022-01-13 09:40:50 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-02-02 18:38:55 +0000 |
commit | 45b1612659d99eb6d58c8c6e52f2ae227a89cd16 (patch) | |
tree | ecbf9f49737e6095dfb7da71dd6bdf3e4e0a0e06 | |
parent | 017564d637e9c3051c2796d1d5b4d5df7179434c (diff) | |
download | edk2-45b1612659d99eb6d58c8c6e52f2ae227a89cd16.tar.gz edk2-45b1612659d99eb6d58c8c6e52f2ae227a89cd16.tar.bz2 edk2-45b1612659d99eb6d58c8c6e52f2ae227a89cd16.zip |
DynamicTablesPkg: Add Memory32Fixed function
Add a Memory32Fixed function to generate code for the corresponding
Memory32Fixed macro in AML.
Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
-rw-r--r-- | DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h | 33 | ||||
-rw-r--r-- | DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c | 58 |
2 files changed, 91 insertions, 0 deletions
diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index af18bf8e48..80d05f74ee 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
+AmlCodeGenRdMemory32Fixed (
+ 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 40d8c2b07a..dafbd19fde 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c @@ -609,6 +609,64 @@ 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
+AmlCodeGenRdMemory32Fixed (
+ 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 = ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR;
+ RangeDesc.Header.Length = sizeof (EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR) -
+ sizeof (ACPI_LARGE_RESOURCE_HEADER);
+ 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
|