Lines Matching defs:ahc

57 static void	ahc_get_tran_settings(struct ahc_softc *ahc,
65 static void ahc_setup_data(struct ahc_softc *ahc, struct cam_sim *sim,
67 static void ahc_abort_ccb(struct ahc_softc *ahc, struct cam_sim *sim,
69 static int ahc_create_path(struct ahc_softc *ahc,
75 ahc_create_path(struct ahc_softc *ahc, char channel, u_int target,
81 path_id = cam_sim_path(ahc->platform_data->sim_b);
83 path_id = cam_sim_path(ahc->platform_data->sim);
90 ahc_map_int(struct ahc_softc *ahc)
97 shareable = (ahc->flags & AHC_EDGE_INTERRUPT) ? 0: RF_SHAREABLE;
98 ahc->platform_data->irq =
99 bus_alloc_resource_any(ahc->dev_softc, SYS_RES_IRQ, &zero,
101 if (ahc->platform_data->irq == NULL) {
102 device_printf(ahc->dev_softc,
106 ahc->platform_data->irq_res_type = SYS_RES_IRQ;
109 error = bus_setup_intr(ahc->dev_softc, ahc->platform_data->irq,
111 ahc_platform_intr, ahc, &ahc->platform_data->ih);
114 device_printf(ahc->dev_softc, "bus_setup_intr() failed: %d\n",
120 aic7770_map_registers(struct ahc_softc *ahc, u_int unused_ioport_arg)
126 regs = bus_alloc_resource_any(ahc->dev_softc, SYS_RES_IOPORT, &rid,
129 device_printf(ahc->dev_softc, "Unable to map I/O space?!\n");
132 ahc->platform_data->regs_res_type = SYS_RES_IOPORT;
133 ahc->platform_data->regs_res_id = rid,
134 ahc->platform_data->regs = regs;
135 ahc->tag = rman_get_bustag(regs);
136 ahc->bsh = rman_get_bushandle(regs);
144 ahc_attach(struct ahc_softc *ahc)
167 if (ahc_spawn_recovery_thread(ahc) != 0)
170 ahc_controller_info(ahc, ahc_info);
172 ahc_lock(ahc);
178 if ((ahc->features & AHC_TWIN) != 0
179 && (ahc->flags & AHC_PRIMARY_CHANNEL) != 0) {
197 sim = cam_sim_alloc(ahc_action, ahc_poll, "ahc", ahc,
198 device_get_unit(ahc->dev_softc),
199 &ahc->platform_data->mtx, 1, AHC_MAX_QUEUE, devq);
205 if (xpt_bus_register(sim, ahc->dev_softc, bus_id) != CAM_SUCCESS) {
228 if (ahc->features & AHC_TWIN) {
229 sim2 = cam_sim_alloc(ahc_action, ahc_poll, "ahc",
230 ahc, device_get_unit(ahc->dev_softc),
231 &ahc->platform_data->mtx, 1,
240 if (xpt_bus_register(sim2, ahc->dev_softc, bus_id2) !=
271 if ((ahc->features & AHC_TWIN) != 0
272 && (ahc->flags & AHC_PRIMARY_CHANNEL) != 0) {
273 ahc->platform_data->sim_b = sim;
274 ahc->platform_data->path_b = path;
275 ahc->platform_data->sim = sim2;
276 ahc->platform_data->path = path2;
278 ahc->platform_data->sim = sim;
279 ahc->platform_data->path = path;
280 ahc->platform_data->sim_b = sim2;
281 ahc->platform_data->path_b = path2;
283 ahc_unlock(ahc);
287 ahc->platform_data->eh =
289 ahc, SHUTDOWN_PRI_DEFAULT);
290 ahc_intr_enable(ahc, TRUE);
302 struct ahc_softc *ahc;
304 ahc = (struct ahc_softc *)arg;
305 ahc_lock(ahc);
306 ahc_intr(ahc);
307 ahc_unlock(ahc);
316 ahc_done(struct ahc_softc *ahc, struct scb *scb)
331 target_offset = SCB_GET_TARGET_OFFSET(ahc, scb);
332 untagged_q = &ahc->untagged_queues[target_offset];
335 ahc_run_untagged_queue(ahc, untagged_q);
347 bus_dmamap_sync(ahc->buffer_dmat, scb->dmamap, op);
348 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
361 if (ahc->pending_device != NULL
362 && xpt_path_comp(ahc->pending_device->path, ccb_path) == 0) {
365 ahc->pending_device = NULL;
378 ahc_free_scb(ahc, scb);
390 ahc->scb_data->recovery_scbs--;
396 if (ahc->scb_data->recovery_scbs == 0) {
402 LIST_FOREACH(list_scb, &ahc->pending_scbs,
409 ahc_print_path(ahc, scb);
431 ahc_get_sense_buf(ahc, scb),
437 ahc_free_scb(ahc, scb);
444 struct ahc_softc *ahc;
451 ahc = (struct ahc_softc *)cam_sim_softc(sim);
454 our_id = SIM_SCSI_ID(ahc, sim);
464 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
471 lstate = ahc->black_hole;
483 if ((ahc->flags & AHC_TQINFIFO_BLOCKED) != 0)
484 ahc_run_tqinfifo(ahc, /*paused*/FALSE);
503 if ((ahc->flags & AHC_INITIATORROLE) == 0
514 if ((scb = ahc_get_scb(ahc)) == NULL) {
517 ahc->flags |= AHC_RESOURCE_SHORTAGE;
537 hscb->scsiid = BUILD_SCSIID(ahc, sim, target_id, our_id);
549 if (ahc->pending_device == lstate)
567 ahc_setup_data(ahc, sim, &ccb->csio, scb);
578 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
589 ahc_send_lstate_events(ahc, lstate);
593 ahc_handle_en_lun(ahc, sim, ccb);
598 ahc_abort_ccb(ahc, sim, ccb);
616 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),
619 SIM_CHANNEL(ahc, sim),
621 tinfo = ahc_fetch_transinfo(ahc, devinfo.channel,
639 discenable = &ahc->user_discenable;
640 tagenable = &ahc->user_tagenable;
666 ahc_validate_width(ahc, /*tinfo limit*/NULL,
668 ahc_set_width(ahc, &devinfo, spi->bus_width,
698 if ((ahc->features & AHC_ULTRA2) != 0)
700 else if ((ahc->features & AHC_ULTRA) != 0)
708 syncrate = ahc_find_syncrate(ahc, &spi->sync_period,
711 ahc_validate_offset(ahc, /*tinfo limit*/NULL,
721 ahc_set_syncrate(ahc, &devinfo, syncrate,
734 ahc_get_tran_settings(ahc, SIM_SCSI_ID(ahc, sim),
735 SIM_CHANNEL(ahc, sim), &ccb->cts);
743 extended = SIM_IS_SCSIBUS_B(ahc, sim)
744 ? ahc->flags & AHC_EXTENDED_TRANS_B
745 : ahc->flags & AHC_EXTENDED_TRANS_A;
754 found = ahc_reset_channel(ahc, SIM_CHANNEL(ahc, sim),
757 xpt_print_path(SIM_PATH(ahc, sim));
776 if ((ahc->features & AHC_WIDE) != 0)
778 if ((ahc->features & AHC_TARGETMODE) != 0) {
787 cpi->max_target = (ahc->features & AHC_WIDE) ? 15 : 7;
789 if (SIM_IS_SCSIBUS_B(ahc, sim)) {
790 cpi->initiator_id = ahc->our_id_b;
791 if ((ahc->flags & AHC_RESET_BUS_B) == 0)
794 cpi->initiator_id = ahc->our_id;
795 if ((ahc->flags & AHC_RESET_BUS_A) == 0)
809 if ((ahc->features & AHC_DT) != 0) {
826 ahc_get_tran_settings(struct ahc_softc *ahc, int our_id, char channel,
842 targ_info = ahc_fetch_transinfo(ahc, devinfo.channel,
854 if ((ahc->user_discenable & devinfo.target_mask) != 0)
857 if ((ahc->user_tagenable & devinfo.target_mask) != 0)
894 struct ahc_softc *ahc;
898 ahc = (struct ahc_softc *)cam_sim_softc(sim);
904 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),
907 SIM_CHANNEL(ahc, sim),
914 ahc_set_width(ahc, &devinfo, MSG_EXT_WDTR_BUS_8_BIT,
916 ahc_set_syncrate(ahc, &devinfo, /*syncrate*/NULL,
933 struct ahc_softc *ahc;
940 ahc = scb->ahc_softc;
948 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
949 ahc_free_scb(ahc, scb);
986 bus_dmamap_sync(ahc->buffer_dmat, scb->dmamap, op);
1011 if ((ahc->bugs & AHC_TMODE_WIDEODD_BUG) != 0
1020 bus_dmamap_unload(ahc->buffer_dmat,
1022 ahc_free_scb(ahc, scb);
1026 sg->addr = aic_htole32(ahc->dma_bug_buf);
1051 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
1052 ahc_free_scb(ahc, scb);
1057 tinfo = ahc_fetch_transinfo(ahc, SCSIID_CHANNEL(ahc, scb->hscb->scsiid),
1059 SCSIID_TARGET(ahc, scb->hscb->scsiid),
1062 mask = SCB_GET_TARGET_MASK(ahc, scb);
1083 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links);
1094 && (ahc->flags & AHC_SCB_BTT) == 0) {
1098 target_offset = SCB_GET_TARGET_OFFSET(ahc, scb);
1099 untagged_q = &(ahc->untagged_queues[target_offset]);
1115 ahc->scb_data->scbindex[scb->hscb->tag] = scb;
1116 ahc_pause(ahc);
1117 if ((ahc->flags & AHC_PAGESCBS) == 0)
1118 ahc_outb(ahc, SCBPTR, scb->hscb->tag);
1119 ahc_outb(ahc, TARG_IMMEDIATE_SCB, scb->hscb->tag);
1120 ahc_unpause(ahc);
1122 ahc_queue_scb(ahc, scb);
1129 struct ahc_softc *ahc;
1131 ahc = (struct ahc_softc *)cam_sim_softc(sim);
1132 ahc_intr(ahc);
1136 ahc_setup_data(struct ahc_softc *ahc, struct cam_sim *sim,
1156 ahc_free_scb(ahc, scb);
1183 error = bus_dmamap_load_ccb(ahc->buffer_dmat,
1202 ahc_abort_ccb(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
1217 status = ahc_find_tmode_devs(ahc, sim, abort_ccb, &tstate,
1285 ahc_send_async(struct ahc_softc *ahc, char channel, u_int target,
1294 error = ahc_create_path(ahc, channel, target, lun, &path);
1309 ahc_get_tran_settings(ahc, channel == 'A' ? ahc->our_id
1310 : ahc->our_id_b,
1333 ahc_platform_set_tags(struct ahc_softc *ahc,
1339 ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
1341 ahc->platform_data = malloc(sizeof(struct ahc_platform_data), M_DEVBUF,
1343 if (ahc->platform_data == NULL)
1349 ahc_platform_free(struct ahc_softc *ahc)
1353 pdata = ahc->platform_data;
1356 bus_release_resource(ahc->dev_softc,
1362 bus_release_resource(ahc->dev_softc,
1380 free(ahc->platform_data, M_DEVBUF);
1394 struct ahc_softc *ahc;
1397 ahc = device_get_softc(dev);
1398 ahc_lock(ahc);
1399 TAILQ_REMOVE(&ahc_tailq, ahc, links);
1400 ahc_intr_enable(ahc, FALSE);
1401 bus_teardown_intr(dev, ahc->platform_data->irq, ahc->platform_data->ih);
1402 ahc_unlock(ahc);
1403 ahc_free(ahc);
1444 "ahc",
1449 DECLARE_MODULE(ahc, ahc_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
1450 MODULE_DEPEND(ahc, cam, 1, 1, 1);
1451 MODULE_VERSION(ahc, 1);