]> Git Repo - J-u-boot.git/blob - cmd/scsi.c
bootm: Drop arguments from do_bootm_states()
[J-u-boot.git] / cmd / scsi.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2001
4  * Denis Peter, MPL AG Switzerland
5  */
6
7 /*
8  * SCSI support.
9  */
10 #include <common.h>
11 #include <blk.h>
12 #include <command.h>
13 #include <scsi.h>
14
15 static int scsi_curr_dev; /* current device */
16
17 /*
18  * scsi boot command intepreter. Derived from diskboot
19  */
20 static int do_scsiboot(struct cmd_tbl *cmdtp, int flag, int argc,
21                        char *const argv[])
22 {
23         return common_diskboot(cmdtp, "scsi", argc, argv);
24 }
25
26 /*
27  * scsi command intepreter
28  */
29 static int do_scsi(struct cmd_tbl *cmdtp, int flag, int argc,
30                    char *const argv[])
31 {
32         int ret;
33
34         if (argc == 2) {
35                 if (strncmp(argv[1], "res", 3) == 0) {
36                         printf("\nReset SCSI\n");
37                         ret = scsi_scan(true);
38                         if (ret)
39                                 return CMD_RET_FAILURE;
40                         return ret;
41                 }
42                 if (strncmp(argv[1], "scan", 4) == 0) {
43                         ret = scsi_scan(true);
44                         if (ret)
45                                 return CMD_RET_FAILURE;
46                         return ret;
47                 }
48         }
49
50         return blk_common_cmd(argc, argv, UCLASS_SCSI, &scsi_curr_dev);
51 }
52
53 U_BOOT_CMD(
54         scsi, 5, 1, do_scsi,
55         "SCSI sub-system",
56         "reset - reset SCSI controller\n"
57         "scsi info  - show available SCSI devices\n"
58         "scsi scan  - (re-)scan SCSI bus\n"
59         "scsi device [dev] - show or set current device\n"
60         "scsi part [dev] - print partition table of one or all SCSI devices\n"
61         "scsi read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
62         "     to memory address `addr'\n"
63         "scsi write addr blk# cnt - write `cnt' blocks starting at block\n"
64         "     `blk#' from memory address `addr'"
65 );
66
67 U_BOOT_CMD(
68         scsiboot, 3, 1, do_scsiboot,
69         "boot from SCSI device",
70         "loadAddr dev:part"
71 );
This page took 0.02867 seconds and 4 git commands to generate.