public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID
@ 2022-09-06 20:33 Jeff Brasen
  2022-09-14 14:37 ` PierreGondois
  2022-09-15 16:22 ` Sami Mujawar
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Brasen @ 2022-09-06 20:33 UTC (permalink / raw)
  To: devel; +Cc: sami.mujawar, Alexei.Fedorov, nd, pierre.gondois, Jeff Brasen

Add support for selecting to use index or segment number as UID and name.
This allows the path of the nodes to be well known.
For example, if the PCIe node needs to be notified from by an interrupt
for a Generic Event Device

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 DynamicTablesPkg/DynamicTablesPkg.dec         |  3 +++
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c    | 19 ++++++++++++++++++-
 .../Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf |  3 +++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec
index cc34c2bdd6..adc2e67cbf 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dec
+++ b/DynamicTablesPkg/DynamicTablesPkg.dec
@@ -60,5 +60,8 @@
   # Non BSA Compliant 16550 Serial HID
   gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonBsaCompliant16550SerialHid|""|VOID*|0x40000008
 
+  # Use PCI segment numbers as UID
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid|FALSE|BOOLEAN|0x40000009
+
 [Guids]
   gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index d82f071e85..85098752c6 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -981,6 +981,7 @@ BuildSsdtPciTableEx (
   UINTN                         Index;
   EFI_ACPI_DESCRIPTION_HEADER   **TableList;
   ACPI_PCI_GENERATOR            *Generator;
+  UINT32                        Uid;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -1036,13 +1037,29 @@ BuildSsdtPciTableEx (
   *Table = TableList;
 
   for (Index = 0; Index < PciCount; Index++) {
+    if (PcdGetBool (PcdPciUseSegmentAsUid)) {
+      Uid = PciInfo[Index].PciSegmentGroupNumber;
+      if (Uid > MAX_PCI_ROOT_COMPLEXES_SUPPORTED) {
+        DEBUG ((
+          DEBUG_ERROR,
+          "ERROR: SSDT-PCI: Pci root complexes segment number: %d."
+          " Greater than maximum number of Pci root complexes supported = %d.\n",
+          Uid,
+          MAX_PCI_ROOT_COMPLEXES_SUPPORTED
+          ));
+        return EFI_INVALID_PARAMETER;
+      }
+    } else {
+      Uid = Index;
+    }
+
     // Build a SSDT table describing the Pci devices.
     Status = BuildSsdtPciTable (
                Generator,
                CfgMgrProtocol,
                AcpiTableInfo,
                &PciInfo[Index],
-               Index,
+               Uid,
                &TableList[Index]
                );
     if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
index b38a4e9d34..c2a1acb570 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
@@ -30,3 +30,6 @@
   AmlLib
   BaseLib
   SsdtPcieSupportLib
+
+[Pcd]
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID
  2022-09-06 20:33 [PATCH] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID Jeff Brasen
@ 2022-09-14 14:37 ` PierreGondois
  2022-09-15 16:22 ` Sami Mujawar
  1 sibling, 0 replies; 4+ messages in thread
From: PierreGondois @ 2022-09-14 14:37 UTC (permalink / raw)
  To: Jeff Brasen, devel; +Cc: sami.mujawar, Alexei.Fedorov, nd

Hello Jeff,
The patch looks good to me:
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>

On 9/6/22 22:33, Jeff Brasen wrote:
> Add support for selecting to use index or segment number as UID and name.
> This allows the path of the nodes to be well known.
> For example, if the PCIe node needs to be notified from by an interrupt
> for a Generic Event Device
> 
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
>   DynamicTablesPkg/DynamicTablesPkg.dec         |  3 +++
>   .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c    | 19 ++++++++++++++++++-
>   .../Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf |  3 +++
>   3 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec
> index cc34c2bdd6..adc2e67cbf 100644
> --- a/DynamicTablesPkg/DynamicTablesPkg.dec
> +++ b/DynamicTablesPkg/DynamicTablesPkg.dec
> @@ -60,5 +60,8 @@
>     # Non BSA Compliant 16550 Serial HID
>     gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonBsaCompliant16550SerialHid|""|VOID*|0x40000008
>   
> +  # Use PCI segment numbers as UID
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid|FALSE|BOOLEAN|0x40000009
> +
>   [Guids]
>     gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
> index d82f071e85..85098752c6 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
> @@ -981,6 +981,7 @@ BuildSsdtPciTableEx (
>     UINTN                         Index;
>     EFI_ACPI_DESCRIPTION_HEADER   **TableList;
>     ACPI_PCI_GENERATOR            *Generator;
> +  UINT32                        Uid;
>   
>     ASSERT (This != NULL);
>     ASSERT (AcpiTableInfo != NULL);
> @@ -1036,13 +1037,29 @@ BuildSsdtPciTableEx (
>     *Table = TableList;
>   
>     for (Index = 0; Index < PciCount; Index++) {
> +    if (PcdGetBool (PcdPciUseSegmentAsUid)) {
> +      Uid = PciInfo[Index].PciSegmentGroupNumber;
> +      if (Uid > MAX_PCI_ROOT_COMPLEXES_SUPPORTED) {
> +        DEBUG ((
> +          DEBUG_ERROR,
> +          "ERROR: SSDT-PCI: Pci root complexes segment number: %d."
> +          " Greater than maximum number of Pci root complexes supported = %d.\n",
> +          Uid,
> +          MAX_PCI_ROOT_COMPLEXES_SUPPORTED
> +          ));
> +        return EFI_INVALID_PARAMETER;
> +      }
> +    } else {
> +      Uid = Index;
> +    }
> +
>       // Build a SSDT table describing the Pci devices.
>       Status = BuildSsdtPciTable (
>                  Generator,
>                  CfgMgrProtocol,
>                  AcpiTableInfo,
>                  &PciInfo[Index],
> -               Index,
> +               Uid,
>                  &TableList[Index]
>                  );
>       if (EFI_ERROR (Status)) {
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
> index b38a4e9d34..c2a1acb570 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
> @@ -30,3 +30,6 @@
>     AmlLib
>     BaseLib
>     SsdtPcieSupportLib
> +
> +[Pcd]
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID
  2022-09-06 20:33 [PATCH] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID Jeff Brasen
  2022-09-14 14:37 ` PierreGondois
@ 2022-09-15 16:22 ` Sami Mujawar
  2022-09-15 16:46   ` [edk2-devel] " Sami Mujawar
  1 sibling, 1 reply; 4+ messages in thread
From: Sami Mujawar @ 2022-09-15 16:22 UTC (permalink / raw)
  To: Jeff Brasen, devel; +Cc: Alexei.Fedorov, nd, pierre.gondois

Hi Jeff,

Thank you for this patch.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 06/09/2022 09:33 pm, Jeff Brasen wrote:
> Add support for selecting to use index or segment number as UID and name.
>
> This allows the path of the nodes to be well known.
>
> For example, if the PCIe node needs to be notified from by an interrupt
>
> for a Generic Event Device
>
>
>
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
>
> ---
>
>   DynamicTablesPkg/DynamicTablesPkg.dec         |  3 +++
>
>   .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c    | 19 ++++++++++++++++++-
>
>   .../Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf |  3 +++
>
>   3 files changed, 24 insertions(+), 1 deletion(-)
>
>
>
> diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec
>
> index cc34c2bdd6..adc2e67cbf 100644
>
> --- a/DynamicTablesPkg/DynamicTablesPkg.dec
>
> +++ b/DynamicTablesPkg/DynamicTablesPkg.dec
>
> @@ -60,5 +60,8 @@
>
>     # Non BSA Compliant 16550 Serial HID
>
>     gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonBsaCompliant16550SerialHid|""|VOID*|0x40000008
>
>   
>
> +  # Use PCI segment numbers as UID
>
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid|FALSE|BOOLEAN|0x40000009
>
> +
>
>   [Guids]
>
>     gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
>
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
>
> index d82f071e85..85098752c6 100644
>
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
>
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
>
> @@ -981,6 +981,7 @@ BuildSsdtPciTableEx (
>
>     UINTN                         Index;
>
>     EFI_ACPI_DESCRIPTION_HEADER   **TableList;
>
>     ACPI_PCI_GENERATOR            *Generator;
>
> +  UINT32                        Uid;
>
>   
>
>     ASSERT (This != NULL);
>
>     ASSERT (AcpiTableInfo != NULL);
>
> @@ -1036,13 +1037,29 @@ BuildSsdtPciTableEx (
>
>     *Table = TableList;
>
>   
>
>     for (Index = 0; Index < PciCount; Index++) {
>
> +    if (PcdGetBool (PcdPciUseSegmentAsUid)) {
>
> +      Uid = PciInfo[Index].PciSegmentGroupNumber;
>
> +      if (Uid > MAX_PCI_ROOT_COMPLEXES_SUPPORTED) {
>
> +        DEBUG ((
>
> +          DEBUG_ERROR,
>
> +          "ERROR: SSDT-PCI: Pci root complexes segment number: %d."
>
> +          " Greater than maximum number of Pci root complexes supported = %d.\n",
>
> +          Uid,
>
> +          MAX_PCI_ROOT_COMPLEXES_SUPPORTED
>
> +          ));
>
> +        return EFI_INVALID_PARAMETER;
>
> +      }
>
> +    } else {
>
> +      Uid = Index;
>
> +    }
>
> +
>
>       // Build a SSDT table describing the Pci devices.
>
>       Status = BuildSsdtPciTable (
>
>                  Generator,
>
>                  CfgMgrProtocol,
>
>                  AcpiTableInfo,
>
>                  &PciInfo[Index],
>
> -               Index,
>
> +               Uid,
>
>                  &TableList[Index]
>
>                  );
>
>       if (EFI_ERROR (Status)) {
>
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
>
> index b38a4e9d34..c2a1acb570 100644
>
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
>
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
>
> @@ -30,3 +30,6 @@
>
>     AmlLib
>
>     BaseLib
>
>     SsdtPcieSupportLib
>
> +
>
> +[Pcd]
>
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID
  2022-09-15 16:22 ` Sami Mujawar
@ 2022-09-15 16:46   ` Sami Mujawar
  0 siblings, 0 replies; 4+ messages in thread
From: Sami Mujawar @ 2022-09-15 16:46 UTC (permalink / raw)
  To: Sami Mujawar, devel

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Merged as 45297e6c9bd1..8c92a9508e16

Thanks.

Regards,
Sami Mujawar

[-- Attachment #2: Type: text/html, Size: 95 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-15 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-06 20:33 [PATCH] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID Jeff Brasen
2022-09-14 14:37 ` PierreGondois
2022-09-15 16:22 ` Sami Mujawar
2022-09-15 16:46   ` [edk2-devel] " Sami Mujawar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox