public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Thomas Abraham <thomas.abraham@arm.com>
To: edk2-devel@lists.01.org
Subject: [PATCH edk2-platforms 2/4] Platform/ARM/Sgi: allow access the second DRAM block
Date: Mon, 23 Jul 2018 21:18:40 +0530	[thread overview]
Message-ID: <1532360922-9556-3-git-send-email-thomas.abraham@arm.com> (raw)
In-Reply-To: <1532360922-9556-1-git-send-email-thomas.abraham@arm.com>

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 <thomas.abraham@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



  parent reply	other threads:[~2018-07-23 15:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 15:48 [PATCH edk2-platforms 0/4] Platform/Arm/Sgi: minor platform support updates Thomas Abraham
2018-07-23 15:48 ` [PATCH edk2-platforms 1/4] Platform/ARM/Sgi: Increase the size of flash image Thomas Abraham
2018-07-23 15:48 ` Thomas Abraham [this message]
2018-07-23 15:48 ` [PATCH edk2-platforms 3/4] Platform/ARM/Sgi: Add ACPI description of virtio block device Thomas Abraham
2018-07-23 15:48 ` [PATCH edk2-platforms 4/4] Platform/ARM/Sgi: Allow use of default fifo size for PL011 controller Thomas Abraham

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=1532360922-9556-3-git-send-email-thomas.abraham@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