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()
549 return ((sdev_id(sdev) << TID_SHIFT) & TID) | (ahd)->our_id; in ahd_build_scsiid()
564 ahd = *(struct ahd_softc **)host->hostdata; in ahd_linux_info()
566 strcpy(bp, "Adaptec AIC79XX PCI-X SCSI HBA DRIVER, Rev " AIC79XX_DRIVER_VERSION "\n" in ahd_linux_info()
568 strcat(bp, ahd->description); in ahd_linux_info()
583 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_lck()
586 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_lck()
588 cmd->result = CAM_REQ_INPROG << 16; in ahd_linux_queue_lck()
600 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in DEF_SCSI_QCMD()
603 target_offset = starget->id; in DEF_SCSI_QCMD()
604 if (starget->channel != 0) in DEF_SCSI_QCMD()
607 return &ahd->platform_data->starget[target_offset]; in DEF_SCSI_QCMD()
614 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in ahd_linux_target_alloc()
615 struct seeprom_config *sc = ahd->seep_config; in ahd_linux_target_alloc()
621 char channel = starget->channel + 'A'; in ahd_linux_target_alloc()
630 int flags = sc->device_flags[starget->id]; in ahd_linux_target_alloc()
632 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_target_alloc()
633 starget->id, &tstate); in ahd_linux_target_alloc()
639 if ((ahd->features & AHD_RTI) == 0) in ahd_linux_target_alloc()
648 spi_min_period(starget) = tinfo->user.period; in ahd_linux_target_alloc()
649 spi_max_offset(starget) = tinfo->user.offset; in ahd_linux_target_alloc()
652 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_linux_target_alloc()
653 starget->id, &tstate); in ahd_linux_target_alloc()
654 ahd_compile_devinfo(&devinfo, ahd->our_id, starget->id, in ahd_linux_target_alloc()
678 *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_slave_alloc()
682 printk("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id); in ahd_linux_slave_alloc()
691 dev->openings = 1; in ahd_linux_slave_alloc()
698 dev->maxtags = 0; in ahd_linux_slave_alloc()
712 if (!spi_initial_dv(sdev->sdev_target)) in ahd_linux_slave_configure()
732 ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_biosparam()
744 extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0; in ahd_linux_biosparam()
784 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_dev_reset()
790 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_dev_reset()
791 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_dev_reset()
797 dev = scsi_transport_device_data(cmd->device); in ahd_linux_dev_reset()
817 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_dev_reset()
818 cmd->device->id, &tstate); in ahd_linux_dev_reset()
819 reset_scb->io_ctx = NULL; in ahd_linux_dev_reset()
820 reset_scb->platform_data->dev = dev; in ahd_linux_dev_reset()
821 reset_scb->sg_count = 0; in ahd_linux_dev_reset()
824 reset_scb->platform_data->xfer_len = 0; in ahd_linux_dev_reset()
825 reset_scb->hscb->control = 0; in ahd_linux_dev_reset()
826 reset_scb->hscb->scsiid = ahd_build_scsiid(ahd, cmd->device); in ahd_linux_dev_reset()
827 reset_scb->hscb->lun = cmd->device->lun; in ahd_linux_dev_reset()
828 reset_scb->hscb->cdb_len = 0; in ahd_linux_dev_reset()
829 reset_scb->hscb->task_management = SIU_TASKMGMT_LUN_RESET; in ahd_linux_dev_reset()
830 reset_scb->flags |= SCB_DEVICE_RESET|SCB_RECOVERY_SCB|SCB_ACTIVE; in ahd_linux_dev_reset()
831 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_dev_reset()
832 reset_scb->flags |= SCB_PACKETIZED; in ahd_linux_dev_reset()
834 reset_scb->hscb->control |= MK_MESSAGE; in ahd_linux_dev_reset()
836 dev->openings--; in ahd_linux_dev_reset()
837 dev->active++; in ahd_linux_dev_reset()
838 dev->commands_issued++; in ahd_linux_dev_reset()
842 LIST_INSERT_HEAD(&ahd->pending_scbs, reset_scb, pending_links); in ahd_linux_dev_reset()
845 ahd->platform_data->eh_done = &done; in ahd_linux_dev_reset()
851 ahd->platform_data->eh_done = NULL; in ahd_linux_dev_reset()
854 ahd_name(ahd), dev->active); in ahd_linux_dev_reset()
872 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_bus_reset()
906 .this_id = -1,
937 dmat->alignment = alignment; in ahd_dma_tag_create()
938 dmat->boundary = boundary; in ahd_dma_tag_create()
939 dmat->maxsize = maxsize; in ahd_dma_tag_create()
954 *vaddr = dma_alloc_coherent(&ahd->dev_softc->dev, dmat->maxsize, mapp, in ahd_dmamem_alloc()
965 dma_free_coherent(&ahd->dev_softc->dev, dmat->maxsize, vaddr, map); in ahd_dmamem_free()
975 * initialization and not for per-transaction buffer mapping. in ahd_dmamap_load()
980 stack_sg.ds_len = dmat->maxsize; in ahd_dmamap_load()
1058 instance = -1; in ahd_parse_brace_option()
1059 targ = -1; in ahd_parse_brace_option()
1071 if (instance == -1) { in ahd_parse_brace_option()
1075 if (targ == -1) in ahd_parse_brace_option()
1086 if (targ != -1) in ahd_parse_brace_option()
1087 targ = -1; in ahd_parse_brace_option()
1088 else if (instance != -1) in ahd_parse_brace_option()
1089 instance = -1; in ahd_parse_brace_option()
1094 if (instance == -1) in ahd_parse_brace_option()
1216 template->name = ahd->description; in ahd_linux_register_host()
1221 *((struct ahd_softc **)host->hostdata) = ahd; in ahd_linux_register_host()
1222 ahd->platform_data->host = host; in ahd_linux_register_host()
1223 host->can_queue = AHD_MAX_QUEUE; in ahd_linux_register_host()
1224 host->cmd_per_lun = 2; in ahd_linux_register_host()
1225 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1226 host->this_id = ahd->our_id; in ahd_linux_register_host()
1227 host->irq = ahd->platform_data->irq; in ahd_linux_register_host()
1228 host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_register_host()
1229 host->max_lun = AHD_NUM_LUNS; in ahd_linux_register_host()
1230 host->max_channel = 0; in ahd_linux_register_host()
1231 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1235 sprintf(buf, "scsi%d", host->host_no); in ahd_linux_register_host()
1241 host->unique_id = ahd->unit; in ahd_linux_register_host()
1245 host->transportt = ahd_linux_transport_template; in ahd_linux_register_host()
1247 retval = scsi_add_host(host, &ahd->dev_softc->dev); in ahd_linux_register_host()
1274 ahd->flags &= ~AHD_RESET_BUS_A; in ahd_linux_initialize_scsi_bus()
1276 if ((ahd->flags & AHD_RESET_BUS_A) != 0) in ahd_linux_initialize_scsi_bus()
1279 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_initialize_scsi_bus()
1292 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_initialize_scsi_bus()
1294 ahd_compile_devinfo(&devinfo, ahd->our_id, target_id, in ahd_linux_initialize_scsi_bus()
1301 if ((ahd->flags & AHD_RESET_BUS_A) != 0) { in ahd_linux_initialize_scsi_bus()
1311 ahd->platform_data = in ahd_platform_alloc()
1313 if (ahd->platform_data == NULL) in ahd_platform_alloc()
1315 ahd->platform_data->irq = AHD_LINUX_NOIRQ; in ahd_platform_alloc()
1317 ahd->seltime = (aic79xx_seltime & 0x3) << 4; in ahd_platform_alloc()
1327 if (ahd->platform_data != NULL) { in ahd_platform_free()
1330 starget = ahd->platform_data->starget[i]; in ahd_platform_free()
1332 ahd->platform_data->starget[i] = NULL; in ahd_platform_free()
1336 if (ahd->platform_data->irq != AHD_LINUX_NOIRQ) in ahd_platform_free()
1337 free_irq(ahd->platform_data->irq, ahd); in ahd_platform_free()
1338 if (ahd->tags[0] == BUS_SPACE_PIO in ahd_platform_free()
1339 && ahd->bshs[0].ioport != 0) in ahd_platform_free()
1340 release_region(ahd->bshs[0].ioport, 256); in ahd_platform_free()
1341 if (ahd->tags[1] == BUS_SPACE_PIO in ahd_platform_free()
1342 && ahd->bshs[1].ioport != 0) in ahd_platform_free()
1343 release_region(ahd->bshs[1].ioport, 256); in ahd_platform_free()
1344 if (ahd->tags[0] == BUS_SPACE_MEMIO in ahd_platform_free()
1345 && ahd->bshs[0].maddr != NULL) { in ahd_platform_free()
1346 iounmap(ahd->bshs[0].maddr); in ahd_platform_free()
1347 release_mem_region(ahd->platform_data->mem_busaddr, in ahd_platform_free()
1350 if (ahd->platform_data->host) in ahd_platform_free()
1351 scsi_host_put(ahd->platform_data->host); in ahd_platform_free()
1353 kfree(ahd->platform_data); in ahd_platform_free()
1363 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_platform_init()
1366 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_platform_init()
1367 if (iocell_opts->precomp != AIC79XX_DEFAULT_PRECOMP) in ahd_platform_init()
1368 AHD_SET_PRECOMP(ahd, iocell_opts->precomp); in ahd_platform_init()
1369 if (iocell_opts->slewrate != AIC79XX_DEFAULT_SLEWRATE) in ahd_platform_init()
1370 AHD_SET_SLEWRATE(ahd, iocell_opts->slewrate); in ahd_platform_init()
1371 if (iocell_opts->amplitude != AIC79XX_DEFAULT_AMPLITUDE) in ahd_platform_init()
1372 AHD_SET_AMPLITUDE(ahd, iocell_opts->amplitude); in ahd_platform_init()
1401 was_queuing = dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED); in ahd_platform_set_tags()
1414 if ((dev->flags & AHD_DEV_FREEZE_TIL_EMPTY) == 0 in ahd_platform_set_tags()
1416 && (dev->active != 0)) { in ahd_platform_set_tags()
1417 dev->flags |= AHD_DEV_FREEZE_TIL_EMPTY; in ahd_platform_set_tags()
1418 dev->qfrozen++; in ahd_platform_set_tags()
1421 dev->flags &= ~(AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED|AHD_DEV_PERIODIC_OTAG); in ahd_platform_set_tags()
1432 dev->maxtags = usertags; in ahd_platform_set_tags()
1433 dev->openings = dev->maxtags - dev->active; in ahd_platform_set_tags()
1435 if (dev->maxtags == 0) { in ahd_platform_set_tags()
1439 dev->openings = 1; in ahd_platform_set_tags()
1441 dev->flags |= AHD_DEV_Q_TAGGED; in ahd_platform_set_tags()
1443 dev->flags |= AHD_DEV_PERIODIC_OTAG; in ahd_platform_set_tags()
1445 dev->flags |= AHD_DEV_Q_BASIC; in ahd_platform_set_tags()
1448 dev->maxtags = 0; in ahd_platform_set_tags()
1449 dev->openings = 1 - dev->active; in ahd_platform_set_tags()
1452 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) { in ahd_platform_set_tags()
1456 dev->openings + dev->active); in ahd_platform_set_tags()
1484 if ((ahd->user_discenable & devinfo->target_mask) != 0) { in ahd_linux_user_tagdepth()
1485 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) { in ahd_linux_user_tagdepth()
1499 tag_info = &aic79xx_tag_info[ahd->unit]; in ahd_linux_user_tagdepth()
1500 tags = tag_info->tag_commands[devinfo->target_offset]; in ahd_linux_user_tagdepth()
1516 struct ahd_softc *ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_device_queue_depth()
1519 ahd->our_id, in ahd_linux_device_queue_depth()
1520 sdev->sdev_target->id, sdev->lun, in ahd_linux_device_queue_depth()
1521 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_device_queue_depth()
1524 if (tags != 0 && sdev->tagged_supported != 0) { in ahd_linux_device_queue_depth()
1560 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_run_command()
1561 cmd->device->id, &tstate); in ahd_linux_run_command()
1562 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) == 0 in ahd_linux_run_command()
1563 || (tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_run_command()
1566 col_idx = AHD_BUILD_COL_IDX(cmd->device->id, in ahd_linux_run_command()
1567 cmd->device->lun); in ahd_linux_run_command()
1570 ahd->flags |= AHD_RESOURCE_SHORTAGE; in ahd_linux_run_command()
1576 scb->io_ctx = cmd; in ahd_linux_run_command()
1577 scb->platform_data->dev = dev; in ahd_linux_run_command()
1578 hscb = scb->hscb; in ahd_linux_run_command()
1579 cmd->host_scribble = (char *)scb; in ahd_linux_run_command()
1584 hscb->control = 0; in ahd_linux_run_command()
1585 hscb->scsiid = ahd_build_scsiid(ahd, cmd->device); in ahd_linux_run_command()
1586 hscb->lun = cmd->device->lun; in ahd_linux_run_command()
1587 scb->hscb->task_management = 0; in ahd_linux_run_command()
1590 if ((ahd->user_discenable & mask) != 0) in ahd_linux_run_command()
1591 hscb->control |= DISCENB; in ahd_linux_run_command()
1593 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) in ahd_linux_run_command()
1594 scb->flags |= SCB_PACKETIZED; in ahd_linux_run_command()
1596 if ((tstate->auto_negotiate & mask) != 0) { in ahd_linux_run_command()
1597 scb->flags |= SCB_AUTO_NEGOTIATE; in ahd_linux_run_command()
1598 scb->hscb->control |= MK_MESSAGE; in ahd_linux_run_command()
1601 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) { in ahd_linux_run_command()
1602 if (dev->commands_since_idle_or_otag == AHD_OTAG_THRESH in ahd_linux_run_command()
1603 && (dev->flags & AHD_DEV_Q_TAGGED) != 0) { in ahd_linux_run_command()
1604 hscb->control |= ORDERED_QUEUE_TAG; in ahd_linux_run_command()
1605 dev->commands_since_idle_or_otag = 0; in ahd_linux_run_command()
1607 hscb->control |= SIMPLE_QUEUE_TAG; in ahd_linux_run_command()
1611 hscb->cdb_len = cmd->cmd_len; in ahd_linux_run_command()
1612 memcpy(hscb->shared_data.idata.cdb, cmd->cmnd, hscb->cdb_len); in ahd_linux_run_command()
1614 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1617 scb->sg_count = 0; in ahd_linux_run_command()
1620 void *sg = scb->sg_list; in ahd_linux_run_command()
1624 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1632 scb->platform_data->xfer_len += len; in ahd_linux_run_command()
1634 i == (nseg - 1)); in ahd_linux_run_command()
1638 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links); in ahd_linux_run_command()
1639 dev->openings--; in ahd_linux_run_command()
1640 dev->active++; in ahd_linux_run_command()
1641 dev->commands_issued++; in ahd_linux_run_command()
1643 if ((dev->flags & AHD_DEV_PERIODIC_OTAG) != 0) in ahd_linux_run_command()
1644 dev->commands_since_idle_or_otag++; in ahd_linux_run_command()
1645 scb->flags |= SCB_ACTIVE; in ahd_linux_run_command()
1684 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_send_async()
1691 if (tinfo->curr.period != tinfo->goal.period in ahd_send_async()
1692 || tinfo->curr.width != tinfo->goal.width in ahd_send_async()
1693 || tinfo->curr.offset != tinfo->goal.offset in ahd_send_async()
1694 || tinfo->curr.ppr_options != tinfo->goal.ppr_options) in ahd_send_async()
1702 starget = ahd->platform_data->starget[target]; in ahd_send_async()
1716 if (tinfo->curr.period == spi_period(starget) in ahd_send_async()
1717 && tinfo->curr.width == spi_width(starget) in ahd_send_async()
1718 && tinfo->curr.offset == spi_offset(starget) in ahd_send_async()
1719 && tinfo->curr.ppr_options == target_ppr_options) in ahd_send_async()
1723 spi_period(starget) = tinfo->curr.period; in ahd_send_async()
1724 spi_width(starget) = tinfo->curr.width; in ahd_send_async()
1725 spi_offset(starget) = tinfo->curr.offset; in ahd_send_async()
1726 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; in ahd_send_async()
1727 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; in ahd_send_async()
1728 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; in ahd_send_async()
1729 spi_rd_strm(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RD_STRM ? 1 : 0; in ahd_send_async()
1730 spi_pcomp_en(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_PCOMP_EN ? 1 : 0; in ahd_send_async()
1731 spi_rti(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RTI ? 1 : 0; in ahd_send_async()
1732 spi_wr_flow(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_WR_FLOW ? 1 : 0; in ahd_send_async()
1733 spi_hold_mcs(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_HOLD_MCS ? 1 : 0; in ahd_send_async()
1740 scsi_report_device_reset(ahd->platform_data->host, in ahd_send_async()
1741 channel - 'A', target); in ahd_send_async()
1745 if (ahd->platform_data->host != NULL) { in ahd_send_async()
1746 scsi_report_bus_reset(ahd->platform_data->host, in ahd_send_async()
1747 channel - 'A'); in ahd_send_async()
1764 if ((scb->flags & SCB_ACTIVE) == 0) { in ahd_done()
1770 cmd = scb->io_ctx; in ahd_done()
1771 dev = scb->platform_data->dev; in ahd_done()
1772 dev->active--; in ahd_done()
1773 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()
1779 } else if (scb->flags & SCB_DEVICE_RESET) { in ahd_done()
1780 if (ahd->platform_data->eh_done) in ahd_done()
1781 complete(ahd->platform_data->eh_done); in ahd_done()
1789 * The Linux mid-layer assumes that sense in ahd_done()
1793 cmd->sense_buffer[0] = 0; in ahd_done()
1799 ahd_get_transfer_length(scb) - ahd_get_residual(scb); in ahd_done()
1801 if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) { in ahd_done()
1819 } else if (amount_xferred < scb->io_ctx->underflow) { in ahd_done()
1824 for (i = 0; i < scb->io_ctx->cmd_len; i++) in ahd_done()
1825 printk(" 0x%x", scb->io_ctx->cmnd[i]); in ahd_done()
1839 ahd_linux_handle_scsi_status(ahd, cmd->device, scb); in ahd_done()
1842 if (dev->openings == 1 in ahd_done()
1845 dev->tag_success_count++; in ahd_done()
1849 * full occurrs, we throttle back. Slowly try to get in ahd_done()
1852 if ((dev->openings + dev->active) < dev->maxtags in ahd_done()
1853 && dev->tag_success_count > AHD_TAG_SUCCESS_INTERVAL) { in ahd_done()
1854 dev->tag_success_count = 0; in ahd_done()
1855 dev->openings++; in ahd_done()
1858 if (dev->active == 0) in ahd_done()
1859 dev->commands_since_idle_or_otag = 0; in ahd_done()
1861 if ((scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_done()
1867 if (ahd->platform_data->eh_done) in ahd_done()
1868 complete(ahd->platform_data->eh_done); in ahd_done()
1884 ahd->our_id, in ahd_linux_handle_scsi_status()
1885 sdev->sdev_target->id, sdev->lun, in ahd_linux_handle_scsi_status()
1886 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_handle_scsi_status()
1890 * We don't currently trust the mid-layer to in ahd_linux_handle_scsi_status()
1892 * when one occurs, we tell the mid-layer to in ahd_linux_handle_scsi_status()
1911 cmd = scb->io_ctx; in ahd_linux_handle_scsi_status()
1912 if ((scb->flags & (SCB_SENSE|SCB_PKT_SENSE)) != 0) { in ahd_linux_handle_scsi_status()
1917 if (scb->flags & SCB_SENSE) { in ahd_linux_handle_scsi_status()
1919 - ahd_get_sense_residual(scb), in ahd_linux_handle_scsi_status()
1928 scb->sense_data; in ahd_linux_handle_scsi_status()
1930 scsi_4btoul(siu->sense_length), in ahd_linux_handle_scsi_status()
1935 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in ahd_linux_handle_scsi_status()
1936 memcpy(cmd->sense_buffer, in ahd_linux_handle_scsi_status()
1950 printk("0x%x ", cmd->sense_buffer[i]); in ahd_linux_handle_scsi_status()
1963 * This ensures that dev->active is equal to in ahd_linux_handle_scsi_status()
1967 dev->tag_success_count = 0; in ahd_linux_handle_scsi_status()
1968 if (dev->active != 0) { in ahd_linux_handle_scsi_status()
1973 dev->openings = 0; in ahd_linux_handle_scsi_status()
1978 dev->active); in ahd_linux_handle_scsi_status()
1981 if (dev->active == dev->tags_on_last_queuefull) { in ahd_linux_handle_scsi_status()
1983 dev->last_queuefull_same_count++; in ahd_linux_handle_scsi_status()
1992 if (dev->last_queuefull_same_count in ahd_linux_handle_scsi_status()
1994 dev->maxtags = dev->active; in ahd_linux_handle_scsi_status()
1997 dev->active); in ahd_linux_handle_scsi_status()
2000 dev->tags_on_last_queuefull = dev->active; in ahd_linux_handle_scsi_status()
2001 dev->last_queuefull_same_count = 0; in ahd_linux_handle_scsi_status()
2006 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2014 dev->openings = 1; in ahd_linux_handle_scsi_status()
2016 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2054 cmd->sense_buffer; in ahd_linux_queue_cmd_complete()
2055 if (sense->extra_len >= 5 && in ahd_linux_queue_cmd_complete()
2056 (sense->add_sense_code == 0x47 in ahd_linux_queue_cmd_complete()
2057 || sense->add_sense_code == 0x48)) in ahd_linux_queue_cmd_complete()
2115 printk("%s: device overrun (status %x) on %d:%d:%d\n", in ahd_linux_queue_cmd_complete()
2116 ahd_name(ahd), status, cmd->device->channel, in ahd_linux_queue_cmd_complete()
2117 cmd->device->id, (u8)cmd->device->lun); in ahd_linux_queue_cmd_complete()
2128 scsi_block_requests(ahd->platform_data->host); in ahd_freeze_simq()
2134 scsi_unblock_requests(ahd->platform_data->host); in ahd_release_simq()
2158 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_abort_cmd()
2164 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_queue_abort_cmd()
2165 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_queue_abort_cmd()
2177 dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_abort_cmd()
2191 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { in ahd_linux_queue_abort_cmd()
2192 if (pending_scb->io_ctx == cmd) in ahd_linux_queue_abort_cmd()
2201 if ((pending_scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_linux_queue_abort_cmd()
2219 if ((pending_scb->flags & SCB_ACTIVE) == 0) { in ahd_linux_queue_abort_cmd()
2229 if (ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2230 cmd->device->channel + 'A', in ahd_linux_queue_abort_cmd()
2231 cmd->device->lun, in ahd_linux_queue_abort_cmd()
2232 pending_scb->hscb->tag, in ahd_linux_queue_abort_cmd()
2236 ahd_name(ahd), cmd->device->channel, in ahd_linux_queue_abort_cmd()
2237 cmd->device->id, (u8)cmd->device->lun); in ahd_linux_queue_abort_cmd()
2268 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2276 * Actually re-queue this SCB in an attempt in ahd_linux_queue_abort_cmd()
2279 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2281 pending_scb->hscb->cdb_len = 0; in ahd_linux_queue_abort_cmd()
2282 pending_scb->hscb->task_attribute = 0; in ahd_linux_queue_abort_cmd()
2283 pending_scb->hscb->task_management = SIU_TASKMGMT_ABORT_TASK; in ahd_linux_queue_abort_cmd()
2285 if ((pending_scb->flags & SCB_PACKETIZED) != 0) { in ahd_linux_queue_abort_cmd()
2294 pending_scb->hscb->task_management); in ahd_linux_queue_abort_cmd()
2297 * If non-packetized, set the MK_MESSAGE control in ahd_linux_queue_abort_cmd()
2305 pending_scb->hscb->control |= MK_MESSAGE|DISCONNECTED; in ahd_linux_queue_abort_cmd()
2308 * The sequencer will never re-reference the in ahd_linux_queue_abort_cmd()
2309 * in-core SCB. To make sure we are notified in ahd_linux_queue_abort_cmd()
2322 ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2323 cmd->device->channel + 'A', cmd->device->lun, in ahd_linux_queue_abort_cmd()
2329 printk("Device is disconnected, re-queuing SCB\n"); in ahd_linux_queue_abort_cmd()
2344 ahd->platform_data->eh_done = &done; in ahd_linux_queue_abort_cmd()
2350 ahd->platform_data->eh_done = NULL; in ahd_linux_queue_abort_cmd()
2353 ahd_name(ahd), dev->active); in ahd_linux_queue_abort_cmd()
2369 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_width()
2370 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_width()
2374 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_width()
2375 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_width()
2383 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_period()
2384 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_period()
2388 starget->channel + 'A', in ahd_linux_set_period()
2389 shost->this_id, starget->id, &tstate); in ahd_linux_set_period()
2391 unsigned int ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_period()
2394 unsigned long offset = tinfo->goal.offset; in ahd_linux_set_period()
2416 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_period()
2417 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_period()
2436 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_offset()
2437 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_offset()
2441 starget->channel + 'A', in ahd_linux_set_offset()
2442 shost->this_id, starget->id, &tstate); in ahd_linux_set_offset()
2454 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_offset()
2455 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_offset()
2457 period = tinfo->goal.period; in ahd_linux_set_offset()
2458 ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_offset()
2471 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_dt()
2472 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_dt()
2476 starget->channel + 'A', in ahd_linux_set_dt()
2477 shost->this_id, starget->id, &tstate); in ahd_linux_set_dt()
2479 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_dt()
2481 unsigned int period = tinfo->goal.period; in ahd_linux_set_dt()
2482 unsigned int width = tinfo->goal.width; in ahd_linux_set_dt()
2500 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_dt()
2501 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_dt()
2506 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_dt()
2513 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_qas()
2514 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_qas()
2518 starget->channel + 'A', in ahd_linux_set_qas()
2519 shost->this_id, starget->id, &tstate); in ahd_linux_set_qas()
2521 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_qas()
2523 unsigned int period = tinfo->goal.period; in ahd_linux_set_qas()
2539 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_qas()
2540 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_qas()
2545 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_qas()
2552 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_iu()
2553 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_iu()
2557 starget->channel + 'A', in ahd_linux_set_iu()
2558 shost->this_id, starget->id, &tstate); in ahd_linux_set_iu()
2560 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_iu()
2562 unsigned int period = tinfo->goal.period; in ahd_linux_set_iu()
2579 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_iu()
2580 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_iu()
2585 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_iu()
2592 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rd_strm()
2593 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rd_strm()
2597 starget->channel + 'A', in ahd_linux_set_rd_strm()
2598 shost->this_id, starget->id, &tstate); in ahd_linux_set_rd_strm()
2600 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rd_strm()
2602 unsigned int period = tinfo->goal.period; in ahd_linux_set_rd_strm()
2615 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rd_strm()
2616 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rd_strm()
2621 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rd_strm()
2628 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_wr_flow()
2629 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_wr_flow()
2633 starget->channel + 'A', in ahd_linux_set_wr_flow()
2634 shost->this_id, starget->id, &tstate); in ahd_linux_set_wr_flow()
2636 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_wr_flow()
2638 unsigned int period = tinfo->goal.period; in ahd_linux_set_wr_flow()
2651 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_wr_flow()
2652 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_wr_flow()
2657 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_wr_flow()
2664 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rti()
2665 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rti()
2669 starget->channel + 'A', in ahd_linux_set_rti()
2670 shost->this_id, starget->id, &tstate); in ahd_linux_set_rti()
2672 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rti()
2674 unsigned int period = tinfo->goal.period; in ahd_linux_set_rti()
2678 if ((ahd->features & AHD_RTI) == 0) { in ahd_linux_set_rti()
2695 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rti()
2696 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rti()
2701 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rti()
2708 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_pcomp_en()
2709 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_pcomp_en()
2713 starget->channel + 'A', in ahd_linux_set_pcomp_en()
2714 shost->this_id, starget->id, &tstate); in ahd_linux_set_pcomp_en()
2716 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_pcomp_en()
2718 unsigned int period = tinfo->goal.period; in ahd_linux_set_pcomp_en()
2731 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_linux_set_pcomp_en()
2734 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_linux_set_pcomp_en()
2735 precomp = iocell_opts->precomp; in ahd_linux_set_pcomp_en()
2745 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_pcomp_en()
2746 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_pcomp_en()
2751 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_pcomp_en()
2758 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_hold_mcs()
2759 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_hold_mcs()
2763 starget->channel + 'A', in ahd_linux_set_hold_mcs()
2764 shost->this_id, starget->id, &tstate); in ahd_linux_set_hold_mcs()
2766 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_hold_mcs()
2768 unsigned int period = tinfo->goal.period; in ahd_linux_set_hold_mcs()
2775 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_hold_mcs()
2776 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_hold_mcs()
2781 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_hold_mcs()
2788 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; in ahd_linux_get_signalling()
2846 return -ENODEV; in ahd_linux_init()