xref: /rk3399_ARM-atf/docs/plat/xilinx-zynqmp.rst (revision c52a142b7ceb397b4d66cc90f2bc717acc7263cd)
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
34*c52a142bSAkshay 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
51*c52a142bSAkshay Belsareof 0x1000 and BL31_LIMIT is set to DDR location of 0x7FFFF. By default the
52*c52a142bSAkshay Belsareabove memory range will NOT be reserved in device tree.
532537f072SAkshay Belsare
54*c52a142bSAkshay BelsareTo reserve the above memory range in device tree, the device tree base address
55*c52a142bSAkshay Belsaremust be provided during build as,
562537f072SAkshay Belsare
572537f072SAkshay Belsaremake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
58*c52a142bSAkshay Belsare       XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31
59*c52a142bSAkshay Belsare
60*c52a142bSAkshay BelsareThe default DTB base address for ZynqMP platform is 0x100000. This default value
61*c52a142bSAkshay Belsareis not set in the code and to use this default address, user still needs to
62*c52a142bSAkshay Belsareprovide it through the build command as above.
63*c52a142bSAkshay Belsare
64*c52a142bSAkshay BelsareIf the user wants to move the bl31 to a different DDR location, user can provide
65*c52a142bSAkshay Belsarethe DDR address location using the build time parameters ZYNQMP_ATF_MEM_BASE and
66*c52a142bSAkshay BelsareZYNQMP_ATF_MEM_SIZE.
67*c52a142bSAkshay Belsare
68*c52a142bSAkshay BelsareThe DDR address must be reserved in the DTB by the user, either by manually
69*c52a142bSAkshay Belsareadding the reserved memory node, in the device tree, with the required address
70*c52a142bSAkshay Belsarerange OR let TF-A modify the device tree on the run.
71*c52a142bSAkshay Belsare
72*c52a142bSAkshay BelsareTo let TF-A access and modify the device tree, the DTB address must be provided
73*c52a142bSAkshay Belsareto the build command as follows,
74*c52a142bSAkshay Belsare
75*c52a142bSAkshay Belsaremake CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
76*c52a142bSAkshay Belsare	ZYNQMP_ATF_MEM_BASE=<DDR address> ZYNQMP_ATF_MEM_SIZE=<size> \
77*c52a142bSAkshay Belsare	XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31
782537f072SAkshay Belsare
792537f072SAkshay Belsare
804def07d5SDan HandleyFSBL->TF-A Parameter Passing
8124dba2b3SPaul Beesley----------------------------
826f625747SDouglas Raillard
834def07d5SDan HandleyThe FSBL populates a data structure with image information for TF-A. TF-A uses
844def07d5SDan Handleythat data to hand off to the loaded images. The address of the handoff data
856f625747SDouglas Raillardstructure is passed in the ``PMU_GLOBAL.GLOBAL_GEN_STORAGE6`` register. The
864def07d5SDan Handleyregister is free to be used by other software once TF-A has brought up
876f625747SDouglas Raillardfurther firmware images.
886f625747SDouglas Raillard
896f625747SDouglas RaillardPower Domain Tree
9024dba2b3SPaul Beesley-----------------
916f625747SDouglas Raillard
924def07d5SDan HandleyThe following power domain tree represents the power domain model used by TF-A
934def07d5SDan Handleyfor ZynqMP:
946f625747SDouglas Raillard
956f625747SDouglas Raillard::
966f625747SDouglas Raillard
976f625747SDouglas Raillard                    +-+
986f625747SDouglas Raillard                    |0|
996f625747SDouglas Raillard                    +-+
1006f625747SDouglas Raillard         +-------+---+---+-------+
1016f625747SDouglas Raillard         |       |       |       |
1026f625747SDouglas Raillard         |       |       |       |
1036f625747SDouglas Raillard         v       v       v       v
1046f625747SDouglas Raillard        +-+     +-+     +-+     +-+
1056f625747SDouglas Raillard        |0|     |1|     |2|     |3|
1066f625747SDouglas Raillard        +-+     +-+     +-+     +-+
1076f625747SDouglas Raillard
1086f625747SDouglas RaillardThe 4 leaf power domains represent the individual A53 cores, while resources
1096f625747SDouglas Raillardcommon to the cluster are grouped in the power domain on the top.
110496d7081SAmit Nagal
111496d7081SAmit NagalCUSTOM SIP service support
112496d7081SAmit Nagal--------------------------
113496d7081SAmit Nagal
114496d7081SAmit Nagal- Dedicated SMC FID ZYNQMP_SIP_SVC_CUSTOM(0x82002000)(32-bit)/
115496d7081SAmit Nagal  (0xC2002000)(64-bit) to be used by a custom package for
116496d7081SAmit Nagal  providing CUSTOM SIP service.
117496d7081SAmit Nagal
118496d7081SAmit Nagal- by default platform provides bare minimum definition for
119496d7081SAmit Nagal  custom_smc_handler in this service.
120496d7081SAmit Nagal
121496d7081SAmit Nagal- to use this service, custom package should implement their
122496d7081SAmit Nagal  smc handler with the name custom_smc_handler. once custom package is
123496d7081SAmit Nagal  included in TF-A build, their definition of custom_smc_handler is
124496d7081SAmit Nagal  enabled.
125496d7081SAmit Nagal
126496d7081SAmit NagalCustom package makefile fragment inclusion in TF-A build
127496d7081SAmit Nagal--------------------------------------------------------
128496d7081SAmit Nagal
129496d7081SAmit Nagal- custom package is not directly part of TF-A source.
130496d7081SAmit Nagal
131496d7081SAmit Nagal- <CUSTOM_PKG_PATH> is the location at which user clones a
132496d7081SAmit Nagal  custom package locally.
133496d7081SAmit Nagal
134496d7081SAmit Nagal- custom package needs to implement makefile fragment named
135496d7081SAmit Nagal  custom_pkg.mk so as to get included in TF-A build.
136496d7081SAmit Nagal
137496d7081SAmit Nagal- custom_pkg.mk specify all the rules to include custom package
138496d7081SAmit Nagal  specific header files, dependent libs, source files that are
139496d7081SAmit Nagal  supposed to be included in TF-A build.
140496d7081SAmit Nagal
141496d7081SAmit Nagal- when <CUSTOM_PKG_PATH> is specified in TF-A build command,
142496d7081SAmit Nagal  custom_pkg.mk is included from <CUSTOM_PKG_PATH> in TF-A build.
143496d7081SAmit Nagal
144496d7081SAmit Nagal- TF-A build command:
145496d7081SAmit Nagal  make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1
146496d7081SAmit Nagal  bl31 CUSTOM_PKG_PATH=<...>
147