Lines Matching defs:ahc

254 ahc_print_path(struct ahc_softc *ahc, struct scb *scb)
257 ahc->platform_data->host->host_no,
258 scb != NULL ? SCB_GET_CHANNEL(ahc, scb) : 'X',
259 scb != NULL ? SCB_GET_TARGET(ahc, scb) : -1,
365 static void ahc_linux_queue_cmd_complete(struct ahc_softc *ahc,
367 static void ahc_linux_freeze_simq(struct ahc_softc *ahc);
368 static void ahc_linux_release_simq(struct ahc_softc *ahc);
370 static void ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc);
371 static u_int ahc_linux_user_tagdepth(struct ahc_softc *ahc,
400 ahc_inb(struct ahc_softc * ahc, long port)
404 if (ahc->tag == BUS_SPACE_MEMIO) {
405 x = readb(ahc->bsh.maddr + port);
407 x = inb(ahc->bsh.ioport + port);
414 ahc_outb(struct ahc_softc * ahc, long port, uint8_t val)
416 if (ahc->tag == BUS_SPACE_MEMIO) {
417 writeb(val, ahc->bsh.maddr + port);
419 outb(val, ahc->bsh.ioport + port);
425 ahc_outsb(struct ahc_softc * ahc, long port, uint8_t *array, int count)
435 ahc_outb(ahc, port, *array++);
439 ahc_insb(struct ahc_softc * ahc, long port, uint8_t *array, int count)
449 *array++ = ahc_inb(ahc, port);
455 static int ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb,
460 ahc_linux_unmap_scb(struct ahc_softc *ahc, struct scb *scb)
465 ahc_sync_sglist(ahc, scb, BUS_DMASYNC_POSTWRITE);
471 ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb,
485 && (ahc->flags & AHC_39BIT_ADDRESSING) != 0)
501 struct ahc_softc *ahc;
504 ahc = *(struct ahc_softc **)host->hostdata;
508 strcat(bp, ahc->description);
511 ahc_controller_info(ahc, ahc_info);
523 struct ahc_softc *ahc;
528 ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
530 ahc_lock(ahc, &flags);
531 if (ahc->platform_data->qfrozen == 0) {
533 rtn = ahc_linux_run_command(ahc, dev, cmd);
535 ahc_unlock(ahc, &flags);
545 struct ahc_softc *ahc =
553 return &ahc->platform_data->starget[target_offset];
559 struct ahc_softc *ahc =
561 struct seeprom_config *sc = ahc->seep_config;
567 unsigned int our_id = ahc->our_id;
575 our_id = ahc->our_id_b;
577 ahc_lock(ahc, &flags);
588 if (ahc->flags & AHC_NEWEEPROM_FMT) {
600 if ((ahc->features & AHC_ULTRA2) != 0) {
611 ahc_find_period(ahc, scsirate, maxsync);
616 ahc_set_syncrate(ahc, &devinfo, NULL, 0, 0, 0,
618 ahc_set_width(ahc, &devinfo, MSG_EXT_WDTR_BUS_8_BIT,
620 ahc_unlock(ahc, &flags);
636 struct ahc_softc *ahc =
642 printk("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id);
692 struct ahc_softc *ahc;
695 ahc = *((struct ahc_softc **)sdev->host->hostdata);
708 extended = (ahc->flags & AHC_EXTENDED_TRANS_A) != 0;
710 extended = (ahc->flags & AHC_EXTENDED_TRANS_B) != 0;
757 struct ahc_softc *ahc;
761 ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
763 ahc_lock(ahc, &flags);
764 found = ahc_reset_channel(ahc, scmd_channel(cmd) + 'A',
766 ahc_unlock(ahc, &flags);
770 "%d SCBs aborted.\n", ahc_name(ahc), found);
802 #define BUILD_SCSIID(ahc, cmd) \
804 | (((cmd)->device->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \
809 ahc_dma_tag_create(struct ahc_softc *ahc, bus_dma_tag_t parent,
837 ahc_dma_tag_destroy(struct ahc_softc *ahc, bus_dma_tag_t dmat)
843 ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr,
847 *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC);
854 ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat,
857 dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map);
861 ahc_dmamap_load(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map,
878 ahc_dmamap_destroy(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map)
883 ahc_dmamap_unload(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map)
1069 ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *template)
1077 template->name = ahc->description;
1082 *((struct ahc_softc **)host->hostdata) = ahc;
1083 ahc->platform_data->host = host;
1087 host->this_id = ahc->our_id;
1088 host->irq = ahc->platform_data->irq;
1089 host->max_id = (ahc->features & AHC_WIDE) ? 16 : 8;
1091 host->max_channel = (ahc->features & AHC_TWIN) ? 1 : 0;
1093 ahc_lock(ahc, &s);
1094 ahc_set_unit(ahc, ahc_linux_unit++);
1095 ahc_unlock(ahc, &s);
1100 ahc_set_name(ahc, new_name);
1102 host->unique_id = ahc->unit;
1103 ahc_linux_initialize_scsi_bus(ahc);
1104 ahc_intr_enable(ahc, TRUE);
1108 retval = scsi_add_host(host, ahc->dev);
1125 ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc)
1134 ahc_lock(ahc, &s);
1137 ahc->flags &= ~(AHC_RESET_BUS_A|AHC_RESET_BUS_B);
1139 if ((ahc->flags & AHC_RESET_BUS_A) != 0)
1140 ahc_reset_channel(ahc, 'A', /*initiate_reset*/TRUE);
1142 numtarg = (ahc->features & AHC_WIDE) ? 16 : 8;
1144 if ((ahc->features & AHC_TWIN) != 0) {
1146 if ((ahc->flags & AHC_RESET_BUS_B) != 0) {
1147 ahc_reset_channel(ahc, 'B', /*initiate_reset*/TRUE);
1168 our_id = ahc->our_id;
1170 if (i > 7 && (ahc->features & AHC_TWIN) != 0) {
1172 our_id = ahc->our_id_b;
1175 tinfo = ahc_fetch_transinfo(ahc, channel, our_id,
1179 ahc_update_neg_request(ahc, &devinfo, tstate,
1182 ahc_unlock(ahc, &s);
1184 if ((ahc->flags & (AHC_RESET_BUS_A|AHC_RESET_BUS_B)) != 0) {
1185 ahc_linux_freeze_simq(ahc);
1187 ahc_linux_release_simq(ahc);
1192 ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
1195 ahc->platform_data =
1197 if (ahc->platform_data == NULL)
1199 ahc->platform_data->irq = AHC_LINUX_NOIRQ;
1200 ahc_lockinit(ahc);
1201 ahc->seltime = (aic7xxx_seltime & 0x3) << 4;
1202 ahc->seltime_b = (aic7xxx_seltime & 0x3) << 4;
1204 ahc->flags |= AHC_DISABLE_PCI_PERR;
1210 ahc_platform_free(struct ahc_softc *ahc)
1215 if (ahc->platform_data != NULL) {
1218 starget = ahc->platform_data->starget[i];
1220 ahc->platform_data->starget[i] = NULL;
1224 if (ahc->platform_data->irq != AHC_LINUX_NOIRQ)
1225 free_irq(ahc->platform_data->irq, ahc);
1226 if (ahc->tag == BUS_SPACE_PIO
1227 && ahc->bsh.ioport != 0)
1228 release_region(ahc->bsh.ioport, 256);
1229 if (ahc->tag == BUS_SPACE_MEMIO
1230 && ahc->bsh.maddr != NULL) {
1231 iounmap(ahc->bsh.maddr);
1232 release_mem_region(ahc->platform_data->mem_busaddr,
1236 if (ahc->platform_data->host)
1237 scsi_host_put(ahc->platform_data->host);
1239 kfree(ahc->platform_data);
1244 ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
1246 ahc_platform_abort_scbs(ahc, SCB_GET_TARGET(ahc, scb),
1247 SCB_GET_CHANNEL(ahc, scb),
1253 ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1288 usertags = ahc_linux_user_tagdepth(ahc, devinfo);
1333 ahc_platform_abort_scbs(struct ahc_softc *ahc, int target, char channel,
1340 ahc_linux_user_tagdepth(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
1346 if ((ahc->user_discenable & devinfo->target_mask) != 0) {
1347 if (ahc->unit >= ARRAY_SIZE(aic7xxx_tag_info)) {
1361 tag_info = &aic7xxx_tag_info[ahc->unit];
1378 struct ahc_softc *ahc = *((struct ahc_softc **)sdev->host->hostdata);
1382 ? ahc->our_id : ahc->our_id_b,
1386 tags = ahc_linux_user_tagdepth(ahc, &devinfo);
1389 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_TAGGED);
1390 ahc_send_async(ahc, devinfo.channel, devinfo.target,
1392 ahc_print_devinfo(ahc, &devinfo);
1395 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE);
1396 ahc_send_async(ahc, devinfo.channel, devinfo.target,
1402 ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
1417 if (ahc->platform_data->qfrozen != 0)
1427 && (ahc->features & AHC_SCB_BTT) == 0) {
1431 untagged_q = &(ahc->untagged_queues[target_offset]);
1445 scb = ahc_get_scb(ahc);
1460 hscb->scsiid = BUILD_SCSIID(ahc, cmd);
1462 mask = SCB_GET_TARGET_MASK(ahc, scb);
1463 tinfo = ahc_fetch_transinfo(ahc, SCB_GET_CHANNEL(ahc, scb),
1465 SCB_GET_TARGET(ahc, scb), &tstate);
1471 if ((ahc->user_discenable & mask) != 0)
1520 consumed = ahc_linux_map_seg(ahc, scb,
1547 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links);
1559 ahc_queue_scb(ahc, scb);
1569 struct ahc_softc *ahc;
1573 ahc = (struct ahc_softc *) dev_id;
1574 ahc_lock(ahc, &flags);
1575 ours = ahc_intr(ahc);
1576 ahc_unlock(ahc, &flags);
1581 ahc_platform_flushwork(struct ahc_softc *ahc)
1587 ahc_send_async(struct ahc_softc *ahc, char channel,
1601 tinfo = ahc_fetch_transinfo(ahc, channel,
1602 channel == 'A' ? ahc->our_id
1603 : ahc->our_id_b,
1624 starget = ahc->platform_data->starget[target_offset];
1652 scsi_report_device_reset(ahc->platform_data->host,
1657 if (ahc->platform_data->host != NULL) {
1658 scsi_report_bus_reset(ahc->platform_data->host,
1671 ahc_done(struct ahc_softc *ahc, struct scb *scb)
1681 target_offset = SCB_GET_TARGET_OFFSET(ahc, scb);
1682 untagged_q = &(ahc->untagged_queues[target_offset]);
1692 ahc_dump_card_state(ahc);
1703 ahc_linux_unmap_scb(ahc, scb);
1722 ahc_print_path(ahc, scb);
1740 ahc_print_path(ahc, scb);
1745 ahc_print_path(ahc, scb);
1756 ahc_linux_handle_scsi_status(ahc, cmd->device, scb);
1784 if (ahc->platform_data->eh_done)
1785 complete(ahc->platform_data->eh_done);
1788 ahc_free_scb(ahc, scb);
1789 ahc_linux_queue_cmd_complete(ahc, cmd);
1793 ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1800 ahc->our_id,
1835 ahc_get_sense_buf(ahc, scb), sense_size);
1874 ahc_print_path(ahc, scb);
1891 ahc_print_path(ahc, scb);
1901 ahc_platform_set_tags(ahc, sdev, &devinfo,
1912 ahc_platform_set_tags(ahc, sdev, &devinfo,
1921 ahc_linux_queue_cmd_complete(struct ahc_softc *ahc, struct scsi_cmnd *cmd)
1991 ahc_linux_freeze_simq(struct ahc_softc *ahc)
1995 ahc_lock(ahc, &s);
1996 ahc->platform_data->qfrozen++;
1997 if (ahc->platform_data->qfrozen == 1) {
1998 scsi_block_requests(ahc->platform_data->host);
2001 ahc_platform_abort_scbs(ahc, CAM_TARGET_WILDCARD, ALL_CHANNELS,
2005 ahc_unlock(ahc, &s);
2009 ahc_linux_release_simq(struct ahc_softc *ahc)
2015 ahc_lock(ahc, &s);
2016 if (ahc->platform_data->qfrozen > 0)
2017 ahc->platform_data->qfrozen--;
2018 if (ahc->platform_data->qfrozen == 0)
2020 ahc_unlock(ahc, &s);
2028 scsi_unblock_requests(ahc->platform_data->host);
2034 struct ahc_softc *ahc;
2052 ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
2062 ahc_lock(ahc, &flags);
2079 ahc_name(ahc), cmd->device->channel, cmd->device->id,
2086 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id,
2091 ahc_name(ahc), cmd->device->channel, cmd->device->id,
2100 LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) {
2108 LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) {
2109 if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd),
2135 was_paused = ahc_is_paused(ahc);
2136 ahc_pause_and_flushwork(ahc);
2145 ahc_name(ahc), was_paused ? "" : "not ");
2146 ahc_dump_card_state(ahc);
2150 if (ahc_search_qinfifo(ahc, cmd->device->id,
2157 ahc_name(ahc), cmd->device->channel,
2162 } else if (ahc_search_qinfifo(ahc, cmd->device->id,
2171 if (disconnected && (ahc_inb(ahc, SEQ_FLAGS) & NOT_IDENTIFIED) == 0) {
2174 bus_scb = ahc_lookup_scb(ahc, ahc_inb(ahc, SCB_TAG));
2178 && ahc_inb(ahc, SAVED_SCSIID) == pending_scb->hscb->scsiid
2179 && ahc_inb(ahc, SAVED_LUN) == SCB_GET_LUN(pending_scb))
2191 last_phase = ahc_inb(ahc, LASTPHASE);
2192 saved_scbptr = ahc_inb(ahc, SCBPTR);
2193 active_scb_index = ahc_inb(ahc, SCB_TAG);
2194 saved_scsiid = ahc_inb(ahc, SAVED_SCSIID);
2198 && SCSIID_TARGET(ahc, saved_scsiid) == scmd_id(cmd)))) {
2204 pending_scb = ahc_lookup_scb(ahc, active_scb_index);
2206 ahc_outb(ahc, MSG_OUT, HOST_MSG);
2207 ahc_outb(ahc, SCSISIGO, last_phase|ATNO);
2238 ahc_search_disc_list(ahc, cmd->device->id,
2252 if ((ahc->flags & AHC_PAGESCBS) == 0) {
2253 ahc_outb(ahc, SCBPTR, pending_scb->hscb->tag);
2254 ahc_outb(ahc, SCB_CONTROL,
2255 ahc_inb(ahc, SCB_CONTROL)|MK_MESSAGE);
2263 ahc_search_qinfifo(ahc, cmd->device->id,
2268 ahc_qinfifo_requeue_tail(ahc, pending_scb);
2269 ahc_outb(ahc, SCBPTR, saved_scbptr);
2270 ahc_print_path(ahc, pending_scb);
2289 ahc_unpause(ahc);
2293 ahc->platform_data->eh_done = &done;
2294 ahc_unlock(ahc, &flags);
2298 ahc_lock(ahc, &flags);
2299 ahc->platform_data->eh_done = NULL;
2300 ahc_unlock(ahc, &flags);
2307 ahc_unlock(ahc, &flags);
2314 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2320 ahc_lock(ahc, &flags);
2321 ahc_set_width(ahc, &devinfo, width, AHC_TRANS_GOAL, FALSE);
2322 ahc_unlock(ahc, &flags);
2328 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2331 = ahc_fetch_transinfo(ahc,
2362 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,
2364 ahc_lock(ahc, &flags);
2365 ahc_set_syncrate(ahc, &devinfo, syncrate, period, offset,
2367 ahc_unlock(ahc, &flags);
2373 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2376 = ahc_fetch_transinfo(ahc,
2388 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,
2393 ahc_lock(ahc, &flags);
2394 ahc_set_syncrate(ahc, &devinfo, syncrate, period, offset,
2396 ahc_unlock(ahc, &flags);
2402 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2405 = ahc_fetch_transinfo(ahc,
2425 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,
2427 ahc_lock(ahc, &flags);
2428 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset,
2430 ahc_unlock(ahc, &flags);
2441 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2444 = ahc_fetch_transinfo(ahc,
2459 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,
2461 ahc_lock(ahc, &flags);
2462 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset,
2464 ahc_unlock(ahc, &flags);
2470 struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata);
2473 = ahc_fetch_transinfo(ahc,
2488 syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,
2490 ahc_lock(ahc, &flags);
2491 ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset,
2493 ahc_unlock(ahc, &flags);
2499 struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata;
2503 if (!(ahc->features & AHC_ULTRA2)) {
2506 ahc->features & AHC_HVD ?
2512 ahc_lock(ahc, &flags);
2513 ahc_pause(ahc);
2514 mode = ahc_inb(ahc, SBLKCTL);
2515 ahc_unpause(ahc);
2516 ahc_unlock(ahc, &flags);