aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot/cmd/scsi.c
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/u-boot/cmd/scsi.c
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/u-boot/cmd/scsi.c')
-rw-r--r--roms/u-boot/cmd/scsi.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/roms/u-boot/cmd/scsi.c b/roms/u-boot/cmd/scsi.c
new file mode 100644
index 000000000..5f710d289
--- /dev/null
+++ b/roms/u-boot/cmd/scsi.c
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2001
+ * Denis Peter, MPL AG Switzerland
+ */
+
+/*
+ * SCSI support.
+ */
+#include <common.h>
+#include <blk.h>
+#include <command.h>
+#include <scsi.h>
+
+static int scsi_curr_dev; /* current device */
+
+/*
+ * scsi boot command intepreter. Derived from diskboot
+ */
+static int do_scsiboot(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ return common_diskboot(cmdtp, "scsi", argc, argv);
+}
+
+/*
+ * scsi command intepreter
+ */
+static int do_scsi(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ int ret;
+
+ if (argc == 2) {
+ if (strncmp(argv[1], "res", 3) == 0) {
+ printf("\nReset SCSI\n");
+#ifndef CONFIG_DM_SCSI
+ scsi_bus_reset(NULL);
+#endif
+ ret = scsi_scan(true);
+ if (ret)
+ return CMD_RET_FAILURE;
+ return ret;
+ }
+ if (strncmp(argv[1], "scan", 4) == 0) {
+ ret = scsi_scan(true);
+ if (ret)
+ return CMD_RET_FAILURE;
+ return ret;
+ }
+ }
+
+ return blk_common_cmd(argc, argv, IF_TYPE_SCSI, &scsi_curr_dev);
+}
+
+U_BOOT_CMD(
+ scsi, 5, 1, do_scsi,
+ "SCSI sub-system",
+ "reset - reset SCSI controller\n"
+ "scsi info - show available SCSI devices\n"
+ "scsi scan - (re-)scan SCSI bus\n"
+ "scsi device [dev] - show or set current device\n"
+ "scsi part [dev] - print partition table of one or all SCSI devices\n"
+ "scsi read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
+ " to memory address `addr'\n"
+ "scsi write addr blk# cnt - write `cnt' blocks starting at block\n"
+ " `blk#' from memory address `addr'"
+);
+
+U_BOOT_CMD(
+ scsiboot, 3, 1, do_scsiboot,
+ "boot from SCSI device",
+ "loadAddr dev:part"
+);