[edk2-devel] [PATCH edk2-platforms 2/2] Silicon/Qemu: use dynamic Pcds for SbsaQemu GIC addresses

Leif Lindholm posted 2 patches 1 year, 2 months ago
[edk2-devel] [PATCH edk2-platforms 2/2] Silicon/Qemu: use dynamic Pcds for SbsaQemu GIC addresses
Posted by Leif Lindholm 1 year, 2 months ago
The GIC addresses as currently declared as FixedPcd for SbsaQemu.
Change them to dynamic, to enable future patches to support these
being determined at runtime.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Graeme Gregory <graeme@xora.org.uk>
Cc: Radoslaw Biernacki <rad@semihalf.com>
Cc: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc                  | 12 ++++++------
 Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf      |  7 ++++---
 .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf      |  5 +++--
 .../SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h |  2 +-
 .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c        |  2 +-
 5 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index 9ca030cfe9a7..0bd0df4f0239 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -406,12 +406,6 @@ [PcdsFixedAtBuild.common]
   # Size of the region used by UEFI in permanent memory (Reserved 64MB)
   gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
 
-  #
-  # ARM General Interrupt Controller
-  #
-  gArmTokenSpaceGuid.PcdGicDistributorBase|0x40060000
-  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x40080000
-
   ## Default Terminal Type
   ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
@@ -523,6 +517,12 @@ [PcdsDynamicDefault.common]
   # TODO as no DT will be used we should pass this by some other method
   gArmTokenSpaceGuid.PcdSystemMemorySize|0x08000000
 
+  #
+  # ARM General Interrupt Controller
+  #
+  gArmTokenSpaceGuid.PcdGicDistributorBase|0x40060000
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x40080000
+
   #
   # Set video resolution for boot options
   # PlatformDxe can set the former at runtime.
diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
index 176d8fab835b..0501c670d565 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
@@ -32,9 +32,6 @@ [Packages]
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [FixedPcd]
-  gArmTokenSpaceGuid.PcdGicDistributorBase
-  gArmTokenSpaceGuid.PcdGicRedistributorsBase
-
   gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
@@ -74,3 +71,7 @@ [FixedPcd]
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize
+
+[Pcd]
+  gArmTokenSpaceGuid.PcdGicDistributorBase
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
index c6de685bd2c4..c1c33788567d 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
@@ -46,6 +46,9 @@ [Pcd]
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdCoreCount
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdClusterCount
 
+  gArmTokenSpaceGuid.PcdGicDistributorBase
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase
+
 [Depex]
   gEfiAcpiTableProtocolGuid                       ## CONSUMES
 
@@ -57,8 +60,6 @@ [Protocols]
 
 [FixedPcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision
-  gArmTokenSpaceGuid.PcdGicDistributorBase
-  gArmTokenSpaceGuid.PcdGicRedistributorsBase
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
diff --git a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h
index dcafcbca5a48..853b81b34df5 100644
--- a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h
+++ b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h
@@ -33,7 +33,7 @@
    EFI_ACPI_6_0_GICR,                        /* Type */                        \
    sizeof (EFI_ACPI_6_0_GICR_STRUCTURE),     /* Length */                      \
    EFI_ACPI_RESERVED_WORD,                   /* Reserved */                    \
-   FixedPcdGet64 (PcdGicRedistributorsBase), /* DiscoveryRangeBaseAddress */   \
+   PcdGet64 (PcdGicRedistributorsBase),      /* DiscoveryRangeBaseAddress */   \
    SBSAQEMU_MADT_GICR_SIZE                   /* DiscoveryRangeLength */        \
    }
 
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
index 58330a3e7005..ae5397bab768 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
@@ -83,7 +83,7 @@ AddMadtTable (
   EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE Gicd =
     EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT (
       0,
-      FixedPcdGet64 (PcdGicDistributorBase),
+      PcdGet64 (PcdGicDistributorBase),
       0,
       3 /* GicVersion */
     );
-- 
2.30.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104809): https://edk2.groups.io/g/devel/message/104809
Mute This Topic: https://groups.io/mt/98854532/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms 2/2] Silicon/Qemu: use dynamic Pcds for SbsaQemu GIC addresses
Posted by Sami Mujawar 1 year, 2 months ago
Hi Leif,

Thank you for this patch.

These changes look good to me.

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

Regards,

Sami Mujawar

