23 #ifdef CONFIG_CISS_SCSI_TAPE
33 #include <linux/slab.h>
34 #include <linux/string.h>
44 #define CCISS_ABORT_MSG 0x00
45 #define CCISS_RESET_MSG 0x01
57 static int cciss_scsi_proc_info(
65 static int cciss_scsi_queue_command (
struct Scsi_Host *
h,
67 static int cciss_eh_device_reset_handler(
struct scsi_cmnd *);
68 static int cciss_eh_abort_handler(
struct scsi_cmnd *);
70 static struct cciss_scsi_hba_t ccissscsi[
MAX_CTLR] = {
71 { .name =
"cciss0", .ndevices = 0 },
72 { .name =
"cciss1", .ndevices = 0 },
73 { .name =
"cciss2", .ndevices = 0 },
74 { .name =
"cciss3", .ndevices = 0 },
75 { .name =
"cciss4", .ndevices = 0 },
76 { .name =
"cciss5", .ndevices = 0 },
77 { .name =
"cciss6", .ndevices = 0 },
78 { .name =
"cciss7", .ndevices = 0 },
85 .proc_info = cciss_scsi_proc_info,
86 .queuecommand = cciss_scsi_queue_command,
91 .eh_device_reset_handler= cciss_eh_device_reset_handler,
92 .eh_abort_handler = cciss_eh_abort_handler,
100 struct cciss_scsi_cmd_stack_elem_t {
111 struct cciss_scsi_cmd_stack_t {
112 struct cciss_scsi_cmd_stack_elem_t *
pool;
113 struct cciss_scsi_cmd_stack_elem_t **
elem;
120 struct cciss_scsi_adapter_data_t {
122 struct cciss_scsi_cmd_stack_t cmd_stack;
128 #define CPQ_TAPE_LOCK(h, flags) spin_lock_irqsave( \
129 &h->scsi_ctlr->lock, flags);
130 #define CPQ_TAPE_UNLOCK(h, flags) spin_unlock_irqrestore( \
131 &h->scsi_ctlr->lock, flags);
142 struct cciss_scsi_cmd_stack_elem_t *
c;
143 struct cciss_scsi_adapter_data_t *
sa;
144 struct cciss_scsi_cmd_stack_t *stk;
148 stk = &sa->cmd_stack;
152 c = stk->elem[stk->top];
154 memset(&c->cmd, 0,
sizeof(c->cmd));
155 memset(&c->Err, 0,
sizeof(c->Err));
157 c->cmd.busaddr = c->busaddr;
158 c->cmd.cmdindex = c->cmdindex;
167 c->cmd.ErrDesc.Addr.lower = temp64.
val32.lower;
168 c->cmd.ErrDesc.Addr.upper = temp64.
val32.upper;
171 c->cmd.ctlr = h->
ctlr;
172 c->cmd.err_info = &c->Err;
184 struct cciss_scsi_adapter_data_t *
sa;
185 struct cciss_scsi_cmd_stack_t *stk;
188 stk = &sa->cmd_stack;
190 if (stk->top >= stk->nelems) {
192 "scsi_cmd_free called too many times.\n");
195 stk->elem[stk->top] = (
struct cciss_scsi_cmd_stack_elem_t *) c;
199 scsi_cmd_stack_setup(
ctlr_info_t *h,
struct cciss_scsi_adapter_data_t *sa)
202 struct cciss_scsi_cmd_stack_t *stk;
205 stk = &sa->cmd_stack;
206 stk->nelems = cciss_tape_cmds + 2;
207 sa->cmd_sg_list = cciss_allocate_sg_chain_blocks(h,
209 if (!sa->cmd_sg_list && h->
chainsize > 0)
212 size =
sizeof(
struct cciss_scsi_cmd_stack_elem_t) * stk->nelems;
217 stk->pool = (
struct cciss_scsi_cmd_stack_elem_t *)
220 if (stk->pool ==
NULL) {
221 cciss_free_sg_chain_blocks(sa->cmd_sg_list, stk->nelems);
222 sa->cmd_sg_list =
NULL;
228 stk->cmd_pool_handle);
231 for (i = 0; i < stk->nelems; i++) {
232 stk->elem[
i] = &stk->pool[
i];
233 stk->elem[
i]->busaddr = (
__u32) (stk->cmd_pool_handle +
234 (
sizeof(
struct cciss_scsi_cmd_stack_elem_t) * i));
235 stk->elem[
i]->cmdindex =
i;
237 stk->top = stk->nelems-1;
244 struct cciss_scsi_adapter_data_t *
sa;
245 struct cciss_scsi_cmd_stack_t *stk;
249 stk = &sa->cmd_stack;
250 if (stk->top != stk->nelems-1) {
252 "bug: %d scsi commands are still outstanding.\n",
253 stk->nelems - stk->top);
255 size =
sizeof(
struct cciss_scsi_cmd_stack_elem_t) * stk->nelems;
259 cciss_free_sg_chain_blocks(sa->cmd_sg_list, stk->nelems);
265 static int xmargin=8;
266 static int amargin=60;
269 print_bytes (
unsigned char *c,
int len,
int hex,
int ascii)
280 if ((i % xmargin) == 0 && i>0)
printk(
"\n");
281 if ((i % xmargin) == 0)
printk(
"0x%04x:", i);
292 if ((i % amargin) == 0 && i>0)
printk(
"\n");
293 if ((i % amargin) == 0)
printk(
"0x%04x:", i);
294 if (*x > 26 && *x < 128)
printk(
"%c", *x);
310 printk(
"LUN:0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
324 printk(
"CDB: %02x %02x %02x %02x %02x %02x %02x %02x"
325 " %02x %02x %02x %02x %02x %02x %02x %02x\n",
334 printk(
"edesc.Addr: 0x%08x/0%08x, Len = %d\n",
337 printk(
"sgs..........Errorinfo:\n");
356 unsigned char target_taken[CCISS_MAX_SCSI_DEVS_PER_HBA];
358 memset(&target_taken[0], 0, CCISS_MAX_SCSI_DEVS_PER_HBA);
360 target_taken[SELF_SCSI_ID] = 1;
361 for (i = 0; i < ccissscsi[h->
ctlr].ndevices; i++)
362 target_taken[ccissscsi[h->
ctlr].dev[i].target] = 1;
364 for (i = 0; i < CCISS_MAX_SCSI_DEVS_PER_HBA; i++) {
365 if (!target_taken[i]) {
366 *bus = 0; *target=
i; *lun = 0; found=1;
379 struct cciss_scsi_dev_t *
device,
380 struct scsi2map *added,
int *nadded)
383 int n = ccissscsi[h->
ctlr].ndevices;
384 struct cciss_scsi_dev_t *
sd;
388 if (n >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
390 "some will be inaccessible.\n");
398 if (device->scsi3addr[4] != 0) {
403 memcpy(addr1, device->scsi3addr, 8);
405 for (i = 0; i <
n; i++) {
406 sd = &ccissscsi[h->
ctlr].dev[
i];
407 memcpy(addr2, sd->scsi3addr, 8);
410 if (
memcmp(addr1, addr2, 8) == 0) {
413 lun = device->scsi3addr[4];
419 sd = &ccissscsi[h->
ctlr].dev[
n];
421 if (find_bus_target_lun(h,
422 &sd->bus, &sd->target, &sd->lun) != 0)
429 added[*nadded].bus = sd->bus;
430 added[*nadded].target = sd->target;
431 added[*nadded].lun = sd->lun;
434 memcpy(sd->scsi3addr, device->scsi3addr, 8);
435 memcpy(sd->vendor, device->vendor,
sizeof(sd->vendor));
436 memcpy(sd->revision, device->revision,
sizeof(sd->revision));
437 memcpy(sd->device_id, device->device_id,
sizeof(sd->device_id));
438 sd->devtype = device->devtype;
440 ccissscsi[h->
ctlr].ndevices++;
446 dev_info(&h->
pdev->dev,
"%s device c%db%dt%dl%d added.\n",
448 sd->bus, sd->target, sd->lun);
454 struct scsi2map *removed,
int *nremoved)
458 struct cciss_scsi_dev_t sd;
462 removed[*nremoved].bus = sd.bus;
463 removed[*nremoved].target = sd.target;
464 removed[*nremoved].lun = sd.lun;
466 for (i = entry; i < ccissscsi[h->
ctlr].ndevices-1; i++)
467 ccissscsi[h->
ctlr].dev[i] = ccissscsi[h->
ctlr].dev[i+1];
468 ccissscsi[h->
ctlr].ndevices--;
469 dev_info(&h->
pdev->dev,
"%s device c%db%dt%dl%d removed.\n",
471 sd.bus, sd.target, sd.lun);
475 #define SCSI3ADDR_EQ(a,b) ( \
476 (a)[7] == (b)[7] && \
477 (a)[6] == (b)[6] && \
478 (a)[5] == (b)[5] && \
479 (a)[4] == (b)[4] && \
480 (a)[3] == (b)[3] && \
481 (a)[2] == (b)[2] && \
482 (a)[1] == (b)[1] && \
485 static void fixup_botched_add(
ctlr_info_t *h,
char *scsi3addr)
491 CPQ_TAPE_LOCK(h, flags);
492 for (i = 0; i < ccissscsi[h->
ctlr].ndevices; i++) {
494 ccissscsi[h->
ctlr].dev[i].scsi3addr, 8) == 0) {
495 for (j = i; j < ccissscsi[h->
ctlr].ndevices-1; j++)
496 ccissscsi[h->
ctlr].dev[j] =
497 ccissscsi[h->
ctlr].dev[j+1];
498 ccissscsi[h->
ctlr].ndevices--;
502 CPQ_TAPE_UNLOCK(h, flags);
505 static int device_is_the_same(
struct cciss_scsi_dev_t *dev1,
506 struct cciss_scsi_dev_t *dev2)
508 return dev1->devtype == dev2->devtype &&
509 memcmp(dev1->scsi3addr, dev2->scsi3addr,
510 sizeof(dev1->scsi3addr)) == 0 &&
511 memcmp(dev1->device_id, dev2->device_id,
512 sizeof(dev1->device_id)) == 0 &&
513 memcmp(dev1->vendor, dev2->vendor,
514 sizeof(dev1->vendor)) == 0 &&
515 memcmp(dev1->model, dev2->model,
516 sizeof(dev1->model)) == 0 &&
517 memcmp(dev1->revision, dev2->revision,
518 sizeof(dev1->revision)) == 0;
522 adjust_cciss_scsi_table(
ctlr_info_t *h,
int hostno,
523 struct cciss_scsi_dev_t sd[],
int nsds)
530 int i,
j, found, changes=0;
531 struct cciss_scsi_dev_t *csd;
533 struct scsi2map *added, *removed;
534 int nadded, nremoved;
537 added = kzalloc(
sizeof(*added) * CCISS_MAX_SCSI_DEVS_PER_HBA,
539 removed = kzalloc(
sizeof(*removed) * CCISS_MAX_SCSI_DEVS_PER_HBA,
542 if (!added || !removed) {
544 "Out of memory in adjust_cciss_scsi_table\n");
548 CPQ_TAPE_LOCK(h, flags);
559 while (i < ccissscsi[h->
ctlr].ndevices) {
560 csd = &ccissscsi[h->
ctlr].dev[
i];
562 for (j=0;j<nsds;j++) {
565 if (device_is_the_same(&sd[j], csd))
575 cciss_scsi_remove_entry(h, hostno, i,
578 }
else if (found == 1) {
581 "device c%db%dt%dl%d has changed.\n",
582 hostno, csd->bus, csd->target, csd->lun);
583 cciss_scsi_remove_entry(h, hostno, i,
586 if (cciss_scsi_add_entry(h, hostno, &sd[j],
587 added, &nadded) != 0)
590 csd->devtype = sd[
j].devtype;
591 memcpy(csd->device_id, sd[j].device_id,
592 sizeof(csd->device_id));
593 memcpy(csd->vendor, sd[j].vendor,
594 sizeof(csd->vendor));
595 memcpy(csd->model, sd[j].model,
597 memcpy(csd->revision, sd[j].revision,
598 sizeof(csd->revision));
606 for (i=0;i<nsds;i++) {
608 for (j = 0; j < ccissscsi[h->
ctlr].ndevices; j++) {
609 csd = &ccissscsi[h->
ctlr].dev[
j];
612 if (device_is_the_same(&sd[i], csd))
621 if (cciss_scsi_add_entry(h, hostno, &sd[i],
622 added, &nadded) != 0)
624 }
else if (found == 1) {
628 "device unexpectedly changed\n");
632 CPQ_TAPE_UNLOCK(h, flags);
637 if (hostno == -1 || !changes)
641 for (i = 0; i < nremoved; i++) {
644 removed[i].target, removed[i].lun);
653 "c%db%dt%dl%d\n for removal.",
654 hostno, removed[i].bus,
655 removed[i].target, removed[i].lun);
660 for (i = 0; i < nadded; i++) {
663 added[i].target, added[i].lun);
667 "c%db%dt%dl%d failed, device not added.\n",
668 hostno, added[i].bus, added[i].target, added[i].lun);
671 fixup_botched_add(h, added[i].scsi3addr);
681 lookup_scsi3addr(
ctlr_info_t *h,
int bus,
int target,
int lun,
char *scsi3addr)
684 struct cciss_scsi_dev_t *sd;
687 CPQ_TAPE_LOCK(h, flags);
688 for (i = 0; i < ccissscsi[h->
ctlr].ndevices; i++) {
689 sd = &ccissscsi[h->
ctlr].dev[
i];
690 if (sd->bus == bus &&
691 sd->target == target &&
693 memcpy(scsi3addr, &sd->scsi3addr[0], 8);
694 CPQ_TAPE_UNLOCK(h, flags);
698 CPQ_TAPE_UNLOCK(h, flags);
705 struct cciss_scsi_adapter_data_t * shba;
707 ccissscsi[h->
ctlr].ndevices = 0;
708 shba = (
struct cciss_scsi_adapter_data_t *)
712 shba->scsi_host =
NULL;
714 shba->registered = 0;
715 if (scsi_cmd_stack_setup(h, shba) != 0) {
743 cciss_unmap_sg_chain_block(h, c);
783 " completed with data overrun "
800 "%p has protocol error\n", c);
805 "%p had hardware error\n", c);
810 "%p had connection lost\n", c);
819 "%p reports abort failed\n", c);
824 "unsolicited abort\n", c);
838 "%p returned unknown status %x\n", c,
863 ((
struct cciss_scsi_adapter_data_t *)
864 h->scsi_ctlr)->scsi_host = sh;
865 sh->hostdata[0] = (
unsigned long) h;
868 error = scsi_add_host(sh, &h->
pdev->dev);
881 cciss_unmap_one(
struct pci_dev *pdev,
890 pci_unmap_single(pdev, (
dma_addr_t) addr64.
val, buflen, data_direction);
894 cciss_map_one(
struct pci_dev *pdev,
902 addr64 = (
__u64) pci_map_single(pdev, buf, buflen, data_direction);
904 (
__u32) (addr64 & (
__u64) 0x00000000FFFFFFFF);
906 (
__u32) ((addr64 >> 32) & (
__u64) 0x00000000FFFFFFFF);
915 unsigned char *scsi3addr,
917 unsigned char cdblen,
918 unsigned char *buf,
int bufsize,
943 cciss_map_one(h->
pdev, c, (
unsigned char *) buf,
947 enqueue_cmd_and_start_io(h, c);
965 "cmd %p has completed with errors\n", c);
967 "cmd %p has SCSI Status = %x\n",
971 "SCSI status is abnormally zero. "
972 "(probably indicates selection timeout "
973 "reported incorrectly due to a known "
974 "firmware bug, circa July, 2001.)\n");
981 " completed with data overrun "
988 "%p is reported invalid (probably means "
989 "target device no longer present)\n", c);
1002 dev_warn(&h->
pdev->dev,
"%p had connection lost\n", c);
1009 "%p reports abort failed\n", c);
1013 "%p aborted due to an unsolicited abort\n", c);
1020 "%p unabortable\n", c);
1024 "%p returned unknown status %x\n",
1030 cciss_scsi_do_inquiry(
ctlr_info_t *h,
unsigned char *scsi3addr,
1031 unsigned char page,
unsigned char *buf,
1032 unsigned char bufsize)
1038 unsigned long flags;
1041 c = scsi_cmd_alloc(h);
1042 spin_unlock_irqrestore(&h->
lock, flags);
1045 printk(
"cmd_alloc returned NULL!\n");
1052 cdb[1] = (page != 0);
1057 rc = cciss_scsi_do_simple_cmd(h, c, scsi3addr, cdb,
1060 if (rc != 0)
return rc;
1064 cciss_scsi_interpret_error(h, c);
1068 scsi_cmd_free(h, c);
1069 spin_unlock_irqrestore(&h->
lock, flags);
1074 static int cciss_scsi_get_device_id(
ctlr_info_t *h,
unsigned char *scsi3addr,
1085 rc = cciss_scsi_do_inquiry(h, scsi3addr, 0x83, buf, 64);
1087 memcpy(device_id, &buf[8], buflen);
1098 unsigned char cdb[12];
1099 unsigned char scsi3addr[8];
1101 unsigned long flags;
1104 c = scsi_cmd_alloc(h);
1105 spin_unlock_irqrestore(&h->
lock, flags);
1107 printk(
"cmd_alloc returned NULL!\n");
1111 memset(&scsi3addr[0], 0, 8);
1118 cdb[6] = (bufsize >> 24) & 0xFF;
1119 cdb[7] = (bufsize >> 16) & 0xFF;
1120 cdb[8] = (bufsize >> 8) & 0xFF;
1121 cdb[9] = bufsize & 0xFF;
1125 rc = cciss_scsi_do_simple_cmd(h, c, scsi3addr,
1127 (
unsigned char *) buf,
1130 if (rc != 0)
return rc;
1135 cciss_scsi_interpret_error(h, c);
1139 scsi_cmd_free(h, c);
1140 spin_unlock_irqrestore(&h->
lock, flags);
1145 cciss_update_non_disk_devices(
ctlr_info_t *h,
int hostno)
1173 #define OBDR_TAPE_INQ_SIZE 49
1174 #define OBDR_TAPE_SIG "$DR-10"
1176 unsigned char *inq_buff;
1177 unsigned char scsi3addr[8];
1180 struct cciss_scsi_dev_t *currentsd, *this_device;
1185 ld_buff = kzalloc(reportlunsize,
GFP_KERNEL);
1187 currentsd = kzalloc(
sizeof(*currentsd) *
1188 (CCISS_MAX_SCSI_DEVS_PER_HBA+1),
GFP_KERNEL);
1189 if (ld_buff ==
NULL || inq_buff ==
NULL || currentsd ==
NULL) {
1193 this_device = ¤tsd[CCISS_MAX_SCSI_DEVS_PER_HBA];
1194 if (cciss_scsi_do_report_phys_luns(h, ld_buff, reportlunsize) == 0) {
1196 num_luns = ((ch[0]<<24) | (ch[1]<<16) | (ch[2]<<8) | ch[3]) / 8;
1197 if (num_luns > CISS_MAX_PHYS_LUN) {
1199 "cciss: Maximum physical LUNs (%d) exceeded. "
1200 "%d LUNs ignored.\n", CISS_MAX_PHYS_LUN,
1201 num_luns - CISS_MAX_PHYS_LUN);
1212 for (i = 0; i < num_luns; i++) {
1214 if (ld_buff->
LUN[i][3] & 0xC0)
continue;
1215 memset(inq_buff, 0, OBDR_TAPE_INQ_SIZE);
1216 memcpy(&scsi3addr[0], &ld_buff->
LUN[i][0], 8);
1218 if (cciss_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
1219 (
unsigned char) OBDR_TAPE_INQ_SIZE) != 0)
1223 this_device->devtype = (inq_buff[0] & 0x1f);
1224 this_device->bus = -1;
1225 this_device->target = -1;
1226 this_device->lun = -1;
1227 memcpy(this_device->scsi3addr, scsi3addr, 8);
1228 memcpy(this_device->vendor, &inq_buff[8],
1229 sizeof(this_device->vendor));
1230 memcpy(this_device->model, &inq_buff[16],
1231 sizeof(this_device->model));
1232 memcpy(this_device->revision, &inq_buff[32],
1233 sizeof(this_device->revision));
1234 memset(this_device->device_id, 0,
1235 sizeof(this_device->device_id));
1236 cciss_scsi_get_device_id(h, scsi3addr,
1237 this_device->device_id,
sizeof(this_device->device_id));
1239 switch (this_device->devtype)
1252 strncpy(obdr_sig, &inq_buff[43], 6);
1254 if (
strncmp(obdr_sig, OBDR_TAPE_SIG, 6) != 0)
1261 if (ncurrent >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
1263 "too many devices.\n", h->
ctlr,
1267 currentsd[ncurrent] = *this_device;
1275 adjust_cciss_scsi_table(h, hostno, currentsd, ncurrent);
1284 is_keyword(
char *
ptr,
int len,
char *
verb)
1286 int verb_len =
strlen(verb);
1287 if (len >= verb_len && !
memcmp(verb,ptr,verb_len))
1298 if ((arg_len = is_keyword(buffer, length,
"rescan")) != 0)
1299 cciss_update_non_disk_devices(h, hostno);
1307 cciss_scsi_proc_info(
struct Scsi_Host *sh,
1324 buflen =
sprintf(buffer,
"cciss%d: SCSI host: %d\n",
1335 for (i = 0; i < ccissscsi[h->
ctlr].ndevices; i++) {
1336 struct cciss_scsi_dev_t *sd =
1337 &ccissscsi[h->
ctlr].dev[
i];
1338 buflen +=
sprintf(&buffer[buflen],
"c%db%dt%dl%d %02d "
1339 "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
1340 sh->
host_no, sd->bus, sd->target, sd->lun,
1342 sd->scsi3addr[0], sd->scsi3addr[1],
1343 sd->scsi3addr[2], sd->scsi3addr[3],
1344 sd->scsi3addr[4], sd->scsi3addr[5],
1345 sd->scsi3addr[6], sd->scsi3addr[7]);
1347 datalen = buflen -
offset;
1352 *start = buffer +
offset;
1355 return cciss_scsi_user_command(h, sh->
host_no,
1369 int request_nsgs,
i, chained, sg_index;
1370 struct cciss_scsi_adapter_data_t *sa = h->scsi_ctlr;
1382 !chained && request_nsgs - i > 1) {
1385 curr_sg = sa->cmd_sg_list[c->
cmdindex];
1389 curr_sg[sg_index].
Addr.lower =
1390 (
__u32) (addr64 & 0x0FFFFFFFFULL);
1391 curr_sg[sg_index].
Addr.upper =
1392 (
__u32) ((addr64 >> 32) & 0x0FFFFFFFFULL);
1393 curr_sg[sg_index].
Len = len;
1394 curr_sg[sg_index].
Ext = 0;
1398 cciss_map_sg_chain_block(h, c,
1404 if (request_nsgs > h->
maxSG)
1405 h->
maxSG = request_nsgs;
1420 unsigned char scsi3addr[8];
1422 unsigned long flags;
1428 rc = lookup_scsi3addr(h, cmd->
device->channel, cmd->
device->id,
1429 cmd->
device->lun, scsi3addr);
1444 c = scsi_cmd_alloc(h);
1445 spin_unlock_irqrestore(&h->
lock, flags);
1447 dev_warn(&h->
pdev->dev,
"scsi_cmd_alloc returned NULL!\n");
1503 dev_warn(&h->
pdev->dev,
"unknown data direction: %d\n",
1508 cciss_scatter_gather(h, c, cmd);
1509 enqueue_cmd_and_start_io(h, c);
1518 struct cciss_scsi_adapter_data_t *
sa;
1519 struct cciss_scsi_cmd_stack_t *stk;
1520 unsigned long flags;
1526 stk = &sa->cmd_stack;
1529 if (sa->registered) {
1530 spin_unlock_irqrestore(&h->lock, flags);
1538 sa->scsi_host =
NULL;
1539 spin_unlock_irqrestore(&h->lock, flags);
1540 scsi_cmd_stack_free(h);
1546 struct cciss_scsi_adapter_data_t *
sa;
1547 struct cciss_scsi_cmd_stack_t *stk;
1548 unsigned long flags;
1552 stk = &sa->cmd_stack;
1554 if (sa->registered) {
1555 dev_info(&h->
pdev->dev,
"SCSI subsystem already engaged.\n");
1556 spin_unlock_irqrestore(&h->
lock, flags);
1560 spin_unlock_irqrestore(&h->
lock, flags);
1561 cciss_update_non_disk_devices(h, -1);
1562 cciss_scsi_detect(h);
1569 unsigned long flags;
1571 CPQ_TAPE_LOCK(h, flags);
1573 "Sequential access devices: %d\n\n",
1574 ccissscsi[h->
ctlr].ndevices);
1575 CPQ_TAPE_UNLOCK(h, flags);
1578 static int wait_for_device_to_become_ready(
ctlr_info_t *h,
1579 unsigned char lunaddr[])
1589 "wait_for_device_to_become_ready.\n");
1594 while (count < 20) {
1603 if (waittime < (
HZ * 30))
1604 waittime = waittime * 2;
1610 rc = sendcmd_withirq_core(h, c, 0);
1612 (
void) process_sendcmd_error(h, c);
1627 check_for_unit_attention(h, c);
1634 "for device to become ready.\n",
1659 static int cciss_eh_device_reset_handler(
struct scsi_cmnd *scsicmd)
1663 unsigned char lunaddr[8];
1670 dev_warn(&h->
pdev->dev,
"resetting tape drive or medium changer.\n");
1673 if (cmd_in_trouble ==
NULL)
1679 if (rc == 0 && wait_for_device_to_become_ready(h, lunaddr) == 0)
1685 static int cciss_eh_abort_handler(
struct scsi_cmnd *scsicmd)
1689 unsigned char lunaddr[8];
1700 if (cmd_to_abort ==
NULL)
1715 #define cciss_scsi_setup(cntl_num)
1716 #define cciss_engage_scsi(h)