blob: 82b9b503a509d3b3ca5bd75b5cd282e4c550cbef [file] [log] [blame]
Paul Beesleyf3653a62019-05-22 11:22:44 +01001Socionext UniPhier
2==================
Masahiro Yamada62a197a2017-12-19 22:30:24 +09003
Dan Handley610e7e12018-03-01 18:44:00 +00004Socionext UniPhier Armv8-A SoCs use Trusted Firmware-A (TF-A) as the secure
5world firmware, supporting BL2 and BL31.
Douglas Raillardd7c21b72017-06-28 15:23:03 +01006
Masahiro Yamada75bfecb2017-12-19 11:56:05 +09007UniPhier SoC family implements its internal boot ROM, which loads 64KB [1]_
8image from a non-volatile storage to the on-chip SRAM, and jumps over to it.
Dan Handley610e7e12018-03-01 18:44:00 +00009TF-A provides a special mode, BL2-AT-EL3, which enables BL2 to execute at EL3.
10It is useful for platforms with non-TF-A boot ROM, like UniPhier. Here, a
11problem is BL2 does not fit in the 64KB limit if `Trusted Board Boot`_ (TBB)
12is enabled. To solve this issue, Socionext provides a first stage loader
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090013called `UniPhier BL`_. This loader runs in the on-chip SRAM, initializes the
14DRAM, expands BL2 there, and hands the control over to it. Therefore, all images
Dan Handley610e7e12018-03-01 18:44:00 +000015of TF-A run in DRAM.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010016
17The UniPhier platform works with/without TBB. See below for the build process
18of each case. The image authentication for the UniPhier platform fully
19complies with the Trusted Board Boot Requirements (TBBR) specification.
20
21The UniPhier BL does not implement the authentication functionality, that is,
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090022it can not verify the BL2 image by itself. Instead, the UniPhier BL assures
23the BL2 validity in a different way; BL2 is GZIP-compressed and appended to
24the UniPhier BL. The concatenation of the UniPhier BL and the compressed BL2
25fits in the 64KB limit. The concatenated image is loaded by the internal boot
26ROM (and verified if the chip fuses are blown).
Douglas Raillardd7c21b72017-06-28 15:23:03 +010027
Douglas Raillardd7c21b72017-06-28 15:23:03 +010028
29Boot Flow
30---------
31
Masahiro Yamada62a197a2017-12-19 22:30:24 +0900321. The Boot ROM
Douglas Raillardd7c21b72017-06-28 15:23:03 +010033
Masahiro Yamada62a197a2017-12-19 22:30:24 +090034 This is hard-wired ROM, so never corrupted. It loads the UniPhier BL (with
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090035 compressed-BL2 appended) into the on-chip SRAM. If the SoC fuses are blown,
Masahiro Yamada62a197a2017-12-19 22:30:24 +090036 the image is verified by the SoC's own method.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010037
Masahiro Yamada62a197a2017-12-19 22:30:24 +0900382. UniPhier BL
Douglas Raillardd7c21b72017-06-28 15:23:03 +010039
Masahiro Yamada62a197a2017-12-19 22:30:24 +090040 This runs in the on-chip SRAM. After the minimum SoC initialization and DRAM
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090041 setup, it decompresses the appended BL2 image into the DRAM, then jumps to
42 the BL2 entry.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010043
Masahiro Yamada75bfecb2017-12-19 11:56:05 +0900443. BL2 (at EL3)
Douglas Raillardd7c21b72017-06-28 15:23:03 +010045
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090046 This runs in the DRAM. It extracts more images such as BL31, BL33 (optionally
47 SCP_BL2, BL32 as well) from Firmware Image Package (FIP). If TBB is enabled,
Dan Handley610e7e12018-03-01 18:44:00 +000048 they are all authenticated by the standard mechanism of TF-A.
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090049 After loading all the images, it jumps to the BL31 entry.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010050
Masahiro Yamada75bfecb2017-12-19 11:56:05 +0900514. BL31, BL32, and BL33
Douglas Raillardd7c21b72017-06-28 15:23:03 +010052
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090053 They all run in the DRAM. See `Firmware Design`_ for details.
Masahiro Yamada62a197a2017-12-19 22:30:24 +090054
Douglas Raillardd7c21b72017-06-28 15:23:03 +010055
56Basic Build
57-----------
58
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090059BL2 must be compressed for the reason above. The UniPhier's platform makefile
60provides a build target ``bl2_gzip`` for this.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010061
62For a non-secure boot loader (aka BL33), U-Boot is well supported for UniPhier
63SoCs. The U-Boot image (``u-boot.bin``) must be built in advance. For the build
64procedure of U-Boot, refer to the document in the `U-Boot`_ project.
65
Masahiro Yamada62a197a2017-12-19 22:30:24 +090066To build minimum functionality for UniPhier (without TBB)::
Douglas Raillardd7c21b72017-06-28 15:23:03 +010067
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090068 make CROSS_COMPILE=<gcc-prefix> PLAT=uniphier BL33=<path-to-BL33> bl2_gzip fip
Douglas Raillardd7c21b72017-06-28 15:23:03 +010069
70Output images:
71
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090072- ``bl2.bin.gz``
Masahiro Yamada62a197a2017-12-19 22:30:24 +090073- ``fip.bin``
74
Douglas Raillardd7c21b72017-06-28 15:23:03 +010075
76Optional features
77-----------------
78
Masahiro Yamada62a197a2017-12-19 22:30:24 +090079- Trusted Board Boot
Douglas Raillardd7c21b72017-06-28 15:23:03 +010080
Masahiro Yamada62a197a2017-12-19 22:30:24 +090081 `mbed TLS`_ is needed as the cryptographic and image parser modules.
82 Refer to the `User Guide`_ for the appropriate version of mbed TLS.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010083
Masahiro Yamada62a197a2017-12-19 22:30:24 +090084 To enable TBB, add the following options to the build command::
Douglas Raillardd7c21b72017-06-28 15:23:03 +010085
86 TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=<path-to-mbedtls>
87
Masahiro Yamada62a197a2017-12-19 22:30:24 +090088- System Control Processor (SCP)
Douglas Raillardd7c21b72017-06-28 15:23:03 +010089
Masahiro Yamada62a197a2017-12-19 22:30:24 +090090 If desired, FIP can include an SCP BL2 image. If BL2 finds an SCP BL2 image
91 in FIP, BL2 loads it into DRAM and kicks the SCP. Most of UniPhier boards
92 still work without SCP, but SCP provides better power management support.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010093
Masahiro Yamada62a197a2017-12-19 22:30:24 +090094 To include SCP BL2, add the following option to the build command::
Douglas Raillardd7c21b72017-06-28 15:23:03 +010095
96 SCP_BL2=<path-to-SCP>
97
Masahiro Yamada62a197a2017-12-19 22:30:24 +090098- BL32 (Secure Payload)
Douglas Raillardd7c21b72017-06-28 15:23:03 +010099
Masahiro Yamada62a197a2017-12-19 22:30:24 +0900100 To enable BL32, add the following options to the build command::
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100101
102 SPD=<spd> BL32=<path-to-BL32>
103
Masahiro Yamada62a197a2017-12-19 22:30:24 +0900104 If you use TSP for BL32, ``BL32=<path-to-BL32>`` is not required. Just add the
105 following::
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100106
107 SPD=tspd
108
Masahiro Yamada62a197a2017-12-19 22:30:24 +0900109
110.. [1] Some SoCs can load 80KB, but the software implementation must be aligned
111 to the lowest common denominator.
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100112.. _Trusted Board Boot: ../trusted-board-boot.rst
113.. _UniPhier BL: https://github.com/uniphier/uniphier-bl
114.. _Firmware Design: ../firmware-design.rst
115.. _U-Boot: https://www.denx.de/wiki/U-Boot
116.. _mbed TLS: https://tls.mbed.org/
117.. _User Guide: ../user-guide.rst