From 73c4645c5a136e64729eba3aa96e5a9c95ba0ac8 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Fri, 10 Jun 2005 15:46:31 +0000 Subject: [PATCH] Remove spl*() in dev/raid/{dpt,ida,iir} and replace them with critical sections. --- sys/dev/raid/dpt/dpt_control.c | 24 +++--- sys/dev/raid/dpt/dpt_eisa.c | 8 +- sys/dev/raid/dpt/dpt_pci.c | 8 +- sys/dev/raid/dpt/dpt_scsi.c | 150 +++++++++++++++------------------ sys/dev/raid/ida/ida.c | 13 +-- sys/dev/raid/ida/ida_disk.c | 8 +- sys/dev/raid/iir/iir.c | 121 ++++++++++++-------------- sys/dev/raid/iir/iir_ctrl.c | 17 ++-- 8 files changed, 160 insertions(+), 189 deletions(-) diff --git a/sys/dev/raid/dpt/dpt_control.c b/sys/dev/raid/dpt/dpt_control.c index 00c77cd05d..4b6c6ae4ed 100644 --- a/sys/dev/raid/dpt/dpt_control.c +++ b/sys/dev/raid/dpt/dpt_control.c @@ -37,7 +37,7 @@ */ #ident "$FreeBSD: src/sys/dev/dpt/dpt_control.c,v 1.16 1999/09/25 18:23:48 phk Exp $" -#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_control.c,v 1.7 2004/05/19 22:52:47 dillon Exp $" +#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_control.c,v 1.8 2005/06/10 15:46:31 swildner Exp $" #include "opt_dpt.h" @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -207,7 +208,6 @@ dpt_get_sysinfo(void) { int i; int j; - int ospl; char *addr; bzero(&dpt_sysinfo, sizeof(dpt_sysinfo_t)); @@ -218,7 +218,7 @@ dpt_get_sysinfo(void) * Let's hope anyone else who does this sort of things protects them * with splhigh too. */ - ospl = splhigh(); + crit_enter(); switch (cpu_class) { case CPUCLASS_386: @@ -378,7 +378,7 @@ dpt_get_sysinfo(void) } dpt_sysinfo.flags |= SI_DriveParamsValid; } - splx(ospl); + crit_exit(); /* Get the processor information */ dpt_sysinfo.flags |= SI_ProcessorValid; @@ -411,7 +411,6 @@ static int dpt_open(dev_t dev, int flags, int fmt, struct proc * p) { int minor_no; - int ospl; dpt_softc_t *dpt; minor_no = minor(dev); @@ -424,10 +423,10 @@ dpt_open(dev_t dev, int flags, int fmt, struct proc * p) if (dpt == NULL) return (ENXIO); - ospl = splbio(); + crit_enter(); if (dpt->state & DPT_HA_CONTROL_ACTIVE) { - splx(ospl); + crit_exit(); return (EBUSY); } else { if ((dpt_inbuf[minor_no & ~SCSI_CONTROL_MASK] = geteblk(PAGE_SIZE)) @@ -436,13 +435,13 @@ dpt_open(dev_t dev, int flags, int fmt, struct proc * p) printf("dpt%d: Failed to obtain an I/O buffer\n", minor_no & ~SCSI_CONTROL_MASK); #endif - splx(ospl); + crit_exit(); return (EINVAL); } } dpt->state |= DPT_HA_CONTROL_ACTIVE; - splx(ospl); + crit_exit(); return (0); } @@ -527,7 +526,6 @@ dpt_read(dev_t dev, struct uio * uio, int ioflag) dpt_softc_t *dpt; int error; int minor_no; - int ospl; minor_no = minor(dev); error = 0; @@ -565,7 +563,7 @@ dpt_read(dev_t dev, struct uio * uio, int ioflag) wbp = work_buffer; work_size = 0; - ospl = splbio(); + crit_enter(); command = dpt_rw_command[dpt->unit]; if (strcmp(command, DPT_RW_CMD_DUMP_SOFTC) == 0) { @@ -640,7 +638,7 @@ dpt_read(dev_t dev, struct uio * uio, int ioflag) #ifdef DPT_DEBUG_CONTROL printf("dpt%d: Bad READ state (%s)\n", minor_no, command); #endif - splx(ospl); + crit_exit(); error = EINVAL; } @@ -655,7 +653,7 @@ dpt_read(dev_t dev, struct uio * uio, int ioflag) #endif } } - splx(ospl); + crit_exit(); return (error); } diff --git a/sys/dev/raid/dpt/dpt_eisa.c b/sys/dev/raid/dpt/dpt_eisa.c index 6133ce4070..a24b7e2927 100644 --- a/sys/dev/raid/dpt/dpt_eisa.c +++ b/sys/dev/raid/dpt/dpt_eisa.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/dpt/dpt_eisa.c,v 1.12.2.1 2000/08/07 18:48:14 peter Exp $ - * $DragonFly: src/sys/dev/raid/dpt/dpt_eisa.c,v 1.4 2005/05/24 20:59:03 dillon Exp $ + * $DragonFly: src/sys/dev/raid/dpt/dpt_eisa.c,v 1.5 2005/06/10 15:46:31 swildner Exp $ */ #include @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -102,7 +103,6 @@ dpt_eisa_attach (device_t dev) dpt_softc_t * dpt; struct resource *io = 0; struct resource *irq = 0; - int s; int rid; void * ih; int error = 0; @@ -149,7 +149,7 @@ dpt_eisa_attach (device_t dev) goto bad; } - s = splcam(); + crit_enter(); if (dpt_init(dpt) != 0) { dpt_free(dpt); @@ -160,7 +160,7 @@ dpt_eisa_attach (device_t dev) /* Register with the XPT */ dpt_attach(dpt); - splx(s); + crit_exit(); error = bus_setup_intr(dev, irq, INTR_TYPE_CAM, dpt_intr, dpt, &ih, NULL); diff --git a/sys/dev/raid/dpt/dpt_pci.c b/sys/dev/raid/dpt/dpt_pci.c index 2ca4fbfafe..2630dc4a3c 100644 --- a/sys/dev/raid/dpt/dpt_pci.c +++ b/sys/dev/raid/dpt/dpt_pci.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/dpt/dpt_pci.c,v 1.17.2.2 2000/08/26 22:21:21 peter Exp $ - * $DragonFly: src/sys/dev/raid/dpt/dpt_pci.c,v 1.4 2005/05/24 20:59:03 dillon Exp $ + * $DragonFly: src/sys/dev/raid/dpt/dpt_pci.c,v 1.5 2005/06/10 15:46:31 swildner Exp $ */ #include @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -77,7 +78,6 @@ dpt_pci_attach (device_t dev) dpt_softc_t * dpt; struct resource *io = 0; struct resource *irq = 0; - int s; int rid; void * ih; int error = 0; @@ -154,7 +154,7 @@ dpt_pci_attach (device_t dev) goto bad; } - s = splcam(); + crit_enter(); if (dpt_init(dpt) != 0) { dpt_free(dpt); @@ -165,7 +165,7 @@ dpt_pci_attach (device_t dev) /* Register with the XPT */ dpt_attach(dpt); - splx(s); + crit_exit(); error = bus_setup_intr(dev, irq, INTR_TYPE_CAM, dpt_intr, dpt, &ih, NULL); diff --git a/sys/dev/raid/dpt/dpt_scsi.c b/sys/dev/raid/dpt/dpt_scsi.c index def1add35a..e00643cdf9 100644 --- a/sys/dev/raid/dpt/dpt_scsi.c +++ b/sys/dev/raid/dpt/dpt_scsi.c @@ -44,7 +44,7 @@ */ #ident "$FreeBSD: src/sys/dev/dpt/dpt_scsi.c,v 1.28.2.3 2003/01/31 02:47:10 grog Exp $" -#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_scsi.c,v 1.8 2004/09/17 03:39:39 joerg Exp $" +#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_scsi.c,v 1.9 2005/06/10 15:46:31 swildner Exp $" #define _DPT_C_ @@ -56,6 +56,7 @@ #include #include +#include #include #include @@ -220,9 +221,8 @@ static __inline struct dpt_ccb* dptgetccb(struct dpt_softc *dpt) { struct dpt_ccb* dccb; - int s; - s = splcam(); + crit_enter(); if ((dccb = SLIST_FIRST(&dpt->free_dccb_list)) != NULL) { SLIST_REMOVE_HEAD(&dpt->free_dccb_list, links); dpt->free_dccbs--; @@ -236,7 +236,7 @@ dptgetccb(struct dpt_softc *dpt) dpt->free_dccbs--; } } - splx(s); + crit_exit(); return (dccb); } @@ -244,9 +244,7 @@ dptgetccb(struct dpt_softc *dpt) static __inline void dptfreeccb(struct dpt_softc *dpt, struct dpt_ccb *dccb) { - int s; - - s = splcam(); + crit_enter(); if ((dccb->state & DCCB_ACTIVE) != 0) LIST_REMOVE(&dccb->ccb->ccb_h, sim_links.le); if ((dccb->state & DCCB_RELEASE_SIMQ) != 0) @@ -259,7 +257,7 @@ dptfreeccb(struct dpt_softc *dpt, struct dpt_ccb *dccb) dccb->state = DCCB_FREE; SLIST_INSERT_HEAD(&dpt->free_dccb_list, dccb, links); ++dpt->free_dccbs; - splx(s); + crit_exit(); } static __inline u_int32_t @@ -479,7 +477,6 @@ dpt_get_conf(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, u_int8_t status; int ndx; - int ospl; int result; cp = &dccb->eata_ccb; @@ -504,7 +501,7 @@ dpt_get_conf(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, cp->cp_identify = 1; cp->cp_datalen = htonl(size); - ospl = splcam(); + crit_enter(); /* * This could be a simple for loop, but we suspected the compiler To @@ -523,7 +520,7 @@ dpt_get_conf(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, if (dpt_raid_busy(dpt)) { printf("dpt%d WARNING: Get_conf() RSUS failed.\n", dpt->unit); - splx(ospl); + crit_exit(); return (0); } } @@ -541,7 +538,7 @@ dpt_get_conf(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, printf("dpt%d WARNING: Get_conf() failed (%d) to send " "EATA_CMD_DMA_READ_CONFIG\n", dpt->unit, result); - splx(ospl); + crit_exit(); return (0); } /* Wait for two seconds for a response. This can be slow */ @@ -555,7 +552,7 @@ dpt_get_conf(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, /* Grab the status and clear interrupts */ status = dpt_inb(dpt, HA_RSTATUS); - splx(ospl); + crit_exit(); /* * Check the status carefully. Return only if the @@ -582,7 +579,6 @@ dpt_detect_cache(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, u_int8_t *param; int bytes; int result; - int ospl; int ndx; u_int8_t status; @@ -627,14 +623,14 @@ dpt_detect_cache(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, cp->cp_datalen = htonl(512); - ospl = splcam(); + crit_enter(); result = dpt_send_eata_command(dpt, cp, dccb_busaddr, EATA_CMD_DMA_SEND_CP, 10000, 0, 0, 0); if (result != 0) { printf("dpt%d WARNING: detect_cache() failed (%d) to send " "EATA_CMD_DMA_SEND_CP\n", dpt->unit, result); - splx(ospl); + crit_exit(); return; } /* Wait for two seconds for a response. This can be slow... */ @@ -647,7 +643,7 @@ dpt_detect_cache(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr, /* Grab the status and clear interrupts */ status = dpt_inb(dpt, HA_RSTATUS); - splx(ospl); + crit_exit(); /* * Sanity check @@ -711,7 +707,6 @@ dptexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) struct dpt_ccb *dccb; union ccb *ccb; struct dpt_softc *dpt; - int s; dccb = (struct dpt_ccb *)arg; ccb = dccb->ccb; @@ -768,7 +763,7 @@ dptexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) dccb->eata_ccb.cp_datalen = 0; } - s = splcam(); + crit_enter(); /* * Last time we need to check if this CCB needs to @@ -779,7 +774,7 @@ dptexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) bus_dmamap_unload(dpt->buffer_dmat, dccb->dmamap); dptfreeccb(dpt, dccb); xpt_done(ccb); - splx(s); + crit_exit(); return; } @@ -798,7 +793,7 @@ dptexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) xpt_done(ccb); } - splx(s); + crit_exit(); } static void @@ -836,11 +831,9 @@ dpt_action(struct cam_sim *sim, union ccb *ccb) return; } if ((dccb = dptgetccb(dpt)) == NULL) { - int s; - - s = splcam(); + crit_enter(); dpt->resource_shortage = 1; - splx(s); + crit_exit(); xpt_freeze_simq(sim, /*count*/1); ccb->ccb_h.status = CAM_REQUEUE_REQ; xpt_done(ccb); @@ -914,10 +907,9 @@ dpt_action(struct cam_sim *sim, union ccb *ccb) * to a single buffer. */ if ((ccbh->flags & CAM_DATA_PHYS) == 0) { - int s; int error; - s = splsoftvm(); + crit_enter(); error = bus_dmamap_load(dpt->buffer_dmat, dccb->dmamap, @@ -935,7 +927,7 @@ dpt_action(struct cam_sim *sim, union ccb *ccb) xpt_freeze_simq(sim, 1); dccb->state |= CAM_RELEASE_SIMQ; } - splx(s); + crit_exit(); } else { struct bus_dma_segment seg; @@ -1704,7 +1696,6 @@ dpttimeout(void *arg) struct dpt_ccb *dccb; union ccb *ccb; struct dpt_softc *dpt; - int s; dccb = (struct dpt_ccb *)arg; ccb = dccb->ccb; @@ -1712,7 +1703,7 @@ dpttimeout(void *arg) xpt_print_path(ccb->ccb_h.path); printf("CCB %p - timed out\n", (void *)dccb); - s = splcam(); + crit_enter(); /* * Try to clear any pending jobs. FreeBSD will loose interrupts, @@ -1726,7 +1717,7 @@ dpttimeout(void *arg) xpt_print_path(ccb->ccb_h.path); printf("CCB %p - timed out CCB already completed\n", (void *)dccb); - splx(s); + crit_exit(); return; } @@ -1734,7 +1725,7 @@ dpttimeout(void *arg) dpt_send_immediate(dpt, &dccb->eata_ccb, dccb->eata_ccb.cp_busaddr, /*retries*/20000, EATA_SPECIFIC_ABORT, 0, 0); ccb->ccb_h.status = CAM_CMD_TIMEOUT; - splx(s); + crit_exit(); } /* @@ -1776,7 +1767,6 @@ static void dpt_reset_hba(dpt_softc_t *dpt) { eata_ccb_t *ccb; - int ospl; dpt_ccb_t dccb, *dccbp; int result; struct scsi_xfer *xs; @@ -1806,13 +1796,13 @@ dpt_reset_hba(dpt_softc_t *dpt) ccb->cp_scsi_cmd = 0; /* Should be ignored */ /* Lock up the submitted queue. We are very persistant here */ - ospl = splcam(); + crit_enter(); while (dpt->queue_status & DPT_SUBMITTED_QUEUE_ACTIVE) { DELAY(100); } dpt->queue_status |= DPT_SUBMITTED_QUEUE_ACTIVE; - splx(ospl); + crit_exit(); /* Send the RESET message */ if ((result = dpt_send_eata_command(dpt, &dccb.eata_ccb, @@ -1857,9 +1847,9 @@ dpt_reset_hba(dpt_softc_t *dpt) (dccbp->std_callback)(dpt, dccbp->eata_ccb.cp_channel, dccbp); } else { - ospl = splcam(); + crit_enter(); dpt_Qpush_free(dpt, dccbp); - splx(ospl); + crit_exit(); } } @@ -1885,7 +1875,6 @@ dpt_target_ccb(dpt_softc_t * dpt, int bus, u_int8_t target, u_int8_t lun, u_int16_t length, u_int16_t offset) { eata_ccb_t *cp; - int ospl; if ((length + offset) > DPT_MAX_TARGET_MODE_BUFFER_SIZE) { printf("dpt%d: Length of %d, and offset of %d are wrong\n", @@ -1945,10 +1934,8 @@ dpt_set_target(int redo, dpt_softc_t * dpt, u_int8_t bus, u_int8_t target, u_int8_t lun, int mode, u_int16_t length, u_int16_t offset, dpt_ccb_t * ccb) { - int ospl; - if (dpt->target_mode_enabled) { - ospl = splcam(); + crit_enter(); if (!redo) dpt_target_ccb(dpt, bus, target, lun, ccb, mode, @@ -1963,7 +1950,7 @@ dpt_set_target(int redo, dpt_softc_t * dpt, dpt_Qadd_waiting(dpt, ccb); dpt_sched_queue(dpt); - splx(ospl); + crit_exit(); } else { printf("dpt%d: Target Mode Request, but Target Mode is OFF\n", dpt->unit); @@ -1986,7 +1973,6 @@ dpt_send_buffer(int unit, u_int8_t channel, u_int8_t target, u_int8_t lun, { dpt_softc_t *dpt; dpt_ccb_t *ccb = NULL; - int ospl; /* This is an external call. Be a bit paranoid */ for (dpt = TAILQ_FIRST(&dpt_softc_list); @@ -2009,21 +1995,21 @@ valid_unit: (dpt->buffer_receiver[channel][target][lun] == NULL)) return (NOT_REGISTERED); - ospl = splsoftcam(); + crit_enter(); /* Process the free list */ if ((TAILQ_EMPTY(&dpt->free_ccbs)) && dpt_alloc_freelist(dpt)) { printf("dpt%d ERROR: Cannot allocate any more free CCB's.\n" " Please try later\n", dpt->unit); - splx(ospl); + crit_exit(); return (NO_RESOURCES); } /* Now grab the newest CCB */ if ((ccb = dpt_Qpop_free(dpt)) == NULL) { - splx(ospl); + crit_exit(); panic("dpt%d: Got a NULL CCB from pop_free()\n", dpt->unit); } - splx(ospl); + crit_exit(); bcopy(dpt->rw_buffer[channel][target][lun] + offset, data, length); dpt_target_ccb(dpt, channel, target, lun, ccb, mode, @@ -2031,7 +2017,7 @@ valid_unit: length, offset); ccb->std_callback = (ccb_callback) callback; /* Potential trouble */ - ospl = splcam(); + crit_enter(); ccb->transaction_id = ++dpt->commands_processed; #ifdef DPT_MEASURE_PERFORMANCE @@ -2041,7 +2027,7 @@ valid_unit: dpt_Qadd_waiting(dpt, ccb); dpt_sched_queue(dpt); - splx(ospl); + crit_exit(); return (0); } return (DRIVER_DOWN); @@ -2050,7 +2036,6 @@ valid_unit: static void dpt_target_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) { - int ospl; eata_ccb_t *cp; cp = &ccb->eata_ccb; @@ -2060,9 +2045,9 @@ dpt_target_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) * We do NOT put it back on the free, etc., queues as it is a special * ccb, owned by the dpt_softc of this unit. */ - ospl = splsoftcam(); + crit_enter(); dpt_Qremove_completed(dpt, ccb); - splx(ospl); + crit_exit(); #define br_channel (ccb->eata_ccb.cp_channel) #define br_target (ccb->eata_ccb.cp_id) @@ -2104,10 +2089,10 @@ dpt_target_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) printf("dpt%d: %s is an unsupported command for target mode\n", dpt->unit, scsi_cmd_name(ccb->eata_ccb.cp_scsi_cmd)); } - ospl = splsoftcam(); + crit_enter(); dpt->target_ccb[br_channel][br_target][br_lun] = NULL; dpt_Qpush_free(dpt, ccb); - splx(ospl); + crit_exit(); } @@ -2123,7 +2108,6 @@ dpt_register_buffer(int unit, u_int8_t channel, u_int8_t target, u_int8_t lun, { dpt_softc_t *dpt; dpt_ccb_t *ccb = NULL; - int ospl; for (dpt = TAILQ_FIRST(&dpt_softc_list); dpt != NULL; @@ -2148,23 +2132,23 @@ valid_unit: /* Assign the requested callback */ dpt->buffer_receiver[channel][target][lun] = callback; /* Get a CCB */ - ospl = splsoftcam(); + crit_enter(); /* Process the free list */ if ((TAILQ_EMPTY(&dpt->free_ccbs)) && dpt_alloc_freelist(dpt)) { printf("dpt%d ERROR: Cannot allocate any more free CCB's.\n" " Please try later\n", dpt->unit); - splx(ospl); + crit_exit(); return (NO_RESOURCES); } /* Now grab the newest CCB */ if ((ccb = dpt_Qpop_free(dpt)) == NULL) { - splx(ospl); + crit_exit(); panic("dpt%d: Got a NULL CCB from pop_free()\n", dpt->unit); } - splx(ospl); + crit_exit(); /* Clean up the leftover of the previous tenant */ ccb->status = DPT_CCB_STATE_NEW; @@ -2186,9 +2170,9 @@ valid_unit: } else { if (dpt->buffer_receiver[channel][target][lun] == callback) { dpt->buffer_receiver[channel][target][lun] = NULL; - ospl = splsoftcam(); + crit_enter(); dpt_Qpush_free(dpt, ccb); - splx(ospl); + crit_exit(); free(dpt->rw_buffer[channel][target][lun], M_DEVBUF); return (SUCCESSFULLY_REGISTERED); } else @@ -2203,12 +2187,11 @@ u_int8_t dpt_blinking_led(dpt_softc_t * dpt) { int ndx; - int ospl; u_int32_t state; u_int32_t previous; u_int8_t result; - ospl = splcam(); + crit_enter(); result = 0; @@ -2222,7 +2205,7 @@ dpt_blinking_led(dpt_softc_t * dpt) if ((state == previous) && (state == DPT_BLINK_INDICATOR)) result = dpt_inb(dpt, 5); - splx(ospl); + crit_exit(); return (result); } @@ -2240,7 +2223,6 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, int channel, target, lun; int huh; int result; - int ospl; int submitted; data = NULL; @@ -2263,22 +2245,22 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, } } /* Get a DPT CCB, so we can prepare a command */ - ospl = splsoftcam(); + crit_enter(); /* Process the free list */ if ((TAILQ_EMPTY(&dpt->free_ccbs)) && dpt_alloc_freelist(dpt)) { printf("dpt%d ERROR: Cannot allocate any more free CCB's.\n" " Please try later\n", dpt->unit); - splx(ospl); + crit_exit(); return (EFAULT); } /* Now grab the newest CCB */ if ((ccb = dpt_Qpop_free(dpt)) == NULL) { - splx(ospl); + crit_exit(); panic("dpt%d: Got a NULL CCB from pop_free()\n", dpt->unit); } else { - splx(ospl); + crit_exit(); /* Clean up the leftover of the previous tenant */ ccb->status = DPT_CCB_STATE_NEW; } @@ -2348,9 +2330,9 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, if ((ccb->eata_ccb.cp_cdb[0] == MULTIFUNCTION_CMD) && (ccb->eata_ccb.cp_cdb[2] == BUS_QUIET)) { /* We wait for ALL traffic for this HBa to subside */ - ospl = splsoftcam(); + crit_enter(); dpt->state |= DPT_HA_QUIET; - splx(ospl); + crit_exit(); while ((submitted = dpt->submitted_ccbs_count) != 0) { huh = tsleep((void *) dpt, PCATCH, "dptqt", 100 * hz); @@ -2370,9 +2352,9 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, /* Resume normal operation */ if ((ccb->eata_ccb.cp_cdb[0] == MULTIFUNCTION_CMD) && (ccb->eata_ccb.cp_cdb[2] == BUS_UNQUIET)) { - ospl = splsoftcam(); + crit_enter(); dpt->state &= ~DPT_HA_QUIET; - splx(ospl); + crit_exit(); } /** * Schedule the command and submit it. @@ -2391,9 +2373,9 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, ++dpt->performance.command_count[ccb->eata_ccb.cp_scsi_cmd]; ccb->command_started = microtime_now; #endif - ospl = splcam(); + crit_enter(); dpt_Qadd_waiting(dpt, ccb); - splx(ospl); + crit_exit(); dpt_sched_queue(dpt); @@ -2410,10 +2392,11 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, static void dpt_user_cmd_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) { - int ospl = splsoftcam(); u_int32_t result; caddr_t cmd_arg; + crit_enter(); + /** * If Auto Request Sense is on, copyout the sense struct */ @@ -2424,7 +2407,7 @@ dpt_user_cmd_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) sizeof(struct scsi_sense_data))) { ccb->result = EFAULT; dpt_Qpush_free(dpt, ccb); - splx(ospl); + crit_exit(); wakeup(ccb); return; } @@ -2436,7 +2419,7 @@ dpt_user_cmd_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) dpt_Qpush_free(dpt, ccb); ccb->result = EFAULT; - splx(ospl); + crit_exit(); wakeup(ccb); return; } @@ -2448,7 +2431,7 @@ dpt_user_cmd_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) if (copyout((caddr_t) & result, cmd_arg, sizeof(result))) { dpt_Qpush_free(dpt, ccb); ccb->result = EFAULT; - splx(ospl); + crit_exit(); wakeup(ccb); return; } @@ -2457,7 +2440,7 @@ dpt_user_cmd_done(dpt_softc_t * dpt, int bus, dpt_ccb_t * ccb) dpt_Qpush_free(dpt, ccb); /* Free allocated memory */ - splx(ospl); + crit_exit(); return; } @@ -2487,14 +2470,13 @@ static void dpt_handle_timeouts(dpt_softc_t * dpt) { dpt_ccb_t *ccb; - int ospl; - ospl = splcam(); + crit_enter(); if (dpt->state & DPT_HA_TIMEOUTS_ACTIVE) { printf("dpt%d WARNING: Timeout Handling Collision\n", dpt->unit); - splx(ospl); + crit_exit(); return; } dpt->state |= DPT_HA_TIMEOUTS_ACTIVE; @@ -2598,7 +2580,7 @@ dpt_handle_timeouts(dpt_softc_t * dpt) } dpt->state &= ~DPT_HA_TIMEOUTS_ACTIVE; - splx(ospl); + crit_exit(); } #endif /* DPT_HANDLE_TIMEOUTS */ diff --git a/sys/dev/raid/ida/ida.c b/sys/dev/raid/ida/ida.c index e5303db697..17695b8392 100644 --- a/sys/dev/raid/ida/ida.c +++ b/sys/dev/raid/ida/ida.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ida/ida.c,v 1.7.2.3 2001/03/01 01:57:32 ps Exp $ - * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.7 2004/06/21 15:39:31 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.8 2005/06/10 15:46:31 swildner Exp $ */ /* @@ -60,6 +60,7 @@ #include #include #include +#include #include "idareg.h" #include "idavar.h" @@ -331,11 +332,11 @@ ida_command(struct ida_softc *ida, int command, void *data, int datasize, struct ida_hardware_qcb *hwqcb; struct ida_qcb *qcb; bus_dmasync_op_t op; - int s, error; + int error; - s = splbio(); + crit_enter(); qcb = ida_get_qcb(ida); - splx(s); + crit_exit(); if (qcb == NULL) { printf("ida_command: out of QCBs"); @@ -358,11 +359,11 @@ ida_command(struct ida_softc *ida, int command, void *data, int datasize, qcb->flags = flags | IDA_COMMAND; - s = splbio(); + crit_enter(); STAILQ_INSERT_TAIL(&ida->qcb_queue, qcb, link.stqe); ida_start(ida); error = ida_wait(ida, qcb); - splx(s); + crit_exit(); /* XXX should have status returned here? */ /* XXX have "status pointer" area in QCB? */ diff --git a/sys/dev/raid/ida/ida_disk.c b/sys/dev/raid/ida/ida_disk.c index e2c686940d..17fa04043f 100644 --- a/sys/dev/raid/ida/ida_disk.c +++ b/sys/dev/raid/ida/ida_disk.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ida/ida_disk.c,v 1.12.2.6 2001/11/27 20:21:02 ps Exp $ - * $DragonFly: src/sys/dev/raid/ida/ida_disk.c,v 1.8 2004/05/19 22:52:47 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ida/ida_disk.c,v 1.9 2005/06/10 15:46:31 swildner Exp $ */ /* @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -158,7 +159,6 @@ static void idad_strategy(struct buf *bp) { struct idad_softc *drv; - int s; drv = idad_getsoftc(bp->b_dev); if (drv == NULL) { @@ -181,10 +181,10 @@ idad_strategy(struct buf *bp) goto done; bp->b_driver1 = drv; - s = splbio(); + crit_enter(); devstat_start_transaction(&drv->stats); ida_submit_buf(drv->controller, bp); - splx(s); + crit_exit(); return; bad: diff --git a/sys/dev/raid/iir/iir.c b/sys/dev/raid/iir/iir.c index 06b595eaf9..0b9c2b93c3 100644 --- a/sys/dev/raid/iir/iir.c +++ b/sys/dev/raid/iir/iir.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/iir/iir.c,v 1.2.2.3 2002/05/05 08:18:12 asmodai Exp $ */ -/* $DragonFly: src/sys/dev/raid/iir/iir.c,v 1.9 2004/09/17 03:39:39 joerg Exp $ */ +/* $DragonFly: src/sys/dev/raid/iir/iir.c,v 1.10 2005/06/10 15:46:31 swildner Exp $ */ /* * Copyright (c) 2000-01 Intel Corporation * All Rights Reserved @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -173,12 +174,9 @@ static u_int32_t gdt_ccb_vtop(struct gdt_softc *gdt, static int gdt_sync_event(struct gdt_softc *gdt, int service, u_int8_t index, struct gdt_ccb *gccb); static int gdt_async_event(struct gdt_softc *gdt, int service); -static struct gdt_ccb *gdt_raw_cmd(struct gdt_softc *gdt, - union ccb *ccb, int *lock); -static struct gdt_ccb *gdt_cache_cmd(struct gdt_softc *gdt, - union ccb *ccb, int *lock); -static struct gdt_ccb *gdt_ioctl_cmd(struct gdt_softc *gdt, - gdt_ucmd_t *ucmd, int *lock); +static struct gdt_ccb *gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb); +static struct gdt_ccb *gdt_cache_cmd(struct gdt_softc *gdt, union ccb *ccb); +static struct gdt_ccb *gdt_ioctl_cmd(struct gdt_softc *gdt, gdt_ucmd_t *ucmd); static void gdt_internal_cache_cmd(struct gdt_softc *gdt,union ccb *ccb); static void gdtmapmem(void *arg, bus_dma_segment_t *dm_segs, @@ -630,11 +628,10 @@ static struct gdt_ccb * gdt_get_ccb(struct gdt_softc *gdt) { struct gdt_ccb *gccb; - int lock; GDT_DPRINTF(GDT_D_QUEUE, ("gdt_get_ccb(%p)\n", gdt)); - lock = splcam(); + crit_enter(); gccb = SLIST_FIRST(&gdt->sc_free_gccb); if (gccb != NULL) { SLIST_REMOVE_HEAD(&gdt->sc_free_gccb, sle); @@ -643,23 +640,21 @@ gdt_get_ccb(struct gdt_softc *gdt) if (gdt_stat.cmd_index_act > gdt_stat.cmd_index_max) gdt_stat.cmd_index_max = gdt_stat.cmd_index_act; } - splx(lock); + crit_exit(); return (gccb); } void gdt_free_ccb(struct gdt_softc *gdt, struct gdt_ccb *gccb) { - int lock; - GDT_DPRINTF(GDT_D_QUEUE, ("gdt_free_ccb(%p, %p)\n", gdt, gccb)); - lock = splcam(); + crit_enter(); gccb->gc_flags = GDT_GCF_UNUSED; SLIST_REMOVE(&gdt->sc_pending_gccb, gccb, gdt_ccb, sle); SLIST_INSERT_HEAD(&gdt->sc_free_gccb, gccb, sle); --gdt_stat.cmd_index_act; - splx(lock); + crit_exit(); if (gdt->sc_state & GDT_SHUTDOWN) wakeup(gccb); } @@ -674,7 +669,6 @@ gdt_ccb_vtop(struct gdt_softc *gdt, struct gdt_ccb *gccb) void gdt_next(struct gdt_softc *gdt) { - int lock; union ccb *ccb; gdt_ucmd_t *ucmd; struct cam_sim *sim; @@ -688,10 +682,10 @@ gdt_next(struct gdt_softc *gdt) GDT_DPRINTF(GDT_D_QUEUE, ("gdt_next(%p)\n", gdt)); - lock = splcam(); + crit_enter(); if (gdt->sc_test_busy(gdt)) { if (!(gdt->sc_state & GDT_POLLING)) { - splx(lock); + crit_exit(); return; } while (gdt->sc_test_busy(gdt)) @@ -710,7 +704,7 @@ gdt_next(struct gdt_softc *gdt) ucmd = TAILQ_FIRST(&gdt->sc_ucmd_queue); if (ucmd != NULL) { TAILQ_REMOVE(&gdt->sc_ucmd_queue, ucmd, links); - if ((gccb = gdt_ioctl_cmd(gdt, ucmd, &lock)) == NULL) { + if ((gccb = gdt_ioctl_cmd(gdt, ucmd)) == NULL) { TAILQ_INSERT_HEAD(&gdt->sc_ucmd_queue, ucmd, links); break; } @@ -741,7 +735,7 @@ gdt_next(struct gdt_softc *gdt) xpt_done(ccb); } else if (bus != gdt->sc_virt_bus) { /* raw service command */ - if ((gccb = gdt_raw_cmd(gdt, ccb, &lock)) == NULL) { + if ((gccb = gdt_raw_cmd(gdt, ccb)) == NULL) { TAILQ_INSERT_HEAD(&gdt->sc_ccb_queue, &ccb->ccb_h, sim_links.tqe); ++gdt_stat.req_queue_act; @@ -758,7 +752,7 @@ gdt_next(struct gdt_softc *gdt) /* cache service command */ if (cmd == READ_6 || cmd == WRITE_6 || cmd == READ_10 || cmd == WRITE_10) { - if ((gccb = gdt_cache_cmd(gdt, ccb, &lock)) == NULL) { + if ((gccb = gdt_cache_cmd(gdt, ccb)) == NULL) { TAILQ_INSERT_HEAD(&gdt->sc_ccb_queue, &ccb->ccb_h, sim_links.tqe); ++gdt_stat.req_queue_act; @@ -767,9 +761,9 @@ gdt_next(struct gdt_softc *gdt) next_cmd = FALSE; } } else { - splx(lock); + crit_exit(); gdt_internal_cache_cmd(gdt, ccb); - lock = splcam(); + crit_enter(); } } if ((gdt->sc_state & GDT_POLLING) || !next_cmd) @@ -778,7 +772,7 @@ gdt_next(struct gdt_softc *gdt) if (gdt->sc_cmd_cnt > 0) gdt->sc_release_event(gdt); - splx(lock); + crit_exit(); if ((gdt->sc_state & GDT_POLLING) && gdt->sc_cmd_cnt > 0) { gdt_wait(gdt, gccb, GDT_POLL_TIMEOUT); @@ -786,7 +780,7 @@ gdt_next(struct gdt_softc *gdt) } static struct gdt_ccb * -gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) +gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb) { struct gdt_ccb *gccb; struct cam_sim *sim; @@ -816,7 +810,7 @@ gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) if (gdt->sc_cmd_cnt == 0) gdt->sc_set_sema0(gdt); - splx(*lock); + crit_exit(); gdt_enc32(gdt->sc_cmd + GDT_CMD_COMMANDINDEX, gccb->gc_cmd_index); gdt_enc16(gdt->sc_cmd + GDT_CMD_OPCODE, GDT_WRITE); @@ -850,11 +844,10 @@ gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { if ((ccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) { if ((ccb->ccb_h.flags & CAM_DATA_PHYS) == 0) { - int s; int error; /* vorher unlock von splcam() ??? */ - s = splsoftvm(); + crit_enter(); error = bus_dmamap_load(gdt->sc_buffer_dmat, gccb->gc_dmamap, @@ -866,7 +859,7 @@ gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) xpt_freeze_simq(sim, 1); gccb->gc_state |= CAM_RELEASE_SIMQ; } - splx(s); + crit_exit(); } else { struct bus_dma_segment seg; @@ -895,12 +888,12 @@ gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) gdtexecuteccb(gccb, NULL, 0, 0); } - *lock = splcam(); + crit_enter(); return (gccb); } static struct gdt_ccb * -gdt_cache_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) +gdt_cache_cmd(struct gdt_softc *gdt, union ccb *ccb) { struct gdt_ccb *gccb; struct cam_sim *sim; @@ -933,7 +926,7 @@ gdt_cache_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) if (gdt->sc_cmd_cnt == 0) gdt->sc_set_sema0(gdt); - splx(*lock); + crit_exit(); gdt_enc32(gdt->sc_cmd + GDT_CMD_COMMANDINDEX, gccb->gc_cmd_index); cmdp = ccb->csio.cdb_io.cdb_bytes; @@ -965,11 +958,10 @@ gdt_cache_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) /* Only use S/G if there is a transfer */ if ((ccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) { if ((ccb->ccb_h.flags & CAM_DATA_PHYS) == 0) { - int s; int error; /* vorher unlock von splcam() ??? */ - s = splsoftvm(); + crit_enter(); error = bus_dmamap_load(gdt->sc_buffer_dmat, gccb->gc_dmamap, @@ -981,7 +973,7 @@ gdt_cache_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) xpt_freeze_simq(sim, 1); gccb->gc_state |= CAM_RELEASE_SIMQ; } - splx(s); + crit_exit(); } else { struct bus_dma_segment seg; @@ -1007,12 +999,12 @@ gdt_cache_cmd(struct gdt_softc *gdt, union ccb *ccb, int *lock) gdtexecuteccb(gccb, segs, ccb->csio.sglist_cnt, 0); } - *lock = splcam(); + crit_enter(); return (gccb); } static struct gdt_ccb * -gdt_ioctl_cmd(struct gdt_softc *gdt, gdt_ucmd_t *ucmd, int *lock) +gdt_ioctl_cmd(struct gdt_softc *gdt, gdt_ucmd_t *ucmd) { struct gdt_ccb *gccb; u_int32_t cnt; @@ -1078,7 +1070,7 @@ gdt_ioctl_cmd(struct gdt_softc *gdt, gdt_ucmd_t *ucmd, int *lock) if (gdt->sc_cmd_cnt == 0) gdt->sc_set_sema0(gdt); - splx(*lock); + crit_exit(); /* fill cmd structure */ gdt_enc32(gdt->sc_cmd + GDT_CMD_COMMANDINDEX, @@ -1148,7 +1140,7 @@ gdt_ioctl_cmd(struct gdt_softc *gdt, gdt_ucmd_t *ucmd, int *lock) GDT_SG_LEN, ucmd->u.raw.sdlen); } - *lock = splcam(); + crit_enter(); gdt_stat.sg_count_act = 1; gdt->sc_copy_cmd(gdt, gccb); return (gccb); @@ -1249,9 +1241,9 @@ gdtexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) struct gdt_ccb *gccb; union ccb *ccb; struct gdt_softc *gdt; - int i, lock; + int i; - lock = splcam(); + crit_enter(); gccb = (struct gdt_ccb *)arg; ccb = gccb->gc_ccb; @@ -1316,7 +1308,7 @@ gdtexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) iir_timeout, gccb); gdt->sc_copy_cmd(gdt, gccb); - splx(lock); + crit_exit(); } @@ -1324,7 +1316,7 @@ static void iir_action( struct cam_sim *sim, union ccb *ccb ) { struct gdt_softc *gdt; - int lock, bus, target, lun; + int bus, target, lun; gdt = (struct gdt_softc *)cam_sim_softc( sim ); ccb->ccb_h.ccb_sim_ptr = sim; @@ -1341,12 +1333,12 @@ iir_action( struct cam_sim *sim, union ccb *ccb ) switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: - lock = splcam(); + crit_enter(); TAILQ_INSERT_TAIL(&gdt->sc_ccb_queue, &ccb->ccb_h, sim_links.tqe); ++gdt_stat.req_queue_act; if (gdt_stat.req_queue_act > gdt_stat.req_queue_max) gdt_stat.req_queue_max = gdt_stat.req_queue_act; - splx(lock); + crit_exit(); gdt_next(gdt); break; case XPT_RESET_DEV: /* Bus Device Reset the specified SCSI device */ @@ -1514,7 +1506,7 @@ iir_shutdown( void *arg, int howto ) struct gdt_softc *gdt; struct gdt_ccb *gccb; gdt_ucmd_t *ucmd; - int lock, i; + int i; gdt = (struct gdt_softc *)arg; GDT_DPRINTF(GDT_D_CMD, ("iir_shutdown(%p, %d)\n", gdt, howto)); @@ -1526,9 +1518,9 @@ iir_shutdown( void *arg, int howto ) ucmd = malloc(sizeof(gdt_ucmd_t), M_DEVBUF, M_INTWAIT | M_ZERO); /* wait for pending IOs */ - lock = splcam(); + crit_enter(); gdt->sc_state = GDT_SHUTDOWN; - splx(lock); + crit_exit(); if ((gccb = SLIST_FIRST(&gdt->sc_pending_gccb)) != NULL) (void) tsleep((void *)gccb, PCATCH, "iirshw", 100 * hz); @@ -1538,10 +1530,10 @@ iir_shutdown( void *arg, int howto ) ucmd->service = GDT_CACHESERVICE; ucmd->OpCode = GDT_FLUSH; ucmd->u.cache.DeviceNo = i; - lock = splcam(); + crit_enter(); TAILQ_INSERT_TAIL(&gdt->sc_ucmd_queue, ucmd, links); ucmd->complete_flag = FALSE; - splx(lock); + crit_exit(); gdt_next(gdt); if (!ucmd->complete_flag) (void) tsleep((void *)ucmd, PCATCH, "iirshw", 10*hz); @@ -1557,7 +1549,6 @@ iir_intr(void *arg) { struct gdt_softc *gdt = arg; struct gdt_intr_ctx ctx; - int lock = 0; struct gdt_ccb *gccb; gdt_ucmd_t *ucmd; u_int32_t cnt; @@ -1570,13 +1561,13 @@ iir_intr(void *arg) return; if (!(gdt->sc_state & GDT_POLLING)) - lock = splcam(); + crit_enter(); gdt_wait_index = 0; ctx.istatus = gdt->sc_get_status(gdt); if (!ctx.istatus) { if (!(gdt->sc_state & GDT_POLLING)) - splx(lock); + crit_exit(); gdt->sc_status = GDT_S_NO_STATUS; return; } @@ -1596,7 +1587,7 @@ iir_intr(void *arg) if (ctx.istatus == GDT_ASYNCINDEX) { gdt_async_event(gdt, ctx.service); if (!(gdt->sc_state & GDT_POLLING)) - splx(lock); + crit_exit(); return; } if (ctx.istatus == GDT_SPEZINDEX) { @@ -1607,7 +1598,7 @@ iir_intr(void *arg) gdt->sc_dvr.eu.driver.ionode = gdt->sc_hanum; gdt_store_event(GDT_ES_DRIVER, 4, &gdt->sc_dvr); if (!(gdt->sc_state & GDT_POLLING)) - splx(lock); + crit_exit(); return; } @@ -1627,7 +1618,7 @@ iir_intr(void *arg) case GDT_GCF_INTERNAL: if (!(gdt->sc_state & GDT_POLLING)) - splx(lock); + crit_exit(); break; case GDT_GCF_IOCTL: @@ -1637,7 +1628,7 @@ iir_intr(void *arg) gdt, gccb)); TAILQ_INSERT_HEAD(&gdt->sc_ucmd_queue, ucmd, links); if (!(gdt->sc_state & GDT_POLLING)) - splx(lock); + crit_exit(); } else { ucmd->status = gdt->sc_status; ucmd->info = gdt->sc_info; @@ -1661,7 +1652,7 @@ iir_intr(void *arg) } gdt_free_ccb(gdt, gccb); if (!(gdt->sc_state & GDT_POLLING)) - splx(lock); + crit_exit(); /* wakeup */ wakeup(ucmd); } @@ -1672,7 +1663,7 @@ iir_intr(void *arg) gdt_free_ccb(gdt, gccb); gdt_sync_event(gdt, ctx.service, ctx.istatus, gccb); if (!(gdt->sc_state & GDT_POLLING)) - splx(lock); + crit_exit(); gdt_next(gdt); break; } @@ -1946,10 +1937,10 @@ gdt_evt_str *gdt_store_event(u_int16_t source, u_int16_t idx, int gdt_read_event(int handle, gdt_evt_str *estr) { gdt_evt_str *e; - int eindex, lock; + int eindex; GDT_DPRINTF(GDT_D_MISC, ("gdt_read_event(%d)\n", handle)); - lock = splcam(); + crit_enter(); if (handle == -1) eindex = eoldidx; else @@ -1957,7 +1948,7 @@ int gdt_read_event(int handle, gdt_evt_str *estr) estr->event_source = 0; if (eindex >= GDT_MAX_EVENTS) { - splx(lock); + crit_exit(); return eindex; } e = &ebuffer[eindex]; @@ -1970,7 +1961,7 @@ int gdt_read_event(int handle, gdt_evt_str *estr) } memcpy(estr, e, sizeof(gdt_evt_str)); } - splx(lock); + crit_exit(); return eindex; } @@ -1978,10 +1969,10 @@ void gdt_readapp_event(u_int8_t application, gdt_evt_str *estr) { gdt_evt_str *e; int found = FALSE; - int eindex, lock; + int eindex; GDT_DPRINTF(GDT_D_MISC, ("gdt_readapp_event(%d)\n", application)); - lock = splcam(); + crit_enter(); eindex = eoldidx; for (;;) { e = &ebuffer[eindex]; @@ -2001,7 +1992,7 @@ void gdt_readapp_event(u_int8_t application, gdt_evt_str *estr) memcpy(estr, e, sizeof(gdt_evt_str)); else estr->event_source = 0; - splx(lock); + crit_exit(); } void gdt_clear_events() diff --git a/sys/dev/raid/iir/iir_ctrl.c b/sys/dev/raid/iir/iir_ctrl.c index 6c2793eeb8..cccb787d8c 100644 --- a/sys/dev/raid/iir/iir_ctrl.c +++ b/sys/dev/raid/iir/iir_ctrl.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/iir/iir_ctrl.c,v 1.2.2.4 2002/05/05 08:18:12 asmodai Exp $ */ -/* $DragonFly: src/sys/dev/raid/iir/iir_ctrl.c,v 1.8 2005/05/06 11:27:51 corecode Exp $ */ +/* $DragonFly: src/sys/dev/raid/iir/iir_ctrl.c,v 1.9 2005/06/10 15:46:31 swildner Exp $ */ /* * Copyright (c) 2000-01 Intel Corporation * All Rights Reserved @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -250,16 +251,15 @@ iir_ioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, d_thread_t * p) { gdt_ucmd_t *ucmd; struct gdt_softc *gdt; - int lock; ucmd = (gdt_ucmd_t *)cmdarg; gdt = gdt_minor2softc(ucmd->io_node); if (gdt == NULL) return (ENXIO); - lock = splcam(); + crit_enter(); TAILQ_INSERT_TAIL(&gdt->sc_ucmd_queue, ucmd, links); ucmd->complete_flag = FALSE; - splx(lock); + crit_exit(); gdt_next(gdt); if (!ucmd->complete_flag) (void) tsleep((void *)ucmd, PCATCH, "iirucw", 0); @@ -315,7 +315,6 @@ iir_ioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, d_thread_t * p) case GDT_IOCTL_EVENT: { gdt_event_t *p; - int lock; p = (gdt_event_t *)cmdarg; if (p->erase == 0xff) { @@ -327,14 +326,14 @@ iir_ioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, d_thread_t * p) p->dvr.event_data.size = sizeof(p->dvr.event_data.eu.sync); else p->dvr.event_data.size = sizeof(p->dvr.event_data.eu.async); - lock = splcam(); + crit_enter(); gdt_store_event(p->dvr.event_source, p->dvr.event_idx, &p->dvr.event_data); - splx(lock); + crit_exit(); } else if (p->erase == 0xfe) { - lock = splcam(); + crit_enter(); gdt_clear_events(); - splx(lock); + crit_exit(); } else if (p->erase == 0) { p->handle = gdt_read_event(p->handle, &p->dvr); } else { -- 2.41.0