Lines Matching defs:instance

76  * the command structure is placed into the per instance disconnected
116 * The generic driver is initialized by calling NCR5380_init(instance),
292 * @instance: adapter state to dump
297 static void NCR5380_print(struct Scsi_Host *instance)
299 struct NCR5380_hostdata *hostdata = shost_priv(instance);
341 * @instance: adapter to dump
346 static void NCR5380_print_phase(struct Scsi_Host *instance)
348 struct NCR5380_hostdata *hostdata = shost_priv(instance);
354 shost_printk(KERN_DEBUG, instance, "REQ not asserted, phase unknown.\n");
359 shost_printk(KERN_DEBUG, instance, "phase %s\n", phases[i].name);
366 * @instance: relevant scsi host instance
371 static const char *NCR5380_info(struct Scsi_Host *instance)
373 struct NCR5380_hostdata *hostdata = shost_priv(instance);
380 * @instance: adapter to configure
383 * Initializes *instance and corresponding 5380 chip,
392 static int NCR5380_init(struct Scsi_Host *instance, int flags)
394 struct NCR5380_hostdata *hostdata = shost_priv(instance);
399 instance->max_lun = 7;
401 hostdata->host = instance;
402 hostdata->id_mask = 1 << instance->this_id;
423 1, instance->host_no);
429 instance->hostt->name, instance->irq, hostdata->io_port,
430 hostdata->base, instance->can_queue, instance->cmd_per_lun,
431 instance->sg_tablesize, instance->this_id,
461 * @instance: adapter to check
473 static int NCR5380_maybe_reset_bus(struct Scsi_Host *instance)
475 struct NCR5380_hostdata *hostdata = shost_priv(instance);
483 shost_printk(KERN_ERR, instance, "SCSI bus busy, waiting up to five seconds\n");
488 shost_printk(KERN_ERR, instance, "bus busy, attempting abort\n");
489 do_abort(instance);
492 shost_printk(KERN_ERR, instance, "bus busy, attempting reset\n");
493 do_reset(instance);
504 shost_printk(KERN_ERR, instance, "bus locked solid\n");
513 * @instance: adapter to remove
518 static void NCR5380_exit(struct Scsi_Host *instance)
520 struct NCR5380_hostdata *hostdata = shost_priv(instance);
528 * @instance: the host instance
532 static void complete_cmd(struct Scsi_Host *instance,
535 struct NCR5380_hostdata *hostdata = shost_priv(instance);
537 dsprintk(NDEBUG_QUEUES, instance, "complete_cmd: cmd %p\n", cmd);
555 * @instance: the relevant SCSI adapter
558 * cmd is added to the per-instance issue queue, with minor
563 static int NCR5380_queue_command(struct Scsi_Host *instance,
566 struct NCR5380_hostdata *hostdata = shost_priv(instance);
574 shost_printk(KERN_DEBUG, instance, "WRITE attempted with NDEBUG_NO_WRITE set\n");
583 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");
725 maybe_release_dma_irq(instance);
727 dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES, instance,
729 requeue_cmd(instance, cmd);
733 dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n");
734 NCR5380_information_transfer(instance);
747 * @instance: the scsi host instance
753 static void NCR5380_dma_complete(struct Scsi_Host *instance)
755 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);
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);
1192 dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",
1199 NCR5380_transfer_pio(instance, &phase, &len, &data);
1203 complete_cmd(instance, cmd);
1204 dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n");
1209 dsprintk(NDEBUG_SELECTION, instance, "nexus established.\n");
1230 * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance,
1235 * Inputs : instance - instance of driver, *phase - pointer to
1254 static int NCR5380_transfer_pio(struct Scsi_Host *instance,
1258 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1280 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ asserted\n");
1284 dsprintk(NDEBUG_PIO, instance, "phase mismatch\n");
1285 NCR5380_dprint_phase(NDEBUG_PIO, instance);
1307 NCR5380_dprint(NDEBUG_PIO, instance);
1313 NCR5380_dprint(NDEBUG_PIO, instance);
1318 NCR5380_dprint(NDEBUG_PIO, instance);
1326 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ negated, handshake complete\n");
1347 dsprintk(NDEBUG_PIO, instance, "residual %d\n", c);
1369 * @instance: adapter to reset
1379 static void do_reset(struct Scsi_Host *instance)
1381 struct NCR5380_hostdata __maybe_unused *hostdata = shost_priv(instance);
1397 * @instance: relevant scsi host instance
1402 static int do_abort(struct Scsi_Host *instance)
1404 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1443 NCR5380_transfer_pio(instance, &phase, &len, &msgptr);
1458 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
1464 * Inputs : instance - instance of driver, *phase - pointer to
1476 static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1480 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1501 dsprintk(NDEBUG_DMA, instance, "initializing DMA %s: length %d, address %p\n",
1624 shost_printk(KERN_ERR, instance, "PDMA read: DRQ timeout\n");
1629 shost_printk(KERN_ERR, instance, "PDMA read: !REQ timeout\n");
1641 shost_printk(KERN_ERR, instance, "PDMA write: DRQ and phase timeout\n");
1646 NCR5380_dma_complete(instance);
1651 * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
1655 * instance->connected.
1657 * Inputs : instance, instance for which we are doing commands
1660 * modified if a command disconnects, *instance->connected will
1667 static void NCR5380_information_transfer(struct Scsi_Host *instance)
1670 struct NCR5380_hostdata *hostdata = shost_priv(instance);
1692 NCR5380_dprint_phase(NDEBUG_INFORMATION, instance);
1734 shost_printk(KERN_DEBUG, instance, "NDEBUG_NO_DATAOUT set, attempted DATAOUT aborted\n");
1736 do_abort(instance);
1738 complete_cmd(instance, cmd);
1750 dsprintk(NDEBUG_INFORMATION, instance,
1771 if (NCR5380_transfer_dma(instance, &phase,
1781 do_reset(instance);
1782 bus_reset_cleanup(instance);
1791 NCR5380_transfer_pio(instance, &phase, &len,
1803 NCR5380_transfer_pio(instance, &phase, &len, &data);
1812 dsprintk(NDEBUG_QUEUES, instance,
1826 complete_cmd(instance, cmd);
1830 dsprintk(NDEBUG_QUEUES, instance, "autosense: adding cmd %p to tail of autosense queue\n",
1835 complete_cmd(instance, cmd);
1844 maybe_release_dma_irq(instance);
1866 instance, "connected command %p for target %d lun %llu moved to disconnected queue\n",
1905 dsprintk(NDEBUG_EXTENDED, instance, "receiving extended message\n");
1910 NCR5380_transfer_pio(instance, &phase, &len, &data);
1911 dsprintk(NDEBUG_EXTENDED, instance, "length %d, code 0x%02x\n",
1923 NCR5380_transfer_pio(instance, &phase, &len, &data);
1924 dsprintk(NDEBUG_EXTENDED, instance, "message received, residual %d\n",
1933 shost_printk(KERN_ERR, instance, "error receiving extended message\n");
1936 shost_printk(KERN_NOTICE, instance, "extended message code %02x length %d is too long\n",
1970 NCR5380_transfer_pio(instance, &phase, &len, &data);
1975 complete_cmd(instance, cmd);
1976 maybe_release_dma_irq(instance);
1989 NCR5380_transfer_pio(instance, &phase, &len, &data);
1994 NCR5380_transfer_pio(instance, &phase, &len, &data);
1998 shost_printk(KERN_ERR, instance, "unknown phase\n");
1999 NCR5380_dprint(NDEBUG_ANY, instance);
2010 * Function : void NCR5380_reselect (struct Scsi_Host *instance)
2012 * Purpose : does reselection, initializing the instance->connected
2016 * Inputs : instance - this instance of the NCR5380.
2019 static void NCR5380_reselect(struct Scsi_Host *instance)
2021 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2037 shost_printk(KERN_WARNING, instance,
2054 shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n");
2069 shost_printk(KERN_ERR, instance, "reselect: REQ timeout\n");
2070 do_abort(instance);
2086 NCR5380_transfer_pio(instance, &phase, &len, &data);
2089 do_abort(instance);
2096 shost_printk(KERN_ERR, instance, "expecting IDENTIFY message, got ");
2099 do_abort(instance);
2128 dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
2133 shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
2139 if (do_abort(instance) == 0)
2170 dsprintk(NDEBUG_RESELECTION, instance, "nexus established, target %d, lun %llu\n",
2240 struct Scsi_Host *instance = cmd->device->host;
2241 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2250 NCR5380_dprint(NDEBUG_ANY, instance);
2251 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2254 dsprintk(NDEBUG_ABORT, instance,
2262 dsprintk(NDEBUG_ABORT, instance,
2266 complete_cmd(instance, cmd);
2271 dsprintk(NDEBUG_ABORT, instance,
2277 complete_cmd(instance, cmd);
2283 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd);
2286 if (do_abort(instance) < 0) {
2288 complete_cmd(instance, cmd);
2293 complete_cmd(instance, cmd);
2298 dsprintk(NDEBUG_ABORT, instance,
2300 complete_cmd(instance, cmd);
2305 dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);
2308 dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);
2312 maybe_release_dma_irq(instance);
2319 static void bus_reset_cleanup(struct Scsi_Host *instance)
2321 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2338 complete_cmd(instance, hostdata->selecting);
2346 complete_cmd(instance, cmd);
2359 complete_cmd(instance, hostdata->connected);
2368 maybe_release_dma_irq(instance);
2380 struct Scsi_Host *instance = cmd->device->host;
2381 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2388 shost_printk(KERN_INFO, instance, __func__);
2390 NCR5380_dprint(NDEBUG_ANY, instance);
2391 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2401 do_reset(instance);
2402 bus_reset_cleanup(instance);