blob: b6969896a7399225527d36d5b87469fd8a2da53e [file] [log] [blame]
Paul Beesleyf3653a62019-05-22 11:22:44 +01001Allwinner ARMv8 SoCs
2====================
Samuel Holland74383202017-08-12 04:07:39 -05003
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.
Andre Przywara4416ba82018-06-22 00:33:28 +01007
Andre Przywara928fc872020-12-11 21:29:31 +00008Building TF-A
9-------------
Andre Przywara4416ba82018-06-22 00:33:28 +010010
Andre Przywara928fc872020-12-11 21:29:31 +000011To 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
Samuel Holland74383202017-08-12 04:07:39 -050022
Andre Przywara2d42e5f2020-11-28 01:39:17 +000023To build for machines with an H616 or H313 SoC:
24
25.. code:: shell
26
27 make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_h616 DEBUG=1 bl31
28
Samuel Holland74383202017-08-12 04:07:39 -050029
Andre Przywara928fc872020-12-11 21:29:31 +000030Installation
31------------
32
33U-Boot's SPL acts as a loader, loading both BL31 and BL33 (typically U-Boot).
34Loading is done from SD card, eMMC or SPI flash, also via an USB debug
35interface (FEL).
Samuel Holland74383202017-08-12 04:07:39 -050036
37After building bl31.bin, the binary must be fed to the U-Boot build system
38to include it in the FIT image that the SPL loader will process.
39bl31.bin can be either copied (or sym-linked) into U-Boot's root directory,
40or the environment variable BL31 must contain the binary's path.
41See the respective `U-Boot documentation`_ for more details.
42
Andre Przywara928fc872020-12-11 21:29:31 +000043.. _U-Boot documentation: https://gitlab.denx.de/u-boot/u-boot/-/blob/master/board/sunxi/README.sunxi64
Samuel Holland74383202017-08-12 04:07:39 -050044
Andre Przywara928fc872020-12-11 21:29:31 +000045Memory layout
46-------------
Samuel Holland74383202017-08-12 04:07:39 -050047
Andre Przywara928fc872020-12-11 21:29:31 +000048A64, H5 and H6 SoCs
49~~~~~~~~~~~~~~~~~~~
Samuel Holland74383202017-08-12 04:07:39 -050050
Andre Przywara928fc872020-12-11 21:29:31 +000051BL31 lives in SRAM A2, which is documented to be accessible from secure
52world only. Since this SRAM region is very limited (48 KB), we take
53several measures to reduce memory consumption. One of them is to confine
54BL31 to only 28 bits of virtual address space, which reduces the number
55of required page tables (each occupying 4KB of memory).
56The mapping we use on those SoCs is as follows:
Andre Przywaraaa26f532017-12-08 01:27:02 +000057
Andre Przywara928fc872020-12-11 21:29:31 +000058::
Andre Przywaraaa26f532017-12-08 01:27:02 +000059
Andre Przywara928fc872020-12-11 21:29:31 +000060 0 64K 16M 1GB 1G+160M physical address
61 +-+------+-+---+------+--...---+-------+----+------+----------
62 |B| |S|///| |//...///| |////| |
63 |R| SRAM |C|///| dev |//...///| (sec) |////| BL33 | DRAM ...
64 |O| |P|///| MMIO |//...///| DRAM |////| |
65 |M| | |///| |//...///| (32M) |////| |
66 +-+------+-+---+------+--...---+-------+----+------+----------
67 | | | | | | / / / /
68 | | | | | | / / / /
69 | | | | | | / / / /
70 | | | | | | / // /
71 | | | | | | / / /
72 +-+------+-+---+------+--+-------+------+
73 |B| |S|///| |//| | |
74 |R| SRAM |C|///| dev |//| sec | BL33 |
75 |O| |P|///| MMIO |//| DRAM | |
76 |M| | |///| |//| | |
77 +-+------+-+---+------+--+-------+------+
78 0 64K 16M 160M 192M 256M virtual address
Andre Przywaraaa26f532017-12-08 01:27:02 +000079
Amit Singh Tomar2f372242018-06-20 00:44:50 +053080
Andre Przywara2d42e5f2020-11-28 01:39:17 +000081H616 SoC
82~~~~~~~~
83
84The H616 lacks the secure SRAM region present on the other SoCs, also
85lacks the "ARISC" management processor (SCP) we use. BL31 thus needs to
86run from DRAM, which prevents our compressed virtual memory map described
87above. Since running in DRAM also lifts the restriction of the limited
88SRAM size, we use the normal 1:1 mapping with 32 bits worth of virtual
89address space. So the virtual addresses used in BL31 match the physical
90addresses as presented above.
91
Amit Singh Tomar2f372242018-06-20 00:44:50 +053092Trusted OS dispatcher
Paul Beesleyf3653a62019-05-22 11:22:44 +010093---------------------
Amit Singh Tomar2f372242018-06-20 00:44:50 +053094
95One can boot Trusted OS(OP-TEE OS, bl32 image) along side bl31 image on Allwinner A64.
96
97In order to include the 'opteed' dispatcher in the image, pass 'SPD=opteed' on the command line
98while compiling the bl31 image and make sure the loader (SPL) loads the Trusted OS binary to
99the beginning of DRAM (0x40000000).