socionext-uniphier.rst 4 KB
Newer Older
1
2
Socionext UniPhier
==================
3

Dan Handley's avatar
Dan Handley committed
4
5
Socionext UniPhier Armv8-A SoCs use Trusted Firmware-A (TF-A) as the secure
world firmware, supporting BL2 and BL31.
6
7
8

UniPhier SoC family implements its internal boot ROM, which loads 64KB [1]_
image from a non-volatile storage to the on-chip SRAM, and jumps over to it.
Dan Handley's avatar
Dan Handley committed
9
10
TF-A provides a special mode, BL2-AT-EL3, which enables BL2 to execute at EL3.
It is useful for platforms with non-TF-A boot ROM, like UniPhier. Here, a
11
12
13
14
15
problem is BL2 does not fit in the 64KB limit if
:ref:`Trusted Board Boot (TBB) <Trusted Board Boot>` is enabled.
To solve this issue, Socionext provides a first stage loader called
`UniPhier BL`_. This loader runs in the on-chip SRAM, initializes the DRAM,
expands BL2 there, and hands the control over to it. Therefore, all images
Dan Handley's avatar
Dan Handley committed
16
of TF-A run in DRAM.
17
18
19
20
21
22

The UniPhier platform works with/without TBB. See below for the build process
of each case. The image authentication for the UniPhier platform fully
complies with the Trusted Board Boot Requirements (TBBR) specification.

The UniPhier BL does not implement the authentication functionality, that is,
23
24
25
26
27
it can not verify the BL2 image by itself. Instead, the UniPhier BL assures
the BL2 validity in a different way; BL2 is GZIP-compressed and appended to
the UniPhier BL. The concatenation of the UniPhier BL and the compressed BL2
fits in the 64KB limit. The concatenated image is loaded by the internal boot
ROM (and verified if the chip fuses are blown).
28
29
30
31
32


Boot Flow
---------

33
34
35
1. The Boot ROM

   This is hard-wired ROM, so never corrupted. It loads the UniPhier BL (with
36
   compressed-BL2 appended) into the on-chip SRAM. If the SoC fuses are blown,
37
   the image is verified by the SoC's own method.
38

39
2. UniPhier BL
40

41
   This runs in the on-chip SRAM. After the minimum SoC initialization and DRAM
42
43
   setup, it decompresses the appended BL2 image into the DRAM, then jumps to
   the BL2 entry.
44

45
3. BL2 (at EL3)
46

47
48
   This runs in the DRAM. It extracts more images such as BL31, BL33 (optionally
   SCP_BL2, BL32 as well) from Firmware Image Package (FIP). If TBB is enabled,
Dan Handley's avatar
Dan Handley committed
49
   they are all authenticated by the standard mechanism of TF-A.
50
   After loading all the images, it jumps to the BL31 entry.
51

52
4. BL31, BL32, and BL33
53

54
   They all run in the DRAM. See :ref:`Firmware Design` for details.
55
56
57
58
59


Basic Build
-----------

60
61
BL2 must be compressed for the reason above. The UniPhier's platform makefile
provides a build target ``bl2_gzip`` for this.
62
63
64
65
66

For a non-secure boot loader (aka BL33), U-Boot is well supported for UniPhier
SoCs. The U-Boot image (``u-boot.bin``) must be built in advance. For the build
procedure of U-Boot, refer to the document in the `U-Boot`_ project.

67
To build minimum functionality for UniPhier (without TBB)::
68

69
    make CROSS_COMPILE=<gcc-prefix> PLAT=uniphier BL33=<path-to-BL33> bl2_gzip fip
70
71
72

Output images:

73
- ``bl2.bin.gz``
74
75
- ``fip.bin``

76
77
78
79

Optional features
-----------------

80
- Trusted Board Boot
81

82
  `mbed TLS`_ is needed as the cryptographic and image parser modules.
83
  Refer to the :ref:`User Guide` for the appropriate version of mbed TLS.
84

85
  To enable TBB, add the following options to the build command::
86
87
88

      TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=<path-to-mbedtls>

89
- System Control Processor (SCP)
90

91
92
93
  If desired, FIP can include an SCP BL2 image. If BL2 finds an SCP BL2 image
  in FIP, BL2 loads it into DRAM and kicks the SCP. Most of UniPhier boards
  still work without SCP, but SCP provides better power management support.
94

95
  To include SCP BL2, add the following option to the build command::
96
97
98

      SCP_BL2=<path-to-SCP>

99
- BL32 (Secure Payload)
100

101
  To enable BL32, add the following options to the build command::
102
103
104

      SPD=<spd> BL32=<path-to-BL32>

105
106
  If you use TSP for BL32, ``BL32=<path-to-BL32>`` is not required. Just add the
  following::
107
108
109

      SPD=tspd

110
111
112

.. [1] Some SoCs can load 80KB, but the software implementation must be aligned
   to the lowest common denominator.
113
114
115
.. _UniPhier BL: https://github.com/uniphier/uniphier-bl
.. _U-Boot: https://www.denx.de/wiki/U-Boot
.. _mbed TLS: https://tls.mbed.org/