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);
578 struct ahd_softc *ahd;
582 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
586 rtn = ahd_linux_run_command(ahd, dev, cmd);
596 struct ahd_softc *ahd =
604 return &ahd->platform_data->starget[target_offset];
610 struct ahd_softc *ahd =
612 struct seeprom_config *sc = ahd->seep_config;
620 ahd_lock(ahd, &flags);
629 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
636 if ((ahd->features & AHD_RTI) == 0)
649 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id,
651 ahd_compile_devinfo(&devinfo, ahd->our_id, starget->id,
654 ahd_set_syncrate(ahd, &devinfo, 0, 0, 0,
656 ahd_set_width(ahd, &devinfo, MSG_EXT_WDTR_BUS_8_BIT,
658 ahd_unlock(ahd, &flags);
674 struct ahd_softc *ahd =
679 printk("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id);
727 struct ahd_softc *ahd;
729 ahd = *((struct ahd_softc **)sdev->host->hostdata);
741 extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0;
773 struct ahd_softc *ahd;
785 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
812 reset_scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX);
818 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
827 reset_scb->hscb->scsiid = BUILD_SCSIID(ahd,cmd);
841 ahd_lock(ahd, &flags);
843 LIST_INSERT_HEAD(&ahd->pending_scbs, reset_scb, pending_links);
844 ahd_queue_scb(ahd, reset_scb);
846 ahd->platform_data->eh_done = &done;
847 ahd_unlock(ahd, &flags);
849 printk("%s: Device reset code sleeping\n", ahd_name(ahd));
851 ahd_lock(ahd, &flags);
852 ahd->platform_data->eh_done = NULL;
853 ahd_unlock(ahd, &flags);
855 ahd_name(ahd), dev->active);
858 printk("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval);
869 struct ahd_softc *ahd;
873 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
877 ahd_name(ahd), cmd);
879 ahd_lock(ahd, &flags);
881 found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A',
883 ahd_unlock(ahd, &flags);
887 "%d SCBs aborted.\n", ahd_name(ahd), found);
918 ahd_dma_tag_create(struct ahd_softc *ahd, bus_dma_tag_t parent,
946 ahd_dma_tag_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat)
952 ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr,
955 *vaddr = dma_alloc_coherent(&ahd->dev_softc->dev, dmat->maxsize, mapp,
963 ahd_dmamem_free(struct ahd_softc *ahd, bus_dma_tag_t dmat,
966 dma_free_coherent(&ahd->dev_softc->dev, dmat->maxsize, vaddr, map);
970 ahd_dmamap_load(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map,
987 ahd_dmamap_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
992 ahd_dmamap_unload(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
1209 ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *template)
1217 template->name = ahd->description;
1222 *((struct ahd_softc **)host->hostdata) = ahd;
1223 ahd->platform_data->host = host;
1227 host->this_id = ahd->our_id;
1228 host->irq = ahd->platform_data->irq;
1229 host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8;
1233 ahd_lock(ahd, &s);
1234 ahd_set_unit(ahd, ahd_linux_unit++);
1235 ahd_unlock(ahd, &s);
1240 ahd_set_name(ahd, new_name);
1242 host->unique_id = ahd->unit;
1243 ahd_linux_initialize_scsi_bus(ahd);
1244 ahd_intr_enable(ahd, TRUE);
1248 retval = scsi_add_host(host, &ahd->dev_softc->dev);
1265 ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd)
1275 ahd->flags &= ~AHD_RESET_BUS_A;
1277 if ((ahd->flags & AHD_RESET_BUS_A) != 0)
1278 ahd_reset_channel(ahd, 'A', /*initiate_reset*/TRUE);
1280 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8;
1282 ahd_lock(ahd, &s);
1293 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
1295 ahd_compile_devinfo(&devinfo, ahd->our_id, target_id,
1297 ahd_update_neg_request(ahd, &devinfo, tstate,
1300 ahd_unlock(ahd, &s);
1302 if ((ahd->flags & AHD_RESET_BUS_A) != 0) {
1303 ahd_freeze_simq(ahd);
1305 ahd_release_simq(ahd);
1310 ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
1312 ahd->platform_data =
1314 if (ahd->platform_data == NULL)
1316 ahd->platform_data->irq = AHD_LINUX_NOIRQ;
1317 ahd_lockinit(ahd);
1318 ahd->seltime = (aic79xx_seltime & 0x3) << 4;
1323 ahd_platform_free(struct ahd_softc *ahd)
1328 if (ahd->platform_data != NULL) {
1331 starget = ahd->platform_data->starget[i];
1333 ahd->platform_data->starget[i] = NULL;
1337 if (ahd->platform_data->irq != AHD_LINUX_NOIRQ)
1338 free_irq(ahd->platform_data->irq, ahd);
1339 if (ahd->tags[0] == BUS_SPACE_PIO
1340 && ahd->bshs[0].ioport != 0)
1341 release_region(ahd->bshs[0].ioport, 256);
1342 if (ahd->tags[1] == BUS_SPACE_PIO
1343 && ahd->bshs[1].ioport != 0)
1344 release_region(ahd->bshs[1].ioport, 256);
1345 if (ahd->tags[0] == BUS_SPACE_MEMIO
1346 && ahd->bshs[0].maddr != NULL) {
1347 iounmap(ahd->bshs[0].maddr);
1348 release_mem_region(ahd->platform_data->mem_busaddr,
1351 if (ahd->platform_data->host)
1352 scsi_host_put(ahd->platform_data->host);
1354 kfree(ahd->platform_data);
1359 ahd_platform_init(struct ahd_softc *ahd)
1364 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
1367 iocell_opts = &aic79xx_iocell_info[ahd->unit];
1369 AHD_SET_PRECOMP(ahd, iocell_opts->precomp);
1371 AHD_SET_SLEWRATE(ahd, iocell_opts->slewrate);
1373 AHD_SET_AMPLITUDE(ahd, iocell_opts->amplitude);
1379 ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
1381 ahd_platform_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb),
1382 SCB_GET_CHANNEL(ahd, scb),
1388 ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1426 usertags = ahd_linux_user_tagdepth(ahd, devinfo);
1472 ahd_platform_abort_scbs(struct ahd_softc *ahd, int target, char channel,
1479 ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
1485 if ((ahd->user_discenable & devinfo->target_mask) != 0) {
1486 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) {
1500 tag_info = &aic79xx_tag_info[ahd->unit];
1517 struct ahd_softc *ahd = *((struct ahd_softc **)sdev->host->hostdata);
1520 ahd->our_id,
1524 tags = ahd_linux_user_tagdepth(ahd, &devinfo);
1527 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_TAGGED);
1528 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1530 ahd_print_devinfo(ahd, &devinfo);
1533 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_NONE);
1534 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1540 ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
1556 ahd_lock(ahd, &flags);
1561 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
1570 if ((scb = ahd_get_scb(ahd, col_idx)) == NULL) {
1571 ahd->flags |= AHD_RESOURCE_SHORTAGE;
1572 ahd_unlock(ahd, &flags);
1586 hscb->scsiid = BUILD_SCSIID(ahd, cmd);
1589 mask = SCB_GET_TARGET_MASK(ahd, scb);
1591 if ((ahd->user_discenable & mask) != 0)
1634 sg = ahd_sg_setup(ahd, scb, sg, addr, len,
1639 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links);
1647 ahd_queue_scb(ahd, scb);
1649 ahd_unlock(ahd, &flags);
1660 struct ahd_softc *ahd;
1664 ahd = (struct ahd_softc *) dev_id;
1665 ahd_lock(ahd, &flags);
1666 ours = ahd_intr(ahd);
1667 ahd_unlock(ahd, &flags);
1672 ahd_send_async(struct ahd_softc *ahd, char channel,
1685 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id,
1703 starget = ahd->platform_data->starget[target];
1741 scsi_report_device_reset(ahd->platform_data->host,
1746 if (ahd->platform_data->host != NULL) {
1747 scsi_report_bus_reset(ahd->platform_data->host,
1760 ahd_done(struct ahd_softc *ahd, struct scb *scb)
1767 ahd_dump_card_state(ahd);
1779 ahd_linux_unmap_scb(ahd, scb);
1798 ahd_print_path(ahd, scb);
1816 ahd_print_path(ahd, scb);
1821 ahd_print_path(ahd, scb);
1832 ahd_linux_handle_scsi_status(ahd, cmd->device, scb);
1860 if (ahd->platform_data->eh_done)
1861 complete(ahd->platform_data->eh_done);
1864 ahd_free_scb(ahd, scb);
1865 ahd_linux_queue_cmd_complete(ahd, cmd);
1869 ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
1876 ahd->our_id,
1929 ahd_get_sense_buf(ahd, scb)
1968 ahd_print_path(ahd, scb);
1987 ahd_print_path(ahd, scb);
1997 ahd_platform_set_tags(ahd, sdev, &devinfo,
2007 ahd_platform_set_tags(ahd, sdev, &devinfo,
2015 ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
2113 ahd_name(ahd), status, cmd->device->channel,
2123 ahd_freeze_simq(struct ahd_softc *ahd)
2125 scsi_block_requests(ahd->platform_data->host);
2129 ahd_release_simq(struct ahd_softc *ahd)
2131 scsi_unblock_requests(ahd->platform_data->host);
2137 struct ahd_softc *ahd;
2156 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
2166 ahd_lock(ahd, &flags);
2189 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
2213 was_paused = ahd_is_paused(ahd);
2214 ahd_pause_and_flushwork(ahd);
2223 ahd_name(ahd), was_paused ? "" : "not ");
2224 ahd_dump_card_state(ahd);
2227 if (ahd_search_qinfifo(ahd, cmd->device->id,
2234 ahd_name(ahd), cmd->device->channel,
2239 saved_modes = ahd_save_modes(ahd);
2240 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
2241 last_phase = ahd_inb(ahd, LASTPHASE);
2242 saved_scbptr = ahd_get_scbptr(ahd);
2244 if (disconnected && (ahd_inb(ahd, SEQ_FLAGS) & NOT_IDENTIFIED) == 0) {
2247 bus_scb = ahd_lookup_scb(ahd, active_scbptr);
2257 saved_scsiid = ahd_inb(ahd, SAVED_SCSIID);
2265 pending_scb = ahd_lookup_scb(ahd, active_scbptr);
2267 ahd_outb(ahd, MSG_OUT, HOST_MSG);
2268 ahd_outb(ahd, SCSISIGO, last_phase|ATNO);
2278 ahd_set_scbptr(ahd, SCB_GET_TAG(pending_scb));
2291 ahd_outb(ahd, SCB_TASK_MANAGEMENT,
2311 ahd_outb(ahd, SCB_CONTROL,
2312 ahd_inb(ahd, SCB_CONTROL)|MK_MESSAGE);
2320 ahd_search_qinfifo(ahd, cmd->device->id,
2324 ahd_qinfifo_requeue_tail(ahd, pending_scb);
2325 ahd_set_scbptr(ahd, saved_scbptr);
2326 ahd_print_path(ahd, pending_scb);
2335 ahd_restore_modes(ahd, saved_modes);
2338 ahd_unpause(ahd);
2342 ahd->platform_data->eh_done = &done;
2343 ahd_unlock(ahd, &flags);
2345 printk("%s: Recovery code sleeping\n", ahd_name(ahd));
2347 ahd_lock(ahd, &flags);
2348 ahd->platform_data->eh_done = NULL;
2349 ahd_unlock(ahd, &flags);
2351 ahd_name(ahd), dev->active);
2356 ahd_unlock(ahd, &flags);
2360 ahd_name(ahd), retval);
2368 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2374 ahd_lock(ahd, &flags);
2375 ahd_set_width(ahd, &devinfo, width, AHD_TRANS_GOAL, FALSE);
2376 ahd_unlock(ahd, &flags);
2382 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2385 = ahd_fetch_transinfo(ahd,
2396 printk("%s: set period to %d\n", ahd_name(ahd), period);
2423 ahd_find_syncrate(ahd, &period, &ppr_options,
2426 ahd_lock(ahd, &flags);
2427 ahd_set_syncrate(ahd, &devinfo, period, offset,
2429 ahd_unlock(ahd, &flags);
2435 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2438 = ahd_fetch_transinfo(ahd,
2449 printk("%s: set offset to %d\n", ahd_name(ahd), offset);
2457 ahd_find_syncrate(ahd, &period, &ppr_options,
2461 ahd_lock(ahd, &flags);
2462 ahd_set_syncrate(ahd, &devinfo, period, offset, ppr_options,
2464 ahd_unlock(ahd, &flags);
2470 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2473 = ahd_fetch_transinfo(ahd,
2485 printk("%s: %s DT\n", ahd_name(ahd),
2500 ahd_find_syncrate(ahd, &period, &ppr_options,
2503 ahd_lock(ahd, &flags);
2504 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2506 ahd_unlock(ahd, &flags);
2512 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2515 = ahd_fetch_transinfo(ahd,
2527 printk("%s: %s QAS\n", ahd_name(ahd),
2539 ahd_find_syncrate(ahd, &period, &ppr_options,
2542 ahd_lock(ahd, &flags);
2543 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2545 ahd_unlock(ahd, &flags);
2551 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2554 = ahd_fetch_transinfo(ahd,
2566 printk("%s: %s IU\n", ahd_name(ahd),
2579 ahd_find_syncrate(ahd, &period, &ppr_options,
2582 ahd_lock(ahd, &flags);
2583 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2585 ahd_unlock(ahd, &flags);
2591 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2594 = ahd_fetch_transinfo(ahd,
2606 printk("%s: %s Read Streaming\n", ahd_name(ahd),
2615 ahd_find_syncrate(ahd, &period, &ppr_options,
2618 ahd_lock(ahd, &flags);
2619 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2621 ahd_unlock(ahd, &flags);
2627 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2630 = ahd_fetch_transinfo(ahd,
2642 printk("%s: %s Write Flow Control\n", ahd_name(ahd),
2651 ahd_find_syncrate(ahd, &period, &ppr_options,
2654 ahd_lock(ahd, &flags);
2655 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2657 ahd_unlock(ahd, &flags);
2663 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2666 = ahd_fetch_transinfo(ahd,
2676 if ((ahd->features & AHD_RTI) == 0) {
2679 printk("%s: RTI not available\n", ahd_name(ahd));
2686 printk("%s: %s RTI\n", ahd_name(ahd),
2695 ahd_find_syncrate(ahd, &period, &ppr_options,
2698 ahd_lock(ahd, &flags);
2699 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2701 ahd_unlock(ahd, &flags);
2707 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2710 = ahd_fetch_transinfo(ahd,
2722 printk("%s: %s Precompensation\n", ahd_name(ahd),
2729 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
2732 iocell_opts = &aic79xx_iocell_info[ahd->unit];
2738 AHD_SET_PRECOMP(ahd, precomp);
2740 AHD_SET_PRECOMP(ahd, 0);
2745 ahd_find_syncrate(ahd, &period, &ppr_options,
2748 ahd_lock(ahd, &flags);
2749 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2751 ahd_unlock(ahd, &flags);
2757 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2760 = ahd_fetch_transinfo(ahd,
2775 ahd_find_syncrate(ahd, &period, &ppr_options,
2778 ahd_lock(ahd, &flags);
2779 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2781 ahd_unlock(ahd, &flags);
2786 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata;
2790 ahd_lock(ahd, &flags);
2791 ahd_pause(ahd);
2792 mode = ahd_inb(ahd, SBLKCTL);
2793 ahd_unpause(ahd);
2794 ahd_unlock(ahd, &flags);