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>,
	Leif Lindholm <leif@nuviainc.com>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [edk2-platforms][PATCH V2 6/6] Platform/Sgi: add SMMU and timer entries to memory description table
Date: Thu,  1 Apr 2021 11:05:43 +0530	[thread overview]
Message-ID: <20210401053543.17308-7-pranav.madhu@arm.com> (raw)
In-Reply-To: <20210401053543.17308-1-pranav.madhu@arm.com>

Add PCDs for base address and address space size for generic timer and
SMMU controllers. Use those PCDs to add platform memory map entries. The
ServerReady SBSA tests, when executed, accesses these controllers and so
the memory mapping for generic timer and SMMU controllers are required.

In addition to this, PCDs for watchdog timer controller base address and
size are introduced instead of using macros for the same. This allows
the base address and address space size for watchdog timer controller to
be specified by platform description files.

Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
---
 Platform/ARM/SgiPkg/SgiPlatform.dec                      | 14 ++++++++-
 Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc                 |  4 +++
 Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc                |  4 +++
 Platform/ARM/SgiPkg/SgiPlatform.dsc.inc                  | 10 ++++++
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf  | 11 +++++++
 Platform/ARM/SgiPkg/Include/SgiPlatform.h                |  4 ---
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c | 32 +++++++++++++++++---
 7 files changed, 70 insertions(+), 9 deletions(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 86ead241a67c..5c10c6f1635c 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -57,11 +57,23 @@
   gArmSgiTokenSpaceGuid.PcdSysPeriphBase|0x00000000|UINT64|0x0000000E
   gArmSgiTokenSpaceGuid.PcdSysPeriphSysRegBase|0x0|UINT64|0x0000000F
 
-  # Timer & Watchdog interrupts
+  # Counter, Timer and Watchdog
+  gArmSgiTokenSpaceGuid.PcdTimerCounterReadBase|0|UINT32|0x00000015
+  gArmSgiTokenSpaceGuid.PcdTimerCounterReadSize|0|UINT32|0x00000016
   gArmSgiTokenSpaceGuid.PcdGtFrame0Gsiv|0|UINT32|0x00000011
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv|0|UINT32|0x00000012
+  gArmSgiTokenSpaceGuid.PcdTimerBase0Base|0|UINT32|0x00000017
+  gArmSgiTokenSpaceGuid.PcdTimerBase0Size|0|UINT32|0x00000018
+  gArmSgiTokenSpaceGuid.PcdTimerControlBase|0|UINT32|0x00000019
+  gArmSgiTokenSpaceGuid.PcdTimerControlSize|0|UINT32|0x0000001A
+  gArmSgiTokenSpaceGuid.PcdWdogBase|0|UINT32|0x0000001B
+  gArmSgiTokenSpaceGuid.PcdWdogSize|0|UINT32|0x0000001C
   gArmSgiTokenSpaceGuid.PcdWdogWS0Gsiv|0|UINT32|0x00000013
   gArmSgiTokenSpaceGuid.PcdWdogWS1Gsiv|0|UINT32|0x00000014
 
+  # SMMU
+  gArmSgiTokenSpaceGuid.PcdSmmuBase|0|UINT32|0x0000001D
+  gArmSgiTokenSpaceGuid.PcdSmmuSize|0|UINT32|0x0000001E
+
 [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 efbb013b0b60..d3d650323891 100644
--- a/Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc
@@ -50,3 +50,7 @@
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv|91
   gArmSgiTokenSpaceGuid.PcdWdogWS0Gsiv|93
   gArmSgiTokenSpaceGuid.PcdWdogWS1Gsiv|94
+
+  # SMMU
+  gArmSgiTokenSpaceGuid.PcdSmmuBase|0x4F000000
+  gArmSgiTokenSpaceGuid.PcdSmmuSize|0x01000000
diff --git a/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc b/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc
index 1167f1a6ff9d..c593156e17be 100644
--- a/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiMemoryMap2.dsc.inc
@@ -50,3 +50,7 @@
   gArmSgiTokenSpaceGuid.PcdGtFrame1Gsiv|108
   gArmSgiTokenSpaceGuid.PcdWdogWS0Gsiv|110
   gArmSgiTokenSpaceGuid.PcdWdogWS1Gsiv|111
+
+  # SMMU
+  gArmSgiTokenSpaceGuid.PcdSmmuBase|0x40000000
+  gArmSgiTokenSpaceGuid.PcdSmmuSize|0x10000000
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
index 12a8f8884c89..e59a399690c1 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
@@ -152,6 +152,16 @@
   # Ethernet / Virtio Network
   gArmSgiTokenSpaceGuid.PcdVirtioNetSize|0x10000
 
+  # Counter, Timer and Watchdog
+  gArmSgiTokenSpaceGuid.PcdTimerCounterReadBase|0x2A800000
+  gArmSgiTokenSpaceGuid.PcdTimerCounterReadSize|0x00010000
+  gArmSgiTokenSpaceGuid.PcdTimerBase0Base|0x2A830000
+  gArmSgiTokenSpaceGuid.PcdTimerBase0Size|0x00010000
+  gArmSgiTokenSpaceGuid.PcdTimerControlBase|0x2A810000
+  gArmSgiTokenSpaceGuid.PcdTimerControlSize|0x00010000
+  gArmSgiTokenSpaceGuid.PcdWdogBase|0x2A440000
+  gArmSgiTokenSpaceGuid.PcdWdogSize|0x00020000
+
   #
   # Set the base address and size of the buffer used
   # for communication between the Normal world edk2
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
index 333247d0d808..f8e517f9efed 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
@@ -64,9 +64,20 @@
 
   gArmTokenSpaceGuid.PcdMmBufferBase
   gArmTokenSpaceGuid.PcdMmBufferSize
+
+  gArmSgiTokenSpaceGuid.PcdTimerCounterReadBase
+  gArmSgiTokenSpaceGuid.PcdTimerCounterReadSize
   gArmSgiTokenSpaceGuid.PcdSmcCs0Base
   gArmSgiTokenSpaceGuid.PcdSmcCs1Base
+  gArmSgiTokenSpaceGuid.PcdSmmuBase
+  gArmSgiTokenSpaceGuid.PcdSmmuSize
   gArmSgiTokenSpaceGuid.PcdSysPeriphBase
+  gArmSgiTokenSpaceGuid.PcdTimerBase0Base
+  gArmSgiTokenSpaceGuid.PcdTimerBase0Size
+  gArmSgiTokenSpaceGuid.PcdTimerControlBase
+  gArmSgiTokenSpaceGuid.PcdTimerControlSize
+  gArmSgiTokenSpaceGuid.PcdWdogBase
+  gArmSgiTokenSpaceGuid.PcdWdogSize
 
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index d6ab585cce80..818879b5f81e 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -21,10 +21,6 @@
 #define SGI_SUBSYS_UART1_BASE                     0x2A410000
 #define SGI_SUBSYS_UART1_SZ                       0x00010000
 
-// Sub System Peripherals - Generic Watchdog
-#define SGI_SUBSYS_GENERIC_WDOG_BASE              0x2A440000
-#define SGI_SUBSYS_GENERIC_WDOG_SZ                SIZE_128KB
-
 // Register offsets into the System Registers Block
 #define SGI_SYSPH_SYS_REG_FLASH                   0x4C
 #define SGI_SYSPH_SYS_REG_FLASH_RWEN              0x1
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
index 9bdc63b9e3d4..8139b75d8ee4 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
@@ -17,7 +17,7 @@
 
 // Total number of descriptors, including the final "end-of-table" descriptor.
 #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS                 \
-          (10 + (FixedPcdGet32 (PcdChipCount) * 2))
+          (14 + (FixedPcdGet32 (PcdChipCount) * 2))
 
 /**
   Returns the Virtual Memory Map of the platform.
@@ -124,9 +124,9 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
 
   // Sub System Peripherals - Generic Watchdog
-  VirtualMemoryTable[++Index].PhysicalBase  = SGI_SUBSYS_GENERIC_WDOG_BASE;
-  VirtualMemoryTable[Index].VirtualBase     = SGI_SUBSYS_GENERIC_WDOG_BASE;
-  VirtualMemoryTable[Index].Length          = SGI_SUBSYS_GENERIC_WDOG_SZ;
+  VirtualMemoryTable[++Index].PhysicalBase  = FixedPcdGet32 (PcdWdogBase);
+  VirtualMemoryTable[Index].VirtualBase     = FixedPcdGet32 (PcdWdogBase);
+  VirtualMemoryTable[Index].Length          = FixedPcdGet32 (PcdWdogSize);
   VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
 
   // Sub System Peripherals - GIC-600
@@ -135,6 +135,30 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Length          = FixedPcdGet64(PcdGicSize);
   VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
 
+  // Sub System Peripherals - Counter
+  VirtualMemoryTable[++Index].PhysicalBase  = FixedPcdGet32 (PcdTimerCounterReadBase);
+  VirtualMemoryTable[Index].VirtualBase     = FixedPcdGet32 (PcdTimerCounterReadBase);
+  VirtualMemoryTable[Index].Length          = FixedPcdGet32 (PcdTimerCounterReadSize);
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+  // Sub System Peripherals - Timer Control
+  VirtualMemoryTable[++Index].PhysicalBase  = FixedPcdGet32 (PcdTimerControlBase);
+  VirtualMemoryTable[Index].VirtualBase     = FixedPcdGet32 (PcdTimerControlBase);
+  VirtualMemoryTable[Index].Length          = FixedPcdGet32 (PcdTimerControlSize);
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+  // Sub System Peripherals - Timer Base0
+  VirtualMemoryTable[++Index].PhysicalBase  = FixedPcdGet32 (PcdTimerBase0Base);
+  VirtualMemoryTable[Index].VirtualBase     = FixedPcdGet32 (PcdTimerBase0Base);
+  VirtualMemoryTable[Index].Length          = FixedPcdGet32 (PcdTimerBase0Size);
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+  // Sub System Peripherals - SMMU
+  VirtualMemoryTable[++Index].PhysicalBase  = FixedPcdGet32 (PcdSmmuBase);
+  VirtualMemoryTable[Index].VirtualBase     = FixedPcdGet32 (PcdSmmuBase);
+  VirtualMemoryTable[Index].Length          = FixedPcdGet32 (PcdSmmuSize);
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
   // Expansion AXI - Platform Peripherals - HDLCD1
   VirtualMemoryTable[++Index].PhysicalBase  = FixedPcdGet32 (PcdArmHdLcdBase);
   VirtualMemoryTable[Index].VirtualBase     = FixedPcdGet32 (PcdArmHdLcdBase);
-- 
2.17.1


  parent reply	other threads:[~2021-04-01  5:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  5:35 [edk2-platforms][PATCH V2 0/6] Platform/Sgi: improvements in RD platform support Pranav Madhu
2021-04-01  5:35 ` [edk2-platforms][PATCH V2 1/6] Platform/Sgi: include SSDT table for RD-V1 platform Pranav Madhu
2021-04-01  5:35 ` [edk2-platforms][PATCH V2 2/6] Platform/Sgi: fix the list of CPU devices on RD-V1-MC platform Pranav Madhu
2021-04-12 11:21   ` Sami Mujawar
2021-04-01  5:35 ` [edk2-platforms][PATCH V2 3/6] Platform/Sgi: fix CPU acpi-id for " Pranav Madhu
2021-04-12 11:21   ` Sami Mujawar
2021-04-01  5:35 ` [edk2-platforms][PATCH V2 4/6] Platform/Sgi: update ACPI table revision Pranav Madhu
2021-04-01  5:35 ` [edk2-platforms][PATCH V2 5/6] Platform/Sgi: define PCD for timer interrupt numbers Pranav Madhu
2021-04-12 11:21   ` Sami Mujawar
2021-04-01  5:35 ` Pranav Madhu [this message]
2021-04-12 11:21   ` [edk2-platforms][PATCH V2 6/6] Platform/Sgi: add SMMU and timer entries to memory description table 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=20210401053543.17308-7-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