blob: 1bf4f516ba0f5e7f72757b63b9fe6413b60dff53 [file] [log] [blame]
Paul Beesley24dba2b2019-05-22 11:22:44 +01001Allwinner ARMv8 SoCs
2====================
Samuel Holland64b3d9d2017-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 Przywara2dde1f52018-06-22 00:33:28 +01007
Andre Przywarafe90f9a2020-12-11 21:29:31 +00008Building TF-A
9-------------
Samuel Holland64b3d9d2017-08-12 04:07:39 -050010
Andre Przywarabed42a52017-12-08 01:27:02 +000011To build for machines with an A64 or H5 SoC:
Samuel Holland64b3d9d2017-08-12 04:07:39 -050012
Paul Beesley29c02522019-03-13 15:11:04 +000013.. code:: shell
Samuel Holland64b3d9d2017-08-12 04:07:39 -050014
Mark Dykes650a4352020-01-08 20:37:18 +000015 make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_a64 DEBUG=1 bl31
Samuel Holland64b3d9d2017-08-12 04:07:39 -050016
Andre Przywarabed42a52017-12-08 01:27:02 +000017To build for machines with an H6 SoC:
18
Paul Beesley29c02522019-03-13 15:11:04 +000019.. code:: shell
Andre Przywarabed42a52017-12-08 01:27:02 +000020
Mark Dykes650a4352020-01-08 20:37:18 +000021 make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_h6 DEBUG=1 bl31
Andre Przywarabed42a52017-12-08 01:27:02 +000022
Andre Przywara26123ca2020-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
Andre Przywaraaa616992021-12-27 15:09:53 +000029Platform-specific build options
30~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31
32The default build options should generate a working firmware image. There are
33some build options that allow to fine-tune the firmware, or to disable support
34for optional features.
35
36- ``SUNXI_SETUP_REGULATORS`` : On SoCs that typically ship with a PMIC
37 power management controller, BL31 tries to set up all needed power rails,
38 programming them to their respective voltages. That allows bootloader
39 software like U-Boot to ignore power control via the PMIC.
40 This setting defaults to 1. In some situations that enables too many
41 regulators, or some regulators need to be enabled in a very specific
42 sequence. To avoid problems with those boards, ``SUNXI_SETUP_REGULATORS``
43 can bet set to ``0`` on the build command line, to skip the PMIC setup
44 entirely. Any bootloader or OS would need to setup the PMIC on its own then.
Andre Przywarafe90f9a2020-12-11 21:29:31 +000045
46Installation
47------------
48
49U-Boot's SPL acts as a loader, loading both BL31 and BL33 (typically U-Boot).
50Loading is done from SD card, eMMC or SPI flash, also via an USB debug
51interface (FEL).
52
53After building bl31.bin, the binary must be fed to the U-Boot build system
54to include it in the FIT image that the SPL loader will process.
55bl31.bin can be either copied (or sym-linked) into U-Boot's root directory,
56or the environment variable BL31 must contain the binary's path.
57See the respective `U-Boot documentation`_ for more details.
58
Sandrine Bailleux0396bcb2020-07-01 13:53:07 +020059.. _U-Boot documentation: https://gitlab.denx.de/u-boot/u-boot/-/blob/master/board/sunxi/README.sunxi64
Amit Singh Tomardab901f2018-06-20 00:44:50 +053060
Andre Przywarafe90f9a2020-12-11 21:29:31 +000061Memory layout
62-------------
63
64A64, H5 and H6 SoCs
65~~~~~~~~~~~~~~~~~~~
66
67BL31 lives in SRAM A2, which is documented to be accessible from secure
68world only. Since this SRAM region is very limited (48 KB), we take
69several measures to reduce memory consumption. One of them is to confine
70BL31 to only 28 bits of virtual address space, which reduces the number
71of required page tables (each occupying 4KB of memory).
72The mapping we use on those SoCs is as follows:
73
74::
75
76 0 64K 16M 1GB 1G+160M physical address
77 +-+------+-+---+------+--...---+-------+----+------+----------
78 |B| |S|///| |//...///| |////| |
79 |R| SRAM |C|///| dev |//...///| (sec) |////| BL33 | DRAM ...
80 |O| |P|///| MMIO |//...///| DRAM |////| |
81 |M| | |///| |//...///| (32M) |////| |
82 +-+------+-+---+------+--...---+-------+----+------+----------
83 | | | | | | / / / /
84 | | | | | | / / / /
85 | | | | | | / / / /
86 | | | | | | / // /
87 | | | | | | / / /
88 +-+------+-+---+------+--+-------+------+
89 |B| |S|///| |//| | |
90 |R| SRAM |C|///| dev |//| sec | BL33 |
91 |O| |P|///| MMIO |//| DRAM | |
92 |M| | |///| |//| | |
93 +-+------+-+---+------+--+-------+------+
94 0 64K 16M 160M 192M 256M virtual address
95
96
Andre Przywara26123ca2020-11-28 01:39:17 +000097H616 SoC
98~~~~~~~~
99
100The H616 lacks the secure SRAM region present on the other SoCs, also
101lacks the "ARISC" management processor (SCP) we use. BL31 thus needs to
102run from DRAM, which prevents our compressed virtual memory map described
103above. Since running in DRAM also lifts the restriction of the limited
104SRAM size, we use the normal 1:1 mapping with 32 bits worth of virtual
105address space. So the virtual addresses used in BL31 match the physical
106addresses as presented above.
107
Amit Singh Tomardab901f2018-06-20 00:44:50 +0530108Trusted OS dispatcher
Paul Beesley24dba2b2019-05-22 11:22:44 +0100109---------------------
Amit Singh Tomardab901f2018-06-20 00:44:50 +0530110
111One can boot Trusted OS(OP-TEE OS, bl32 image) along side bl31 image on Allwinner A64.
112
113In order to include the 'opteed' dispatcher in the image, pass 'SPD=opteed' on the command line
114while compiling the bl31 image and make sure the loader (SPL) loads the Trusted OS binary to
115the beginning of DRAM (0x40000000).