xilinx-zynqmp.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. Xilinx Zynq UltraScale+ MPSoC
  2. =============================
  3. Trusted Firmware-A (TF-A) implements the EL3 firmware layer for Xilinx Zynq
  4. UltraScale + MPSoC.
  5. The platform only uses the runtime part of TF-A as ZynqMP already has a
  6. BootROM (BL1) and FSBL (BL2).
  7. BL31 is TF-A.
  8. BL32 is an optional Secure Payload.
  9. BL33 is the non-secure world software (U-Boot, Linux etc).
  10. To build:
  11. .. code:: bash
  12. make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 bl31
  13. To build bl32 TSP you have to rebuild bl31 too:
  14. .. code:: bash
  15. make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp SPD=tspd RESET_TO_BL31=1 bl31 bl32
  16. To build TF-A for JTAG DCC console:
  17. .. code:: bash
  18. make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 bl31 ZYNQMP_CONSOLE=dcc
  19. ZynqMP platform specific build options
  20. --------------------------------------
  21. - ``XILINX_OF_BOARD_DTB_ADDR`` : Specifies the base address of Device tree.
  22. - ``ZYNQMP_ATF_MEM_BASE``: Specifies the base address of the bl31 binary.
  23. - ``ZYNQMP_ATF_MEM_SIZE``: Specifies the size of the memory region of the bl31 binary.
  24. - ``ZYNQMP_BL32_MEM_BASE``: Specifies the base address of the bl32 binary.
  25. - ``ZYNQMP_BL32_MEM_SIZE``: Specifies the size of the memory region of the bl32 binary.
  26. - ``ZYNQMP_CONSOLE``: Select the console driver. Options:
  27. - ``cadence``, ``cadence0``: Cadence UART 0
  28. - ``cadence1`` : Cadence UART 1
  29. ZynqMP Debug behavior
  30. ---------------------
  31. With DEBUG=1, TF-A for ZynqMP uses DDR memory range instead of OCM memory range
  32. due to size constraints.
  33. For DEBUG=1 configuration for ZynqMP the BL31_BASE is set to the DDR location
  34. of 0x1000 and BL31_LIMIT is set to DDR location of 0x7FFFF. By default the
  35. above memory range will NOT be reserved in device tree.
  36. To reserve the above memory range in device tree, the device tree base address
  37. must be provided during build as,
  38. make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
  39. XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31
  40. The default DTB base address for ZynqMP platform is 0x100000. This default value
  41. is not set in the code and to use this default address, user still needs to
  42. provide it through the build command as above.
  43. If the user wants to move the bl31 to a different DDR location, user can provide
  44. the DDR address location using the build time parameters ZYNQMP_ATF_MEM_BASE and
  45. ZYNQMP_ATF_MEM_SIZE.
  46. The DDR address must be reserved in the DTB by the user, either by manually
  47. adding the reserved memory node, in the device tree, with the required address
  48. range OR let TF-A modify the device tree on the run.
  49. To let TF-A access and modify the device tree, the DTB address must be provided
  50. to the build command as follows,
  51. make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
  52. ZYNQMP_ATF_MEM_BASE=<DDR address> ZYNQMP_ATF_MEM_SIZE=<size> \
  53. XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31
  54. DDR Address Range Usage
  55. -----------------------
  56. When FSBL runs on RPU and TF-A is to be placed in DDR address range,
  57. then the user needs to make sure that the DDR address is beyond 256KB.
  58. In the RPU view, the first 256 KB is TCM memory.
  59. For this use case, with the minimum base address in DDR for TF-A,
  60. the build command example is;
  61. make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
  62. ZYNQMP_ATF_MEM_BASE=0x40000 ZYNQMP_ATF_MEM_SIZE=<size>
  63. Configurable Stack Size
  64. -----------------------
  65. The stack size in TF-A for ZynqMP platform is configurable.
  66. The custom package can define the desired stack size as per the requirement in
  67. the make file as follows,
  68. PLATFORM_STACK_SIZE := <value>
  69. $(eval $(call add_define,PLATFORM_STACK_SIZE))
  70. FSBL->TF-A Parameter Passing
  71. ----------------------------
  72. The FSBL populates a data structure with image information for TF-A. TF-A uses
  73. that data to hand off to the loaded images. The address of the handoff data
  74. structure is passed in the ``PMU_GLOBAL.GLOBAL_GEN_STORAGE6`` register. The
  75. register is free to be used by other software once TF-A has brought up
  76. further firmware images.
  77. Power Domain Tree
  78. -----------------
  79. The following power domain tree represents the power domain model used by TF-A
  80. for ZynqMP:
  81. ::
  82. +-+
  83. |0|
  84. +-+
  85. +-------+---+---+-------+
  86. | | | |
  87. | | | |
  88. v v v v
  89. +-+ +-+ +-+ +-+
  90. |0| |1| |2| |3|
  91. +-+ +-+ +-+ +-+
  92. The 4 leaf power domains represent the individual A53 cores, while resources
  93. common to the cluster are grouped in the power domain on the top.
  94. CUSTOM SIP service support
  95. --------------------------
  96. - Dedicated SMC FID ZYNQMP_SIP_SVC_CUSTOM(0x82002000)(32-bit)/
  97. (0xC2002000)(64-bit) to be used by a custom package for
  98. providing CUSTOM SIP service.
  99. - by default platform provides bare minimum definition for
  100. custom_smc_handler in this service.
  101. - to use this service, custom package should implement their
  102. smc handler with the name custom_smc_handler. once custom package is
  103. included in TF-A build, their definition of custom_smc_handler is
  104. enabled.
  105. Custom package makefile fragment inclusion in TF-A build
  106. --------------------------------------------------------
  107. - custom package is not directly part of TF-A source.
  108. - <CUSTOM_PKG_PATH> is the location at which user clones a
  109. custom package locally.
  110. - custom package needs to implement makefile fragment named
  111. custom_pkg.mk so as to get included in TF-A build.
  112. - custom_pkg.mk specify all the rules to include custom package
  113. specific header files, dependent libs, source files that are
  114. supposed to be included in TF-A build.
  115. - when <CUSTOM_PKG_PATH> is specified in TF-A build command,
  116. custom_pkg.mk is included from <CUSTOM_PKG_PATH> in TF-A build.
  117. - TF-A build command:
  118. make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1
  119. bl31 CUSTOM_PKG_PATH=<...>
  120. Reference DEN0028E SMC calling convention
  121. ------------------------------------------
  122. Allocated subranges of Function Identifier to SIP services
  123. ------------------------------------------------------------
  124. +-----------------------+-------------------------------------------------------+
  125. | SMC Function | Identifier Service type |
  126. +-----------------------+-------------------------------------------------------+
  127. | 0xC2000000-0xC200FFFF | Fast SMC64 SiP Service Calls as per SMCCC Section 6.1 |
  128. +-----------------------+-------------------------------------------------------+
  129. IPI SMC call ranges
  130. -------------------
  131. +---------------------------+-----------------------------------------------------------+
  132. | SMC Function Identifier | Service type |
  133. +---------------------------+-----------------------------------------------------------+
  134. | 0xc2001000-0xc2001FFF | Fast SMC64 SiP Service call range used for AMD-Xilinx IPI |
  135. +---------------------------+-----------------------------------------------------------+
  136. PM SMC call ranges
  137. ------------------
  138. +---------------------------+---------------------------------------------------------------------------+
  139. | SMC Function Identifier | Service type |
  140. +---------------------------+---------------------------------------------------------------------------+
  141. | 0xc2000000-0xc2000FFF | Fast SMC64 SiP Service call range used for AMD-Xilinx Platform Management |
  142. +---------------------------+---------------------------------------------------------------------------+
  143. SMC function IDs for SiP Service queries
  144. ----------------------------------------
  145. +--------------+--------------+--------------+
  146. | Service | Call UID | Revision |
  147. +--------------+--------------+--------------+
  148. | SiP Service | 0x8200_FF01 | 0x8200_FF03 |
  149. +--------------+--------------+--------------+
  150. Call UID Query – Returns a unique identifier of the service provider.
  151. Revision Query – Returns revision details of the service implementor.
  152. CUSTOM SIP service support
  153. --------------------------
  154. +-------------+------------+------------+
  155. | Service | 32-bit | 64-bit |
  156. +-------------+------------+------------+
  157. | SiP Service | 0x82002000 | 0xC2002000 |
  158. +-------------+------------+------------+