--- //depot/vendor/freebsd/src/sys/dev/buslogic/bt.c 2011-01-18 15:25:17.000000000 0000 +++ //depot/user/jhb/cleanup/sys/dev/buslogic/bt.c 2012-09-02 00:23:52.000000000 0000 @@ -43,6 +43,7 @@ */ #include +#include #include #include #include @@ -140,6 +141,7 @@ static bus_dmamap_callback_t btexecuteccb; static void btdone(struct bt_softc *bt, struct bt_ccb *bccb, bt_mbi_comp_code_t comp_code); +static void bt_intr_locked(struct bt_softc *bt); /* Host adapter command functions */ static int btreset(struct bt_softc* bt, int hard_reset); @@ -161,10 +163,8 @@ static void btpoll(struct cam_sim *sim); /* Our timeout handler */ -timeout_t bttimeout; +static void bttimeout(void *arg); -u_long bt_unit = 0; - /* * XXX * Do our own re-probe protection until a configuration @@ -206,12 +206,10 @@ LIST_INIT(&bt->pending_ccbs); SLIST_INIT(&bt->sg_maps); bt->dev = dev; - bt->unit = device_get_unit(dev); bt->port = port; bt->irq = irq; bt->drq = drq; - bt->tag = rman_get_bustag(port); - bt->bsh = rman_get_bushandle(port); + mtx_init(&bt->lock, "bt", NULL, MTX_DEF); } void @@ -270,6 +268,7 @@ case 0: break; } + mtx_destroy(&bt->lock); } int @@ -287,9 +286,11 @@ * Determine our IRQ, and DMA settings and * export them to the configuration system. */ + mtx_lock(&bt->lock); error = bt_cmd(bt, BOP_INQUIRE_CONFIG, NULL, /*parmlen*/0, (u_int8_t*)&config_data, sizeof(config_data), DEFAULT_CMD_TIMEOUT); + mtx_unlock(&bt->lock); if (error != 0) { printf("bt_port_probe: Could not determine IRQ or DMA " "settings for adapter.\n"); @@ -381,7 +382,9 @@ * adapter and attempt to fetch the extended setup * information. This should filter out all 1542 cards. */ + mtx_lock(&bt->lock); if ((error = btreset(bt, /*hard_reset*/TRUE)) != 0) { + mtx_unlock(&bt->lock); if (bootverbose) device_printf(dev, "Failed Reset\n"); return (ENXIO); @@ -391,6 +394,7 @@ error = bt_cmd(bt, BOP_INQUIRE_ESETUP_INFO, ¶m, /*parmlen*/1, (u_int8_t*)&esetup_info, sizeof(esetup_info), DEFAULT_CMD_TIMEOUT); + mtx_unlock(&bt->lock); if (error != 0) { return (ENXIO); } @@ -412,10 +416,12 @@ u_int8_t length_param; /* First record the firmware version */ + mtx_lock(&bt->lock); error = bt_cmd(bt, BOP_INQUIRE_BOARD_ID, NULL, /*parmlen*/0, (u_int8_t*)&board_id, sizeof(board_id), DEFAULT_CMD_TIMEOUT); if (error != 0) { + mtx_unlock(&bt->lock); device_printf(dev, "bt_fetch_adapter_info - Failed Get Board Info\n"); return (error); } @@ -434,6 +440,7 @@ (u_int8_t*)&bt->firmware_ver[3], 1, DEFAULT_CMD_TIMEOUT); if (error != 0) { + mtx_unlock(&bt->lock); device_printf(dev, "bt_fetch_adapter_info - Failed Get " "Firmware 3rd Digit\n"); @@ -450,6 +457,7 @@ (u_int8_t*)&bt->firmware_ver[4], 1, DEFAULT_CMD_TIMEOUT); if (error != 0) { + mtx_unlock(&bt->lock); device_printf(dev, "bt_fetch_adapter_info - Failed Get " "Firmware 4th Digit\n"); @@ -483,6 +491,7 @@ (u_int8_t*)&esetup_info, sizeof(esetup_info), DEFAULT_CMD_TIMEOUT); if (error != 0) { + mtx_unlock(&bt->lock); return (error); } @@ -514,6 +523,7 @@ (u_int8_t*)&model_data, sizeof(model_data), DEFAULT_CMD_TIMEOUT); if (error != 0) { + mtx_unlock(&bt->lock); device_printf(dev, "bt_fetch_adapter_info - Failed Inquire " "Model Number\n"); @@ -600,6 +610,7 @@ sizeof(auto_scsi_data), DEFAULT_CMD_TIMEOUT); if (error != 0) { + mtx_unlock(&bt->lock); device_printf(dev, "bt_fetch_adapter_info - Failed " "Get Auto SCSI Info\n"); @@ -635,6 +646,7 @@ sizeof(setup_info), DEFAULT_CMD_TIMEOUT); if (error != 0) { + mtx_unlock(&bt->lock); device_printf(dev, "bt_fetch_adapter_info - Failed " "Get Setup Info\n"); @@ -662,6 +674,7 @@ error = bt_cmd(bt, BOP_INQUIRE_CONFIG, NULL, /*parmlen*/0, (u_int8_t*)&config_data, sizeof(config_data), DEFAULT_CMD_TIMEOUT); + mtx_unlock(&bt->lock); if (error != 0) { device_printf(dev, "bt_fetch_adapter_info - Failed Get Config\n"); @@ -720,7 +733,7 @@ /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ BUS_DMA_ALLOCNOW, /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockarg */ &bt->lock, &bt->buffer_dmat) != 0) { goto error_exit; } @@ -740,8 +753,8 @@ /* nsegments */ 1, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->mailbox_dmat) != 0) { goto error_exit; } @@ -767,7 +780,9 @@ bt->in_boxes = (bt_mbox_in_t *)&bt->out_boxes[bt->num_boxes]; + mtx_lock(&bt->lock); btinitmboxes(bt); + mtx_unlock(&bt->lock); /* DMA tag for our ccb structures */ if (bus_dma_tag_create( /* parent */ bt->parent_dmat, @@ -782,8 +797,8 @@ /* nsegments */ 1, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->ccb_dmat) != 0) { goto error_exit; } @@ -818,8 +833,8 @@ /* nsegments */ 1, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->sg_dmat) != 0) { goto error_exit; } @@ -837,7 +852,7 @@ } /* - * Note that we are going and return (to probe) + * Note that we are going and return (to attach) */ return 0; @@ -873,15 +888,17 @@ /* * Construct our SIM entry */ - bt->sim = cam_sim_alloc(btaction, btpoll, "bt", bt, bt->unit, - &Giant, 2, tagged_dev_openings, devq); + bt->sim = cam_sim_alloc(btaction, btpoll, "bt", bt, + device_get_unit(bt->dev), &bt->lock, 2, tagged_dev_openings, devq); if (bt->sim == NULL) { cam_simq_free(devq); return (ENOMEM); } - + + mtx_lock(&bt->lock); if (xpt_bus_register(bt->sim, dev, 0) != CAM_SUCCESS) { cam_sim_free(bt->sim, /*free_devq*/TRUE); + mtx_unlock(&bt->lock); return (ENXIO); } @@ -890,14 +907,16 @@ CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_bus_deregister(cam_sim_path(bt->sim)); cam_sim_free(bt->sim, /*free_devq*/TRUE); + mtx_unlock(&bt->lock); return (ENXIO); } + mtx_unlock(&bt->lock); /* * Setup interrupt. */ - error = bus_setup_intr(dev, bt->irq, INTR_TYPE_CAM|INTR_ENTROPY, NULL, - bt_intr, bt, &bt->ih); + error = bus_setup_intr(dev, bt->irq, INTR_TYPE_CAM | INTR_ENTROPY | + INTR_MPSAFE, NULL, bt_intr, bt, &bt->ih); if (error) { device_printf(dev, "bus_setup_intr() failed: %d\n", error); return (error); @@ -1024,6 +1043,7 @@ next_ccb->sg_list = segs; next_ccb->sg_list_phys = physaddr; next_ccb->flags = BCCB_FREE; + callout_init_mtx(&next_ccb->timer, &bt->lock, 0); error = bus_dmamap_create(bt->buffer_dmat, /*flags*/0, &next_ccb->dmamap); if (error != 0) @@ -1051,9 +1071,9 @@ static __inline void btfreeccb(struct bt_softc *bt, struct bt_ccb *bccb) { - int s; - s = splcam(); + if (!dumping) + mtx_assert(&bt->lock, MA_OWNED); if ((bccb->flags & BCCB_ACTIVE) != 0) LIST_REMOVE(&bccb->ccb->ccb_h, sim_links.le); if (bt->resource_shortage != 0 @@ -1064,16 +1084,15 @@ bccb->flags = BCCB_FREE; SLIST_INSERT_HEAD(&bt->free_bt_ccbs, bccb, links); bt->active_ccbs--; - splx(s); } static __inline struct bt_ccb* btgetccb(struct bt_softc *bt) { struct bt_ccb* bccb; - int s; - s = splcam(); + if (!dumping) + mtx_assert(&bt->lock, MA_OWNED); if ((bccb = SLIST_FIRST(&bt->free_bt_ccbs)) != NULL) { SLIST_REMOVE_HEAD(&bt->free_bt_ccbs, links); bt->active_ccbs++; @@ -1085,7 +1104,6 @@ bt->active_ccbs++; } } - splx(s); return (bccb); } @@ -1098,6 +1116,7 @@ CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("btaction\n")); bt = (struct bt_softc *)cam_sim_softc(sim); + mtx_assert(&bt->lock, MA_OWNED); switch (ccb->ccb_h.func_code) { /* Common cases first */ @@ -1111,11 +1130,8 @@ * get a bccb to use. */ if ((bccb = btgetccb(bt)) == NULL) { - int s; - s = splcam(); bt->resource_shortage = TRUE; - splx(s); xpt_freeze_simq(bt->sim, /*count*/1); ccb->ccb_h.status = CAM_REQUEUE_REQ; xpt_done(ccb); @@ -1197,10 +1213,8 @@ * to a single buffer. */ if ((ccbh->flags & CAM_DATA_PHYS)==0) { - int s; int error; - s = splsoftvm(); error = bus_dmamap_load( bt->buffer_dmat, bccb->dmamap, @@ -1222,7 +1236,6 @@ csio->ccb_h.status |= CAM_RELEASE_SIMQ; } - splx(s); } else { struct bus_dma_segment seg; @@ -1426,7 +1439,6 @@ struct bt_ccb *bccb; union ccb *ccb; struct bt_softc *bt; - int s; bccb = (struct bt_ccb *)arg; ccb = bccb->ccb; @@ -1484,8 +1496,6 @@ bccb->hccb.data_addr = 0; } - s = splcam(); - /* * Last time we need to check if this CCB needs to * be aborted. @@ -1495,7 +1505,6 @@ bus_dmamap_unload(bt->buffer_dmat, bccb->dmamap); btfreeccb(bt, bccb); xpt_done(ccb); - splx(s); return; } @@ -1503,9 +1512,8 @@ ccb->ccb_h.status |= CAM_SIM_QUEUED; LIST_INSERT_HEAD(&bt->pending_ccbs, &ccb->ccb_h, sim_links.le); - ccb->ccb_h.timeout_ch = - timeout(bttimeout, (caddr_t)bccb, - (ccb->ccb_h.timeout * hz) / 1000); + callout_reset(&bccb->timer, (ccb->ccb_h.timeout * hz) / 1000, + bttimeout, bccb); /* Tell the adapter about this command */ bt->cur_outbox->ccb_addr = btccbvtop(bt, bccb); @@ -1521,7 +1529,7 @@ "Encountered busy mailbox with %d out of %d " "commands active!!!\n", bt->active_ccbs, bt->max_ccbs); - untimeout(bttimeout, bccb, ccb->ccb_h.timeout_ch); + callout_stop(&bccb->timer); if (nseg != 0) bus_dmamap_unload(bt->buffer_dmat, bccb->dmamap); btfreeccb(bt, bccb); @@ -1534,16 +1542,24 @@ bt->cur_outbox->action_code = BMBO_START; bt_outb(bt, COMMAND_REG, BOP_START_MBOX); btnextoutbox(bt); - splx(s); } void bt_intr(void *arg) { struct bt_softc *bt; + + bt = arg; + mtx_lock(&bt->lock); + bt_intr_locked(bt); + mtx_unlock(&bt->lock); +} + +void +bt_intr_locked(struct bt_softc *bt) +{ u_int intstat; - bt = (struct bt_softc *)arg; while (((intstat = bt_inb(bt, INTSTAT_REG)) & INTR_PENDING) != 0) { if ((intstat & CMD_COMPLETE) != 0) { @@ -1629,9 +1645,9 @@ ccb_h = LIST_NEXT(ccb_h, sim_links.le); btdone(bt, pending_bccb, BMBI_ERROR); } else { - ccb_h->timeout_ch = - timeout(bttimeout, (caddr_t)pending_bccb, - (ccb_h->timeout * hz) / 1000); + callout_reset(&pending_bccb->timer, + (ccb_h->timeout * hz) / 1000, + bttimeout, pending_bccb); ccb_h = LIST_NEXT(ccb_h, sim_links.le); } } @@ -1639,7 +1655,7 @@ return; } - untimeout(bttimeout, bccb, ccb->ccb_h.timeout_ch); + callout_stop(&bccb->timer); switch (comp_code) { case BMBI_FREE: @@ -1822,8 +1838,9 @@ } if (timeout == 0) { if (bootverbose) - printf("%s: btreset - Diagnostic Active failed to " - "assert. status = 0x%x\n", bt_name(bt), status); + device_printf(bt->dev, + "btreset - Diagnostic Active failed to " + "assert. status = 0x%x\n", status); return (ETIMEDOUT); } @@ -1850,20 +1867,22 @@ DELAY(100); } if (timeout == 0) { - printf("%s: btreset - Host adapter failed to come ready. " - "status = 0x%x\n", bt_name(bt), status); + device_printf(bt->dev, + "btreset - Host adapter failed to come ready. " + "status = 0x%x\n", status); return (ETIMEDOUT); } /* If the diagnostics failed, tell the user */ if ((status & DIAG_FAIL) != 0 || (status & HA_READY) == 0) { - printf("%s: btreset - Adapter failed diagnostics\n", - bt_name(bt)); + device_printf(bt->dev, + "btreset - Adapter failed diagnostics\n"); if ((status & DATAIN_REG_READY) != 0) - printf("%s: btreset - Host Adapter Error code = 0x%x\n", - bt_name(bt), bt_inb(bt, DATAIN_REG)); + device_printf(bt->dev, + "btreset - Host Adapter Error code = 0x%x\n", + bt_inb(bt, DATAIN_REG)); return (ENXIO); } @@ -1901,7 +1920,6 @@ u_int saved_status; u_int intstat; u_int reply_buf_size; - int s; int cmd_complete; int error; @@ -1934,8 +1952,9 @@ DELAY(100); } if (timeout == 0) { - printf("%s: bt_cmd: Timeout waiting for adapter ready, " - "status = 0x%x\n", bt_name(bt), status); + device_printf(bt->dev, + "bt_cmd: Timeout waiting for adapter ready, " + "status = 0x%x\n", status); return (ETIMEDOUT); } @@ -1951,10 +1970,8 @@ timeout = 10000; while (param_len && --timeout) { DELAY(100); - s = splcam(); status = bt_inb(bt, STATUS_REG); intstat = bt_inb(bt, INTSTAT_REG); - splx(s); if ((intstat & (INTR_PENDING|CMD_COMPLETE)) == (INTR_PENDING|CMD_COMPLETE)) { @@ -1976,8 +1993,8 @@ } } if (timeout == 0) { - printf("%s: bt_cmd: Timeout sending parameters, " - "status = 0x%x\n", bt_name(bt), status); + device_printf(bt->dev, "bt_cmd: Timeout sending parameters, " + "status = 0x%x\n", status); cmd_complete = 1; saved_status = status; error = ETIMEDOUT; @@ -1988,7 +2005,6 @@ */ while (cmd_complete == 0 && --cmd_timeout) { - s = splcam(); status = bt_inb(bt, STATUS_REG); intstat = bt_inb(bt, INTSTAT_REG); /* @@ -2000,8 +2016,7 @@ */ if ((intstat & (INTR_PENDING|IMB_LOADED)) == (INTR_PENDING|IMB_LOADED)) - bt_intr(bt); - splx(s); + bt_intr_locked(bt); if (bt->command_cmp != 0) { /* @@ -2035,9 +2050,9 @@ if (reply_len < reply_buf_size) { *reply_data++ = data; } else { - printf("%s: bt_cmd - Discarded reply data byte " - "for opcode 0x%x\n", bt_name(bt), - opcode); + device_printf(bt->dev, + "bt_cmd - Discarded reply data byte " + "for opcode 0x%x\n", opcode); } /* * Reset timeout to ensure at least a second @@ -2054,20 +2069,18 @@ DELAY(100); } if (cmd_timeout == 0) { - printf("%s: bt_cmd: Timeout waiting for command (%x) " - "to complete.\n%s: status = 0x%x, intstat = 0x%x, " - "rlen %d\n", bt_name(bt), opcode, - bt_name(bt), status, intstat, reply_len); + device_printf(bt->dev, + "bt_cmd: Timeout waiting for command (%x) " + "to complete.\n", opcode); + device_printf(bt->dev, "status = 0x%x, intstat = 0x%x, " + "rlen %d\n", status, intstat, reply_len); error = (ETIMEDOUT); } /* - * Clear any pending interrupts. Block interrupts so our - * interrupt handler is not re-entered. + * Clear any pending interrupts. */ - s = splcam(); - bt_intr(bt); - splx(s); + bt_intr_locked(bt); if (error != 0) return (error); @@ -2083,7 +2096,7 @@ * reset above), perform a soft reset. */ if (bootverbose) - printf("%s: Invalid Command 0x%x\n", bt_name(bt), + device_printf(bt->dev, "Invalid Command 0x%x\n", opcode); DELAY(1000); status = bt_inb(bt, STATUS_REG); @@ -2151,8 +2164,8 @@ printf("btinitmboxes: Unable to enable strict RR\n"); error = 0; } else if (bootverbose) { - printf("%s: Using Strict Round Robin Mailbox Mode\n", - bt_name(bt)); + device_printf(bt->dev, + "Using Strict Round Robin Mailbox Mode\n"); } } @@ -2199,8 +2212,9 @@ DEFAULT_CMD_TIMEOUT); if (error != 0) { - printf("%s: btfetchtransinfo - Inquire Setup Info Failed %x\n", - bt_name(bt), error); + device_printf(bt->dev, + "btfetchtransinfo - Inquire Setup Info Failed %x\n", + error); return; } @@ -2254,8 +2268,9 @@ DEFAULT_CMD_TIMEOUT); if (error != 0) { - printf("%s: btfetchtransinfo - Inquire Sync " - "Info Failed 0x%x\n", bt_name(bt), error); + device_printf(bt->dev, + "btfetchtransinfo - Inquire Sync " + "Info Failed 0x%x\n", error); return; } sync_period = sync_info.sync_rate[target] * 100; @@ -2316,7 +2331,7 @@ static void btpoll(struct cam_sim *sim) { - bt_intr(cam_sim_softc(sim)); + bt_intr_locked(cam_sim_softc(sim)); } void @@ -2325,21 +2340,18 @@ struct bt_ccb *bccb; union ccb *ccb; struct bt_softc *bt; - int s; bccb = (struct bt_ccb *)arg; ccb = bccb->ccb; bt = (struct bt_softc *)ccb->ccb_h.ccb_bt_ptr; + mtx_assert(&bt->lock, MA_OWNED); xpt_print_path(ccb->ccb_h.path); printf("CCB %p - timed out\n", (void *)bccb); - s = splcam(); - if ((bccb->flags & BCCB_ACTIVE) == 0) { xpt_print_path(ccb->ccb_h.path); printf("CCB %p - timed out CCB already completed\n", (void *)bccb); - splx(s); return; } @@ -2366,7 +2378,7 @@ struct bt_ccb *pending_bccb; pending_bccb = (struct bt_ccb *)ccb_h->ccb_bccb_ptr; - untimeout(bttimeout, pending_bccb, ccb_h->timeout_ch); + callout_stop(&pending_bccb->timer); ccb_h = LIST_NEXT(ccb_h, sim_links.le); } } @@ -2389,7 +2401,7 @@ */ ccb->ccb_h.status = CAM_CMD_TIMEOUT; btreset(bt, /*hardreset*/TRUE); - printf("%s: No longer in timeout\n", bt_name(bt)); + device_printf(bt->dev, "No longer in timeout\n"); } else { /* * Send a Bus Device Reset message: @@ -2403,8 +2415,7 @@ * later which will attempt a bus reset. */ bccb->flags |= BCCB_DEVICE_RESET; - ccb->ccb_h.timeout_ch = - timeout(bttimeout, (caddr_t)bccb, 2 * hz); + callout_reset(&bccb->timer, 2 * hz, bttimeout, bccb); bt->recovery_bccb->hccb.opcode = INITIATOR_BUS_DEV_RESET; @@ -2421,8 +2432,6 @@ bt_outb(bt, COMMAND_REG, BOP_START_MBOX); btnextoutbox(bt); } - - splx(s); } MODULE_VERSION(bt, 1); --- //depot/vendor/freebsd/src/sys/dev/buslogic/bt_eisa.c 2006-12-11 18:31:50.000000000 0000 +++ //depot/user/jhb/cleanup/sys/dev/buslogic/bt_eisa.c 2012-09-02 00:23:52.000000000 0000 @@ -140,7 +140,7 @@ return (ENOMEM); } } else - irq = 0; + irq = NULL; bt->irq = irq; return (0); @@ -287,7 +287,7 @@ result = ENXIO; } else { eisa_add_intr(dev, info.irq, shared); - result = 0; + result = BUS_PROBE_DEFAULT; } bt_eisa_release_resources(dev); @@ -315,11 +315,11 @@ /* nsegments */ ~0, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg, */ &Giant, + /* lockfunc */ NULL, + /* lockarg, */ NULL, &bt->parent_dmat) != 0) { bt_eisa_release_resources(dev); - return -1; + return (ENOMEM); } /* @@ -328,7 +328,7 @@ */ if (bt_probe(dev) || bt_fetch_adapter_info(dev) || bt_init(dev)) { bt_eisa_release_resources(dev); - return -1; + return (ENXIO); } /* Attach sub-devices - always succeeds (sets up intr) */ --- //depot/vendor/freebsd/src/sys/dev/buslogic/bt_isa.c 2006-12-11 18:31:50.000000000 0000 +++ //depot/user/jhb/cleanup/sys/dev/buslogic/bt_isa.c 2012-09-02 00:23:52.000000000 0000 @@ -75,7 +75,7 @@ return (ENOMEM); } } else - irq = 0; + irq = NULL; if (isa_get_drq(dev) != -1) { rid = 0; @@ -90,7 +90,7 @@ return (ENOMEM); } } else - drq = 0; + drq = NULL; bt_init_softc(dev, port, irq, drq); @@ -176,7 +176,7 @@ bus_set_resource(dev, SYS_RES_DRQ, 0, info.drq, 1); bus_set_resource(dev, SYS_RES_IRQ, 0, info.irq, 1); - return (0); + return (BUS_PROBE_DEFAULT); } return (ENXIO); @@ -233,7 +233,7 @@ } /* XXX Should be a child of the ISA or VL bus dma tag */ - if (bus_dma_tag_create( /* parent */ NULL, + if (bus_dma_tag_create( /* parent */ bus_get_dma_tag(dev), /* alignemnt */ 1, /* boundary */ 0, /* lowaddr */ lowaddr, @@ -244,8 +244,8 @@ /* nsegments */ ~0, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->parent_dmat) != 0) { bt_isa_release_resources(dev); return (ENOMEM); @@ -272,8 +272,8 @@ /* nsegments */ 1, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->sense_dmat) != 0) { bt_isa_release_resources(dev); return (ENOMEM); --- //depot/vendor/freebsd/src/sys/dev/buslogic/bt_mca.c 2006-12-11 18:31:50.000000000 0000 +++ //depot/user/jhb/cleanup/sys/dev/buslogic/bt_mca.c 2012-09-02 00:23:52.000000000 0000 @@ -196,7 +196,7 @@ } else { mca_add_drq(dev, drq); mca_add_irq(dev, irq); - result = 0; + result = BUS_PROBE_DEFAULT; } bt_mca_release_resources(dev); @@ -229,8 +229,8 @@ /* nsegments */ ~0, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->parent_dmat) != 0) { bt_mca_release_resources(dev); return (ENOMEM); @@ -254,8 +254,8 @@ /* nsegments */ 1, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->sense_dmat) != 0) { bt_mca_release_resources(dev); return (ENOMEM); --- //depot/vendor/freebsd/src/sys/dev/buslogic/bt_pci.c 2012-03-12 19:30:21.000000000 0000 +++ //depot/user/jhb/cleanup/sys/dev/buslogic/bt_pci.c 2012-09-02 00:23:52.000000000 0000 @@ -148,7 +148,7 @@ } bt_pci_release_resources(dev); device_set_desc(dev, "Buslogic Multi-Master SCSI Host Adapter"); - return (0); + return (BUS_PROBE_DEFAULT); } default: break; @@ -161,7 +161,6 @@ bt_pci_attach(device_t dev) { struct bt_softc *bt = device_get_softc(dev); - int opri; int error; /* Initialize softc */ @@ -183,31 +182,19 @@ /* nsegments */ ~0, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &bt->parent_dmat) != 0) { bt_pci_release_resources(dev); return (ENOMEM); } - /* - * Protect ourself from spurrious interrupts during - * intialization and attach. We should really rely - * on interrupts during attach, but we don't have - * access to our interrupts during ISA probes, so until - * that changes, we mask our interrupts during attach - * too. - */ - opri = splcam(); - if (bt_probe(dev) || bt_fetch_adapter_info(dev) || bt_init(dev)) { bt_pci_release_resources(dev); - splx(opri); return (ENXIO); } error = bt_attach(dev); - splx(opri); if (error) { bt_pci_release_resources(dev); --- //depot/vendor/freebsd/src/sys/dev/buslogic/btreg.h 2005-01-06 01:48:14.000000000 0000 +++ //depot/user/jhb/cleanup/sys/dev/buslogic/btreg.h 2012-09-02 00:23:52.000000000 0000 @@ -582,6 +582,7 @@ u_int32_t flags; union ccb *ccb; bus_dmamap_t dmamap; + struct callout timer; bt_sg_t *sg_list; u_int32_t sg_list_phys; }; @@ -599,8 +600,7 @@ struct resource *irq; struct resource *drq; void *ih; - bus_space_tag_t tag; - bus_space_handle_t bsh; + struct mtx lock; struct cam_sim *sim; struct cam_path *path; bt_mbox_out_t *cur_outbox; @@ -637,7 +637,6 @@ u_int num_ccbs; /* Number of CCBs malloc'd */ u_int max_ccbs; /* Maximum allocatable CCBs */ u_int max_sg; - u_int unit; u_int scsi_id; u_int32_t extended_trans :1, wide_bus :1, @@ -664,8 +663,6 @@ char model[5]; }; -extern u_long bt_unit; - #define BT_TEMP_UNIT 0xFF /* Unit for probes */ void bt_init_softc(device_t dev, struct resource *port, @@ -696,10 +693,10 @@ #define bt_name(bt) device_get_nameunit(bt->dev) -#define bt_inb(bt, port) \ - bus_space_read_1((bt)->tag, (bt)->bsh, port) +#define bt_inb(bt, reg) \ + bus_read_1((bt)->port, reg) -#define bt_outb(bt, port, value) \ - bus_space_write_1((bt)->tag, (bt)->bsh, port, value) +#define bt_outb(bt, reg, value) \ + bus_write_1((bt)->port, reg, value) #endif /* _BT_H_ */