Lines Matching +full:slew +full:- +full:time +full:- +full:us

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
103 * attempt to slowly increase the depth over time as the device recovers
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
240 * Skip the scsi bus reset. Non 0 make us skip the reset at startup. This
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"
380 * multi-millisecond waits. Wait at most in ahd_delay()
381 * 1024us per call. 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()
578 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_lck()
581 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_lck()
583 cmd->result = CAM_REQ_INPROG << 16; in ahd_linux_queue_lck()
595 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in DEF_SCSI_QCMD()
598 target_offset = starget->id; in DEF_SCSI_QCMD()
599 if (starget->channel != 0) in DEF_SCSI_QCMD()
602 return &ahd->platform_data->starget[target_offset]; in DEF_SCSI_QCMD()
609 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in ahd_linux_target_alloc()
610 struct seeprom_config *sc = ahd->seep_config; in ahd_linux_target_alloc()
616 char channel = starget->channel + 'A'; in ahd_linux_target_alloc()
625 int flags = sc->device_flags[starget->id]; in ahd_linux_target_alloc()
627 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_target_alloc()
628 starget->id, &tstate); in ahd_linux_target_alloc()
634 if ((ahd->features & AHD_RTI) == 0) in ahd_linux_target_alloc()
643 spi_min_period(starget) = tinfo->user.period; in ahd_linux_target_alloc()
644 spi_max_offset(starget) = tinfo->user.offset; in ahd_linux_target_alloc()
647 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_linux_target_alloc()
648 starget->id, &tstate); in ahd_linux_target_alloc()
649 ahd_compile_devinfo(&devinfo, ahd->our_id, starget->id, in ahd_linux_target_alloc()
673 *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_slave_alloc()
677 printk("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id); in ahd_linux_slave_alloc()
686 dev->openings = 1; in ahd_linux_slave_alloc()
693 dev->maxtags = 0; in ahd_linux_slave_alloc()
707 if (!spi_initial_dv(sdev->sdev_target)) in ahd_linux_slave_configure()
727 ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_biosparam()
739 extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0; in ahd_linux_biosparam()
779 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_dev_reset()
785 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_dev_reset()
786 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_dev_reset()
792 dev = scsi_transport_device_data(cmd->device); in ahd_linux_dev_reset()
804 * Generate us a new SCB in ahd_linux_dev_reset()
812 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_dev_reset()
813 cmd->device->id, &tstate); in ahd_linux_dev_reset()
814 reset_scb->io_ctx = cmd; in ahd_linux_dev_reset()
815 reset_scb->platform_data->dev = dev; in ahd_linux_dev_reset()
816 reset_scb->sg_count = 0; in ahd_linux_dev_reset()
819 reset_scb->platform_data->xfer_len = 0; in ahd_linux_dev_reset()
820 reset_scb->hscb->control = 0; in ahd_linux_dev_reset()
821 reset_scb->hscb->scsiid = BUILD_SCSIID(ahd,cmd); in ahd_linux_dev_reset()
822 reset_scb->hscb->lun = cmd->device->lun; in ahd_linux_dev_reset()
823 reset_scb->hscb->cdb_len = 0; in ahd_linux_dev_reset()
824 reset_scb->hscb->task_management = SIU_TASKMGMT_LUN_RESET; in ahd_linux_dev_reset()
825 reset_scb->flags |= SCB_DEVICE_RESET|SCB_RECOVERY_SCB|SCB_ACTIVE; in ahd_linux_dev_reset()
826 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_dev_reset()
827 reset_scb->flags |= SCB_PACKETIZED; in ahd_linux_dev_reset()
829 reset_scb->hscb->control |= MK_MESSAGE; in ahd_linux_dev_reset()
831 dev->openings--; in ahd_linux_dev_reset()
832 dev->active++; in ahd_linux_dev_reset()
833 dev->commands_issued++; in ahd_linux_dev_reset()
837 LIST_INSERT_HEAD(&ahd->pending_scbs, reset_scb, pending_links); in ahd_linux_dev_reset()
840 ahd->platform_data->eh_done = &done; in ahd_linux_dev_reset()
846 ahd->platform_data->eh_done = NULL; in ahd_linux_dev_reset()
849 ahd_name(ahd), dev->active); in ahd_linux_dev_reset()
867 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_bus_reset()
901 .this_id = -1,
932 dmat->alignment = alignment; in ahd_dma_tag_create()
933 dmat->boundary = boundary; in ahd_dma_tag_create()
934 dmat->maxsize = maxsize; in ahd_dma_tag_create()
949 *vaddr = dma_alloc_coherent(&ahd->dev_softc->dev, dmat->maxsize, mapp, in ahd_dmamem_alloc()
960 dma_free_coherent(&ahd->dev_softc->dev, dmat->maxsize, vaddr, map); in ahd_dmamem_free()
970 * initialization and not for per-transaction buffer mapping. in ahd_dmamap_load()
975 stack_sg.ds_len = dmat->maxsize; in ahd_dmamap_load()
1053 instance = -1; in ahd_parse_brace_option()
1054 targ = -1; in ahd_parse_brace_option()
1066 if (instance == -1) { in ahd_parse_brace_option()
1070 if (targ == -1) in ahd_parse_brace_option()
1081 if (targ != -1) in ahd_parse_brace_option()
1082 targ = -1; in ahd_parse_brace_option()
1083 else if (instance != -1) in ahd_parse_brace_option()
1084 instance = -1; in ahd_parse_brace_option()
1089 if (instance == -1) in ahd_parse_brace_option()
1211 template->name = ahd->description; in ahd_linux_register_host()
1216 *((struct ahd_softc **)host->hostdata) = ahd; in ahd_linux_register_host()
1217 ahd->platform_data->host = host; in ahd_linux_register_host()
1218 host->can_queue = AHD_MAX_QUEUE; in ahd_linux_register_host()
1219 host->cmd_per_lun = 2; in ahd_linux_register_host()
1220 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1221 host->this_id = ahd->our_id; in ahd_linux_register_host()
1222 host->irq = ahd->platform_data->irq; in ahd_linux_register_host()
1223 host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_register_host()
1224 host->max_lun = AHD_NUM_LUNS; in ahd_linux_register_host()
1225 host->max_channel = 0; in ahd_linux_register_host()
1226 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1230 sprintf(buf, "scsi%d", host->host_no); in ahd_linux_register_host()
1236 host->unique_id = ahd->unit; in ahd_linux_register_host()
1240 host->transportt = ahd_linux_transport_template; in ahd_linux_register_host()
1242 retval = scsi_add_host(host, &ahd->dev_softc->dev); in ahd_linux_register_host()
1269 ahd->flags &= ~AHD_RESET_BUS_A; in ahd_linux_initialize_scsi_bus()
1271 if ((ahd->flags & AHD_RESET_BUS_A) != 0) in ahd_linux_initialize_scsi_bus()
1274 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_initialize_scsi_bus()
1287 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_initialize_scsi_bus()
1289 ahd_compile_devinfo(&devinfo, ahd->our_id, target_id, in ahd_linux_initialize_scsi_bus()
1295 /* Give the bus some time to recover */ in ahd_linux_initialize_scsi_bus()
1296 if ((ahd->flags & AHD_RESET_BUS_A) != 0) { in ahd_linux_initialize_scsi_bus()
1306 ahd->platform_data = in ahd_platform_alloc()
1308 if (ahd->platform_data == NULL) in ahd_platform_alloc()
1310 ahd->platform_data->irq = AHD_LINUX_NOIRQ; in ahd_platform_alloc()
1312 ahd->seltime = (aic79xx_seltime & 0x3) << 4; in ahd_platform_alloc()
1322 if (ahd->platform_data != NULL) { in ahd_platform_free()
1325 starget = ahd->platform_data->starget[i]; in ahd_platform_free()
1327 ahd->platform_data->starget[i] = NULL; in ahd_platform_free()
1331 if (ahd->platform_data->irq != AHD_LINUX_NOIRQ) in ahd_platform_free()
1332 free_irq(ahd->platform_data->irq, ahd); in ahd_platform_free()
1333 if (ahd->tags[0] == BUS_SPACE_PIO in ahd_platform_free()
1334 && ahd->bshs[0].ioport != 0) in ahd_platform_free()
1335 release_region(ahd->bshs[0].ioport, 256); in ahd_platform_free()
1336 if (ahd->tags[1] == BUS_SPACE_PIO in ahd_platform_free()
1337 && ahd->bshs[1].ioport != 0) in ahd_platform_free()
1338 release_region(ahd->bshs[1].ioport, 256); in ahd_platform_free()
1339 if (ahd->tags[0] == BUS_SPACE_MEMIO in ahd_platform_free()
1340 && ahd->bshs[0].maddr != NULL) { in ahd_platform_free()
1341 iounmap(ahd->bshs[0].maddr); in ahd_platform_free()
1342 release_mem_region(ahd->platform_data->mem_busaddr, in ahd_platform_free()
1345 if (ahd->platform_data->host) in ahd_platform_free()
1346 scsi_host_put(ahd->platform_data->host); in ahd_platform_free()
1348 kfree(ahd->platform_data); in ahd_platform_free()
1358 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_platform_init()
1361 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_platform_init()
1362 if (iocell_opts->precomp != AIC79XX_DEFAULT_PRECOMP) in ahd_platform_init()
1363 AHD_SET_PRECOMP(ahd, iocell_opts->precomp); in ahd_platform_init()
1364 if (iocell_opts->slewrate != AIC79XX_DEFAULT_SLEWRATE) in ahd_platform_init()
1365 AHD_SET_SLEWRATE(ahd, iocell_opts->slewrate); in ahd_platform_init()
1366 if (iocell_opts->amplitude != AIC79XX_DEFAULT_AMPLITUDE) in ahd_platform_init()
1367 AHD_SET_AMPLITUDE(ahd, iocell_opts->amplitude); in ahd_platform_init()
1396 was_queuing = dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED); in ahd_platform_set_tags()
1409 if ((dev->flags & AHD_DEV_FREEZE_TIL_EMPTY) == 0 in ahd_platform_set_tags()
1411 && (dev->active != 0)) { in ahd_platform_set_tags()
1412 dev->flags |= AHD_DEV_FREEZE_TIL_EMPTY; in ahd_platform_set_tags()
1413 dev->qfrozen++; in ahd_platform_set_tags()
1416 dev->flags &= ~(AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED|AHD_DEV_PERIODIC_OTAG); in ahd_platform_set_tags()
1427 dev->maxtags = usertags; in ahd_platform_set_tags()
1428 dev->openings = dev->maxtags - dev->active; in ahd_platform_set_tags()
1430 if (dev->maxtags == 0) { in ahd_platform_set_tags()
1434 dev->openings = 1; in ahd_platform_set_tags()
1436 dev->flags |= AHD_DEV_Q_TAGGED; in ahd_platform_set_tags()
1438 dev->flags |= AHD_DEV_PERIODIC_OTAG; in ahd_platform_set_tags()
1440 dev->flags |= AHD_DEV_Q_BASIC; in ahd_platform_set_tags()
1443 dev->maxtags = 0; in ahd_platform_set_tags()
1444 dev->openings = 1 - dev->active; in ahd_platform_set_tags()
1447 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) { in ahd_platform_set_tags()
1451 dev->openings + dev->active); in ahd_platform_set_tags()
1456 * us at any time even though we can only execute them in ahd_platform_set_tags()
1479 if ((ahd->user_discenable & devinfo->target_mask) != 0) { in ahd_linux_user_tagdepth()
1480 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) { in ahd_linux_user_tagdepth()
1494 tag_info = &aic79xx_tag_info[ahd->unit]; in ahd_linux_user_tagdepth()
1495 tags = tag_info->tag_commands[devinfo->target_offset]; in ahd_linux_user_tagdepth()
1511 struct ahd_softc *ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_device_queue_depth()
1514 ahd->our_id, in ahd_linux_device_queue_depth()
1515 sdev->sdev_target->id, sdev->lun, in ahd_linux_device_queue_depth()
1516 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_device_queue_depth()
1519 if (tags != 0 && sdev->tagged_supported != 0) { in ahd_linux_device_queue_depth()
1555 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_run_command()
1556 cmd->device->id, &tstate); in ahd_linux_run_command()
1557 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) == 0 in ahd_linux_run_command()
1558 || (tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_run_command()
1561 col_idx = AHD_BUILD_COL_IDX(cmd->device->id, in ahd_linux_run_command()
1562 cmd->device->lun); in ahd_linux_run_command()
1565 ahd->flags |= AHD_RESOURCE_SHORTAGE; in ahd_linux_run_command()
1571 scb->io_ctx = cmd; in ahd_linux_run_command()
1572 scb->platform_data->dev = dev; in ahd_linux_run_command()
1573 hscb = scb->hscb; in ahd_linux_run_command()
1574 cmd->host_scribble = (char *)scb; in ahd_linux_run_command()
1579 hscb->control = 0; in ahd_linux_run_command()
1580 hscb->scsiid = BUILD_SCSIID(ahd, cmd); in ahd_linux_run_command()
1581 hscb->lun = cmd->device->lun; in ahd_linux_run_command()
1582 scb->hscb->task_management = 0; in ahd_linux_run_command()
1585 if ((ahd->user_discenable & mask) != 0) in ahd_linux_run_command()
1586 hscb->control |= DISCENB; in ahd_linux_run_command()
1588 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) in ahd_linux_run_command()
1589 scb->flags |= SCB_PACKETIZED; in ahd_linux_run_command()
1591 if ((tstate->auto_negotiate & mask) != 0) { in ahd_linux_run_command()
1592 scb->flags |= SCB_AUTO_NEGOTIATE; in ahd_linux_run_command()
1593 scb->hscb->control |= MK_MESSAGE; in ahd_linux_run_command()
1596 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) { in ahd_linux_run_command()
1597 if (dev->commands_since_idle_or_otag == AHD_OTAG_THRESH in ahd_linux_run_command()
1598 && (dev->flags & AHD_DEV_Q_TAGGED) != 0) { in ahd_linux_run_command()
1599 hscb->control |= ORDERED_QUEUE_TAG; in ahd_linux_run_command()
1600 dev->commands_since_idle_or_otag = 0; in ahd_linux_run_command()
1602 hscb->control |= SIMPLE_QUEUE_TAG; in ahd_linux_run_command()
1606 hscb->cdb_len = cmd->cmd_len; in ahd_linux_run_command()
1607 memcpy(hscb->shared_data.idata.cdb, cmd->cmnd, hscb->cdb_len); in ahd_linux_run_command()
1609 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1612 scb->sg_count = 0; in ahd_linux_run_command()
1615 void *sg = scb->sg_list; in ahd_linux_run_command()
1619 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1627 scb->platform_data->xfer_len += len; in ahd_linux_run_command()
1629 i == (nseg - 1)); in ahd_linux_run_command()
1633 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links); in ahd_linux_run_command()
1634 dev->openings--; in ahd_linux_run_command()
1635 dev->active++; in ahd_linux_run_command()
1636 dev->commands_issued++; in ahd_linux_run_command()
1638 if ((dev->flags & AHD_DEV_PERIODIC_OTAG) != 0) in ahd_linux_run_command()
1639 dev->commands_since_idle_or_otag++; in ahd_linux_run_command()
1640 scb->flags |= SCB_ACTIVE; in ahd_linux_run_command()
1679 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_send_async()
1686 if (tinfo->curr.period != tinfo->goal.period in ahd_send_async()
1687 || tinfo->curr.width != tinfo->goal.width in ahd_send_async()
1688 || tinfo->curr.offset != tinfo->goal.offset in ahd_send_async()
1689 || tinfo->curr.ppr_options != tinfo->goal.ppr_options) in ahd_send_async()
1697 starget = ahd->platform_data->starget[target]; in ahd_send_async()
1711 if (tinfo->curr.period == spi_period(starget) in ahd_send_async()
1712 && tinfo->curr.width == spi_width(starget) in ahd_send_async()
1713 && tinfo->curr.offset == spi_offset(starget) in ahd_send_async()
1714 && tinfo->curr.ppr_options == target_ppr_options) in ahd_send_async()
1718 spi_period(starget) = tinfo->curr.period; in ahd_send_async()
1719 spi_width(starget) = tinfo->curr.width; in ahd_send_async()
1720 spi_offset(starget) = tinfo->curr.offset; in ahd_send_async()
1721 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; in ahd_send_async()
1722 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; in ahd_send_async()
1723 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; in ahd_send_async()
1724 spi_rd_strm(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RD_STRM ? 1 : 0; in ahd_send_async()
1725 spi_pcomp_en(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_PCOMP_EN ? 1 : 0; in ahd_send_async()
1726 spi_rti(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RTI ? 1 : 0; in ahd_send_async()
1727 spi_wr_flow(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_WR_FLOW ? 1 : 0; in ahd_send_async()
1728 spi_hold_mcs(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_HOLD_MCS ? 1 : 0; in ahd_send_async()
1735 scsi_report_device_reset(ahd->platform_data->host, in ahd_send_async()
1736 channel - 'A', target); in ahd_send_async()
1740 if (ahd->platform_data->host != NULL) { in ahd_send_async()
1741 scsi_report_bus_reset(ahd->platform_data->host, in ahd_send_async()
1742 channel - 'A'); in ahd_send_async()
1759 if ((scb->flags & SCB_ACTIVE) == 0) { in ahd_done()
1765 cmd = scb->io_ctx; in ahd_done()
1766 dev = scb->platform_data->dev; in ahd_done()
1767 dev->active--; in ahd_done()
1768 dev->openings++; in ahd_done()
1769 if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) { in ahd_done()
1770 cmd->result &= ~(CAM_DEV_QFRZN << 16); in ahd_done()
1771 dev->qfrozen--; in ahd_done()
1777 * The Linux mid-layer assumes that sense in ahd_done()
1781 cmd->sense_buffer[0] = 0; in ahd_done()
1787 ahd_get_transfer_length(scb) - ahd_get_residual(scb); in ahd_done()
1789 if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) { in ahd_done()
1807 } else if (amount_xferred < scb->io_ctx->underflow) { in ahd_done()
1812 for (i = 0; i < scb->io_ctx->cmd_len; i++) in ahd_done()
1813 printk(" 0x%x", scb->io_ctx->cmnd[i]); in ahd_done()
1826 ahd_linux_handle_scsi_status(ahd, cmd->device, scb); in ahd_done()
1829 if (dev->openings == 1 in ahd_done()
1832 dev->tag_success_count++; in ahd_done()
1839 if ((dev->openings + dev->active) < dev->maxtags in ahd_done()
1840 && dev->tag_success_count > AHD_TAG_SUCCESS_INTERVAL) { in ahd_done()
1841 dev->tag_success_count = 0; in ahd_done()
1842 dev->openings++; in ahd_done()
1845 if (dev->active == 0) in ahd_done()
1846 dev->commands_since_idle_or_otag = 0; in ahd_done()
1848 if ((scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_done()
1854 if (ahd->platform_data->eh_done) in ahd_done()
1855 complete(ahd->platform_data->eh_done); in ahd_done()
1870 ahd->our_id, in ahd_linux_handle_scsi_status()
1871 sdev->sdev_target->id, sdev->lun, in ahd_linux_handle_scsi_status()
1872 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_handle_scsi_status()
1876 * We don't currently trust the mid-layer to in ahd_linux_handle_scsi_status()
1878 * when one occurs, we tell the mid-layer to in ahd_linux_handle_scsi_status()
1879 * unconditionally requeue the command to us in ahd_linux_handle_scsi_status()
1897 cmd = scb->io_ctx; in ahd_linux_handle_scsi_status()
1898 if ((scb->flags & (SCB_SENSE|SCB_PKT_SENSE)) != 0) { in ahd_linux_handle_scsi_status()
1903 if (scb->flags & SCB_SENSE) { in ahd_linux_handle_scsi_status()
1905 - ahd_get_sense_residual(scb), in ahd_linux_handle_scsi_status()
1914 scb->sense_data; in ahd_linux_handle_scsi_status()
1916 scsi_4btoul(siu->sense_length), in ahd_linux_handle_scsi_status()
1921 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in ahd_linux_handle_scsi_status()
1922 memcpy(cmd->sense_buffer, in ahd_linux_handle_scsi_status()
1936 printk("0x%x ", cmd->sense_buffer[i]); in ahd_linux_handle_scsi_status()
1946 * By the time the core driver has returned this in ahd_linux_handle_scsi_status()
1948 * to us but not the device have been returned. in ahd_linux_handle_scsi_status()
1949 * This ensures that dev->active is equal to in ahd_linux_handle_scsi_status()
1953 dev->tag_success_count = 0; in ahd_linux_handle_scsi_status()
1954 if (dev->active != 0) { in ahd_linux_handle_scsi_status()
1959 dev->openings = 0; in ahd_linux_handle_scsi_status()
1964 dev->active); in ahd_linux_handle_scsi_status()
1967 if (dev->active == dev->tags_on_last_queuefull) { in ahd_linux_handle_scsi_status()
1969 dev->last_queuefull_same_count++; in ahd_linux_handle_scsi_status()
1978 if (dev->last_queuefull_same_count in ahd_linux_handle_scsi_status()
1980 dev->maxtags = dev->active; in ahd_linux_handle_scsi_status()
1983 dev->active); in ahd_linux_handle_scsi_status()
1986 dev->tags_on_last_queuefull = dev->active; in ahd_linux_handle_scsi_status()
1987 dev->last_queuefull_same_count = 0; in ahd_linux_handle_scsi_status()
1992 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2000 dev->openings = 1; in ahd_linux_handle_scsi_status()
2002 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2040 cmd->sense_buffer; in ahd_linux_queue_cmd_complete()
2041 if (sense->extra_len >= 5 && in ahd_linux_queue_cmd_complete()
2042 (sense->add_sense_code == 0x47 in ahd_linux_queue_cmd_complete()
2043 || sense->add_sense_code == 0x48)) in ahd_linux_queue_cmd_complete()
2102 ahd_name(ahd), status, cmd->device->channel, in ahd_linux_queue_cmd_complete()
2103 cmd->device->id, (u8)cmd->device->lun); in ahd_linux_queue_cmd_complete()
2114 scsi_block_requests(ahd->platform_data->host); in ahd_freeze_simq()
2120 scsi_unblock_requests(ahd->platform_data->host); in ahd_release_simq()
2144 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_abort_cmd()
2150 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_queue_abort_cmd()
2151 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_queue_abort_cmd()
2160 * at all, and the system wanted us to just abort the in ahd_linux_queue_abort_cmd()
2163 dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_abort_cmd()
2177 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { in ahd_linux_queue_abort_cmd()
2178 if (pending_scb->io_ctx == cmd) in ahd_linux_queue_abort_cmd()
2187 if ((pending_scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_linux_queue_abort_cmd()
2205 if ((pending_scb->flags & SCB_ACTIVE) == 0) { in ahd_linux_queue_abort_cmd()
2210 printk("%s: At time of recovery, card was %spaused\n", in ahd_linux_queue_abort_cmd()
2215 if (ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2216 cmd->device->channel + 'A', in ahd_linux_queue_abort_cmd()
2217 cmd->device->lun, in ahd_linux_queue_abort_cmd()
2218 pending_scb->hscb->tag, in ahd_linux_queue_abort_cmd()
2222 ahd_name(ahd), cmd->device->channel, in ahd_linux_queue_abort_cmd()
2223 cmd->device->id, (u8)cmd->device->lun); in ahd_linux_queue_abort_cmd()
2254 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2262 * Actually re-queue this SCB in an attempt in ahd_linux_queue_abort_cmd()
2265 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2267 pending_scb->hscb->cdb_len = 0; in ahd_linux_queue_abort_cmd()
2268 pending_scb->hscb->task_attribute = 0; in ahd_linux_queue_abort_cmd()
2269 pending_scb->hscb->task_management = SIU_TASKMGMT_ABORT_TASK; in ahd_linux_queue_abort_cmd()
2271 if ((pending_scb->flags & SCB_PACKETIZED) != 0) { in ahd_linux_queue_abort_cmd()
2280 pending_scb->hscb->task_management); in ahd_linux_queue_abort_cmd()
2283 * If non-packetized, set the MK_MESSAGE control in ahd_linux_queue_abort_cmd()
2291 pending_scb->hscb->control |= MK_MESSAGE|DISCONNECTED; in ahd_linux_queue_abort_cmd()
2294 * The sequencer will never re-reference the in ahd_linux_queue_abort_cmd()
2295 * in-core SCB. To make sure we are notified in ahd_linux_queue_abort_cmd()
2308 ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2309 cmd->device->channel + 'A', cmd->device->lun, in ahd_linux_queue_abort_cmd()
2315 printk("Device is disconnected, re-queuing SCB\n"); in ahd_linux_queue_abort_cmd()
2330 ahd->platform_data->eh_done = &done; in ahd_linux_queue_abort_cmd()
2336 ahd->platform_data->eh_done = NULL; in ahd_linux_queue_abort_cmd()
2339 ahd_name(ahd), dev->active); in ahd_linux_queue_abort_cmd()
2355 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_width()
2356 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_width()
2360 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_width()
2361 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_width()
2369 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_period()
2370 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_period()
2374 starget->channel + 'A', in ahd_linux_set_period()
2375 shost->this_id, starget->id, &tstate); in ahd_linux_set_period()
2377 unsigned int ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_period()
2380 unsigned long offset = tinfo->goal.offset; in ahd_linux_set_period()
2402 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_period()
2403 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_period()
2422 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_offset()
2423 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_offset()
2427 starget->channel + 'A', in ahd_linux_set_offset()
2428 shost->this_id, starget->id, &tstate); in ahd_linux_set_offset()
2440 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_offset()
2441 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_offset()
2443 period = tinfo->goal.period; in ahd_linux_set_offset()
2444 ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_offset()
2457 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_dt()
2458 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_dt()
2462 starget->channel + 'A', in ahd_linux_set_dt()
2463 shost->this_id, starget->id, &tstate); in ahd_linux_set_dt()
2465 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_dt()
2467 unsigned int period = tinfo->goal.period; in ahd_linux_set_dt()
2468 unsigned int width = tinfo->goal.width; in ahd_linux_set_dt()
2486 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_dt()
2487 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_dt()
2492 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_dt()
2499 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_qas()
2500 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_qas()
2504 starget->channel + 'A', in ahd_linux_set_qas()
2505 shost->this_id, starget->id, &tstate); in ahd_linux_set_qas()
2507 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_qas()
2509 unsigned int period = tinfo->goal.period; in ahd_linux_set_qas()
2525 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_qas()
2526 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_qas()
2531 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_qas()
2538 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_iu()
2539 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_iu()
2543 starget->channel + 'A', in ahd_linux_set_iu()
2544 shost->this_id, starget->id, &tstate); in ahd_linux_set_iu()
2546 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_iu()
2548 unsigned int period = tinfo->goal.period; in ahd_linux_set_iu()
2565 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_iu()
2566 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_iu()
2571 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_iu()
2578 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rd_strm()
2579 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rd_strm()
2583 starget->channel + 'A', in ahd_linux_set_rd_strm()
2584 shost->this_id, starget->id, &tstate); in ahd_linux_set_rd_strm()
2586 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rd_strm()
2588 unsigned int period = tinfo->goal.period; in ahd_linux_set_rd_strm()
2601 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rd_strm()
2602 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rd_strm()
2607 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rd_strm()
2614 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_wr_flow()
2615 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_wr_flow()
2619 starget->channel + 'A', in ahd_linux_set_wr_flow()
2620 shost->this_id, starget->id, &tstate); in ahd_linux_set_wr_flow()
2622 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_wr_flow()
2624 unsigned int period = tinfo->goal.period; in ahd_linux_set_wr_flow()
2637 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_wr_flow()
2638 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_wr_flow()
2643 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_wr_flow()
2650 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rti()
2651 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rti()
2655 starget->channel + 'A', in ahd_linux_set_rti()
2656 shost->this_id, starget->id, &tstate); in ahd_linux_set_rti()
2658 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rti()
2660 unsigned int period = tinfo->goal.period; in ahd_linux_set_rti()
2664 if ((ahd->features & AHD_RTI) == 0) { in ahd_linux_set_rti()
2681 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rti()
2682 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rti()
2687 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rti()
2694 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_pcomp_en()
2695 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_pcomp_en()
2699 starget->channel + 'A', in ahd_linux_set_pcomp_en()
2700 shost->this_id, starget->id, &tstate); in ahd_linux_set_pcomp_en()
2702 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_pcomp_en()
2704 unsigned int period = tinfo->goal.period; in ahd_linux_set_pcomp_en()
2717 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_linux_set_pcomp_en()
2720 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_linux_set_pcomp_en()
2721 precomp = iocell_opts->precomp; in ahd_linux_set_pcomp_en()
2731 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_pcomp_en()
2732 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_pcomp_en()
2737 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_pcomp_en()
2744 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_hold_mcs()
2745 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_hold_mcs()
2749 starget->channel + 'A', in ahd_linux_set_hold_mcs()
2750 shost->this_id, starget->id, &tstate); in ahd_linux_set_hold_mcs()
2752 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_hold_mcs()
2754 unsigned int period = tinfo->goal.period; in ahd_linux_set_hold_mcs()
2761 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_hold_mcs()
2762 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_hold_mcs()
2767 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_hold_mcs()
2774 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; in ahd_linux_get_signalling()
2832 return -ENODEV; in ahd_linux_init()