Lines Matching +full:overrun +full:- +full:throttle +full:- +full:ms
6 * --------------------------------------------------------------------------
7 * Copyright (c) 1994-2000 Justin T. Gibbs.
8 * Copyright (c) 1997-1999 Doug Ledford
9 * Copyright (c) 2000-2003 Adaptec Inc.
23 * 3. Neither the names of the above-listed copyright holders nor the names
76 * To change the default number of tagged transactions allowed per-device,
83 * Twin adapters will use indexes 0-7 for channel 0, and indexes 8-15
96 * The driver will throttle the number of commands dispatched to a
102 * depths. The driver will throttle back when the queue fulls occur and
110 * (0, 2-11, 13-15), disables tagged queueing for ID 12, and tells the
118 * IDs 2, 5-7, and 9-15.
227 ahd->platform_data->host->host_no, in ahd_print_path()
229 scb != NULL ? SCB_GET_TARGET(ahd, scb) : -1, in ahd_print_path()
230 scb != NULL ? SCB_GET_LUN(scb) : -1); in ahd_print_path()
234 * XXX - these options apply unilaterally to _all_ adapters
260 * non-0 = Enable PCI parity check
262 * NOTE: you can't actually pass -1 on the lilo prompt. So, to set this
263 * variable to -1 you would actually want to simply pass the variable
265 * -1.
280 * 0 - 256ms
281 * 1 - 128ms
282 * 2 - 64ms
283 * 3 - 32ms
284 * We default to 256ms because some older devices need a longer time
302 * EonStor 3U 16-Bay: U16U-G3A3
303 * EonStor 2U 12-Bay: U12U-G3A3
325 "period-delimited options string:\n"
335 " tag_info:<tag_str> Set per-target tag depth\n"
337 " slewrate:<slewrate_list>Set the signal slew rate (0-15).\n"
338 " precomp:<pcomp_list> Set the signal precompensation (0-7).\n"
339 " amplitude:<int> Set the signal amplitude (0-7).\n"
341 " (0/256ms,1/128ms,2/64ms,3/32ms)\n"
347 " # Shorten the selection timeout to 128ms\n"
380 * multi-millisecond waits. Wait at most in ahd_delay()
385 usec -= 1024; in ahd_delay()
405 if (ahd->tags[0] == BUS_SPACE_MEMIO) { in ahd_inb()
406 x = readb(ahd->bshs[0].maddr + port); in ahd_inb()
408 x = inb(ahd->bshs[(port) >> 8].ioport + ((port) & 0xFF)); in ahd_inb()
420 if (ahd->tags[0] == BUS_SPACE_MEMIO) {
421 x = readw(ahd->bshs[0].maddr + port);
423 x = inw(ahd->bshs[(port) >> 8].ioport + ((port) & 0xFF));
433 if (ahd->tags[0] == BUS_SPACE_MEMIO) { in ahd_outb()
434 writeb(val, ahd->bshs[0].maddr + port); in ahd_outb()
436 outb(val, ahd->bshs[(port) >> 8].ioport + (port & 0xFF)); in ahd_outb()
444 if (ahd->tags[0] == BUS_SPACE_MEMIO) { in ahd_outw_atomic()
445 writew(val, ahd->bshs[0].maddr + port); in ahd_outw_atomic()
447 outw(val, ahd->bshs[(port) >> 8].ioport + (port & 0xFF)); in ahd_outw_atomic()
538 cmd = scb->io_ctx; in ahd_linux_unmap_scb()
545 (((scmd_id(cmd) << TID_SHIFT) & TID) | (ahd)->our_id)
559 ahd = *(struct ahd_softc **)host->hostdata; in ahd_linux_info()
561 strcpy(bp, "Adaptec AIC79XX PCI-X SCSI HBA DRIVER, Rev " AIC79XX_DRIVER_VERSION "\n" in ahd_linux_info()
563 strcat(bp, ahd->description); in ahd_linux_info()
579 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_lck()
582 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_lck()
584 cmd->scsi_done = scsi_done; in ahd_linux_queue_lck()
585 cmd->result = CAM_REQ_INPROG << 16; in ahd_linux_queue_lck()
597 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in DEF_SCSI_QCMD()
600 target_offset = starget->id; in DEF_SCSI_QCMD()
601 if (starget->channel != 0) in DEF_SCSI_QCMD()
604 return &ahd->platform_data->starget[target_offset]; in DEF_SCSI_QCMD()
611 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in ahd_linux_target_alloc()
612 struct seeprom_config *sc = ahd->seep_config; in ahd_linux_target_alloc()
618 char channel = starget->channel + 'A'; in ahd_linux_target_alloc()
627 int flags = sc->device_flags[starget->id]; in ahd_linux_target_alloc()
629 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_target_alloc()
630 starget->id, &tstate); in ahd_linux_target_alloc()
636 if ((ahd->features & AHD_RTI) == 0) in ahd_linux_target_alloc()
645 spi_min_period(starget) = tinfo->user.period; in ahd_linux_target_alloc()
646 spi_max_offset(starget) = tinfo->user.offset; in ahd_linux_target_alloc()
649 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_linux_target_alloc()
650 starget->id, &tstate); in ahd_linux_target_alloc()
651 ahd_compile_devinfo(&devinfo, ahd->our_id, starget->id, in ahd_linux_target_alloc()
675 *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_slave_alloc()
679 printk("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id); in ahd_linux_slave_alloc()
688 dev->openings = 1; in ahd_linux_slave_alloc()
695 dev->maxtags = 0; in ahd_linux_slave_alloc()
709 if (!spi_initial_dv(sdev->sdev_target)) in ahd_linux_slave_configure()
729 ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_biosparam()
741 extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0; in ahd_linux_biosparam()
785 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_dev_reset()
791 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_dev_reset()
792 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_dev_reset()
798 dev = scsi_transport_device_data(cmd->device); in ahd_linux_dev_reset()
818 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_dev_reset()
819 cmd->device->id, &tstate); in ahd_linux_dev_reset()
820 reset_scb->io_ctx = cmd; in ahd_linux_dev_reset()
821 reset_scb->platform_data->dev = dev; in ahd_linux_dev_reset()
822 reset_scb->sg_count = 0; in ahd_linux_dev_reset()
825 reset_scb->platform_data->xfer_len = 0; in ahd_linux_dev_reset()
826 reset_scb->hscb->control = 0; in ahd_linux_dev_reset()
827 reset_scb->hscb->scsiid = BUILD_SCSIID(ahd,cmd); in ahd_linux_dev_reset()
828 reset_scb->hscb->lun = cmd->device->lun; in ahd_linux_dev_reset()
829 reset_scb->hscb->cdb_len = 0; in ahd_linux_dev_reset()
830 reset_scb->hscb->task_management = SIU_TASKMGMT_LUN_RESET; in ahd_linux_dev_reset()
831 reset_scb->flags |= SCB_DEVICE_RESET|SCB_RECOVERY_SCB|SCB_ACTIVE; in ahd_linux_dev_reset()
832 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_dev_reset()
833 reset_scb->flags |= SCB_PACKETIZED; in ahd_linux_dev_reset()
835 reset_scb->hscb->control |= MK_MESSAGE; in ahd_linux_dev_reset()
837 dev->openings--; in ahd_linux_dev_reset()
838 dev->active++; in ahd_linux_dev_reset()
839 dev->commands_issued++; in ahd_linux_dev_reset()
843 LIST_INSERT_HEAD(&ahd->pending_scbs, reset_scb, pending_links); in ahd_linux_dev_reset()
846 ahd->platform_data->eh_done = &done; in ahd_linux_dev_reset()
852 ahd->platform_data->eh_done = NULL; in ahd_linux_dev_reset()
855 ahd_name(ahd), dev->active); in ahd_linux_dev_reset()
873 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_bus_reset()
907 .this_id = -1,
938 dmat->alignment = alignment; in ahd_dma_tag_create()
939 dmat->boundary = boundary; in ahd_dma_tag_create()
940 dmat->maxsize = maxsize; in ahd_dma_tag_create()
955 *vaddr = dma_alloc_coherent(&ahd->dev_softc->dev, dmat->maxsize, mapp, in ahd_dmamem_alloc()
966 dma_free_coherent(&ahd->dev_softc->dev, dmat->maxsize, vaddr, map); in ahd_dmamem_free()
976 * initialization and not for per-transaction buffer mapping. in ahd_dmamap_load()
981 stack_sg.ds_len = dmat->maxsize; in ahd_dmamap_load()
1059 instance = -1; in ahd_parse_brace_option()
1060 targ = -1; in ahd_parse_brace_option()
1072 if (instance == -1) { in ahd_parse_brace_option()
1076 if (targ == -1) in ahd_parse_brace_option()
1087 if (targ != -1) in ahd_parse_brace_option()
1088 targ = -1; in ahd_parse_brace_option()
1089 else if (instance != -1) in ahd_parse_brace_option()
1090 instance = -1; in ahd_parse_brace_option()
1095 if (instance == -1) in ahd_parse_brace_option()
1217 template->name = ahd->description; in ahd_linux_register_host()
1222 *((struct ahd_softc **)host->hostdata) = ahd; in ahd_linux_register_host()
1223 ahd->platform_data->host = host; in ahd_linux_register_host()
1224 host->can_queue = AHD_MAX_QUEUE; in ahd_linux_register_host()
1225 host->cmd_per_lun = 2; in ahd_linux_register_host()
1226 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1227 host->this_id = ahd->our_id; in ahd_linux_register_host()
1228 host->irq = ahd->platform_data->irq; in ahd_linux_register_host()
1229 host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_register_host()
1230 host->max_lun = AHD_NUM_LUNS; in ahd_linux_register_host()
1231 host->max_channel = 0; in ahd_linux_register_host()
1232 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1236 sprintf(buf, "scsi%d", host->host_no); in ahd_linux_register_host()
1242 host->unique_id = ahd->unit; in ahd_linux_register_host()
1246 host->transportt = ahd_linux_transport_template; in ahd_linux_register_host()
1248 retval = scsi_add_host(host, &ahd->dev_softc->dev); in ahd_linux_register_host()
1275 ahd->flags &= ~AHD_RESET_BUS_A; in ahd_linux_initialize_scsi_bus()
1277 if ((ahd->flags & AHD_RESET_BUS_A) != 0) in ahd_linux_initialize_scsi_bus()
1280 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_initialize_scsi_bus()
1293 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_initialize_scsi_bus()
1295 ahd_compile_devinfo(&devinfo, ahd->our_id, target_id, in ahd_linux_initialize_scsi_bus()
1302 if ((ahd->flags & AHD_RESET_BUS_A) != 0) { in ahd_linux_initialize_scsi_bus()
1312 ahd->platform_data = in ahd_platform_alloc()
1314 if (ahd->platform_data == NULL) in ahd_platform_alloc()
1316 ahd->platform_data->irq = AHD_LINUX_NOIRQ; in ahd_platform_alloc()
1318 ahd->seltime = (aic79xx_seltime & 0x3) << 4; in ahd_platform_alloc()
1328 if (ahd->platform_data != NULL) { in ahd_platform_free()
1331 starget = ahd->platform_data->starget[i]; in ahd_platform_free()
1333 ahd->platform_data->starget[i] = NULL; in ahd_platform_free()
1337 if (ahd->platform_data->irq != AHD_LINUX_NOIRQ) in ahd_platform_free()
1338 free_irq(ahd->platform_data->irq, ahd); in ahd_platform_free()
1339 if (ahd->tags[0] == BUS_SPACE_PIO in ahd_platform_free()
1340 && ahd->bshs[0].ioport != 0) in ahd_platform_free()
1341 release_region(ahd->bshs[0].ioport, 256); in ahd_platform_free()
1342 if (ahd->tags[1] == BUS_SPACE_PIO in ahd_platform_free()
1343 && ahd->bshs[1].ioport != 0) in ahd_platform_free()
1344 release_region(ahd->bshs[1].ioport, 256); in ahd_platform_free()
1345 if (ahd->tags[0] == BUS_SPACE_MEMIO in ahd_platform_free()
1346 && ahd->bshs[0].maddr != NULL) { in ahd_platform_free()
1347 iounmap(ahd->bshs[0].maddr); in ahd_platform_free()
1348 release_mem_region(ahd->platform_data->mem_busaddr, in ahd_platform_free()
1351 if (ahd->platform_data->host) in ahd_platform_free()
1352 scsi_host_put(ahd->platform_data->host); in ahd_platform_free()
1354 kfree(ahd->platform_data); in ahd_platform_free()
1364 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_platform_init()
1367 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_platform_init()
1368 if (iocell_opts->precomp != AIC79XX_DEFAULT_PRECOMP) in ahd_platform_init()
1369 AHD_SET_PRECOMP(ahd, iocell_opts->precomp); in ahd_platform_init()
1370 if (iocell_opts->slewrate != AIC79XX_DEFAULT_SLEWRATE) in ahd_platform_init()
1371 AHD_SET_SLEWRATE(ahd, iocell_opts->slewrate); in ahd_platform_init()
1372 if (iocell_opts->amplitude != AIC79XX_DEFAULT_AMPLITUDE) in ahd_platform_init()
1373 AHD_SET_AMPLITUDE(ahd, iocell_opts->amplitude); in ahd_platform_init()
1402 was_queuing = dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED); in ahd_platform_set_tags()
1415 if ((dev->flags & AHD_DEV_FREEZE_TIL_EMPTY) == 0 in ahd_platform_set_tags()
1417 && (dev->active != 0)) { in ahd_platform_set_tags()
1418 dev->flags |= AHD_DEV_FREEZE_TIL_EMPTY; in ahd_platform_set_tags()
1419 dev->qfrozen++; in ahd_platform_set_tags()
1422 dev->flags &= ~(AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED|AHD_DEV_PERIODIC_OTAG); in ahd_platform_set_tags()
1433 dev->maxtags = usertags; in ahd_platform_set_tags()
1434 dev->openings = dev->maxtags - dev->active; in ahd_platform_set_tags()
1436 if (dev->maxtags == 0) { in ahd_platform_set_tags()
1440 dev->openings = 1; in ahd_platform_set_tags()
1442 dev->flags |= AHD_DEV_Q_TAGGED; in ahd_platform_set_tags()
1444 dev->flags |= AHD_DEV_PERIODIC_OTAG; in ahd_platform_set_tags()
1446 dev->flags |= AHD_DEV_Q_BASIC; in ahd_platform_set_tags()
1449 dev->maxtags = 0; in ahd_platform_set_tags()
1450 dev->openings = 1 - dev->active; in ahd_platform_set_tags()
1453 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) { in ahd_platform_set_tags()
1457 dev->openings + dev->active); in ahd_platform_set_tags()
1485 if ((ahd->user_discenable & devinfo->target_mask) != 0) { in ahd_linux_user_tagdepth()
1486 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) { in ahd_linux_user_tagdepth()
1500 tag_info = &aic79xx_tag_info[ahd->unit]; in ahd_linux_user_tagdepth()
1501 tags = tag_info->tag_commands[devinfo->target_offset]; in ahd_linux_user_tagdepth()
1517 struct ahd_softc *ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_device_queue_depth()
1520 ahd->our_id, in ahd_linux_device_queue_depth()
1521 sdev->sdev_target->id, sdev->lun, in ahd_linux_device_queue_depth()
1522 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_device_queue_depth()
1525 if (tags != 0 && sdev->tagged_supported != 0) { in ahd_linux_device_queue_depth()
1561 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_run_command()
1562 cmd->device->id, &tstate); in ahd_linux_run_command()
1563 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) == 0 in ahd_linux_run_command()
1564 || (tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_run_command()
1567 col_idx = AHD_BUILD_COL_IDX(cmd->device->id, in ahd_linux_run_command()
1568 cmd->device->lun); in ahd_linux_run_command()
1571 ahd->flags |= AHD_RESOURCE_SHORTAGE; in ahd_linux_run_command()
1577 scb->io_ctx = cmd; in ahd_linux_run_command()
1578 scb->platform_data->dev = dev; in ahd_linux_run_command()
1579 hscb = scb->hscb; in ahd_linux_run_command()
1580 cmd->host_scribble = (char *)scb; in ahd_linux_run_command()
1585 hscb->control = 0; in ahd_linux_run_command()
1586 hscb->scsiid = BUILD_SCSIID(ahd, cmd); in ahd_linux_run_command()
1587 hscb->lun = cmd->device->lun; in ahd_linux_run_command()
1588 scb->hscb->task_management = 0; in ahd_linux_run_command()
1591 if ((ahd->user_discenable & mask) != 0) in ahd_linux_run_command()
1592 hscb->control |= DISCENB; in ahd_linux_run_command()
1594 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) in ahd_linux_run_command()
1595 scb->flags |= SCB_PACKETIZED; in ahd_linux_run_command()
1597 if ((tstate->auto_negotiate & mask) != 0) { in ahd_linux_run_command()
1598 scb->flags |= SCB_AUTO_NEGOTIATE; in ahd_linux_run_command()
1599 scb->hscb->control |= MK_MESSAGE; in ahd_linux_run_command()
1602 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) { in ahd_linux_run_command()
1603 if (dev->commands_since_idle_or_otag == AHD_OTAG_THRESH in ahd_linux_run_command()
1604 && (dev->flags & AHD_DEV_Q_TAGGED) != 0) { in ahd_linux_run_command()
1605 hscb->control |= MSG_ORDERED_TASK; in ahd_linux_run_command()
1606 dev->commands_since_idle_or_otag = 0; in ahd_linux_run_command()
1608 hscb->control |= MSG_SIMPLE_TASK; in ahd_linux_run_command()
1612 hscb->cdb_len = cmd->cmd_len; in ahd_linux_run_command()
1613 memcpy(hscb->shared_data.idata.cdb, cmd->cmnd, hscb->cdb_len); in ahd_linux_run_command()
1615 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1618 scb->sg_count = 0; in ahd_linux_run_command()
1621 void *sg = scb->sg_list; in ahd_linux_run_command()
1625 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1633 scb->platform_data->xfer_len += len; in ahd_linux_run_command()
1635 i == (nseg - 1)); in ahd_linux_run_command()
1639 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links); in ahd_linux_run_command()
1640 dev->openings--; in ahd_linux_run_command()
1641 dev->active++; in ahd_linux_run_command()
1642 dev->commands_issued++; in ahd_linux_run_command()
1644 if ((dev->flags & AHD_DEV_PERIODIC_OTAG) != 0) in ahd_linux_run_command()
1645 dev->commands_since_idle_or_otag++; in ahd_linux_run_command()
1646 scb->flags |= SCB_ACTIVE; in ahd_linux_run_command()
1685 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_send_async()
1692 if (tinfo->curr.period != tinfo->goal.period in ahd_send_async()
1693 || tinfo->curr.width != tinfo->goal.width in ahd_send_async()
1694 || tinfo->curr.offset != tinfo->goal.offset in ahd_send_async()
1695 || tinfo->curr.ppr_options != tinfo->goal.ppr_options) in ahd_send_async()
1703 starget = ahd->platform_data->starget[target]; in ahd_send_async()
1717 if (tinfo->curr.period == spi_period(starget) in ahd_send_async()
1718 && tinfo->curr.width == spi_width(starget) in ahd_send_async()
1719 && tinfo->curr.offset == spi_offset(starget) in ahd_send_async()
1720 && tinfo->curr.ppr_options == target_ppr_options) in ahd_send_async()
1724 spi_period(starget) = tinfo->curr.period; in ahd_send_async()
1725 spi_width(starget) = tinfo->curr.width; in ahd_send_async()
1726 spi_offset(starget) = tinfo->curr.offset; in ahd_send_async()
1727 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; in ahd_send_async()
1728 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; in ahd_send_async()
1729 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; in ahd_send_async()
1730 spi_rd_strm(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RD_STRM ? 1 : 0; in ahd_send_async()
1731 spi_pcomp_en(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_PCOMP_EN ? 1 : 0; in ahd_send_async()
1732 spi_rti(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RTI ? 1 : 0; in ahd_send_async()
1733 spi_wr_flow(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_WR_FLOW ? 1 : 0; in ahd_send_async()
1734 spi_hold_mcs(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_HOLD_MCS ? 1 : 0; in ahd_send_async()
1741 scsi_report_device_reset(ahd->platform_data->host, in ahd_send_async()
1742 channel - 'A', target); in ahd_send_async()
1746 if (ahd->platform_data->host != NULL) { in ahd_send_async()
1747 scsi_report_bus_reset(ahd->platform_data->host, in ahd_send_async()
1748 channel - 'A'); in ahd_send_async()
1765 if ((scb->flags & SCB_ACTIVE) == 0) { in ahd_done()
1771 cmd = scb->io_ctx; in ahd_done()
1772 dev = scb->platform_data->dev; in ahd_done()
1773 dev->active--; in ahd_done()
1774 dev->openings++; in ahd_done()
1775 if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) { in ahd_done()
1776 cmd->result &= ~(CAM_DEV_QFRZN << 16); in ahd_done()
1777 dev->qfrozen--; in ahd_done()
1783 * The Linux mid-layer assumes that sense in ahd_done()
1787 cmd->sense_buffer[0] = 0; in ahd_done()
1793 ahd_get_transfer_length(scb) - ahd_get_residual(scb); in ahd_done()
1795 if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) { in ahd_done()
1813 } else if (amount_xferred < scb->io_ctx->underflow) { in ahd_done()
1818 for (i = 0; i < scb->io_ctx->cmd_len; i++) in ahd_done()
1819 printk(" 0x%x", scb->io_ctx->cmnd[i]); in ahd_done()
1832 ahd_linux_handle_scsi_status(ahd, cmd->device, scb); in ahd_done()
1835 if (dev->openings == 1 in ahd_done()
1838 dev->tag_success_count++; in ahd_done()
1842 * full occurrs, we throttle back. Slowly try to get in ahd_done()
1845 if ((dev->openings + dev->active) < dev->maxtags in ahd_done()
1846 && dev->tag_success_count > AHD_TAG_SUCCESS_INTERVAL) { in ahd_done()
1847 dev->tag_success_count = 0; in ahd_done()
1848 dev->openings++; in ahd_done()
1851 if (dev->active == 0) in ahd_done()
1852 dev->commands_since_idle_or_otag = 0; in ahd_done()
1854 if ((scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_done()
1860 if (ahd->platform_data->eh_done) in ahd_done()
1861 complete(ahd->platform_data->eh_done); in ahd_done()
1876 ahd->our_id, in ahd_linux_handle_scsi_status()
1877 sdev->sdev_target->id, sdev->lun, in ahd_linux_handle_scsi_status()
1878 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_handle_scsi_status()
1882 * We don't currently trust the mid-layer to in ahd_linux_handle_scsi_status()
1884 * when one occurs, we tell the mid-layer to in ahd_linux_handle_scsi_status()
1903 cmd = scb->io_ctx; in ahd_linux_handle_scsi_status()
1904 if ((scb->flags & (SCB_SENSE|SCB_PKT_SENSE)) != 0) { in ahd_linux_handle_scsi_status()
1909 if (scb->flags & SCB_SENSE) { in ahd_linux_handle_scsi_status()
1911 - ahd_get_sense_residual(scb), in ahd_linux_handle_scsi_status()
1920 scb->sense_data; in ahd_linux_handle_scsi_status()
1922 scsi_4btoul(siu->sense_length), in ahd_linux_handle_scsi_status()
1927 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in ahd_linux_handle_scsi_status()
1928 memcpy(cmd->sense_buffer, in ahd_linux_handle_scsi_status()
1931 cmd->result |= (DRIVER_SENSE << 24); in ahd_linux_handle_scsi_status()
1942 printk("0x%x ", cmd->sense_buffer[i]); in ahd_linux_handle_scsi_status()
1955 * This ensures that dev->active is equal to in ahd_linux_handle_scsi_status()
1959 dev->tag_success_count = 0; in ahd_linux_handle_scsi_status()
1960 if (dev->active != 0) { in ahd_linux_handle_scsi_status()
1965 dev->openings = 0; in ahd_linux_handle_scsi_status()
1970 dev->active); in ahd_linux_handle_scsi_status()
1973 if (dev->active == dev->tags_on_last_queuefull) { in ahd_linux_handle_scsi_status()
1975 dev->last_queuefull_same_count++; in ahd_linux_handle_scsi_status()
1984 if (dev->last_queuefull_same_count in ahd_linux_handle_scsi_status()
1986 dev->maxtags = dev->active; in ahd_linux_handle_scsi_status()
1989 dev->active); in ahd_linux_handle_scsi_status()
1992 dev->tags_on_last_queuefull = dev->active; in ahd_linux_handle_scsi_status()
1993 dev->last_queuefull_same_count = 0; in ahd_linux_handle_scsi_status()
1998 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2006 dev->openings = 1; in ahd_linux_handle_scsi_status()
2008 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2044 if ((cmd->result >> 24) != DRIVER_SENSE) { in ahd_linux_queue_cmd_complete()
2050 cmd->sense_buffer; in ahd_linux_queue_cmd_complete()
2051 if (sense->extra_len >= 5 && in ahd_linux_queue_cmd_complete()
2052 (sense->add_sense_code == 0x47 in ahd_linux_queue_cmd_complete()
2053 || sense->add_sense_code == 0x48)) in ahd_linux_queue_cmd_complete()
2112 printk("%s: device overrun (status %x) on %d:%d:%d\n", in ahd_linux_queue_cmd_complete()
2113 ahd_name(ahd), status, cmd->device->channel, in ahd_linux_queue_cmd_complete()
2114 cmd->device->id, (u8)cmd->device->lun); in ahd_linux_queue_cmd_complete()
2119 cmd->scsi_done(cmd); in ahd_linux_queue_cmd_complete()
2125 scsi_block_requests(ahd->platform_data->host); in ahd_freeze_simq()
2131 scsi_unblock_requests(ahd->platform_data->host); in ahd_release_simq()
2156 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_abort_cmd()
2162 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_queue_abort_cmd()
2163 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_queue_abort_cmd()
2175 dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_abort_cmd()
2189 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { in ahd_linux_queue_abort_cmd()
2190 if (pending_scb->io_ctx == cmd) in ahd_linux_queue_abort_cmd()
2199 if ((pending_scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_linux_queue_abort_cmd()
2217 if ((pending_scb->flags & SCB_ACTIVE) == 0) { in ahd_linux_queue_abort_cmd()
2227 if (ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2228 cmd->device->channel + 'A', in ahd_linux_queue_abort_cmd()
2229 cmd->device->lun, in ahd_linux_queue_abort_cmd()
2230 pending_scb->hscb->tag, in ahd_linux_queue_abort_cmd()
2234 ahd_name(ahd), cmd->device->channel, in ahd_linux_queue_abort_cmd()
2235 cmd->device->id, (u8)cmd->device->lun); in ahd_linux_queue_abort_cmd()
2266 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2274 * Actually re-queue this SCB in an attempt in ahd_linux_queue_abort_cmd()
2277 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2279 pending_scb->hscb->cdb_len = 0; in ahd_linux_queue_abort_cmd()
2280 pending_scb->hscb->task_attribute = 0; in ahd_linux_queue_abort_cmd()
2281 pending_scb->hscb->task_management = SIU_TASKMGMT_ABORT_TASK; in ahd_linux_queue_abort_cmd()
2283 if ((pending_scb->flags & SCB_PACKETIZED) != 0) { in ahd_linux_queue_abort_cmd()
2292 pending_scb->hscb->task_management); in ahd_linux_queue_abort_cmd()
2295 * If non-packetized, set the MK_MESSAGE control in ahd_linux_queue_abort_cmd()
2303 pending_scb->hscb->control |= MK_MESSAGE|DISCONNECTED; in ahd_linux_queue_abort_cmd()
2306 * The sequencer will never re-reference the in ahd_linux_queue_abort_cmd()
2307 * in-core SCB. To make sure we are notified in ahd_linux_queue_abort_cmd()
2320 ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2321 cmd->device->channel + 'A', cmd->device->lun, in ahd_linux_queue_abort_cmd()
2327 printk("Device is disconnected, re-queuing SCB\n"); in ahd_linux_queue_abort_cmd()
2342 ahd->platform_data->eh_done = &done; in ahd_linux_queue_abort_cmd()
2348 ahd->platform_data->eh_done = NULL; in ahd_linux_queue_abort_cmd()
2351 ahd_name(ahd), dev->active); in ahd_linux_queue_abort_cmd()
2367 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_width()
2368 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_width()
2372 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_width()
2373 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_width()
2381 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_period()
2382 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_period()
2386 starget->channel + 'A', in ahd_linux_set_period()
2387 shost->this_id, starget->id, &tstate); in ahd_linux_set_period()
2389 unsigned int ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_period()
2392 unsigned long offset = tinfo->goal.offset; in ahd_linux_set_period()
2414 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_period()
2415 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_period()
2434 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_offset()
2435 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_offset()
2439 starget->channel + 'A', in ahd_linux_set_offset()
2440 shost->this_id, starget->id, &tstate); in ahd_linux_set_offset()
2452 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_offset()
2453 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_offset()
2455 period = tinfo->goal.period; in ahd_linux_set_offset()
2456 ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_offset()
2469 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_dt()
2470 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_dt()
2474 starget->channel + 'A', in ahd_linux_set_dt()
2475 shost->this_id, starget->id, &tstate); in ahd_linux_set_dt()
2477 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_dt()
2479 unsigned int period = tinfo->goal.period; in ahd_linux_set_dt()
2480 unsigned int width = tinfo->goal.width; in ahd_linux_set_dt()
2498 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_dt()
2499 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_dt()
2504 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_dt()
2511 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_qas()
2512 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_qas()
2516 starget->channel + 'A', in ahd_linux_set_qas()
2517 shost->this_id, starget->id, &tstate); in ahd_linux_set_qas()
2519 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_qas()
2521 unsigned int period = tinfo->goal.period; in ahd_linux_set_qas()
2537 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_qas()
2538 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_qas()
2543 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_qas()
2550 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_iu()
2551 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_iu()
2555 starget->channel + 'A', in ahd_linux_set_iu()
2556 shost->this_id, starget->id, &tstate); in ahd_linux_set_iu()
2558 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_iu()
2560 unsigned int period = tinfo->goal.period; in ahd_linux_set_iu()
2577 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_iu()
2578 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_iu()
2583 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_iu()
2590 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rd_strm()
2591 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rd_strm()
2595 starget->channel + 'A', in ahd_linux_set_rd_strm()
2596 shost->this_id, starget->id, &tstate); in ahd_linux_set_rd_strm()
2598 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rd_strm()
2600 unsigned int period = tinfo->goal.period; in ahd_linux_set_rd_strm()
2613 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rd_strm()
2614 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rd_strm()
2619 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rd_strm()
2626 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_wr_flow()
2627 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_wr_flow()
2631 starget->channel + 'A', in ahd_linux_set_wr_flow()
2632 shost->this_id, starget->id, &tstate); in ahd_linux_set_wr_flow()
2634 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_wr_flow()
2636 unsigned int period = tinfo->goal.period; in ahd_linux_set_wr_flow()
2649 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_wr_flow()
2650 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_wr_flow()
2655 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_wr_flow()
2662 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rti()
2663 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rti()
2667 starget->channel + 'A', in ahd_linux_set_rti()
2668 shost->this_id, starget->id, &tstate); in ahd_linux_set_rti()
2670 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rti()
2672 unsigned int period = tinfo->goal.period; in ahd_linux_set_rti()
2676 if ((ahd->features & AHD_RTI) == 0) { in ahd_linux_set_rti()
2693 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rti()
2694 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rti()
2699 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rti()
2706 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_pcomp_en()
2707 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_pcomp_en()
2711 starget->channel + 'A', in ahd_linux_set_pcomp_en()
2712 shost->this_id, starget->id, &tstate); in ahd_linux_set_pcomp_en()
2714 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_pcomp_en()
2716 unsigned int period = tinfo->goal.period; in ahd_linux_set_pcomp_en()
2729 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_linux_set_pcomp_en()
2732 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_linux_set_pcomp_en()
2733 precomp = iocell_opts->precomp; in ahd_linux_set_pcomp_en()
2743 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_pcomp_en()
2744 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_pcomp_en()
2749 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_pcomp_en()
2756 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_hold_mcs()
2757 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_hold_mcs()
2761 starget->channel + 'A', in ahd_linux_set_hold_mcs()
2762 shost->this_id, starget->id, &tstate); in ahd_linux_set_hold_mcs()
2764 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_hold_mcs()
2766 unsigned int period = tinfo->goal.period; in ahd_linux_set_hold_mcs()
2773 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_hold_mcs()
2774 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_hold_mcs()
2779 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_hold_mcs()
2786 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; in ahd_linux_get_signalling()
2844 return -ENODEV; in ahd_linux_init()