public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pranav Madhu" <pranav.madhu@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [edk2-platforms][PATCH v2 2/5] Platform/Sgi: Add GED support
Date: Fri, 11 Jun 2021 16:04:18 +0530	[thread overview]
Message-ID: <20210611103421.32518-3-pranav.madhu@arm.com> (raw)
In-Reply-To: <20210611103421.32518-1-pranav.madhu@arm.com>

Add ACPI Generic Event Device (GED) support for Arm's reference design
platforms. The SP804 dual-timer interrupt is used as the event source
for GED.

Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
---
 Platform/ARM/SgiPkg/SgiPlatform.dec                     |  5 ++
 Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc                |  5 ++
 Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc               |  5 ++
 Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf   |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf   |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/RdN2AcpiTables.inf       |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf   |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/RdV1AcpiTables.inf       |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/RdV1McAcpiTables.inf     |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf     |  3 ++
 Platform/ARM/SgiPkg/AcpiTables/SsdtEvents.asl           | 49 ++++++++++++++++++++
 12 files changed, 88 insertions(+)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
index e0aabc566d88..ffbbb24f1c33 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -81,5 +81,10 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Size|0|UINT32|0x00000020
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt|0|UINT32|0x00000021
 
+  # SP804 Dual Timer
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress|0|UINT32|0x00000022
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize|0|UINT32|0x00000023
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt|0|UINT32|0x00000024
+
 [Ppis]
   gNtFwConfigDtInfoPpiGuid     = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
diff --git a/Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc b/Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc
index a567af8537ec..76707be73d7b 100644
--- a/Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc
@@ -51,6 +51,11 @@
   gArmSgiTokenSpaceGuid.PcdWdogWS0Gsiv|93
   gArmSgiTokenSpaceGuid.PcdWdogWS1Gsiv|94
 
+  # SP804 dual timer
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress|0x1C110000
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize|0x00010000
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt|230
+
   # SMMU
   gArmSgiTokenSpaceGuid.PcdSmmuBase|0x4F000000
   gArmSgiTokenSpaceGuid.PcdSmmuSize|0x01000000
diff --git a/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc b/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc
index 5c137c0991e7..2d612f9b9674 100644
--- a/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc
@@ -51,6 +51,11 @@
   gArmSgiTokenSpaceGuid.PcdWdogWS0Gsiv|110
   gArmSgiTokenSpaceGuid.PcdWdogWS1Gsiv|111
 
+  # SP804 dual timer
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress|0x0C110000
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize|0x00010000
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt|486
+
   # SMMU
   gArmSgiTokenSpaceGuid.PcdSmmuBase|0x40000000
   gArmSgiTokenSpaceGuid.PcdSmmuSize|0x10000000
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
index 56b80f418398..8c34c2fa73e4 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
@@ -57,6 +57,9 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
index fa6692bc86f6..8d46b001444c 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
@@ -57,6 +57,9 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
index d0ee125fa1de..473c9eff0f55 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
@@ -66,6 +66,9 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN2AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdN2AcpiTables.inf
index 232b58eb012f..c537db45e08f 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN2AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN2AcpiTables.inf
@@ -57,6 +57,9 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf
index 5713ef1ce3a9..6bbc3fc230ae 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1AcpiTables.inf
@@ -58,6 +58,9 @@
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
   gArmSgiTokenSpaceGuid.PcdSmmuBase
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdV1AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdV1AcpiTables.inf
index e7b702962abe..d461cbe54c68 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdV1AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdV1AcpiTables.inf
@@ -57,6 +57,9 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdV1McAcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdV1McAcpiTables.inf
index 901391fba70e..3b699b0acbb8 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdV1McAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdV1McAcpiTables.inf
@@ -66,6 +66,9 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
index d59aefde735b..3ee66b1dfd5a 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
@@ -57,6 +57,9 @@
   gArmSgiTokenSpaceGuid.PcdGpioController0Interrupt
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerBaseAddress
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerSize
+  gArmSgiTokenSpaceGuid.PcdSp804DualTimerInterrupt
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SsdtEvents.asl b/Platform/ARM/SgiPkg/AcpiTables/SsdtEvents.asl
index 28c7ce4e7f3c..58efe62c93ea 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SsdtEvents.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SsdtEvents.asl
@@ -9,12 +9,20 @@
   Interrupt is received by OSPM and that GPIO Interrupt Connection is listed in
   a GPIO controller device’s _AEI object.
 
