[U-Boot] [PATCH 1/1] cmd: add el command

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Oct 11 06:08:37 UTC 2018


On 10/11/2018 05:28 AM, Heinrich Schuchardt wrote:
> The 'el' command displays the current exception level of the processor
> on the aarch64 architecture.
> 
> This information is needed to analyze problems in the EFI subsystem.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  cmd/Kconfig  |  7 +++++++
>  cmd/Makefile |  1 +
>  cmd/el.c     | 25 +++++++++++++++++++++++++
>  3 files changed, 33 insertions(+)
>  create mode 100644 cmd/el.c
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 7ed3c9c3b3..cfad07432e 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1373,6 +1373,13 @@ config CMD_DISPLAY
>  	  displayed on a simple board-specific display. Implement
>  	  display_putc() to use it.
>  
> +config CMD_EL
> +	bool "el - display processor exception level"
> +	depends on ARM64
> +	help
> +	  Enable the 'el' command which displays the exception level of the
> +	  processor.
> +
>  config CMD_LED
>  	bool "led"
>  	default y if LED
> diff --git a/cmd/Makefile b/cmd/Makefile
> index d9cdaf6064..63e3afd56b 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -47,6 +47,7 @@ endif
>  obj-$(CONFIG_CMD_DISPLAY) += display.o
>  obj-$(CONFIG_CMD_DTIMG) += dtimg.o
>  obj-$(CONFIG_CMD_ECHO) += echo.o
> +obj-$(CONFIG_CMD_EL) += el.o
>  obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
>  obj-$(CONFIG_CMD_EEPROM) += eeprom.o
>  obj-$(CONFIG_EFI_STUB) += efi.o
> diff --git a/cmd/el.c b/cmd/el.c
> new file mode 100644
> index 0000000000..57081c36f2
> --- /dev/null
> +++ b/cmd/el.c
> @@ -0,0 +1,25 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * The 'el' command prints the current exception level
> + *
> + * Copyright (c) 2018, Heinrich Schuchardt <xypron.glpk at gmx.de>
> + */
> +#include <common.h>
> +#include <command.h>
> +#include <asm/system.h>
> +
> +static int do_el(cmd_tbl_t *cmdtp, int flag, int argc,
> +		 char * const argv[])
> +{
> +	printf("processor exception level: EL%d\n", current_el());
> +	return CMD_RET_SUCCESS;
> +}
> +
> +#ifdef CONFIG_SYS_LONGHELP
> +static char el_help_text[] = "";
> +#endif
> +
> +U_BOOT_CMD_COMPLETE
> +	(el, 2, 0, do_el,
> +	 "display processor exception level",
> +	 el_help_text, NULL);
>
Would it be preferable to include the information about the exception
level to the bdinfo command?

An example where the information came in handy is
https://lists.denx.de/pipermail/u-boot/2018-October/343998.html
efi_loader: PSCI reset and shutdown for EL1

Regards

Heinrich


More information about the U-Boot mailing list