[PATCH v3 2/2] imx: hab: Make imx_hab_is_enabled dependent on FIELD_RETURN

Marek Vasut marex at denx.de
Thu Oct 17 14:09:48 CEST 2024


On 10/17/24 9:50 AM, Paul Geurts wrote:

[...]

>   bool imx_hab_is_enabled(void)
>   {
> -	struct imx_fuse_t *fuse =
> +	struct imx_fuse_t *sec_config =
>   		(struct imx_fuse_t *)&imx_sec_config_fuse;
> +	struct imx_fuse_t *field_return =
> +		(struct imx_fuse_t *)&imx_field_return_fuse;
>   	uint32_t reg;
> +	bool is_enabled;
>   	int ret;
>   
> -	ret = fuse_read(fuse->bank, fuse->word, &reg);
> +	ret = fuse_read(sec_config->bank, sec_config->word, &reg);
>   	if (ret) {
>   		puts("\nSecure boot fuse read error\n");

Drop the leading \n please.

>   		return ret;
>   	}
> +	is_enabled = (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT;

is_enabled = reg & IS_HAB_ENABLED_BIT;
is enough here.

> +	if (is_enabled) {
> +		ret = fuse_read(field_return->bank, field_return->word, &reg);
> +		if (ret) {
> +			puts("\nField return fuse read error\n");

Drop the leading \n please.

> +			return ret;
> +		}
> +		is_enabled = !((reg & FIELD_RETURN_FUSE_MASK) == FIELD_RETURN_PATTERN);

is_enabled = (reg & FIELD_RETURN_FUSE_MASK) != FIELD_RETURN_PATTERN;

> +	}
>   
> -	return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT;
> +	return is_enabled;
>   }
[...]


More information about the U-Boot mailing list