From: "PierreGondois" <pierre.gondois@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
Sami Mujawar <sami.mujawar@arm.com>,
Rebecca Cran <quic_rcran@quicinc.com>,
Pierre Gondois <pierre.gondois@arm.com>
Subject: [PATCH v5 3/9] DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI
Date: Tue, 1 Feb 2022 18:22:46 +0100 [thread overview]
Message-ID: <20220201172252.799725-4-Pierre.Gondois@arm.com> (raw)
In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com>
From: Pierre Gondois <Pierre.Gondois@arm.com>
In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbers are described in the _PRT entry.
The interrupt type is then assumed by the OS.
AmlAddPrtEntry() currently only handles the first model. Make
changes to also handle the second model.
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
---
Notes:
v4:
- New patch (to handle GSI description in _PRT). [Pierre]
.../Common/AmlLib/CodeGen/AmlCodeGen.c | 89 ++++++++++++-------
1 file changed, 55 insertions(+), 34 deletions(-)
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index d245848ce3fa..2d55db97c7bf 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -1,7 +1,7 @@
/** @file
AML Code Generation.
- Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -881,6 +881,9 @@ AmlCodeGenNameResourceTemplate (
// interrupt, so let it to index 0.
}
+ The 2 models described in ACPI 6.4, s6.2.13 "_PRT (PCI Routing Table)" can
+ be generated by this function. The example above matches the first model.
+
The package is added at the tail of the list of the input _PRT node
name:
Name (_PRT, Package () {
@@ -901,8 +904,10 @@ AmlCodeGenNameResourceTemplate (
@param [in] Pin PCI pin number of the device (0-INTA ... 3-INTD).
Must be between 0-3.
@param [in] LinkName Link Name, i.e. device in the AML NameSpace
- describing the interrupt used.
- The input string is copied.
+ describing the interrupt used. The input string
+ is copied.
+ If NULL, generate 0 in the 'Source' field (cf.
+ second model, using GSIV).
@param [in] SourceIndex Source index or GSIV.
@param [in] PrtNameNode Prt Named node to add the object to ....
@@ -930,7 +935,6 @@ AmlAddPrtEntry (
AML_DATA_NODE *DataNode;
if ((Pin > 3) ||
- (LinkName == NULL) ||
(PrtNameNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)PrtNameNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (PrtNameNode, AML_NAME_OP, 0)) ||
@@ -999,41 +1003,58 @@ AmlAddPrtEntry (
NewElementNode = NULL;
- Status = ConvertAslNameToAmlName (LinkName, &AmlNameString);
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- goto error_handler;
- }
+ if (LinkName != NULL) {
+ Status = ConvertAslNameToAmlName (LinkName, &AmlNameString);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
- Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- goto error_handler;
- }
+ Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
- Status = AmlCreateDataNode (
- EAmlNodeDataTypeNameString,
- (UINT8 *)AmlNameString,
- AmlNameStringSize,
- &DataNode
- );
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- goto error_handler;
- }
+ Status = AmlCreateDataNode (
+ EAmlNodeDataTypeNameString,
+ (UINT8 *)AmlNameString,
+ AmlNameStringSize,
+ &DataNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
- // AmlNameString will be freed before returning.
+ // AmlNameString will be freed be fore returning.
- Status = AmlVarListAddTail (
- (AML_NODE_HANDLE)PackageNode,
- (AML_NODE_HANDLE)DataNode
- );
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- goto error_handler;
- }
+ Status = AmlVarListAddTail (
+ (AML_NODE_HANDLE)PackageNode,
+ (AML_NODE_HANDLE)DataNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ DataNode = NULL;
+ } else {
+ Status = AmlCodeGenInteger (0, &NewElementNode);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
- DataNode = NULL;
+ Status = AmlVarListAddTail (
+ (AML_NODE_HANDLE)PackageNode,
+ (AML_NODE_HANDLE)NewElementNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+ }
Status = AmlCodeGenInteger (SourceIndex, &NewElementNode);
if (EFI_ERROR (Status)) {
--
2.25.1
next prev parent reply other threads:[~2022-02-01 17:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 17:22 [PATCH v5 0/9] Add ACPI support for Kvmtool PierreGondois
2022-02-01 17:22 ` [PATCH v5 1/9] DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID PierreGondois
2022-02-01 17:22 ` [PATCH v5 2/9] DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info PierreGondois
2022-02-01 17:22 ` PierreGondois [this message]
2022-02-01 17:22 ` [PATCH v5 4/9] DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation PierreGondois
2022-02-01 17:22 ` [PATCH v5 5/9] ArmVirtPkg: Add cspell exceptions PierreGondois
2022-02-01 17:22 ` [PATCH v5 6/9] ArmVirtPkg/Kvmtool: Add DSDT ACPI table PierreGondois
2022-02-01 17:22 ` [PATCH v5 7/9] ArmVirtPkg/Kvmtool: Add Configuration Manager PierreGondois
2022-02-01 17:22 ` [PATCH v5 8/9] ArmVirtPkg/Kvmtool: Enable ACPI support PierreGondois
2022-02-01 17:22 ` [PATCH v5 9/9] ArmVirtPkg/Kvmtool: Enable Acpiview PierreGondois
2022-02-01 18:04 ` [PATCH v5 0/9] Add ACPI support for Kvmtool Ard Biesheuvel
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=20220201172252.799725-4-Pierre.Gondois@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