From bbfcc268721213c805078517cf553ec1d2d2f774 Mon Sep 17 00:00:00 2001
From: Joakim Bech <joakim.bech@linaro.org>
Date: Wed, 16 Jan 2019 22:48:43 +0100
Subject: [PATCH] rpi3: Set RPI3_PRELOADED_DTB_BASE for TF-A

In TF-A in the commit:
   (5341b42ec) rpi3: Add mem reserve region to DTB if present

they started to runtime patching of the DTB, but the default build rules
in TF-A doesn't set RPI3_PRELOADED_DTB_BASE to anything which then gets
set to the default value: 1, which gives incorrect memory mappings for
MAP_BL32_MEM. Therefore we must tell where the DTB is located and we do
that by adding adding a compile time flag to TF-A, i.e.,

       RPI3_PRELOADED_DTB_BASE=0x00010000

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (RPi3)
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
---
 rpi3.mk                     | 1 +
 rpi3/firmware/uboot.env.txt | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/rpi3.mk b/rpi3.mk
index cf89462..71abfac 100644
--- a/rpi3.mk
+++ b/rpi3.mk
@@ -66,6 +66,7 @@ ARM_TF_FLAGS ?= \
 	CRASH_REPORTING=1 \
 	LOG_LEVEL=40 \
 	PLAT=rpi3 \
+	RPI3_PRELOADED_DTB_BASE=0x00010000 \
 	SPD=opteed
 
 arm-tf: optee-os $(RPI3_UBOOT_ENV)
diff --git a/rpi3/firmware/uboot.env.txt b/rpi3/firmware/uboot.env.txt
index c453dc4..7e29962 100644
--- a/rpi3/firmware/uboot.env.txt
+++ b/rpi3/firmware/uboot.env.txt
@@ -33,4 +33,4 @@ nfsboot=run load_kernel; run set_bootargs_tty set_bootargs_nfs set_common_args;
 set_bootargs_tty=setenv bootargs console=${ttyconsole} console=${sttyconsole},${baudrate}
 set_bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs rw rootfstype=nfs nfsroot=${nfsserverip}:${nfspath},udp,vers=3 ip=dhcp
 set_bootargs_mmc=setenv bootargs ${bootargs} root=/dev/mmcblk0p2 rw rootfs=ext4
-set_common_args=setenv bootargs ${bootargs} smsc95xx.macaddr=${ethaddr} 'ignore_loglevel dma.dmachans=0x7f35 memmap=16M$256M rootwait 8250.nr_uarts=1 elevator=deadline fsck.repair=yes bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0'
+set_common_args=setenv bootargs ${bootargs} smsc95xx.macaddr=${ethaddr} 'ignore_loglevel dma.dmachans=0x7f35 rootwait 8250.nr_uarts=1 elevator=deadline fsck.repair=yes bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0'
-- 
GitLab