]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
spl: atf: add SPL_ATF_NO_PLATFORM_PARAM option
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tue, 2 Jan 2018 20:16:43 +0000 (21:16 +0100)
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Wed, 3 Jan 2018 13:26:57 +0000 (14:26 +0100)
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>
common/spl/Kconfig
common/spl/spl_atf.c

index aef0034b33567983650e0e10a1d88142a1ae7f40..9d35f412336522162e659d6ac9953ad1861c9469 100644 (file)
@@ -721,10 +721,24 @@ config SPL_ATF
        bool "Support ARM Trusted Firmware"
        depends on ARM64
        help
-         ATF(ARM Trusted Firmware) is a component for ARM arch64 which
-         is loaded by SPL(which is considered as BL2 in ATF terminology).
+         ATF(ARM Trusted Firmware) is a component for ARM AArch64 which
+         is loaded by SPL (which is considered as BL2 in ATF terminology).
          More detail at: https://github.com/ARM-software/arm-trusted-firmware
 
+config SPL_ATF_NO_PLATFORM_PARAM
+        bool "Pass no platform parameter"
+       depends on SPL_ATF
+       help
+         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 parameter
+         validation to gracefully reject a FDT being passed.
+
+         If this option is enabled, the spl_atf os-type handler will
+         always pass NULL for the platform parameter.
+
+         If your ATF is affected, say Y.
+
 config TPL
        bool
        depends on SUPPORT_TPL
index 63557c01e8c33417f13c1292bed11ed083a3def4..a942de9964a3cc7e6b2d02e6100e68334636c6d3 100644 (file)
@@ -144,6 +144,7 @@ void spl_invoke_atf(struct spl_image_info *spl_image)
 {
        uintptr_t  bl33_entry = CONFIG_SYS_TEXT_BASE;
        void *blob = spl_image->fdt_addr;
+       uintptr_t platform_param = (uintptr_t)blob;
        int node;
 
        /*
@@ -157,9 +158,18 @@ void spl_invoke_atf(struct spl_image_info *spl_image)
        if (node >= 0)
                bl33_entry = spl_fit_images_get_entry(blob, node);
 
+       /*
+        * If ATF_NO_PLATFORM_PARAM is set, we override the platform
+        * parameter and always pass 0.  This is a workaround for
+        * older ATF versions that have insufficiently robust (or
+        * overzealous) argument validation.
+        */
+       if (CONFIG_IS_ENABLED(ATF_NO_PLATFORM_PARAM))
+               platform_param = 0;
+
        /*
         * We don't provide a BL3-2 entry yet, but this will be possible
         * using similar logic.
         */
-       bl31_entry(spl_image->entry_point, bl33_entry, (uintptr_t)blob);
+       bl31_entry(spl_image->entry_point, bl33_entry, platform_param);
 }