Lines Matching defs:ahd

224 ahd_print_path(struct ahd_softc *ahd, struct scb *scb)
227 ahd->platform_data->host->host_no,
228 scb != NULL ? SCB_GET_CHANNEL(ahd, scb) : 'X',
229 scb != NULL ? SCB_GET_TARGET(ahd, scb) : -1,
355 static void ahd_linux_queue_cmd_complete(struct ahd_softc *ahd,
358 static void ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd);
359 static u_int ahd_linux_user_tagdepth(struct ahd_softc *ahd,
367 static void ahd_freeze_simq(struct ahd_softc *ahd);
368 static void ahd_release_simq(struct ahd_softc *ahd);
391 uint8_t ahd_inb(struct ahd_softc * ahd, long port);
392 void ahd_outb(struct ahd_softc * ahd, long port, uint8_t val);
393 void ahd_outw_atomic(struct ahd_softc * ahd,
395 void ahd_outsb(struct ahd_softc * ahd, long port,
397 void ahd_insb(struct ahd_softc * ahd, long port,
401 ahd_inb(struct ahd_softc * ahd, long port)
405 if (ahd->tags[0] == BUS_SPACE_MEMIO) {
406 x = readb(ahd->bshs[0].maddr + port);
408 x = inb(ahd->bshs[(port) >> 8].ioport + ((port) & 0xFF));
416 ahd_inw_atomic(struct ahd_softc * ahd, long port)
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));
431 ahd_outb(struct ahd_softc * ahd, long port, uint8_t val)
433 if (ahd->tags[0] == BUS_SPACE_MEMIO) {
434 writeb(val, ahd->bshs[0].maddr + port);
436 outb(val, ahd->bshs[(port) >> 8].ioport + (port & 0xFF));
442 ahd_outw_atomic(struct ahd_softc * ahd, long port, uint16_t val)
444 if (ahd->tags[0] == BUS_SPACE_MEMIO) {
445 writew(val, ahd->bshs[0].maddr + port);
447 outw(val, ahd->bshs[(port) >> 8].ioport + (port & 0xFF));
453 ahd_outsb(struct ahd_softc * ahd, long port, uint8_t *array, int count)
463 ahd_outb(ahd, port, *array++);
467 ahd_insb(struct ahd_softc * ahd, long port, uint8_t *array, int count)
477 *array++ = ahd_inb(ahd, port);
534 ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
539 ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
544 #define BUILD_SCSIID(ahd, cmd) \
545 (((scmd_id(cmd) << TID_SHIFT) & TID) | (ahd)->our_id)
556 struct ahd_softc *ahd;
559 ahd = *(struct ahd_softc **)host->hostdata;
563 strcat(bp, ahd->description);
566 ahd_controller_info(ahd, ahd_info);
577 struct ahd_softc *ahd;
581 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
584 rtn = ahd_linux_run_command(ahd, dev, cmd);
594 struct ahd_softc *ahd =
602 return &ahd->platform_data->starget[target_offset];
608 struct ahd_softc *ahd =
610 struct seeprom_config *sc = ahd->seep_config;
618 ahd_lock(ahd, &flags);
627 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
634 if ((ahd->features & AHD_RTI) == 0)
647 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id,
649 ahd_compile_devinfo(&devinfo, ahd->our_id, starget->id,
652 ahd_set_syncrate(ahd, &devinfo, 0, 0, 0,
654 ahd_set_width(ahd, &devinfo, MSG_EXT_WDTR_BUS_8_BIT,
656 ahd_unlock(ahd, &flags);
672 struct ahd_softc *ahd =
677 printk("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id);
725 struct ahd_softc *ahd;
727 ahd = *((struct ahd_softc **)sdev->host->hostdata);
739 extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0;
767 struct ahd_softc *ahd;
779 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
806 reset_scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX);
812 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
821 reset_scb->hscb->scsiid = BUILD_SCSIID(ahd,cmd);
835 ahd_lock(ahd, &flags);
837 LIST_INSERT_HEAD(&ahd->pending_scbs, reset_scb, pending_links);
838 ahd_queue_scb(ahd, reset_scb);
840 ahd->platform_data->eh_done = &done;
841 ahd_unlock(ahd, &flags);
843 printk("%s: Device reset code sleeping\n", ahd_name(ahd));
845 ahd_lock(ahd, &flags);
846 ahd->platform_data->eh_done = NULL;
847 ahd_unlock(ahd, &flags);
849 ahd_name(ahd), dev->active);
852 printk("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval);
863 struct ahd_softc *ahd;
867 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
871 ahd_name(ahd), cmd);
873 ahd_lock(ahd, &flags);
875 found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A',
877 ahd_unlock(ahd, &flags);
881 "%d SCBs aborted.\n", ahd_name(ahd), found);
912 ahd_dma_tag_create(struct ahd_softc *ahd, bus_dma_tag_t parent,
940 ahd_dma_tag_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat)
946 ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr,
949 *vaddr = dma_alloc_coherent(&ahd->dev_softc->dev, dmat->maxsize, mapp,
957 ahd_dmamem_free(struct ahd_softc *ahd, bus_dma_tag_t dmat,
960 dma_free_coherent(&ahd->dev_softc->dev, dmat->maxsize, vaddr, map);
964 ahd_dmamap_load(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map,
981 ahd_dmamap_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
986 ahd_dmamap_unload(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
1203 ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *template)
1211 template->name = ahd->description;
1216 *((struct ahd_softc **)host->hostdata) = ahd;
1217 ahd->platform_data->host = host;
1221 host->this_id = ahd->our_id;
1222 host->irq = ahd->platform_data->irq;
1223 host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8;
1227 ahd_lock(ahd, &s);
1228 ahd_set_unit(ahd, ahd_linux_unit++);
1229 ahd_unlock(ahd, &s);
1234 ahd_set_name(ahd, new_name);
1236 host->unique_id = ahd->unit;
1237 ahd_linux_initialize_scsi_bus(ahd);
1238 ahd_intr_enable(ahd, TRUE);
1242 retval = scsi_add_host(host, &ahd->dev_softc->dev);
1259 ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd)
1269 ahd->flags &= ~AHD_RESET_BUS_A;
1271 if ((ahd->flags & AHD_RESET_BUS_A) != 0)
1272 ahd_reset_channel(ahd, 'A', /*initiate_reset*/TRUE);
1274 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8;
1276 ahd_lock(ahd, &s);
1287 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
1289 ahd_compile_devinfo(&devinfo, ahd->our_id, target_id,
1291 ahd_update_neg_request(ahd, &devinfo, tstate,
1294 ahd_unlock(ahd, &s);
1296 if ((ahd->flags & AHD_RESET_BUS_A) != 0) {
1297 ahd_freeze_simq(ahd);
1299 ahd_release_simq(ahd);
1304 ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
1306 ahd->platform_data =
1308 if (ahd->platform_data == NULL)
1310 ahd->platform_data->irq = AHD_LINUX_NOIRQ;
1311 ahd_lockinit(ahd);
1312 ahd->seltime = (aic79xx_seltime & 0x3) << 4;
1317 ahd_platform_free(struct ahd_softc *ahd)
1322 if (ahd->platform_data != NULL) {
1325 starget = ahd->platform_data->starget[i];
1327 ahd->platform_data->starget[i] = NULL;
1331 if (ahd->platform_data->irq != AHD_LINUX_NOIRQ)
1332 free_irq(ahd->platform_data->irq, ahd);
1333 if (ahd->tags[0] == BUS_SPACE_PIO
1334 && ahd->bshs[0].ioport != 0)
1335 release_region(ahd->bshs[0].ioport, 256);
1336 if (ahd->tags[1] == BUS_SPACE_PIO
1337 && ahd->bshs[1].ioport != 0)
1338 release_region(ahd->bshs[1].ioport, 256);
1339 if (ahd->tags[0] == BUS_SPACE_MEMIO
1340 && ahd->bshs[0].maddr != NULL) {
1341 iounmap(ahd->bshs[0].maddr);
1342 release_mem_region(ahd->platform_data->mem_busaddr,
1345 if (ahd->platform_data->host)
1346 scsi_host_put(ahd->platform_data->host);
1348 kfree(ahd->platform_data);
1353 ahd_platform_init(struct ahd_softc *ahd)
1358 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
1361 iocell_opts = &aic79xx_iocell_info[ahd->unit];
1363 AHD_SET_PRECOMP(ahd, iocell_opts->precomp);
1365 AHD_SET_SLEWRATE(ahd, iocell_opts->slewrate);
1367 AHD_SET_AMPLITUDE(ahd, iocell_opts->amplitude);
1373 ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
1375 ahd_platform_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb),
1376 SCB_GET_CHANNEL(ahd, scb),
1382 ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1420 usertags = ahd_linux_user_tagdepth(ahd, devinfo);
1466 ahd_platform_abort_scbs(struct ahd_softc *ahd, int target, char channel,
1473 ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
1479 if ((ahd->user_discenable & devinfo->target_mask) != 0) {
1480 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) {
1494 tag_info = &aic79xx_tag_info[ahd->unit];
1511 struct ahd_softc *ahd = *((struct ahd_softc **)sdev->host->hostdata);
1514 ahd->our_id,
1518 tags = ahd_linux_user_tagdepth(ahd, &devinfo);
1521 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_TAGGED);
1522 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1524 ahd_print_devinfo(ahd, &devinfo);
1527 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_NONE);
1528 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1534 ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
1550 ahd_lock(ahd, &flags);
1555 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
1564 if ((scb = ahd_get_scb(ahd, col_idx)) == NULL) {
1565 ahd->flags |= AHD_RESOURCE_SHORTAGE;
1566 ahd_unlock(ahd, &flags);
1580 hscb->scsiid = BUILD_SCSIID(ahd, cmd);
1583 mask = SCB_GET_TARGET_MASK(ahd, scb);
1585 if ((ahd->user_discenable & mask) != 0)
1628 sg = ahd_sg_setup(ahd, scb, sg, addr, len,
1633 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links);
1641 ahd_queue_scb(ahd, scb);
1643 ahd_unlock(ahd, &flags);
1654 struct ahd_softc *ahd;
1658 ahd = (struct ahd_softc *) dev_id;
1659 ahd_lock(ahd, &flags);
1660 ours = ahd_intr(ahd);
1661 ahd_unlock(ahd, &flags);
1666 ahd_send_async(struct ahd_softc *ahd, char channel,
1679 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id,
1697 starget = ahd->platform_data->starget[target];
1735 scsi_report_device_reset(ahd->platform_data->host,
1740 if (ahd->platform_data->host != NULL) {
1741 scsi_report_bus_reset(ahd->platform_data->host,
1754 ahd_done(struct ahd_softc *ahd, struct scb *scb)
1761 ahd_dump_card_state(ahd);
1773 ahd_linux_unmap_scb(ahd, scb);
1792 ahd_print_path(ahd, scb);
1810 ahd_print_path(ahd, scb);
1815 ahd_print_path(ahd, scb);
1826 ahd_linux_handle_scsi_status(ahd, cmd->device, scb);
1854 if (ahd->platform_data->eh_done)
1855 complete(ahd->platform_data->eh_done);
1858 ahd_free_scb(ahd, scb);
1859 ahd_linux_queue_cmd_complete(ahd, cmd);
1863 ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
1870 ahd->our_id,
1923 ahd_get_sense_buf(ahd, scb)
1962 ahd_print_path(ahd, scb);
1981 ahd_print_path(ahd, scb);
1991 ahd_platform_set_tags(ahd, sdev, &devinfo,
2001 ahd_platform_set_tags(ahd, sdev, &devinfo,
2009 ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
2102 ahd_name(ahd), status, cmd->device->channel,
2112 ahd_freeze_simq(struct ahd_softc *ahd)
2114 scsi_block_requests(ahd->platform_data->host);
2118 ahd_release_simq(struct ahd_softc *ahd)
2120 scsi_unblock_requests(ahd->platform_data->host);
2126 struct ahd_softc *ahd;
2144 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
2154 ahd_lock(ahd, &flags);
2177 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
2201 was_paused = ahd_is_paused(ahd);
2202 ahd_pause_and_flushwork(ahd);
2211 ahd_name(ahd), was_paused ? "" : "not ");
2212 ahd_dump_card_state(ahd);
2215 if (ahd_search_qinfifo(ahd, cmd->device->id,
2222 ahd_name(ahd), cmd->device->channel,
2227 saved_modes = ahd_save_modes(ahd);
2228 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
2229 last_phase = ahd_inb(ahd, LASTPHASE);
2230 saved_scbptr = ahd_get_scbptr(ahd);
2232 if (disconnected && (ahd_inb(ahd, SEQ_FLAGS) & NOT_IDENTIFIED) == 0) {
2235 bus_scb = ahd_lookup_scb(ahd, active_scbptr);
2245 ahd_inb(ahd, SAVED_SCSIID);
2253 pending_scb = ahd_lookup_scb(ahd, active_scbptr);
2255 ahd_outb(ahd, MSG_OUT, HOST_MSG);
2256 ahd_outb(ahd, SCSISIGO, last_phase|ATNO);
2266 ahd_set_scbptr(ahd, SCB_GET_TAG(pending_scb));
2279 ahd_outb(ahd, SCB_TASK_MANAGEMENT,
2299 ahd_outb(ahd, SCB_CONTROL,
2300 ahd_inb(ahd, SCB_CONTROL)|MK_MESSAGE);
2308 ahd_search_qinfifo(ahd, cmd->device->id,
2312 ahd_qinfifo_requeue_tail(ahd, pending_scb);
2313 ahd_set_scbptr(ahd, saved_scbptr);
2314 ahd_print_path(ahd, pending_scb);
2323 ahd_restore_modes(ahd, saved_modes);
2326 ahd_unpause(ahd);
2330 ahd->platform_data->eh_done = &done;
2331 ahd_unlock(ahd, &flags);
2333 printk("%s: Recovery code sleeping\n", ahd_name(ahd));
2335 ahd_lock(ahd, &flags);
2336 ahd->platform_data->eh_done = NULL;
2337 ahd_unlock(ahd, &flags);
2339 ahd_name(ahd), dev->active);
2344 ahd_unlock(ahd, &flags);
2348 ahd_name(ahd), retval);
2356 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2362 ahd_lock(ahd, &flags);
2363 ahd_set_width(ahd, &devinfo, width, AHD_TRANS_GOAL, FALSE);
2364 ahd_unlock(ahd, &flags);
2370 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2373 = ahd_fetch_transinfo(ahd,
2384 printk("%s: set period to %d\n", ahd_name(ahd), period);
2411 ahd_find_syncrate(ahd, &period, &ppr_options,
2414 ahd_lock(ahd, &flags);
2415 ahd_set_syncrate(ahd, &devinfo, period, offset,
2417 ahd_unlock(ahd, &flags);
2423 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2426 = ahd_fetch_transinfo(ahd,
2437 printk("%s: set offset to %d\n", ahd_name(ahd), offset);
2445 ahd_find_syncrate(ahd, &period, &ppr_options,
2449 ahd_lock(ahd, &flags);
2450 ahd_set_syncrate(ahd, &devinfo, period, offset, ppr_options,
2452 ahd_unlock(ahd, &flags);
2458 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2461 = ahd_fetch_transinfo(ahd,
2473 printk("%s: %s DT\n", ahd_name(ahd),
2488 ahd_find_syncrate(ahd, &period, &ppr_options,
2491 ahd_lock(ahd, &flags);
2492 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2494 ahd_unlock(ahd, &flags);
2500 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2503 = ahd_fetch_transinfo(ahd,
2515 printk("%s: %s QAS\n", ahd_name(ahd),
2527 ahd_find_syncrate(ahd, &period, &ppr_options,
2530 ahd_lock(ahd, &flags);
2531 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2533 ahd_unlock(ahd, &flags);
2539 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2542 = ahd_fetch_transinfo(ahd,
2554 printk("%s: %s IU\n", ahd_name(ahd),
2567 ahd_find_syncrate(ahd, &period, &ppr_options,
2570 ahd_lock(ahd, &flags);
2571 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2573 ahd_unlock(ahd, &flags);
2579 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2582 = ahd_fetch_transinfo(ahd,
2594 printk("%s: %s Read Streaming\n", ahd_name(ahd),
2603 ahd_find_syncrate(ahd, &period, &ppr_options,
2606 ahd_lock(ahd, &flags);
2607 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2609 ahd_unlock(ahd, &flags);
2615 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2618 = ahd_fetch_transinfo(ahd,
2630 printk("%s: %s Write Flow Control\n", ahd_name(ahd),
2639 ahd_find_syncrate(ahd, &period, &ppr_options,
2642 ahd_lock(ahd, &flags);
2643 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2645 ahd_unlock(ahd, &flags);
2651 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2654 = ahd_fetch_transinfo(ahd,
2664 if ((ahd->features & AHD_RTI) == 0) {
2667 printk("%s: RTI not available\n", ahd_name(ahd));
2674 printk("%s: %s RTI\n", ahd_name(ahd),
2683 ahd_find_syncrate(ahd, &period, &ppr_options,
2686 ahd_lock(ahd, &flags);
2687 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2689 ahd_unlock(ahd, &flags);
2695 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2698 = ahd_fetch_transinfo(ahd,
2710 printk("%s: %s Precompensation\n", ahd_name(ahd),
2717 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
2720 iocell_opts = &aic79xx_iocell_info[ahd->unit];
2726 AHD_SET_PRECOMP(ahd, precomp);
2728 AHD_SET_PRECOMP(ahd, 0);
2733 ahd_find_syncrate(ahd, &period, &ppr_options,
2736 ahd_lock(ahd, &flags);
2737 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2739 ahd_unlock(ahd, &flags);
2745 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2748 = ahd_fetch_transinfo(ahd,
2763 ahd_find_syncrate(ahd, &period, &ppr_options,
2766 ahd_lock(ahd, &flags);
2767 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2769 ahd_unlock(ahd, &flags);
2774 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata;
2778 ahd_lock(ahd, &flags);
2779 ahd_pause(ahd);
2780 mode = ahd_inb(ahd, SBLKCTL);
2781 ahd_unpause(ahd);
2782 ahd_unlock(ahd, &flags);