From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dr. Philipp Tomsich Date: Fri, 14 Apr 2017 12:51:26 +0200 Subject: [U-Boot] [PATCH] rockchip: reserve memory for rk3399 ATF data In-Reply-To: <1492165263-30111-1-git-send-email-kever.yang@rock-chips.com> References: <1492165263-30111-1-git-send-email-kever.yang@rock-chips.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Kever, Do we really need to change the SPL layout (i.e. BL2) for this? The SPL code should remain independent of later stages. This change would tie the U-Boot SPL (BL2) to a specific implementation/memory layout of the later BL31 stage. It should rather remain the responsibility of the BL31 stage to properly relocate itself as needed upon startup... Our (yet unreleased) development tree (for ATF) uses a much less intrusive approach to achieve the same result (using the knowledge that the ATF will not return to SPL and thus allowing the ATF to overwrite memory areas previously used by SPL): 1. ATF (BL31), the M0-firmware and the second-stage U-Boot are loaded as separate firmware blobs into DRAM using Andre's FIT image loader patches 2. SPL transfers control to ATF (with a vendor-specific parameter payload, which contains the location of the M0 firmware in DRAM) 3. ATF installs the M0 firmware into its final location Note that we’ve split the M0 firmware off the ATF build (and into a separate repository), as we’d otherwise end up with ELF files that has data/code/etc in the first MB of the address space and the M0 binary at 0xff8c0000 — if you convert such an ELF to a binary, you’d end up with a file size of approx. 4GB. In other words: we don’t include the M0 binary into the ATF, but load it separately through the FIT image loader... I’ll try to get our Cortex-M0 and ATF repositories pushed to our public GIT by early next week, so you can review… Regards, Philipp. > On 14 Apr 2017, at 12:21, Kever Yang wrote: > > There are 3 region used by rk3399 ATF: > - bl31 code, locate at 0x10000; > - cortex-m0 code and data, locate at 0xff8c0000; > - bl31 data, locate at 0xff8c1000 ~ 0xff8c4000; > > SPL_TEXT_BASE starts from 0xff8c2000, we need to reserve memory > for ATF data, or else there will have memory corrupt after SPL > load ATF image. > > More detail about cortex-M0 code in ATF: > https://github.com/ARM-software/arm-trusted-firmware/commit/ > 8382e17c4c6bffd15119dfce1ee4372e3c1a7890 > > Signed-off-by: Kever Yang > --- > > arch/arm/include/asm/arch-rockchip/boot0.h | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm/include/asm/arch-rockchip/boot0.h b/arch/arm/include/asm/arch-rockchip/boot0.h > index 8d7bc9a..f85a4db 100644 > --- a/arch/arm/include/asm/arch-rockchip/boot0.h > +++ b/arch/arm/include/asm/arch-rockchip/boot0.h > @@ -16,3 +16,7 @@ > .space 0x4 /* space for the 'RK33' */ > #endif > b reset > + > +#ifdef defined(CONFIG_ROCKCHIP_RK3399) && defined(CONFIG_SPL_BUILD) > + .space 0x4000 /* space for the ATF data */ > +#endif > -- > 1.9.1 >