From: "Sami Mujawar" <sami.mujawar@arm.com>
To: Pierre.Gondois@arm.com, devel@edk2.groups.io,
Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Akanksha Jain <akanksha.jain2@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>, nd <nd@arm.com>
Subject: Re: [PATCH v1 3/7] DynamicTablesPkg: AML Code generation to create a named ResourceTemplate()
Date: Wed, 6 Oct 2021 16:16:23 +0100 [thread overview]
Message-ID: <5ed6dec0-11b3-eded-a4be-5233f7f9ea8c@arm.com> (raw)
In-Reply-To: <20210623115834.907-4-Pierre.Gondois@arm.com>
Hi Pierre,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 23/06/2021 12:58 PM, Pierre.Gondois@arm.com wrote:
> From: Pierre Gondois <Pierre.Gondois@arm.com>
>
> Add AmlCodeGenNameResourceTemplate() to generate code for a
> ResourceTemplate().
>
> AmlCodeGenNameResourceTemplate ("REST", ParentNode, NewObjectNode) is
> equivalent of the following ASL code:
> Name(REST, ResourceTemplate () {})
>
> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
> ---
> .../Include/Library/AmlLib/AmlLib.h | 28 ++++++++++
> .../Common/AmlLib/CodeGen/AmlCodeGen.c | 55 +++++++++++++++++++
> 2 files changed, 83 insertions(+)
>
> diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
> index 412db886e1f2..544bc670c455 100644
> --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
> +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
> @@ -880,6 +880,34 @@ AmlCodeGenNamePackage (
> OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
> );
>
> +/** AML code generation for a Name object node, containing a ResourceTemplate.
> +
> + AmlCodeGenNameResourceTemplate ("PRS0", ParentNode, NewObjectNode) is
> + equivalent of the following ASL code:
> + Name(PRS0, ResourceTemplate () {})
> +
> + @ingroup CodeGenApis
> +
> + @param [in] NameString The new variable name.
> + Must be a NULL-terminated ASL NameString
> + e.g.: "DEV0", "DV15.DEV0", etc.
> + The input string is copied.
> + @param [in] ParentNode If provided, set ParentNode as the parent
> + 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
> +AmlCodeGenNameResourceTemplate (
> + IN CONST CHAR8 * NameString,
> + IN AML_NODE_HANDLE ParentNode, OPTIONAL
> + OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
> + );
> +
> /** AML code generation for a Device object node.
>
> AmlCodeGenDevice ("COM0", ParentNode, NewObjectNode) is
> diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
> index f9175c623622..eaa49a5834c2 100644
> --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
> +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
> @@ -802,6 +802,61 @@ AmlCodeGenNamePackage (
> return Status;
> }
>
> +/** AML code generation for a Name object node, containing a ResourceTemplate.
> +
> + AmlCodeGenNameResourceTemplate ("PRS0", ParentNode, NewObjectNode) is
> + equivalent of the following ASL code:
> + Name(PRS0, ResourceTemplate () {})
> +
> + @param [in] NameString The new variable name.
> + Must be a NULL-terminated ASL NameString
> + e.g.: "DEV0", "DV15.DEV0", etc.
> + The input string is copied.
> + @param [in] ParentNode If provided, set ParentNode as the parent
> + 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
> +AmlCodeGenNameResourceTemplate (
> + IN CONST CHAR8 * NameString,
> + IN AML_NODE_HEADER * ParentNode, OPTIONAL
> + OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
> + )
> +{
> + EFI_STATUS Status;
> + AML_OBJECT_NODE * ResourceTemplateNode;
> +
> + if ((NameString == NULL) ||
> + ((ParentNode == NULL) && (NewObjectNode == NULL))) {
> + ASSERT (0);
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + Status = AmlCodeGenResourceTemplate (&ResourceTemplateNode);
> + if (EFI_ERROR (Status)) {
> + ASSERT (0);
> + return Status;
> + }
> +
> + Status = AmlCodeGenName (
> + NameString,
> + ResourceTemplateNode,
> + ParentNode,
> + NewObjectNode
> + );
> + if (EFI_ERROR (Status)) {
> + ASSERT (0);
> + AmlDeleteTree ((AML_NODE_HEADER*)ResourceTemplateNode);
> + }
> +
> + return Status;
> +}
> +
> /** AML code generation for a Device object node.
>
> AmlCodeGenDevice ("COM0", ParentNode, NewObjectNode) is
next prev parent reply other threads:[~2021-10-06 15:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-23 11:58 [PATCH v1 0/7] Create a SSDT PCIe generator PierreGondois
2021-06-23 11:58 ` [PATCH v1 1/7] DynamicTablesPkg: AML Code generation for memory ranges PierreGondois
2021-10-06 15:14 ` Sami Mujawar
2021-06-23 11:58 ` [PATCH v1 2/7] DynamicTablesPkg: AML Code generation to create a named Package() PierreGondois
2021-10-06 15:15 ` Sami Mujawar
2021-06-23 11:58 ` [PATCH v1 3/7] DynamicTablesPkg: AML Code generation to create a named ResourceTemplate() PierreGondois
2021-10-06 15:16 ` Sami Mujawar [this message]
2021-06-23 11:58 ` [PATCH v1 4/7] DynamicTablesPkg: AML Code generation to add _PRT entries PierreGondois
2021-10-06 15:17 ` Sami Mujawar
2021-06-23 11:58 ` [PATCH v1 5/7] DynamicTablesPkg: Add AmlAttachNode() PierreGondois
2021-10-06 15:17 ` Sami Mujawar
2021-06-23 11:58 ` [PATCH v1 6/7] DynamicTablesPkg: Add Pci related objects PierreGondois
2021-10-06 15:18 ` Sami Mujawar
2021-06-23 11:58 ` [PATCH v1 7/7] DynamicTablesPkg: SSDT Pci express generator PierreGondois
2021-10-07 11:11 ` Sami Mujawar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ed6dec0-11b3-eded-a4be-5233f7f9ea8c@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox