Lines Matching defs:instance
76 * the command structure is placed into the per instance disconnected
115 * The generic driver is initialized by calling NCR5380_init(instance),
289 * @instance: adapter state to dump
294 static void NCR5380_print(struct Scsi_Host *instance)
296 struct NCR5380_hostdata *hostdata = shost_priv(instance);
338 * @instance: adapter to dump
343 static void NCR5380_print_phase(struct Scsi_Host *instance)
345 struct NCR5380_hostdata *hostdata = shost_priv(instance);
351 shost_printk(KERN_DEBUG, instance, "REQ not asserted, phase unknown.\n");
356 shost_printk(KERN_DEBUG, instance, "phase %s\n", phases[i].name);
363 * @instance: relevant scsi host instance
368 static const char *NCR5380_info(struct Scsi_Host *instance)
370 struct NCR5380_hostdata *hostdata = shost_priv(instance);
377 * @instance: adapter to configure
380 * Initializes *instance and corresponding 5380 chip,
389 static int NCR5380_init(struct Scsi_Host *instance, int flags)
391 struct NCR5380_hostdata *hostdata = shost_priv(instance);
396 instance->max_lun = 7;
398 hostdata->host = instance;
399 hostdata->id_mask = 1 << instance->this_id;
420 0, instance->host_no);
426 instance->hostt->name, instance->irq, hostdata->io_port,
427 hostdata->base, instance->can_queue, instance->cmd_per_lun,
428 instance->sg_tablesize, instance->this_id,
458 * @instance: adapter to check
470 static int NCR5380_maybe_reset_bus(struct Scsi_Host *instance)
472 struct NCR5380_hostdata *hostdata = shost_priv(instance);
480 shost_printk(KERN_ERR, instance, "SCSI bus busy, waiting up to five seconds\n");
485 shost_printk(KERN_ERR, instance, "bus busy, attempting abort\n");
486 do_abort(instance, 1);
489 shost_printk(KERN_ERR, instance, "bus busy, attempting reset\n");
490 do_reset(instance);
501 shost_printk(KERN_ERR, instance, "bus locked solid\n");
510 * @instance: adapter to remove
515 static void NCR5380_exit(struct Scsi_Host *instance)
517 struct NCR5380_hostdata *hostdata = shost_priv(instance);
525 * @instance: the host instance
529 static void complete_cmd(struct Scsi_Host *instance,
532 struct NCR5380_hostdata *hostdata = shost_priv(instance);
534 dsprintk(NDEBUG_QUEUES, instance, "complete_cmd: cmd %p\n", cmd);
552 * @instance: the relevant SCSI adapter
555 * cmd is added to the per-instance issue queue, with minor
560 static int NCR5380_queue_command(struct Scsi_Host *instance,
563 struct NCR5380_hostdata *hostdata = shost_priv(instance);
571 shost_printk(KERN_DEBUG, instance, "WRITE attempted with NDEBUG_NO_WRITE set\n");
582 if (!NCR5380_acquire_dma_irq(instance)) {
602 dsprintk(NDEBUG_QUEUES, instance, "command %p added to %s of queue\n",
610 static inline void maybe_release_dma_irq(struct Scsi_Host *instance)
612 struct NCR5380_hostdata *hostdata = shost_priv(instance);
620 NCR5380_release_dma_irq(instance);
626 * @instance: the scsi host instance
635 static struct scsi_cmnd *dequeue_next_cmd(struct Scsi_Host *instance)
637 struct NCR5380_hostdata *hostdata = shost_priv(instance);
644 dsprintk(NDEBUG_QUEUES, instance, "dequeue: cmd=%p target=%d busy=0x%02x lun=%llu\n",
649 dsprintk(NDEBUG_QUEUES, instance,
660 dsprintk(NDEBUG_QUEUES, instance,
669 static void requeue_cmd(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
671 struct NCR5380_hostdata *hostdata = shost_priv(instance);
695 struct Scsi_Host *instance = hostdata->host;
703 struct scsi_cmnd *cmd = dequeue_next_cmd(instance);
708 dsprintk(NDEBUG_MAIN, instance, "main: dequeued %p\n", cmd);
712 * On success, instance->hostdata->connected is set.
723 if (!NCR5380_select(instance, cmd)) {
724 dsprintk(NDEBUG_MAIN, instance, "main: select complete\n");
726 dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES, instance,
728 requeue_cmd(instance, cmd);
732 dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n");
733 NCR5380_information_transfer(instance);
738 maybe_release_dma_irq(instance);
748 * @instance: the scsi host instance
754 static void NCR5380_dma_complete(struct Scsi_Host *instance)
756 struct NCR5380_hostdata *hostdata = shost_priv(instance);
773 dsprintk(NDEBUG_DMA, instance, "read overrun handled\n");
781 instance->host_no);
787 pr_err("scsi%d: BASR %02x\n", instance->host_no,
790 instance->host_no);
813 dsprintk(NDEBUG_DMA, instance,
821 dsprintk(NDEBUG_DMA, instance,
823 NCR5380_transfer_pio(instance, &p, &cnt, data, 0);
866 struct Scsi_Host *instance = dev_id;
867 struct NCR5380_hostdata *hostdata = shost_priv(instance);
879 dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n",
888 dsprintk(NDEBUG_INTR, instance, "interrupt in DMA mode\n");
891 NCR5380_dma_complete(instance);
903 dsprintk(NDEBUG_INTR, instance, "interrupt with SEL and IO\n");
906 NCR5380_reselect(instance);
917 shost_printk(KERN_WARNING, instance,
919 bus_reset_cleanup(instance);
921 dsprintk(NDEBUG_INTR, instance, "unknown interrupt\n");
929 dsprintk(NDEBUG_INTR, instance, "interrupt without IRQ bit\n");
942 * @instance: the Scsi_Host instance
965 static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
968 struct NCR5380_hostdata *hostdata = shost_priv(instance);
974 bool can_disconnect = instance->irq != NO_IRQ &&
978 NCR5380_dprint(NDEBUG_ARBITRATION, instance);
979 dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n",
980 instance->this_id);
1025 shost_printk(KERN_ERR, instance,
1039 dsprintk(NDEBUG_ARBITRATION, instance, "lost arbitration, deasserting MR_ARBITRATE\n");
1073 dsprintk(NDEBUG_ARBITRATION, instance, "won arbitration\n");
1129 dsprintk(NDEBUG_SELECTION, instance, "selecting target %d\n", scmd_id(cmd));
1142 NCR5380_reselect(instance);
1143 shost_printk(KERN_ERR, instance, "reselection after won arbitration?\n");
1156 complete_cmd(instance, cmd);
1157 dsprintk(NDEBUG_SELECTION, instance,
1185 shost_printk(KERN_ERR, instance, "select: REQ timeout\n");
1190 do_abort(instance, 0);
1194 dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",
1201 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1205 complete_cmd(instance, cmd);
1206 dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n");
1211 dsprintk(NDEBUG_SELECTION, instance, "nexus established.\n");
1232 * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance,
1237 * Inputs : instance - instance of driver, *phase - pointer to
1257 static int NCR5380_transfer_pio(struct Scsi_Host *instance,
1261 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1284 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ asserted\n");
1288 dsprintk(NDEBUG_PIO, instance, "phase mismatch\n");
1289 NCR5380_dprint_phase(NDEBUG_PIO, instance);
1311 NCR5380_dprint(NDEBUG_PIO, instance);
1317 NCR5380_dprint(NDEBUG_PIO, instance);
1322 NCR5380_dprint(NDEBUG_PIO, instance);
1330 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ negated, handshake complete\n");
1351 dsprintk(NDEBUG_PIO, instance, "residual %d\n", c);
1373 * @instance: adapter to reset
1383 static void do_reset(struct Scsi_Host *instance)
1385 struct NCR5380_hostdata __maybe_unused *hostdata = shost_priv(instance);
1401 * @instance: relevant scsi host instance
1407 static int do_abort(struct Scsi_Host *instance, unsigned int can_sleep)
1409 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1450 NCR5380_transfer_pio(instance, &phase, &len, &msgptr, can_sleep);
1465 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
1471 * Inputs : instance - instance of driver, *phase - pointer to
1483 static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1487 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1508 dsprintk(NDEBUG_DMA, instance, "initializing DMA %s: length %d, address %p\n",
1631 shost_printk(KERN_ERR, instance, "PDMA read: DRQ timeout\n");
1636 shost_printk(KERN_ERR, instance, "PDMA read: !REQ timeout\n");
1648 shost_printk(KERN_ERR, instance, "PDMA write: DRQ and phase timeout\n");
1653 NCR5380_dma_complete(instance);
1658 * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
1662 * instance->connected.
1664 * Inputs : instance, instance for which we are doing commands
1667 * modified if a command disconnects, *instance->connected will
1674 static void NCR5380_information_transfer(struct Scsi_Host *instance)
1677 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1699 NCR5380_dprint_phase(NDEBUG_INFORMATION, instance);
1741 shost_printk(KERN_DEBUG, instance, "NDEBUG_NO_DATAOUT set, attempted DATAOUT aborted\n");
1743 do_abort(instance, 0);
1745 complete_cmd(instance, cmd);
1757 dsprintk(NDEBUG_INFORMATION, instance,
1778 if (NCR5380_transfer_dma(instance, &phase,
1788 do_reset(instance);
1789 bus_reset_cleanup(instance);
1798 NCR5380_transfer_pio(instance, &phase, &len,
1811 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1822 dsprintk(NDEBUG_QUEUES, instance,
1834 complete_cmd(instance, cmd);
1838 dsprintk(NDEBUG_QUEUES, instance, "autosense: adding cmd %p to tail of autosense queue\n",
1843 complete_cmd(instance, cmd);
1873 instance, "connected command %p for target %d lun %llu moved to disconnected queue\n",
1912 dsprintk(NDEBUG_EXTENDED, instance, "receiving extended message\n");
1917 NCR5380_transfer_pio(instance, &phase, &len, &data, 1);
1918 dsprintk(NDEBUG_EXTENDED, instance, "length %d, code 0x%02x\n",
1930 NCR5380_transfer_pio(instance, &phase, &len, &data, 1);
1931 dsprintk(NDEBUG_EXTENDED, instance, "message received, residual %d\n",
1940 shost_printk(KERN_ERR, instance, "error receiving extended message\n");
1943 shost_printk(KERN_NOTICE, instance, "extended message code %02x length %d is too long\n",
1977 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1982 complete_cmd(instance, cmd);
1995 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
2000 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
2004 shost_printk(KERN_ERR, instance, "unknown phase\n");
2005 NCR5380_dprint(NDEBUG_ANY, instance);
2016 * Function : void NCR5380_reselect (struct Scsi_Host *instance)
2018 * Purpose : does reselection, initializing the instance->connected
2022 * Inputs : instance - this instance of the NCR5380.
2025 static void NCR5380_reselect(struct Scsi_Host *instance)
2027 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2043 shost_printk(KERN_WARNING, instance,
2060 shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n");
2075 shost_printk(KERN_ERR, instance, "reselect: REQ timeout\n");
2076 do_abort(instance, 0);
2092 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
2095 do_abort(instance, 0);
2102 shost_printk(KERN_ERR, instance, "expecting IDENTIFY message, got ");
2105 do_abort(instance, 0);
2134 dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
2139 shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
2145 if (do_abort(instance, 0) == 0)
2176 dsprintk(NDEBUG_RESELECTION, instance, "nexus established, target %d, lun %llu\n",
2246 struct Scsi_Host *instance = cmd->device->host;
2247 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2256 NCR5380_dprint(NDEBUG_ANY, instance);
2257 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2260 dsprintk(NDEBUG_ABORT, instance,
2268 dsprintk(NDEBUG_ABORT, instance,
2272 complete_cmd(instance, cmd);
2277 dsprintk(NDEBUG_ABORT, instance,
2283 complete_cmd(instance, cmd);
2289 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd);
2292 if (do_abort(instance, 0) < 0) {
2294 complete_cmd(instance, cmd);
2299 complete_cmd(instance, cmd);
2304 dsprintk(NDEBUG_ABORT, instance,
2306 complete_cmd(instance, cmd);
2311 dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);
2314 dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);
2324 static void bus_reset_cleanup(struct Scsi_Host *instance)
2326 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2343 complete_cmd(instance, hostdata->selecting);
2351 complete_cmd(instance, cmd);
2364 complete_cmd(instance, hostdata->connected);
2384 struct Scsi_Host *instance = cmd->device->host;
2385 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2392 shost_printk(KERN_INFO, instance, __func__);
2394 NCR5380_dprint(NDEBUG_ANY, instance);
2395 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2405 do_reset(instance);
2406 bus_reset_cleanup(instance);