Lines Matching defs:ahc

52 static void	ahc_get_tran_settings(struct ahc_softc *ahc,
60 static void ahc_setup_data(struct ahc_softc *ahc, struct cam_sim *sim,
62 static void ahc_abort_ccb(struct ahc_softc *ahc, struct cam_sim *sim,
64 static int ahc_create_path(struct ahc_softc *ahc,
69 ahc_create_path(struct ahc_softc *ahc, char channel, u_int target,
75 path_id = cam_sim_path(ahc->platform_data->sim_b);
77 path_id = cam_sim_path(ahc->platform_data->sim);
84 ahc_map_int(struct ahc_softc *ahc)
91 shareable = (ahc->flags & AHC_EDGE_INTERRUPT) ? 0: RF_SHAREABLE;
92 ahc->platform_data->irq =
93 bus_alloc_resource_any(ahc->dev_softc, SYS_RES_IRQ, &zero,
95 if (ahc->platform_data->irq == NULL) {
96 device_printf(ahc->dev_softc,
100 ahc->platform_data->irq_res_type = SYS_RES_IRQ;
103 error = bus_setup_intr(ahc->dev_softc, ahc->platform_data->irq,
105 ahc_platform_intr, ahc, &ahc->platform_data->ih);
108 device_printf(ahc->dev_softc, "bus_setup_intr() failed: %d\n",
114 aic7770_map_registers(struct ahc_softc *ahc, u_int unused_ioport_arg)
120 regs = bus_alloc_resource_any(ahc->dev_softc, SYS_RES_IOPORT, &rid,
123 device_printf(ahc->dev_softc, "Unable to map I/O space?!\n");
126 ahc->platform_data->regs_res_type = SYS_RES_IOPORT;
127 ahc->platform_data->regs_res_id = rid;
128 ahc->platform_data->regs = regs;
129 ahc->tag = rman_get_bustag(regs);
130 ahc->bsh = rman_get_bushandle(regs);
138 ahc_attach(struct ahc_softc *ahc)
160 if (ahc_spawn_recovery_thread(ahc) != 0)
163 ahc_controller_info(ahc, ahc_info);
165 ahc_lock(ahc);
171 if ((ahc->features & AHC_TWIN) != 0
172 && (ahc->flags & AHC_PRIMARY_CHANNEL) != 0) {
190 sim = cam_sim_alloc(ahc_action, ahc_poll, "ahc", ahc,
191 device_get_unit(ahc->dev_softc),
192 &ahc->platform_data->mtx, 1, AHC_MAX_QUEUE, devq);
198 if (xpt_bus_register(sim, ahc->dev_softc, bus_id) != CAM_SUCCESS) {
222 if (ahc->features & AHC_TWIN) {
223 sim2 = cam_sim_alloc(ahc_action, ahc_poll, "ahc",
224 ahc, device_get_unit(ahc->dev_softc),
225 &ahc->platform_data->mtx, 1,
234 if (xpt_bus_register(sim2, ahc->dev_softc, bus_id2) !=
265 if ((ahc->features & AHC_TWIN) != 0
266 && (ahc->flags & AHC_PRIMARY_CHANNEL) != 0) {
267 ahc->platform_data->sim_b = sim;
268 ahc->platform_data->path_b = path;
269 ahc->platform_data->sim = sim2;
270 ahc->platform_data->path = path2;
272 ahc->platform_data->sim = sim;
273 ahc->platform_data->path = path;
274 ahc->platform_data->sim_b = sim2;
275 ahc->platform_data->path_b = path2;
277 ahc_unlock(ahc);
281 ahc->platform_data->eh =
283 ahc, SHUTDOWN_PRI_DEFAULT);
284 ahc_intr_enable(ahc, TRUE);
296 struct ahc_softc *ahc;
298 ahc = (struct ahc_softc *)arg;
299 ahc_lock(ahc);
300 ahc_intr(ahc);
301 ahc_unlock(ahc);
305 ahc_sync_ccb(struct ahc_softc *ahc, struct scb *scb, union ccb *ccb, bool post)
320 bus_dmamap_sync(ahc->buffer_dmat, scb->dmamap, op);
329 ahc_done(struct ahc_softc *ahc, struct scb *scb)
344 target_offset = SCB_GET_TARGET_OFFSET(ahc, scb);
345 untagged_q = &ahc->untagged_queues[target_offset];
348 ahc_run_untagged_queue(ahc, untagged_q);
354 ahc_sync_ccb(ahc, scb, ccb, true);
355 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
368 if (ahc->pending_device != NULL
369 && xpt_path_comp(ahc->pending_device->path, ccb_path) == 0) {
371 ahc->pending_device = NULL;
384 ahc_free_scb(ahc, scb);
396 ahc->scb_data->recovery_scbs--;
402 if (ahc->scb_data->recovery_scbs == 0) {
408 LIST_FOREACH(list_scb, &ahc->pending_scbs,
414 ahc_print_path(ahc, scb);
436 ahc_get_sense_buf(ahc, scb),
442 ahc_free_scb(ahc, scb);
449 struct ahc_softc *ahc;
456 ahc = (struct ahc_softc *)cam_sim_softc(sim);
459 our_id = SIM_SCSI_ID(ahc, sim);
469 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
476 lstate = ahc->black_hole;
487 if ((ahc->flags & AHC_TQINFIFO_BLOCKED) != 0)
488 ahc_run_tqinfifo(ahc, /*paused*/FALSE);
507 if ((ahc->flags & AHC_INITIATORROLE) == 0
518 if ((scb = ahc_get_scb(ahc)) == NULL) {
520 ahc->flags |= AHC_RESOURCE_SHORTAGE;
540 hscb->scsiid = BUILD_SCSIID(ahc, sim, target_id, our_id);
552 if (ahc->pending_device == lstate)
570 ahc_setup_data(ahc, sim, &ccb->csio, scb);
581 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
592 ahc_send_lstate_events(ahc, lstate);
596 ahc_handle_en_lun(ahc, sim, ccb);
601 ahc_abort_ccb(ahc, sim, ccb);
619 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),
622 SIM_CHANNEL(ahc, sim),
624 tinfo = ahc_fetch_transinfo(ahc, devinfo.channel,
642 discenable = &ahc->user_discenable;
643 tagenable = &ahc->user_tagenable;
669 ahc_validate_width(ahc, /*tinfo limit*/NULL,
671 ahc_set_width(ahc, &devinfo, spi->bus_width,
701 if ((ahc->features & AHC_ULTRA2) != 0)
703 else if ((ahc->features & AHC_ULTRA) != 0)
711 syncrate = ahc_find_syncrate(ahc, &spi->sync_period,
714 ahc_validate_offset(ahc, /*tinfo limit*/NULL,
724 ahc_set_syncrate(ahc, &devinfo, syncrate,
736 ahc_get_tran_settings(ahc, SIM_SCSI_ID(ahc, sim),
737 SIM_CHANNEL(ahc, sim), &ccb->cts);
745 extended = SIM_IS_SCSIBUS_B(ahc, sim)
746 ? ahc->flags & AHC_EXTENDED_TRANS_B
747 : ahc->flags & AHC_EXTENDED_TRANS_A;
756 found = ahc_reset_channel(ahc, SIM_CHANNEL(ahc, sim),
759 xpt_print_path(SIM_PATH(ahc, sim));
778 if ((ahc->features & AHC_WIDE) != 0)
780 if ((ahc->features & AHC_TARGETMODE) != 0) {
789 cpi->max_target = (ahc->features & AHC_WIDE) ? 15 : 7;
791 if (SIM_IS_SCSIBUS_B(ahc, sim)) {
792 cpi->initiator_id = ahc->our_id_b;
793 if ((ahc->flags & AHC_RESET_BUS_B) == 0)
796 cpi->initiator_id = ahc->our_id;
797 if ((ahc->flags & AHC_RESET_BUS_A) == 0)
811 if ((ahc->features & AHC_DT) != 0) {
828 ahc_get_tran_settings(struct ahc_softc *ahc, int our_id, char channel,
844 targ_info = ahc_fetch_transinfo(ahc, devinfo.channel,
856 if ((ahc->user_discenable & devinfo.target_mask) != 0)
859 if ((ahc->user_tagenable & devinfo.target_mask) != 0)
896 struct ahc_softc *ahc;
900 ahc = (struct ahc_softc *)cam_sim_softc(sim);
906 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),
909 SIM_CHANNEL(ahc, sim),
916 ahc_set_width(ahc, &devinfo, MSG_EXT_WDTR_BUS_8_BIT,
918 ahc_set_syncrate(ahc, &devinfo, /*syncrate*/NULL,
935 struct ahc_softc *ahc;
942 ahc = scb->ahc_softc;
950 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
951 ahc_free_scb(ahc, scb);
982 ahc_sync_ccb(ahc, scb, ccb, false);
1007 if ((ahc->bugs & AHC_TMODE_WIDEODD_BUG) != 0
1014 bus_dmamap_unload(ahc->buffer_dmat,
1016 ahc_free_scb(ahc, scb);
1020 sg->addr = aic_htole32(ahc->dma_bug_buf);
1045 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
1046 ahc_free_scb(ahc, scb);
1051 tinfo = ahc_fetch_transinfo(ahc, SCSIID_CHANNEL(ahc, scb->hscb->scsiid),
1053 SCSIID_TARGET(ahc, scb->hscb->scsiid),
1056 mask = SCB_GET_TARGET_MASK(ahc, scb);
1077 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links);
1088 && (ahc->flags & AHC_SCB_BTT) == 0) {
1092 target_offset = SCB_GET_TARGET_OFFSET(ahc, scb);
1093 untagged_q = &(ahc->untagged_queues[target_offset]);
1109 ahc->scb_data->scbindex[scb->hscb->tag] = scb;
1110 ahc_pause(ahc);
1111 if ((ahc->flags & AHC_PAGESCBS) == 0)
1112 ahc_outb(ahc, SCBPTR, scb->hscb->tag);
1113 ahc_outb(ahc, TARG_IMMEDIATE_SCB, scb->hscb->tag);
1114 ahc_unpause(ahc);
1116 ahc_queue_scb(ahc, scb);
1123 struct ahc_softc *ahc;
1125 ahc = (struct ahc_softc *)cam_sim_softc(sim);
1126 ahc_intr(ahc);
1130 ahc_setup_data(struct ahc_softc *ahc, struct cam_sim *sim,
1149 ahc_free_scb(ahc, scb);
1176 error = bus_dmamap_load_ccb(ahc->buffer_dmat,
1195 ahc_abort_ccb(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
1210 status = ahc_find_tmode_devs(ahc, sim, abort_ccb, &tstate,
1278 ahc_send_async(struct ahc_softc *ahc, char channel, u_int target,
1287 error = ahc_create_path(ahc, channel, target, lun, &path);
1302 ahc_get_tran_settings(ahc, channel == 'A' ? ahc->our_id
1303 : ahc->our_id_b,
1326 ahc_platform_set_tags(struct ahc_softc *ahc,
1332 ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
1334 ahc->platform_data = malloc(sizeof(struct ahc_platform_data), M_DEVBUF,
1336 if (ahc->platform_data == NULL)
1342 ahc_platform_free(struct ahc_softc *ahc)
1346 pdata = ahc->platform_data;
1349 bus_release_resource(ahc->dev_softc,
1355 bus_release_resource(ahc->dev_softc,
1373 free(ahc->platform_data, M_DEVBUF);
1387 struct ahc_softc *ahc;
1390 ahc = device_get_softc(dev);
1391 ahc_lock(ahc);
1392 TAILQ_REMOVE(&ahc_tailq, ahc, links);
1393 ahc_intr_enable(ahc, FALSE);
1394 bus_teardown_intr(dev, ahc->platform_data->irq, ahc->platform_data->ih);
1395 ahc_unlock(ahc);
1396 ahc_free(ahc);
1437 "ahc",
1442 DECLARE_MODULE(ahc, ahc_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
1443 MODULE_DEPEND(ahc, cam, 1, 1, 1);
1444 MODULE_VERSION(ahc, 1);