[U-Boot] [PATCH v2 3/3] efi_loader: define all known status codes

Alexander Graf agraf at suse.de
Tue Jul 4 07:17:34 UTC 2017



On 03.07.17 22:41, Heinrich Schuchardt wrote:
> efi.h held only a few EFI status codes.
> 
> The patch adds the missing definitions for later usage.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> v2
> 	This patch was split of version 1 of
> 	efi_loader: provide meaningful status code
> ---
>   include/efi.h | 47 ++++++++++++++++++++++++++++++++++-------------
>   1 file changed, 34 insertions(+), 13 deletions(-)
> 
> diff --git a/include/efi.h b/include/efi.h
> index 3d587807e8..242da3c3be 100644
> --- a/include/efi.h
> +++ b/include/efi.h
> @@ -39,19 +39,40 @@ struct efi_device_path;
>   #define EFI_BITS_PER_LONG	64
>   #endif
>   
> -#define EFI_SUCCESS		0
> -#define EFI_LOAD_ERROR		(1 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_INVALID_PARAMETER	(2 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_UNSUPPORTED		(3 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_BAD_BUFFER_SIZE	(4 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_BUFFER_TOO_SMALL	(5 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_NOT_READY		(6 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_DEVICE_ERROR	(7 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_WRITE_PROTECTED	(8 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_OUT_OF_RESOURCES	(9 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_NOT_FOUND		(14 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_ACCESS_DENIED	(15 | (1UL << (EFI_BITS_PER_LONG - 1)))
> -#define EFI_SECURITY_VIOLATION	(26 | (1UL << (EFI_BITS_PER_LONG - 1)))
> +#define EFI_SUCCESS			0
> +#define EFI_LOAD_ERROR			(1 | (1UL << (EFI_BITS_PER_LONG - 1)))

While you're touching these anyway, would you mind to convert the error 
bit into something more readable?

#define EFI_ERROR_MASK (1UL << (EFI_BITS_PER_LONG - 1))
#define EFI_LOAD_ERROR (EFI_ERROR_MASK | 1)

We can then reuse the same constant in patch 2/3 to mask the bit out of 
the return value ;).


Alex


More information about the U-Boot mailing list