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);
703 struct ahd_softc *ahd;
705 ahd = *((struct ahd_softc **)sdev->host->hostdata);
732 struct ahd_softc *ahd;
734 ahd = *((struct ahd_softc **)sdev->host->hostdata);
751 extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0;
783 struct ahd_softc *ahd;
798 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
825 reset_scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX);
831 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
840 reset_scb->hscb->scsiid = BUILD_SCSIID(ahd,cmd);
854 ahd_lock(ahd, &flags);
856 LIST_INSERT_HEAD(&ahd->pending_scbs, reset_scb, pending_links);
857 ahd_queue_scb(ahd, reset_scb);
859 ahd->platform_data->eh_done = &done;
860 ahd_unlock(ahd, &flags);
862 printk("%s: Device reset code sleeping\n", ahd_name(ahd));
864 ahd_lock(ahd, &flags);
865 ahd->platform_data->eh_done = NULL;
866 ahd_unlock(ahd, &flags);
868 ahd_name(ahd), dev->active);
871 printk("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval);
882 struct ahd_softc *ahd;
886 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
890 ahd_name(ahd), cmd);
892 ahd_lock(ahd, &flags);
894 found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A',
896 ahd_unlock(ahd, &flags);
900 "%d SCBs aborted.\n", ahd_name(ahd), found);
932 ahd_dma_tag_create(struct ahd_softc *ahd, bus_dma_tag_t parent,
960 ahd_dma_tag_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat)
966 ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr,
969 *vaddr = pci_alloc_consistent(ahd->dev_softc,
977 ahd_dmamem_free(struct ahd_softc *ahd, bus_dma_tag_t dmat,
980 pci_free_consistent(ahd->dev_softc, dmat->maxsize,
985 ahd_dmamap_load(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map,
1002 ahd_dmamap_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
1007 ahd_dmamap_unload(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
1224 ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *template)
1232 template->name = ahd->description;
1237 *((struct ahd_softc **)host->hostdata) = ahd;
1238 ahd->platform_data->host = host;
1242 host->this_id = ahd->our_id;
1243 host->irq = ahd->platform_data->irq;
1244 host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8;
1248 ahd_lock(ahd, &s);
1249 ahd_set_unit(ahd, ahd_linux_unit++);
1250 ahd_unlock(ahd, &s);
1255 ahd_set_name(ahd, new_name);
1257 host->unique_id = ahd->unit;
1258 ahd_linux_initialize_scsi_bus(ahd);
1259 ahd_intr_enable(ahd, TRUE);
1263 retval = scsi_add_host(host, &ahd->dev_softc->dev);
1280 ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd)
1290 ahd->flags &= ~AHD_RESET_BUS_A;
1292 if ((ahd->flags & AHD_RESET_BUS_A) != 0)
1293 ahd_reset_channel(ahd, 'A', /*initiate_reset*/TRUE);
1295 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8;
1297 ahd_lock(ahd, &s);
1308 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
1310 ahd_compile_devinfo(&devinfo, ahd->our_id, target_id,
1312 ahd_update_neg_request(ahd, &devinfo, tstate,
1315 ahd_unlock(ahd, &s);
1317 if ((ahd->flags & AHD_RESET_BUS_A) != 0) {
1318 ahd_freeze_simq(ahd);
1320 ahd_release_simq(ahd);
1325 ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
1327 ahd->platform_data =
1329 if (ahd->platform_data == NULL)
1331 memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data));
1332 ahd->platform_data->irq = AHD_LINUX_NOIRQ;
1333 ahd_lockinit(ahd);
1334 ahd->seltime = (aic79xx_seltime & 0x3) << 4;
1339 ahd_platform_free(struct ahd_softc *ahd)
1344 if (ahd->platform_data != NULL) {
1347 starget = ahd->platform_data->starget[i];
1349 ahd->platform_data->starget[i] = NULL;
1353 if (ahd->platform_data->irq != AHD_LINUX_NOIRQ)
1354 free_irq(ahd->platform_data->irq, ahd);
1355 if (ahd->tags[0] == BUS_SPACE_PIO
1356 && ahd->bshs[0].ioport != 0)
1357 release_region(ahd->bshs[0].ioport, 256);
1358 if (ahd->tags[1] == BUS_SPACE_PIO
1359 && ahd->bshs[1].ioport != 0)
1360 release_region(ahd->bshs[1].ioport, 256);
1361 if (ahd->tags[0] == BUS_SPACE_MEMIO
1362 && ahd->bshs[0].maddr != NULL) {
1363 iounmap(ahd->bshs[0].maddr);
1364 release_mem_region(ahd->platform_data->mem_busaddr,
1367 if (ahd->platform_data->host)
1368 scsi_host_put(ahd->platform_data->host);
1370 kfree(ahd->platform_data);
1375 ahd_platform_init(struct ahd_softc *ahd)
1380 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
1383 iocell_opts = &aic79xx_iocell_info[ahd->unit];
1385 AHD_SET_PRECOMP(ahd, iocell_opts->precomp);
1387 AHD_SET_SLEWRATE(ahd, iocell_opts->slewrate);
1389 AHD_SET_AMPLITUDE(ahd, iocell_opts->amplitude);
1395 ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
1397 ahd_platform_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb),
1398 SCB_GET_CHANNEL(ahd, scb),
1404 ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1442 usertags = ahd_linux_user_tagdepth(ahd, devinfo);
1491 ahd_platform_abort_scbs(struct ahd_softc *ahd, int target, char channel,
1498 ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
1504 if ((ahd->user_discenable & devinfo->target_mask) != 0) {
1505 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) {
1519 tag_info = &aic79xx_tag_info[ahd->unit];
1536 struct ahd_softc *ahd = *((struct ahd_softc **)sdev->host->hostdata);
1539 ahd->our_id,
1543 tags = ahd_linux_user_tagdepth(ahd, &devinfo);
1546 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_TAGGED);
1547 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1549 ahd_print_devinfo(ahd, &devinfo);
1552 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_NONE);
1553 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1559 ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
1575 ahd_lock(ahd, &flags);
1580 tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
1589 if ((scb = ahd_get_scb(ahd, col_idx)) == NULL) {
1590 ahd->flags |= AHD_RESOURCE_SHORTAGE;
1591 ahd_unlock(ahd, &flags);
1605 hscb->scsiid = BUILD_SCSIID(ahd, cmd);
1608 mask = SCB_GET_TARGET_MASK(ahd, scb);
1610 if ((ahd->user_discenable & mask) != 0)
1662 sg = ahd_sg_setup(ahd, scb, sg, addr, len,
1667 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links);
1675 ahd_queue_scb(ahd, scb);
1677 ahd_unlock(ahd, &flags);
1688 struct ahd_softc *ahd;
1692 ahd = (struct ahd_softc *) dev_id;
1693 ahd_lock(ahd, &flags);
1694 ours = ahd_intr(ahd);
1695 ahd_unlock(ahd, &flags);
1700 ahd_send_async(struct ahd_softc *ahd, char channel,
1713 tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id,
1731 starget = ahd->platform_data->starget[target];
1769 scsi_report_device_reset(ahd->platform_data->host,
1774 if (ahd->platform_data->host != NULL) {
1775 scsi_report_bus_reset(ahd->platform_data->host,
1788 ahd_done(struct ahd_softc *ahd, struct scb *scb)
1795 ahd_dump_card_state(ahd);
1807 ahd_linux_unmap_scb(ahd, scb);
1824 ahd_print_path(ahd, scb);
1842 ahd_print_path(ahd, scb);
1847 ahd_print_path(ahd, scb);
1858 ahd_linux_handle_scsi_status(ahd, cmd->device, scb);
1886 if (ahd->platform_data->eh_done)
1887 complete(ahd->platform_data->eh_done);
1890 ahd_free_scb(ahd, scb);
1891 ahd_linux_queue_cmd_complete(ahd, cmd);
1895 ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
1902 ahd->our_id,
1955 ahd_get_sense_buf(ahd, scb)
1994 ahd_print_path(ahd, scb);
2013 ahd_print_path(ahd, scb);
2023 ahd_platform_set_tags(ahd, sdev, &devinfo,
2033 ahd_platform_set_tags(ahd, sdev, &devinfo,
2041 ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
2139 ahd_name(ahd), status, cmd->device->channel,
2149 ahd_freeze_simq(struct ahd_softc *ahd)
2151 scsi_block_requests(ahd->platform_data->host);
2155 ahd_release_simq(struct ahd_softc *ahd)
2157 scsi_unblock_requests(ahd->platform_data->host);
2163 struct ahd_softc *ahd;
2182 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
2192 ahd_lock(ahd, &flags);
2216 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
2240 was_paused = ahd_is_paused(ahd);
2241 ahd_pause_and_flushwork(ahd);
2250 ahd_name(ahd), was_paused ? "" : "not ");
2251 ahd_dump_card_state(ahd);
2254 if (ahd_search_qinfifo(ahd, cmd->device->id,
2261 ahd_name(ahd), cmd->device->channel,
2267 saved_modes = ahd_save_modes(ahd);
2268 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
2269 last_phase = ahd_inb(ahd, LASTPHASE);
2270 saved_scbptr = ahd_get_scbptr(ahd);
2272 if (disconnected && (ahd_inb(ahd, SEQ_FLAGS) & NOT_IDENTIFIED) == 0) {
2275 bus_scb = ahd_lookup_scb(ahd, active_scbptr);
2285 saved_scsiid = ahd_inb(ahd, SAVED_SCSIID);
2293 pending_scb = ahd_lookup_scb(ahd, active_scbptr);
2295 ahd_outb(ahd, MSG_OUT, HOST_MSG);
2296 ahd_outb(ahd, SCSISIGO, last_phase|ATNO);
2306 ahd_set_scbptr(ahd, SCB_GET_TAG(pending_scb));
2319 ahd_outb(ahd, SCB_TASK_MANAGEMENT,
2339 ahd_outb(ahd, SCB_CONTROL,
2340 ahd_inb(ahd, SCB_CONTROL)|MK_MESSAGE);
2348 ahd_search_qinfifo(ahd, cmd->device->id,
2352 ahd_qinfifo_requeue_tail(ahd, pending_scb);
2353 ahd_set_scbptr(ahd, saved_scbptr);
2354 ahd_print_path(ahd, pending_scb);
2373 ahd_unpause(ahd);
2377 ahd->platform_data->eh_done = &done;
2378 ahd_unlock(ahd, &flags);
2380 printk("%s: Recovery code sleeping\n", ahd_name(ahd));
2382 ahd_lock(ahd, &flags);
2383 ahd->platform_data->eh_done = NULL;
2384 ahd_unlock(ahd, &flags);
2386 ahd_name(ahd), dev->active);
2391 ahd_unlock(ahd, &flags);
2395 ahd_name(ahd), retval);
2403 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2409 ahd_lock(ahd, &flags);
2410 ahd_set_width(ahd, &devinfo, width, AHD_TRANS_GOAL, FALSE);
2411 ahd_unlock(ahd, &flags);
2417 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2420 = ahd_fetch_transinfo(ahd,
2431 printk("%s: set period to %d\n", ahd_name(ahd), period);
2458 ahd_find_syncrate(ahd, &period, &ppr_options,
2461 ahd_lock(ahd, &flags);
2462 ahd_set_syncrate(ahd, &devinfo, period, offset,
2464 ahd_unlock(ahd, &flags);
2470 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2473 = ahd_fetch_transinfo(ahd,
2484 printk("%s: set offset to %d\n", ahd_name(ahd), offset);
2492 ahd_find_syncrate(ahd, &period, &ppr_options,
2496 ahd_lock(ahd, &flags);
2497 ahd_set_syncrate(ahd, &devinfo, period, offset, ppr_options,
2499 ahd_unlock(ahd, &flags);
2505 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2508 = ahd_fetch_transinfo(ahd,
2520 printk("%s: %s DT\n", ahd_name(ahd),
2535 ahd_find_syncrate(ahd, &period, &ppr_options,
2538 ahd_lock(ahd, &flags);
2539 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2541 ahd_unlock(ahd, &flags);
2547 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2550 = ahd_fetch_transinfo(ahd,
2562 printk("%s: %s QAS\n", ahd_name(ahd),
2574 ahd_find_syncrate(ahd, &period, &ppr_options,
2577 ahd_lock(ahd, &flags);
2578 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2580 ahd_unlock(ahd, &flags);
2586 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2589 = ahd_fetch_transinfo(ahd,
2601 printk("%s: %s IU\n", ahd_name(ahd),
2614 ahd_find_syncrate(ahd, &period, &ppr_options,
2617 ahd_lock(ahd, &flags);
2618 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2620 ahd_unlock(ahd, &flags);
2626 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2629 = ahd_fetch_transinfo(ahd,
2641 printk("%s: %s Read Streaming\n", ahd_name(ahd),
2650 ahd_find_syncrate(ahd, &period, &ppr_options,
2653 ahd_lock(ahd, &flags);
2654 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2656 ahd_unlock(ahd, &flags);
2662 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2665 = ahd_fetch_transinfo(ahd,
2677 printk("%s: %s Write Flow Control\n", ahd_name(ahd),
2686 ahd_find_syncrate(ahd, &period, &ppr_options,
2689 ahd_lock(ahd, &flags);
2690 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2692 ahd_unlock(ahd, &flags);
2698 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2701 = ahd_fetch_transinfo(ahd,
2711 if ((ahd->features & AHD_RTI) == 0) {
2714 printk("%s: RTI not available\n", ahd_name(ahd));
2721 printk("%s: %s RTI\n", ahd_name(ahd),
2730 ahd_find_syncrate(ahd, &period, &ppr_options,
2733 ahd_lock(ahd, &flags);
2734 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2736 ahd_unlock(ahd, &flags);
2742 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2745 = ahd_fetch_transinfo(ahd,
2757 printk("%s: %s Precompensation\n", ahd_name(ahd),
2764 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
2767 iocell_opts = &aic79xx_iocell_info[ahd->unit];
2773 AHD_SET_PRECOMP(ahd, precomp);
2775 AHD_SET_PRECOMP(ahd, 0);
2780 ahd_find_syncrate(ahd, &period, &ppr_options,
2783 ahd_lock(ahd, &flags);
2784 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2786 ahd_unlock(ahd, &flags);
2792 struct ahd_softc *ahd = *((struct ahd_softc **)shost->hostdata);
2795 = ahd_fetch_transinfo(ahd,
2810 ahd_find_syncrate(ahd, &period, &ppr_options,
2813 ahd_lock(ahd, &flags);
2814 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2816 ahd_unlock(ahd, &flags);
2821 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata;
2825 ahd_lock(ahd, &flags);
2826 ahd_pause(ahd);
2827 mode = ahd_inb(ahd, SBLKCTL);
2828 ahd_unpause(ahd);
2829 ahd_unlock(ahd, &flags);