xref: /rk3399_ARM-atf/docs/plat/socionext-uniphier.rst (revision f325f9ce429c09e28acbbb57f3dd8a09e4d1ccf4)
124dba2b3SPaul BeesleySocionext UniPhier
224dba2b3SPaul Beesley==================
358b6fccfSMasahiro Yamada
44def07d5SDan HandleySocionext UniPhier Armv8-A SoCs use Trusted Firmware-A (TF-A) as the secure
54def07d5SDan Handleyworld firmware, supporting BL2 and BL31.
66f625747SDouglas Raillard
7247fc043SMasahiro YamadaUniPhier SoC family implements its internal boot ROM, which loads 64KB [1]_
8247fc043SMasahiro Yamadaimage from a non-volatile storage to the on-chip SRAM, and jumps over to it.
94def07d5SDan HandleyTF-A provides a special mode, BL2-AT-EL3, which enables BL2 to execute at EL3.
104def07d5SDan HandleyIt is useful for platforms with non-TF-A boot ROM, like UniPhier. Here, a
1134760951SPaul Beesleyproblem is BL2 does not fit in the 64KB limit if
1234760951SPaul Beesley:ref:`Trusted Board Boot (TBB) <Trusted Board Boot>` is enabled.
1334760951SPaul BeesleyTo solve this issue, Socionext provides a first stage loader called
1434760951SPaul Beesley`UniPhier BL`_. This loader runs in the on-chip SRAM, initializes the DRAM,
1534760951SPaul Beesleyexpands BL2 there, and hands the control over to it. Therefore, all images
164def07d5SDan Handleyof TF-A run in DRAM.
176f625747SDouglas Raillard
186f625747SDouglas RaillardThe UniPhier platform works with/without TBB. See below for the build process
196f625747SDouglas Raillardof each case. The image authentication for the UniPhier platform fully
206f625747SDouglas Raillardcomplies with the Trusted Board Boot Requirements (TBBR) specification.
216f625747SDouglas Raillard
226f625747SDouglas RaillardThe UniPhier BL does not implement the authentication functionality, that is,
23247fc043SMasahiro Yamadait can not verify the BL2 image by itself. Instead, the UniPhier BL assures
24247fc043SMasahiro Yamadathe BL2 validity in a different way; BL2 is GZIP-compressed and appended to
25247fc043SMasahiro Yamadathe UniPhier BL. The concatenation of the UniPhier BL and the compressed BL2
26247fc043SMasahiro Yamadafits in the 64KB limit. The concatenated image is loaded by the internal boot
27247fc043SMasahiro YamadaROM (and verified if the chip fuses are blown).
286f625747SDouglas Raillard
296f625747SDouglas Raillard
306f625747SDouglas RaillardBoot Flow
316f625747SDouglas Raillard---------
326f625747SDouglas Raillard
3358b6fccfSMasahiro Yamada1. The Boot ROM
346f625747SDouglas Raillard
356f625747SDouglas Raillard   This is hard-wired ROM, so never corrupted. It loads the UniPhier BL (with
36247fc043SMasahiro Yamada   compressed-BL2 appended) into the on-chip SRAM. If the SoC fuses are blown,
376f625747SDouglas Raillard   the image is verified by the SoC's own method.
386f625747SDouglas Raillard
3958b6fccfSMasahiro Yamada2. UniPhier BL
406f625747SDouglas Raillard
416f625747SDouglas Raillard   This runs in the on-chip SRAM. After the minimum SoC initialization and DRAM
42247fc043SMasahiro Yamada   setup, it decompresses the appended BL2 image into the DRAM, then jumps to
43247fc043SMasahiro Yamada   the BL2 entry.
446f625747SDouglas Raillard
45247fc043SMasahiro Yamada3. BL2 (at EL3)
466f625747SDouglas Raillard
47247fc043SMasahiro Yamada   This runs in the DRAM. It extracts more images such as BL31, BL33 (optionally
48247fc043SMasahiro Yamada   SCP_BL2, BL32 as well) from Firmware Image Package (FIP). If TBB is enabled,
494def07d5SDan Handley   they are all authenticated by the standard mechanism of TF-A.
50247fc043SMasahiro Yamada   After loading all the images, it jumps to the BL31 entry.
516f625747SDouglas Raillard
52247fc043SMasahiro Yamada4. BL31, BL32, and BL33
536f625747SDouglas Raillard
5434760951SPaul Beesley   They all run in the DRAM. See :ref:`Firmware Design` for details.
556f625747SDouglas Raillard
5658b6fccfSMasahiro Yamada
576f625747SDouglas RaillardBasic Build
586f625747SDouglas Raillard-----------
596f625747SDouglas Raillard
60247fc043SMasahiro YamadaBL2 must be compressed for the reason above. The UniPhier's platform makefile
61247fc043SMasahiro Yamadaprovides a build target ``bl2_gzip`` for this.
626f625747SDouglas Raillard
636f625747SDouglas RaillardFor a non-secure boot loader (aka BL33), U-Boot is well supported for UniPhier
646f625747SDouglas RaillardSoCs. The U-Boot image (``u-boot.bin``) must be built in advance. For the build
656f625747SDouglas Raillardprocedure of U-Boot, refer to the document in the `U-Boot`_ project.
666f625747SDouglas Raillard
6758b6fccfSMasahiro YamadaTo build minimum functionality for UniPhier (without TBB)::
686f625747SDouglas Raillard
69247fc043SMasahiro Yamada    make CROSS_COMPILE=<gcc-prefix> PLAT=uniphier BL33=<path-to-BL33> bl2_gzip fip
706f625747SDouglas Raillard
716f625747SDouglas RaillardOutput images:
726f625747SDouglas Raillard
73247fc043SMasahiro Yamada- ``bl2.bin.gz``
746f625747SDouglas Raillard- ``fip.bin``
756f625747SDouglas Raillard
7658b6fccfSMasahiro Yamada
776f625747SDouglas RaillardOptional features
786f625747SDouglas Raillard-----------------
796f625747SDouglas Raillard
806f625747SDouglas Raillard- Trusted Board Boot
816f625747SDouglas Raillard
826f625747SDouglas Raillard  `mbed TLS`_ is needed as the cryptographic and image parser modules.
83*43f35ef5SPaul Beesley  Refer to the :ref:`Prerequisites` document for the appropriate version of
84*43f35ef5SPaul Beesley  mbed TLS.
856f625747SDouglas Raillard
8658b6fccfSMasahiro Yamada  To enable TBB, add the following options to the build command::
876f625747SDouglas Raillard
886f625747SDouglas Raillard      TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=<path-to-mbedtls>
896f625747SDouglas Raillard
906f625747SDouglas Raillard- System Control Processor (SCP)
916f625747SDouglas Raillard
926f625747SDouglas Raillard  If desired, FIP can include an SCP BL2 image. If BL2 finds an SCP BL2 image
936f625747SDouglas Raillard  in FIP, BL2 loads it into DRAM and kicks the SCP. Most of UniPhier boards
946f625747SDouglas Raillard  still work without SCP, but SCP provides better power management support.
956f625747SDouglas Raillard
9658b6fccfSMasahiro Yamada  To include SCP BL2, add the following option to the build command::
976f625747SDouglas Raillard
986f625747SDouglas Raillard      SCP_BL2=<path-to-SCP>
996f625747SDouglas Raillard
1006f625747SDouglas Raillard- BL32 (Secure Payload)
1016f625747SDouglas Raillard
10258b6fccfSMasahiro Yamada  To enable BL32, add the following options to the build command::
1036f625747SDouglas Raillard
1046f625747SDouglas Raillard      SPD=<spd> BL32=<path-to-BL32>
1056f625747SDouglas Raillard
1066f625747SDouglas Raillard  If you use TSP for BL32, ``BL32=<path-to-BL32>`` is not required. Just add the
10758b6fccfSMasahiro Yamada  following::
1086f625747SDouglas Raillard
1096f625747SDouglas Raillard      SPD=tspd
1106f625747SDouglas Raillard
11158b6fccfSMasahiro Yamada
11258b6fccfSMasahiro Yamada.. [1] Some SoCs can load 80KB, but the software implementation must be aligned
11358b6fccfSMasahiro Yamada   to the lowest common denominator.
1146f625747SDouglas Raillard.. _UniPhier BL: https://github.com/uniphier/uniphier-bl
1156f625747SDouglas Raillard.. _U-Boot: https://www.denx.de/wiki/U-Boot
1166f625747SDouglas Raillard.. _mbed TLS: https://tls.mbed.org/
117