[PATCH 13/17] arm: smh: Remove smhload command

Sean Anderson sean.anderson at seco.com
Thu Mar 3 21:43:56 CET 2022


This command's functionality is now completely implemented by the
standard fs load command. Convert the vexpress64 boot command (which is
the only user) and remove the implementation.

Signed-off-by: Sean Anderson <sean.anderson at seco.com>
---

 arch/arm/lib/semihosting.c             | 76 --------------------------
 configs/vexpress_aemv8a_semi_defconfig |  2 +-
 2 files changed, 1 insertion(+), 77 deletions(-)

diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index 45cd566cfc..57ab25294f 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -10,8 +10,6 @@
  * available in silicon now, fastmodel usage makes less sense for them.
  */
 #include <common.h>
-#include <command.h>
-#include <env.h>
 #include <log.h>
 #include <semihosting.h>
 
@@ -169,77 +167,3 @@ long smh_seek(long fd, long pos)
 		return smh_errno();
 	return 0;
 }
-
-static int smh_load_file(const char * const name, ulong load_addr,
-			 ulong *size)
-{
-	long fd;
-	long len;
-	long ret;
-
-	fd = smh_open(name, MODE_READ | MODE_BINARY);
-	if (fd < 0)
-		return fd;
-
-	len = smh_flen(fd);
-	if (len < 0) {
-		smh_close(fd);
-		return len;
-	}
-
-	ret = smh_read(fd, (void *)load_addr, len);
-	smh_close(fd);
-
-	if (ret == len) {
-		*size = len;
-		printf("loaded file %s from %08lX to %08lX, %08lX bytes\n",
-		       name,
-		       load_addr,
-		       load_addr + len - 1,
-		       len);
-	} else if (ret >= 0) {
-		ret = -EAGAIN;
-	}
-
-	if (ret < 0) {
-		printf("read failed: %ld\n", ret);
-		return ret;
-	}
-
-	return 0;
-}
-
-static int do_smhload(struct cmd_tbl *cmdtp, int flag, int argc,
-		      char *const argv[])
-{
-	if (argc == 3 || argc == 4) {
-		ulong load_addr;
-		ulong size = 0;
-		int ret;
-		char size_str[64];
-
-		load_addr = hextoul(argv[2], NULL);
-		if (!load_addr)
-			return -1;
-
-		ret = smh_load_file(argv[1], load_addr, &size);
-		if (ret < 0)
-			return CMD_RET_FAILURE;
-
-		/* Optionally save returned end to the environment */
-		if (argc == 4) {
-			sprintf(size_str, "0x%08lx", size);
-			env_set(argv[3], size_str);
-		}
-	} else {
-		return CMD_RET_USAGE;
-	}
-	return 0;
-}
-
-U_BOOT_CMD(smhload, 4, 0, do_smhload, "load a file using semihosting",
-	   "<file> 0x<address> [end var]\n"
-	   "    - load a semihosted file to the address specified\n"
-	   "      if the optional [end var] is specified, the end\n"
-	   "      address of the file will be stored in this environment\n"
-	   "      variable.\n");
diff --git a/configs/vexpress_aemv8a_semi_defconfig b/configs/vexpress_aemv8a_semi_defconfig
index 82a5b52f1e..d7771f6260 100644
--- a/configs/vexpress_aemv8a_semi_defconfig
+++ b/configs/vexpress_aemv8a_semi_defconfig
@@ -17,7 +17,7 @@ CONFIG_ANDROID_BOOT_IMAGE=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9"
-CONFIG_BOOTCOMMAND="if smhload ${boot_name} ${boot_addr_r}; then   set bootargs;   abootimg addr ${boot_addr_r};   abootimg get dtb --index=0 fdt_addr_r;   bootm ${boot_addr_r} ${boot_addr_r}   ${fdt_addr_r}; else;   set fdt_high 0xffffffffffffffff;   set initrd_high 0xffffffffffffffff;   smhload ${kernel_name} ${kernel_addr};   smhload ${fdtfile} ${fdt_addr_r};   smhload ${ramdisk_name} ${ramdisk_addr_r}   ramdisk_end;   fdt addr ${fdt_addr_r}; fdt resize;   fdt chosen ${ramdisk_addr_r} ${ramdisk_end};   booti $kernel_addr - $fdt_addr_r; fi"
+CONFIG_BOOTCOMMAND="if load hostfs ${boot_addr_r} ${boot_name}; then   set bootargs;   abootimg addr ${boot_addr_r};   abootimg get dtb --index=0 fdt_addr_r;   bootm ${boot_addr_r} ${boot_addr_r}   ${fdt_addr_r}; else;   set fdt_high 0xffffffffffffffff;   set initrd_high 0xffffffffffffffff;   load hostfs ${kernel_addr} ${kernel_name};   load hostfs ${fdt_addr_r} ${fdtfile};   load ${ramdisk_addr_r} ${ramdisk_name};   fdt addr ${fdt_addr_r}; fdt resize;   fdt chosen ${ramdisk_addr_r} ${filesize};   booti $kernel_addr - $fdt_addr_r; fi"
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SYS_PROMPT="VExpress64# "
-- 
2.25.1



More information about the U-Boot mailing list