From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.3612.1617255362189233330 for ; Wed, 31 Mar 2021 22:36:02 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pranav.madhu@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DC320D6E; Wed, 31 Mar 2021 22:36:01 -0700 (PDT) Received: from usa.arm.com (a074742.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7A1623F694; Wed, 31 Mar 2021 22:36:00 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar 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 Message-Id: <20210401053543.17308-7-pranav.madhu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210401053543.17308-1-pranav.madhu@arm.com> References: <20210401053543.17308-1-pranav.madhu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- 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/Sg= iPlatform.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 =20 - # 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 =20 + # SMMU + gArmSgiTokenSpaceGuid.PcdSmmuBase|0|UINT32|0x0000001D + gArmSgiTokenSpaceGuid.PcdSmmuSize|0|UINT32|0x0000001E + [Ppis] gNtFwConfigDtInfoPpiGuid =3D { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8,= 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } } diff --git a/Platform/ARM/SgiPkg/SgiMemoryMap.dsc.inc b/Platform/ARM/SgiP= kg/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/Sgi= Pkg/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/SgiPk= g/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 =20 + # 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/Pl= atform/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 @@ =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 =20 gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/Sgi= Pkg/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 =20 -// 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/P= latform/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 @@ =20 // Total number of descriptors, including the final "end-of-table" descr= iptor. #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS \ - (10 + (FixedPcdGet32 (PcdChipCount) * 2)) + (14 + (FixedPcdGet32 (PcdChipCount) * 2)) =20 /** Returns the Virtual Memory Map of the platform. @@ -124,9 +124,9 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; =20 // Sub System Peripherals - Generic Watchdog - VirtualMemoryTable[++Index].PhysicalBase =3D SGI_SUBSYS_GENERIC_WDOG_= BASE; - VirtualMemoryTable[Index].VirtualBase =3D SGI_SUBSYS_GENERIC_WDOG_= BASE; - VirtualMemoryTable[Index].Length =3D SGI_SUBSYS_GENERIC_WDOG_= SZ; + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet32 (PcdWdogBa= se); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet32 (PcdWdogBa= se); + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdWdogSi= ze); VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; =20 // Sub System Peripherals - GIC-600 @@ -135,6 +135,30 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length =3D FixedPcdGet64(PcdGicSize= ); VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; =20 + // Sub System Peripherals - Counter + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet32 (PcdTimerC= ounterReadBase); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet32 (PcdTimerC= ounterReadBase); + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdTimerC= ounterReadSize); + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; + + // Sub System Peripherals - Timer Control + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet32 (PcdTimerC= ontrolBase); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet32 (PcdTimerC= ontrolBase); + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdTimerC= ontrolSize); + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; + + // Sub System Peripherals - Timer Base0 + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet32 (PcdTimerB= ase0Base); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet32 (PcdTimerB= ase0Base); + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdTimerB= ase0Size); + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; + + // Sub System Peripherals - SMMU + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet32 (PcdSmmuBa= se); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet32 (PcdSmmuBa= se); + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdSmmuSi= ze); + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; + // Expansion AXI - Platform Peripherals - HDLCD1 VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet32 (PcdArmHdL= cdBase); VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet32 (PcdArmHdL= cdBase); --=20 2.17.1