Lines Matching +full:settle +full:- +full:delay +full:- +full:usec
26 * config file (!adp7771.cfg), the Adaptec AHA-2740A Series User's Guide,
29 * (adp7770.ovl), the Adaptec AHA-2740 Series Technical Reference Manual,
30 * the Adaptec AIC-7770 Data Book, the ANSI SCSI specification, the
31 * ANSI SCSI-2 specification (draft 10c), ...
33 * --------------------------------------------------------------------------
41 * --------------------------------------------------------------------------
42 * Copyright (c) 1994-2000 Justin T. Gibbs.
43 * Copyright (c) 2000-2001 Adaptec Inc.
57 * 3. Neither the names of the above-listed copyright holders nor the names
78 *---------------------------------------------------------------------------
82 * Rory Bolt - Sequencer bug fixes
83 * Jay Estabrook - Initial DEC Alpha support
84 * Doug Ledford - Much needed abort/reset bug fixes
85 * Kai Makisara - DMAing of SCBs
101 * Copyright (c) 1997-1999 Doug Ledford
132 #include <linux/delay.h> /* For ssleep/msleep */
137 * Set this to the delay in seconds after SCSI bus reset.
139 * The scsi error recovery code performs its own bus settle
140 * delay handling for error recovery actions.
149 * To change the default number of tagged transactions allowed per-device,
156 * Twin adapters will use indexes 0-7 for channel 0, and indexes 8-15
183 * (0, 2-11, 13-15), disables tagged queueing for ID 12, and tells the
191 * IDs 2, 5-7, and 9-15.
257 ahc->platform_data->host->host_no, in ahc_print_path()
259 scb != NULL ? SCB_GET_TARGET(ahc, scb) : -1, in ahc_print_path()
260 scb != NULL ? SCB_GET_LUN(scb) : -1); in ahc_print_path()
264 * XXX - these options apply unilaterally to _all_ 274x/284x/294x
291 * non-0 = reverse polarity pci parity checking
306 * 0 - 256ms
307 * 1 - 128ms
308 * 2 - 64ms
309 * 3 - 32ms
336 "period-delimited options string:\n"
348 " tag_info:<tag_str> Set per-target tag depth\n"
386 ahc_delay(long usec) in ahc_delay() argument
390 * multi-millisecond waits. Wait at most in ahc_delay()
393 while (usec > 0) { in ahc_delay()
394 udelay(usec % 1024); in ahc_delay()
395 usec -= 1024; in ahc_delay()
405 if (ahc->tag == BUS_SPACE_MEMIO) { in ahc_inb()
406 x = readb(ahc->bsh.maddr + port); in ahc_inb()
408 x = inb(ahc->bsh.ioport + port); in ahc_inb()
417 if (ahc->tag == BUS_SPACE_MEMIO) { in ahc_outb()
418 writeb(val, ahc->bsh.maddr + port); in ahc_outb()
420 outb(val, ahc->bsh.ioport + port); in ahc_outb()
465 cmd = scb->io_ctx; in ahc_linux_unmap_scb()
477 if ((scb->sg_count + 1) > AHC_NSEG) in ahc_linux_map_seg()
482 sg->addr = ahc_htole32(addr & 0xFFFFFFFF); in ahc_linux_map_seg()
483 scb->platform_data->xfer_len += len; in ahc_linux_map_seg()
486 && (ahc->flags & AHC_39BIT_ADDRESSING) != 0) in ahc_linux_map_seg()
489 sg->len = ahc_htole32(len); in ahc_linux_map_seg()
505 ahc = *(struct ahc_softc **)host->hostdata; in ahc_linux_info()
509 strcat(bp, ahc->description); in ahc_linux_info()
525 struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); in ahc_linux_queue_lck()
529 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; in ahc_linux_queue_lck()
532 if (ahc->platform_data->qfrozen == 0) { in ahc_linux_queue_lck()
533 cmd->result = CAM_REQ_INPROG << 16; in ahc_linux_queue_lck()
547 *((struct ahc_softc **)dev_to_shost(&starget->dev)->hostdata); in DEF_SCSI_QCMD()
550 target_offset = starget->id; in DEF_SCSI_QCMD()
551 if (starget->channel != 0) in DEF_SCSI_QCMD()
554 return &ahc->platform_data->starget[target_offset]; in DEF_SCSI_QCMD()
561 *((struct ahc_softc **)dev_to_shost(&starget->dev)->hostdata); in ahc_linux_target_alloc()
562 struct seeprom_config *sc = ahc->seep_config; in ahc_linux_target_alloc()
567 char channel = starget->channel + 'A'; in ahc_linux_target_alloc()
568 unsigned int our_id = ahc->our_id; in ahc_linux_target_alloc()
571 target_offset = starget->id; in ahc_linux_target_alloc()
572 if (starget->channel != 0) in ahc_linux_target_alloc()
575 if (starget->channel) in ahc_linux_target_alloc()
576 our_id = ahc->our_id_b; in ahc_linux_target_alloc()
587 int flags = sc->device_flags[target_offset]; in ahc_linux_target_alloc()
589 if (ahc->flags & AHC_NEWEEPROM_FMT) { in ahc_linux_target_alloc()
601 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_linux_target_alloc()
614 ahc_compile_devinfo(&devinfo, our_id, starget->id, in ahc_linux_target_alloc()
638 *((struct ahc_softc **)sdev->host->hostdata); in ahc_linux_slave_alloc()
639 struct scsi_target *starget = sdev->sdev_target; in ahc_linux_slave_alloc()
643 printk("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); in ahc_linux_slave_alloc()
652 dev->openings = 1; in ahc_linux_slave_alloc()
659 dev->maxtags = 0; in ahc_linux_slave_alloc()
675 if (!spi_initial_dv(sdev->sdev_target)) in ahc_linux_slave_configure()
696 ahc = *((struct ahc_softc **)sdev->host->hostdata); in ahc_linux_biosparam()
709 extended = (ahc->flags & AHC_EXTENDED_TRANS_A) != 0; in ahc_linux_biosparam()
711 extended = (ahc->flags & AHC_EXTENDED_TRANS_B) != 0; in ahc_linux_biosparam()
732 error = ahc_linux_queue_recovery_cmd(cmd->device, cmd); in ahc_linux_abort()
746 error = ahc_linux_queue_recovery_cmd(cmd->device, NULL); in ahc_linux_dev_reset()
762 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; in ahc_linux_bus_reset()
791 .this_id = -1,
806 unsigned int scsiid = (sdev->id << TID_SHIFT) & TID; in ahc_build_scsiid()
808 if (sdev->channel == 0) in ahc_build_scsiid()
809 scsiid |= ahc->our_id; in ahc_build_scsiid()
811 scsiid |= ahc->our_id_b | TWIN_CHNLB; in ahc_build_scsiid()
837 dmat->alignment = alignment; in ahc_dma_tag_create()
838 dmat->boundary = boundary; in ahc_dma_tag_create()
839 dmat->maxsize = maxsize; in ahc_dma_tag_create()
855 *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC); in ahc_dmamem_alloc()
865 dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map); in ahc_dmamem_free()
875 * initialization and not for per-transaction buffer mapping. in ahc_dmamap_load()
880 stack_sg.ds_len = dmat->maxsize; in ahc_dmamap_load()
942 instance = -1; in ahc_parse_brace_option()
943 targ = -1; in ahc_parse_brace_option()
955 if (instance == -1) { in ahc_parse_brace_option()
959 if (targ == -1) in ahc_parse_brace_option()
970 if (targ != -1) in ahc_parse_brace_option()
971 targ = -1; in ahc_parse_brace_option()
972 else if (instance != -1) in ahc_parse_brace_option()
973 instance = -1; in ahc_parse_brace_option()
978 if (instance == -1) in ahc_parse_brace_option()
1085 template->name = ahc->description; in ahc_linux_register_host()
1088 return -ENOMEM; in ahc_linux_register_host()
1090 *((struct ahc_softc **)host->hostdata) = ahc; in ahc_linux_register_host()
1091 ahc->platform_data->host = host; in ahc_linux_register_host()
1092 host->can_queue = AHC_MAX_QUEUE; in ahc_linux_register_host()
1093 host->cmd_per_lun = 2; in ahc_linux_register_host()
1095 host->this_id = ahc->our_id; in ahc_linux_register_host()
1096 host->irq = ahc->platform_data->irq; in ahc_linux_register_host()
1097 host->max_id = (ahc->features & AHC_WIDE) ? 16 : 8; in ahc_linux_register_host()
1098 host->max_lun = AHC_NUM_LUNS; in ahc_linux_register_host()
1099 host->max_channel = (ahc->features & AHC_TWIN) ? 1 : 0; in ahc_linux_register_host()
1100 host->sg_tablesize = AHC_NSEG; in ahc_linux_register_host()
1104 sprintf(buf, "scsi%d", host->host_no); in ahc_linux_register_host()
1110 host->unique_id = ahc->unit; in ahc_linux_register_host()
1114 host->transportt = ahc_linux_transport_template; in ahc_linux_register_host()
1116 retval = scsi_add_host(host, ahc->dev); in ahc_linux_register_host()
1145 ahc->flags &= ~(AHC_RESET_BUS_A|AHC_RESET_BUS_B); in ahc_linux_initialize_scsi_bus()
1147 if ((ahc->flags & AHC_RESET_BUS_A) != 0) in ahc_linux_initialize_scsi_bus()
1150 numtarg = (ahc->features & AHC_WIDE) ? 16 : 8; in ahc_linux_initialize_scsi_bus()
1152 if ((ahc->features & AHC_TWIN) != 0) { in ahc_linux_initialize_scsi_bus()
1154 if ((ahc->flags & AHC_RESET_BUS_B) != 0) { in ahc_linux_initialize_scsi_bus()
1176 our_id = ahc->our_id; in ahc_linux_initialize_scsi_bus()
1178 if (i > 7 && (ahc->features & AHC_TWIN) != 0) { in ahc_linux_initialize_scsi_bus()
1180 our_id = ahc->our_id_b; in ahc_linux_initialize_scsi_bus()
1192 if ((ahc->flags & (AHC_RESET_BUS_A|AHC_RESET_BUS_B)) != 0) { in ahc_linux_initialize_scsi_bus()
1203 ahc->platform_data = in ahc_platform_alloc()
1205 if (ahc->platform_data == NULL) in ahc_platform_alloc()
1207 ahc->platform_data->irq = AHC_LINUX_NOIRQ; in ahc_platform_alloc()
1209 ahc->seltime = (aic7xxx_seltime & 0x3) << 4; in ahc_platform_alloc()
1210 ahc->seltime_b = (aic7xxx_seltime & 0x3) << 4; in ahc_platform_alloc()
1212 ahc->flags |= AHC_DISABLE_PCI_PERR; in ahc_platform_alloc()
1223 if (ahc->platform_data != NULL) { in ahc_platform_free()
1226 starget = ahc->platform_data->starget[i]; in ahc_platform_free()
1228 ahc->platform_data->starget[i] = NULL; in ahc_platform_free()
1232 if (ahc->platform_data->irq != AHC_LINUX_NOIRQ) in ahc_platform_free()
1233 free_irq(ahc->platform_data->irq, ahc); in ahc_platform_free()
1234 if (ahc->tag == BUS_SPACE_PIO in ahc_platform_free()
1235 && ahc->bsh.ioport != 0) in ahc_platform_free()
1236 release_region(ahc->bsh.ioport, 256); in ahc_platform_free()
1237 if (ahc->tag == BUS_SPACE_MEMIO in ahc_platform_free()
1238 && ahc->bsh.maddr != NULL) { in ahc_platform_free()
1239 iounmap(ahc->bsh.maddr); in ahc_platform_free()
1240 release_mem_region(ahc->platform_data->mem_busaddr, in ahc_platform_free()
1244 if (ahc->platform_data->host) in ahc_platform_free()
1245 scsi_host_put(ahc->platform_data->host); in ahc_platform_free()
1247 kfree(ahc->platform_data); in ahc_platform_free()
1272 was_queuing = dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED); in ahc_platform_set_tags()
1285 if ((dev->flags & AHC_DEV_FREEZE_TIL_EMPTY) == 0 in ahc_platform_set_tags()
1287 && (dev->active != 0)) { in ahc_platform_set_tags()
1288 dev->flags |= AHC_DEV_FREEZE_TIL_EMPTY; in ahc_platform_set_tags()
1289 dev->qfrozen++; in ahc_platform_set_tags()
1292 dev->flags &= ~(AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED|AHC_DEV_PERIODIC_OTAG); in ahc_platform_set_tags()
1303 dev->maxtags = usertags; in ahc_platform_set_tags()
1304 dev->openings = dev->maxtags - dev->active; in ahc_platform_set_tags()
1306 if (dev->maxtags == 0) { in ahc_platform_set_tags()
1310 dev->openings = 1; in ahc_platform_set_tags()
1312 dev->flags |= AHC_DEV_Q_TAGGED; in ahc_platform_set_tags()
1314 dev->flags |= AHC_DEV_PERIODIC_OTAG; in ahc_platform_set_tags()
1316 dev->flags |= AHC_DEV_Q_BASIC; in ahc_platform_set_tags()
1319 dev->maxtags = 0; in ahc_platform_set_tags()
1320 dev->openings = 1 - dev->active; in ahc_platform_set_tags()
1322 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { in ahc_platform_set_tags()
1326 dev->openings + dev->active); in ahc_platform_set_tags()
1354 if ((ahc->user_discenable & devinfo->target_mask) != 0) { in ahc_linux_user_tagdepth()
1355 if (ahc->unit >= ARRAY_SIZE(aic7xxx_tag_info)) { in ahc_linux_user_tagdepth()
1369 tag_info = &aic7xxx_tag_info[ahc->unit]; in ahc_linux_user_tagdepth()
1370 tags = tag_info->tag_commands[devinfo->target_offset]; in ahc_linux_user_tagdepth()
1386 struct ahc_softc *ahc = *((struct ahc_softc **)sdev->host->hostdata); in ahc_linux_device_queue_depth()
1389 sdev->sdev_target->channel == 0 in ahc_linux_device_queue_depth()
1390 ? ahc->our_id : ahc->our_id_b, in ahc_linux_device_queue_depth()
1391 sdev->sdev_target->id, sdev->lun, in ahc_linux_device_queue_depth()
1392 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahc_linux_device_queue_depth()
1395 if (tags != 0 && sdev->tagged_supported != 0) { in ahc_linux_device_queue_depth()
1425 if (ahc->platform_data->qfrozen != 0) in ahc_linux_run_command()
1434 if (!(cmd->flags & SCMD_TAGGED) in ahc_linux_run_command()
1435 && (ahc->features & AHC_SCB_BTT) == 0) { in ahc_linux_run_command()
1438 target_offset = cmd->device->id + cmd->device->channel * 8; in ahc_linux_run_command()
1439 untagged_q = &(ahc->untagged_queues[target_offset]); in ahc_linux_run_command()
1459 scb->io_ctx = cmd; in ahc_linux_run_command()
1460 scb->platform_data->dev = dev; in ahc_linux_run_command()
1461 hscb = scb->hscb; in ahc_linux_run_command()
1462 cmd->host_scribble = (char *)scb; in ahc_linux_run_command()
1467 hscb->control = 0; in ahc_linux_run_command()
1468 hscb->scsiid = ahc_build_scsiid(ahc, cmd->device); in ahc_linux_run_command()
1469 hscb->lun = cmd->device->lun; in ahc_linux_run_command()
1474 hscb->scsirate = tinfo->scsirate; in ahc_linux_run_command()
1475 hscb->scsioffset = tinfo->curr.offset; in ahc_linux_run_command()
1476 if ((tstate->ultraenb & mask) != 0) in ahc_linux_run_command()
1477 hscb->control |= ULTRAENB; in ahc_linux_run_command()
1479 if ((ahc->user_discenable & mask) != 0) in ahc_linux_run_command()
1480 hscb->control |= DISCENB; in ahc_linux_run_command()
1482 if ((tstate->auto_negotiate & mask) != 0) { in ahc_linux_run_command()
1483 scb->flags |= SCB_AUTO_NEGOTIATE; in ahc_linux_run_command()
1484 scb->hscb->control |= MK_MESSAGE; in ahc_linux_run_command()
1487 if ((dev->flags & (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) { in ahc_linux_run_command()
1488 if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH in ahc_linux_run_command()
1489 && (dev->flags & AHC_DEV_Q_TAGGED) != 0) { in ahc_linux_run_command()
1490 hscb->control |= ORDERED_QUEUE_TAG; in ahc_linux_run_command()
1491 dev->commands_since_idle_or_otag = 0; in ahc_linux_run_command()
1493 hscb->control |= SIMPLE_QUEUE_TAG; in ahc_linux_run_command()
1497 hscb->cdb_len = cmd->cmd_len; in ahc_linux_run_command()
1498 if (hscb->cdb_len <= 12) { in ahc_linux_run_command()
1499 memcpy(hscb->shared_data.cdb, cmd->cmnd, hscb->cdb_len); in ahc_linux_run_command()
1501 memcpy(hscb->cdb32, cmd->cmnd, hscb->cdb_len); in ahc_linux_run_command()
1502 scb->flags |= SCB_CDB32_PTR; in ahc_linux_run_command()
1505 scb->platform_data->xfer_len = 0; in ahc_linux_run_command()
1508 scb->sg_count = 0; in ahc_linux_run_command()
1516 sg = scb->sg_list; in ahc_linux_run_command()
1531 scb->sg_count += consumed; in ahc_linux_run_command()
1533 sg--; in ahc_linux_run_command()
1534 sg->len |= ahc_htole32(AHC_DMA_LAST_SEG); in ahc_linux_run_command()
1539 scb->hscb->sgptr = in ahc_linux_run_command()
1540 ahc_htole32(scb->sg_list_phys | SG_FULL_RESID); in ahc_linux_run_command()
1546 scb->hscb->dataptr = scb->sg_list->addr; in ahc_linux_run_command()
1547 scb->hscb->datacnt = scb->sg_list->len; in ahc_linux_run_command()
1549 scb->hscb->sgptr = ahc_htole32(SG_LIST_NULL); in ahc_linux_run_command()
1550 scb->hscb->dataptr = 0; in ahc_linux_run_command()
1551 scb->hscb->datacnt = 0; in ahc_linux_run_command()
1552 scb->sg_count = 0; in ahc_linux_run_command()
1555 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links); in ahc_linux_run_command()
1556 dev->openings--; in ahc_linux_run_command()
1557 dev->active++; in ahc_linux_run_command()
1558 dev->commands_issued++; in ahc_linux_run_command()
1559 if ((dev->flags & AHC_DEV_PERIODIC_OTAG) != 0) in ahc_linux_run_command()
1560 dev->commands_since_idle_or_otag++; in ahc_linux_run_command()
1562 scb->flags |= SCB_ACTIVE; in ahc_linux_run_command()
1565 scb->flags |= SCB_UNTAGGEDQ; in ahc_linux_run_command()
1610 channel == 'A' ? ahc->our_id in ahc_send_async()
1611 : ahc->our_id_b, in ahc_send_async()
1618 if (tinfo->curr.period != tinfo->goal.period in ahc_send_async()
1619 || tinfo->curr.width != tinfo->goal.width in ahc_send_async()
1620 || tinfo->curr.offset != tinfo->goal.offset in ahc_send_async()
1621 || tinfo->curr.ppr_options != tinfo->goal.ppr_options) in ahc_send_async()
1632 starget = ahc->platform_data->starget[target_offset]; in ahc_send_async()
1641 if (tinfo->curr.period == spi_period(starget) in ahc_send_async()
1642 && tinfo->curr.width == spi_width(starget) in ahc_send_async()
1643 && tinfo->curr.offset == spi_offset(starget) in ahc_send_async()
1644 && tinfo->curr.ppr_options == target_ppr_options) in ahc_send_async()
1648 spi_period(starget) = tinfo->curr.period; in ahc_send_async()
1649 spi_width(starget) = tinfo->curr.width; in ahc_send_async()
1650 spi_offset(starget) = tinfo->curr.offset; in ahc_send_async()
1651 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; in ahc_send_async()
1652 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; in ahc_send_async()
1653 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; in ahc_send_async()
1660 scsi_report_device_reset(ahc->platform_data->host, in ahc_send_async()
1661 channel - 'A', target); in ahc_send_async()
1665 if (ahc->platform_data->host != NULL) { in ahc_send_async()
1666 scsi_report_bus_reset(ahc->platform_data->host, in ahc_send_async()
1667 channel - 'A'); in ahc_send_async()
1685 if ((scb->flags & SCB_UNTAGGEDQ) != 0) { in ahc_done()
1690 untagged_q = &(ahc->untagged_queues[target_offset]); in ahc_done()
1693 } else if ((scb->flags & SCB_ACTIVE) == 0) { in ahc_done()
1699 printk("SCB %d done'd twice\n", scb->hscb->tag); in ahc_done()
1703 cmd = scb->io_ctx; in ahc_done()
1704 dev = scb->platform_data->dev; in ahc_done()
1705 dev->active--; in ahc_done()
1706 dev->openings++; in ahc_done()
1707 if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) { in ahc_done()
1708 cmd->result &= ~(CAM_DEV_QFRZN << 16); in ahc_done()
1709 dev->qfrozen--; in ahc_done()
1715 * The Linux mid-layer assumes that sense in ahc_done()
1719 cmd->sense_buffer[0] = 0; in ahc_done()
1725 ahc_get_transfer_length(scb) - ahc_get_residual(scb); in ahc_done()
1727 if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) { in ahc_done()
1745 } else if (amount_xferred < scb->io_ctx->underflow) { in ahc_done()
1750 for (i = 0; i < scb->io_ctx->cmd_len; i++) in ahc_done()
1751 printk(" 0x%x", scb->io_ctx->cmnd[i]); in ahc_done()
1764 ahc_linux_handle_scsi_status(ahc, cmd->device, scb); in ahc_done()
1767 if (dev->openings == 1 in ahc_done()
1770 dev->tag_success_count++; in ahc_done()
1777 if ((dev->openings + dev->active) < dev->maxtags in ahc_done()
1778 && dev->tag_success_count > AHC_TAG_SUCCESS_INTERVAL) { in ahc_done()
1779 dev->tag_success_count = 0; in ahc_done()
1780 dev->openings++; in ahc_done()
1783 if (dev->active == 0) in ahc_done()
1784 dev->commands_since_idle_or_otag = 0; in ahc_done()
1786 if ((scb->flags & SCB_RECOVERY_SCB) != 0) { in ahc_done()
1792 if (ahc->platform_data->eh_done) in ahc_done()
1793 complete(ahc->platform_data->eh_done); in ahc_done()
1808 ahc->our_id, in ahc_linux_handle_scsi_status()
1809 sdev->sdev_target->id, sdev->lun, in ahc_linux_handle_scsi_status()
1810 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahc_linux_handle_scsi_status()
1814 * We don't currently trust the mid-layer to in ahc_linux_handle_scsi_status()
1816 * when one occurs, we tell the mid-layer to in ahc_linux_handle_scsi_status()
1835 cmd = scb->io_ctx; in ahc_linux_handle_scsi_status()
1836 if (scb->flags & SCB_SENSE) { in ahc_linux_handle_scsi_status()
1840 - ahc_get_sense_residual(scb), in ahc_linux_handle_scsi_status()
1842 memcpy(cmd->sense_buffer, in ahc_linux_handle_scsi_status()
1845 memset(&cmd->sense_buffer[sense_size], 0, in ahc_linux_handle_scsi_status()
1846 SCSI_SENSE_BUFFERSIZE - sense_size); in ahc_linux_handle_scsi_status()
1856 printk("0x%x ", cmd->sense_buffer[i]); in ahc_linux_handle_scsi_status()
1870 * This ensures that dev->active is equal to in ahc_linux_handle_scsi_status()
1874 dev->tag_success_count = 0; in ahc_linux_handle_scsi_status()
1875 if (dev->active != 0) { in ahc_linux_handle_scsi_status()
1880 dev->openings = 0; in ahc_linux_handle_scsi_status()
1883 printk("Dropping tag count to %d\n", dev->active); in ahc_linux_handle_scsi_status()
1885 if (dev->active == dev->tags_on_last_queuefull) { in ahc_linux_handle_scsi_status()
1887 dev->last_queuefull_same_count++; in ahc_linux_handle_scsi_status()
1896 if (dev->last_queuefull_same_count in ahc_linux_handle_scsi_status()
1898 dev->maxtags = dev->active; in ahc_linux_handle_scsi_status()
1901 dev->active); in ahc_linux_handle_scsi_status()
1904 dev->tags_on_last_queuefull = dev->active; in ahc_linux_handle_scsi_status()
1905 dev->last_queuefull_same_count = 0; in ahc_linux_handle_scsi_status()
1910 (dev->flags & AHC_DEV_Q_BASIC) in ahc_linux_handle_scsi_status()
1918 dev->openings = 1; in ahc_linux_handle_scsi_status()
1921 (dev->flags & AHC_DEV_Q_BASIC) in ahc_linux_handle_scsi_status()
2004 ahc->platform_data->qfrozen++; in ahc_linux_freeze_simq()
2005 if (ahc->platform_data->qfrozen == 1) { in ahc_linux_freeze_simq()
2006 scsi_block_requests(ahc->platform_data->host); in ahc_linux_freeze_simq()
2024 if (ahc->platform_data->qfrozen > 0) in ahc_linux_release_simq()
2025 ahc->platform_data->qfrozen--; in ahc_linux_release_simq()
2026 if (ahc->platform_data->qfrozen == 0) in ahc_linux_release_simq()
2030 * There is still a race here. The mid-layer in ahc_linux_release_simq()
2036 scsi_unblock_requests(ahc->platform_data->host); in ahc_linux_release_simq()
2060 ahc = *(struct ahc_softc **)sdev->host->hostdata; in ahc_linux_queue_recovery_cmd()
2067 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahc_linux_queue_recovery_cmd()
2068 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahc_linux_queue_recovery_cmd()
2089 ahc_name(ahc), sdev->channel, sdev->id, (u8)sdev->lun); in ahc_linux_queue_recovery_cmd()
2094 if (cmd && (dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0 in ahc_linux_queue_recovery_cmd()
2095 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2096 cmd->device->channel + 'A', in ahc_linux_queue_recovery_cmd()
2097 (u8)cmd->device->lun, in ahc_linux_queue_recovery_cmd()
2100 ahc_name(ahc), cmd->device->channel, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2101 (u8)cmd->device->lun); in ahc_linux_queue_recovery_cmd()
2110 LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) { in ahc_linux_queue_recovery_cmd()
2111 if (scb->io_ctx == cmd) { in ahc_linux_queue_recovery_cmd()
2118 LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) { in ahc_linux_queue_recovery_cmd()
2119 if (ahc_match_scb(ahc, scb, sdev->id, in ahc_linux_queue_recovery_cmd()
2120 sdev->channel + 'A', in ahc_linux_queue_recovery_cmd()
2134 if ((pending_scb->flags & SCB_RECOVERY_SCB) != 0) { in ahc_linux_queue_recovery_cmd()
2151 if ((pending_scb->flags & SCB_ACTIVE) == 0) { in ahc_linux_queue_recovery_cmd()
2162 if (ahc_search_qinfifo(ahc, sdev->id, in ahc_linux_queue_recovery_cmd()
2163 sdev->channel + 'A', in ahc_linux_queue_recovery_cmd()
2164 sdev->lun, in ahc_linux_queue_recovery_cmd()
2165 pending_scb->hscb->tag, in ahc_linux_queue_recovery_cmd()
2169 ahc_name(ahc), sdev->channel, in ahc_linux_queue_recovery_cmd()
2170 sdev->id, (u8)sdev->lun); in ahc_linux_queue_recovery_cmd()
2174 } else if (ahc_search_qinfifo(ahc, sdev->id, in ahc_linux_queue_recovery_cmd()
2175 sdev->channel + 'A', in ahc_linux_queue_recovery_cmd()
2176 sdev->lun, in ahc_linux_queue_recovery_cmd()
2177 pending_scb->hscb->tag, in ahc_linux_queue_recovery_cmd()
2190 && ahc_inb(ahc, SAVED_SCSIID) == pending_scb->hscb->scsiid in ahc_linux_queue_recovery_cmd()
2208 && (pending_scb->hscb->tag == active_scb_index in ahc_linux_queue_recovery_cmd()
2209 || (!cmd && SCSIID_TARGET(ahc, saved_scsiid) == sdev->id))) { in ahc_linux_queue_recovery_cmd()
2216 pending_scb->flags |= SCB_RECOVERY_SCB; in ahc_linux_queue_recovery_cmd()
2217 pending_scb->flags |= cmd ? SCB_ABORT : SCB_DEVICE_RESET; in ahc_linux_queue_recovery_cmd()
2225 * Actually re-queue this SCB in an attempt in ahc_linux_queue_recovery_cmd()
2229 * to the timed-out device. in ahc_linux_queue_recovery_cmd()
2240 pending_scb->hscb->control |= MK_MESSAGE|DISCONNECTED; in ahc_linux_queue_recovery_cmd()
2241 pending_scb->flags |= SCB_RECOVERY_SCB; in ahc_linux_queue_recovery_cmd()
2242 pending_scb->flags |= cmd ? SCB_ABORT : SCB_DEVICE_RESET; in ahc_linux_queue_recovery_cmd()
2251 ahc_search_disc_list(ahc, sdev->id, in ahc_linux_queue_recovery_cmd()
2252 sdev->channel + 'A', in ahc_linux_queue_recovery_cmd()
2253 sdev->lun, pending_scb->hscb->tag, in ahc_linux_queue_recovery_cmd()
2259 * In the non-paging case, the sequencer will in ahc_linux_queue_recovery_cmd()
2260 * never re-reference the in-core SCB. in ahc_linux_queue_recovery_cmd()
2265 if ((ahc->flags & AHC_PAGESCBS) == 0) { in ahc_linux_queue_recovery_cmd()
2266 ahc_outb(ahc, SCBPTR, pending_scb->hscb->tag); in ahc_linux_queue_recovery_cmd()
2276 ahc_search_qinfifo(ahc, sdev->id, in ahc_linux_queue_recovery_cmd()
2277 sdev->channel + 'A', in ahc_linux_queue_recovery_cmd()
2278 (u8)sdev->lun, SCB_LIST_NULL, in ahc_linux_queue_recovery_cmd()
2284 printk("Device is disconnected, re-queuing SCB\n"); in ahc_linux_queue_recovery_cmd()
2296 * the semantics of the mid-layer recovery engine are not in ahc_linux_queue_recovery_cmd()
2306 ahc->platform_data->eh_done = &done; in ahc_linux_queue_recovery_cmd()
2312 ahc->platform_data->eh_done = NULL; in ahc_linux_queue_recovery_cmd()
2326 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_width()
2327 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_width()
2331 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_width()
2332 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_width()
2340 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_period()
2341 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_period()
2345 starget->channel + 'A', in ahc_linux_set_period()
2346 shost->this_id, starget->id, &tstate); in ahc_linux_set_period()
2348 unsigned int ppr_options = tinfo->goal.ppr_options; in ahc_linux_set_period()
2350 unsigned long offset = tinfo->goal.offset; in ahc_linux_set_period()
2366 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_period()
2367 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_period()
2385 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_offset()
2386 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_offset()
2390 starget->channel + 'A', in ahc_linux_set_offset()
2391 shost->this_id, starget->id, &tstate); in ahc_linux_set_offset()
2398 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_offset()
2399 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_offset()
2403 period = tinfo->goal.period; in ahc_linux_set_offset()
2404 ppr_options = tinfo->goal.ppr_options; in ahc_linux_set_offset()
2414 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_dt()
2415 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_dt()
2419 starget->channel + 'A', in ahc_linux_set_dt()
2420 shost->this_id, starget->id, &tstate); in ahc_linux_set_dt()
2422 unsigned int ppr_options = tinfo->goal.ppr_options in ahc_linux_set_dt()
2424 unsigned int period = tinfo->goal.period; in ahc_linux_set_dt()
2425 unsigned int width = tinfo->goal.width; in ahc_linux_set_dt()
2436 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_dt()
2437 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_dt()
2441 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, in ahc_linux_set_dt()
2453 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
2454 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2458 starget->channel + 'A',
2459 shost->this_id, starget->id, &tstate);
2461 unsigned int ppr_options = tinfo->goal.ppr_options
2463 unsigned int period = tinfo->goal.period;
2470 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
2471 starget->channel + 'A', ROLE_INITIATOR);
2475 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset,
2482 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
2483 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2487 starget->channel + 'A',
2488 shost->this_id, starget->id, &tstate);
2490 unsigned int ppr_options = tinfo->goal.ppr_options
2492 unsigned int period = tinfo->goal.period;
2499 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
2500 starget->channel + 'A', ROLE_INITIATOR);
2504 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset,
2512 struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; in ahc_linux_get_signalling()
2516 if (!(ahc->features & AHC_ULTRA2)) { in ahc_linux_get_signalling()
2517 /* non-LVD chipset, may not have SBLKCTL reg */ in ahc_linux_get_signalling()
2519 ahc->features & AHC_HVD ? in ahc_linux_get_signalling()
2571 return -ENODEV; in ahc_linux_init()