[PATCH v4.1 10/9] spl: Convert NVMe to spl_load

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Jul 27 17:06:54 CEST 2023


On 24.07.23 20:09, Sean Anderson wrote:
> This converts the blk load method (used exclusively by NVMe) to use
> spl_load. As a consequence, it also adds support for LOAD_FIT_FULL and
> IMX images.
>
> Signed-off-by: Sean Anderson <sean.anderson at seco.com>
> ---
> As suggested by Heinrich.
>
>   common/spl/spl_blk_fs.c | 62 ++++++++++-------------------------------
>   1 file changed, 14 insertions(+), 48 deletions(-)
>
> diff --git a/common/spl/spl_blk_fs.c b/common/spl/spl_blk_fs.c
> index d97adc4d39a..a0992f3838a 100644
> --- a/common/spl/spl_blk_fs.c
> +++ b/common/spl/spl_blk_fs.c
> @@ -50,6 +50,12 @@ int spl_blk_load_image(struct spl_image_info *spl_image,
>   	loff_t actlen, filesize;
>   	struct blk_dev dev;
>   	int ret;
> +	struct spl_load_info load = {
> +		.read = spl_fit_read,
> +		.bl_len = 1,
> +		.filename = filename,
> +		.priv = &dev,
> +	};
>
>   	blk_desc = blk_get_devnum_by_uclass_id(uclass_id, devnum);
>   	if (!blk_desc) {
> @@ -75,6 +81,13 @@ int spl_blk_load_image(struct spl_image_info *spl_image,
>   		goto out;
>   	}
>
> +	ret = fs_size(filename, &filesize);
> +	if (ret) {
> +		printf("spl: unable to get file size: %s. Err - %d\n",
> +		       filename, ret);
> +		goto out;
> +	}
> +
>   	ret = fs_read(filename, (ulong)header, 0,
>   		      sizeof(struct legacy_img_hdr), &actlen);
>   	if (ret) {
> @@ -83,52 +96,5 @@ int spl_blk_load_image(struct spl_image_info *spl_image,
>   		goto out

Hello Sean,

Unfortunately this does not build.

Here you have a goto out but below you delete the label.

+common/spl/spl_blk_fs.c: In function 'spl_blk_load_image':
+common/spl/spl_blk_fs.c:96:17: error: label 'out' used but not defined
+   96 |                 goto out;
+      |                 ^~~~

Could you respin the complete series with all 10 patches, please.

Best regards

Heinrich

;
>   	}
>
> -	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
> -	    image_get_magic(header) == FDT_MAGIC) {
> -		struct spl_load_info load;
> -
> -		debug("Found FIT\n");
> -		load.read = spl_fit_read;
> -		load.bl_len = 1;
> -		load.filename = (void *)filename;
> -		load.priv = &dev;
> -
> -		return spl_load_simple_fit(spl_image, &load, 0, header);
> -	}
> -
> -	ret = spl_parse_image_header(spl_image, bootdev, header);
> -	if (ret) {
> -		printf("spl: unable to parse image header. Err - %d\n",
> -		       ret);
> -		goto out;
> -	}
> -
> -	ret = fs_set_blk_dev(dev.ifname, dev.dev_part_str, FS_TYPE_ANY);
> -	if (ret) {
> -		printf("spl: unable to set blk_dev %s %s. Err - %d\n",
> -		       dev.ifname, dev.dev_part_str, ret);
> -		goto out;
> -	}
> -
> -	ret = fs_size(filename, &filesize);
> -	if (ret) {
> -		printf("spl: unable to get file size: %s. Err - %d\n",
> -		       filename, ret);
> -		goto out;
> -	}
> -
> -	ret = fs_set_blk_dev(dev.ifname, dev.dev_part_str, FS_TYPE_ANY);
> -	if (ret) {
> -		printf("spl: unable to set blk_dev %s %s. Err - %d\n",
> -		       dev.ifname, dev.dev_part_str, ret);
> -		goto out;
> -	}
> -
> -	ret = fs_read(filename, (ulong)spl_image->load_addr, 0, filesize,
> -		      &actlen);
> -	if (ret)
> -		printf("spl: unable to read file %s. Err - %d\n",
> -		       filename, ret);
> -out:
> -	return ret;
> +	return spl_load(spl_image, bootdev, &load, header, filesize, 0);
>   }



More information about the U-Boot mailing list