]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
e887afc9 WD |
2 | /* |
3 | * (C) Copyright 2001 | |
4 | * Denis Peter, MPL AG Switzerland | |
e887afc9 WD |
5 | */ |
6 | ||
7 | /* | |
8 | * SCSI support. | |
9 | */ | |
d678a59d | 10 | #include <common.h> |
e6f6f9e6 | 11 | #include <blk.h> |
e887afc9 | 12 | #include <command.h> |
e887afc9 | 13 | #include <scsi.h> |
e887afc9 WD |
14 | |
15 | static int scsi_curr_dev; /* current device */ | |
16 | ||
11f610ed | 17 | /* |
e887afc9 WD |
18 | * scsi boot command intepreter. Derived from diskboot |
19 | */ | |
09140113 SG |
20 | static int do_scsiboot(struct cmd_tbl *cmdtp, int flag, int argc, |
21 | char *const argv[]) | |
e887afc9 | 22 | { |
7405a133 | 23 | return common_diskboot(cmdtp, "scsi", argc, argv); |
e887afc9 WD |
24 | } |
25 | ||
11f610ed | 26 | /* |
e887afc9 WD |
27 | * scsi command intepreter |
28 | */ | |
09140113 SG |
29 | static int do_scsi(struct cmd_tbl *cmdtp, int flag, int argc, |
30 | char *const argv[]) | |
e887afc9 | 31 | { |
c002e39a MS |
32 | int ret; |
33 | ||
1eaadd34 | 34 | if (argc == 2) { |
f1d4d937 SG |
35 | if (strncmp(argv[1], "res", 3) == 0) { |
36 | printf("\nReset SCSI\n"); | |
8eab1a58 | 37 | ret = scsi_scan(true); |
c002e39a MS |
38 | if (ret) |
39 | return CMD_RET_FAILURE; | |
40 | return ret; | |
f1d4d937 | 41 | } |
f1d4d937 | 42 | if (strncmp(argv[1], "scan", 4) == 0) { |
8eab1a58 | 43 | ret = scsi_scan(true); |
c002e39a MS |
44 | if (ret) |
45 | return CMD_RET_FAILURE; | |
46 | return ret; | |
f1d4d937 | 47 | } |
1eaadd34 | 48 | } |
11f610ed | 49 | |
e33a5c6b | 50 | return blk_common_cmd(argc, argv, UCLASS_SCSI, &scsi_curr_dev); |
758c9e69 HTL |
51 | } |
52 | ||
73a9cfde SG |
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 | ); |