Lines Matching refs:instance

76  * the command structure is placed into the per instance disconnected
115 * The generic driver is initialized by calling NCR5380_init(instance),
287 * @instance: adapter state to dump
292 static void NCR5380_print(struct Scsi_Host *instance)
294 struct NCR5380_hostdata *hostdata = shost_priv(instance);
336 * @instance: adapter to dump
341 static void NCR5380_print_phase(struct Scsi_Host *instance)
343 struct NCR5380_hostdata *hostdata = shost_priv(instance);
349 shost_printk(KERN_DEBUG, instance, "REQ not asserted, phase unknown.\n");
354 shost_printk(KERN_DEBUG, instance, "phase %s\n", phases[i].name);
361 * @instance: relevant scsi host instance
366 static const char *NCR5380_info(struct Scsi_Host *instance)
368 struct NCR5380_hostdata *hostdata = shost_priv(instance);
375 * @instance: adapter to configure
378 * Initializes *instance and corresponding 5380 chip,
387 static int NCR5380_init(struct Scsi_Host *instance, int flags)
389 struct NCR5380_hostdata *hostdata = shost_priv(instance);
394 instance->max_lun = 7;
396 hostdata->host = instance;
397 hostdata->id_mask = 1 << instance->this_id;
418 0, instance->host_no);
424 instance->hostt->name, instance->irq, hostdata->io_port,
425 hostdata->base, instance->can_queue, instance->cmd_per_lun,
426 instance->sg_tablesize, instance->this_id,
456 * @instance: adapter to check
468 static int NCR5380_maybe_reset_bus(struct Scsi_Host *instance)
470 struct NCR5380_hostdata *hostdata = shost_priv(instance);
478 shost_printk(KERN_ERR, instance, "SCSI bus busy, waiting up to five seconds\n");
483 shost_printk(KERN_ERR, instance, "bus busy, attempting abort\n");
484 do_abort(instance, 1);
487 shost_printk(KERN_ERR, instance, "bus busy, attempting reset\n");
488 do_reset(instance);
499 shost_printk(KERN_ERR, instance, "bus locked solid\n");
508 * @instance: adapter to remove
513 static void NCR5380_exit(struct Scsi_Host *instance)
515 struct NCR5380_hostdata *hostdata = shost_priv(instance);
523 * @instance: the host instance
527 static void complete_cmd(struct Scsi_Host *instance,
530 struct NCR5380_hostdata *hostdata = shost_priv(instance);
532 dsprintk(NDEBUG_QUEUES, instance, "complete_cmd: cmd %p\n", cmd);
550 * @instance: the relevant SCSI adapter
553 * cmd is added to the per-instance issue queue, with minor
558 static int NCR5380_queue_command(struct Scsi_Host *instance,
561 struct NCR5380_hostdata *hostdata = shost_priv(instance);
569 shost_printk(KERN_DEBUG, instance, "WRITE attempted with NDEBUG_NO_WRITE set\n");
580 if (!NCR5380_acquire_dma_irq(instance)) {
600 dsprintk(NDEBUG_QUEUES, instance, "command %p added to %s of queue\n",
608 static inline void maybe_release_dma_irq(struct Scsi_Host *instance)
610 struct NCR5380_hostdata *hostdata = shost_priv(instance);
618 NCR5380_release_dma_irq(instance);
624 * @instance: the scsi host instance
633 static struct scsi_cmnd *dequeue_next_cmd(struct Scsi_Host *instance)
635 struct NCR5380_hostdata *hostdata = shost_priv(instance);
642 dsprintk(NDEBUG_QUEUES, instance, "dequeue: cmd=%p target=%d busy=0x%02x lun=%llu\n",
647 dsprintk(NDEBUG_QUEUES, instance,
658 dsprintk(NDEBUG_QUEUES, instance,
667 static void requeue_cmd(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
669 struct NCR5380_hostdata *hostdata = shost_priv(instance);
693 struct Scsi_Host *instance = hostdata->host;
701 struct scsi_cmnd *cmd = dequeue_next_cmd(instance);
706 dsprintk(NDEBUG_MAIN, instance, "main: dequeued %p\n", cmd);
710 * On success, instance->hostdata->connected is set.
721 if (!NCR5380_select(instance, cmd)) {
722 dsprintk(NDEBUG_MAIN, instance, "main: select complete\n");
724 dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES, instance,
726 requeue_cmd(instance, cmd);
730 dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n");
731 NCR5380_information_transfer(instance);
736 maybe_release_dma_irq(instance);
746 * @instance: the scsi host instance
752 static void NCR5380_dma_complete(struct Scsi_Host *instance)
754 struct NCR5380_hostdata *hostdata = shost_priv(instance);
771 dsprintk(NDEBUG_DMA, instance, "read overrun handled\n");
779 instance->host_no);
785 pr_err("scsi%d: BASR %02x\n", instance->host_no,
788 instance->host_no);
811 dsprintk(NDEBUG_DMA, instance,
819 dsprintk(NDEBUG_DMA, instance,
821 NCR5380_transfer_pio(instance, &p, &cnt, data, 0);
864 struct Scsi_Host *instance = dev_id;
865 struct NCR5380_hostdata *hostdata = shost_priv(instance);
877 dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n",
886 dsprintk(NDEBUG_INTR, instance, "interrupt in DMA mode\n");
889 NCR5380_dma_complete(instance);
901 dsprintk(NDEBUG_INTR, instance, "interrupt with SEL and IO\n");
904 NCR5380_reselect(instance);
915 shost_printk(KERN_WARNING, instance,
917 bus_reset_cleanup(instance);
919 dsprintk(NDEBUG_INTR, instance, "unknown interrupt\n");
927 dsprintk(NDEBUG_INTR, instance, "interrupt without IRQ bit\n");
940 * @instance: the Scsi_Host instance
963 static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
966 struct NCR5380_hostdata *hostdata = shost_priv(instance);
972 bool can_disconnect = instance->irq != NO_IRQ &&
976 NCR5380_dprint(NDEBUG_ARBITRATION, instance);
977 dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n",
978 instance->this_id);
1023 shost_printk(KERN_ERR, instance,
1037 dsprintk(NDEBUG_ARBITRATION, instance, "lost arbitration, deasserting MR_ARBITRATE\n");
1071 dsprintk(NDEBUG_ARBITRATION, instance, "won arbitration\n");
1127 dsprintk(NDEBUG_SELECTION, instance, "selecting target %d\n", scmd_id(cmd));
1140 NCR5380_reselect(instance);
1141 shost_printk(KERN_ERR, instance, "reselection after won arbitration?\n");
1154 complete_cmd(instance, cmd);
1155 dsprintk(NDEBUG_SELECTION, instance,
1183 shost_printk(KERN_ERR, instance, "select: REQ timeout\n");
1188 do_abort(instance, 0);
1192 dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",
1199 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1203 complete_cmd(instance, cmd);
1204 dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n");
1209 dsprintk(NDEBUG_SELECTION, instance, "nexus established.\n");
1231 * @instance: instance of driver
1246 static void NCR5380_transfer_pio(struct Scsi_Host *instance,
1250 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1273 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ asserted\n");
1277 dsprintk(NDEBUG_PIO, instance, "phase mismatch\n");
1278 NCR5380_dprint_phase(NDEBUG_PIO, instance);
1300 NCR5380_dprint(NDEBUG_PIO, instance);
1306 NCR5380_dprint(NDEBUG_PIO, instance);
1311 NCR5380_dprint(NDEBUG_PIO, instance);
1319 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ negated, handshake complete\n");
1342 dsprintk(NDEBUG_PIO, instance, "residual %d\n", c);
1359 * @instance: adapter to reset
1369 static void do_reset(struct Scsi_Host *instance)
1371 struct NCR5380_hostdata __maybe_unused *hostdata = shost_priv(instance);
1387 * @instance: relevant scsi host instance
1393 static int do_abort(struct Scsi_Host *instance, unsigned int can_sleep)
1395 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1436 NCR5380_transfer_pio(instance, &phase, &len, &msgptr, can_sleep);
1451 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
1457 * Inputs : instance - instance of driver, *phase - pointer to
1469 static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1473 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1495 dsprintk(NDEBUG_DMA, instance, "initializing DMA %s: length %d, address %p\n",
1641 NCR5380_dma_complete(instance);
1646 * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
1650 * instance->connected.
1652 * Inputs : instance, instance for which we are doing commands
1655 * modified if a command disconnects, *instance->connected will
1659 static void NCR5380_information_transfer(struct Scsi_Host *instance)
1662 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1684 NCR5380_dprint_phase(NDEBUG_INFORMATION, instance);
1726 shost_printk(KERN_DEBUG, instance, "NDEBUG_NO_DATAOUT set, attempted DATAOUT aborted\n");
1728 do_abort(instance, 0);
1730 complete_cmd(instance, cmd);
1742 dsprintk(NDEBUG_INFORMATION, instance,
1763 if (NCR5380_transfer_dma(instance, &phase,
1773 do_reset(instance);
1774 bus_reset_cleanup(instance);
1783 NCR5380_transfer_pio(instance, &phase, &len,
1797 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1809 dsprintk(NDEBUG_QUEUES, instance,
1821 complete_cmd(instance, cmd);
1825 dsprintk(NDEBUG_QUEUES, instance, "autosense: adding cmd %p to tail of autosense queue\n",
1830 complete_cmd(instance, cmd);
1860 instance, "connected command %p for target %d lun %llu moved to disconnected queue\n",
1899 dsprintk(NDEBUG_EXTENDED, instance, "receiving extended message\n");
1904 NCR5380_transfer_pio(instance, &phase, &len, &data, 1);
1905 dsprintk(NDEBUG_EXTENDED, instance, "length %d, code 0x%02x\n",
1917 NCR5380_transfer_pio(instance, &phase, &len, &data, 1);
1918 dsprintk(NDEBUG_EXTENDED, instance, "message received, residual %d\n",
1927 shost_printk(KERN_ERR, instance, "error receiving extended message\n");
1930 shost_printk(KERN_NOTICE, instance, "extended message code %02x length %d is too long\n",
1964 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1969 complete_cmd(instance, cmd);
1982 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1988 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1992 shost_printk(KERN_ERR, instance, "unknown phase\n");
1993 NCR5380_dprint(NDEBUG_ANY, instance);
2007 do_reset(instance);
2008 bus_reset_cleanup(instance);
2015 * Function : void NCR5380_reselect (struct Scsi_Host *instance)
2017 * Purpose : does reselection, initializing the instance->connected
2021 * Inputs : instance - this instance of the NCR5380.
2024 static void NCR5380_reselect(struct Scsi_Host *instance)
2026 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2042 shost_printk(KERN_WARNING, instance,
2059 shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n");
2074 shost_printk(KERN_ERR, instance, "reselect: REQ timeout\n");
2075 do_abort(instance, 0);
2091 NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
2094 do_abort(instance, 0);
2101 shost_printk(KERN_ERR, instance, "expecting IDENTIFY message, got ");
2104 do_abort(instance, 0);
2133 dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
2138 shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
2144 if (do_abort(instance, 0) == 0)
2175 dsprintk(NDEBUG_RESELECTION, instance, "nexus established, target %d, lun %llu\n",
2245 struct Scsi_Host *instance = cmd->device->host;
2246 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2255 NCR5380_dprint(NDEBUG_ANY, instance);
2256 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2259 dsprintk(NDEBUG_ABORT, instance,
2267 dsprintk(NDEBUG_ABORT, instance,
2271 complete_cmd(instance, cmd);
2276 dsprintk(NDEBUG_ABORT, instance,
2282 complete_cmd(instance, cmd);
2288 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd);
2291 if (do_abort(instance, 0) < 0) {
2293 complete_cmd(instance, cmd);
2298 complete_cmd(instance, cmd);
2303 dsprintk(NDEBUG_ABORT, instance,
2305 complete_cmd(instance, cmd);
2310 dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);
2313 dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);
2323 static void bus_reset_cleanup(struct Scsi_Host *instance)
2325 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2342 complete_cmd(instance, hostdata->selecting);
2350 complete_cmd(instance, cmd);
2363 complete_cmd(instance, hostdata->connected);
2383 struct Scsi_Host *instance = cmd->device->host;
2384 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2391 shost_printk(KERN_INFO, instance, __func__);
2393 NCR5380_dprint(NDEBUG_ANY, instance);
2394 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2404 do_reset(instance);
2405 bus_reset_cleanup(instance);