On 12/05/2023 06:57 pm, Leif Lindholm via groups.io wrote:
> The GIC addresses as currently declared as FixedPcd for SbsaQemu.
> Change them to dynamic, to enable future patches to support these
> being determined at runtime.
>
> Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Graeme Gregory <graeme@xora.org.uk>
> Cc: Radoslaw Biernacki <rad@semihalf.com>
> Cc: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> ---
>   Platform/Qemu/SbsaQemu/SbsaQemu.dsc                  | 12 ++++++------
>   Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf      |  7 ++++---
>   .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf      |  5 +++--
>   .../SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h |  2 +-
>   .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c        |  2 +-
>   5 files changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> index 9ca030cfe9a7..0bd0df4f0239 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> @@ -406,12 +406,6 @@ [PcdsFixedAtBuild.common]
>     # Size of the region used by UEFI in permanent memory (Reserved 64MB)
>     gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
>   
> -  #
> -  # ARM General Interrupt Controller
> -  #
> -  gArmTokenSpaceGuid.PcdGicDistributorBase|0x40060000
> -  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x40080000
> -
>     ## Default Terminal Type
>     ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
>     gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
> @@ -523,6 +517,12 @@ [PcdsDynamicDefault.common]
>     # TODO as no DT will be used we should pass this by some other method
>     gArmTokenSpaceGuid.PcdSystemMemorySize|0x08000000
>   
> +  #
> +  # ARM General Interrupt Controller
> +  #
> +  gArmTokenSpaceGuid.PcdGicDistributorBase|0x40060000
> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x40080000
> +
>     #
>     # Set video resolution for boot options
>     # PlatformDxe can set the former at runtime.
> diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
> index 176d8fab835b..0501c670d565 100644
> --- a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
> +++ b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
> @@ -32,9 +32,6 @@ [Packages]
>     Silicon/Qemu/SbsaQemu/SbsaQemu.dec
>   
>   [FixedPcd]
> -  gArmTokenSpaceGuid.PcdGicDistributorBase
> -  gArmTokenSpaceGuid.PcdGicRedistributorsBase
> -
>     gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
>     gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
>     gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
> @@ -74,3 +71,7 @@ [FixedPcd]
>     gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
>     gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase
>     gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize
> +
> +[Pcd]
> +  gArmTokenSpaceGuid.PcdGicDistributorBase
> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase
> diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
> index c6de685bd2c4..c1c33788567d 100644
> --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
> @@ -46,6 +46,9 @@ [Pcd]
>     gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdCoreCount
>     gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdClusterCount
>   
> +  gArmTokenSpaceGuid.PcdGicDistributorBase
> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase
> +
>   [Depex]
>     gEfiAcpiTableProtocolGuid                       ## CONSUMES
>   
> @@ -57,8 +60,6 @@ [Protocols]
>   
>   [FixedPcd]
>     gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision
> -  gArmTokenSpaceGuid.PcdGicDistributorBase
> -  gArmTokenSpaceGuid.PcdGicRedistributorsBase
>   
>     gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
>     gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
> diff --git a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h
> index dcafcbca5a48..853b81b34df5 100644
> --- a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h
> +++ b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h
> @@ -33,7 +33,7 @@
>      EFI_ACPI_6_0_GICR,                        /* Type */                        \
>      sizeof (EFI_ACPI_6_0_GICR_STRUCTURE),     /* Length */                      \
>      EFI_ACPI_RESERVED_WORD,                   /* Reserved */                    \
> -   FixedPcdGet64 (PcdGicRedistributorsBase), /* DiscoveryRangeBaseAddress */   \
> +   PcdGet64 (PcdGicRedistributorsBase),      /* DiscoveryRangeBaseAddress */   \
>      SBSAQEMU_MADT_GICR_SIZE                   /* DiscoveryRangeLength */        \
>      }
>   
> diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
> index 58330a3e7005..ae5397bab768 100644
> --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
> @@ -83,7 +83,7 @@ AddMadtTable (
>     EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE Gicd =
>       EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT (
>         0,
> -      FixedPcdGet64 (PcdGicDistributorBase),
> +      PcdGet64 (PcdGicDistributorBase),
>         0,
>         3 /* GicVersion */
>       );


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104942): https://edk2.groups.io/g/devel/message/104942
Mute This Topic: https://groups.io/mt/98854532/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-