From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=thomas.abraham@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 8DD71210C0F67 for ; Mon, 23 Jul 2018 08:48:55 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 24CC680D; Mon, 23 Jul 2018 08:48:55 -0700 (PDT) Received: from usa.arm.com (a74716-lin.blr.arm.com [10.162.4.145]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CDFD43F237; Mon, 23 Jul 2018 08:48:53 -0700 (PDT) From: Thomas Abraham To: edk2-devel@lists.01.org Date: Mon, 23 Jul 2018 21:18:40 +0530 Message-Id: <1532360922-9556-3-git-send-email-thomas.abraham@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532360922-9556-1-git-send-email-thomas.abraham@arm.com> References: <1532360922-9556-1-git-send-email-thomas.abraham@arm.com> Subject: [PATCH edk2-platforms 2/4] Platform/ARM/Sgi: allow access the second DRAM block X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2018 15:48:55 -0000 SGI platforms include a second DRAM block of 6GB starting at 0x8080000000. Add support to allow access to this block of DRAM. Change-Id: If1817fd20ce4ce12d3577f78b01c35b410c516a5 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Thomas Abraham --- .../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 // 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