wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Denis Peter, MPL AG Switzerland |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * SCSI support. |
| 10 | */ |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 11 | #include <common.h> |
| 12 | #include <command.h> |
Simon Glass | f360947 | 2014-10-15 04:38:37 -0600 | [diff] [blame] | 13 | #include <inttypes.h> |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 14 | #include <asm/processor.h> |
| 15 | #include <scsi.h> |
| 16 | #include <image.h> |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 17 | #include <pci.h> |
| 18 | |
Vadim Bendebury | 4ae5eb7 | 2012-10-29 05:23:45 +0000 | [diff] [blame] | 19 | #ifdef CONFIG_SCSI_DEV_LIST |
| 20 | #define SCSI_DEV_LIST CONFIG_SCSI_DEV_LIST |
| 21 | #else |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 22 | #ifdef CONFIG_SCSI_SYM53C8XX |
| 23 | #define SCSI_VEND_ID 0x1000 |
| 24 | #ifndef CONFIG_SCSI_DEV_ID |
| 25 | #define SCSI_DEV_ID 0x0001 |
| 26 | #else |
| 27 | #define SCSI_DEV_ID CONFIG_SCSI_DEV_ID |
| 28 | #endif |
Jin Zhengxiong | 4782ac8 | 2006-08-23 19:10:44 +0800 | [diff] [blame] | 29 | #elif defined CONFIG_SATA_ULI5288 |
| 30 | |
| 31 | #define SCSI_VEND_ID 0x10b9 |
| 32 | #define SCSI_DEV_ID 0x5288 |
| 33 | |
Rob Herring | 942e314 | 2011-07-06 16:13:36 +0000 | [diff] [blame] | 34 | #elif !defined(CONFIG_SCSI_AHCI_PLAT) |
Jin Zhengxiong | 4782ac8 | 2006-08-23 19:10:44 +0800 | [diff] [blame] | 35 | #error no scsi device defined |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 36 | #endif |
Vadim Bendebury | 4ae5eb7 | 2012-10-29 05:23:45 +0000 | [diff] [blame] | 37 | #define SCSI_DEV_LIST {SCSI_VEND_ID, SCSI_DEV_ID} |
| 38 | #endif |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 39 | |
tang yuantian | 1a1cf6e | 2015-03-20 10:27:54 +0800 | [diff] [blame] | 40 | #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) |
Vadim Bendebury | 4ae5eb7 | 2012-10-29 05:23:45 +0000 | [diff] [blame] | 41 | const struct pci_device_id scsi_device_list[] = { SCSI_DEV_LIST }; |
| 42 | #endif |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 43 | static ccb tempccb; /* temporary scsi command buffer */ |
| 44 | |
| 45 | static unsigned char tempbuff[512]; /* temporary data buffer */ |
| 46 | |
| 47 | static int scsi_max_devs; /* number of highest available scsi device */ |
| 48 | |
| 49 | static int scsi_curr_dev; /* current device */ |
| 50 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 51 | static block_dev_desc_t scsi_dev_desc[CONFIG_SYS_SCSI_MAX_DEVICE]; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 52 | |
| 53 | /******************************************************************************** |
| 54 | * forward declerations of some Setup Routines |
| 55 | */ |
| 56 | void scsi_setup_test_unit_ready(ccb * pccb); |
Mark Langsdorf | 35df893 | 2015-06-05 00:58:44 +0100 | [diff] [blame^] | 57 | void scsi_setup_read6(ccb * pccb, lbaint_t start, unsigned short blocks); |
| 58 | void scsi_setup_read_ext(ccb * pccb, lbaint_t start, unsigned short blocks); |
| 59 | static void scsi_setup_write_ext(ccb *pccb, lbaint_t start, |
| 60 | unsigned short blocks); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 61 | void scsi_setup_inquiry(ccb * pccb); |
| 62 | void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len); |
| 63 | |
| 64 | |
Gabe Black | b4c5bbc | 2012-10-29 05:23:57 +0000 | [diff] [blame] | 65 | static int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, |
| 66 | unsigned long *blksz); |
Simon Glass | 4f6aa34 | 2013-07-03 07:11:41 -0700 | [diff] [blame] | 67 | static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt, |
| 68 | void *buffer); |
| 69 | static ulong scsi_write(int device, lbaint_t blknr, |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 70 | lbaint_t blkcnt, const void *buffer); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 71 | |
| 72 | |
| 73 | /********************************************************************************* |
| 74 | * (re)-scan the scsi bus and reports scsi device info |
| 75 | * to the user if mode = 1 |
| 76 | */ |
| 77 | void scsi_scan(int mode) |
| 78 | { |
| 79 | unsigned char i,perq,modi,lun; |
Gabe Black | b4c5bbc | 2012-10-29 05:23:57 +0000 | [diff] [blame] | 80 | lbaint_t capacity; |
| 81 | unsigned long blksz; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 82 | ccb* pccb=(ccb *)&tempccb; |
| 83 | |
| 84 | if(mode==1) { |
| 85 | printf("scanning bus for devices...\n"); |
| 86 | } |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 87 | for(i=0;i<CONFIG_SYS_SCSI_MAX_DEVICE;i++) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 88 | scsi_dev_desc[i].target=0xff; |
| 89 | scsi_dev_desc[i].lun=0xff; |
| 90 | scsi_dev_desc[i].lba=0; |
| 91 | scsi_dev_desc[i].blksz=0; |
Egbert Eich | 0472fbf | 2013-04-09 21:11:56 +0000 | [diff] [blame] | 92 | scsi_dev_desc[i].log2blksz = |
| 93 | LOG2_INVALID(typeof(scsi_dev_desc[i].log2blksz)); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 94 | scsi_dev_desc[i].type=DEV_TYPE_UNKNOWN; |
| 95 | scsi_dev_desc[i].vendor[0]=0; |
| 96 | scsi_dev_desc[i].product[0]=0; |
| 97 | scsi_dev_desc[i].revision[0]=0; |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 98 | scsi_dev_desc[i].removable = false; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 99 | scsi_dev_desc[i].if_type=IF_TYPE_SCSI; |
| 100 | scsi_dev_desc[i].dev=i; |
| 101 | scsi_dev_desc[i].part_type=PART_TYPE_UNKNOWN; |
| 102 | scsi_dev_desc[i].block_read=scsi_read; |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 103 | scsi_dev_desc[i].block_write = scsi_write; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 104 | } |
| 105 | scsi_max_devs=0; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 106 | for(i=0;i<CONFIG_SYS_SCSI_MAX_SCSI_ID;i++) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 107 | pccb->target=i; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 108 | for(lun=0;lun<CONFIG_SYS_SCSI_MAX_LUN;lun++) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 109 | pccb->lun=lun; |
| 110 | pccb->pdata=(unsigned char *)&tempbuff; |
| 111 | pccb->datalen=512; |
| 112 | scsi_setup_inquiry(pccb); |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 113 | if (scsi_exec(pccb) != true) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 114 | if(pccb->contr_stat==SCSI_SEL_TIME_OUT) { |
wdenk | 1a344f2 | 2005-02-03 23:00:49 +0000 | [diff] [blame] | 115 | debug ("Selection timeout ID %d\n",pccb->target); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 116 | continue; /* selection timeout => assuming no device present */ |
| 117 | } |
| 118 | scsi_print_error(pccb); |
| 119 | continue; |
| 120 | } |
| 121 | perq=tempbuff[0]; |
| 122 | modi=tempbuff[1]; |
| 123 | if((perq & 0x1f)==0x1f) { |
| 124 | continue; /* skip unknown devices */ |
| 125 | } |
| 126 | if((modi&0x80)==0x80) /* drive is removable */ |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 127 | scsi_dev_desc[scsi_max_devs].removable=true; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 128 | /* get info for this device */ |
Stefan Roese | 2309c13 | 2007-11-17 07:58:25 +0100 | [diff] [blame] | 129 | scsi_ident_cpy((unsigned char *)&scsi_dev_desc[scsi_max_devs].vendor[0], |
| 130 | &tempbuff[8], 8); |
| 131 | scsi_ident_cpy((unsigned char *)&scsi_dev_desc[scsi_max_devs].product[0], |
| 132 | &tempbuff[16], 16); |
| 133 | scsi_ident_cpy((unsigned char *)&scsi_dev_desc[scsi_max_devs].revision[0], |
| 134 | &tempbuff[32], 4); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 135 | scsi_dev_desc[scsi_max_devs].target=pccb->target; |
| 136 | scsi_dev_desc[scsi_max_devs].lun=pccb->lun; |
| 137 | |
| 138 | pccb->datalen=0; |
| 139 | scsi_setup_test_unit_ready(pccb); |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 140 | if (scsi_exec(pccb) != true) { |
| 141 | if (scsi_dev_desc[scsi_max_devs].removable == true) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 142 | scsi_dev_desc[scsi_max_devs].type=perq; |
| 143 | goto removable; |
| 144 | } |
| 145 | scsi_print_error(pccb); |
| 146 | continue; |
| 147 | } |
Gabe Black | b4c5bbc | 2012-10-29 05:23:57 +0000 | [diff] [blame] | 148 | if (scsi_read_capacity(pccb, &capacity, &blksz)) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 149 | scsi_print_error(pccb); |
| 150 | continue; |
| 151 | } |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 152 | scsi_dev_desc[scsi_max_devs].lba=capacity; |
| 153 | scsi_dev_desc[scsi_max_devs].blksz=blksz; |
Egbert Eich | 0472fbf | 2013-04-09 21:11:56 +0000 | [diff] [blame] | 154 | scsi_dev_desc[scsi_max_devs].log2blksz = |
| 155 | LOG2(scsi_dev_desc[scsi_max_devs].blksz); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 156 | scsi_dev_desc[scsi_max_devs].type=perq; |
| 157 | init_part(&scsi_dev_desc[scsi_max_devs]); |
| 158 | removable: |
| 159 | if(mode==1) { |
| 160 | printf (" Device %d: ", scsi_max_devs); |
| 161 | dev_print(&scsi_dev_desc[scsi_max_devs]); |
| 162 | } /* if mode */ |
| 163 | scsi_max_devs++; |
| 164 | } /* next LUN */ |
| 165 | } |
| 166 | if(scsi_max_devs>0) |
| 167 | scsi_curr_dev=0; |
| 168 | else |
Wolfgang Denk | d0ff51b | 2008-07-14 15:19:07 +0200 | [diff] [blame] | 169 | scsi_curr_dev = -1; |
Stefan Reinauer | 447c031 | 2012-10-29 05:23:48 +0000 | [diff] [blame] | 170 | |
| 171 | printf("Found %d device(s).\n", scsi_max_devs); |
Dan Murphy | fff40a7 | 2014-02-03 06:59:01 -0600 | [diff] [blame] | 172 | #ifndef CONFIG_SPL_BUILD |
Stefan Reinauer | 447c031 | 2012-10-29 05:23:48 +0000 | [diff] [blame] | 173 | setenv_ulong("scsidevs", scsi_max_devs); |
Dan Murphy | fff40a7 | 2014-02-03 06:59:01 -0600 | [diff] [blame] | 174 | #endif |
Stefan Reinauer | 447c031 | 2012-10-29 05:23:48 +0000 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | int scsi_get_disk_count(void) |
| 178 | { |
| 179 | return scsi_max_devs; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 180 | } |
| 181 | |
tang yuantian | 1a1cf6e | 2015-03-20 10:27:54 +0800 | [diff] [blame] | 182 | #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 183 | void scsi_init(void) |
| 184 | { |
| 185 | int busdevfunc; |
Vadim Bendebury | 4ae5eb7 | 2012-10-29 05:23:45 +0000 | [diff] [blame] | 186 | int i; |
| 187 | /* |
| 188 | * Find a device from the list, this driver will support a single |
| 189 | * controller. |
| 190 | */ |
| 191 | for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { |
| 192 | /* get PCI Device ID */ |
| 193 | busdevfunc = pci_find_device(scsi_device_list[i].vendor, |
| 194 | scsi_device_list[i].device, |
| 195 | 0); |
| 196 | if (busdevfunc != -1) |
| 197 | break; |
| 198 | } |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 199 | |
Vadim Bendebury | 4ae5eb7 | 2012-10-29 05:23:45 +0000 | [diff] [blame] | 200 | if (busdevfunc == -1) { |
| 201 | printf("Error: SCSI Controller(s) "); |
| 202 | for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { |
| 203 | printf("%04X:%04X ", |
| 204 | scsi_device_list[i].vendor, |
| 205 | scsi_device_list[i].device); |
| 206 | } |
| 207 | printf("not found\n"); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 208 | return; |
| 209 | } |
| 210 | #ifdef DEBUG |
| 211 | else { |
Vadim Bendebury | 4ae5eb7 | 2012-10-29 05:23:45 +0000 | [diff] [blame] | 212 | printf("SCSI Controller (%04X,%04X) found (%d:%d:%d)\n", |
| 213 | scsi_device_list[i].vendor, |
| 214 | scsi_device_list[i].device, |
| 215 | (busdevfunc >> 16) & 0xFF, |
| 216 | (busdevfunc >> 11) & 0x1F, |
| 217 | (busdevfunc >> 8) & 0x7); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 218 | } |
| 219 | #endif |
Simon Glass | abbdb26 | 2015-01-27 22:13:44 -0700 | [diff] [blame] | 220 | bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci"); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 221 | scsi_low_level_init(busdevfunc); |
| 222 | scsi_scan(1); |
Simon Glass | abbdb26 | 2015-01-27 22:13:44 -0700 | [diff] [blame] | 223 | bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 224 | } |
Rob Herring | 942e314 | 2011-07-06 16:13:36 +0000 | [diff] [blame] | 225 | #endif |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 226 | |
Matthew McClintock | df3fc52 | 2011-05-24 05:31:19 +0000 | [diff] [blame] | 227 | #ifdef CONFIG_PARTITIONS |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 228 | block_dev_desc_t * scsi_get_dev(int dev) |
| 229 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 230 | return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 231 | } |
Matthew McClintock | df3fc52 | 2011-05-24 05:31:19 +0000 | [diff] [blame] | 232 | #endif |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 233 | |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 234 | /****************************************************************************** |
| 235 | * scsi boot command intepreter. Derived from diskboot |
| 236 | */ |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 237 | int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 238 | { |
Rob Herring | 7405a13 | 2012-09-21 04:02:30 +0000 | [diff] [blame] | 239 | return common_diskboot(cmdtp, "scsi", argc, argv); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | /********************************************************************************* |
| 243 | * scsi command intepreter |
| 244 | */ |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 245 | int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 246 | { |
| 247 | switch (argc) { |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 248 | case 0: |
| 249 | case 1: |
| 250 | return CMD_RET_USAGE; |
Wolfgang Denk | 47e26b1 | 2010-07-17 01:06:04 +0200 | [diff] [blame] | 251 | |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 252 | case 2: |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 253 | if (strncmp(argv[1],"res",3) == 0) { |
| 254 | printf("\nReset SCSI\n"); |
| 255 | scsi_bus_reset(); |
| 256 | scsi_scan(1); |
| 257 | return 0; |
| 258 | } |
| 259 | if (strncmp(argv[1],"inf",3) == 0) { |
| 260 | int i; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 261 | for (i=0; i<CONFIG_SYS_SCSI_MAX_DEVICE; ++i) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 262 | if(scsi_dev_desc[i].type==DEV_TYPE_UNKNOWN) |
| 263 | continue; /* list only known devices */ |
| 264 | printf ("SCSI dev. %d: ", i); |
| 265 | dev_print(&scsi_dev_desc[i]); |
| 266 | } |
| 267 | return 0; |
| 268 | } |
| 269 | if (strncmp(argv[1],"dev",3) == 0) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 270 | if ((scsi_curr_dev < 0) || (scsi_curr_dev >= CONFIG_SYS_SCSI_MAX_DEVICE)) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 271 | printf("\nno SCSI devices available\n"); |
| 272 | return 1; |
| 273 | } |
| 274 | printf ("\n Device %d: ", scsi_curr_dev); |
| 275 | dev_print(&scsi_dev_desc[scsi_curr_dev]); |
| 276 | return 0; |
| 277 | } |
| 278 | if (strncmp(argv[1],"scan",4) == 0) { |
| 279 | scsi_scan(1); |
| 280 | return 0; |
| 281 | } |
| 282 | if (strncmp(argv[1],"part",4) == 0) { |
| 283 | int dev, ok; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 284 | for (ok=0, dev=0; dev<CONFIG_SYS_SCSI_MAX_DEVICE; ++dev) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 285 | if (scsi_dev_desc[dev].type!=DEV_TYPE_UNKNOWN) { |
| 286 | ok++; |
| 287 | if (dev) |
| 288 | printf("\n"); |
wdenk | 1a344f2 | 2005-02-03 23:00:49 +0000 | [diff] [blame] | 289 | debug ("print_part of %x\n",dev); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 290 | print_part(&scsi_dev_desc[dev]); |
| 291 | } |
| 292 | } |
| 293 | if (!ok) |
| 294 | printf("\nno SCSI devices available\n"); |
| 295 | return 1; |
| 296 | } |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 297 | return CMD_RET_USAGE; |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 298 | case 3: |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 299 | if (strncmp(argv[1],"dev",3) == 0) { |
| 300 | int dev = (int)simple_strtoul(argv[2], NULL, 10); |
| 301 | printf ("\nSCSI device %d: ", dev); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 302 | if (dev >= CONFIG_SYS_SCSI_MAX_DEVICE) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 303 | printf("unknown device\n"); |
| 304 | return 1; |
| 305 | } |
| 306 | printf ("\n Device %d: ", dev); |
| 307 | dev_print(&scsi_dev_desc[dev]); |
| 308 | if(scsi_dev_desc[dev].type == DEV_TYPE_UNKNOWN) { |
| 309 | return 1; |
| 310 | } |
| 311 | scsi_curr_dev = dev; |
| 312 | printf("... is now current device\n"); |
| 313 | return 0; |
| 314 | } |
| 315 | if (strncmp(argv[1],"part",4) == 0) { |
| 316 | int dev = (int)simple_strtoul(argv[2], NULL, 10); |
| 317 | if(scsi_dev_desc[dev].type != DEV_TYPE_UNKNOWN) { |
| 318 | print_part(&scsi_dev_desc[dev]); |
| 319 | } |
| 320 | else { |
| 321 | printf ("\nSCSI device %d not available\n", dev); |
| 322 | } |
| 323 | return 1; |
| 324 | } |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 325 | return CMD_RET_USAGE; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 326 | default: |
| 327 | /* at least 4 args */ |
| 328 | if (strcmp(argv[1],"read") == 0) { |
| 329 | ulong addr = simple_strtoul(argv[2], NULL, 16); |
| 330 | ulong blk = simple_strtoul(argv[3], NULL, 16); |
| 331 | ulong cnt = simple_strtoul(argv[4], NULL, 16); |
| 332 | ulong n; |
| 333 | printf ("\nSCSI read: device %d block # %ld, count %ld ... ", |
| 334 | scsi_curr_dev, blk, cnt); |
| 335 | n = scsi_read(scsi_curr_dev, blk, cnt, (ulong *)addr); |
| 336 | printf ("%ld blocks read: %s\n",n,(n==cnt) ? "OK" : "ERROR"); |
| 337 | return 0; |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 338 | } else if (strcmp(argv[1], "write") == 0) { |
| 339 | ulong addr = simple_strtoul(argv[2], NULL, 16); |
| 340 | ulong blk = simple_strtoul(argv[3], NULL, 16); |
| 341 | ulong cnt = simple_strtoul(argv[4], NULL, 16); |
| 342 | ulong n; |
| 343 | printf("\nSCSI write: device %d block # %ld, " |
| 344 | "count %ld ... ", |
| 345 | scsi_curr_dev, blk, cnt); |
| 346 | n = scsi_write(scsi_curr_dev, blk, cnt, |
| 347 | (ulong *)addr); |
| 348 | printf("%ld blocks written: %s\n", n, |
| 349 | (n == cnt) ? "OK" : "ERROR"); |
| 350 | return 0; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 351 | } |
| 352 | } /* switch */ |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 353 | return CMD_RET_USAGE; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | /**************************************************************************************** |
| 357 | * scsi_read |
| 358 | */ |
| 359 | |
| 360 | #define SCSI_MAX_READ_BLK 0xFFFF /* almost the maximum amount of the scsi_ext command.. */ |
| 361 | |
Simon Glass | 4f6aa34 | 2013-07-03 07:11:41 -0700 | [diff] [blame] | 362 | static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt, |
| 363 | void *buffer) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 364 | { |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 365 | lbaint_t start, blks; |
| 366 | uintptr_t buf_addr; |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 367 | unsigned short smallblks; |
| 368 | ccb* pccb=(ccb *)&tempccb; |
| 369 | device&=0xff; |
| 370 | /* Setup device |
| 371 | */ |
| 372 | pccb->target=scsi_dev_desc[device].target; |
| 373 | pccb->lun=scsi_dev_desc[device].lun; |
| 374 | buf_addr=(unsigned long)buffer; |
| 375 | start=blknr; |
| 376 | blks=blkcnt; |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 377 | debug("\nscsi_read: dev %d startblk " LBAF |
| 378 | ", blccnt " LBAF " buffer %lx\n", |
| 379 | device, start, blks, (unsigned long)buffer); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 380 | do { |
| 381 | pccb->pdata=(unsigned char *)buf_addr; |
| 382 | if(blks>SCSI_MAX_READ_BLK) { |
| 383 | pccb->datalen=scsi_dev_desc[device].blksz * SCSI_MAX_READ_BLK; |
| 384 | smallblks=SCSI_MAX_READ_BLK; |
| 385 | scsi_setup_read_ext(pccb,start,smallblks); |
| 386 | start+=SCSI_MAX_READ_BLK; |
| 387 | blks-=SCSI_MAX_READ_BLK; |
| 388 | } |
| 389 | else { |
| 390 | pccb->datalen=scsi_dev_desc[device].blksz * blks; |
| 391 | smallblks=(unsigned short) blks; |
| 392 | scsi_setup_read_ext(pccb,start,smallblks); |
| 393 | start+=blks; |
| 394 | blks=0; |
| 395 | } |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 396 | debug("scsi_read_ext: startblk " LBAF |
Simon Glass | f360947 | 2014-10-15 04:38:37 -0600 | [diff] [blame] | 397 | ", blccnt %x buffer %" PRIXPTR "\n", |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 398 | start, smallblks, buf_addr); |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 399 | if (scsi_exec(pccb) != true) { |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 400 | scsi_print_error(pccb); |
| 401 | blkcnt-=blks; |
| 402 | break; |
| 403 | } |
| 404 | buf_addr+=pccb->datalen; |
| 405 | } while(blks!=0); |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 406 | debug("scsi_read_ext: end startblk " LBAF |
Simon Glass | f360947 | 2014-10-15 04:38:37 -0600 | [diff] [blame] | 407 | ", blccnt %x buffer %" PRIXPTR "\n", start, smallblks, buf_addr); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 408 | return(blkcnt); |
| 409 | } |
| 410 | |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 411 | /******************************************************************************* |
| 412 | * scsi_write |
| 413 | */ |
| 414 | |
| 415 | /* Almost the maximum amount of the scsi_ext command.. */ |
| 416 | #define SCSI_MAX_WRITE_BLK 0xFFFF |
| 417 | |
Simon Glass | 4f6aa34 | 2013-07-03 07:11:41 -0700 | [diff] [blame] | 418 | static ulong scsi_write(int device, lbaint_t blknr, |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 419 | lbaint_t blkcnt, const void *buffer) |
| 420 | { |
| 421 | lbaint_t start, blks; |
| 422 | uintptr_t buf_addr; |
| 423 | unsigned short smallblks; |
| 424 | ccb* pccb = (ccb *)&tempccb; |
| 425 | device &= 0xff; |
| 426 | /* Setup device |
| 427 | */ |
| 428 | pccb->target = scsi_dev_desc[device].target; |
| 429 | pccb->lun = scsi_dev_desc[device].lun; |
| 430 | buf_addr = (unsigned long)buffer; |
| 431 | start = blknr; |
| 432 | blks = blkcnt; |
| 433 | debug("\n%s: dev %d startblk " LBAF ", blccnt " LBAF " buffer %lx\n", |
| 434 | __func__, device, start, blks, (unsigned long)buffer); |
| 435 | do { |
| 436 | pccb->pdata = (unsigned char *)buf_addr; |
| 437 | if (blks > SCSI_MAX_WRITE_BLK) { |
| 438 | pccb->datalen = (scsi_dev_desc[device].blksz * |
| 439 | SCSI_MAX_WRITE_BLK); |
| 440 | smallblks = SCSI_MAX_WRITE_BLK; |
| 441 | scsi_setup_write_ext(pccb, start, smallblks); |
| 442 | start += SCSI_MAX_WRITE_BLK; |
| 443 | blks -= SCSI_MAX_WRITE_BLK; |
| 444 | } else { |
| 445 | pccb->datalen = scsi_dev_desc[device].blksz * blks; |
| 446 | smallblks = (unsigned short)blks; |
| 447 | scsi_setup_write_ext(pccb, start, smallblks); |
| 448 | start += blks; |
| 449 | blks = 0; |
| 450 | } |
Simon Glass | f360947 | 2014-10-15 04:38:37 -0600 | [diff] [blame] | 451 | debug("%s: startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n", |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 452 | __func__, start, smallblks, buf_addr); |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 453 | if (scsi_exec(pccb) != true) { |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 454 | scsi_print_error(pccb); |
| 455 | blkcnt -= blks; |
| 456 | break; |
| 457 | } |
| 458 | buf_addr += pccb->datalen; |
| 459 | } while (blks != 0); |
Simon Glass | f360947 | 2014-10-15 04:38:37 -0600 | [diff] [blame] | 460 | debug("%s: end startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n", |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 461 | __func__, start, smallblks, buf_addr); |
| 462 | return blkcnt; |
| 463 | } |
| 464 | |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 465 | /* copy src to dest, skipping leading and trailing blanks |
| 466 | * and null terminate the string |
| 467 | */ |
| 468 | void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len) |
| 469 | { |
| 470 | int start,end; |
| 471 | |
| 472 | start=0; |
| 473 | while(start<len) { |
| 474 | if(src[start]!=' ') |
| 475 | break; |
| 476 | start++; |
| 477 | } |
| 478 | end=len-1; |
| 479 | while(end>start) { |
| 480 | if(src[end]!=' ') |
| 481 | break; |
| 482 | end--; |
| 483 | } |
| 484 | for( ; start<=end; start++) { |
| 485 | *dest++=src[start]; |
| 486 | } |
| 487 | *dest='\0'; |
| 488 | } |
| 489 | |
| 490 | |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 491 | /* Trim trailing blanks, and NUL-terminate string |
| 492 | */ |
| 493 | void scsi_trim_trail (unsigned char *str, unsigned int len) |
| 494 | { |
| 495 | unsigned char *p = str + len - 1; |
| 496 | |
| 497 | while (len-- > 0) { |
| 498 | *p-- = '\0'; |
| 499 | if (*p != ' ') { |
| 500 | return; |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | |
Gabe Black | b4c5bbc | 2012-10-29 05:23:57 +0000 | [diff] [blame] | 505 | int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, unsigned long *blksz) |
| 506 | { |
| 507 | *capacity = 0; |
| 508 | |
| 509 | memset(pccb->cmd, 0, sizeof(pccb->cmd)); |
| 510 | pccb->cmd[0] = SCSI_RD_CAPAC10; |
| 511 | pccb->cmd[1] = pccb->lun << 5; |
| 512 | pccb->cmdlen = 10; |
| 513 | pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ |
| 514 | |
| 515 | pccb->datalen = 8; |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 516 | if (scsi_exec(pccb) != true) |
Gabe Black | b4c5bbc | 2012-10-29 05:23:57 +0000 | [diff] [blame] | 517 | return 1; |
| 518 | |
| 519 | *capacity = ((lbaint_t)pccb->pdata[0] << 24) | |
| 520 | ((lbaint_t)pccb->pdata[1] << 16) | |
| 521 | ((lbaint_t)pccb->pdata[2] << 8) | |
| 522 | ((lbaint_t)pccb->pdata[3]); |
| 523 | |
| 524 | if (*capacity != 0xffffffff) { |
| 525 | /* Read capacity (10) was sufficient for this drive. */ |
| 526 | *blksz = ((unsigned long)pccb->pdata[4] << 24) | |
| 527 | ((unsigned long)pccb->pdata[5] << 16) | |
| 528 | ((unsigned long)pccb->pdata[6] << 8) | |
| 529 | ((unsigned long)pccb->pdata[7]); |
| 530 | return 0; |
| 531 | } |
| 532 | |
| 533 | /* Read capacity (10) was insufficient. Use read capacity (16). */ |
| 534 | |
| 535 | memset(pccb->cmd, 0, sizeof(pccb->cmd)); |
| 536 | pccb->cmd[0] = SCSI_RD_CAPAC16; |
| 537 | pccb->cmd[1] = 0x10; |
| 538 | pccb->cmdlen = 16; |
| 539 | pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ |
| 540 | |
| 541 | pccb->datalen = 16; |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 542 | if (scsi_exec(pccb) != true) |
Gabe Black | b4c5bbc | 2012-10-29 05:23:57 +0000 | [diff] [blame] | 543 | return 1; |
| 544 | |
| 545 | *capacity = ((uint64_t)pccb->pdata[0] << 56) | |
| 546 | ((uint64_t)pccb->pdata[1] << 48) | |
| 547 | ((uint64_t)pccb->pdata[2] << 40) | |
| 548 | ((uint64_t)pccb->pdata[3] << 32) | |
| 549 | ((uint64_t)pccb->pdata[4] << 24) | |
| 550 | ((uint64_t)pccb->pdata[5] << 16) | |
| 551 | ((uint64_t)pccb->pdata[6] << 8) | |
| 552 | ((uint64_t)pccb->pdata[7]); |
| 553 | |
| 554 | *blksz = ((uint64_t)pccb->pdata[8] << 56) | |
| 555 | ((uint64_t)pccb->pdata[9] << 48) | |
| 556 | ((uint64_t)pccb->pdata[10] << 40) | |
| 557 | ((uint64_t)pccb->pdata[11] << 32) | |
| 558 | ((uint64_t)pccb->pdata[12] << 24) | |
| 559 | ((uint64_t)pccb->pdata[13] << 16) | |
| 560 | ((uint64_t)pccb->pdata[14] << 8) | |
| 561 | ((uint64_t)pccb->pdata[15]); |
| 562 | |
| 563 | return 0; |
| 564 | } |
| 565 | |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 566 | |
| 567 | /************************************************************************************ |
| 568 | * Some setup (fill-in) routines |
| 569 | */ |
| 570 | void scsi_setup_test_unit_ready(ccb * pccb) |
| 571 | { |
| 572 | pccb->cmd[0]=SCSI_TST_U_RDY; |
| 573 | pccb->cmd[1]=pccb->lun<<5; |
| 574 | pccb->cmd[2]=0; |
| 575 | pccb->cmd[3]=0; |
| 576 | pccb->cmd[4]=0; |
| 577 | pccb->cmd[5]=0; |
| 578 | pccb->cmdlen=6; |
| 579 | pccb->msgout[0]=SCSI_IDENTIFY; /* NOT USED */ |
| 580 | } |
| 581 | |
Mark Langsdorf | 35df893 | 2015-06-05 00:58:44 +0100 | [diff] [blame^] | 582 | void scsi_setup_read_ext(ccb * pccb, lbaint_t start, unsigned short blocks) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 583 | { |
| 584 | pccb->cmd[0]=SCSI_READ10; |
| 585 | pccb->cmd[1]=pccb->lun<<5; |
| 586 | pccb->cmd[2]=((unsigned char) (start>>24))&0xff; |
| 587 | pccb->cmd[3]=((unsigned char) (start>>16))&0xff; |
| 588 | pccb->cmd[4]=((unsigned char) (start>>8))&0xff; |
| 589 | pccb->cmd[5]=((unsigned char) (start))&0xff; |
| 590 | pccb->cmd[6]=0; |
| 591 | pccb->cmd[7]=((unsigned char) (blocks>>8))&0xff; |
| 592 | pccb->cmd[8]=(unsigned char) blocks & 0xff; |
| 593 | pccb->cmd[6]=0; |
| 594 | pccb->cmdlen=10; |
| 595 | pccb->msgout[0]=SCSI_IDENTIFY; /* NOT USED */ |
wdenk | 1a344f2 | 2005-02-03 23:00:49 +0000 | [diff] [blame] | 596 | debug ("scsi_setup_read_ext: cmd: %02X %02X startblk %02X%02X%02X%02X blccnt %02X%02X\n", |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 597 | pccb->cmd[0],pccb->cmd[1], |
| 598 | pccb->cmd[2],pccb->cmd[3],pccb->cmd[4],pccb->cmd[5], |
| 599 | pccb->cmd[7],pccb->cmd[8]); |
| 600 | } |
| 601 | |
Mark Langsdorf | 35df893 | 2015-06-05 00:58:44 +0100 | [diff] [blame^] | 602 | void scsi_setup_write_ext(ccb *pccb, lbaint_t start, unsigned short blocks) |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 603 | { |
| 604 | pccb->cmd[0] = SCSI_WRITE10; |
| 605 | pccb->cmd[1] = pccb->lun << 5; |
| 606 | pccb->cmd[2] = ((unsigned char) (start>>24)) & 0xff; |
| 607 | pccb->cmd[3] = ((unsigned char) (start>>16)) & 0xff; |
| 608 | pccb->cmd[4] = ((unsigned char) (start>>8)) & 0xff; |
| 609 | pccb->cmd[5] = ((unsigned char) (start)) & 0xff; |
| 610 | pccb->cmd[6] = 0; |
| 611 | pccb->cmd[7] = ((unsigned char) (blocks>>8)) & 0xff; |
| 612 | pccb->cmd[8] = (unsigned char)blocks & 0xff; |
| 613 | pccb->cmd[9] = 0; |
| 614 | pccb->cmdlen = 10; |
| 615 | pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ |
| 616 | debug("%s: cmd: %02X %02X startblk %02X%02X%02X%02X blccnt %02X%02X\n", |
| 617 | __func__, |
| 618 | pccb->cmd[0], pccb->cmd[1], |
| 619 | pccb->cmd[2], pccb->cmd[3], pccb->cmd[4], pccb->cmd[5], |
| 620 | pccb->cmd[7], pccb->cmd[8]); |
| 621 | } |
| 622 | |
Mark Langsdorf | 35df893 | 2015-06-05 00:58:44 +0100 | [diff] [blame^] | 623 | void scsi_setup_read6(ccb * pccb, lbaint_t start, unsigned short blocks) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 624 | { |
| 625 | pccb->cmd[0]=SCSI_READ6; |
| 626 | pccb->cmd[1]=pccb->lun<<5 | (((unsigned char)(start>>16))&0x1f); |
| 627 | pccb->cmd[2]=((unsigned char) (start>>8))&0xff; |
| 628 | pccb->cmd[3]=((unsigned char) (start))&0xff; |
| 629 | pccb->cmd[4]=(unsigned char) blocks & 0xff; |
| 630 | pccb->cmd[5]=0; |
| 631 | pccb->cmdlen=6; |
| 632 | pccb->msgout[0]=SCSI_IDENTIFY; /* NOT USED */ |
wdenk | 1a344f2 | 2005-02-03 23:00:49 +0000 | [diff] [blame] | 633 | debug ("scsi_setup_read6: cmd: %02X %02X startblk %02X%02X blccnt %02X\n", |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 634 | pccb->cmd[0],pccb->cmd[1], |
| 635 | pccb->cmd[2],pccb->cmd[3],pccb->cmd[4]); |
| 636 | } |
| 637 | |
| 638 | |
| 639 | void scsi_setup_inquiry(ccb * pccb) |
| 640 | { |
| 641 | pccb->cmd[0]=SCSI_INQUIRY; |
| 642 | pccb->cmd[1]=pccb->lun<<5; |
| 643 | pccb->cmd[2]=0; |
| 644 | pccb->cmd[3]=0; |
| 645 | if(pccb->datalen>255) |
| 646 | pccb->cmd[4]=255; |
| 647 | else |
| 648 | pccb->cmd[4]=(unsigned char)pccb->datalen; |
| 649 | pccb->cmd[5]=0; |
| 650 | pccb->cmdlen=6; |
| 651 | pccb->msgout[0]=SCSI_IDENTIFY; /* NOT USED */ |
| 652 | } |
| 653 | |
Wolfgang Denk | 460c322 | 2005-08-04 01:14:12 +0200 | [diff] [blame] | 654 | |
| 655 | U_BOOT_CMD( |
| 656 | scsi, 5, 1, do_scsi, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 657 | "SCSI sub-system", |
Wolfgang Denk | 460c322 | 2005-08-04 01:14:12 +0200 | [diff] [blame] | 658 | "reset - reset SCSI controller\n" |
| 659 | "scsi info - show available SCSI devices\n" |
| 660 | "scsi scan - (re-)scan SCSI bus\n" |
| 661 | "scsi device [dev] - show or set current device\n" |
| 662 | "scsi part [dev] - print partition table of one or all SCSI devices\n" |
| 663 | "scsi read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n" |
Hung-Te Lin | 758c9e6 | 2012-10-29 05:23:46 +0000 | [diff] [blame] | 664 | " to memory address `addr'\n" |
| 665 | "scsi write addr blk# cnt - write `cnt' blocks starting at block\n" |
| 666 | " `blk#' from memory address `addr'" |
Wolfgang Denk | 460c322 | 2005-08-04 01:14:12 +0200 | [diff] [blame] | 667 | ); |
| 668 | |
| 669 | U_BOOT_CMD( |
| 670 | scsiboot, 3, 1, do_scsiboot, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 671 | "boot from SCSI device", |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 672 | "loadAddr dev:part" |
Wolfgang Denk | 460c322 | 2005-08-04 01:14:12 +0200 | [diff] [blame] | 673 | ); |