public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Girish Pathak <girish.pathak@arm.com>
To: edk2-devel@lists.01.org
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com, Stephanie.Hughes-Fitt@arm.com,
	nd@arm.com, Arvind.Chauhan@arm.com, Daniil.Egranov@arm.com,
	thomas.abraham@arm.com
Subject: [PATCH edk2-platforms v4 13/17] ARM/VExpressPkg: Reserving framebuffer at build
Date: Thu,  5 Apr 2018 19:07:59 +0100	[thread overview]
Message-ID: <20180405180803.33684-14-girish.pathak@arm.com> (raw)
In-Reply-To: <20180405180803.33684-1-girish.pathak@arm.com>

From: Girish Pathak <girish.pathak at arm.com>

This change uses two PCDs, PcdArmLcdFrameBufferBase and
PcdArmLcdFrameBufferSize introduced in correspondiong EDK2 patch to
reserve framebuffer in DRAM if these values are defined in platform
specific DSC file, avoiding the need to allocate dynamically.
This allows the framebuffer to appear as "I/O memory" outside of the
normal RAM map, which is similar to the "VRAM" case.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
---

Notes:
    v3:
    - Move PcdArmLcdDdrFrameBufferBase and
      PcdArmLcdDdrFrameBufferSize to VExpressPkg.                 [Ard]
    
      These PCDs are also used for the Juno platform hence these
      PCDs are defined for the ArmPlatformPkg so that both
      platform can use it.                                        [Girish]
    
    - Could you please add an ASSERT() so that System Memory
      and PcdArmLcdDdrFrameBufferBase do not overlap              [Ard]
    
      Done                                                        [Girish]

 Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf |  4 +-
 Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c          | 41 ++++++++++++++------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
index 8c6291c42f8a599591d00d7afcb2ff3399417034..b025abd98b5e654323b7821ac353ad920e2e6421 100644
--- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
+++ b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
@@ -1,5 +1,5 @@
 #/* @file
-#  Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+#  Copyright (c) 2011-2018, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -54,6 +54,8 @@ [FixedPcd]
   gArmTokenSpaceGuid.PcdArmPrimaryCore
 
   gArmPlatformTokenSpaceGuid.PcdCoreCount
+  gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase
+  gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferSize
 
 [Ppis]
   gArmMpCoreInfoPpiGuid
diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c
index 9fb0803d31ad0dbab59875bae99fd8a381d484b7..1d5fefc21726ba1b05d90e0e47677575d7fa2034 100644
--- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c
+++ b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2011-2016, ARM Limited. All rights reserved.
+*  Copyright (c) 2011-2018, ARM Limited. All rights reserved.
 *
 *  This program and the accompanying materials
 *  are licensed and made available under the terms and conditions of the BSD License
@@ -128,17 +128,34 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Length = 2 * ARM_VE_SMB_PERIPH_SZ;
   VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
 
-  // VRAM
-  VirtualMemoryTable[++Index].PhysicalBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE;
-  VirtualMemoryTable[Index].VirtualBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE;
-  VirtualMemoryTable[Index].Length = PL111_CLCD_VRAM_MOTHERBOARD_SIZE;
-  //
-  // Map the VRAM region as Normal Non-Cacheable memory and not device memory,
-  // so that we can use the accelerated string routines that may use unaligned
-  // accesses or DC ZVA instructions. The enum identifier is slightly awkward
-  // here, but it maps to a memory type that allows buffering and reordering.
-  //
-  VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED;
+  // Map region for the framebuffer in the system RAM if no VRAM present
+  if (FixedPcdGet32 (PcdArmLcdDdrFrameBufferBase) == 0) {
+    // VRAM
+    VirtualMemoryTable[++Index].PhysicalBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE;
+    VirtualMemoryTable[Index].VirtualBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE;
+    VirtualMemoryTable[Index].Length = PL111_CLCD_VRAM_MOTHERBOARD_SIZE;
+    //
+    // Map the VRAM region as Normal Non-Cacheable memory and not device memory,
+    // so that we can use the accelerated string routines that may use unaligned
+    // accesses or DC ZVA instructions. The enum identifier is slightly awkward
+    // here, but it maps to a memory type that allows buffering and reordering.
+    //
+    VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED;
+
+  } else {
+    ASSERT ((ARM_VE_DRAM_BASE + ARM_VE_DRAM_SZ - 1) <
+            FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase));
+    VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase);
+    VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase);
+    VirtualMemoryTable[Index].Length = FixedPcdGet32 (PcdArmLcdDdrFrameBufferSize);
+    // Map as Normal Non-Cacheable memory, so that we can use the accelerated
+    // SetMem/CopyMem routines that may use unaligned accesses or
+    // DC ZVA instructions. If mapped as device memory, these routine may cause
+    // alignment faults.
+    // NOTE: The attribute value is misleading, it indicates memory map type as
+    // an un-cached, un-buffered but allows buffering and reordering.
+    VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED;
+  }
 
   // Map sparse memory region if present
   if (HasSparseMemory) {
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




  parent reply	other threads:[~2018-04-05 18:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 18:07 [PATCH edk2-platforms v4 00/17] Update GOP Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 01/17] ARM/VExpressPkg: Fix MODULE_TYPE of HDLCD/PL111 platform libraries Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 02/17] ARM/VExpressPkg: Tidy HDLCD and PL11LCD platform Lib: Coding standard Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 03/17] ARM/VExpressPkg: Tidy HdLcd/PL111Lcd code: Updated comments Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 04/17] ARM/VExpressPkg: Remove unused PcdPL111LcdMaxMode from HDLCD inf Girish Pathak
2018-04-23 17:03   ` Leif Lindholm
2018-04-23 17:07     ` Girish Pathak
2018-04-23 17:10       ` Leif Lindholm
2018-04-05 18:07 ` [PATCH edk2-platforms v4 05/17] ARM/VExpressPkg: Add and update debug ASSERTS Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 06/17] ARM/VExpressPkg: PL111Lcd/HdLcd plaform libs: Minor code cleanup Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 07/17] ARM/VExpressPkg: PL111 and HDLCD: Use FixedPcdGet32 Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 08/17] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove status check EFI_TIMEOUT Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 09/17] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove redundant Bpp Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 10/17] ARM/VExpressPkg: Redefine LcdPlatformGetTimings function Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 11/17] ARM/VExpressPkg: PL111 and HDLCD: Add PCD to select pixel format Girish Pathak
2018-04-05 18:07 ` [PATCH edk2-platforms v4 12/17] ARM/VExpressPkg: Allocate framebuffer using EfiReservedMemoryType Girish Pathak
2018-04-05 18:07 ` Girish Pathak [this message]
2018-04-05 18:08 ` [PATCH edk2-platforms v4 14/17] ARM/VExpressPkg: Set EFI_MEMORY_XP flag on GOP framebuffer Girish Pathak
2018-04-05 18:08 ` [PATCH edk2-platforms v4 15/17] ARM/VExpressPkg: New DP500/DP550/DP650 platform library Girish Pathak
2018-04-05 18:08 ` [PATCH edk2-platforms v4 16/17] ARM/JunoPkg: Adding SCMI MTL library Girish Pathak
2018-04-05 18:08 ` [PATCH edk2-platforms v4 17/17] ARM/JunoPkg: Add HDLCD platform library Girish Pathak
2018-04-23 13:00 ` [PATCH edk2-platforms v4 00/17] Update GOP Leif Lindholm

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=20180405180803.33684-14-girish.pathak@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