• Home
  • Raw
  • Download

Lines Matching refs:hostdata

210 static int NCR5380_poll_politely2(struct NCR5380_hostdata *hostdata,  in NCR5380_poll_politely2()  argument
215 unsigned long n = hostdata->poll_loops; in NCR5380_poll_politely2()
299 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_print() local
348 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_print_phase() local
373 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_info() local
375 return hostdata->info; in NCR5380_info()
394 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_init() local
401 hostdata->host = instance; in NCR5380_init()
402 hostdata->id_mask = 1 << instance->this_id; in NCR5380_init()
403 hostdata->id_higher_mask = 0; in NCR5380_init()
404 for (i = hostdata->id_mask; i <= 0x80; i <<= 1) in NCR5380_init()
405 if (i > hostdata->id_mask) in NCR5380_init()
406 hostdata->id_higher_mask |= i; in NCR5380_init()
408 hostdata->busy[i] = 0; in NCR5380_init()
409 hostdata->dma_len = 0; in NCR5380_init()
411 spin_lock_init(&hostdata->lock); in NCR5380_init()
412 hostdata->connected = NULL; in NCR5380_init()
413 hostdata->sensing = NULL; in NCR5380_init()
414 INIT_LIST_HEAD(&hostdata->autosense); in NCR5380_init()
415 INIT_LIST_HEAD(&hostdata->unissued); in NCR5380_init()
416 INIT_LIST_HEAD(&hostdata->disconnected); in NCR5380_init()
418 hostdata->flags = flags; in NCR5380_init()
420 INIT_WORK(&hostdata->main_task, NCR5380_main); in NCR5380_init()
421 hostdata->work_q = alloc_workqueue("ncr5380_%d", in NCR5380_init()
424 if (!hostdata->work_q) in NCR5380_init()
427 snprintf(hostdata->info, sizeof(hostdata->info), in NCR5380_init()
429 instance->hostt->name, instance->irq, hostdata->io_port, in NCR5380_init()
430 hostdata->base, instance->can_queue, instance->cmd_per_lun, in NCR5380_init()
432 hostdata->flags & FLAG_DMA_FIXUP ? "DMA_FIXUP " : "", in NCR5380_init()
433 hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "", in NCR5380_init()
434 hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : ""); in NCR5380_init()
454 hostdata->poll_loops = NCR5380_REG_POLL_TIME * accesses_per_ms / 2; in NCR5380_init()
475 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_maybe_reset_bus() local
484 NCR5380_poll_politely(hostdata, in NCR5380_maybe_reset_bus()
498 if (hostdata->flags & FLAG_TOSHIBA_DELAY) in NCR5380_maybe_reset_bus()
520 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_exit() local
522 cancel_work_sync(&hostdata->main_task); in NCR5380_exit()
523 destroy_workqueue(hostdata->work_q); in NCR5380_exit()
535 struct NCR5380_hostdata *hostdata = shost_priv(instance); in complete_cmd() local
539 if (hostdata->sensing == cmd) { in complete_cmd()
542 scsi_eh_restore_cmnd(cmd, &hostdata->ses); in complete_cmd()
544 scsi_eh_restore_cmnd(cmd, &hostdata->ses); in complete_cmd()
547 hostdata->sensing = NULL; in complete_cmd()
566 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_queue_command() local
586 spin_lock_irqsave(&hostdata->lock, flags); in NCR5380_queue_command()
596 list_add(&ncmd->list, &hostdata->unissued); in NCR5380_queue_command()
598 list_add_tail(&ncmd->list, &hostdata->unissued); in NCR5380_queue_command()
600 spin_unlock_irqrestore(&hostdata->lock, flags); in NCR5380_queue_command()
606 queue_work(hostdata->work_q, &hostdata->main_task); in NCR5380_queue_command()
612 struct NCR5380_hostdata *hostdata = shost_priv(instance); in maybe_release_dma_irq() local
615 if (list_empty(&hostdata->disconnected) && in maybe_release_dma_irq()
616 list_empty(&hostdata->unissued) && in maybe_release_dma_irq()
617 list_empty(&hostdata->autosense) && in maybe_release_dma_irq()
618 !hostdata->connected && in maybe_release_dma_irq()
619 !hostdata->selecting) { in maybe_release_dma_irq()
637 struct NCR5380_hostdata *hostdata = shost_priv(instance); in dequeue_next_cmd() local
641 if (hostdata->sensing || list_empty(&hostdata->autosense)) { in dequeue_next_cmd()
642 list_for_each_entry(ncmd, &hostdata->unissued, list) { in dequeue_next_cmd()
645 cmd, scmd_id(cmd), hostdata->busy[scmd_id(cmd)], cmd->device->lun); in dequeue_next_cmd()
647 if (!(hostdata->busy[scmd_id(cmd)] & (1 << cmd->device->lun))) { in dequeue_next_cmd()
656 ncmd = list_first_entry(&hostdata->autosense, in dequeue_next_cmd()
662 scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); in dequeue_next_cmd()
663 hostdata->sensing = cmd; in dequeue_next_cmd()
671 struct NCR5380_hostdata *hostdata = shost_priv(instance); in requeue_cmd() local
674 if (hostdata->sensing == cmd) { in requeue_cmd()
675 scsi_eh_restore_cmnd(cmd, &hostdata->ses); in requeue_cmd()
676 list_add(&ncmd->list, &hostdata->autosense); in requeue_cmd()
677 hostdata->sensing = NULL; in requeue_cmd()
679 list_add(&ncmd->list, &hostdata->unissued); in requeue_cmd()
693 struct NCR5380_hostdata *hostdata = in NCR5380_main() local
695 struct Scsi_Host *instance = hostdata->host; in NCR5380_main()
701 spin_lock_irq(&hostdata->lock); in NCR5380_main()
702 while (!hostdata->connected && !hostdata->selecting) { in NCR5380_main()
732 if (hostdata->connected && !hostdata->dma_len) { in NCR5380_main()
737 if (!hostdata->connected) in NCR5380_main()
738 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); in NCR5380_main()
739 spin_unlock_irq(&hostdata->lock); in NCR5380_main()
755 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_dma_complete() local
762 if (hostdata->read_overruns) { in NCR5380_dma_complete()
763 p = hostdata->connected->SCp.phase; in NCR5380_dma_complete()
777 if ((sun3scsi_dma_finish(rq_data_dir(hostdata->connected->request)))) { in NCR5380_dma_complete()
797 transferred = hostdata->dma_len - NCR5380_dma_residual(hostdata); in NCR5380_dma_complete()
798 hostdata->dma_len = 0; in NCR5380_dma_complete()
800 data = (unsigned char **)&hostdata->connected->SCp.ptr; in NCR5380_dma_complete()
801 count = &hostdata->connected->SCp.this_residual; in NCR5380_dma_complete()
805 if (hostdata->read_overruns) { in NCR5380_dma_complete()
809 cnt = toPIO = hostdata->read_overruns; in NCR5380_dma_complete()
865 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_intr() local
870 spin_lock_irqsave(&hostdata->lock, flags); in NCR5380_intr()
888 if (hostdata->connected) { in NCR5380_intr()
890 queue_work(hostdata->work_q, &hostdata->main_task); in NCR5380_intr()
895 } else if ((NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_mask) && in NCR5380_intr()
903 if (!hostdata->connected) { in NCR5380_intr()
905 queue_work(hostdata->work_q, &hostdata->main_task); in NCR5380_intr()
907 if (!hostdata->connected) in NCR5380_intr()
908 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); in NCR5380_intr()
933 spin_unlock_irqrestore(&hostdata->lock, flags); in NCR5380_intr()
964 __releases(&hostdata->lock) __acquires(&hostdata->lock) in NCR5380_select()
966 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_select() local
987 hostdata->selecting = cmd; in NCR5380_select()
1000 NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask); in NCR5380_select()
1007 spin_unlock_irq(&hostdata->lock); in NCR5380_select()
1008 err = NCR5380_poll_politely2(hostdata, MODE_REG, MR_ARBITRATE, 0, in NCR5380_select()
1011 spin_lock_irq(&hostdata->lock); in NCR5380_select()
1016 if (!hostdata->selecting) { in NCR5380_select()
1027 spin_unlock_irq(&hostdata->lock); in NCR5380_select()
1034 (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) || in NCR5380_select()
1038 spin_lock_irq(&hostdata->lock); in NCR5380_select()
1054 if (hostdata->flags & FLAG_TOSHIBA_DELAY) in NCR5380_select()
1059 spin_lock_irq(&hostdata->lock); in NCR5380_select()
1065 if (!hostdata->selecting) { in NCR5380_select()
1078 NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask | (1 << scmd_id(cmd))); in NCR5380_select()
1096 spin_unlock_irq(&hostdata->lock); in NCR5380_select()
1134 err = NCR5380_poll_politely(hostdata, STATUS_REG, SR_BSY, SR_BSY, in NCR5380_select()
1138 spin_lock_irq(&hostdata->lock); in NCR5380_select()
1146 spin_lock_irq(&hostdata->lock); in NCR5380_select()
1150 if (!hostdata->selecting) in NCR5380_select()
1180 err = NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, HZ); in NCR5380_select()
1181 spin_lock_irq(&hostdata->lock); in NCR5380_select()
1187 if (!hostdata->selecting) { in NCR5380_select()
1211 hostdata->connected = cmd; in NCR5380_select()
1212 hostdata->busy[cmd->device->id] |= 1 << cmd->device->lun; in NCR5380_select()
1223 if (!hostdata->selecting) in NCR5380_select()
1225 hostdata->selecting = NULL; in NCR5380_select()
1258 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_transfer_pio() local
1277 if (NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, HZ) < 0) in NCR5380_transfer_pio()
1322 if (NCR5380_poll_politely(hostdata, in NCR5380_transfer_pio()
1381 struct NCR5380_hostdata __maybe_unused *hostdata = shost_priv(instance); in do_reset() local
1404 struct NCR5380_hostdata *hostdata = shost_priv(instance); in do_abort() local
1422 rc = NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, 10 * HZ); in do_abort()
1433 rc = NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, 0, 3 * HZ); in do_abort()
1480 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_transfer_dma() local
1492 hostdata->connected->SCp.phase = p; in NCR5380_transfer_dma()
1495 if (hostdata->read_overruns) in NCR5380_transfer_dma()
1496 c -= hostdata->read_overruns; in NCR5380_transfer_dma()
1497 else if (hostdata->flags & FLAG_DMA_FIXUP) in NCR5380_transfer_dma()
1513 if (!(hostdata->flags & FLAG_LATE_DMA_SETUP)) { in NCR5380_transfer_dma()
1518 result = NCR5380_dma_recv_setup(hostdata, d, c); in NCR5380_transfer_dma()
1520 result = NCR5380_dma_send_setup(hostdata, d, c); in NCR5380_transfer_dma()
1547 if (hostdata->flags & FLAG_LATE_DMA_SETUP) { in NCR5380_transfer_dma()
1552 result = NCR5380_dma_recv_setup(hostdata, d, c); in NCR5380_transfer_dma()
1554 result = NCR5380_dma_send_setup(hostdata, d, c); in NCR5380_transfer_dma()
1563 hostdata->dma_len = result; in NCR5380_transfer_dma()
1568 hostdata->dma_len = c; in NCR5380_transfer_dma()
1604 if (hostdata->flags & FLAG_DMA_FIXUP) { in NCR5380_transfer_dma()
1621 if (NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG, in NCR5380_transfer_dma()
1626 if (NCR5380_poll_politely(hostdata, STATUS_REG, in NCR5380_transfer_dma()
1637 if (NCR5380_poll_politely2(hostdata, in NCR5380_transfer_dma()
1668 __releases(&hostdata->lock) __acquires(&hostdata->lock) in NCR5380_information_transfer()
1670 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_information_transfer() local
1683 while ((cmd = hostdata->connected)) { in NCR5380_information_transfer()
1701 count = sun3scsi_dma_xfer_len(hostdata, cmd); in NCR5380_information_transfer()
1705 sun3scsi_dma_send_setup(hostdata, in NCR5380_information_transfer()
1708 sun3scsi_dma_recv_setup(hostdata, in NCR5380_information_transfer()
1739 hostdata->connected = NULL; in NCR5380_information_transfer()
1740 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_information_transfer()
1767 transfersize = NCR5380_dma_xfer_len(hostdata, cmd); in NCR5380_information_transfer()
1816 hostdata->connected = NULL; in NCR5380_information_transfer()
1817 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_information_transfer()
1833 &hostdata->autosense); in NCR5380_information_transfer()
1849 switch (hostdata->last_message) { in NCR5380_information_transfer()
1854 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF)); in NCR5380_information_transfer()
1863 hostdata->connected = NULL; in NCR5380_information_transfer()
1864 list_add(&ncmd->list, &hostdata->disconnected); in NCR5380_information_transfer()
1903 spin_unlock_irq(&hostdata->lock); in NCR5380_information_transfer()
1941 spin_lock_irq(&hostdata->lock); in NCR5380_information_transfer()
1942 if (!hostdata->connected) in NCR5380_information_transfer()
1969 hostdata->last_message = msgout; in NCR5380_information_transfer()
1972 hostdata->connected = NULL; in NCR5380_information_transfer()
1973 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_information_transfer()
2002 spin_unlock_irq(&hostdata->lock); in NCR5380_information_transfer()
2003 NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, HZ); in NCR5380_information_transfer()
2004 spin_lock_irq(&hostdata->lock); in NCR5380_information_transfer()
2021 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_reselect() local
2035 target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask); in NCR5380_reselect()
2052 if (NCR5380_poll_politely(hostdata, in NCR5380_reselect()
2064 if (NCR5380_poll_politely(hostdata, in NCR5380_reselect()
2116 list_for_each_entry(ncmd, &hostdata->disconnected, list) { in NCR5380_reselect()
2140 hostdata->busy[target] &= ~(1 << lun); in NCR5380_reselect()
2150 count = sun3scsi_dma_xfer_len(hostdata, tmp); in NCR5380_reselect()
2154 sun3scsi_dma_send_setup(hostdata, in NCR5380_reselect()
2157 sun3scsi_dma_recv_setup(hostdata, in NCR5380_reselect()
2169 hostdata->connected = tmp; in NCR5380_reselect()
2241 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_abort() local
2245 spin_lock_irqsave(&hostdata->lock, flags); in NCR5380_abort()
2253 if (list_del_cmd(&hostdata->unissued, cmd)) { in NCR5380_abort()
2261 if (hostdata->selecting == cmd) { in NCR5380_abort()
2264 hostdata->selecting = NULL; in NCR5380_abort()
2270 if (list_del_cmd(&hostdata->disconnected, cmd)) { in NCR5380_abort()
2282 if (hostdata->connected == cmd) { in NCR5380_abort()
2284 hostdata->connected = NULL; in NCR5380_abort()
2285 hostdata->dma_len = 0; in NCR5380_abort()
2297 if (list_del_cmd(&hostdata->autosense, cmd)) { in NCR5380_abort()
2307 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_abort()
2311 queue_work(hostdata->work_q, &hostdata->main_task); in NCR5380_abort()
2313 spin_unlock_irqrestore(&hostdata->lock, flags); in NCR5380_abort()
2321 struct NCR5380_hostdata *hostdata = shost_priv(instance); in bus_reset_cleanup() local
2336 if (hostdata->selecting) { in bus_reset_cleanup()
2337 hostdata->selecting->result = DID_RESET << 16; in bus_reset_cleanup()
2338 complete_cmd(instance, hostdata->selecting); in bus_reset_cleanup()
2339 hostdata->selecting = NULL; in bus_reset_cleanup()
2342 list_for_each_entry(ncmd, &hostdata->disconnected, list) { in bus_reset_cleanup()
2348 INIT_LIST_HEAD(&hostdata->disconnected); in bus_reset_cleanup()
2350 list_for_each_entry(ncmd, &hostdata->autosense, list) { in bus_reset_cleanup()
2355 INIT_LIST_HEAD(&hostdata->autosense); in bus_reset_cleanup()
2357 if (hostdata->connected) { in bus_reset_cleanup()
2358 set_host_byte(hostdata->connected, DID_RESET); in bus_reset_cleanup()
2359 complete_cmd(instance, hostdata->connected); in bus_reset_cleanup()
2360 hostdata->connected = NULL; in bus_reset_cleanup()
2364 hostdata->busy[i] = 0; in bus_reset_cleanup()
2365 hostdata->dma_len = 0; in bus_reset_cleanup()
2367 queue_work(hostdata->work_q, &hostdata->main_task); in bus_reset_cleanup()
2381 struct NCR5380_hostdata *hostdata = shost_priv(instance); in NCR5380_host_reset() local
2385 spin_lock_irqsave(&hostdata->lock, flags); in NCR5380_host_reset()
2393 list_for_each_entry(ncmd, &hostdata->unissued, list) { in NCR5380_host_reset()
2399 INIT_LIST_HEAD(&hostdata->unissued); in NCR5380_host_reset()
2404 spin_unlock_irqrestore(&hostdata->lock, flags); in NCR5380_host_reset()