Lines Matching +full:throttle +full:- +full:period +full:- +full:us
26 * config file (!adp7771.cfg), the Adaptec AHA-2740A Series User's Guide,
29 * (adp7770.ovl), the Adaptec AHA-2740 Series Technical Reference Manual,
30 * the Adaptec AIC-7770 Data Book, the ANSI SCSI specification, the
31 * ANSI SCSI-2 specification (draft 10c), ...
33 * --------------------------------------------------------------------------
41 * --------------------------------------------------------------------------
42 * Copyright (c) 1994-2000 Justin T. Gibbs.
43 * Copyright (c) 2000-2001 Adaptec Inc.
57 * 3. Neither the names of the above-listed copyright holders nor the names
78 *---------------------------------------------------------------------------
82 * Rory Bolt - Sequencer bug fixes
83 * Jay Estabrook - Initial DEC Alpha support
84 * Doug Ledford - Much needed abort/reset bug fixes
85 * Kai Makisara - DMAing of SCBs
101 * Copyright (c) 1997-1999 Doug Ledford
149 * To change the default number of tagged transactions allowed per-device,
156 * Twin adapters will use indexes 0-7 for channel 0, and indexes 8-15
169 * The driver will throttle the number of commands dispatched to a
175 * depths. The driver will throttle back when the queue fulls occur and
183 * (0, 2-11, 13-15), disables tagged queueing for ID 12, and tells the
191 * IDs 2, 5-7, and 9-15.
257 ahc->platform_data->host->host_no, in ahc_print_path()
259 scb != NULL ? SCB_GET_TARGET(ahc, scb) : -1, in ahc_print_path()
260 scb != NULL ? SCB_GET_LUN(scb) : -1); in ahc_print_path()
264 * XXX - these options apply unilaterally to _all_ 274x/284x/294x
270 * Skip the scsi bus reset. Non 0 make us skip the reset at startup. This
291 * non-0 = reverse polarity pci parity checking
306 * 0 - 256ms
307 * 1 - 128ms
308 * 2 - 64ms
309 * 3 - 32ms
336 "period-delimited options string:\n"
348 " tag_info:<tag_str> Set per-target tag depth\n"
389 * multi-millisecond waits. Wait at most in ahc_delay()
390 * 1024us per call. in ahc_delay()
394 usec -= 1024; in ahc_delay()
404 if (ahc->tag == BUS_SPACE_MEMIO) { in ahc_inb()
405 x = readb(ahc->bsh.maddr + port); in ahc_inb()
407 x = inb(ahc->bsh.ioport + port); in ahc_inb()
416 if (ahc->tag == BUS_SPACE_MEMIO) { in ahc_outb()
417 writeb(val, ahc->bsh.maddr + port); in ahc_outb()
419 outb(val, ahc->bsh.ioport + port); in ahc_outb()
464 cmd = scb->io_ctx; in ahc_linux_unmap_scb()
476 if ((scb->sg_count + 1) > AHC_NSEG) in ahc_linux_map_seg()
481 sg->addr = ahc_htole32(addr & 0xFFFFFFFF); in ahc_linux_map_seg()
482 scb->platform_data->xfer_len += len; in ahc_linux_map_seg()
485 && (ahc->flags & AHC_39BIT_ADDRESSING) != 0) in ahc_linux_map_seg()
488 sg->len = ahc_htole32(len); in ahc_linux_map_seg()
504 ahc = *(struct ahc_softc **)host->hostdata; in ahc_linux_info()
508 strcat(bp, ahc->description); in ahc_linux_info()
524 struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); in ahc_linux_queue_lck()
528 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; in ahc_linux_queue_lck()
531 if (ahc->platform_data->qfrozen == 0) { in ahc_linux_queue_lck()
532 cmd->result = CAM_REQ_INPROG << 16; in ahc_linux_queue_lck()
546 *((struct ahc_softc **)dev_to_shost(&starget->dev)->hostdata); in DEF_SCSI_QCMD()
549 target_offset = starget->id; in DEF_SCSI_QCMD()
550 if (starget->channel != 0) in DEF_SCSI_QCMD()
553 return &ahc->platform_data->starget[target_offset]; in DEF_SCSI_QCMD()
560 *((struct ahc_softc **)dev_to_shost(&starget->dev)->hostdata); in ahc_linux_target_alloc()
561 struct seeprom_config *sc = ahc->seep_config; in ahc_linux_target_alloc()
566 char channel = starget->channel + 'A'; in ahc_linux_target_alloc()
567 unsigned int our_id = ahc->our_id; in ahc_linux_target_alloc()
570 target_offset = starget->id; in ahc_linux_target_alloc()
571 if (starget->channel != 0) in ahc_linux_target_alloc()
574 if (starget->channel) in ahc_linux_target_alloc()
575 our_id = ahc->our_id_b; in ahc_linux_target_alloc()
586 int flags = sc->device_flags[target_offset]; in ahc_linux_target_alloc()
588 if (ahc->flags & AHC_NEWEEPROM_FMT) { in ahc_linux_target_alloc()
600 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_linux_target_alloc()
613 ahc_compile_devinfo(&devinfo, our_id, starget->id, in ahc_linux_target_alloc()
637 *((struct ahc_softc **)sdev->host->hostdata); in ahc_linux_slave_alloc()
638 struct scsi_target *starget = sdev->sdev_target; in ahc_linux_slave_alloc()
642 printk("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); in ahc_linux_slave_alloc()
651 dev->openings = 1; in ahc_linux_slave_alloc()
658 dev->maxtags = 0; in ahc_linux_slave_alloc()
674 if (!spi_initial_dv(sdev->sdev_target)) in ahc_linux_slave_configure()
695 ahc = *((struct ahc_softc **)sdev->host->hostdata); in ahc_linux_biosparam()
708 extended = (ahc->flags & AHC_EXTENDED_TRANS_A) != 0; in ahc_linux_biosparam()
710 extended = (ahc->flags & AHC_EXTENDED_TRANS_B) != 0; in ahc_linux_biosparam()
761 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; in ahc_linux_bus_reset()
790 .this_id = -1,
803 ((((cmd)->device->id << TID_SHIFT) & TID) \
804 | (((cmd)->device->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \
805 | (((cmd)->device->channel == 0) ? 0 : TWIN_CHNLB))
829 dmat->alignment = alignment; in ahc_dma_tag_create()
830 dmat->boundary = boundary; in ahc_dma_tag_create()
831 dmat->maxsize = maxsize; in ahc_dma_tag_create()
847 *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC); in ahc_dmamem_alloc()
857 dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map); in ahc_dmamem_free()
867 * initialization and not for per-transaction buffer mapping. in ahc_dmamap_load()
872 stack_sg.ds_len = dmat->maxsize; in ahc_dmamap_load()
934 instance = -1; in ahc_parse_brace_option()
935 targ = -1; in ahc_parse_brace_option()
947 if (instance == -1) { in ahc_parse_brace_option()
951 if (targ == -1) in ahc_parse_brace_option()
962 if (targ != -1) in ahc_parse_brace_option()
963 targ = -1; in ahc_parse_brace_option()
964 else if (instance != -1) in ahc_parse_brace_option()
965 instance = -1; in ahc_parse_brace_option()
970 if (instance == -1) in ahc_parse_brace_option()
1077 template->name = ahc->description; in ahc_linux_register_host()
1082 *((struct ahc_softc **)host->hostdata) = ahc; in ahc_linux_register_host()
1083 ahc->platform_data->host = host; in ahc_linux_register_host()
1084 host->can_queue = AHC_MAX_QUEUE; in ahc_linux_register_host()
1085 host->cmd_per_lun = 2; in ahc_linux_register_host()
1087 host->this_id = ahc->our_id; in ahc_linux_register_host()
1088 host->irq = ahc->platform_data->irq; in ahc_linux_register_host()
1089 host->max_id = (ahc->features & AHC_WIDE) ? 16 : 8; in ahc_linux_register_host()
1090 host->max_lun = AHC_NUM_LUNS; in ahc_linux_register_host()
1091 host->max_channel = (ahc->features & AHC_TWIN) ? 1 : 0; in ahc_linux_register_host()
1092 host->sg_tablesize = AHC_NSEG; in ahc_linux_register_host()
1096 sprintf(buf, "scsi%d", host->host_no); in ahc_linux_register_host()
1102 host->unique_id = ahc->unit; in ahc_linux_register_host()
1106 host->transportt = ahc_linux_transport_template; in ahc_linux_register_host()
1108 retval = scsi_add_host(host, ahc->dev); in ahc_linux_register_host()
1137 ahc->flags &= ~(AHC_RESET_BUS_A|AHC_RESET_BUS_B); in ahc_linux_initialize_scsi_bus()
1139 if ((ahc->flags & AHC_RESET_BUS_A) != 0) in ahc_linux_initialize_scsi_bus()
1142 numtarg = (ahc->features & AHC_WIDE) ? 16 : 8; in ahc_linux_initialize_scsi_bus()
1144 if ((ahc->features & AHC_TWIN) != 0) { in ahc_linux_initialize_scsi_bus()
1146 if ((ahc->flags & AHC_RESET_BUS_B) != 0) { in ahc_linux_initialize_scsi_bus()
1168 our_id = ahc->our_id; in ahc_linux_initialize_scsi_bus()
1170 if (i > 7 && (ahc->features & AHC_TWIN) != 0) { in ahc_linux_initialize_scsi_bus()
1172 our_id = ahc->our_id_b; in ahc_linux_initialize_scsi_bus()
1184 if ((ahc->flags & (AHC_RESET_BUS_A|AHC_RESET_BUS_B)) != 0) { in ahc_linux_initialize_scsi_bus()
1195 ahc->platform_data = in ahc_platform_alloc()
1197 if (ahc->platform_data == NULL) in ahc_platform_alloc()
1199 ahc->platform_data->irq = AHC_LINUX_NOIRQ; in ahc_platform_alloc()
1201 ahc->seltime = (aic7xxx_seltime & 0x3) << 4; in ahc_platform_alloc()
1202 ahc->seltime_b = (aic7xxx_seltime & 0x3) << 4; in ahc_platform_alloc()
1204 ahc->flags |= AHC_DISABLE_PCI_PERR; in ahc_platform_alloc()
1215 if (ahc->platform_data != NULL) { in ahc_platform_free()
1218 starget = ahc->platform_data->starget[i]; in ahc_platform_free()
1220 ahc->platform_data->starget[i] = NULL; in ahc_platform_free()
1224 if (ahc->platform_data->irq != AHC_LINUX_NOIRQ) in ahc_platform_free()
1225 free_irq(ahc->platform_data->irq, ahc); in ahc_platform_free()
1226 if (ahc->tag == BUS_SPACE_PIO in ahc_platform_free()
1227 && ahc->bsh.ioport != 0) in ahc_platform_free()
1228 release_region(ahc->bsh.ioport, 256); in ahc_platform_free()
1229 if (ahc->tag == BUS_SPACE_MEMIO in ahc_platform_free()
1230 && ahc->bsh.maddr != NULL) { in ahc_platform_free()
1231 iounmap(ahc->bsh.maddr); in ahc_platform_free()
1232 release_mem_region(ahc->platform_data->mem_busaddr, in ahc_platform_free()
1236 if (ahc->platform_data->host) in ahc_platform_free()
1237 scsi_host_put(ahc->platform_data->host); in ahc_platform_free()
1239 kfree(ahc->platform_data); in ahc_platform_free()
1264 was_queuing = dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED); in ahc_platform_set_tags()
1277 if ((dev->flags & AHC_DEV_FREEZE_TIL_EMPTY) == 0 in ahc_platform_set_tags()
1279 && (dev->active != 0)) { in ahc_platform_set_tags()
1280 dev->flags |= AHC_DEV_FREEZE_TIL_EMPTY; in ahc_platform_set_tags()
1281 dev->qfrozen++; in ahc_platform_set_tags()
1284 dev->flags &= ~(AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED|AHC_DEV_PERIODIC_OTAG); in ahc_platform_set_tags()
1295 dev->maxtags = usertags; in ahc_platform_set_tags()
1296 dev->openings = dev->maxtags - dev->active; in ahc_platform_set_tags()
1298 if (dev->maxtags == 0) { in ahc_platform_set_tags()
1302 dev->openings = 1; in ahc_platform_set_tags()
1304 dev->flags |= AHC_DEV_Q_TAGGED; in ahc_platform_set_tags()
1306 dev->flags |= AHC_DEV_PERIODIC_OTAG; in ahc_platform_set_tags()
1308 dev->flags |= AHC_DEV_Q_BASIC; in ahc_platform_set_tags()
1311 dev->maxtags = 0; in ahc_platform_set_tags()
1312 dev->openings = 1 - dev->active; in ahc_platform_set_tags()
1314 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { in ahc_platform_set_tags()
1318 dev->openings + dev->active); in ahc_platform_set_tags()
1323 * us at any time even though we can only execute them in ahc_platform_set_tags()
1346 if ((ahc->user_discenable & devinfo->target_mask) != 0) { in ahc_linux_user_tagdepth()
1347 if (ahc->unit >= ARRAY_SIZE(aic7xxx_tag_info)) { in ahc_linux_user_tagdepth()
1361 tag_info = &aic7xxx_tag_info[ahc->unit]; in ahc_linux_user_tagdepth()
1362 tags = tag_info->tag_commands[devinfo->target_offset]; in ahc_linux_user_tagdepth()
1378 struct ahc_softc *ahc = *((struct ahc_softc **)sdev->host->hostdata); in ahc_linux_device_queue_depth()
1381 sdev->sdev_target->channel == 0 in ahc_linux_device_queue_depth()
1382 ? ahc->our_id : ahc->our_id_b, in ahc_linux_device_queue_depth()
1383 sdev->sdev_target->id, sdev->lun, in ahc_linux_device_queue_depth()
1384 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahc_linux_device_queue_depth()
1387 if (tags != 0 && sdev->tagged_supported != 0) { in ahc_linux_device_queue_depth()
1414 * Schedule us to run later. The only reason we are not in ahc_linux_run_command()
1417 if (ahc->platform_data->qfrozen != 0) in ahc_linux_run_command()
1426 if (!(cmd->flags & SCMD_TAGGED) in ahc_linux_run_command()
1427 && (ahc->features & AHC_SCB_BTT) == 0) { in ahc_linux_run_command()
1430 target_offset = cmd->device->id + cmd->device->channel * 8; in ahc_linux_run_command()
1431 untagged_q = &(ahc->untagged_queues[target_offset]); in ahc_linux_run_command()
1451 scb->io_ctx = cmd; in ahc_linux_run_command()
1452 scb->platform_data->dev = dev; in ahc_linux_run_command()
1453 hscb = scb->hscb; in ahc_linux_run_command()
1454 cmd->host_scribble = (char *)scb; in ahc_linux_run_command()
1459 hscb->control = 0; in ahc_linux_run_command()
1460 hscb->scsiid = BUILD_SCSIID(ahc, cmd); in ahc_linux_run_command()
1461 hscb->lun = cmd->device->lun; in ahc_linux_run_command()
1466 hscb->scsirate = tinfo->scsirate; in ahc_linux_run_command()
1467 hscb->scsioffset = tinfo->curr.offset; in ahc_linux_run_command()
1468 if ((tstate->ultraenb & mask) != 0) in ahc_linux_run_command()
1469 hscb->control |= ULTRAENB; in ahc_linux_run_command()
1471 if ((ahc->user_discenable & mask) != 0) in ahc_linux_run_command()
1472 hscb->control |= DISCENB; in ahc_linux_run_command()
1474 if ((tstate->auto_negotiate & mask) != 0) { in ahc_linux_run_command()
1475 scb->flags |= SCB_AUTO_NEGOTIATE; in ahc_linux_run_command()
1476 scb->hscb->control |= MK_MESSAGE; in ahc_linux_run_command()
1479 if ((dev->flags & (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) { in ahc_linux_run_command()
1480 if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH in ahc_linux_run_command()
1481 && (dev->flags & AHC_DEV_Q_TAGGED) != 0) { in ahc_linux_run_command()
1482 hscb->control |= ORDERED_QUEUE_TAG; in ahc_linux_run_command()
1483 dev->commands_since_idle_or_otag = 0; in ahc_linux_run_command()
1485 hscb->control |= SIMPLE_QUEUE_TAG; in ahc_linux_run_command()
1489 hscb->cdb_len = cmd->cmd_len; in ahc_linux_run_command()
1490 if (hscb->cdb_len <= 12) { in ahc_linux_run_command()
1491 memcpy(hscb->shared_data.cdb, cmd->cmnd, hscb->cdb_len); in ahc_linux_run_command()
1493 memcpy(hscb->cdb32, cmd->cmnd, hscb->cdb_len); in ahc_linux_run_command()
1494 scb->flags |= SCB_CDB32_PTR; in ahc_linux_run_command()
1497 scb->platform_data->xfer_len = 0; in ahc_linux_run_command()
1500 scb->sg_count = 0; in ahc_linux_run_command()
1508 sg = scb->sg_list; in ahc_linux_run_command()
1523 scb->sg_count += consumed; in ahc_linux_run_command()
1525 sg--; in ahc_linux_run_command()
1526 sg->len |= ahc_htole32(AHC_DMA_LAST_SEG); in ahc_linux_run_command()
1531 scb->hscb->sgptr = in ahc_linux_run_command()
1532 ahc_htole32(scb->sg_list_phys | SG_FULL_RESID); in ahc_linux_run_command()
1538 scb->hscb->dataptr = scb->sg_list->addr; in ahc_linux_run_command()
1539 scb->hscb->datacnt = scb->sg_list->len; in ahc_linux_run_command()
1541 scb->hscb->sgptr = ahc_htole32(SG_LIST_NULL); in ahc_linux_run_command()
1542 scb->hscb->dataptr = 0; in ahc_linux_run_command()
1543 scb->hscb->datacnt = 0; in ahc_linux_run_command()
1544 scb->sg_count = 0; in ahc_linux_run_command()
1547 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links); in ahc_linux_run_command()
1548 dev->openings--; in ahc_linux_run_command()
1549 dev->active++; in ahc_linux_run_command()
1550 dev->commands_issued++; in ahc_linux_run_command()
1551 if ((dev->flags & AHC_DEV_PERIODIC_OTAG) != 0) in ahc_linux_run_command()
1552 dev->commands_since_idle_or_otag++; in ahc_linux_run_command()
1554 scb->flags |= SCB_ACTIVE; in ahc_linux_run_command()
1557 scb->flags |= SCB_UNTAGGEDQ; in ahc_linux_run_command()
1602 channel == 'A' ? ahc->our_id in ahc_send_async()
1603 : ahc->our_id_b, in ahc_send_async()
1610 if (tinfo->curr.period != tinfo->goal.period in ahc_send_async()
1611 || tinfo->curr.width != tinfo->goal.width in ahc_send_async()
1612 || tinfo->curr.offset != tinfo->goal.offset in ahc_send_async()
1613 || tinfo->curr.ppr_options != tinfo->goal.ppr_options) in ahc_send_async()
1624 starget = ahc->platform_data->starget[target_offset]; in ahc_send_async()
1633 if (tinfo->curr.period == spi_period(starget) in ahc_send_async()
1634 && tinfo->curr.width == spi_width(starget) in ahc_send_async()
1635 && tinfo->curr.offset == spi_offset(starget) in ahc_send_async()
1636 && tinfo->curr.ppr_options == target_ppr_options) in ahc_send_async()
1640 spi_period(starget) = tinfo->curr.period; in ahc_send_async()
1641 spi_width(starget) = tinfo->curr.width; in ahc_send_async()
1642 spi_offset(starget) = tinfo->curr.offset; in ahc_send_async()
1643 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; in ahc_send_async()
1644 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; in ahc_send_async()
1645 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; in ahc_send_async()
1652 scsi_report_device_reset(ahc->platform_data->host, in ahc_send_async()
1653 channel - 'A', target); in ahc_send_async()
1657 if (ahc->platform_data->host != NULL) { in ahc_send_async()
1658 scsi_report_bus_reset(ahc->platform_data->host, in ahc_send_async()
1659 channel - 'A'); in ahc_send_async()
1677 if ((scb->flags & SCB_UNTAGGEDQ) != 0) { in ahc_done()
1682 untagged_q = &(ahc->untagged_queues[target_offset]); in ahc_done()
1685 } else if ((scb->flags & SCB_ACTIVE) == 0) { in ahc_done()
1691 printk("SCB %d done'd twice\n", scb->hscb->tag); in ahc_done()
1695 cmd = scb->io_ctx; in ahc_done()
1696 dev = scb->platform_data->dev; in ahc_done()
1697 dev->active--; in ahc_done()
1698 dev->openings++; in ahc_done()
1699 if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) { in ahc_done()
1700 cmd->result &= ~(CAM_DEV_QFRZN << 16); in ahc_done()
1701 dev->qfrozen--; in ahc_done()
1707 * The Linux mid-layer assumes that sense in ahc_done()
1711 cmd->sense_buffer[0] = 0; in ahc_done()
1717 ahc_get_transfer_length(scb) - ahc_get_residual(scb); in ahc_done()
1719 if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) { in ahc_done()
1737 } else if (amount_xferred < scb->io_ctx->underflow) { in ahc_done()
1742 for (i = 0; i < scb->io_ctx->cmd_len; i++) in ahc_done()
1743 printk(" 0x%x", scb->io_ctx->cmnd[i]); in ahc_done()
1756 ahc_linux_handle_scsi_status(ahc, cmd->device, scb); in ahc_done()
1759 if (dev->openings == 1 in ahc_done()
1762 dev->tag_success_count++; in ahc_done()
1766 * full occurrs, we throttle back. Slowly try to get in ahc_done()
1769 if ((dev->openings + dev->active) < dev->maxtags in ahc_done()
1770 && dev->tag_success_count > AHC_TAG_SUCCESS_INTERVAL) { in ahc_done()
1771 dev->tag_success_count = 0; in ahc_done()
1772 dev->openings++; in ahc_done()
1775 if (dev->active == 0) in ahc_done()
1776 dev->commands_since_idle_or_otag = 0; in ahc_done()
1778 if ((scb->flags & SCB_RECOVERY_SCB) != 0) { in ahc_done()
1784 if (ahc->platform_data->eh_done) in ahc_done()
1785 complete(ahc->platform_data->eh_done); in ahc_done()
1800 ahc->our_id, in ahc_linux_handle_scsi_status()
1801 sdev->sdev_target->id, sdev->lun, in ahc_linux_handle_scsi_status()
1802 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahc_linux_handle_scsi_status()
1806 * We don't currently trust the mid-layer to in ahc_linux_handle_scsi_status()
1808 * when one occurs, we tell the mid-layer to in ahc_linux_handle_scsi_status()
1809 * unconditionally requeue the command to us in ahc_linux_handle_scsi_status()
1827 cmd = scb->io_ctx; in ahc_linux_handle_scsi_status()
1828 if (scb->flags & SCB_SENSE) { in ahc_linux_handle_scsi_status()
1832 - ahc_get_sense_residual(scb), in ahc_linux_handle_scsi_status()
1834 memcpy(cmd->sense_buffer, in ahc_linux_handle_scsi_status()
1837 memset(&cmd->sense_buffer[sense_size], 0, in ahc_linux_handle_scsi_status()
1838 SCSI_SENSE_BUFFERSIZE - sense_size); in ahc_linux_handle_scsi_status()
1848 printk("0x%x ", cmd->sense_buffer[i]); in ahc_linux_handle_scsi_status()
1861 * to us but not the device have been returned. in ahc_linux_handle_scsi_status()
1862 * This ensures that dev->active is equal to in ahc_linux_handle_scsi_status()
1866 dev->tag_success_count = 0; in ahc_linux_handle_scsi_status()
1867 if (dev->active != 0) { in ahc_linux_handle_scsi_status()
1872 dev->openings = 0; in ahc_linux_handle_scsi_status()
1875 printk("Dropping tag count to %d\n", dev->active); in ahc_linux_handle_scsi_status()
1877 if (dev->active == dev->tags_on_last_queuefull) { in ahc_linux_handle_scsi_status()
1879 dev->last_queuefull_same_count++; in ahc_linux_handle_scsi_status()
1888 if (dev->last_queuefull_same_count in ahc_linux_handle_scsi_status()
1890 dev->maxtags = dev->active; in ahc_linux_handle_scsi_status()
1893 dev->active); in ahc_linux_handle_scsi_status()
1896 dev->tags_on_last_queuefull = dev->active; in ahc_linux_handle_scsi_status()
1897 dev->last_queuefull_same_count = 0; in ahc_linux_handle_scsi_status()
1902 (dev->flags & AHC_DEV_Q_BASIC) in ahc_linux_handle_scsi_status()
1910 dev->openings = 1; in ahc_linux_handle_scsi_status()
1913 (dev->flags & AHC_DEV_Q_BASIC) in ahc_linux_handle_scsi_status()
1996 ahc->platform_data->qfrozen++; in ahc_linux_freeze_simq()
1997 if (ahc->platform_data->qfrozen == 1) { in ahc_linux_freeze_simq()
1998 scsi_block_requests(ahc->platform_data->host); in ahc_linux_freeze_simq()
2016 if (ahc->platform_data->qfrozen > 0) in ahc_linux_release_simq()
2017 ahc->platform_data->qfrozen--; in ahc_linux_release_simq()
2018 if (ahc->platform_data->qfrozen == 0) in ahc_linux_release_simq()
2022 * There is still a race here. The mid-layer in ahc_linux_release_simq()
2028 scsi_unblock_requests(ahc->platform_data->host); in ahc_linux_release_simq()
2052 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; in ahc_linux_queue_recovery_cmd()
2058 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahc_linux_queue_recovery_cmd()
2059 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahc_linux_queue_recovery_cmd()
2068 * at all, and the system wanted us to just abort the in ahc_linux_queue_recovery_cmd()
2071 dev = scsi_transport_device_data(cmd->device); in ahc_linux_queue_recovery_cmd()
2079 ahc_name(ahc), cmd->device->channel, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2080 (u8)cmd->device->lun); in ahc_linux_queue_recovery_cmd()
2085 if ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0 in ahc_linux_queue_recovery_cmd()
2086 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2087 cmd->device->channel + 'A', in ahc_linux_queue_recovery_cmd()
2088 (u8)cmd->device->lun, in ahc_linux_queue_recovery_cmd()
2091 ahc_name(ahc), cmd->device->channel, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2092 (u8)cmd->device->lun); in ahc_linux_queue_recovery_cmd()
2100 LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) { in ahc_linux_queue_recovery_cmd()
2101 if (pending_scb->io_ctx == cmd) in ahc_linux_queue_recovery_cmd()
2108 LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) { in ahc_linux_queue_recovery_cmd()
2122 if ((pending_scb->flags & SCB_RECOVERY_SCB) != 0) { in ahc_linux_queue_recovery_cmd()
2139 if ((pending_scb->flags & SCB_ACTIVE) == 0) { in ahc_linux_queue_recovery_cmd()
2150 if (ahc_search_qinfifo(ahc, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2151 cmd->device->channel + 'A', in ahc_linux_queue_recovery_cmd()
2152 cmd->device->lun, in ahc_linux_queue_recovery_cmd()
2153 pending_scb->hscb->tag, in ahc_linux_queue_recovery_cmd()
2157 ahc_name(ahc), cmd->device->channel, in ahc_linux_queue_recovery_cmd()
2158 cmd->device->id, (u8)cmd->device->lun); in ahc_linux_queue_recovery_cmd()
2162 } else if (ahc_search_qinfifo(ahc, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2163 cmd->device->channel + 'A', in ahc_linux_queue_recovery_cmd()
2164 cmd->device->lun, in ahc_linux_queue_recovery_cmd()
2165 pending_scb->hscb->tag, in ahc_linux_queue_recovery_cmd()
2178 && ahc_inb(ahc, SAVED_SCSIID) == pending_scb->hscb->scsiid in ahc_linux_queue_recovery_cmd()
2196 && (pending_scb->hscb->tag == active_scb_index in ahc_linux_queue_recovery_cmd()
2205 pending_scb->flags |= SCB_RECOVERY_SCB|flag; in ahc_linux_queue_recovery_cmd()
2213 * Actually re-queue this SCB in an attempt in ahc_linux_queue_recovery_cmd()
2217 * to the timed-out device. in ahc_linux_queue_recovery_cmd()
2228 pending_scb->hscb->control |= MK_MESSAGE|DISCONNECTED; in ahc_linux_queue_recovery_cmd()
2229 pending_scb->flags |= SCB_RECOVERY_SCB|flag; in ahc_linux_queue_recovery_cmd()
2238 ahc_search_disc_list(ahc, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2239 cmd->device->channel + 'A', in ahc_linux_queue_recovery_cmd()
2240 cmd->device->lun, pending_scb->hscb->tag, in ahc_linux_queue_recovery_cmd()
2246 * In the non-paging case, the sequencer will in ahc_linux_queue_recovery_cmd()
2247 * never re-reference the in-core SCB. in ahc_linux_queue_recovery_cmd()
2252 if ((ahc->flags & AHC_PAGESCBS) == 0) { in ahc_linux_queue_recovery_cmd()
2253 ahc_outb(ahc, SCBPTR, pending_scb->hscb->tag); in ahc_linux_queue_recovery_cmd()
2263 ahc_search_qinfifo(ahc, cmd->device->id, in ahc_linux_queue_recovery_cmd()
2264 cmd->device->channel + 'A', in ahc_linux_queue_recovery_cmd()
2265 cmd->device->lun, SCB_LIST_NULL, in ahc_linux_queue_recovery_cmd()
2271 printk("Device is disconnected, re-queuing SCB\n"); in ahc_linux_queue_recovery_cmd()
2283 * the semantics of the mid-layer recovery engine are not in ahc_linux_queue_recovery_cmd()
2293 ahc->platform_data->eh_done = &done; in ahc_linux_queue_recovery_cmd()
2299 ahc->platform_data->eh_done = NULL; in ahc_linux_queue_recovery_cmd()
2313 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_width()
2314 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_width()
2318 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_width()
2319 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_width()
2325 static void ahc_linux_set_period(struct scsi_target *starget, int period) in ahc_linux_set_period() argument
2327 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_period()
2328 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_period()
2332 starget->channel + 'A', in ahc_linux_set_period()
2333 shost->this_id, starget->id, &tstate); in ahc_linux_set_period()
2335 unsigned int ppr_options = tinfo->goal.ppr_options; in ahc_linux_set_period()
2337 unsigned long offset = tinfo->goal.offset; in ahc_linux_set_period()
2343 if (period < 9) in ahc_linux_set_period()
2344 period = 9; /* 12.5ns is our minimum */ in ahc_linux_set_period()
2345 if (period == 9) { in ahc_linux_set_period()
2350 period = 10; in ahc_linux_set_period()
2353 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_period()
2354 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_period()
2362 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, in ahc_linux_set_period()
2365 ahc_set_syncrate(ahc, &devinfo, syncrate, period, offset, in ahc_linux_set_period()
2372 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_offset()
2373 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_offset()
2377 starget->channel + 'A', in ahc_linux_set_offset()
2378 shost->this_id, starget->id, &tstate); in ahc_linux_set_offset()
2381 unsigned int period = 0; in ahc_linux_set_offset() local
2385 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_offset()
2386 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_offset()
2388 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, in ahc_linux_set_offset()
2390 period = tinfo->goal.period; in ahc_linux_set_offset()
2391 ppr_options = tinfo->goal.ppr_options; in ahc_linux_set_offset()
2394 ahc_set_syncrate(ahc, &devinfo, syncrate, period, offset, in ahc_linux_set_offset()
2401 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahc_linux_set_dt()
2402 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); in ahc_linux_set_dt()
2406 starget->channel + 'A', in ahc_linux_set_dt()
2407 shost->this_id, starget->id, &tstate); in ahc_linux_set_dt()
2409 unsigned int ppr_options = tinfo->goal.ppr_options in ahc_linux_set_dt()
2411 unsigned int period = tinfo->goal.period; in ahc_linux_set_dt() local
2412 unsigned int width = tinfo->goal.width; in ahc_linux_set_dt()
2420 } else if (period == 9) in ahc_linux_set_dt()
2421 period = 10; /* if resetting DT, period must be >= 25ns */ in ahc_linux_set_dt()
2423 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahc_linux_set_dt()
2424 starget->channel + 'A', ROLE_INITIATOR); in ahc_linux_set_dt()
2425 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, in ahc_linux_set_dt()
2428 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, in ahc_linux_set_dt()
2440 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
2441 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2445 starget->channel + 'A',
2446 shost->this_id, starget->id, &tstate);
2448 unsigned int ppr_options = tinfo->goal.ppr_options
2450 unsigned int period = tinfo->goal.period;
2457 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
2458 starget->channel + 'A', ROLE_INITIATOR);
2459 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,
2462 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset,
2469 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
2470 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2474 starget->channel + 'A',
2475 shost->this_id, starget->id, &tstate);
2477 unsigned int ppr_options = tinfo->goal.ppr_options
2479 unsigned int period = tinfo->goal.period;
2486 ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
2487 starget->channel + 'A', ROLE_INITIATOR);
2488 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,
2491 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset,
2499 struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; in ahc_linux_get_signalling()
2503 if (!(ahc->features & AHC_ULTRA2)) { in ahc_linux_get_signalling()
2504 /* non-LVD chipset, may not have SBLKCTL reg */ in ahc_linux_get_signalling()
2506 ahc->features & AHC_HVD ? in ahc_linux_get_signalling()
2558 return -ENODEV; in ahc_linux_init()