Paul Beesley | 24dba2b | 2019-05-22 11:22:44 +0100 | [diff] [blame] | 1 | Allwinner ARMv8 SoCs |
| 2 | ==================== |
Samuel Holland | 64b3d9d | 2017-08-12 04:07:39 -0500 | [diff] [blame] | 3 | |
| 4 | Trusted Firmware-A (TF-A) implements the EL3 firmware layer for Allwinner |
| 5 | SoCs with ARMv8 cores. Only BL31 is used to provide proper EL3 setup and |
| 6 | PSCI runtime services. |
Andre Przywara | 2dde1f5 | 2018-06-22 00:33:28 +0100 | [diff] [blame] | 7 | |
Andre Przywara | fe90f9a | 2020-12-11 21:29:31 +0000 | [diff] [blame^] | 8 | Building TF-A |
| 9 | ------------- |
Samuel Holland | 64b3d9d | 2017-08-12 04:07:39 -0500 | [diff] [blame] | 10 | |
Andre Przywara | bed42a5 | 2017-12-08 01:27:02 +0000 | [diff] [blame] | 11 | To build for machines with an A64 or H5 SoC: |
Samuel Holland | 64b3d9d | 2017-08-12 04:07:39 -0500 | [diff] [blame] | 12 | |
Paul Beesley | 29c0252 | 2019-03-13 15:11:04 +0000 | [diff] [blame] | 13 | .. code:: shell |
Samuel Holland | 64b3d9d | 2017-08-12 04:07:39 -0500 | [diff] [blame] | 14 | |
Mark Dykes | 650a435 | 2020-01-08 20:37:18 +0000 | [diff] [blame] | 15 | make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_a64 DEBUG=1 bl31 |
Samuel Holland | 64b3d9d | 2017-08-12 04:07:39 -0500 | [diff] [blame] | 16 | |
Andre Przywara | bed42a5 | 2017-12-08 01:27:02 +0000 | [diff] [blame] | 17 | To build for machines with an H6 SoC: |
| 18 | |
Paul Beesley | 29c0252 | 2019-03-13 15:11:04 +0000 | [diff] [blame] | 19 | .. code:: shell |
Andre Przywara | bed42a5 | 2017-12-08 01:27:02 +0000 | [diff] [blame] | 20 | |
Mark Dykes | 650a435 | 2020-01-08 20:37:18 +0000 | [diff] [blame] | 21 | make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_h6 DEBUG=1 bl31 |
Andre Przywara | bed42a5 | 2017-12-08 01:27:02 +0000 | [diff] [blame] | 22 | |
Andre Przywara | fe90f9a | 2020-12-11 21:29:31 +0000 | [diff] [blame^] | 23 | |
| 24 | Installation |
| 25 | ------------ |
| 26 | |
| 27 | U-Boot's SPL acts as a loader, loading both BL31 and BL33 (typically U-Boot). |
| 28 | Loading is done from SD card, eMMC or SPI flash, also via an USB debug |
| 29 | interface (FEL). |
| 30 | |
| 31 | After building bl31.bin, the binary must be fed to the U-Boot build system |
| 32 | to include it in the FIT image that the SPL loader will process. |
| 33 | bl31.bin can be either copied (or sym-linked) into U-Boot's root directory, |
| 34 | or the environment variable BL31 must contain the binary's path. |
| 35 | See the respective `U-Boot documentation`_ for more details. |
| 36 | |
Sandrine Bailleux | 0396bcb | 2020-07-01 13:53:07 +0200 | [diff] [blame] | 37 | .. _U-Boot documentation: https://gitlab.denx.de/u-boot/u-boot/-/blob/master/board/sunxi/README.sunxi64 |
Amit Singh Tomar | dab901f | 2018-06-20 00:44:50 +0530 | [diff] [blame] | 38 | |
Andre Przywara | fe90f9a | 2020-12-11 21:29:31 +0000 | [diff] [blame^] | 39 | Memory layout |
| 40 | ------------- |
| 41 | |
| 42 | A64, H5 and H6 SoCs |
| 43 | ~~~~~~~~~~~~~~~~~~~ |
| 44 | |
| 45 | BL31 lives in SRAM A2, which is documented to be accessible from secure |
| 46 | world only. Since this SRAM region is very limited (48 KB), we take |
| 47 | several measures to reduce memory consumption. One of them is to confine |
| 48 | BL31 to only 28 bits of virtual address space, which reduces the number |
| 49 | of required page tables (each occupying 4KB of memory). |
| 50 | The 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 | |
Amit Singh Tomar | dab901f | 2018-06-20 00:44:50 +0530 | [diff] [blame] | 75 | Trusted OS dispatcher |
Paul Beesley | 24dba2b | 2019-05-22 11:22:44 +0100 | [diff] [blame] | 76 | --------------------- |
Amit Singh Tomar | dab901f | 2018-06-20 00:44:50 +0530 | [diff] [blame] | 77 | |
| 78 | One can boot Trusted OS(OP-TEE OS, bl32 image) along side bl31 image on Allwinner A64. |
| 79 | |
| 80 | In order to include the 'opteed' dispatcher in the image, pass 'SPD=opteed' on the command line |
| 81 | while compiling the bl31 image and make sure the loader (SPL) loads the Trusted OS binary to |
| 82 | the beginning of DRAM (0x40000000). |