1*91f16700SchasingluluXilinx Zynq UltraScale+ MPSoC 2*91f16700Schasinglulu============================= 3*91f16700Schasinglulu 4*91f16700SchasingluluTrusted Firmware-A (TF-A) implements the EL3 firmware layer for Xilinx Zynq 5*91f16700SchasingluluUltraScale + MPSoC. 6*91f16700SchasingluluThe platform only uses the runtime part of TF-A as ZynqMP already has a 7*91f16700SchasingluluBootROM (BL1) and FSBL (BL2). 8*91f16700Schasinglulu 9*91f16700SchasingluluBL31 is TF-A. 10*91f16700SchasingluluBL32 is an optional Secure Payload. 11*91f16700SchasingluluBL33 is the non-secure world software (U-Boot, Linux etc). 12*91f16700Schasinglulu 13*91f16700SchasingluluTo build: 14*91f16700Schasinglulu 15*91f16700Schasinglulu.. code:: bash 16*91f16700Schasinglulu 17*91f16700Schasinglulu make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 bl31 18*91f16700Schasinglulu 19*91f16700SchasingluluTo build bl32 TSP you have to rebuild bl31 too: 20*91f16700Schasinglulu 21*91f16700Schasinglulu.. code:: bash 22*91f16700Schasinglulu 23*91f16700Schasinglulu make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp SPD=tspd RESET_TO_BL31=1 bl31 bl32 24*91f16700Schasinglulu 25*91f16700SchasingluluTo build TF-A for JTAG DCC console: 26*91f16700Schasinglulu 27*91f16700Schasinglulu.. code:: bash 28*91f16700Schasinglulu 29*91f16700Schasinglulu make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 bl31 ZYNQMP_CONSOLE=dcc 30*91f16700Schasinglulu 31*91f16700SchasingluluZynqMP platform specific build options 32*91f16700Schasinglulu-------------------------------------- 33*91f16700Schasinglulu 34*91f16700Schasinglulu- ``XILINX_OF_BOARD_DTB_ADDR`` : Specifies the base address of Device tree. 35*91f16700Schasinglulu- ``ZYNQMP_ATF_MEM_BASE``: Specifies the base address of the bl31 binary. 36*91f16700Schasinglulu- ``ZYNQMP_ATF_MEM_SIZE``: Specifies the size of the memory region of the bl31 binary. 37*91f16700Schasinglulu- ``ZYNQMP_BL32_MEM_BASE``: Specifies the base address of the bl32 binary. 38*91f16700Schasinglulu- ``ZYNQMP_BL32_MEM_SIZE``: Specifies the size of the memory region of the bl32 binary. 39*91f16700Schasinglulu 40*91f16700Schasinglulu- ``ZYNQMP_CONSOLE``: Select the console driver. Options: 41*91f16700Schasinglulu 42*91f16700Schasinglulu - ``cadence``, ``cadence0``: Cadence UART 0 43*91f16700Schasinglulu - ``cadence1`` : Cadence UART 1 44*91f16700Schasinglulu 45*91f16700SchasingluluZynqMP Debug behavior 46*91f16700Schasinglulu--------------------- 47*91f16700Schasinglulu 48*91f16700SchasingluluWith DEBUG=1, TF-A for ZynqMP uses DDR memory range instead of OCM memory range 49*91f16700Schasingluludue to size constraints. 50*91f16700SchasingluluFor DEBUG=1 configuration for ZynqMP the BL31_BASE is set to the DDR location 51*91f16700Schasingluluof 0x1000 and BL31_LIMIT is set to DDR location of 0x7FFFF. By default the 52*91f16700Schasingluluabove memory range will NOT be reserved in device tree. 53*91f16700Schasinglulu 54*91f16700SchasingluluTo reserve the above memory range in device tree, the device tree base address 55*91f16700Schasinglulumust be provided during build as, 56*91f16700Schasinglulu 57*91f16700Schasinglulumake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \ 58*91f16700Schasinglulu XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31 59*91f16700Schasinglulu 60*91f16700SchasingluluThe default DTB base address for ZynqMP platform is 0x100000. This default value 61*91f16700Schasingluluis not set in the code and to use this default address, user still needs to 62*91f16700Schasingluluprovide it through the build command as above. 63*91f16700Schasinglulu 64*91f16700SchasingluluIf the user wants to move the bl31 to a different DDR location, user can provide 65*91f16700Schasingluluthe DDR address location using the build time parameters ZYNQMP_ATF_MEM_BASE and 66*91f16700SchasingluluZYNQMP_ATF_MEM_SIZE. 67*91f16700Schasinglulu 68*91f16700SchasingluluThe DDR address must be reserved in the DTB by the user, either by manually 69*91f16700Schasingluluadding the reserved memory node, in the device tree, with the required address 70*91f16700Schasinglulurange OR let TF-A modify the device tree on the run. 71*91f16700Schasinglulu 72*91f16700SchasingluluTo let TF-A access and modify the device tree, the DTB address must be provided 73*91f16700Schasingluluto the build command as follows, 74*91f16700Schasinglulu 75*91f16700Schasinglulumake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \ 76*91f16700Schasinglulu ZYNQMP_ATF_MEM_BASE=<DDR address> ZYNQMP_ATF_MEM_SIZE=<size> \ 77*91f16700Schasinglulu XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31 78*91f16700Schasinglulu 79*91f16700SchasingluluDDR Address Range Usage 80*91f16700Schasinglulu----------------------- 81*91f16700Schasinglulu 82*91f16700SchasingluluWhen FSBL runs on RPU and TF-A is to be placed in DDR address range, 83*91f16700Schasingluluthen the user needs to make sure that the DDR address is beyond 256KB. 84*91f16700SchasingluluIn the RPU view, the first 256 KB is TCM memory. 85*91f16700Schasinglulu 86*91f16700SchasingluluFor this use case, with the minimum base address in DDR for TF-A, 87*91f16700Schasingluluthe build command example is; 88*91f16700Schasinglulu 89*91f16700Schasinglulumake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \ 90*91f16700Schasinglulu ZYNQMP_ATF_MEM_BASE=0x40000 ZYNQMP_ATF_MEM_SIZE=<size> 91*91f16700Schasinglulu 92*91f16700SchasingluluConfigurable Stack Size 93*91f16700Schasinglulu----------------------- 94*91f16700Schasinglulu 95*91f16700SchasingluluThe stack size in TF-A for ZynqMP platform is configurable. 96*91f16700SchasingluluThe custom package can define the desired stack size as per the requirement in 97*91f16700Schasingluluthe make file as follows, 98*91f16700Schasinglulu 99*91f16700SchasingluluPLATFORM_STACK_SIZE := <value> 100*91f16700Schasinglulu$(eval $(call add_define,PLATFORM_STACK_SIZE)) 101*91f16700Schasinglulu 102*91f16700SchasingluluFSBL->TF-A Parameter Passing 103*91f16700Schasinglulu---------------------------- 104*91f16700Schasinglulu 105*91f16700SchasingluluThe FSBL populates a data structure with image information for TF-A. TF-A uses 106*91f16700Schasingluluthat data to hand off to the loaded images. The address of the handoff data 107*91f16700Schasinglulustructure is passed in the ``PMU_GLOBAL.GLOBAL_GEN_STORAGE6`` register. The 108*91f16700Schasingluluregister is free to be used by other software once TF-A has brought up 109*91f16700Schasinglulufurther firmware images. 110*91f16700Schasinglulu 111*91f16700SchasingluluPower Domain Tree 112*91f16700Schasinglulu----------------- 113*91f16700Schasinglulu 114*91f16700SchasingluluThe following power domain tree represents the power domain model used by TF-A 115*91f16700Schasinglulufor ZynqMP: 116*91f16700Schasinglulu 117*91f16700Schasinglulu:: 118*91f16700Schasinglulu 119*91f16700Schasinglulu +-+ 120*91f16700Schasinglulu |0| 121*91f16700Schasinglulu +-+ 122*91f16700Schasinglulu +-------+---+---+-------+ 123*91f16700Schasinglulu | | | | 124*91f16700Schasinglulu | | | | 125*91f16700Schasinglulu v v v v 126*91f16700Schasinglulu +-+ +-+ +-+ +-+ 127*91f16700Schasinglulu |0| |1| |2| |3| 128*91f16700Schasinglulu +-+ +-+ +-+ +-+ 129*91f16700Schasinglulu 130*91f16700SchasingluluThe 4 leaf power domains represent the individual A53 cores, while resources 131*91f16700Schasinglulucommon to the cluster are grouped in the power domain on the top. 132*91f16700Schasinglulu 133*91f16700SchasingluluCUSTOM SIP service support 134*91f16700Schasinglulu-------------------------- 135*91f16700Schasinglulu 136*91f16700Schasinglulu- Dedicated SMC FID ZYNQMP_SIP_SVC_CUSTOM(0x82002000)(32-bit)/ 137*91f16700Schasinglulu (0xC2002000)(64-bit) to be used by a custom package for 138*91f16700Schasinglulu providing CUSTOM SIP service. 139*91f16700Schasinglulu 140*91f16700Schasinglulu- by default platform provides bare minimum definition for 141*91f16700Schasinglulu custom_smc_handler in this service. 142*91f16700Schasinglulu 143*91f16700Schasinglulu- to use this service, custom package should implement their 144*91f16700Schasinglulu smc handler with the name custom_smc_handler. once custom package is 145*91f16700Schasinglulu included in TF-A build, their definition of custom_smc_handler is 146*91f16700Schasinglulu enabled. 147*91f16700Schasinglulu 148*91f16700SchasingluluCustom package makefile fragment inclusion in TF-A build 149*91f16700Schasinglulu-------------------------------------------------------- 150*91f16700Schasinglulu 151*91f16700Schasinglulu- custom package is not directly part of TF-A source. 152*91f16700Schasinglulu 153*91f16700Schasinglulu- <CUSTOM_PKG_PATH> is the location at which user clones a 154*91f16700Schasinglulu custom package locally. 155*91f16700Schasinglulu 156*91f16700Schasinglulu- custom package needs to implement makefile fragment named 157*91f16700Schasinglulu custom_pkg.mk so as to get included in TF-A build. 158*91f16700Schasinglulu 159*91f16700Schasinglulu- custom_pkg.mk specify all the rules to include custom package 160*91f16700Schasinglulu specific header files, dependent libs, source files that are 161*91f16700Schasinglulu supposed to be included in TF-A build. 162*91f16700Schasinglulu 163*91f16700Schasinglulu- when <CUSTOM_PKG_PATH> is specified in TF-A build command, 164*91f16700Schasinglulu custom_pkg.mk is included from <CUSTOM_PKG_PATH> in TF-A build. 165*91f16700Schasinglulu 166*91f16700Schasinglulu- TF-A build command: 167*91f16700Schasinglulu make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 168*91f16700Schasinglulu bl31 CUSTOM_PKG_PATH=<...> 169