From 5ee31baf813123e2816e55cf2b5aaf604770da8b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:05 -0700 Subject: efi: Fix debug message address format This should use U-Boot's standard format for hex address. Fix it. Signed-off-by: Simon Glass Signed-off-by: Alexander Graf --- cmd/bootefi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index c8079c4fe8..3ab256ec51 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -248,7 +248,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) fdt_addr = simple_strtoul(sfdt, NULL, 16); } - printf("## Starting EFI application at 0x%08lx ...\n", addr); + printf("## Starting EFI application at %08lx ...\n", addr); r = do_bootefi_exec((void *)addr, (void*)fdt_addr); printf("## Application terminated, r = %d\n", r); -- cgit From c7ae3dfdccc171543804d6577ee41ab03e7a09bc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:08 -0700 Subject: efi: Add support for a hello world test program It is useful to have a basic sanity check for EFI loader support. Add a 'bootefi hello' command which loads HelloWord.efi and runs it under U-Boot. Signed-off-by: Simon Glass [agraf: Fix documentation, add unfulfilled kconfig dep] Signed-off-by: Alexander Graf --- cmd/Kconfig | 9 +++++++++ cmd/bootefi.c | 27 +++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index e339d8638a..ebcfd6ddaf 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -181,6 +181,15 @@ config CMD_BOOTEFI help Boot an EFI image from memory. +config CMD_BOOTEFI_HELLO + bool "Allow booting a standard EFI hello world for testing" + depends on CMD_BOOTEFI && NEED_CRT0_ENABLEMENT + help + This adds a standard EFI hello world application to U-Boot so that + it can be used with the 'bootefi hello' command. This is useful + for testing that EFI is working at a basic level, and for bringing + up EFI support on a new architecture. + config CMD_ELF bool "bootelf, bootvx" default y diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 3ab256ec51..ae1b713197 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -239,13 +239,23 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc < 2) return CMD_RET_USAGE; - saddr = argv[1]; +#ifdef CONFIG_CMD_BOOTEFI_HELLO + if (!strcmp(argv[1], "hello")) { + ulong size = __efi_hello_world_end - __efi_hello_world_begin; - addr = simple_strtoul(saddr, NULL, 16); + addr = CONFIG_SYS_LOAD_ADDR; + memcpy((char *)addr, __efi_hello_world_begin, size); + } else +#endif + { + saddr = argv[1]; - if (argc > 2) { - sfdt = argv[2]; - fdt_addr = simple_strtoul(sfdt, NULL, 16); + addr = simple_strtoul(saddr, NULL, 16); + + if (argc > 2) { + sfdt = argv[2]; + fdt_addr = simple_strtoul(sfdt, NULL, 16); + } } printf("## Starting EFI application at %08lx ...\n", addr); @@ -263,7 +273,12 @@ static char bootefi_help_text[] = " [fdt address]\n" " - boot EFI payload stored at address .\n" " If specified, the device tree located at gets\n" - " exposed as EFI configuration table.\n"; + " exposed as EFI configuration table.\n" +#ifdef CONFIG_CMD_BOOTEFI_HELLO + "hello\n" + " - boot a sample Hello World application stored within U-Boot" +#endif + ; #endif U_BOOT_CMD( -- cgit From dd46eef2f6e0b7dce2e6bcd85ed8caca5a6b606c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:10 -0700 Subject: efi: arm: Add EFI app support Add support for EFI apps on ARM. This includes start-up and relocation code, plus a link script and some compiler setting changes. Signed-off-by: Simon Glass [agraf: Remove whitespace change, add kconfig dep] Signed-off-by: Alexander Graf --- cmd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index ebcfd6ddaf..a1ce4b790e 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -183,7 +183,7 @@ config CMD_BOOTEFI config CMD_BOOTEFI_HELLO bool "Allow booting a standard EFI hello world for testing" - depends on CMD_BOOTEFI && NEED_CRT0_ENABLEMENT + depends on CMD_BOOTEFI && ARM && !ARM64 help This adds a standard EFI hello world application to U-Boot so that it can be used with the 'bootefi hello' command. This is useful -- cgit From c65d76ed5f81e54d32f280116caaf45119e4670d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:11 -0700 Subject: efi: arm: Add aarch64 EFI app support Add support for EFI apps on aarch64. This includes start-up and relocation code plus a link script. Signed-off-by: Simon Glass [agraf: add kconfig dep] Signed-off-by: Alexander Graf --- cmd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index a1ce4b790e..501ac17d2c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -183,7 +183,7 @@ config CMD_BOOTEFI config CMD_BOOTEFI_HELLO bool "Allow booting a standard EFI hello world for testing" - depends on CMD_BOOTEFI && ARM && !ARM64 + depends on CMD_BOOTEFI && ARM help This adds a standard EFI hello world application to U-Boot so that it can be used with the 'bootefi hello' command. This is useful -- cgit From 5bd828b5329ed9b7c85beae1e532daa710f22168 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:15 -0700 Subject: efi: x86: Adjust EFI files support efi_loader Add compiler flags and make a few minor adjustments to support the efi loader. Signed-off-by: Simon Glass [agraf: Add Kconfig dep] Signed-off-by: Alexander Graf --- cmd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index 501ac17d2c..2a2f23e251 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -183,7 +183,7 @@ config CMD_BOOTEFI config CMD_BOOTEFI_HELLO bool "Allow booting a standard EFI hello world for testing" - depends on CMD_BOOTEFI && ARM + depends on CMD_BOOTEFI && (ARM || X86) help This adds a standard EFI hello world application to U-Boot so that it can be used with the 'bootefi hello' command. This is useful -- cgit From 69bd459d343fe1e5a68a6f187d8c99c78c6fc6ce Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 17 Nov 2016 01:02:58 +0100 Subject: efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 Some boards decided not to run ATF or other secure firmware in EL3, so they instead run U-Boot there. The uEFI spec doesn't know what EL3 is though - it only knows about EL2 and EL1. So if we see that we're running in EL3, let's get into EL2 to make payloads happy. Signed-off-by: Alexander Graf Reviewed-by: York Sun --- cmd/bootefi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cmd') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index ae1b713197..ca411702ba 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -226,6 +226,17 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt) return status == EFI_SUCCESS ? 0 : -EINVAL; } +#ifdef CONFIG_ARM64 + /* On AArch64 we need to make sure we call our payload in < EL3 */ + if (current_el() == 3) { + smp_kick_all_cpus(); + dcache_disable(); /* flush cache before switch to EL2 */ + armv8_switch_to_el2(); + /* Enable caches again */ + dcache_enable(); + } +#endif + return entry(&loaded_image_info, &systab); } -- cgit From 9af5ba878a8cca5af6e03b701367cf28bef39d6d Mon Sep 17 00:00:00 2001 From: Semen Protsenko Date: Mon, 24 Oct 2016 18:41:10 +0300 Subject: fastboot: Add CONFIG_FASTBOOT_USB_DEV option Some boards (like AM57x EVM) has USB OTG controller other than 0. So in order to use correct controller number in compiled environment we should define CONFIG_FASTBOOT_USB_DEV option. For example, when doing "fastboot reboot-bootloader" we want to enter fastboot mode automatically. But to do so we need to provide controller number to "fastboot" command. If this procedure is defined in some config which is common to bunch of boards, and boards have different USB controller numbers, we can't just hardcode "fastboot 0" in the environment. We need to use configurable option, which this patch adds. Signed-off-by: Sam Protsenko Reviewed-by: Tom Rini --- cmd/fastboot/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cmd') diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig index 5d2facc298..d555d0a7ee 100644 --- a/cmd/fastboot/Kconfig +++ b/cmd/fastboot/Kconfig @@ -41,6 +41,14 @@ config FASTBOOT_BUF_SIZE downloads. This buffer should be as large as possible for a platform. Define this to the size available RAM for fastboot. +config FASTBOOT_USB_DEV + int "USB controller number" + default 0 + help + Some boards have USB OTG controller other than 0. Define this + option so it can be used in compiled environment (e.g. in + CONFIG_BOOTCOMMAND). + config FASTBOOT_FLASH bool "Enable FASTBOOT FLASH command" help -- cgit From c294873179ea3a9eb2c51c23f78f2dfae92e4a2d Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 13 Nov 2016 22:26:13 +0100 Subject: fastboot: simplify the Kconfig logic Currently, the fastboot item in menuconfig is a comment followed by a boolean option withan empty prompt, followed by a menu: *** FASTBOOT *** [*] Fastboot support ---> This is not "nice-looking" at all... Change the logic to make the boolean option a "menuconfig" rather than a mere "config", so that all dependent options gets groupped under a menu. The layout is now: *** FASTBOOT *** [*] Fastboot support ---> Signed-off-by: "Yann E. MORIN" Cc: Simon Glass Reviewed-by: Simon Glass Tested-by: Simon Glass --- cmd/fastboot/Kconfig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig index d555d0a7ee..89b9e73440 100644 --- a/cmd/fastboot/Kconfig +++ b/cmd/fastboot/Kconfig @@ -1,10 +1,9 @@ comment "FASTBOOT" -config FASTBOOT - bool "" +menuconfig FASTBOOT + bool "Fastboot support" -menu "Fastboot support" - depends on FASTBOOT +if FASTBOOT config USB_FUNCTION_FASTBOOT bool "Enable USB fastboot gadget" @@ -89,4 +88,4 @@ config FASTBOOT_MBR_NAME endif # USB_FUNCTION_FASTBOOT -endmenu +endif # FASTBOOT -- cgit From ec6617c39741adc6c54952564579e32c3c09c66f Mon Sep 17 00:00:00 2001 From: Alison Wang Date: Thu, 10 Nov 2016 10:49:03 +0800 Subject: armv8: Support loading 32-bit OS in AArch32 execution state To support loading a 32-bit OS, the execution state will change from AArch64 to AArch32 when jumping to kernel. The architecture information will be got through checking FIT image, then U-Boot will load 32-bit OS or 64-bit OS automatically. Signed-off-by: Ebony Zhu Signed-off-by: Alison Wang Signed-off-by: Chenhui Zhao Reviewed-by: York Sun --- cmd/bootefi.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index ca411702ba..97a0fc9c7c 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -141,6 +141,18 @@ static void *copy_fdt(void *fdt) return new_fdt; } +#ifdef CONFIG_ARM64 +static unsigned long efi_run_in_el2(ulong (*entry)(void *image_handle, + struct efi_system_table *st), void *image_handle, + struct efi_system_table *st) +{ + /* Enable caches again */ + dcache_enable(); + + return entry(image_handle, st); +} +#endif + /* * Load an EFI payload into a newly allocated piece of memory, register all * EFI objects it would want to access and jump to it. @@ -231,9 +243,14 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt) if (current_el() == 3) { smp_kick_all_cpus(); dcache_disable(); /* flush cache before switch to EL2 */ - armv8_switch_to_el2(); - /* Enable caches again */ - dcache_enable(); + + /* Move into EL2 and keep running there */ + armv8_switch_to_el2((ulong)entry, (ulong)&loaded_image_info, + (ulong)&systab, (ulong)efi_run_in_el2, + ES_TO_AARCH64); + + /* Should never reach here, efi exits with longjmp */ + while (1) { } } #endif -- cgit From 2f5d532f3b8a7697dc1b5700000b1e350323d50c Mon Sep 17 00:00:00 2001 From: Keerthy Date: Wed, 26 Oct 2016 13:42:30 +0530 Subject: power: regulator: Introduce regulator_set_value_force function In case we want to force a particular value on a regulator irrespective of the min/max constraints for testing purposes one can call regulator_set_value_force function. Signed-off-by: Keerthy Reviewed-by: Simon Glass --- cmd/regulator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/regulator.c b/cmd/regulator.c index bfea6e04b6..2ef5bc9a82 100644 --- a/cmd/regulator.c +++ b/cmd/regulator.c @@ -292,7 +292,10 @@ static int do_value(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_FAILURE; } - ret = regulator_set_value(dev, value); + if (!force) + ret = regulator_set_value(dev, value); + else + ret = regulator_set_value_force(dev, value); if (ret) { printf("Regulator: %s - can't set the Voltage!\n", uc_pdata->name); -- cgit From 95b62b2e28dbc3419f49eeae2e4fdccc862fccea Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 17 Nov 2016 22:40:10 +0100 Subject: efi_loader: Allow to compile helloworld.efi w/o bundling it Today we can compile a self-contained hello world efi test binary that allows us to quickly verify whether the EFI loader framwork works. We can use that binary outside of the self-contained test case though, by providing it to a to-be-tested system via tftp. This patch separates compilation of the helloworld.efi file from including it in the u-boot binary for "bootefi hello". It also modifies the efi_loader test case to enable travis to pick up the compiled file. Because we're now no longer bloating the resulting u-boot binary, we can enable compilation always, giving us good travis test coverage. Signed-off-by: Alexander Graf Reviewed-by: Tom Rini --- cmd/Kconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index 2a2f23e251..b16c6032aa 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -181,9 +181,22 @@ config CMD_BOOTEFI help Boot an EFI image from memory. +config CMD_BOOTEFI_HELLO_COMPILE + bool "Compile a standard EFI hello world binary for testing" + depends on CMD_BOOTEFI && (ARM || X86) + default y + help + This compiles a standard EFI hello world application with U-Boot so + that it can be used with the test/py testing framework. This is useful + for testing that EFI is working at a basic level, and for bringing + up EFI support on a new architecture. + + No additional space will be required in the resulting U-Boot binary + when this option is enabled. + config CMD_BOOTEFI_HELLO bool "Allow booting a standard EFI hello world for testing" - depends on CMD_BOOTEFI && (ARM || X86) + depends on CMD_BOOTEFI_HELLO_COMPILE help This adds a standard EFI hello world application to U-Boot so that it can be used with the 'bootefi hello' command. This is useful -- cgit From aa6ab905b2833ea74ec92fc9d40d6245ff294a07 Mon Sep 17 00:00:00 2001 From: Tang Yuantian Date: Mon, 21 Nov 2016 10:24:20 +0800 Subject: sata: fix sata command can not being executed bug Commit d97dc8a0 separated the non-command code into its own file which caused variable sata_curr_device can not be set to a correct value. Before commit d97dc8a0, variable sata_curr_device can be set correctly in sata_initialize(). After commit d97dc8a0, sata_initialize() is moved out to its own file. Accordingly, variable sata_curr_device is removed from sata_initialize() too. This caused sata_curr_device never gets a chance to be set properly which prevent other commands from being executed. This patch sets variable sata_curr_device properly. Fixes: d97dc8a0 (dm: sata: Separate the non-command code into its own file) Signed-off-by: Tang Yuantian Reviewed-by: Simon Glass --- cmd/sata.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/sata.c b/cmd/sata.c index d18b5233e6..f56622acc2 100644 --- a/cmd/sata.c +++ b/cmd/sata.c @@ -32,9 +32,12 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } /* If the user has not yet run `sata init`, do it now */ - if (sata_curr_device == -1) - if (sata_initialize()) - return 1; + if (sata_curr_device == -1) { + rc = sata_initialize(); + if (rc == -1) + return rc; + sata_curr_device = rc; + } switch (argc) { case 0: -- cgit