[PATCH] xilinx: Do not call private env_get_location() when !ENV_IS_NOWHERE
Michal Simek
michal.simek at amd.com
Tue Apr 2 15:07:30 CEST 2024
On 3/22/24 12:43, Michal Simek wrote:
> Private function for finding out location of environment is not working
> when ENV_IS_NOWHERE is disabled.
> The reason is that current fallback is ENVL_UNKNOWN when
> CONFIG_ENV_IS_NOWHERE is not enabled. The code could be updated like this
>
> - return ENVL_NOWHERE;
> + if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
> + return ENVL_NOWHERE;
> + return ENVL_UNKNOWN;
>
> But then boot is still not working because ENVL_UNKNOWN has no driver and
> env_init() returns -ENODEV. That's why it is better not to define board
> specific env_get_location() because then weak env_get_location() is used
> which is going over env_locations[] and returning locations which are
> actually enabled in u-boot instance.
>
> Signed-off-by: Michal Simek <michal.simek at amd.com>
> ---
>
> board/xilinx/versal-net/board.c | 2 ++
> board/xilinx/versal/board.c | 2 ++
> board/xilinx/zynqmp/zynqmp.c | 2 ++
> 3 files changed, 6 insertions(+)
>
> diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
> index aecaeb657453..da03024e162f 100644
> --- a/board/xilinx/versal-net/board.c
> +++ b/board/xilinx/versal-net/board.c
> @@ -372,6 +372,7 @@ void reset_cpu(void)
> {
> }
>
> +#if defined(CONFIG_ENV_IS_NOWHERE)
> enum env_location env_get_location(enum env_operation op, int prio)
> {
> u8 bootmode = versal_net_get_bootmode();
> @@ -401,3 +402,4 @@ enum env_location env_get_location(enum env_operation op, int prio)
> return ENVL_NOWHERE;
> }
> }
> +#endif
> diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
> index 8c2e614ad8a0..4f6d56119db1 100644
> --- a/board/xilinx/versal/board.c
> +++ b/board/xilinx/versal/board.c
> @@ -291,6 +291,7 @@ void reset_cpu(void)
> {
> }
>
> +#if defined(CONFIG_ENV_IS_NOWHERE)
> enum env_location env_get_location(enum env_operation op, int prio)
> {
> u32 bootmode = versal_get_bootmode();
> @@ -320,3 +321,4 @@ enum env_location env_get_location(enum env_operation op, int prio)
> return ENVL_NOWHERE;
> }
> }
> +#endif
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index ba49eb7be229..79daaf8723ac 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -588,6 +588,7 @@ int mmc_get_env_dev(void)
> return bootseq;
> }
>
> +#if defined(CONFIG_ENV_IS_NOWHERE)
> enum env_location env_get_location(enum env_operation op, int prio)
> {
> u32 bootmode = zynqmp_get_bootmode();
> @@ -621,6 +622,7 @@ enum env_location env_get_location(enum env_operation op, int prio)
> return ENVL_NOWHERE;
> }
> }
> +#endif
>
> #if defined(CONFIG_SET_DFU_ALT_INFO)
>
Applied.
M
More information about the U-Boot
mailing list