1Allwinner ARMv8 SoCs 2==================== 3 4Trusted Firmware-A (TF-A) implements the EL3 firmware layer for Allwinner 5SoCs with ARMv8 cores. Only BL31 is used to provide proper EL3 setup and 6PSCI runtime services. 7 8Building TF-A 9------------- 10 11To build for machines with an A64 or H5 SoC: 12 13.. code:: shell 14 15 make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_a64 DEBUG=1 bl31 16 17To build for machines with an H6 SoC: 18 19.. code:: shell 20 21 make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_h6 DEBUG=1 bl31 22 23 24Installation 25------------ 26 27U-Boot's SPL acts as a loader, loading both BL31 and BL33 (typically U-Boot). 28Loading is done from SD card, eMMC or SPI flash, also via an USB debug 29interface (FEL). 30 31After building bl31.bin, the binary must be fed to the U-Boot build system 32to include it in the FIT image that the SPL loader will process. 33bl31.bin can be either copied (or sym-linked) into U-Boot's root directory, 34or the environment variable BL31 must contain the binary's path. 35See the respective `U-Boot documentation`_ for more details. 36 37.. _U-Boot documentation: https://gitlab.denx.de/u-boot/u-boot/-/blob/master/board/sunxi/README.sunxi64 38 39Memory layout 40------------- 41 42A64, H5 and H6 SoCs 43~~~~~~~~~~~~~~~~~~~ 44 45BL31 lives in SRAM A2, which is documented to be accessible from secure 46world only. Since this SRAM region is very limited (48 KB), we take 47several measures to reduce memory consumption. One of them is to confine 48BL31 to only 28 bits of virtual address space, which reduces the number 49of required page tables (each occupying 4KB of memory). 50The mapping we use on those SoCs is as follows: 51 52:: 53 54 0 64K 16M 1GB 1G+160M physical address 55 +-+------+-+---+------+--...---+-------+----+------+---------- 56 |B| |S|///| |//...///| |////| | 57 |R| SRAM |C|///| dev |//...///| (sec) |////| BL33 | DRAM ... 58 |O| |P|///| MMIO |//...///| DRAM |////| | 59 |M| | |///| |//...///| (32M) |////| | 60 +-+------+-+---+------+--...---+-------+----+------+---------- 61 | | | | | | / / / / 62 | | | | | | / / / / 63 | | | | | | / / / / 64 | | | | | | / // / 65 | | | | | | / / / 66 +-+------+-+---+------+--+-------+------+ 67 |B| |S|///| |//| | | 68 |R| SRAM |C|///| dev |//| sec | BL33 | 69 |O| |P|///| MMIO |//| DRAM | | 70 |M| | |///| |//| | | 71 +-+------+-+---+------+--+-------+------+ 72 0 64K 16M 160M 192M 256M virtual address 73 74 75Trusted OS dispatcher 76--------------------- 77 78One can boot Trusted OS(OP-TEE OS, bl32 image) along side bl31 image on Allwinner A64. 79 80In order to include the 'opteed' dispatcher in the image, pass 'SPD=opteed' on the command line 81while compiling the bl31 image and make sure the loader (SPL) loads the Trusted OS binary to 82the beginning of DRAM (0x40000000). 83