public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: Loic Poulain <loic.poulain@linaro.org>, sjg@chromium.org, marex@denx.de
Cc: u-boot@lists.denx.de, abbaraju.manojsai@amarulasolutions.com
Subject: Re: [PATCH 1/3] spl: fit: Discard decompression if not supported
Date: Sat, 4 Nov 2023 11:10:34 -0400	[thread overview]
Message-ID: <e1a1482a-cf05-005d-817a-96a925cf6f87@gmail.com> (raw)
In-Reply-To: <20231103143426.3643712-1-loic.poulain@linaro.org>

On 11/3/23 10:34, Loic Poulain wrote:
> And simplify further decompression testing.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>   common/spl/spl_fit.c | 27 +++++++++++++++++++++------
>   1 file changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 70d8d5942d..1d42cb1d10 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -208,6 +208,20 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size,
>   	return (data_size + info->bl_len - 1) / info->bl_len;
>   }
>   
> +static inline bool spl_fit_decompression_supported(uint8_t comp)
> +{
> +	switch (comp) {
> +	case IH_COMP_GZIP:
> +		return IS_ENABLED(CONFIG_SPL_GZIP);
> +	case IH_COMP_LZMA:
> +		return IS_ENABLED(CONFIG_SPL_LZMA);
> +	case IH_COMP_NONE:
> +		return true;
> +	}
> +
> +	return false;
> +}
> +
>   /**
>    * load_simple_fit(): load the image described in a certain FIT node
>    * @info:	points to information about the device to load data from
> @@ -235,7 +249,7 @@ static int load_simple_fit(struct spl_load_info *info, ulong sector,
>   	void *src;
>   	ulong overhead;
>   	int nr_sectors;
> -	uint8_t image_comp = -1, type = -1;
> +	uint8_t image_comp, type = -1;
>   	const void *data;
>   	const void *fit = ctx->fit;
>   	bool external_data = false;
> @@ -248,9 +262,11 @@ static int load_simple_fit(struct spl_load_info *info, ulong sector,
>   			debug("%s ", genimg_get_type_name(type));
>   	}
>   
> -	if (spl_decompression_enabled()) {
> -		fit_image_get_comp(fit, node, &image_comp);
> -		debug("%s ", genimg_get_comp_name(image_comp));
> +	fit_image_get_comp(fit, node, &image_comp);
> +	if (!spl_fit_decompression_supported(image_comp)) {
> +		debug("Discard unsupported compression %s ",
> +		      genimg_get_comp_name(image_comp));
> +		image_comp = IH_COMP_NONE;
>   	}
>   
>   	if (fit_image_get_load(fit, node, &load_addr)) {
> @@ -283,8 +299,7 @@ static int load_simple_fit(struct spl_load_info *info, ulong sector,
>   			return 0;
>   		}
>   
> -		if (spl_decompression_enabled() &&
> -		    (image_comp == IH_COMP_GZIP || image_comp == IH_COMP_LZMA))
> +		if (image_comp != IH_COMP_NONE)
>   			src_ptr = map_sysmem(ALIGN(CONFIG_SYS_LOAD_ADDR, ARCH_DMA_MINALIGN), len);
>   		else
>   			src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len);

Why doesn't spl_decompression_enabled work here?

--Sean

      parent reply	other threads:[~2023-11-04 15:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 14:34 [PATCH 1/3] spl: fit: Discard decompression if not supported Loic Poulain
2023-11-03 14:34 ` [PATCH 2/3] spl: fit: Add support for LZO compressed images Loic Poulain
2023-11-04 15:19   ` Sean Anderson
2023-11-03 14:34 ` [PATCH 3/3] spl: fit: Load compressed blob to heap buffer Loic Poulain
2023-11-04 15:13   ` Sean Anderson
2023-11-04 15:10 ` Sean Anderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1a1482a-cf05-005d-817a-96a925cf6f87@gmail.com \
    --to=seanga2@gmail.com \
    --cc=abbaraju.manojsai@amarulasolutions.com \
    --cc=loic.poulain@linaro.org \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox