socionext-uniphier.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. Socionext UniPhier
  2. ==================
  3. Socionext UniPhier Armv8-A SoCs use Trusted Firmware-A (TF-A) as the secure
  4. world firmware, supporting BL2 and BL31.
  5. UniPhier SoC family implements its internal boot ROM, which loads 64KB [1]_
  6. image from a non-volatile storage to the on-chip SRAM, and jumps over to it.
  7. TF-A provides a special mode, BL2-AT-EL3, which enables BL2 to execute at EL3.
  8. It is useful for platforms with non-TF-A boot ROM, like UniPhier. Here, a
  9. problem is BL2 does not fit in the 64KB limit if
  10. :ref:`Trusted Board Boot (TBB) <Trusted Board Boot>` is enabled.
  11. To solve this issue, Socionext provides a first stage loader called
  12. `UniPhier BL`_. This loader runs in the on-chip SRAM, initializes the DRAM,
  13. expands BL2 there, and hands the control over to it. Therefore, all images
  14. of TF-A run in DRAM.
  15. The UniPhier platform works with/without TBB. See below for the build process
  16. of each case. The image authentication for the UniPhier platform fully
  17. complies with the Trusted Board Boot Requirements (TBBR) specification.
  18. The UniPhier BL does not implement the authentication functionality, that is,
  19. it can not verify the BL2 image by itself. Instead, the UniPhier BL assures
  20. the BL2 validity in a different way; BL2 is GZIP-compressed and appended to
  21. the UniPhier BL. The concatenation of the UniPhier BL and the compressed BL2
  22. fits in the 64KB limit. The concatenated image is loaded by the internal boot
  23. ROM (and verified if the chip fuses are blown).
  24. Boot Flow
  25. ---------
  26. 1. The Boot ROM
  27. This is hard-wired ROM, so never corrupted. It loads the UniPhier BL (with
  28. compressed-BL2 appended) into the on-chip SRAM. If the SoC fuses are blown,
  29. the image is verified by the SoC's own method.
  30. 2. UniPhier BL
  31. This runs in the on-chip SRAM. After the minimum SoC initialization and DRAM
  32. setup, it decompresses the appended BL2 image into the DRAM, then jumps to
  33. the BL2 entry.
  34. 3. BL2 (at EL3)
  35. This runs in the DRAM. It extracts more images such as BL31, BL33 (optionally
  36. SCP_BL2, BL32 as well) from Firmware Image Package (FIP). If TBB is enabled,
  37. they are all authenticated by the standard mechanism of TF-A.
  38. After loading all the images, it jumps to the BL31 entry.
  39. 4. BL31, BL32, and BL33
  40. They all run in the DRAM. See :ref:`Firmware Design` for details.
  41. Basic Build
  42. -----------
  43. BL2 must be compressed for the reason above. The UniPhier's platform makefile
  44. provides a build target ``bl2_gzip`` for this.
  45. For a non-secure boot loader (aka BL33), U-Boot is well supported for UniPhier
  46. SoCs. The U-Boot image (``u-boot.bin``) must be built in advance. For the build
  47. procedure of U-Boot, refer to the document in the `U-Boot`_ project.
  48. To build minimum functionality for UniPhier (without TBB)::
  49. make CROSS_COMPILE=<gcc-prefix> PLAT=uniphier BL33=<path-to-BL33> bl2_gzip fip
  50. Output images:
  51. - ``bl2.bin.gz``
  52. - ``fip.bin``
  53. Optional features
  54. -----------------
  55. - Trusted Board Boot
  56. `mbed TLS`_ is needed as the cryptographic and image parser modules.
  57. Refer to the :ref:`Prerequisites` document for the appropriate version of
  58. mbed TLS.
  59. To enable TBB, add the following options to the build command::
  60. TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=<path-to-mbedtls>
  61. - System Control Processor (SCP)
  62. If desired, FIP can include an SCP BL2 image. If BL2 finds an SCP BL2 image
  63. in FIP, BL2 loads it into DRAM and kicks the SCP. Most of UniPhier boards
  64. still work without SCP, but SCP provides better power management support.
  65. To include SCP BL2, add the following option to the build command::
  66. SCP_BL2=<path-to-SCP>
  67. - BL32 (Secure Payload)
  68. To enable BL32, add the following options to the build command::
  69. SPD=<spd> BL32=<path-to-BL32>
  70. If you use TSP for BL32, ``BL32=<path-to-BL32>`` is not required. Just add the
  71. following::
  72. SPD=tspd
  73. .. [1] Some SoCs can load 80KB, but the software implementation must be aligned
  74. to the lowest common denominator.
  75. .. _UniPhier BL: https://github.com/uniphier/uniphier-bl
  76. .. _U-Boot: https://www.denx.de/wiki/U-Boot
  77. .. _mbed TLS: https://tls.mbed.org/