Lines Matching +full:reg +full:- +full:names
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
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
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()
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()
482 ahd_pci_read_config(ahd_dev_softc_t pci, int reg, int width) in ahd_pci_read_config() argument
489 pci_read_config_byte(pci, reg, &retval); in ahd_pci_read_config()
495 pci_read_config_word(pci, reg, &retval); in ahd_pci_read_config()
501 pci_read_config_dword(pci, reg, &retval); in ahd_pci_read_config()
512 ahd_pci_write_config(ahd_dev_softc_t pci, int reg, uint32_t value, int width) in ahd_pci_write_config() argument
516 pci_write_config_byte(pci, reg, value); in ahd_pci_write_config()
519 pci_write_config_word(pci, reg, value); in ahd_pci_write_config()
522 pci_write_config_dword(pci, reg, value); in ahd_pci_write_config()
538 cmd = scb->io_ctx; in ahd_linux_unmap_scb()
545 (((scmd_id(cmd) << TID_SHIFT) & TID) | (ahd)->our_id)
559 ahd = *(struct ahd_softc **)host->hostdata; in ahd_linux_info()
561 strcpy(bp, "Adaptec AIC79XX PCI-X SCSI HBA DRIVER, Rev " AIC79XX_DRIVER_VERSION "\n" in ahd_linux_info()
563 strcat(bp, ahd->description); in ahd_linux_info()
579 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_lck()
582 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_lck()
584 cmd->scsi_done = scsi_done; in ahd_linux_queue_lck()
585 cmd->result = CAM_REQ_INPROG << 16; in ahd_linux_queue_lck()
597 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in DEF_SCSI_QCMD()
600 target_offset = starget->id; in DEF_SCSI_QCMD()
601 if (starget->channel != 0) in DEF_SCSI_QCMD()
604 return &ahd->platform_data->starget[target_offset]; in DEF_SCSI_QCMD()
611 *((struct ahd_softc **)dev_to_shost(&starget->dev)->hostdata); in ahd_linux_target_alloc()
612 struct seeprom_config *sc = ahd->seep_config; in ahd_linux_target_alloc()
618 char channel = starget->channel + 'A'; in ahd_linux_target_alloc()
627 int flags = sc->device_flags[starget->id]; in ahd_linux_target_alloc()
629 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_target_alloc()
630 starget->id, &tstate); in ahd_linux_target_alloc()
636 if ((ahd->features & AHD_RTI) == 0) in ahd_linux_target_alloc()
645 spi_min_period(starget) = tinfo->user.period; in ahd_linux_target_alloc()
646 spi_max_offset(starget) = tinfo->user.offset; in ahd_linux_target_alloc()
649 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_linux_target_alloc()
650 starget->id, &tstate); in ahd_linux_target_alloc()
651 ahd_compile_devinfo(&devinfo, ahd->our_id, starget->id, in ahd_linux_target_alloc()
675 *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_slave_alloc()
679 printk("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id); in ahd_linux_slave_alloc()
688 dev->openings = 1; in ahd_linux_slave_alloc()
695 dev->maxtags = 0; in ahd_linux_slave_alloc()
705 ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_slave_configure()
712 if (!spi_initial_dv(sdev->sdev_target)) in ahd_linux_slave_configure()
734 ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_biosparam()
741 if (ret != -1) in ahd_linux_biosparam()
751 extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0; in ahd_linux_biosparam()
798 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_dev_reset()
804 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_dev_reset()
805 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_dev_reset()
811 dev = scsi_transport_device_data(cmd->device); in ahd_linux_dev_reset()
831 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_dev_reset()
832 cmd->device->id, &tstate); in ahd_linux_dev_reset()
833 reset_scb->io_ctx = cmd; in ahd_linux_dev_reset()
834 reset_scb->platform_data->dev = dev; in ahd_linux_dev_reset()
835 reset_scb->sg_count = 0; in ahd_linux_dev_reset()
838 reset_scb->platform_data->xfer_len = 0; in ahd_linux_dev_reset()
839 reset_scb->hscb->control = 0; in ahd_linux_dev_reset()
840 reset_scb->hscb->scsiid = BUILD_SCSIID(ahd,cmd); in ahd_linux_dev_reset()
841 reset_scb->hscb->lun = cmd->device->lun; in ahd_linux_dev_reset()
842 reset_scb->hscb->cdb_len = 0; in ahd_linux_dev_reset()
843 reset_scb->hscb->task_management = SIU_TASKMGMT_LUN_RESET; in ahd_linux_dev_reset()
844 reset_scb->flags |= SCB_DEVICE_RESET|SCB_RECOVERY_SCB|SCB_ACTIVE; in ahd_linux_dev_reset()
845 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_dev_reset()
846 reset_scb->flags |= SCB_PACKETIZED; in ahd_linux_dev_reset()
848 reset_scb->hscb->control |= MK_MESSAGE; in ahd_linux_dev_reset()
850 dev->openings--; in ahd_linux_dev_reset()
851 dev->active++; in ahd_linux_dev_reset()
852 dev->commands_issued++; in ahd_linux_dev_reset()
856 LIST_INSERT_HEAD(&ahd->pending_scbs, reset_scb, pending_links); in ahd_linux_dev_reset()
859 ahd->platform_data->eh_done = &done; in ahd_linux_dev_reset()
865 ahd->platform_data->eh_done = NULL; in ahd_linux_dev_reset()
868 ahd_name(ahd), dev->active); in ahd_linux_dev_reset()
886 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_bus_reset()
919 .this_id = -1,
951 dmat->alignment = alignment; in ahd_dma_tag_create()
952 dmat->boundary = boundary; in ahd_dma_tag_create()
953 dmat->maxsize = maxsize; in ahd_dma_tag_create()
968 *vaddr = pci_alloc_consistent(ahd->dev_softc, in ahd_dmamem_alloc()
969 dmat->maxsize, mapp); in ahd_dmamem_alloc()
979 pci_free_consistent(ahd->dev_softc, dmat->maxsize, in ahd_dmamem_free()
990 * initialization and not for per-transaction buffer mapping. in ahd_dmamap_load()
995 stack_sg.ds_len = dmat->maxsize; in ahd_dmamap_load()
1073 instance = -1; in ahd_parse_brace_option()
1074 targ = -1; in ahd_parse_brace_option()
1086 if (instance == -1) { in ahd_parse_brace_option()
1090 if (targ == -1) in ahd_parse_brace_option()
1101 if (targ != -1) in ahd_parse_brace_option()
1102 targ = -1; in ahd_parse_brace_option()
1103 else if (instance != -1) in ahd_parse_brace_option()
1104 instance = -1; in ahd_parse_brace_option()
1109 if (instance == -1) in ahd_parse_brace_option()
1231 template->name = ahd->description; in ahd_linux_register_host()
1236 *((struct ahd_softc **)host->hostdata) = ahd; in ahd_linux_register_host()
1237 ahd->platform_data->host = host; in ahd_linux_register_host()
1238 host->can_queue = AHD_MAX_QUEUE; in ahd_linux_register_host()
1239 host->cmd_per_lun = 2; in ahd_linux_register_host()
1240 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1241 host->this_id = ahd->our_id; in ahd_linux_register_host()
1242 host->irq = ahd->platform_data->irq; in ahd_linux_register_host()
1243 host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_register_host()
1244 host->max_lun = AHD_NUM_LUNS; in ahd_linux_register_host()
1245 host->max_channel = 0; in ahd_linux_register_host()
1246 host->sg_tablesize = AHD_NSEG; in ahd_linux_register_host()
1250 sprintf(buf, "scsi%d", host->host_no); in ahd_linux_register_host()
1256 host->unique_id = ahd->unit; in ahd_linux_register_host()
1260 host->transportt = ahd_linux_transport_template; in ahd_linux_register_host()
1262 retval = scsi_add_host(host, &ahd->dev_softc->dev); in ahd_linux_register_host()
1289 ahd->flags &= ~AHD_RESET_BUS_A; in ahd_linux_initialize_scsi_bus()
1291 if ((ahd->flags & AHD_RESET_BUS_A) != 0) in ahd_linux_initialize_scsi_bus()
1294 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8; in ahd_linux_initialize_scsi_bus()
1307 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_initialize_scsi_bus()
1309 ahd_compile_devinfo(&devinfo, ahd->our_id, target_id, in ahd_linux_initialize_scsi_bus()
1316 if ((ahd->flags & AHD_RESET_BUS_A) != 0) { in ahd_linux_initialize_scsi_bus()
1326 ahd->platform_data = in ahd_platform_alloc()
1328 if (ahd->platform_data == NULL) in ahd_platform_alloc()
1330 memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data)); in ahd_platform_alloc()
1331 ahd->platform_data->irq = AHD_LINUX_NOIRQ; in ahd_platform_alloc()
1333 ahd->seltime = (aic79xx_seltime & 0x3) << 4; in ahd_platform_alloc()
1343 if (ahd->platform_data != NULL) { in ahd_platform_free()
1346 starget = ahd->platform_data->starget[i]; in ahd_platform_free()
1348 ahd->platform_data->starget[i] = NULL; in ahd_platform_free()
1352 if (ahd->platform_data->irq != AHD_LINUX_NOIRQ) in ahd_platform_free()
1353 free_irq(ahd->platform_data->irq, ahd); in ahd_platform_free()
1354 if (ahd->tags[0] == BUS_SPACE_PIO in ahd_platform_free()
1355 && ahd->bshs[0].ioport != 0) in ahd_platform_free()
1356 release_region(ahd->bshs[0].ioport, 256); in ahd_platform_free()
1357 if (ahd->tags[1] == BUS_SPACE_PIO in ahd_platform_free()
1358 && ahd->bshs[1].ioport != 0) in ahd_platform_free()
1359 release_region(ahd->bshs[1].ioport, 256); in ahd_platform_free()
1360 if (ahd->tags[0] == BUS_SPACE_MEMIO in ahd_platform_free()
1361 && ahd->bshs[0].maddr != NULL) { in ahd_platform_free()
1362 iounmap(ahd->bshs[0].maddr); in ahd_platform_free()
1363 release_mem_region(ahd->platform_data->mem_busaddr, in ahd_platform_free()
1366 if (ahd->platform_data->host) in ahd_platform_free()
1367 scsi_host_put(ahd->platform_data->host); in ahd_platform_free()
1369 kfree(ahd->platform_data); in ahd_platform_free()
1379 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_platform_init()
1382 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_platform_init()
1383 if (iocell_opts->precomp != AIC79XX_DEFAULT_PRECOMP) in ahd_platform_init()
1384 AHD_SET_PRECOMP(ahd, iocell_opts->precomp); in ahd_platform_init()
1385 if (iocell_opts->slewrate != AIC79XX_DEFAULT_SLEWRATE) in ahd_platform_init()
1386 AHD_SET_SLEWRATE(ahd, iocell_opts->slewrate); in ahd_platform_init()
1387 if (iocell_opts->amplitude != AIC79XX_DEFAULT_AMPLITUDE) in ahd_platform_init()
1388 AHD_SET_AMPLITUDE(ahd, iocell_opts->amplitude); in ahd_platform_init()
1417 was_queuing = dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED); in ahd_platform_set_tags()
1430 if ((dev->flags & AHD_DEV_FREEZE_TIL_EMPTY) == 0 in ahd_platform_set_tags()
1432 && (dev->active != 0)) { in ahd_platform_set_tags()
1433 dev->flags |= AHD_DEV_FREEZE_TIL_EMPTY; in ahd_platform_set_tags()
1434 dev->qfrozen++; in ahd_platform_set_tags()
1437 dev->flags &= ~(AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED|AHD_DEV_PERIODIC_OTAG); in ahd_platform_set_tags()
1448 dev->maxtags = usertags; in ahd_platform_set_tags()
1449 dev->openings = dev->maxtags - dev->active; in ahd_platform_set_tags()
1451 if (dev->maxtags == 0) { in ahd_platform_set_tags()
1455 dev->openings = 1; in ahd_platform_set_tags()
1457 dev->flags |= AHD_DEV_Q_TAGGED; in ahd_platform_set_tags()
1459 dev->flags |= AHD_DEV_PERIODIC_OTAG; in ahd_platform_set_tags()
1461 dev->flags |= AHD_DEV_Q_BASIC; in ahd_platform_set_tags()
1464 dev->maxtags = 0; in ahd_platform_set_tags()
1465 dev->openings = 1 - dev->active; in ahd_platform_set_tags()
1468 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) { in ahd_platform_set_tags()
1471 scsi_activate_tcq(sdev, dev->openings + dev->active); in ahd_platform_set_tags()
1475 scsi_activate_tcq(sdev, dev->openings + dev->active); in ahd_platform_set_tags()
1503 if ((ahd->user_discenable & devinfo->target_mask) != 0) { in ahd_linux_user_tagdepth()
1504 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) { in ahd_linux_user_tagdepth()
1518 tag_info = &aic79xx_tag_info[ahd->unit]; in ahd_linux_user_tagdepth()
1519 tags = tag_info->tag_commands[devinfo->target_offset]; in ahd_linux_user_tagdepth()
1535 struct ahd_softc *ahd = *((struct ahd_softc **)sdev->host->hostdata); in ahd_linux_device_queue_depth()
1538 ahd->our_id, in ahd_linux_device_queue_depth()
1539 sdev->sdev_target->id, sdev->lun, in ahd_linux_device_queue_depth()
1540 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_device_queue_depth()
1543 if (tags != 0 && sdev->tagged_supported != 0) { in ahd_linux_device_queue_depth()
1579 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, in ahd_linux_run_command()
1580 cmd->device->id, &tstate); in ahd_linux_run_command()
1581 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) == 0 in ahd_linux_run_command()
1582 || (tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { in ahd_linux_run_command()
1585 col_idx = AHD_BUILD_COL_IDX(cmd->device->id, in ahd_linux_run_command()
1586 cmd->device->lun); in ahd_linux_run_command()
1589 ahd->flags |= AHD_RESOURCE_SHORTAGE; in ahd_linux_run_command()
1595 scb->io_ctx = cmd; in ahd_linux_run_command()
1596 scb->platform_data->dev = dev; in ahd_linux_run_command()
1597 hscb = scb->hscb; in ahd_linux_run_command()
1598 cmd->host_scribble = (char *)scb; in ahd_linux_run_command()
1603 hscb->control = 0; in ahd_linux_run_command()
1604 hscb->scsiid = BUILD_SCSIID(ahd, cmd); in ahd_linux_run_command()
1605 hscb->lun = cmd->device->lun; in ahd_linux_run_command()
1606 scb->hscb->task_management = 0; in ahd_linux_run_command()
1609 if ((ahd->user_discenable & mask) != 0) in ahd_linux_run_command()
1610 hscb->control |= DISCENB; in ahd_linux_run_command()
1612 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) in ahd_linux_run_command()
1613 scb->flags |= SCB_PACKETIZED; in ahd_linux_run_command()
1615 if ((tstate->auto_negotiate & mask) != 0) { in ahd_linux_run_command()
1616 scb->flags |= SCB_AUTO_NEGOTIATE; in ahd_linux_run_command()
1617 scb->hscb->control |= MK_MESSAGE; in ahd_linux_run_command()
1620 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) { in ahd_linux_run_command()
1626 hscb->control |= tag_msgs[0]; in ahd_linux_run_command()
1628 dev->commands_since_idle_or_otag = 0; in ahd_linux_run_command()
1630 if (dev->commands_since_idle_or_otag == AHD_OTAG_THRESH in ahd_linux_run_command()
1631 && (dev->flags & AHD_DEV_Q_TAGGED) != 0) { in ahd_linux_run_command()
1632 hscb->control |= MSG_ORDERED_TASK; in ahd_linux_run_command()
1633 dev->commands_since_idle_or_otag = 0; in ahd_linux_run_command()
1635 hscb->control |= MSG_SIMPLE_TASK; in ahd_linux_run_command()
1639 hscb->cdb_len = cmd->cmd_len; in ahd_linux_run_command()
1640 memcpy(hscb->shared_data.idata.cdb, cmd->cmnd, hscb->cdb_len); in ahd_linux_run_command()
1642 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1645 scb->sg_count = 0; in ahd_linux_run_command()
1648 void *sg = scb->sg_list; in ahd_linux_run_command()
1652 scb->platform_data->xfer_len = 0; in ahd_linux_run_command()
1660 scb->platform_data->xfer_len += len; in ahd_linux_run_command()
1662 i == (nseg - 1)); in ahd_linux_run_command()
1666 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links); in ahd_linux_run_command()
1667 dev->openings--; in ahd_linux_run_command()
1668 dev->active++; in ahd_linux_run_command()
1669 dev->commands_issued++; in ahd_linux_run_command()
1671 if ((dev->flags & AHD_DEV_PERIODIC_OTAG) != 0) in ahd_linux_run_command()
1672 dev->commands_since_idle_or_otag++; in ahd_linux_run_command()
1673 scb->flags |= SCB_ACTIVE; in ahd_linux_run_command()
1718 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, in ahd_send_async()
1725 if (tinfo->curr.period != tinfo->goal.period in ahd_send_async()
1726 || tinfo->curr.width != tinfo->goal.width in ahd_send_async()
1727 || tinfo->curr.offset != tinfo->goal.offset in ahd_send_async()
1728 || tinfo->curr.ppr_options != tinfo->goal.ppr_options) in ahd_send_async()
1736 starget = ahd->platform_data->starget[target]; in ahd_send_async()
1750 if (tinfo->curr.period == spi_period(starget) in ahd_send_async()
1751 && tinfo->curr.width == spi_width(starget) in ahd_send_async()
1752 && tinfo->curr.offset == spi_offset(starget) in ahd_send_async()
1753 && tinfo->curr.ppr_options == target_ppr_options) in ahd_send_async()
1757 spi_period(starget) = tinfo->curr.period; in ahd_send_async()
1758 spi_width(starget) = tinfo->curr.width; in ahd_send_async()
1759 spi_offset(starget) = tinfo->curr.offset; in ahd_send_async()
1760 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; in ahd_send_async()
1761 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; in ahd_send_async()
1762 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; in ahd_send_async()
1763 spi_rd_strm(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RD_STRM ? 1 : 0; in ahd_send_async()
1764 spi_pcomp_en(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_PCOMP_EN ? 1 : 0; in ahd_send_async()
1765 spi_rti(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RTI ? 1 : 0; in ahd_send_async()
1766 spi_wr_flow(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_WR_FLOW ? 1 : 0; in ahd_send_async()
1767 spi_hold_mcs(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_HOLD_MCS ? 1 : 0; in ahd_send_async()
1774 scsi_report_device_reset(ahd->platform_data->host, in ahd_send_async()
1775 channel - 'A', target); in ahd_send_async()
1779 if (ahd->platform_data->host != NULL) { in ahd_send_async()
1780 scsi_report_bus_reset(ahd->platform_data->host, in ahd_send_async()
1781 channel - 'A'); in ahd_send_async()
1798 if ((scb->flags & SCB_ACTIVE) == 0) { in ahd_done()
1804 cmd = scb->io_ctx; in ahd_done()
1805 dev = scb->platform_data->dev; in ahd_done()
1806 dev->active--; in ahd_done()
1807 dev->openings++; in ahd_done()
1808 if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) { in ahd_done()
1809 cmd->result &= ~(CAM_DEV_QFRZN << 16); in ahd_done()
1810 dev->qfrozen--; in ahd_done()
1816 * The Linux mid-layer assumes that sense in ahd_done()
1820 cmd->sense_buffer[0] = 0; in ahd_done()
1825 ahd_get_transfer_length(scb) - ahd_get_residual(scb); in ahd_done()
1826 if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) { in ahd_done()
1844 } else if (amount_xferred < scb->io_ctx->underflow) { in ahd_done()
1849 for (i = 0; i < scb->io_ctx->cmd_len; i++) in ahd_done()
1850 printk(" 0x%x", scb->io_ctx->cmnd[i]); in ahd_done()
1863 ahd_linux_handle_scsi_status(ahd, cmd->device, scb); in ahd_done()
1866 if (dev->openings == 1 in ahd_done()
1869 dev->tag_success_count++; in ahd_done()
1876 if ((dev->openings + dev->active) < dev->maxtags in ahd_done()
1877 && dev->tag_success_count > AHD_TAG_SUCCESS_INTERVAL) { in ahd_done()
1878 dev->tag_success_count = 0; in ahd_done()
1879 dev->openings++; in ahd_done()
1882 if (dev->active == 0) in ahd_done()
1883 dev->commands_since_idle_or_otag = 0; in ahd_done()
1885 if ((scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_done()
1891 if (ahd->platform_data->eh_done) in ahd_done()
1892 complete(ahd->platform_data->eh_done); in ahd_done()
1907 ahd->our_id, in ahd_linux_handle_scsi_status()
1908 sdev->sdev_target->id, sdev->lun, in ahd_linux_handle_scsi_status()
1909 sdev->sdev_target->channel == 0 ? 'A' : 'B', in ahd_linux_handle_scsi_status()
1913 * We don't currently trust the mid-layer to in ahd_linux_handle_scsi_status()
1915 * when one occurs, we tell the mid-layer to in ahd_linux_handle_scsi_status()
1934 cmd = scb->io_ctx; in ahd_linux_handle_scsi_status()
1935 if ((scb->flags & (SCB_SENSE|SCB_PKT_SENSE)) != 0) { in ahd_linux_handle_scsi_status()
1940 if (scb->flags & SCB_SENSE) { in ahd_linux_handle_scsi_status()
1942 - ahd_get_sense_residual(scb), in ahd_linux_handle_scsi_status()
1951 scb->sense_data; in ahd_linux_handle_scsi_status()
1953 scsi_4btoul(siu->sense_length), in ahd_linux_handle_scsi_status()
1958 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in ahd_linux_handle_scsi_status()
1959 memcpy(cmd->sense_buffer, in ahd_linux_handle_scsi_status()
1962 cmd->result |= (DRIVER_SENSE << 24); in ahd_linux_handle_scsi_status()
1973 printk("0x%x ", cmd->sense_buffer[i]); in ahd_linux_handle_scsi_status()
1986 * This ensures that dev->active is equal to in ahd_linux_handle_scsi_status()
1990 dev->tag_success_count = 0; in ahd_linux_handle_scsi_status()
1991 if (dev->active != 0) { in ahd_linux_handle_scsi_status()
1996 dev->openings = 0; in ahd_linux_handle_scsi_status()
2001 dev->active); in ahd_linux_handle_scsi_status()
2004 if (dev->active == dev->tags_on_last_queuefull) { in ahd_linux_handle_scsi_status()
2006 dev->last_queuefull_same_count++; in ahd_linux_handle_scsi_status()
2015 if (dev->last_queuefull_same_count in ahd_linux_handle_scsi_status()
2017 dev->maxtags = dev->active; in ahd_linux_handle_scsi_status()
2020 dev->active); in ahd_linux_handle_scsi_status()
2023 dev->tags_on_last_queuefull = dev->active; in ahd_linux_handle_scsi_status()
2024 dev->last_queuefull_same_count = 0; in ahd_linux_handle_scsi_status()
2029 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2037 dev->openings = 1; in ahd_linux_handle_scsi_status()
2039 (dev->flags & AHD_DEV_Q_BASIC) in ahd_linux_handle_scsi_status()
2075 if ((cmd->result >> 24) != DRIVER_SENSE) { in ahd_linux_queue_cmd_complete()
2081 cmd->sense_buffer; in ahd_linux_queue_cmd_complete()
2082 if (sense->extra_len >= 5 && in ahd_linux_queue_cmd_complete()
2083 (sense->add_sense_code == 0x47 in ahd_linux_queue_cmd_complete()
2084 || sense->add_sense_code == 0x48)) in ahd_linux_queue_cmd_complete()
2144 ahd_name(ahd), status, cmd->device->channel, in ahd_linux_queue_cmd_complete()
2145 cmd->device->id, cmd->device->lun); in ahd_linux_queue_cmd_complete()
2150 cmd->scsi_done(cmd); in ahd_linux_queue_cmd_complete()
2156 scsi_block_requests(ahd->platform_data->host); in ahd_freeze_simq()
2162 scsi_unblock_requests(ahd->platform_data->host); in ahd_release_simq()
2187 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; in ahd_linux_queue_abort_cmd()
2193 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) in ahd_linux_queue_abort_cmd()
2194 printk(" 0x%x", cmd->cmnd[cdb_byte]); in ahd_linux_queue_abort_cmd()
2206 dev = scsi_transport_device_data(cmd->device); in ahd_linux_queue_abort_cmd()
2221 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { in ahd_linux_queue_abort_cmd()
2222 if (pending_scb->io_ctx == cmd) in ahd_linux_queue_abort_cmd()
2231 if ((pending_scb->flags & SCB_RECOVERY_SCB) != 0) { in ahd_linux_queue_abort_cmd()
2249 if ((pending_scb->flags & SCB_ACTIVE) == 0) { in ahd_linux_queue_abort_cmd()
2259 if (ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2260 cmd->device->channel + 'A', in ahd_linux_queue_abort_cmd()
2261 cmd->device->lun, in ahd_linux_queue_abort_cmd()
2262 pending_scb->hscb->tag, in ahd_linux_queue_abort_cmd()
2266 ahd_name(ahd), cmd->device->channel, in ahd_linux_queue_abort_cmd()
2267 cmd->device->id, cmd->device->lun); in ahd_linux_queue_abort_cmd()
2299 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2307 * Actually re-queue this SCB in an attempt in ahd_linux_queue_abort_cmd()
2310 pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT; in ahd_linux_queue_abort_cmd()
2312 pending_scb->hscb->cdb_len = 0; in ahd_linux_queue_abort_cmd()
2313 pending_scb->hscb->task_attribute = 0; in ahd_linux_queue_abort_cmd()
2314 pending_scb->hscb->task_management = SIU_TASKMGMT_ABORT_TASK; in ahd_linux_queue_abort_cmd()
2316 if ((pending_scb->flags & SCB_PACKETIZED) != 0) { in ahd_linux_queue_abort_cmd()
2325 pending_scb->hscb->task_management); in ahd_linux_queue_abort_cmd()
2328 * If non-packetized, set the MK_MESSAGE control in ahd_linux_queue_abort_cmd()
2336 pending_scb->hscb->control |= MK_MESSAGE|DISCONNECTED; in ahd_linux_queue_abort_cmd()
2339 * The sequencer will never re-reference the in ahd_linux_queue_abort_cmd()
2340 * in-core SCB. To make sure we are notified in ahd_linux_queue_abort_cmd()
2353 ahd_search_qinfifo(ahd, cmd->device->id, in ahd_linux_queue_abort_cmd()
2354 cmd->device->channel + 'A', cmd->device->lun, in ahd_linux_queue_abort_cmd()
2360 printk("Device is disconnected, re-queuing SCB\n"); in ahd_linux_queue_abort_cmd()
2372 * the semantics of the mid-layer recovery engine are not in ahd_linux_queue_abort_cmd()
2382 ahd->platform_data->eh_done = &done; in ahd_linux_queue_abort_cmd()
2388 ahd->platform_data->eh_done = NULL; in ahd_linux_queue_abort_cmd()
2391 ahd_name(ahd), dev->active); in ahd_linux_queue_abort_cmd()
2407 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_width()
2408 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_width()
2412 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_width()
2413 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_width()
2421 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_period()
2422 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_period()
2426 starget->channel + 'A', in ahd_linux_set_period()
2427 shost->this_id, starget->id, &tstate); in ahd_linux_set_period()
2429 unsigned int ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_period()
2432 unsigned long offset = tinfo->goal.offset; in ahd_linux_set_period()
2454 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_period()
2455 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_period()
2474 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_offset()
2475 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_offset()
2479 starget->channel + 'A', in ahd_linux_set_offset()
2480 shost->this_id, starget->id, &tstate); in ahd_linux_set_offset()
2492 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_offset()
2493 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_offset()
2495 period = tinfo->goal.period; in ahd_linux_set_offset()
2496 ppr_options = tinfo->goal.ppr_options; in ahd_linux_set_offset()
2509 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_dt()
2510 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_dt()
2514 starget->channel + 'A', in ahd_linux_set_dt()
2515 shost->this_id, starget->id, &tstate); in ahd_linux_set_dt()
2517 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_dt()
2519 unsigned int period = tinfo->goal.period; in ahd_linux_set_dt()
2520 unsigned int width = tinfo->goal.width; in ahd_linux_set_dt()
2538 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_dt()
2539 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_dt()
2544 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_dt()
2551 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_qas()
2552 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_qas()
2556 starget->channel + 'A', in ahd_linux_set_qas()
2557 shost->this_id, starget->id, &tstate); in ahd_linux_set_qas()
2559 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_qas()
2561 unsigned int period = tinfo->goal.period; in ahd_linux_set_qas()
2577 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_qas()
2578 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_qas()
2583 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_qas()
2590 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_iu()
2591 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_iu()
2595 starget->channel + 'A', in ahd_linux_set_iu()
2596 shost->this_id, starget->id, &tstate); in ahd_linux_set_iu()
2598 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_iu()
2600 unsigned int period = tinfo->goal.period; in ahd_linux_set_iu()
2617 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_iu()
2618 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_iu()
2623 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_iu()
2630 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rd_strm()
2631 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rd_strm()
2635 starget->channel + 'A', in ahd_linux_set_rd_strm()
2636 shost->this_id, starget->id, &tstate); in ahd_linux_set_rd_strm()
2638 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rd_strm()
2640 unsigned int period = tinfo->goal.period; in ahd_linux_set_rd_strm()
2653 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rd_strm()
2654 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rd_strm()
2659 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rd_strm()
2666 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_wr_flow()
2667 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_wr_flow()
2671 starget->channel + 'A', in ahd_linux_set_wr_flow()
2672 shost->this_id, starget->id, &tstate); in ahd_linux_set_wr_flow()
2674 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_wr_flow()
2676 unsigned int period = tinfo->goal.period; in ahd_linux_set_wr_flow()
2689 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_wr_flow()
2690 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_wr_flow()
2695 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_wr_flow()
2702 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_rti()
2703 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_rti()
2707 starget->channel + 'A', in ahd_linux_set_rti()
2708 shost->this_id, starget->id, &tstate); in ahd_linux_set_rti()
2710 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_rti()
2712 unsigned int period = tinfo->goal.period; in ahd_linux_set_rti()
2716 if ((ahd->features & AHD_RTI) == 0) { in ahd_linux_set_rti()
2733 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_rti()
2734 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_rti()
2739 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_rti()
2746 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_pcomp_en()
2747 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_pcomp_en()
2751 starget->channel + 'A', in ahd_linux_set_pcomp_en()
2752 shost->this_id, starget->id, &tstate); in ahd_linux_set_pcomp_en()
2754 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_pcomp_en()
2756 unsigned int period = tinfo->goal.period; in ahd_linux_set_pcomp_en()
2769 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { in ahd_linux_set_pcomp_en()
2772 iocell_opts = &aic79xx_iocell_info[ahd->unit]; in ahd_linux_set_pcomp_en()
2773 precomp = iocell_opts->precomp; in ahd_linux_set_pcomp_en()
2783 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_pcomp_en()
2784 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_pcomp_en()
2789 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_pcomp_en()
2796 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in ahd_linux_set_hold_mcs()
2797 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata); in ahd_linux_set_hold_mcs()
2801 starget->channel + 'A', in ahd_linux_set_hold_mcs()
2802 shost->this_id, starget->id, &tstate); in ahd_linux_set_hold_mcs()
2804 unsigned int ppr_options = tinfo->goal.ppr_options in ahd_linux_set_hold_mcs()
2806 unsigned int period = tinfo->goal.period; in ahd_linux_set_hold_mcs()
2813 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, in ahd_linux_set_hold_mcs()
2814 starget->channel + 'A', ROLE_INITIATOR); in ahd_linux_set_hold_mcs()
2819 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, in ahd_linux_set_hold_mcs()
2826 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; in ahd_linux_get_signalling()
2884 return -ENODEV; in ahd_linux_init()