+  Interrupt Signalled ACPI event is another method of signalling events in
+  HW-Reduced ACPI model. In this method, ACPI event is generated when an
+  interrupt is received by the OSPM which is listed in the Generic Event Device
+  (GED) _CRS object.
+
   Copyright (c) 2021, ARM Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Specification Reference:
     - ACPI 6.4, Chapter 5.6.5, GPIO-signaled ACPI Events
     - Arm Base Boot Requirements 1.0, Issue F, Chapter 8.5.3, GPIO controllers
+    - ACPI 6.4, Chapter 5.6.9, Interrupt-signaled ACPI events
+    - Arm Base Boot Requirements 1.0, Issue F, Chapter 8.5.4 Generic Event
+      Devices
 **/
 
 #include "SgiAcpiHeader.h"
@@ -64,4 +72,45 @@ DefinitionBlock("SsdtEvent.aml", "SSDT", 2, "ARMLTD", "ARMSGI", EFI_ACPI_ARM_OEM
       INC0, 8
     }
   }
+
+  /* ACPI GED object Template. Arm's reference design platforms include a SP804
+     dual timer which is implemented as part of the RoS sub-system. The SP804
+     interrupt is used in GED as interrupt source. */
+  Device (\_SB.GED0) {
+    Name (_HID, "ACPI0013")
+    Name (_UID, 0)
+
+    /* Resource setting for GED */
+    Name (_CRS, ResourceTemplate () {
+      Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+        FixedPcdGet32 (PcdSp804DualTimerInterrupt)
+      }
+    })
+
+    Method (_STA, 0x0, NotSerialized) {
+      return (0xF);
+    }
+
+    /* Register map for interrupt clear register */
+    OperationRegion (
+      DTIM,
+      SystemMemory,
+      FixedPcdGet32 (PcdSp804DualTimerBaseAddress),
+      FixedPcdGet32 (PcdSp804DualTimerSize))
+    Field (DTIM, DWordAcc, NoLock, Preserve) {
+      Offset (0x0C),
+      T1IC, 32,       /* 0x0C Timer 1 Interrupt clear */
+    }
+
+    /* GED event handler */
+    Method (_EVT, 1, Serialized) {
+      switch (ToInteger (Arg0))
+      {
+        case (FixedPcdGet32 (PcdSp804DualTimerInterrupt)) {
+          Store (0x01, T1IC)
+        }
+      }
+    }
+  } /* Device (\_SB.GED0) */
+
 }
-- 
2.17.1


  parent reply	other threads:[~2021-06-11 10:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 10:34 [edk2-platforms][PATCH v2 0/5] Platform/Sgi: Miscellaneous updates Pranav Madhu
2021-06-11 10:34 ` [edk2-platforms][PATCH v2 1/5] Platform/Sgi: Enable PrimeCell GPIO Pranav Madhu
2021-06-14 10:33   ` [edk2-devel] " Thomas Abraham
2021-06-11 10:34 ` Pranav Madhu [this message]
2021-06-14 10:35   ` [edk2-devel] [edk2-platforms][PATCH v2 2/5] Platform/Sgi: Add GED support Thomas Abraham
2021-06-11 10:34 ` [edk2-platforms][PATCH v2 3/5] Platform/Sgi: define the macro ENABLE_GOP Pranav Madhu
2021-06-11 10:34 ` [edk2-platforms][PATCH v2 4/5] Platform/Sgi: update _OSC control method to control LPI and CPPC Pranav Madhu
2021-06-14 10:37   ` [edk2-devel] " Thomas Abraham
2021-06-11 10:34 ` [edk2-platforms][PATCH v2 5/5] Platform/Sgi: Cleanup build options for StandaloneMM context Pranav Madhu
2021-06-14 10:38   ` [edk2-devel] " Thomas Abraham
2021-07-05 14:34 ` [edk2-devel] [edk2-platforms][PATCH v2 0/5] Platform/Sgi: Miscellaneous updates Sami Mujawar
2021-07-05 15:35   ` 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=20210611103421.32518-3-pranav.madhu@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