public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pete Batard" <pete@akeo.ie>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com,
	awarkentin@vmware.com
Subject: [edk2-platforms][PATCH 3/6] Platform/RPi/AcpiTables: Use PCDs in MADT
Date: Thu, 26 Mar 2020 11:53:19 +0000	[thread overview]
Message-ID: <20200326115322.2880-4-pete@akeo.ie> (raw)
In-Reply-To: <20200326115322.2880-1-pete@akeo.ie>

Instead of going through a model #ifdef, the call to
EFI_ACPI_5_1_GICC_STRUCTURE_INIT () is factorized by
setting up a new set of PCDs.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/AcpiTables/AcpiTables.inf |  8 +++++
 Platform/RaspberryPi/AcpiTables/Madt.aslc      | 31 ++++++++------------
 Platform/RaspberryPi/RPi3/RPi3.dsc             |  9 ++++++
 Platform/RaspberryPi/RPi4/RPi4.dsc             |  7 +++++
 Platform/RaspberryPi/RaspberryPi.dec           |  7 +++++
 5 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
index 9ad5246d6bb6..6642541d6a0a 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
@@ -39,6 +39,7 @@ [Packages]
   EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
+  Platform/RaspberryPi/RaspberryPi.dec
   Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
   Silicon/Broadcom/Bcm283x/Bcm283x.dec
   Silicon/Broadcom/Drivers/Net/BcmNet.dec
@@ -56,6 +57,13 @@ [FixedPcd]
   gBcmNetTokenSpaceGuid.PcdBcmGenetRegistersAddress
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
   gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
+  gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase
+  gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase
+  gRaspberryPiTokenSpaceGuid.PcdGicGsivId
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3
 
 [BuildOptions]
   GCC:*_*_*_ASL_FLAGS       = -vw3133 -vw3150
diff --git a/Platform/RaspberryPi/AcpiTables/Madt.aslc b/Platform/RaspberryPi/AcpiTables/Madt.aslc
index 4029cd191ab5..faf461814536 100644
--- a/Platform/RaspberryPi/AcpiTables/Madt.aslc
+++ b/Platform/RaspberryPi/AcpiTables/Madt.aslc
@@ -44,29 +44,22 @@ PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
     0, // Flags
   },
   {
-#if (RPI_MODEL == 3)
     EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+      0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq0),
+      FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+      FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
     EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+      1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq1),
+      FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+      FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
     EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
+      2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq2),
+      FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+      FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
     EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0),
-#elif (RPI_MODEL == 4)
-    EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 48, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
-        0xFF846000, 0xFF844000, 0x19, 0),
-    EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 49, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
-        0xFF846000, 0xFF844000, 0x19, 0),
-    EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 50, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
-        0xFF846000, 0xFF844000, 0x19, 0),
-    EFI_ACPI_5_1_GICC_STRUCTURE_INIT(
-        3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 51, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
-        0xFF846000, 0xFF844000, 0x19, 0),
-#endif
+      3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, FixedPcdGet32 (PcdGicPmuIrq3),
+      FixedPcdGet64 (PcdGicInterruptInterfaceBase), FixedPcdGet64 (PcdGicInterruptInterfaceVBase),
+      FixedPcdGet64 (PcdGicInterruptInterfaceHBase), FixedPcdGet32 (PcdGicGsivId), 0),
   },
 #if (RPI_MODEL != 3)
   EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBase), 0)
diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 7fb9a41f3d9a..1651def87ce1 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -403,6 +403,15 @@ [PcdsFixedAtBuild.common]
   gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedMHz|1200
   gRaspberryPiTokenSpaceGuid.PcdCpuMaxSpeedMHz|1500
 
+  #
+  # ARM General Interrupt Controller
+  #
+  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x40000000
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x09
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x09
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x09
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x09
+
   ## Default Terminal Type
   ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index 1abb010469f5..4fe4d810a0bc 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -431,6 +431,13 @@ [PcdsFixedAtBuild.common]
   #
   gArmTokenSpaceGuid.PcdGicDistributorBase|0xFF841000
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0xFF842000
+  gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase|0xFF844000
+  gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase|0xFF846000
+  gRaspberryPiTokenSpaceGuid.PcdGicGsivId|0x19
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x30
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x31
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x32
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x33
 
   #
   # Fixed CPU settings.
diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
index dc37541f3732..d59b548185e3 100644
--- a/Platform/RaspberryPi/RaspberryPi.dec
+++ b/Platform/RaspberryPi/RaspberryPi.dec
@@ -47,6 +47,13 @@ [PcdsFixedAtBuild.common]
   gRaspberryPiTokenSpaceGuid.PcdCpuLowSpeedMHz|600|UINT32|0x0000000a
   gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedMHz|800|UINT32|0x0000000b
   gRaspberryPiTokenSpaceGuid.PcdCpuMaxSpeedMHz|1000|UINT32|0x0000000c
+  gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase|0x0|UINT64|0x00000030
+  gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase|0x0|UINT64|0x00000031
+  gRaspberryPiTokenSpaceGuid.PcdGicGsivId|0x0|UINT32|0x00000032
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x0|UINT32|0x00000033
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x0|UINT32|0x00000034
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x0|UINT32|0x00000035
+  gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x0|UINT32|0x00000036
 
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   gRaspberryPiTokenSpaceGuid.PcdCpuClock|0|UINT32|0x0000000d
-- 
2.21.0.windows.1


  parent reply	other threads:[~2020-03-26 11:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 11:53 [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 1/6] Platform/RPi/AcpiTables: Fix Pi 4 interrupts values Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 2/6] Platform/RPi/AcpiTables: Replace VendorLong () blobs with PinFunction () Pete Batard
2020-03-26 11:53 ` Pete Batard [this message]
2020-03-26 11:53 ` [edk2-platforms][PATCH 4/6] Platform/RPi/AcpiTables: Clean up ACPI IDs Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 5/6] Platform/RPi/AcpiTables: Move GPU devices into a separate ASL file Pete Batard
2020-03-26 11:53 ` [edk2-platforms][PATCH 6/6] Platform/RPi/AcpiTables: Describe DMA constraints for devices behind GPU Pete Batard
2020-03-26 14:06 ` [edk2-platforms][PATCH 0/6] Platforms/RPi/AcpiTables: ACPI platform improvements 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=20200326115322.2880-4-pete@akeo.ie \
    --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