summaryrefslogtreecommitdiff
path: root/common/spl/spl_atf.c
AgeCommit message (Collapse)AuthorFilesLines
2022-10-31Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASESimon Glass1-1/+1
The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE and this makes it imposible to use CONFIG_VAL(). Rename it to resolve this problem. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-11spl: atf: Fix clang -Wasm-operand-widths warningAlistair Delva1-1/+1
common/spl/spl_atf.c:187:51: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory"); ^ common/spl/spl_atf.c:187:34: note: use constraint modifier "w" __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory"); ^~ %w0 Use %x0 to match what Linux does in <asm/sysreg.h> write_sysreg(). Signed-off-by: Alistair Delva <adelva@google.com> Cc: Kever Yang <kever.yang@rock-chips.com> Cc: Michael Walle <michael@walle.cc> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Nick Desaulniers <ndesaulniers@google.com>
2020-12-05spl: atf: add support for LOAD_IMAGE_V2Michael Walle1-4/+95
Newer platforms use the LOAD_IMAGE_V2 parameter passing method. Add support for it. Signed-off-by: Michael Walle <michael@walle.cc>
2020-12-05spl: atf: remove helper structure from common headerMichael Walle1-0/+11
bl2_to_bl31_params_mem is just an implementation detail of the SPL ATF support and is not needed anywhere else. Move it from the header to the actual module. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Michal Simek <michal.simek@xilinx.com>
2020-12-05spl: atf: provide a bl2_plat_get_bl31_params_default()Michael Walle1-3/+11
Move the actual implementation of the bl2_plat_get_bl31_params() to its own function. The weak function will just call the default implementation. This has the advantage that board code can still call the original implementation if it just want to modify minor things. Signed-off-by: Michael Walle <michael@walle.cc>
2020-12-05spl: atf: move storage for bl31_params into functionMichael Walle1-3/+2
There is no need to have the storage available globally. This is also a preparation for LOAD_IMAGE_V2 support. That will introduce a similar generator function which also has its own storage. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Michal Simek <michal.simek@xilinx.com>
2020-10-27spl: Use standard FIT entriesMichal Simek1-3/+4
SPL is creating fit-images DT node when loadables are recorded in selected configuration. Entries which are created are using entry-point and load-addr property names. But there shouldn't be a need to use non standard properties because entry/load are standard FIT properties. But using standard FIT properties enables option to use generic FIT functions to descrease SPL size. Here is result for ZynqMP virt configuration: xilinx_zynqmp_virt: spl/u-boot-spl:all -82 spl/u-boot-spl:rodata -22 spl/u-boot-spl:text -60 The patch causes change in run time fit image record. Before: fit-images { uboot { os = "u-boot"; type = "firmware"; size = <0xfd520>; entry-point = <0x8000000>; load-addr = <0x8000000>; }; }; After: fit-images { uboot { os = "u-boot"; type = "firmware"; size = <0xfd520>; entry = <0x8000000>; load = <0x8000000>; }; }; Replacing calling fdt_getprop_u32() by fit_image_get_entry/load() also enables support for reading entry/load properties recorded in 64bit format. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop image.h from common headerSimon Glass1-0/+1
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop net.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-14spl: atf: Enable option to rewrite bl2_plat_get_bl31_params()Michal Simek1-14/+1
Xilinx ZynqMP platform is passing information to ATF in private format and ATF bl31 parameters are not used. That's why enable option to rewrite this function by platform specific implementation. The patch also move and update kernel-doc format with missing parameters. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2020-01-14spl: atf: Add missing ndepth initializationMichal Simek1-1/+1
ndepth needs to be initialized before it is used in fdt_next_node(). Uninitialized value is causing that node is found and depth increase but won't pass condition below because initial state wasn't setup. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-12-03common: Move some cache and MMU functions out of common.hSimon Glass1-0/+1
These functions belong in cpu_func.h. Another option would be cache.h but that code uses driver model and we have not moved these cache functions to use driver model. Since they are CPU-related it seems reasonable to put them here. Move them over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-11-10common: spl: atf: support booting bl32 imageJoseph Chen1-14/+34
Trusted-Firmware can also initialize a secure payload to use as a trusted execution environment. In general for the arm64 case this is provided as separate image and uboot is supposed to also place it in a predetermined location in memory and add the necessary parameters to the ATF boot params. So add the possibility to get this tee payload from the provided FIT image and setup things as necessary. Tested on a Rockchip PX30 with mainline TF-A, mainline OP-Tee (with pending PX30 support) and mainline 5.4-rc1 Linux kernel. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-07-02spl: atf: Fix uninitialized pointer to bl31_image_infoFrieder Schrempf1-0/+1
The pointer to struct atf_image_info in bl31_params_mem.bl31_params.bl31_image_info is not initialized before being dereferenced. This can cause U-Boot to crash right before jumping to the BL31 ATF binary. Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de> Fixes: bcc1726a7bdd ("spl: add support to booting with ATF") Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-01-28spl: atf: pass NULL for bl32_ep pcKever Yang1-1/+2
ATF use bl32_ep_info->pc to decide if thre is an available bl32, let's mark it as NULL first. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-01-03spl: atf: add SPL_ATF_NO_PLATFORM_PARAM optionPhilipp Tomsich1-1/+11
While we expect to call a pointer to a valid FDT (or NULL) as the platform parameter to an ATF, some ATF versions are not U-Boot aware and have an insufficiently robust (or an overzealour) parameter validation: either way, this may cause a hard-stop with uncooperative ATF versions. This change adds the option to suppress passing a platform parameter and will always pass NULL. Debug output from ATF w/ this option disabled (i.e. default): INFO: plat_param_from_bl2: 0x291450 Debug output from ATF w/ this option enabled: INFO: plat_param_from_bl2: 0 Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-26spl: atf: introduce spl_invoke_atf and make bl31_entry privatePhilipp Tomsich1-8/+76
This adds a new interface spl_invoke_atf() that takes a spl_image_info argument and then derives the necessary parameters for the ATF entry. Based on the additional information recorded (into /fit-images) from the FIT loadables, we can now easily locate the next boot stage. We now pass a pointer to a FDT as the platform-specific parameter pointer to ATF (so we don't run into the future headache of every board/platform defining their own proprietary tag-structure), as FDT access is already available in ATF. With the necessary infrastructure in place, we can now update the support for the ARM Trusted Firmware to dispatch into the spl_invoke_atf function only if a IH_OS_ARM_TRUSTED_FIRMWARE image is loaded. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-15spl: add support to booting with ATFKever Yang1-0/+97
ATF(ARM Trusted Firmware) is used by ARM arch64 SoCs, find more infomation about ATF at: https://github.com/ARM-software/arm-trusted-firmware SPL is considered as BL2 in ATF terminology, it needs to load other parts of ATF binary like BL31, BL32, SCP-BL30, and BL33(U-Boot). And needs to prepare the parameter for BL31 which including entry and image information for all other images. Then the SPL handle PC to BL31 with the parameter, the BL31 will do the rest of work and at last get into U-Boot(BL33). This patch needs work with patches from Andre for SPL support multi binary in FIT. The entry point of bl31 and bl33 are still using hard code because we still can not get them from the FIT image information. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>