SGI platforms include a second DRAM block of 6GB starting at 0x8080000000. Add support to allow access to this block of DRAM.
Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> Cc: Leif Lindholm <leif.lindh...@linaro.org> Signed-off-by: Thomas Abraham <thomas.abra...@arm.com> --- .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf | 4 ++++ .../SgiPkg/Library/PlatformLib/PlatformLibMem.c | 24 +++++++++++++++++++++- Platform/ARM/SgiPkg/SgiPlatform.dec | 4 ++++ Platform/ARM/SgiPkg/SgiPlatform.dsc | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf index 5d4bf72..93377fa 100644 --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf @@ -44,6 +44,10 @@ [FixedPcd] gArmPlatformTokenSpaceGuid.PcdClusterCount gArmPlatformTokenSpaceGuid.PcdCoreCount + + gArmSgiTokenSpaceGuid.PcdDramBlock2Base + gArmSgiTokenSpaceGuid.PcdDramBlock2Size + gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize gArmTokenSpaceGuid.PcdGicDistributorBase diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c index 03c206b..3314a26 100644 --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c @@ -22,7 +22,7 @@ #include <SgiPlatform.h> // Total number of descriptors, including the final "end-of-table" descriptor. -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 10 +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 11 /** Returns the Virtual Memory Map of the platform. @@ -41,6 +41,22 @@ ArmPlatformGetVirtualMemoryMap ( { UINTN Index; ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; + + ResourceAttributes = + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_TESTED; + + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + ResourceAttributes, + FixedPcdGet64 (PcdDramBlock2Base), + FixedPcdGet64 (PcdDramBlock2Size)); ASSERT (VirtualMemoryMap != NULL); Index = 0; @@ -100,6 +116,12 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length = PcdGet64 (PcdSystemMemorySize); VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; + // DDR - Second Block + VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdDramBlock2Base); + VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdDramBlock2Base); + VirtualMemoryTable[Index].Length = PcdGet64 (PcdDramBlock2Size); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; + // PCI Configuration Space VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPciExpressBaseAddress); VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdPciExpressBaseAddress); diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec index 2f6ebcc..2fcc13e 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dec +++ b/Platform/ARM/SgiPkg/SgiPlatform.dec @@ -38,5 +38,9 @@ # Set this PCD to TRUE to enable virtio support. gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE|BOOLEAN|0x00000001 +[PcdsFixedAtBuild] + gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002 + gArmSgiTokenSpaceGuid.PcdDramBlock2Size|0|UINT64|0x00000003 + [Ppis] gHwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } } diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.dsc index 7b8e051..55fdbce 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc @@ -103,6 +103,10 @@ [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdVFPEnabled|1 + # DRAM Block2 Base and Size + gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0x8080000000 + gArmSgiTokenSpaceGuid.PcdDramBlock2Size|0x180000000 + # NV Storage PCDs. Use base of 0x08000000 for NOR0, 0xC0000000 for NOR 1 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0C000000 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x01400000 -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel