[edk2-devel] [edk2-platforms][PATCH V2 6/6] Platform/Sgi: add SMMU and timer entries to memory description table

Sami Mujawar sami.mujawar at arm.com
Mon Apr 12 11:21:59 UTC 2021


Hi Pranav,

Can you sort the PCDs in alphabetical order in the inf, dec and dsc.inc, please?
With that changed.

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

Regards,

Sami Mujawar

On 01/04/2021, 06:36, "Pranav Madhu" <pranav.madhu at arm.com> wrote:

    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 at 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
[SAMI] Please sort PCDs in alphabetical order in inf, dec, and dsc.inc.
[/SAMI]
       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




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73949): https://edk2.groups.io/g/devel/message/73949
Mute This Topic: https://groups.io/mt/81769421/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list