124dba2b3SPaul BeesleyXilinx Zynq UltraScale+ MPSoC 224dba2b3SPaul Beesley============================= 36f625747SDouglas Raillard 44def07d5SDan HandleyTrusted Firmware-A (TF-A) implements the EL3 firmware layer for Xilinx Zynq 56f625747SDouglas RaillardUltraScale + MPSoC. 64def07d5SDan HandleyThe platform only uses the runtime part of TF-A as ZynqMP already has a 76f625747SDouglas RaillardBootROM (BL1) and FSBL (BL2). 86f625747SDouglas Raillard 94def07d5SDan HandleyBL31 is TF-A. 106f625747SDouglas RaillardBL32 is an optional Secure Payload. 116f625747SDouglas RaillardBL33 is the non-secure world software (U-Boot, Linux etc). 126f625747SDouglas Raillard 136f625747SDouglas RaillardTo build: 146f625747SDouglas Raillard 156f625747SDouglas Raillard.. code:: bash 166f625747SDouglas Raillard 17e8e7cdf3SVenkatesh Yadav Abbarapu make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 bl31 186f625747SDouglas Raillard 196f625747SDouglas RaillardTo build bl32 TSP you have to rebuild bl31 too: 206f625747SDouglas Raillard 216f625747SDouglas Raillard.. code:: bash 226f625747SDouglas Raillard 23e8e7cdf3SVenkatesh Yadav Abbarapu make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp SPD=tspd RESET_TO_BL31=1 bl31 bl32 246f625747SDouglas Raillard 25c00baeecSVenkatesh Yadav AbbarapuTo build TF-A for JTAG DCC console: 26c00baeecSVenkatesh Yadav Abbarapu 27c00baeecSVenkatesh Yadav Abbarapu.. code:: bash 28c00baeecSVenkatesh Yadav Abbarapu 29c00baeecSVenkatesh Yadav Abbarapu make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 bl31 ZYNQMP_CONSOLE=dcc 30c00baeecSVenkatesh Yadav Abbarapu 316f625747SDouglas RaillardZynqMP platform specific build options 3224dba2b3SPaul Beesley-------------------------------------- 336f625747SDouglas Raillard 34c52a142bSAkshay Belsare- ``XILINX_OF_BOARD_DTB_ADDR`` : Specifies the base address of Device tree. 356f625747SDouglas Raillard- ``ZYNQMP_ATF_MEM_BASE``: Specifies the base address of the bl31 binary. 366f625747SDouglas Raillard- ``ZYNQMP_ATF_MEM_SIZE``: Specifies the size of the memory region of the bl31 binary. 376f625747SDouglas Raillard- ``ZYNQMP_BL32_MEM_BASE``: Specifies the base address of the bl32 binary. 386f625747SDouglas Raillard- ``ZYNQMP_BL32_MEM_SIZE``: Specifies the size of the memory region of the bl32 binary. 396f625747SDouglas Raillard 406f625747SDouglas Raillard- ``ZYNQMP_CONSOLE``: Select the console driver. Options: 416f625747SDouglas Raillard 426f625747SDouglas Raillard - ``cadence``, ``cadence0``: Cadence UART 0 436f625747SDouglas Raillard - ``cadence1`` : Cadence UART 1 446f625747SDouglas Raillard 452537f072SAkshay BelsareZynqMP Debug behavior 462537f072SAkshay Belsare--------------------- 472537f072SAkshay Belsare 482537f072SAkshay BelsareWith DEBUG=1, TF-A for ZynqMP uses DDR memory range instead of OCM memory range 492537f072SAkshay Belsaredue to size constraints. 502537f072SAkshay BelsareFor DEBUG=1 configuration for ZynqMP the BL31_BASE is set to the DDR location 51c52a142bSAkshay Belsareof 0x1000 and BL31_LIMIT is set to DDR location of 0x7FFFF. By default the 52c52a142bSAkshay Belsareabove memory range will NOT be reserved in device tree. 532537f072SAkshay Belsare 54c52a142bSAkshay BelsareTo reserve the above memory range in device tree, the device tree base address 55c52a142bSAkshay Belsaremust be provided during build as, 562537f072SAkshay Belsare 572537f072SAkshay Belsaremake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \ 58c52a142bSAkshay Belsare XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31 59c52a142bSAkshay Belsare 60c52a142bSAkshay BelsareThe default DTB base address for ZynqMP platform is 0x100000. This default value 61c52a142bSAkshay Belsareis not set in the code and to use this default address, user still needs to 62c52a142bSAkshay Belsareprovide it through the build command as above. 63c52a142bSAkshay Belsare 64c52a142bSAkshay BelsareIf the user wants to move the bl31 to a different DDR location, user can provide 65c52a142bSAkshay Belsarethe DDR address location using the build time parameters ZYNQMP_ATF_MEM_BASE and 66c52a142bSAkshay BelsareZYNQMP_ATF_MEM_SIZE. 67c52a142bSAkshay Belsare 68c52a142bSAkshay BelsareThe DDR address must be reserved in the DTB by the user, either by manually 69c52a142bSAkshay Belsareadding the reserved memory node, in the device tree, with the required address 70c52a142bSAkshay Belsarerange OR let TF-A modify the device tree on the run. 71c52a142bSAkshay Belsare 72c52a142bSAkshay BelsareTo let TF-A access and modify the device tree, the DTB address must be provided 73c52a142bSAkshay Belsareto the build command as follows, 74c52a142bSAkshay Belsare 75c52a142bSAkshay Belsaremake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \ 76c52a142bSAkshay Belsare ZYNQMP_ATF_MEM_BASE=<DDR address> ZYNQMP_ATF_MEM_SIZE=<size> \ 77c52a142bSAkshay Belsare XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31 782537f072SAkshay Belsare 79*2b932f83SBelsare, AkshayDDR Address Range Usage 80*2b932f83SBelsare, Akshay----------------------- 81*2b932f83SBelsare, Akshay 82*2b932f83SBelsare, AkshayWhen FSBL runs on RPU and TF-A is to be placed in DDR address range, 83*2b932f83SBelsare, Akshaythen the user needs to make sure that the DDR address is beyond 256KB. 84*2b932f83SBelsare, AkshayIn the RPU view, the first 256 KB is TCM memory. 85*2b932f83SBelsare, Akshay 86*2b932f83SBelsare, AkshayFor this use case, with the minimum base address in DDR for TF-A, 87*2b932f83SBelsare, Akshaythe build command example is; 88*2b932f83SBelsare, Akshay 89*2b932f83SBelsare, Akshaymake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \ 90*2b932f83SBelsare, Akshay ZYNQMP_ATF_MEM_BASE=0x40000 ZYNQMP_ATF_MEM_SIZE=<size> 912537f072SAkshay Belsare 924def07d5SDan HandleyFSBL->TF-A Parameter Passing 9324dba2b3SPaul Beesley---------------------------- 946f625747SDouglas Raillard 954def07d5SDan HandleyThe FSBL populates a data structure with image information for TF-A. TF-A uses 964def07d5SDan Handleythat data to hand off to the loaded images. The address of the handoff data 976f625747SDouglas Raillardstructure is passed in the ``PMU_GLOBAL.GLOBAL_GEN_STORAGE6`` register. The 984def07d5SDan Handleyregister is free to be used by other software once TF-A has brought up 996f625747SDouglas Raillardfurther firmware images. 1006f625747SDouglas Raillard 1016f625747SDouglas RaillardPower Domain Tree 10224dba2b3SPaul Beesley----------------- 1036f625747SDouglas Raillard 1044def07d5SDan HandleyThe following power domain tree represents the power domain model used by TF-A 1054def07d5SDan Handleyfor ZynqMP: 1066f625747SDouglas Raillard 1076f625747SDouglas Raillard:: 1086f625747SDouglas Raillard 1096f625747SDouglas Raillard +-+ 1106f625747SDouglas Raillard |0| 1116f625747SDouglas Raillard +-+ 1126f625747SDouglas Raillard +-------+---+---+-------+ 1136f625747SDouglas Raillard | | | | 1146f625747SDouglas Raillard | | | | 1156f625747SDouglas Raillard v v v v 1166f625747SDouglas Raillard +-+ +-+ +-+ +-+ 1176f625747SDouglas Raillard |0| |1| |2| |3| 1186f625747SDouglas Raillard +-+ +-+ +-+ +-+ 1196f625747SDouglas Raillard 1206f625747SDouglas RaillardThe 4 leaf power domains represent the individual A53 cores, while resources 1216f625747SDouglas Raillardcommon to the cluster are grouped in the power domain on the top. 122496d7081SAmit Nagal 123496d7081SAmit NagalCUSTOM SIP service support 124496d7081SAmit Nagal-------------------------- 125496d7081SAmit Nagal 126496d7081SAmit Nagal- Dedicated SMC FID ZYNQMP_SIP_SVC_CUSTOM(0x82002000)(32-bit)/ 127496d7081SAmit Nagal (0xC2002000)(64-bit) to be used by a custom package for 128496d7081SAmit Nagal providing CUSTOM SIP service. 129496d7081SAmit Nagal 130496d7081SAmit Nagal- by default platform provides bare minimum definition for 131496d7081SAmit Nagal custom_smc_handler in this service. 132496d7081SAmit Nagal 133496d7081SAmit Nagal- to use this service, custom package should implement their 134496d7081SAmit Nagal smc handler with the name custom_smc_handler. once custom package is 135496d7081SAmit Nagal included in TF-A build, their definition of custom_smc_handler is 136496d7081SAmit Nagal enabled. 137496d7081SAmit Nagal 138496d7081SAmit NagalCustom package makefile fragment inclusion in TF-A build 139496d7081SAmit Nagal-------------------------------------------------------- 140496d7081SAmit Nagal 141496d7081SAmit Nagal- custom package is not directly part of TF-A source. 142496d7081SAmit Nagal 143496d7081SAmit Nagal- <CUSTOM_PKG_PATH> is the location at which user clones a 144496d7081SAmit Nagal custom package locally. 145496d7081SAmit Nagal 146496d7081SAmit Nagal- custom package needs to implement makefile fragment named 147496d7081SAmit Nagal custom_pkg.mk so as to get included in TF-A build. 148496d7081SAmit Nagal 149496d7081SAmit Nagal- custom_pkg.mk specify all the rules to include custom package 150496d7081SAmit Nagal specific header files, dependent libs, source files that are 151496d7081SAmit Nagal supposed to be included in TF-A build. 152496d7081SAmit Nagal 153496d7081SAmit Nagal- when <CUSTOM_PKG_PATH> is specified in TF-A build command, 154496d7081SAmit Nagal custom_pkg.mk is included from <CUSTOM_PKG_PATH> in TF-A build. 155496d7081SAmit Nagal 156496d7081SAmit Nagal- TF-A build command: 157496d7081SAmit Nagal make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 158496d7081SAmit Nagal bl31 CUSTOM_PKG_PATH=<...> 159