CVS commit: [jmcneill-audiomp3] src/sys/dev/ebus
Module Name:src Committed By: macallan Date: Wed Nov 23 16:53:57 UTC 2011 Modified Files: src/sys/dev/ebus [jmcneill-audiomp3]: cs4231_ebus.c Log Message: initialize locks now this works on my U60 To generate a diff of this commit: cvs rdiff -u -r1.34.4.3 -r1.34.4.4 src/sys/dev/ebus/cs4231_ebus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ebus/cs4231_ebus.c diff -u src/sys/dev/ebus/cs4231_ebus.c:1.34.4.3 src/sys/dev/ebus/cs4231_ebus.c:1.34.4.4 --- src/sys/dev/ebus/cs4231_ebus.c:1.34.4.3 Tue Nov 22 22:47:05 2011 +++ src/sys/dev/ebus/cs4231_ebus.c Wed Nov 23 16:53:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_ebus.c,v 1.34.4.3 2011/11/22 22:47:05 jmcneill Exp $ */ +/* $NetBSD: cs4231_ebus.c,v 1.34.4.4 2011/11/23 16:53:57 macallan Exp $ */ /* * Copyright (c) 2002 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cs4231_ebus.c,v 1.34.4.3 2011/11/22 22:47:05 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cs4231_ebus.c,v 1.34.4.4 2011/11/23 16:53:57 macallan Exp $); #ifdef _KERNEL_OPT #include opt_sparc_arch.h @@ -248,6 +248,8 @@ cs4231_ebus_attach(device_t parent, devi return; } + ad1848_init_locks(sc-sc_ad1848, IPL_SCHED); + /* establish interrupt channels */ for (i = 0; i ea-ea_nintr; ++i) bus_intr_establish(ea-ea_bustag,
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: macallan Date: Wed Nov 23 16:55:24 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: audiocs at ebus works on sparc64 To generate a diff of this commit: cvs rdiff -u -r1.1.2.27 -r1.1.2.28 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.27 src/sys/dev/TODO.audiomp:1.1.2.28 --- src/sys/dev/TODO.audiomp:1.1.2.27 Tue Nov 22 18:29:06 2011 +++ src/sys/dev/TODO.audiomp Wed Nov 23 16:55:24 2011 @@ -17,7 +17,7 @@ arch/sparc/dev/audioamd.c done arch/x68k/dev/vs.c done arch/zaurus/dev/zaudio.c done dev/bluetooth/btsco.c done -dev/ebus/cs4231_ebus.c done +dev/ebus/cs4231_ebus.c done port-sparc64 dev/ic/interwave.c done dev/ic/mpu.c done dev/ic/opl.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jakllsch Date: Wed Nov 23 18:43:53 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: wss(4) and clcs(4) tested successfully To generate a diff of this commit: cvs rdiff -u -r1.1.2.28 -r1.1.2.29 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.28 src/sys/dev/TODO.audiomp:1.1.2.29 --- src/sys/dev/TODO.audiomp:1.1.2.28 Wed Nov 23 16:55:24 2011 +++ src/sys/dev/TODO.audiomp Wed Nov 23 18:43:53 2011 @@ -27,7 +27,7 @@ dev/isa/ess.c done port-shark dev/isa/gus.c done dev/isa/pas.c done dev/isa/sb.c done port-i386 -dev/isa/wss.c done +dev/isa/wss.c done port-i386 dev/isa/ym.c done port-i386 dev/isapnp/mpu_isapnp.c done dev/pad/pad.c done @@ -38,7 +38,7 @@ dev/pci/autri.c done port-sparc64 dev/pci/auvia.c done dev/pci/azalia.c done port-i386 dev/pci/cmpci.c done -dev/pci/cs4280.c done +dev/pci/cs4280.c done port-i386 dev/pci/cs4281.c done dev/pci/eap.c done port-i386 dev/pci/emuxki.c done port-amd64
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Tue Nov 22 08:55:44 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: midictl.c Log Message: - make this not crash with midiplay -l anymore by killing store_thread() with kthread_exit() instead of return - adjust wait channels to be unique - add some asserts that insert it not called while destroy is in progress - note some probably dead code with KASSERT(FALSE) for now To generate a diff of this commit: cvs rdiff -u -r1.6.32.2 -r1.6.32.3 src/sys/dev/midictl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/midictl.c diff -u src/sys/dev/midictl.c:1.6.32.2 src/sys/dev/midictl.c:1.6.32.3 --- src/sys/dev/midictl.c:1.6.32.2 Tue Nov 22 06:11:12 2011 +++ src/sys/dev/midictl.c Tue Nov 22 08:55:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: midictl.c,v 1.6.32.2 2011/11/22 06:11:12 mrg Exp $ */ +/* $NetBSD: midictl.c,v 1.6.32.3 2011/11/22 08:55:44 mrg Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: midictl.c,v 1.6.32.2 2011/11/22 06:11:12 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: midictl.c,v 1.6.32.3 2011/11/22 08:55:44 mrg Exp $); /* * See midictl.h for an overview of the purpose and use of this module. @@ -188,9 +188,9 @@ midictl_open(midictl *mc) return ENOMEM; } s-lock = mc-lock; - cv_init(s-cv, midictl); + cv_init(s-cv, midictlv); error = kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, store_thread, - s, NULL, midictl); + s, NULL, midictlt); if (error != 0) { printf(midictl: cannot create kthread, error = %d\n, error); cv_destroy(s-cv); @@ -225,6 +225,7 @@ midictl_change(midictl *mc, uint_fast8_t _Bool islsb, present; KASSERT(mutex_owned(mc-lock)); + KASSERT(!mc-store-destroy); switch ( ctlval[0] ) { /* @@ -352,6 +353,7 @@ midictl_read(midictl *mc, uint_fast8_t c _Bool islsb, present; KASSERT(mutex_owned(mc-lock)); + KASSERT(!mc-store-destroy); key = ctlr; c = classify(key, islsb); @@ -388,6 +390,7 @@ midictl_rpn_read(midictl *mc, uint_fast8 { KASSERT(mutex_owned(mc-lock)); + KASSERT(!mc-store-destroy); return read14(mc, chan, RPN, ctlr, dflt); } @@ -398,6 +401,7 @@ midictl_nrpn_read(midictl *mc, uint_fast { KASSERT(mutex_owned(mc-lock)); + KASSERT(!mc-store-destroy); return read14(mc, chan, NRPN, ctlr, dflt); } @@ -550,7 +554,7 @@ store_thread(void *arg) cv_destroy(s-cv); kmem_free(s-table, sizeof(*s-table)s-lgcapacity); kmem_free(s, sizeof(*s)); - return; + kthread_exit(0); } else if (NEED_REHASH(s)) { store_rehash(s); } else { @@ -689,20 +693,28 @@ store_rehash(midictl_store *s) mutex_enter(s-lock); if (newtbl == NULL) { - kpause(midictl, false, hz, s-lock); + kpause(midictls, false, hz, s-lock); return; } + /* + * If s-lgcapacity is changed from what we saved int oldlgcap + * then someone else has already done this for us. + * XXXMRG but only function changes s-lgcapacity from its + * initial value, and it is called singled threaded from the + * main store_thread(), so this code seems dead to me. + */ if (oldlgcap != s-lgcapacity) { + KASSERT(FALSE); mutex_exit(s-lock); kmem_free(newtbl, sizeof(*newtbl) newlgcap); mutex_enter(s-lock); return; } - for ( oidx = 1s-lgcapacity ; oidx -- 0 ; ) { - if (!(s-table[oidx] IS_USED) ) + for (oidx = 1 s-lgcapacity ; oidx-- 0 ; ) { + if (!(s-table[oidx] IS_USED)) continue; - if ( s-table[oidx] IS_CTL7 ) + if (s-table[oidx] IS_CTL7) mask = 0x; else mask = 0x3f;
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Tue Nov 22 11:50:02 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: sequencer.c Log Message: more steps towards making this work: - avoid using uninitialised memory to get a pointer, this fixes hangs in sequencerwrite() and general mayhem when it corrupts random other memory. - re-take sc-lock in sequencewrite() when continuing from the main loop. To generate a diff of this commit: cvs rdiff -u -r1.52.14.3 -r1.52.14.4 src/sys/dev/sequencer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sequencer.c diff -u src/sys/dev/sequencer.c:1.52.14.3 src/sys/dev/sequencer.c:1.52.14.4 --- src/sys/dev/sequencer.c:1.52.14.3 Tue Nov 22 07:57:23 2011 +++ src/sys/dev/sequencer.c Tue Nov 22 11:50:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sequencer.c,v 1.52.14.3 2011/11/22 07:57:23 mrg Exp $ */ +/* $NetBSD: sequencer.c,v 1.52.14.4 2011/11/22 11:50:02 mrg Exp $ */ /* * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.52.14.3 2011/11/22 07:57:23 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.52.14.4 2011/11/22 11:50:02 mrg Exp $); #include sequencer.h @@ -240,7 +240,7 @@ sequenceropen(dev_t dev, int flags, int if ((error = sequencer_enter(dev, sc)) != 0) return error; - sc = seqdevs[unit]; + KASSERT(sc == seqdevs[unit]); if (sc-isopen != 0) { sequencer_exit(sc); return EBUSY; @@ -296,7 +296,7 @@ sequenceropen(dev_t dev, int flags, int seq_reset(sc); sequencer_exit(sc); - DPRINTF((sequenceropen: mode=%d, nmidi=%d\n, sc-mode, sc-nmidi)); + DPRINTF((%s: mode=%d, nmidi=%d\n, __func__, sc-mode, sc-nmidi)); return 0; } @@ -310,7 +310,7 @@ seq_drain(struct sequencer_softc *sc) DPRINTFN(3, (seq_drain: %p, len=%d\n, sc, SEQ_QLEN(sc-outq))); seq_startoutput(sc); error = 0; - while(!SEQ_QEMPTY(sc-outq) !error) + while (!SEQ_QEMPTY(sc-outq) !error) error = cv_timedwait_sig(sc-wchan, sc-lock, 60*hz); return (error); } @@ -357,7 +357,7 @@ seq_startoutput(struct sequencer_softc * if (sc-timeout) return; DPRINTFN(4, (seq_startoutput: %p, len=%d\n, sc, SEQ_QLEN(q))); - while(!SEQ_QEMPTY(q) !sc-timeout) { + while (!SEQ_QEMPTY(q) !sc-timeout) { SEQ_QGET(q, cmd); seq_do_command(sc, cmd); } @@ -410,7 +410,6 @@ static int seq_input_event(struct sequencer_softc *sc, seq_event_t *cmd) { struct sequencer_queue *q; - proc_t *p; KASSERT(mutex_owned(sc-lock)); @@ -427,6 +426,8 @@ seq_input_event(struct sequencer_softc * cv_broadcast(sc-rchan); selnotify(sc-rsel, 0, NOTE_SUBMIT); if (sc-async != 0) { + proc_t *p; + mutex_enter(proc_lock); if ((p = proc_find(sc-async)) != NULL) psignal(p, SIGIO); @@ -448,6 +449,7 @@ seq_softintr(void *addr) sc = addr; mutex_enter(sc-lock); + qi.qi_ptr = pcq_get(sc-pcq); if (qi.qi_ptr == NULL) { mutex_exit(sc-lock); @@ -516,9 +518,10 @@ sequencerread(dev_t dev, struct uio *uio DPRINTFN(20, (sequencerread: %PRIx64, count=%d, ioflag=%x\n, dev, (int)uio-uio_resid, ioflag)); - q = sc-inq; if ((error = sequencer_enter(dev, sc)) != 0) return error; + q = sc-inq; + if (sc-mode == SEQ_OLD) { sequencer_exit(sc); DPRINTFN(-1,(sequencerread: old read\n)); @@ -563,22 +566,24 @@ sequencerwrite(dev_t dev, struct uio *ui DPRINTFN(2, (sequencerwrite: %PRIx64, count=%d\n, dev, (int)uio-uio_resid)); - q = sc-outq; - if ((error = sequencer_enter(dev, sc)) != 0) return error; + q = sc-outq; + size = sc-mode == SEQ_NEW ? sizeof cmdbuf : SEQOLD_CMDSIZE; while (uio-uio_resid = size error == 0) { mutex_exit(sc-lock); error = uiomove(cmdbuf, size, uio); if (error == 0) { if (sc-mode == SEQ_OLD seq_to_new(cmdbuf, uio)) { +mutex_enter(sc-lock); continue; } if (cmdbuf.tag == SEQ_FULLSIZE) { /* We do it like OSS does, asynchronously */ error = seq_do_fullsize(sc, cmdbuf, uio); if (error == 0) { + mutex_enter(sc-lock); continue; } } @@ -1297,6 +1302,9 @@ midiseq_in(struct midi_dev *md, u_char * struct sequencer_softc *sc; sequencer_pcqitem_t qi; + DPRINTFN(2, (midiseq_in: %p %02x %02x %02x\n, + md, msg[0], msg[1], msg[2])); + sc = md-seq; qi.qi_msg[0] = msg[0];
CVS commit: [jmcneill-audiomp3] src/sys/dev/sbus
Module Name:src Committed By: macallan Date: Tue Nov 22 17:36:01 UTC 2011 Modified Files: src/sys/dev/sbus [jmcneill-audiomp3]: cs4231_sbus.c Log Message: we need to initialize the locks before using them Now this works on my Ultra 1 To generate a diff of this commit: cvs rdiff -u -r1.48.4.2 -r1.48.4.3 src/sys/dev/sbus/cs4231_sbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sbus/cs4231_sbus.c diff -u src/sys/dev/sbus/cs4231_sbus.c:1.48.4.2 src/sys/dev/sbus/cs4231_sbus.c:1.48.4.3 --- src/sys/dev/sbus/cs4231_sbus.c:1.48.4.2 Sun Nov 20 11:41:53 2011 +++ src/sys/dev/sbus/cs4231_sbus.c Tue Nov 22 17:36:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_sbus.c,v 1.48.4.2 2011/11/20 11:41:53 mrg Exp $ */ +/* $NetBSD: cs4231_sbus.c,v 1.48.4.3 2011/11/22 17:36:01 macallan Exp $ */ /*- * Copyright (c) 1998, 1999, 2002, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cs4231_sbus.c,v 1.48.4.2 2011/11/20 11:41:53 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: cs4231_sbus.c,v 1.48.4.3 2011/11/22 17:36:01 macallan Exp $); #include audio.h #if NAUDIO 0 @@ -161,9 +161,9 @@ cs4231_sbus_attach(device_t parent, devi sbsc-sc_bt = sc-sc_bustag = sa-sa_bustag; sc-sc_dmatag = sa-sa_dmatag; - sbsc-sc_pint = sparc_softintr_establish(IPL_VM, + sbsc-sc_pint = sparc_softintr_establish(IPL_SCHED, (void *)cs4231_sbus_pint, sc); - sbsc-sc_rint = sparc_softintr_establish(IPL_VM, + sbsc-sc_rint = sparc_softintr_establish(IPL_SCHED, (void *)cs4231_sbus_rint, sc); /* @@ -188,6 +188,7 @@ cs4231_sbus_attach(device_t parent, devi cs4231_common_attach(sc, self, bh); printf(\n); + ad1848_init_locks(sc-sc_ad1848, IPL_SCHED); /* Establish interrupt channel */ if (sa-sa_nintr) bus_intr_establish(sa-sa_bustag,
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: macallan Date: Tue Nov 22 18:29:06 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: audiocs at sbus works on sparc and sparc64 To generate a diff of this commit: cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.26 src/sys/dev/TODO.audiomp:1.1.2.27 --- src/sys/dev/TODO.audiomp:1.1.2.26 Tue Nov 22 05:56:43 2011 +++ src/sys/dev/TODO.audiomp Tue Nov 22 18:29:06 2011 @@ -51,7 +51,7 @@ dev/pci/neo.c done dev/pci/sv.c done dev/pci/yds.c done dev/pci/hdaudio/hdafg.c done port-i386, port-amd64 -dev/sbus/cs4231_sbus.c done +dev/sbus/cs4231_sbus.c done port-sparc, port-sparc64 dev/sbus/dbri.c done port-sparc dev/tc/bba.c done dev/usb/uaudio.c done port-amd64
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Mon Nov 21 11:21:04 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: i tested azalia To generate a diff of this commit: cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.17 src/sys/dev/TODO.audiomp:1.1.2.18 --- src/sys/dev/TODO.audiomp:1.1.2.17 Sun Nov 20 19:26:34 2011 +++ src/sys/dev/TODO.audiomp Mon Nov 21 11:21:04 2011 @@ -36,7 +36,7 @@ dev/pci/auich.c done dev/pci/auixp.c done dev/pci/autri.c done dev/pci/auvia.c done -dev/pci/azalia.c done +dev/pci/azalia.c done port-i386 dev/pci/cmpci.c done dev/pci/cs4280.c done dev/pci/cs4281.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: macallan Date: Tue Nov 22 00:19:30 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: I tested autri To generate a diff of this commit: cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.20 src/sys/dev/TODO.audiomp:1.1.2.21 --- src/sys/dev/TODO.audiomp:1.1.2.20 Mon Nov 21 21:39:44 2011 +++ src/sys/dev/TODO.audiomp Tue Nov 22 00:19:30 2011 @@ -34,7 +34,7 @@ dev/pad/pad.c done dev/pci/auacer.c done dev/pci/auich.c done port-amd64 dev/pci/auixp.c done -dev/pci/autri.c done +dev/pci/autri.c done port-sparc64 dev/pci/auvia.c done dev/pci/azalia.c done port-i386 dev/pci/cmpci.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: macallan Date: Tue Nov 22 00:49:38 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: awacs works now To generate a diff of this commit: cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.21 src/sys/dev/TODO.audiomp:1.1.2.22 --- src/sys/dev/TODO.audiomp:1.1.2.21 Tue Nov 22 00:19:30 2011 +++ src/sys/dev/TODO.audiomp Tue Nov 22 00:49:37 2011 @@ -8,7 +8,7 @@ arcm/arm/xscale/pxa2x0_ac97.c done arch/dreamcast/dev/g2/aica.c done arch/hp700/gsc/harmony.c done arch/hpcmips/vr/vraiu.c done -arch/macppc/dev/awacs.c +arch/macppc/dev/awacs.c done port-macppc arch/macppc/dev/snapper.c arch/prep/isa/paud_isa.c done arch/sgimips/hpc/haltwo.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev/usb
Module Name:src Committed By: mrg Date: Tue Nov 22 02:39:59 UTC 2011 Modified Files: src/sys/dev/usb [jmcneill-audiomp3]: uaudio.c Log Message: port to audiomp. mostly from jared, tested and completed by me. this one is a little more tricky. besides the usual spl and get_locks changes, we have to deal with the USB subsystem wanting to sleep and expecting to be called with the kernel lock held. so we always take the kernel lock and drop the interrupt lock before calling into usbd. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.120.10.1 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.120 src/sys/dev/usb/uaudio.c:1.120.10.1 --- src/sys/dev/usb/uaudio.c:1.120 Tue Dec 28 20:11:18 2010 +++ src/sys/dev/usb/uaudio.c Tue Nov 22 02:39:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.120 2010/12/28 20:11:18 jakllsch Exp $ */ +/* $NetBSD: uaudio.c,v 1.120.10.1 2011/11/22 02:39:59 mrg Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uaudio.c,v 1.120 2010/12/28 20:11:18 jakllsch Exp $); +__KERNEL_RCSID(0, $NetBSD: uaudio.c,v 1.120.10.1 2011/11/22 02:39:59 mrg Exp $); #include sys/param.h #include sys/systm.h @@ -155,8 +155,18 @@ struct chan { struct uaudio_softc *sc; /* our softc */ }; +/* + * XXX Locking notes: + * + *The MI USB audio subsystem is not MP-SAFE. Our strategy here + *is to ensure we have the kernel lock held when calling into + *usbd, and, generally, to have dropped the sc_intr_lock during + *these sections as well since the usb code will sleep. + */ struct uaudio_softc { device_t sc_dev; /* base device */ + kmutex_t sc_lock; + kmutex_t sc_intr_lock; usbd_device_handle sc_udev; /* USB device */ int sc_ac_iface; /* Audio Control interface */ usbd_interface_handle sc_ac_ifaceh; @@ -322,6 +332,7 @@ Static int uaudio_mixer_set_port(void *, Static int uaudio_mixer_get_port(void *, mixer_ctrl_t *); Static int uaudio_query_devinfo(void *, mixer_devinfo_t *); Static int uaudio_get_props(void *); +Static void uaudio_get_locks(void *, kmutex_t **, kmutex_t **); Static const struct audio_hw_if uaudio_hw_if = { uaudio_open, @@ -352,6 +363,7 @@ Static const struct audio_hw_if uaudio_h uaudio_trigger_input, NULL, NULL, + uaudio_get_locks, }; int uaudio_match(device_t, cfdata_t, void *); @@ -393,6 +405,8 @@ uaudio_attach(device_t parent, device_t sc-sc_dev = self; sc-sc_udev = uaa-device; + mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_USB); strlcpy(sc-sc_adev.name, USB audio, sizeof(sc-sc_adev.name)); strlcpy(sc-sc_adev.version, , sizeof(sc-sc_adev.version)); @@ -519,6 +533,10 @@ uaudio_detach(device_t self, int flags) if (sc-sc_formats != NULL) free(sc-sc_formats, M_USBDEV); auconv_delete_encodings(sc-sc_encodings); + + mutex_destroy(sc-sc_lock); + mutex_destroy(sc-sc_intr_lock); + return rv; } @@ -2173,10 +2191,12 @@ uaudio_close(void *addr) Static int uaudio_drain(void *addr) { - struct uaudio_softc *sc; + struct uaudio_softc *sc = addr; - sc = addr; - usbd_delay_ms(sc-sc_udev, UAUDIO_NCHANBUFS * UAUDIO_NFRAMES); + KASSERT(mutex_owned(sc-sc_intr_lock)); + + kpause(uaudiodr, false, + mstohz(UAUDIO_NCHANBUFS * UAUDIO_NFRAMES), sc-sc_intr_lock); return 0; } @@ -2184,32 +2204,42 @@ uaudio_drain(void *addr) Static int uaudio_halt_out_dma(void *addr) { - struct uaudio_softc *sc; + struct uaudio_softc *sc = addr; DPRINTF((uaudio_halt_out_dma: enter\n)); - sc = addr; + + KERNEL_LOCK(1, curlwp); + mutex_spin_exit(sc-sc_intr_lock); if (sc-sc_playchan.pipe != NULL) { uaudio_chan_close(sc, sc-sc_playchan); sc-sc_playchan.pipe = NULL; uaudio_chan_free_buffers(sc, sc-sc_playchan); sc-sc_playchan.intr = NULL; } + mutex_spin_enter(sc-sc_intr_lock); + KERNEL_UNLOCK_ONE(curlwp); + return 0; } Static int uaudio_halt_in_dma(void *addr) { - struct uaudio_softc *sc; + struct uaudio_softc *sc = addr; DPRINTF((uaudio_halt_in_dma: enter\n)); - sc = addr; + + KERNEL_LOCK(1, curlwp); + mutex_spin_exit(sc-sc_intr_lock); if (sc-sc_recchan.pipe != NULL) { uaudio_chan_close(sc, sc-sc_recchan); sc-sc_recchan.pipe = NULL; uaudio_chan_free_buffers(sc, sc-sc_recchan); sc-sc_recchan.intr = NULL; } + mutex_spin_enter(sc-sc_intr_lock); + KERNEL_UNLOCK_ONE(curlwp); + return 0; } @@ -2283,6 +2313,16 @@ uaudio_get_props(void *addr) } +Static void +uaudio_get_locks(void *addr, kmutex_t **intr, kmutex_t **thread) +{ + struct uaudio_softc *sc; + + sc = addr; + *intr = sc-sc_intr_lock; + *thread = sc-sc_lock; +} + Static int uaudio_get(struct uaudio_softc *sc, int which, int type, int wValue, int wIndex, int len) @@ -2412,8 +2452,10 @@
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Tue Nov 22 02:43:59 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: note3 uaudio and hdafg on amd64. To generate a diff of this commit: cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.22 src/sys/dev/TODO.audiomp:1.1.2.23 --- src/sys/dev/TODO.audiomp:1.1.2.22 Tue Nov 22 00:49:37 2011 +++ src/sys/dev/TODO.audiomp Tue Nov 22 02:43:59 2011 @@ -50,9 +50,9 @@ dev/pci/gcscaudio.c done dev/pci/neo.c done dev/pci/sv.c done dev/pci/yds.c done -dev/pci/hdaudio/hdafg.c done port-i386 +dev/pci/hdaudio/hdafg.c done port-i386, port-amd64 dev/sbus/cs4231_sbus.c done dev/sbus/dbri.c done dev/tc/bba.c done -dev/usb/uaudio.c +dev/usb/uaudio.c done port-amd64 dev/usb/umidi.c
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Tue Nov 22 03:02:14 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: dbri works on sparc. To generate a diff of this commit: cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.23 src/sys/dev/TODO.audiomp:1.1.2.24 --- src/sys/dev/TODO.audiomp:1.1.2.23 Tue Nov 22 02:43:59 2011 +++ src/sys/dev/TODO.audiomp Tue Nov 22 03:02:14 2011 @@ -52,7 +52,7 @@ dev/pci/sv.c done dev/pci/yds.c done dev/pci/hdaudio/hdafg.c done port-i386, port-amd64 dev/sbus/cs4231_sbus.c done -dev/sbus/dbri.c done +dev/sbus/dbri.c done port-sparc dev/tc/bba.c done dev/usb/uaudio.c done port-amd64 dev/usb/umidi.c
CVS commit: [jmcneill-audiomp3] src/sys/dev/isa
Module Name:src Committed By: jakllsch Date: Tue Nov 22 03:02:53 UTC 2011 Modified Files: src/sys/dev/isa [jmcneill-audiomp3]: ad1848_isa.c Log Message: don't attempt to obtain the intr mutex again, only KASSERT we own it already To generate a diff of this commit: cvs rdiff -u -r1.37.4.1 -r1.37.4.2 src/sys/dev/isa/ad1848_isa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/ad1848_isa.c diff -u src/sys/dev/isa/ad1848_isa.c:1.37.4.1 src/sys/dev/isa/ad1848_isa.c:1.37.4.2 --- src/sys/dev/isa/ad1848_isa.c:1.37.4.1 Sat Nov 19 21:49:37 2011 +++ src/sys/dev/isa/ad1848_isa.c Tue Nov 22 03:02:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ad1848_isa.c,v 1.37.4.1 2011/11/19 21:49:37 jmcneill Exp $ */ +/* $NetBSD: ad1848_isa.c,v 1.37.4.2 2011/11/22 03:02:53 jakllsch Exp $ */ /*- * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ad1848_isa.c,v 1.37.4.1 2011/11/19 21:49:37 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ad1848_isa.c,v 1.37.4.2 2011/11/22 03:02:53 jakllsch Exp $); #include sys/param.h #include sys/systm.h @@ -502,9 +502,8 @@ ad1848_isa_open(void *addr, int flags) #ifndef AUDIO_NO_POWER_CTL /* Power-up chip */ if (isc-powerctl) { - mutex_spin_enter(sc-sc_intr_lock); + KASSERT(mutex_owned(sc-sc_intr_lock)); isc-powerctl(isc-powerarg, flags); - mutex_spin_exit(sc-sc_intr_lock); } #endif @@ -515,9 +514,8 @@ ad1848_isa_open(void *addr, int flags) if (error) { #ifndef AUDIO_NO_POWER_CTL if (isc-powerctl) { - mutex_spin_enter(sc-sc_intr_lock); + KASSERT(mutex_owned(sc-sc_intr_lock)); isc-powerctl(isc-powerarg, 0); - mutex_spin_exit(sc-sc_intr_lock); } #endif goto bad; @@ -549,9 +547,8 @@ ad1848_isa_close(void *addr) #ifndef AUDIO_NO_POWER_CTL /* Power-down chip */ if (isc-powerctl) { - mutex_spin_enter(sc-sc_intr_lock); + KASSERT(mutex_owned(sc-sc_intr_lock)); isc-powerctl(isc-powerarg, 0); - mutex_spin_exit(sc-sc_intr_lock); } #endif
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jakllsch Date: Tue Nov 22 03:07:31 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: ym(4) successfully tested lightly on i386 To generate a diff of this commit: cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.24 src/sys/dev/TODO.audiomp:1.1.2.25 --- src/sys/dev/TODO.audiomp:1.1.2.24 Tue Nov 22 03:02:14 2011 +++ src/sys/dev/TODO.audiomp Tue Nov 22 03:07:30 2011 @@ -28,7 +28,7 @@ dev/isa/gus.c done dev/isa/pas.c done dev/isa/sb.c done port-i386 dev/isa/wss.c done -dev/isa/ym.c done +dev/isa/ym.c done port-i386 dev/isapnp/mpu_isapnp.c done dev/pad/pad.c done dev/pci/auacer.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: macallan Date: Tue Nov 22 05:56:43 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: snapper works To generate a diff of this commit: cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.25 src/sys/dev/TODO.audiomp:1.1.2.26 --- src/sys/dev/TODO.audiomp:1.1.2.25 Tue Nov 22 03:07:30 2011 +++ src/sys/dev/TODO.audiomp Tue Nov 22 05:56:43 2011 @@ -9,7 +9,7 @@ arch/dreamcast/dev/g2/aica.c done arch/hp700/gsc/harmony.c done arch/hpcmips/vr/vraiu.c done arch/macppc/dev/awacs.c done port-macppc -arch/macppc/dev/snapper.c +arch/macppc/dev/snapper.c done port-macppc, TAS3004 only arch/prep/isa/paud_isa.c done arch/sgimips/hpc/haltwo.c done arch/sgimips/mace/mavb.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Tue Nov 22 06:11:12 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: midictl.c Log Message: avoid one use-after-free error. midi_store-lock is unlocked after we cv_broadcast() to get the midi_store freed. keep a local copy of the lock pointer to avoid this. To generate a diff of this commit: cvs rdiff -u -r1.6.32.1 -r1.6.32.2 src/sys/dev/midictl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/midictl.c diff -u src/sys/dev/midictl.c:1.6.32.1 src/sys/dev/midictl.c:1.6.32.2 --- src/sys/dev/midictl.c:1.6.32.1 Sat Nov 19 21:49:35 2011 +++ src/sys/dev/midictl.c Tue Nov 22 06:11:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: midictl.c,v 1.6.32.1 2011/11/19 21:49:35 jmcneill Exp $ */ +/* $NetBSD: midictl.c,v 1.6.32.2 2011/11/22 06:11:12 mrg Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: midictl.c,v 1.6.32.1 2011/11/19 21:49:35 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: midictl.c,v 1.6.32.2 2011/11/22 06:11:12 mrg Exp $); /* * See midictl.h for an overview of the purpose and use of this module. @@ -206,13 +206,15 @@ void midictl_close(midictl *mc) { midictl_store *s; + kmutex_t *lock; s = mc-store; + lock = s-lock; - mutex_enter(s-lock); + mutex_enter(lock); s-destroy = true; cv_broadcast(s-cv); - mutex_exit(s-lock); + mutex_exit(lock); } void
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Tue Nov 22 07:54:45 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: midi.c Log Message: adjust some DPRINTF*() calls so that they compile now. To generate a diff of this commit: cvs rdiff -u -r1.72.10.1 -r1.72.10.2 src/sys/dev/midi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/midi.c diff -u src/sys/dev/midi.c:1.72.10.1 src/sys/dev/midi.c:1.72.10.2 --- src/sys/dev/midi.c:1.72.10.1 Sat Nov 19 21:49:35 2011 +++ src/sys/dev/midi.c Tue Nov 22 07:54:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: midi.c,v 1.72.10.1 2011/11/19 21:49:35 jmcneill Exp $ */ +/* $NetBSD: midi.c,v 1.72.10.2 2011/11/22 07:54:45 mrg Exp $ */ /* * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: midi.c,v 1.72.10.1 2011/11/19 21:49:35 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: midi.c,v 1.72.10.2 2011/11/22 07:54:45 mrg Exp $); #include midi.h #include sequencer.h @@ -838,11 +838,11 @@ midiclose(dev_t dev, int flags, int ifmt struct midi_softc *sc; const struct midi_hw_if *hw; - DPRINTFN(3,(midiclose %p\n, sc)); - sc = device_lookup_private(midi_cd, MIDIUNIT(dev)); hw = sc-hw_if; + DPRINTFN(3,(midiclose %p\n, sc)); + mutex_enter(sc-lock); /* midi_start_output(sc); anything buffered = pbus already set! */ while (sc-pbus) { @@ -869,13 +869,13 @@ midiread(dev_t dev, struct uio *uio, int MIDI_BUF_DECLARE(idx); MIDI_BUF_DECLARE(buf); - DPRINTFN(6,(midiread: %p, count=%lu\n, sc, - (unsigned long)uio-uio_resid)); - sc = device_lookup_private(midi_cd, MIDIUNIT(dev)); mb = sc-inbuf; first = 1; + DPRINTFN(6,(midiread: %p, count=%lu\n, sc, + (unsigned long)uio-uio_resid)); + mutex_enter(sc-lock); if (sc-dying) { mutex_exit(sc-lock); @@ -1261,7 +1261,7 @@ midi_intr_out(struct midi_softc *sc) softint_schedule(sc-sih); } if (error) { - DPRINTF((midi_intr_output error %d\n, error)) + DPRINTF((midi_intr_output error %d\n, error)); } return error; } @@ -1393,10 +1393,11 @@ midiwrite(dev_t dev, struct uio *uio, in size_t xfrcount; int pollout = 0; + sc = device_lookup_private(midi_cd, MIDIUNIT(dev)); + DPRINTFN(6,(midiwrite: %p, unit=%d, count=%lu\n, sc, (int)minor(dev), (unsigned long)uio-uio_resid)); - sc = device_lookup_private(midi_cd, MIDIUNIT(dev)); mutex_enter(sc-lock); if (sc-dying) { mutex_exit(sc-lock); @@ -1527,14 +1528,14 @@ midiioctl(dev_t dev, u_long cmd, void *a int error; MIDI_BUF_DECLARE(buf); - DPRINTFN(5,(midiioctl: %p cmd=0x%08lx\n, sc, cmd)); - sc = device_lookup_private(midi_cd, MIDIUNIT(dev));; if (sc-dying) return EIO; hw = sc-hw_if; error = 0; + DPRINTFN(5,(midiioctl: %p cmd=0x%08lx\n, sc, cmd)); + switch (cmd) { case FIONBIO: /* All handled in the upper layer. */ @@ -1611,11 +1612,11 @@ midipoll(dev_t dev, int events, struct l MIDI_BUF_DECLARE(idx); MIDI_BUF_DECLARE(buf); - DPRINTFN(6,(midipoll: %p events=0x%x\n, sc, events)); - sc = device_lookup_private(midi_cd, MIDIUNIT(dev)); revents = 0; + DPRINTFN(6,(midipoll: %p events=0x%x\n, sc, events)); + mutex_enter(sc-lock); if (sc-dying) { mutex_exit(sc-lock);
CVS commit: [jmcneill-audiomp3] src/sys/dev/usb
Module Name:src Committed By: mrg Date: Tue Nov 22 07:56:15 UTC 2011 Modified Files: src/sys/dev/usb [jmcneill-audiomp3]: umidi.c umidivar.h Log Message: port umidi to audiomp: get_locks support, take locks in interrupts. untested, and midi in this branch has general problems still anyway. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.44.4.1 src/sys/dev/usb/umidi.c cvs rdiff -u -r1.14 -r1.14.10.1 src/sys/dev/usb/umidivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/umidi.c diff -u src/sys/dev/usb/umidi.c:1.44 src/sys/dev/usb/umidi.c:1.44.4.1 --- src/sys/dev/usb/umidi.c:1.44 Fri Oct 7 19:41:03 2011 +++ src/sys/dev/usb/umidi.c Tue Nov 22 07:56:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: umidi.c,v 1.44 2011/10/07 19:41:03 jakllsch Exp $ */ +/* $NetBSD: umidi.c,v 1.44.4.1 2011/11/22 07:56:15 mrg Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: umidi.c,v 1.44 2011/10/07 19:41:03 jakllsch Exp $); +__KERNEL_RCSID(0, $NetBSD: umidi.c,v 1.44.4.1 2011/11/22 07:56:15 mrg Exp $); #include sys/types.h #include sys/param.h @@ -79,6 +79,7 @@ static int umidi_commonmsg(void *, int, static int umidi_sysex(void *, u_char *, int); static int umidi_rtmsg(void *, int); static void umidi_getinfo(void *, struct midi_info *); +static void umidi_get_locks(void *, kmutex_t **, kmutex_t **); static usbd_status alloc_pipe(struct umidi_endpoint *); static void free_pipe(struct umidi_endpoint *); @@ -127,11 +128,11 @@ static void out_solicit(void *); /* stru const struct midi_hw_if umidi_hw_if = { - umidi_open, - umidi_close, - umidi_rtmsg, - umidi_getinfo, - 0, /* ioctl */ + .open = umidi_open, + .close = umidi_close, + .output = umidi_rtmsg, + .getinfo = umidi_getinfo, + .get_locks = umidi_get_locks, }; struct midi_hw_if_ext umidi_hw_if_ext = { @@ -200,6 +201,8 @@ umidi_attach(device_t parent, device_t s aprint_normal_dev(self, ); umidi_print_quirk(sc-sc_quirk); + mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_USB); err = alloc_all_endpoints(sc); if (err!=USBD_NORMAL_COMPLETION) { @@ -297,6 +300,9 @@ umidi_detach(device_t self, int flags) usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc-sc_udev, sc-sc_dev); + mutex_destroy(sc-sc_lock); + mutex_destroy(sc-sc_intr_lock); + return 0; } @@ -436,6 +442,15 @@ umidi_getinfo(void *addr, struct midi_in midi_register_hw_if_ext(mm? umidi_hw_if_mm : umidi_hw_if_ext); } +static void +umidi_get_locks(void *addr, kmutex_t **intr, kmutex_t **thread) +{ + struct umidi_mididev *mididev = addr; + struct umidi_softc *sc = mididev-sc; + + *intr = sc-sc_intr_lock; + *thread = sc-sc_lock; +} /* * each endpoint stuffs @@ -1547,6 +1562,7 @@ in_intr(usbd_xfer_handle xfer, usbd_priv { int cn, len, i; struct umidi_endpoint *ep = (struct umidi_endpoint *)priv; + struct umidi_softc *sc = ep-sc; struct umidi_jack *jack; unsigned char *packet; umidi_packet_bufp slot; @@ -1557,6 +1573,7 @@ in_intr(usbd_xfer_handle xfer, usbd_priv if (ep-sc-sc_dying || !ep-num_open) return; + mutex_enter(sc-sc_intr_lock); usbd_get_xfer_status(xfer, NULL, NULL, count, NULL); if ( 0 == count % UMIDI_PACKET_SIZE ) { DPRINTFN(200,(%s: input endpoint %p transfer length %u\n, @@ -1588,6 +1605,7 @@ in_intr(usbd_xfer_handle xfer, usbd_priv (unsigned)data[0], (unsigned)data[1], (unsigned)data[2])); + mutex_exit(sc-sc_intr_lock); return; } @@ -1610,6 +1628,7 @@ in_intr(usbd_xfer_handle xfer, usbd_priv } (void)start_input_transfer(ep); + mutex_exit(sc-sc_intr_lock); } static void @@ -1623,6 +1642,7 @@ out_intr(usbd_xfer_handle xfer, usbd_pri if (sc-sc_dying) return; + mutex_enter(sc-sc_intr_lock); #ifdef UMIDI_DEBUG if ( umididebug = 200 ) microtime(umidi_tv); @@ -1657,6 +1677,7 @@ out_intr(usbd_xfer_handle xfer, usbd_pri ep-soliciting = 1; out_solicit(ep); } + mutex_exit(sc-sc_intr_lock); } /* Index: src/sys/dev/usb/umidivar.h diff -u src/sys/dev/usb/umidivar.h:1.14 src/sys/dev/usb/umidivar.h:1.14.10.1 --- src/sys/dev/usb/umidivar.h:1.14 Wed Nov 3 22:34:24 2010 +++ src/sys/dev/usb/umidivar.h Tue Nov 22 07:56:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: umidivar.h,v 1.14 2010/11/03 22:34:24 dyoung Exp $ */ +/* $NetBSD: umidivar.h,v 1.14.10.1 2011/11/22 07:56:15 mrg Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -119,4 +119,7 @@ struct umidi_softc { struct umidi_endpoint *sc_in_ep; struct umidi_endpoint *sc_endpoints; int cblnums_global; + + kmutex_t sc_lock; + kmutex_t sc_intr_lock; };
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Tue Nov 22 07:57:24 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: sequencer.c Log Message: adjust DPRINTF*() calls to actually build. avoid a potential NULl pointer deref. To generate a diff of this commit: cvs rdiff -u -r1.52.14.2 -r1.52.14.3 src/sys/dev/sequencer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sequencer.c diff -u src/sys/dev/sequencer.c:1.52.14.2 src/sys/dev/sequencer.c:1.52.14.3 --- src/sys/dev/sequencer.c:1.52.14.2 Sun Nov 20 20:00:15 2011 +++ src/sys/dev/sequencer.c Tue Nov 22 07:57:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sequencer.c,v 1.52.14.2 2011/11/20 20:00:15 jmcneill Exp $ */ +/* $NetBSD: sequencer.c,v 1.52.14.3 2011/11/22 07:57:23 mrg Exp $ */ /* * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.52.14.2 2011/11/20 20:00:15 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.52.14.3 2011/11/22 07:57:23 mrg Exp $); #include sequencer.h @@ -370,7 +370,7 @@ sequencerclose(dev_t dev, int flags, int struct midi_softc *msc; int unit, error; - DPRINTF((sequencerclose: %d\n, dev)); + DPRINTF((sequencerclose: %PRIx64\n, dev)); if ((error = sequencer_enter(dev, sc)) != 0) return error; @@ -389,7 +389,8 @@ sequencerclose(dev_t dev, int flags, int mutex_exit(sc-lock); for (unit = 0; unit sc-nmidi; unit++) - midiseq_close(sc-devs[unit]); + if (sc-devs[unit] != NULL) + midiseq_close(sc-devs[unit]); if (sc-devs != NULL) { KASSERT(sc-ndevs 0); kmem_free(sc-devs, sc-ndevs * sizeof(struct midi_dev *)); @@ -400,6 +401,8 @@ sequencerclose(dev_t dev, int flags, int sc-isopen = 0; sequencer_exit(sc); + DPRINTF((sequencerclose: %PRIx64 done\n, dev)); + return (0); } @@ -510,7 +513,7 @@ sequencerread(dev_t dev, struct uio *uio seq_event_t ev; int error; - DPRINTFN(20, (sequencerread: %d, count=%d, ioflag=%x\n, + DPRINTFN(20, (sequencerread: %PRIx64, count=%d, ioflag=%x\n, dev, (int)uio-uio_resid, ioflag)); q = sc-inq; @@ -557,7 +560,7 @@ sequencerwrite(dev_t dev, struct uio *ui seq_event_t cmdbuf; int size; - DPRINTFN(2, (sequencerwrite: %d, count=%d\n, dev, + DPRINTFN(2, (sequencerwrite: %PRIx64, count=%d\n, dev, (int)uio-uio_resid)); q = sc-outq; @@ -620,7 +623,7 @@ sequencerioctl(dev_t dev, u_long cmd, vo struct timeval now; u_long tx; - DPRINTFN(2, (sequencerioctl: %d cmd=0x%08lx\n, dev, cmd)); + DPRINTFN(2, (sequencerioctl: %PRIx64 cmd=0x%08lx\n, dev, cmd)); if ((error = sequencer_enter(dev, sc)) != 0) return error;
CVS commit: [jmcneill-audiomp3] src/sys/dev/isa
Module Name:src Committed By: mrg Date: Sun Nov 20 08:40:52 UTC 2011 Modified Files: src/sys/dev/isa [jmcneill-audiomp3]: ess.c Log Message: make sure to return from the end of essattach() before destroying the callouts and mutexes. with an uncommited audio.c change, i can now play audio on my shark with the branch. To generate a diff of this commit: cvs rdiff -u -r1.78.10.1 -r1.78.10.2 src/sys/dev/isa/ess.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/ess.c diff -u src/sys/dev/isa/ess.c:1.78.10.1 src/sys/dev/isa/ess.c:1.78.10.2 --- src/sys/dev/isa/ess.c:1.78.10.1 Sat Nov 19 21:49:37 2011 +++ src/sys/dev/isa/ess.c Sun Nov 20 08:40:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ess.c,v 1.78.10.1 2011/11/19 21:49:37 jmcneill Exp $ */ +/* $NetBSD: ess.c,v 1.78.10.2 2011/11/20 08:40:52 mrg Exp $ */ /* * Copyright 1997 @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ess.c,v 1.78.10.1 2011/11/19 21:49:37 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ess.c,v 1.78.10.2 2011/11/20 08:40:52 mrg Exp $); #include sys/param.h #include sys/systm.h @@ -1076,6 +1076,8 @@ essattach(struct ess_softc *sc, int enab ess_printsc(sc); #endif + return; + fail: callout_destroy(sc-sc_poll1_ch); callout_destroy(sc-sc_poll2_ch);
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Sun Nov 20 09:37:04 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: audio_if.h Log Message: don't need to forward declare 'struct malloc_type' anymore. To generate a diff of this commit: cvs rdiff -u -r1.66.14.1 -r1.66.14.2 src/sys/dev/audio_if.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio_if.h diff -u src/sys/dev/audio_if.h:1.66.14.1 src/sys/dev/audio_if.h:1.66.14.2 --- src/sys/dev/audio_if.h:1.66.14.1 Sat Nov 19 21:49:34 2011 +++ src/sys/dev/audio_if.h Sun Nov 20 09:37:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: audio_if.h,v 1.66.14.1 2011/11/19 21:49:34 jmcneill Exp $ */ +/* $NetBSD: audio_if.h,v 1.66.14.2 2011/11/20 09:37:04 mrg Exp $ */ /* * Copyright (c) 1994 Havard Eidnes. @@ -172,7 +172,6 @@ typedef struct stream_filter_list { } filters[AUDIO_MAX_FILTERS]; } stream_filter_list_t; -struct malloc_type; struct audio_hw_if { int (*open)(void *, int); /* open hardware */ void (*close)(void *); /* close hardware */
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Sun Nov 20 09:40:20 UTC 2011 Modified Files: src/sys/dev/ebus [jmcneill-audiomp3]: cs4231_ebus.c src/sys/dev/ic [jmcneill-audiomp3]: cs4231.c cs4231var.h src/sys/dev/sbus [jmcneill-audiomp3]: cs4231_sbus.c Log Message: make audiocs(4) compile. i don't have anything handy to actually test this easily, but this was just updating the alloc/free to kmem and hooking into ad1848_get_locks(). To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/dev/ebus/cs4231_ebus.c cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/dev/ic/cs4231.c cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/dev/ic/cs4231var.h cvs rdiff -u -r1.48 -r1.48.4.1 src/sys/dev/sbus/cs4231_sbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ebus/cs4231_ebus.c diff -u src/sys/dev/ebus/cs4231_ebus.c:1.34 src/sys/dev/ebus/cs4231_ebus.c:1.34.4.1 --- src/sys/dev/ebus/cs4231_ebus.c:1.34 Thu Jun 2 00:23:28 2011 +++ src/sys/dev/ebus/cs4231_ebus.c Sun Nov 20 09:40:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_ebus.c,v 1.34 2011/06/02 00:23:28 christos Exp $ */ +/* $NetBSD: cs4231_ebus.c,v 1.34.4.1 2011/11/20 09:40:19 mrg Exp $ */ /* * Copyright (c) 2002 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cs4231_ebus.c,v 1.34 2011/06/02 00:23:28 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: cs4231_ebus.c,v 1.34.4.1 2011/11/20 09:40:19 mrg Exp $); #ifdef _KERNEL_OPT #include opt_sparc_arch.h @@ -38,8 +38,9 @@ __KERNEL_RCSID(0, $NetBSD: cs4231_ebus. #include sys/systm.h #include sys/errno.h #include sys/device.h -#include sys/malloc.h #include sys/cpu.h +#include sys/kmem.h +#include sys/malloc.h #include machine/autoconf.h @@ -123,6 +124,7 @@ const struct audio_hw_if audiocs_ebus_hw cs4231_ebus_trigger_input, NULL, /* dev_ioctl */ NULL, /* powerstate */ + ad1848_get_locks, }; #ifdef AUDIO_DEBUG Index: src/sys/dev/ic/cs4231.c diff -u src/sys/dev/ic/cs4231.c:1.26 src/sys/dev/ic/cs4231.c:1.26.4.1 --- src/sys/dev/ic/cs4231.c:1.26 Thu Jun 2 00:23:28 2011 +++ src/sys/dev/ic/cs4231.c Sun Nov 20 09:40:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231.c,v 1.26 2011/06/02 00:23:28 christos Exp $ */ +/* $NetBSD: cs4231.c,v 1.26.4.1 2011/11/20 09:40:19 mrg Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cs4231.c,v 1.26 2011/06/02 00:23:28 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: cs4231.c,v 1.26.4.1 2011/11/20 09:40:19 mrg Exp $); #include audio.h #if NAUDIO 0 @@ -39,8 +39,9 @@ __KERNEL_RCSID(0, $NetBSD: cs4231.c,v 1 #include sys/systm.h #include sys/errno.h #include sys/device.h -#include sys/malloc.h #include sys/bus.h +#include sys/kmem.h +#include sys/malloc.h #include machine/autoconf.h #include sys/cpu.h @@ -175,8 +176,7 @@ cs4231_common_attach(struct cs4231_softc } void * -cs4231_malloc(void *addr, int direction, size_t size, -struct malloc_type *pool, int flags) +cs4231_malloc(void *addr, int direction, size_t size) { struct cs4231_softc *sc; bus_dma_tag_t dmatag; @@ -184,7 +184,7 @@ cs4231_malloc(void *addr, int direction, sc = addr; dmatag = sc-sc_dmatag; - p = malloc(sizeof(*p), pool, flags); + p = kmem_alloc(sizeof(*p), KM_SLEEP); if (p == NULL) return NULL; @@ -221,12 +221,12 @@ fail3: fail2: bus_dmamap_destroy(dmatag, p-dmamap); fail1: - free(p, pool); + kmem_free(p, size); return NULL; } void -cs4231_free(void *addr, void *ptr, struct malloc_type *pool) +cs4231_free(void *addr, void *ptr, size_t size) { struct cs4231_softc *sc; bus_dma_tag_t dmatag; @@ -242,7 +242,7 @@ cs4231_free(void *addr, void *ptr, struc bus_dmamem_free(dmatag, p-segs, p-nsegs); bus_dmamap_destroy(dmatag, p-dmamap); *pp = p-next; - free(p, pool); + kmem_free(p, size); return; } printf(cs4231_free: rogue pointer\n); Index: src/sys/dev/ic/cs4231var.h diff -u src/sys/dev/ic/cs4231var.h:1.9 src/sys/dev/ic/cs4231var.h:1.9.4.1 --- src/sys/dev/ic/cs4231var.h:1.9 Thu Jun 2 00:23:28 2011 +++ src/sys/dev/ic/cs4231var.h Sun Nov 20 09:40:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231var.h,v 1.9 2011/06/02 00:23:28 christos Exp $ */ +/* $NetBSD: cs4231var.h,v 1.9.4.1 2011/11/20 09:40:19 mrg Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -108,7 +108,7 @@ int cs4231_get_port(void *, mixer_ctrl_t int cs4231_query_devinfo(void *, mixer_devinfo_t *); int cs4231_get_props(void *); -void *cs4231_malloc(void *, int, size_t, struct malloc_type *, int); -void cs4231_free(void *, void *, struct malloc_type *); +void *cs4231_malloc(void *, int, size_t); +void cs4231_free(void *, void *, size_t); #endif /* _DEV_IC_CS4231VAR_H_ */ Index: src/sys/dev/sbus/cs4231_sbus.c diff -u src/sys/dev/sbus/cs4231_sbus.c:1.48 src/sys/dev/sbus/cs4231_sbus.c:1.48.4.1 ---
CVS commit: [jmcneill-audiomp3] src/sys/dev/sbus
Module Name:src Committed By: mrg Date: Sun Nov 20 10:48:55 UTC 2011 Modified Files: src/sys/dev/sbus [jmcneill-audiomp3]: dbri.c dbrivar.h Log Message: port to audiomp: update allocm/freem, and add get_locks() support. bots on my ss20, but i haven't really tested it yet. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.33.6.1 src/sys/dev/sbus/dbri.c cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/dev/sbus/dbrivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.33 src/sys/dev/sbus/dbri.c:1.33.6.1 --- src/sys/dev/sbus/dbri.c:1.33 Wed Mar 9 05:40:11 2011 +++ src/sys/dev/sbus/dbri.c Sun Nov 20 10:48:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $ */ +/* $NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $); #include audio.h #if NAUDIO 0 @@ -43,11 +43,11 @@ __KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.3 #include sys/systm.h #include sys/errno.h #include sys/device.h -#include sys/malloc.h #include sys/proc.h #include sys/kernel.h #include sys/bus.h #include sys/intr.h +#include sys/kmem.h #include dev/sbus/sbusvar.h #include sparc/sparc/auxreg.h @@ -156,9 +156,10 @@ static int dbri_trigger_output(void *, v void (*)(void *), void *, const struct audio_params *); static int dbri_trigger_input(void *, void *, void *, int, void (*)(void *), void *, const struct audio_params *); +static void dbri_get_locks(void *, kmutex_t **, kmutex_t **); -static void *dbri_malloc(void *, int, size_t, struct malloc_type *, int); -static void dbri_free(void *, void *, struct malloc_type *); +static void *dbri_malloc(void *, int, size_t); +static void dbri_free(void *, void *, size_t); static paddr_t dbri_mappage(void *, void *, off_t, int); static void dbri_set_power(struct dbri_softc *, int); static void dbri_bring_up(struct dbri_softc *); @@ -175,32 +176,25 @@ struct audio_device dbri_device = { }; struct audio_hw_if dbri_hw_if = { - dbri_open, - dbri_close, - NULL, /* drain */ - dbri_query_encoding, - dbri_set_params, - dbri_round_blocksize, - NULL, /* commit_settings */ - NULL, /* init_output */ - NULL, /* init_input */ - NULL, /* start_output */ - NULL, /* start_input */ - dbri_halt_output, - dbri_halt_input, - NULL, /* speaker_ctl */ - dbri_getdev, - NULL, /* setfd */ - dbri_set_port, - dbri_get_port, - dbri_query_devinfo, - dbri_malloc, - dbri_free, - dbri_round_buffersize, - dbri_mappage, - dbri_get_props, - dbri_trigger_output, - dbri_trigger_input + .open = dbri_open, + .close = dbri_close, + .query_encoding = dbri_query_encoding, + .set_params = dbri_set_params, + .round_blocksize = dbri_round_blocksize, + .halt_output = dbri_halt_output, + .halt_input = dbri_halt_input, + .getdev = dbri_getdev, + .set_port = dbri_set_port, + .get_port = dbri_get_port, + .query_devinfo = dbri_query_devinfo, + .allocm = dbri_malloc, + .freem = dbri_free, + .round_buffersize = dbri_round_buffersize, + .mappage = dbri_mappage, + .get_props = dbri_get_props, + .trigger_output = dbri_trigger_output, + .trigger_input = dbri_trigger_input, + .get_locks = dbri_get_locks, }; CFATTACH_DECL_NEW(dbri, sizeof(struct dbri_softc), @@ -370,6 +364,9 @@ dbri_attach_sbus(device_t parent, device sc-sc_dmabase = sc-sc_dmamap-dm_segs[0].ds_addr; sc-sc_bufsiz = size; + mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); + bus_intr_establish(sa-sa_bustag, sa-sa_pri, IPL_SCHED, dbri_intr, sc); @@ -2049,6 +2046,14 @@ dbri_trigger_input(void *hdl, void *star return 0; } +static void +dbri_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread) +{ + struct dbri_softc *sc = opaque; + + *intr = sc-sc_intr_lock; + *thread = sc-sc_lock; +} static uint32_t reverse_bytes(uint32_t b, int len) @@ -2075,7 +2080,7 @@ reverse_bytes(uint32_t b, int len) } static void * -dbri_malloc(void *v, int dir, size_t s, struct malloc_type *mt, int flags) +dbri_malloc(void *v, int dir, size_t s) { struct dbri_softc *sc = v; struct dbri_desc *dd = sc-sc_desc[sc-sc_desc_used]; @@ -2116,7 +2121,7 @@ dbri_malloc(void *v, int dir, size_t s, } static void -dbri_free(void *v, void *p, struct malloc_type *mt) +dbri_free(void *v, void *p, size_t size) { struct dbri_softc *sc = v; struct dbri_desc *dd; Index: src/sys/dev/sbus/dbrivar.h diff -u src/sys/dev/sbus/dbrivar.h:1.12 src/sys/dev/sbus/dbrivar.h:1.12.10.1 --- src/sys/dev/sbus/dbrivar.h:1.12 Tue Jan 11 00:49:50 2011 +++ src/sys/dev/sbus/dbrivar.h Sun Nov 20 10:48:54 2011 @@ -1,4
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Sun Nov 20 10:58:11 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: audio.c Log Message: change the locking protocol for audio_get_props(). make it always assert that the thread lock is held before entry, and arrange to make this always so. To generate a diff of this commit: cvs rdiff -u -r1.253.4.1 -r1.253.4.2 src/sys/dev/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio.c diff -u src/sys/dev/audio.c:1.253.4.1 src/sys/dev/audio.c:1.253.4.2 --- src/sys/dev/audio.c:1.253.4.1 Sat Nov 19 21:49:34 2011 +++ src/sys/dev/audio.c Sun Nov 20 10:58:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.253.4.1 2011/11/19 21:49:34 jmcneill Exp $ */ +/* $NetBSD: audio.c,v 1.253.4.2 2011/11/20 10:58:10 mrg Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -155,7 +155,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: audio.c,v 1.253.4.1 2011/11/19 21:49:34 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: audio.c,v 1.253.4.2 2011/11/20 10:58:10 mrg Exp $); #include audio.h #if NAUDIO 0 @@ -430,7 +430,9 @@ audioattach(device_t parent, device_t se sc-sc_dev = parent; sc-sc_lastinfovalid = false; + mutex_enter(sc-sc_lock); props = audio_get_props(sc); + mutex_exit(sc-sc_lock); if (props AUDIO_PROP_FULLDUPLEX) aprint_normal(: full duplex); @@ -449,6 +451,14 @@ audioattach(device_t parent, device_t se aprint_naive(\n); aprint_normal(\n); + /* + * XXX Would like to not hold the sc_lock around this whole block + * escpially for audio_alloc_ring(), except that the latter calls + * -round_blocksize() which demands the thread lock to be taken. + * + * Revisit. + */ + mutex_enter(sc-sc_lock); if (audio_can_playback(sc)) { error = audio_alloc_ring(sc, sc-sc_pr, AUMODE_PLAY, AU_RING_SIZE); @@ -472,7 +482,6 @@ audioattach(device_t parent, device_t se sc-sc_lastgain = 128; - mutex_enter(sc-sc_lock); error = audio_set_defaults(sc, 0); mutex_exit(sc-sc_lock); if (error != 0) { @@ -1663,9 +1672,11 @@ audio_open(dev_t dev, struct audio_softc sc-sc_eof = 0; sc-sc_playdrop = 0; + mutex_enter(sc-sc_intr_lock); sc-sc_full_duplex = (flags (FWRITE|FREAD)) == (FWRITE|FREAD) (audio_get_props(sc) AUDIO_PROP_FULLDUPLEX); + mutex_exit(sc-sc_intr_lock); mode = 0; if (flags FREAD) { @@ -4416,10 +4427,10 @@ audio_get_props(struct audio_softc *sc) const struct audio_hw_if *hw; int props; + KASSERT(mutex_owned(sc-sc_lock)); + hw = sc-hw_if; - mutex_enter(sc-sc_lock); props = hw-get_props(sc-hw_hdl); - mutex_exit(sc-sc_lock); /* * if neither playback nor capture properties are reported,
CVS commit: [jmcneill-audiomp3] src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sun Nov 20 11:09:26 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio [jmcneill-audiomp3]: hdafg.c Log Message: need to hold intr_lock while calling audio_pint/audio_rint To generate a diff of this commit: cvs rdiff -u -r1.10.4.1 -r1.10.4.2 src/sys/dev/pci/hdaudio/hdafg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/hdaudio/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.10.4.1 src/sys/dev/pci/hdaudio/hdafg.c:1.10.4.2 --- src/sys/dev/pci/hdaudio/hdafg.c:1.10.4.1 Sat Nov 19 23:40:07 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Sun Nov 20 11:09:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.10.4.1 2011/11/19 23:40:07 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.10.4.2 2011/11/20 11:09:25 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk @@ -60,7 +60,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.10.4.1 2011/11/19 23:40:07 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.10.4.2 2011/11/20 11:09:25 jmcneill Exp $); #include sys/types.h #include sys/param.h @@ -3166,15 +3166,16 @@ hdafg_stream_intr(struct hdaudio_stream hda_write1(ad-ad_sc-sc_host, HDAUDIO_SD_STS(st-st_shift), HDAUDIO_STS_DESE | HDAUDIO_STS_FIFOE | HDAUDIO_STS_BCIS); - //if (sts HDAUDIO_STS_BCIS) { - if (st == ad-ad_playback ad-ad_playbackintr) { - ad-ad_playbackintr(ad-ad_playbackintrarg); - handled = 1; - } else if (st == ad-ad_capture ad-ad_captureintr) { - ad-ad_captureintr(ad-ad_captureintrarg); - handled = 1; - } - //} + mutex_spin_enter(ad-ad_sc-sc_intr_lock); + /* XXX test (sts HDAUDIO_STS_BCIS)? */ + if (st == ad-ad_playback ad-ad_playbackintr) { + ad-ad_playbackintr(ad-ad_playbackintrarg); + handled = 1; + } else if (st == ad-ad_capture ad-ad_captureintr) { + ad-ad_captureintr(ad-ad_captureintrarg); + handled = 1; + } + mutex_spin_exit(ad-ad_sc-sc_intr_lock); return handled; }
CVS commit: [jmcneill-audiomp3] src/sys/dev/pci
Module Name:src Committed By: jmcneill Date: Sun Nov 20 11:10:16 UTC 2011 Modified Files: src/sys/dev/pci [jmcneill-audiomp3]: gcscaudio.c Log Message: need to hold intr_lock when calling audio_pint/audio_rint To generate a diff of this commit: cvs rdiff -u -r1.7.4.2 -r1.7.4.3 src/sys/dev/pci/gcscaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/gcscaudio.c diff -u src/sys/dev/pci/gcscaudio.c:1.7.4.2 src/sys/dev/pci/gcscaudio.c:1.7.4.3 --- src/sys/dev/pci/gcscaudio.c:1.7.4.2 Sat Nov 19 23:36:38 2011 +++ src/sys/dev/pci/gcscaudio.c Sun Nov 20 11:10:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gcscaudio.c,v 1.7.4.2 2011/11/19 23:36:38 jmcneill Exp $ */ +/* $NetBSD: gcscaudio.c,v 1.7.4.3 2011/11/20 11:10:16 jmcneill Exp $ */ /*- * Copyright (c) 2008 SHIMIZU Ryo r...@nerv.org @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: gcscaudio.c,v 1.7.4.2 2011/11/19 23:36:38 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: gcscaudio.c,v 1.7.4.3 2011/11/20 11:10:16 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -1210,9 +1210,12 @@ gcscaudio_intr(void *arg) nintr = 0; sc = (struct gcscaudio_softc *)arg; + + mutex_spin_enter(sc-sc_intr_lock); + intr = bus_space_read_2(sc-sc_iot, sc-sc_ioh, ACC_IRQ_STATUS); if (intr == 0) - return 0; + goto done; /* Front output */ if (intr ACC_IRQ_STATUS_BM0_IRQ_STS) { @@ -1289,6 +1292,9 @@ gcscaudio_intr(void *arg) aprint_normal_dev(sc-sc_dev, Audio Bus Master 5 IRQ Status\n); #endif +done: + mutex_spin_exit(sc-sc_intr_lock); + return nintr ? 1 : 0; }
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 11:26:35 UTC 2011 Added Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: list of audio and midi drivers and their statuses To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/dev/TODO.audiomp diff -u /dev/null src/sys/dev/TODO.audiomp:1.1.2.1 --- /dev/null Sun Nov 20 11:26:35 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 11:26:35 2011 @@ -0,0 +1,58 @@ +driverstatus +=== +arch/amiga/dev/aucc.c +arch/amiga/dev/repulse.c done +arch/amiga/dev/toccata.c +arch/arm/iomd/vidcaudio.c +arcm/arm/xscale/pxa2x0_ac97.c +arch/dreamcast/dev/g2/aica.c +arch/hp700/gsc/harmony.c +arch/hpcmips/vr/vraiu.c +arch/macppc/dev/awacs.c +arch/macppc/dev/snapper.c +arch/prep/isa/paud_isa.c +arch/sgimips/hpc/haltwo.c +arch/sgimips/mace/mavb.c +arch/sparc/dev/audioamd.c done +arch/x68k/dev/vs.c +arch/zaurus/dev/zaudio.c +dev/bluetooth/btsco.c done +dev/ebus/cs4231_ebus.c done +dev/ic/interwave.c done +dev/ic/mpu.c done +dev/ic/opl.c done +dev/ic/tms320av110.c +dev/isa/aria.c done +dev/isa/ess.c done +dev/isa/gus.c done +dev/isa/pas.c done +dev/isa/sb.c done +dev/isa/wss.c done +dev/isa/ym.c done +dev/isapnp/mpu_isapnp.c done +dev/pad/pad.c done +dev/pci/auacer.c done +dev/pci/auich.c done +dev/pci/auixp.c done +dev/pci/autri.c done +dev/pci/auvia.c done +dev/pci/azalia.c done +dev/pci/cmpci.c done +dev/pci/cs4280.c done +dev/pci/cs4281.c done +dev/pci/eap.c done +dev/pci/emuxki.c done +dev/pci/esa.c done +dev/pci/esm.c done +dev/pci/eso.c done +dev/pci/fms.c done +dev/pci/gcscaudio.c done +dev/pci/neo.c done +dev/pci/sv.c done +dev/pci/yds.c done +dev/pci/hdaudio/hdafg.c done +dev/sbus/cs4231_sbus.c done +dev/sbus/dbri.c done +dev/tc/bba.c done +dev/usb/uaudio.c +dev/usb/umidi.c
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Sun Nov 20 11:41:53 UTC 2011 Modified Files: src/sys/dev/ebus [jmcneill-audiomp3]: cs4231_ebus.c src/sys/dev/sbus [jmcneill-audiomp3]: cs4231_sbus.c Log Message: complete the port to audiomp: don't forget to take sc_intr_lock in the hardware interrupt routines. To generate a diff of this commit: cvs rdiff -u -r1.34.4.1 -r1.34.4.2 src/sys/dev/ebus/cs4231_ebus.c cvs rdiff -u -r1.48.4.1 -r1.48.4.2 src/sys/dev/sbus/cs4231_sbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ebus/cs4231_ebus.c diff -u src/sys/dev/ebus/cs4231_ebus.c:1.34.4.1 src/sys/dev/ebus/cs4231_ebus.c:1.34.4.2 --- src/sys/dev/ebus/cs4231_ebus.c:1.34.4.1 Sun Nov 20 09:40:19 2011 +++ src/sys/dev/ebus/cs4231_ebus.c Sun Nov 20 11:41:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_ebus.c,v 1.34.4.1 2011/11/20 09:40:19 mrg Exp $ */ +/* $NetBSD: cs4231_ebus.c,v 1.34.4.2 2011/11/20 11:41:53 mrg Exp $ */ /* * Copyright (c) 2002 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cs4231_ebus.c,v 1.34.4.1 2011/11/20 09:40:19 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: cs4231_ebus.c,v 1.34.4.2 2011/11/20 11:41:53 mrg Exp $); #ifdef _KERNEL_OPT #include opt_sparc_arch.h @@ -542,6 +542,8 @@ cs4231_ebus_intr(void *arg) ebsc = arg; sc = ebsc-sc_cs4231; + mutex_spin_enter(sc-sc_ad1848.sc_intr_lock); + status = ADREAD(sc-sc_ad1848, AD1848_STATUS); #ifdef AUDIO_DEBUG @@ -582,6 +584,7 @@ cs4231_ebus_intr(void *arg) ret = 1; } + mutex_spin_exit(sc-sc_ad1848.sc_intr_lock); return ret; } @@ -592,10 +595,10 @@ cs4231_ebus_pint(void *cookie) struct cs4231_softc *sc = cookie; struct cs_transfer *t = sc-sc_playback; - KERNEL_LOCK(1, NULL); + mutex_spin_enter(sc-sc_ad1848.sc_intr_lock); if (t-t_intr != NULL) (*t-t_intr)(t-t_arg); - KERNEL_UNLOCK_ONE(NULL); + mutex_spin_exit(sc-sc_ad1848.sc_intr_lock); return 0; } @@ -605,9 +608,9 @@ cs4231_ebus_rint(void *cookie) struct cs4231_softc *sc = cookie; struct cs_transfer *t = sc-sc_capture; - KERNEL_LOCK(1, NULL); + mutex_spin_enter(sc-sc_ad1848.sc_intr_lock); if (t-t_intr != NULL) (*t-t_intr)(t-t_arg); - KERNEL_UNLOCK_ONE(NULL); + mutex_spin_exit(sc-sc_ad1848.sc_intr_lock); return 0; } Index: src/sys/dev/sbus/cs4231_sbus.c diff -u src/sys/dev/sbus/cs4231_sbus.c:1.48.4.1 src/sys/dev/sbus/cs4231_sbus.c:1.48.4.2 --- src/sys/dev/sbus/cs4231_sbus.c:1.48.4.1 Sun Nov 20 09:40:19 2011 +++ src/sys/dev/sbus/cs4231_sbus.c Sun Nov 20 11:41:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_sbus.c,v 1.48.4.1 2011/11/20 09:40:19 mrg Exp $ */ +/* $NetBSD: cs4231_sbus.c,v 1.48.4.2 2011/11/20 11:41:53 mrg Exp $ */ /*- * Copyright (c) 1998, 1999, 2002, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cs4231_sbus.c,v 1.48.4.1 2011/11/20 09:40:19 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: cs4231_sbus.c,v 1.48.4.2 2011/11/20 11:41:53 mrg Exp $); #include audio.h #if NAUDIO 0 @@ -516,6 +516,8 @@ cs4231_sbus_intr(void *arg) if ((csr APC_INTR_MASK) == 0) /* any interrupt pedning? */ return 0; + mutex_spin_enter(sc-sc_ad1848.sc_intr_lock); + /* write back DMA status to clear interrupt */ bus_space_write_4(sbsc-sc_bt, sbsc-sc_bh, APC_DMA_CSR, csr); ++sc-sc_intrcnt.ev_count; @@ -596,6 +598,8 @@ cs4231_sbus_intr(void *arg) /* evcnt? */ } + mutex_spin_exit(sc-sc_ad1848.sc_intr_lock); + return 1; } @@ -605,11 +609,11 @@ cs4231_sbus_pint(void *cookie) struct cs4231_softc *sc = cookie; struct cs_transfer *t; - KERNEL_LOCK(1, NULL); + mutex_spin_enter(sc-sc_ad1848.sc_intr_lock); t = sc-sc_playback; if (t-t_intr != NULL) (*t-t_intr)(t-t_arg); - KERNEL_UNLOCK_ONE(NULL); + mutex_spin_exit(sc-sc_ad1848.sc_intr_lock); return 0; } @@ -619,11 +623,11 @@ cs4231_sbus_rint(void *cookie) struct cs4231_softc *sc = cookie; struct cs_transfer *t; - KERNEL_LOCK(1, NULL); + mutex_spin_enter(sc-sc_ad1848.sc_intr_lock); t = sc-sc_capture; if (t-t_intr != NULL) (*t-t_intr)(t-t_arg); - KERNEL_UNLOCK_ONE(NULL); + mutex_spin_exit(sc-sc_ad1848.sc_intr_lock); return 0; }
CVS commit: [jmcneill-audiomp3] src/sys/dev/ic
Module Name:src Committed By: mrg Date: Sun Nov 20 12:04:14 UTC 2011 Modified Files: src/sys/dev/ic [jmcneill-audiomp3]: am7930.c Log Message: IPL_SCHED is enough. To generate a diff of this commit: cvs rdiff -u -r1.50.56.1 -r1.50.56.2 src/sys/dev/ic/am7930.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/am7930.c diff -u src/sys/dev/ic/am7930.c:1.50.56.1 src/sys/dev/ic/am7930.c:1.50.56.2 --- src/sys/dev/ic/am7930.c:1.50.56.1 Sun Nov 20 10:56:18 2011 +++ src/sys/dev/ic/am7930.c Sun Nov 20 12:04:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: am7930.c,v 1.50.56.1 2011/11/20 10:56:18 mrg Exp $ */ +/* $NetBSD: am7930.c,v 1.50.56.2 2011/11/20 12:04:14 mrg Exp $ */ /* * Copyright (c) 1995 Rolf Grossmann @@ -36,7 +36,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: am7930.c,v 1.50.56.1 2011/11/20 10:56:18 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: am7930.c,v 1.50.56.2 2011/11/20 12:04:14 mrg Exp $); #include audio.h #if NAUDIO 0 @@ -191,8 +191,7 @@ am7930_init(struct am7930_softc *sc, int } mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE); - /* We used to take splaudio() in commit_settings */ - mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_VM); + mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); } int
CVS commit: [jmcneill-audiomp3] src/sys/dev/sbus
Module Name:src Committed By: mrg Date: Sun Nov 20 12:07:13 UTC 2011 Modified Files: src/sys/dev/sbus [jmcneill-audiomp3]: dbri.c Log Message: convert spl*() to use the sc_intr_lock mutex, and hold it in a couple of other places we should as well. To generate a diff of this commit: cvs rdiff -u -r1.33.6.1 -r1.33.6.2 src/sys/dev/sbus/dbri.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.33.6.1 src/sys/dev/sbus/dbri.c:1.33.6.2 --- src/sys/dev/sbus/dbri.c:1.33.6.1 Sun Nov 20 10:48:54 2011 +++ src/sys/dev/sbus/dbri.c Sun Nov 20 12:07:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $ */ +/* $NetBSD: dbri.c,v 1.33.6.2 2011/11/20 12:07:13 mrg Exp $ */ /* * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: dbri.c,v 1.33.6.2 2011/11/20 12:07:13 mrg Exp $); #include audio.h #if NAUDIO 0 @@ -472,6 +472,8 @@ dbri_intr(void *hdl) bus_space_handle_t ioh = sc-sc_ioh; int x; + mutex_spin_enter(sc-sc_intr_lock); + /* clear interrupt */ x = bus_space_read_4(iot, ioh, DBRI_REG1); if (x (DBRI_MRR | DBRI_MLE | DBRI_LBG | DBRI_MBE)) { @@ -506,6 +508,8 @@ dbri_intr(void *hdl) dbri_process_interrupt_buffer(sc); + mutex_spin_exit(sc-sc_intr_lock); + return (1); } @@ -598,9 +602,8 @@ dbri_command_send(struct dbri_softc *sc, bus_space_handle_t ioh = sc-sc_ioh; bus_space_tag_t iot = sc-sc_iot; int maxloops = 100; - int x; - x = splsched(); + mutex_spin_enter(sc-sc_intr_lock); sc-sc_locked--; @@ -638,7 +641,7 @@ dbri_command_send(struct dbri_softc *sc, } } - splx(x); + mutex_spin_exit(sc-sc_intr_lock); return; } @@ -1266,7 +1269,7 @@ setup_ring_xmit(struct dbri_softc *sc, i void (*callback)(void *), void *callback_args) { volatile uint32_t *cmd; - int x, i; + int i; int td; int td_first, td_last; bus_addr_t dmabuf, dmabase; @@ -1316,7 +1319,7 @@ setup_ring_xmit(struct dbri_softc *sc, i dd-callback = callback; dd-callback_args = callback_args; - x = splsched(); + mutex_spin_enter(sc-sc_intr_lock); /* the pipe shouldn't be active */ if (pipe_active(sc, pipe)) { @@ -1352,7 +1355,7 @@ setup_ring_xmit(struct dbri_softc *sc, i DPRINTF(%s: starting DMA\n, __func__); } - splx(x); + mutex_spin_exit(sc-sc_intr_lock); return; } @@ -1362,7 +1365,7 @@ setup_ring_recv(struct dbri_softc *sc, i void (*callback)(void *), void *callback_args) { volatile uint32_t *cmd; - int x, i; + int i; int td_first, td_last; bus_addr_t dmabuf, dmabase; struct dbri_desc *dd = sc-sc_desc[which]; @@ -1407,7 +1410,7 @@ setup_ring_recv(struct dbri_softc *sc, i dd-callback = callback; dd-callback_args = callback_args; - x = splsched(); + mutex_spin_enter(sc-sc_intr_lock); /* the pipe shouldn't be active */ if (pipe_active(sc, pipe)) { @@ -1443,7 +1446,7 @@ setup_ring_recv(struct dbri_softc *sc, i DPRINTF(%s: starting DMA\n, __func__); } - splx(x); + mutex_spin_exit(sc-sc_intr_lock); return; } @@ -2211,10 +2214,9 @@ dbri_resume(device_t self, const pmf_qua aprint_verbose(resume: %d\n, sc-sc_refcount); if (sc-sc_playing) { volatile uint32_t *cmd; - int s; dbri_bring_up(sc); - s = splsched(); + mutex_spin_enter(sc-sc_intr_lock); cmd = dbri_command_lock(sc); *(cmd++) = DBRI_CMD(DBRI_COMMAND_SDP, 0, sc-sc_pipe[4].sdp | @@ -2223,7 +2225,7 @@ dbri_resume(device_t self, const pmf_qua *(cmd++) = sc-sc_dmabase + dbri_dma_off(xmit, 0); dbri_command_send(sc, cmd); - splx(s); + mutex_spin_exit(sc-sc_intr_lock); } return true; }
CVS commit: [jmcneill-audiomp3] src/sys/dev/isa
Module Name:src Committed By: mrg Date: Sun Nov 20 12:08:19 UTC 2011 Modified Files: src/sys/dev/isa [jmcneill-audiomp3]: pcppi.c pcppivar.h Log Message: port the changes from ad-audiomp2 branch. this mostly replaces the changes i'd made to pcppi to achieve a similar result. XXX: these actually could be pulled down to -current today, i think. no actual dependancies on audiomp branch itself. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.37.6.1 src/sys/dev/isa/pcppi.c cvs rdiff -u -r1.10.6.1 -r1.10.6.2 src/sys/dev/isa/pcppivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/pcppi.c diff -u src/sys/dev/isa/pcppi.c:1.37 src/sys/dev/isa/pcppi.c:1.37.6.1 --- src/sys/dev/isa/pcppi.c:1.37 Tue May 24 09:28:03 2011 +++ src/sys/dev/isa/pcppi.c Sun Nov 20 12:08:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pcppi.c,v 1.37 2011/05/24 09:28:03 mrg Exp $ */ +/* $NetBSD: pcppi.c,v 1.37.6.1 2011/11/20 12:08:19 mrg Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.37 2011/05/24 09:28:03 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.37.6.1 2011/11/20 12:08:19 mrg Exp $); #include attimer.h @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1. #include sys/bus.h #include sys/mutex.h #include sys/condvar.h +#include sys/tty.h #include dev/ic/attimervar.h @@ -66,16 +67,14 @@ CFATTACH_DECL3_NEW(pcppi, sizeof(struct DVF_DETACH_SHUTDOWN); static int pcppisearch(device_t, cfdata_t, const int *, void *); -static void pcppi_bell_stop_unlocked(void*); -static void pcppi_bell_stop(void*); +static void pcppi_bell_stop(struct pcppi_softc *); +static void pcppi_bell_callout(void *); #if NATTIMER 0 static void pcppi_attach_speaker(device_t); static void pcppi_detach_speaker(struct pcppi_softc *); #endif -#define PCPPIPRI (PZERO - 1) - int pcppi_match(device_t parent, cfdata_t match, void *aux) { @@ -175,6 +174,7 @@ pcppi_isa_attach(device_t parent, device void pcppi_childdet(device_t self, device_t child) { + /* we hold no child references, so do nothing */ } @@ -196,14 +196,16 @@ pcppi_detach(device_t self, int flags) #if NPCKBD 0 pckbd_unhook_bell(pcppi_pckbd_bell, sc); #endif + mutex_spin_enter(tty_lock); pcppi_bell_stop(sc); + mutex_spin_exit(tty_lock); - callout_stop(sc-sc_bell_ch); + callout_halt(sc-sc_bell_ch, NULL); callout_destroy(sc-sc_bell_ch); - bus_space_unmap(sc-sc_iot, sc-sc_ppi_ioh, sc-sc_size); - mutex_destroy(sc-sc_lock); - cv_destroy(sc-sc_stop_cv); + cv_destroy(sc-sc_slp); + + bus_space_unmap(sc-sc_iot, sc-sc_ppi_ioh, sc-sc_size); return 0; } @@ -214,12 +216,11 @@ pcppi_attach(struct pcppi_softc *sc) struct pcppi_attach_args pa; device_t self = sc-sc_dv; -callout_init(sc-sc_bell_ch, 0); - -sc-sc_bellactive = sc-sc_bellpitch = sc-sc_slp = 0; + callout_init(sc-sc_bell_ch, CALLOUT_MPSAFE); + callout_setfunc(sc-sc_bell_ch, pcppi_bell_callout, sc); + cv_init(sc-sc_slp, bell); - mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_VM); - cv_init(sc-sc_stop_cv, bell); +sc-sc_bellactive = sc-sc_bellpitch = 0; #if NPCKBD 0 /* Provide a beeper for the PC Keyboard, if there isn't one already. */ @@ -274,21 +275,27 @@ pcppi_attach_speaker(device_t self) void pcppi_bell(pcppi_tag_t self, int pitch, int period, int slp) { + + mutex_spin_enter(tty_lock); + pcppi_bell_locked(self, pitch, period, slp); + mutex_spin_exit(tty_lock); +} + +void +pcppi_bell_locked(pcppi_tag_t self, int pitch, int period, int slp) +{ struct pcppi_softc *sc = self; - mutex_enter(sc-sc_lock); if (sc-sc_bellactive) { if (sc-sc_timeout) { sc-sc_timeout = 0; callout_stop(sc-sc_bell_ch); } - if (sc-sc_slp) - cv_broadcast(sc-sc_stop_cv); + cv_broadcast(sc-sc_slp); } if (pitch == 0 || period == 0) { - pcppi_bell_stop_unlocked(sc); + pcppi_bell_stop(sc); sc-sc_bellpitch = 0; - mutex_exit(sc-sc_lock); return; } if (!sc-sc_bellactive || sc-sc_bellpitch != pitch) { @@ -306,24 +313,32 @@ pcppi_bell(pcppi_tag_t self, int pitch, sc-sc_bellactive = 1; if (slp PCPPI_BELL_POLL) { delay((period * 100) / hz); - pcppi_bell_stop_unlocked(sc); + pcppi_bell_stop(sc); } else { sc-sc_timeout = 1; - callout_reset(sc-sc_bell_ch, period, pcppi_bell_stop, sc); + callout_schedule(sc-sc_bell_ch, period); if (slp PCPPI_BELL_SLEEP) { - sc-sc_slp = 1; - cv_wait_sig(sc-sc_stop_cv, sc-sc_lock); - sc-sc_slp = 0; + cv_wait_sig(sc-sc_slp, tty_lock); } } - mutex_exit(sc-sc_lock); } static void -pcppi_bell_stop_unlocked(void *arg) +pcppi_bell_callout(void *arg) { struct pcppi_softc *sc = arg; + mutex_spin_enter(tty_lock); + if (sc-sc_timeout != 0) { + pcppi_bell_stop(sc); + } + mutex_spin_exit(tty_lock); +} + +static void +pcppi_bell_stop(struct pcppi_softc *sc) +{ +
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 12:09:13 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: haltwo is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.1 src/sys/dev/TODO.audiomp:1.1.2.2 --- src/sys/dev/TODO.audiomp:1.1.2.1 Sun Nov 20 11:26:35 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 12:09:13 2011 @@ -11,7 +11,7 @@ arch/hpcmips/vr/vraiu.c arch/macppc/dev/awacs.c arch/macppc/dev/snapper.c arch/prep/isa/paud_isa.c -arch/sgimips/hpc/haltwo.c +arch/sgimips/hpc/haltwo.c done arch/sgimips/mace/mavb.c arch/sparc/dev/audioamd.c done arch/x68k/dev/vs.c
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Sun Nov 20 12:17:03 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: add a column for tested and mark hdafg and ess as done. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.2 src/sys/dev/TODO.audiomp:1.1.2.3 --- src/sys/dev/TODO.audiomp:1.1.2.2 Sun Nov 20 12:09:13 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 12:17:03 2011 @@ -1,4 +1,4 @@ -driverstatus +driverstatus tested === arch/amiga/dev/aucc.c arch/amiga/dev/repulse.c done @@ -23,7 +23,7 @@ dev/ic/mpu.c done dev/ic/opl.c done dev/ic/tms320av110.c dev/isa/aria.c done -dev/isa/ess.c done +dev/isa/ess.c done port-shark dev/isa/gus.c done dev/isa/pas.c done dev/isa/sb.c done @@ -50,7 +50,7 @@ dev/pci/gcscaudio.c done dev/pci/neo.c done dev/pci/sv.c done dev/pci/yds.c done -dev/pci/hdaudio/hdafg.c done +dev/pci/hdaudio/hdafg.c done port-amd64 dev/sbus/cs4231_sbus.c done dev/sbus/dbri.c done dev/tc/bba.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 12:28:26 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: mavb is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.3 src/sys/dev/TODO.audiomp:1.1.2.4 --- src/sys/dev/TODO.audiomp:1.1.2.3 Sun Nov 20 12:17:03 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 12:28:26 2011 @@ -12,7 +12,7 @@ arch/macppc/dev/awacs.c arch/macppc/dev/snapper.c arch/prep/isa/paud_isa.c arch/sgimips/hpc/haltwo.c done -arch/sgimips/mace/mavb.c +arch/sgimips/mace/mavb.c done arch/sparc/dev/audioamd.c done arch/x68k/dev/vs.c arch/zaurus/dev/zaudio.c
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 12:37:56 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: i tested eap To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.4 src/sys/dev/TODO.audiomp:1.1.2.5 --- src/sys/dev/TODO.audiomp:1.1.2.4 Sun Nov 20 12:28:26 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 12:37:56 2011 @@ -40,7 +40,7 @@ dev/pci/azalia.c done dev/pci/cmpci.c done dev/pci/cs4280.c done dev/pci/cs4281.c done -dev/pci/eap.c done +dev/pci/eap.c done port-i386 dev/pci/emuxki.c done dev/pci/esa.c done dev/pci/esm.c done @@ -50,7 +50,7 @@ dev/pci/gcscaudio.c done dev/pci/neo.c done dev/pci/sv.c done dev/pci/yds.c done -dev/pci/hdaudio/hdafg.c done port-amd64 +dev/pci/hdaudio/hdafg.c done port-i386 dev/sbus/cs4231_sbus.c done dev/sbus/dbri.c done dev/tc/bba.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: mrg Date: Sun Nov 20 13:14:33 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: note pxa2x0_ac97 now compiles and should be done To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.7 src/sys/dev/TODO.audiomp:1.1.2.8 --- src/sys/dev/TODO.audiomp:1.1.2.7 Sun Nov 20 12:59:31 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 13:14:33 2011 @@ -4,7 +4,7 @@ arch/amiga/dev/aucc.c done arch/amiga/dev/repulse.c done arch/amiga/dev/toccata.c done arch/arm/iomd/vidcaudio.c done -arcm/arm/xscale/pxa2x0_ac97.c +arcm/arm/xscale/pxa2x0_ac97.c done arch/dreamcast/dev/g2/aica.c arch/hp700/gsc/harmony.c arch/hpcmips/vr/vraiu.c
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 13:31:19 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: zaudio is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.8 src/sys/dev/TODO.audiomp:1.1.2.9 --- src/sys/dev/TODO.audiomp:1.1.2.8 Sun Nov 20 13:14:33 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 13:31:19 2011 @@ -15,7 +15,7 @@ arch/sgimips/hpc/haltwo.c done arch/sgimips/mace/mavb.c done arch/sparc/dev/audioamd.c done arch/x68k/dev/vs.c -arch/zaurus/dev/zaudio.c +arch/zaurus/dev/zaudio.c done dev/bluetooth/btsco.c done dev/ebus/cs4231_ebus.c done dev/ic/interwave.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 14:13:25 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: build.sh -m prep tools failed for me so mark paud_isa toolchain-fails To generate a diff of this commit: cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.9 src/sys/dev/TODO.audiomp:1.1.2.10 --- src/sys/dev/TODO.audiomp:1.1.2.9 Sun Nov 20 13:31:19 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 14:13:25 2011 @@ -10,7 +10,7 @@ arch/hp700/gsc/harmony.c arch/hpcmips/vr/vraiu.c arch/macppc/dev/awacs.c arch/macppc/dev/snapper.c -arch/prep/isa/paud_isa.c +arch/prep/isa/paud_isa.c toolchain-fails arch/sgimips/hpc/haltwo.c done arch/sgimips/mace/mavb.c done arch/sparc/dev/audioamd.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 14:27:09 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: vraiu is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.10 src/sys/dev/TODO.audiomp:1.1.2.11 --- src/sys/dev/TODO.audiomp:1.1.2.10 Sun Nov 20 14:13:25 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 14:27:09 2011 @@ -7,7 +7,7 @@ arch/arm/iomd/vidcaudio.c done arcm/arm/xscale/pxa2x0_ac97.c done arch/dreamcast/dev/g2/aica.c arch/hp700/gsc/harmony.c -arch/hpcmips/vr/vraiu.c +arch/hpcmips/vr/vraiu.c done arch/macppc/dev/awacs.c arch/macppc/dev/snapper.c arch/prep/isa/paud_isa.c toolchain-fails
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 15:00:49 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: aica is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.11 src/sys/dev/TODO.audiomp:1.1.2.12 --- src/sys/dev/TODO.audiomp:1.1.2.11 Sun Nov 20 14:27:09 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 15:00:49 2011 @@ -5,7 +5,7 @@ arch/amiga/dev/repulse.c done arch/amiga/dev/toccata.c done arch/arm/iomd/vidcaudio.c done arcm/arm/xscale/pxa2x0_ac97.c done -arch/dreamcast/dev/g2/aica.c +arch/dreamcast/dev/g2/aica.c done arch/hp700/gsc/harmony.c arch/hpcmips/vr/vraiu.c done arch/macppc/dev/awacs.c
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 15:24:01 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: harmony is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.12 src/sys/dev/TODO.audiomp:1.1.2.13 --- src/sys/dev/TODO.audiomp:1.1.2.12 Sun Nov 20 15:00:49 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 15:24:01 2011 @@ -6,7 +6,7 @@ arch/amiga/dev/toccata.c done arch/arm/iomd/vidcaudio.c done arcm/arm/xscale/pxa2x0_ac97.c done arch/dreamcast/dev/g2/aica.c done -arch/hp700/gsc/harmony.c +arch/hp700/gsc/harmony.c done arch/hpcmips/vr/vraiu.c done arch/macppc/dev/awacs.c arch/macppc/dev/snapper.c
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 15:49:16 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: tms320av110 (melody) is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.13 src/sys/dev/TODO.audiomp:1.1.2.14 --- src/sys/dev/TODO.audiomp:1.1.2.13 Sun Nov 20 15:24:01 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 15:49:16 2011 @@ -21,7 +21,7 @@ dev/ebus/cs4231_ebus.c done dev/ic/interwave.c done dev/ic/mpu.c done dev/ic/opl.c done -dev/ic/tms320av110.c +dev/ic/tms320av110.c done dev/isa/aria.c done dev/isa/ess.c done port-shark dev/isa/gus.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 16:18:32 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: vs is done To generate a diff of this commit: cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.14 src/sys/dev/TODO.audiomp:1.1.2.15 --- src/sys/dev/TODO.audiomp:1.1.2.14 Sun Nov 20 15:49:16 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 16:18:32 2011 @@ -14,7 +14,7 @@ arch/prep/isa/paud_isa.c toolchain-fails arch/sgimips/hpc/haltwo.c done arch/sgimips/mace/mavb.c done arch/sparc/dev/audioamd.c done -arch/x68k/dev/vs.c +arch/x68k/dev/vs.c done arch/zaurus/dev/zaudio.c done dev/bluetooth/btsco.c done dev/ebus/cs4231_ebus.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 19:26:34 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: TODO.audiomp Log Message: i tested sb under qemu To generate a diff of this commit: cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/dev/TODO.audiomp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/TODO.audiomp diff -u src/sys/dev/TODO.audiomp:1.1.2.16 src/sys/dev/TODO.audiomp:1.1.2.17 --- src/sys/dev/TODO.audiomp:1.1.2.16 Sun Nov 20 16:34:23 2011 +++ src/sys/dev/TODO.audiomp Sun Nov 20 19:26:34 2011 @@ -26,7 +26,7 @@ dev/isa/aria.c done dev/isa/ess.c done port-shark dev/isa/gus.c done dev/isa/pas.c done -dev/isa/sb.c done +dev/isa/sb.c done port-i386 dev/isa/wss.c done dev/isa/ym.c done dev/isapnp/mpu_isapnp.c done
CVS commit: [jmcneill-audiomp3] src/sys/dev/isa
Module Name:src Committed By: jmcneill Date: Sun Nov 20 19:44:50 UTC 2011 Modified Files: src/sys/dev/isa [jmcneill-audiomp3]: sbdsp.c Log Message: improve the last change, after discussing it with rmind To generate a diff of this commit: cvs rdiff -u -r1.134.12.2 -r1.134.12.3 src/sys/dev/isa/sbdsp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/sbdsp.c diff -u src/sys/dev/isa/sbdsp.c:1.134.12.2 src/sys/dev/isa/sbdsp.c:1.134.12.3 --- src/sys/dev/isa/sbdsp.c:1.134.12.2 Sun Nov 20 19:26:05 2011 +++ src/sys/dev/isa/sbdsp.c Sun Nov 20 19:44:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.134.12.2 2011/11/20 19:26:05 jmcneill Exp $ */ +/* $NetBSD: sbdsp.c,v 1.134.12.3 2011/11/20 19:44:50 jmcneill Exp $ */ /*- * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sbdsp.c,v 1.134.12.2 2011/11/20 19:26:05 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: sbdsp.c,v 1.134.12.3 2011/11/20 19:44:50 jmcneill Exp $); #include midi.h #include mpu.h @@ -1095,7 +1095,11 @@ sbdsp_rdsp(struct sbdsp_softc *sc) void sbdsp_pause(struct sbdsp_softc *sc) { - delay(10); /* 1/10th of a second */ + + KASSERT(mutex_owned(sc-sc_intr_lock)); + mutex_spin_exit(sc-sc_intr_lock); + (void)kpause(sbpause, false, hz/8, sc-sc_lock); + mutex_spin_enter(sc-sc_intr_lock); } /*
CVS commit: [jmcneill-audiomp3] src/sys/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 20 20:00:15 UTC 2011 Modified Files: src/sys/dev [jmcneill-audiomp3]: sequencer.c Log Message: avoid passing size 0 to kmem_alloc when the sequencer device is opened and no midi devices are attached To generate a diff of this commit: cvs rdiff -u -r1.52.14.1 -r1.52.14.2 src/sys/dev/sequencer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sequencer.c diff -u src/sys/dev/sequencer.c:1.52.14.1 src/sys/dev/sequencer.c:1.52.14.2 --- src/sys/dev/sequencer.c:1.52.14.1 Sat Nov 19 21:49:35 2011 +++ src/sys/dev/sequencer.c Sun Nov 20 20:00:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sequencer.c,v 1.52.14.1 2011/11/19 21:49:35 jmcneill Exp $ */ +/* $NetBSD: sequencer.c,v 1.52.14.2 2011/11/20 20:00:15 jmcneill Exp $ */ /* * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.52.14.1 2011/11/19 21:49:35 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.52.14.2 2011/11/20 20:00:15 jmcneill Exp $); #include sequencer.h @@ -268,17 +268,22 @@ sequenceropen(dev_t dev, int flags, int SEQ_QINIT(sc-outq); sc-lowat = SEQ_MAXQ / 2; - mutex_exit(sc-lock); - sc-devs = kmem_alloc(sc-ndevs * sizeof(struct midi_dev *), KM_SLEEP); - for (unit = 0; unit sc-ndevs; unit++) { - md = midiseq_open(unit, flags); - if (md) { - sc-devs[sc-nmidi++] = md; - md-seq = sc; - md-doingsysex = 0; + if (sc-ndevs 0) { + mutex_exit(sc-lock); + sc-devs = kmem_alloc(sc-ndevs * sizeof(struct midi_dev *), + KM_SLEEP); + for (unit = 0; unit sc-ndevs; unit++) { + md = midiseq_open(unit, flags); + if (md) { +sc-devs[sc-nmidi++] = md; +md-seq = sc; +md-doingsysex = 0; + } } + mutex_enter(sc-lock); + } else { + sc-devs = NULL; } - mutex_enter(sc-lock); /* Only now redirect input from MIDI devices. */ for (unit = 0; unit sc-nmidi; unit++) { @@ -385,7 +390,11 @@ sequencerclose(dev_t dev, int flags, int for (unit = 0; unit sc-nmidi; unit++) midiseq_close(sc-devs[unit]); - kmem_free(sc-devs, sc-ndevs * sizeof(struct midi_dev *)); + if (sc-devs != NULL) { + KASSERT(sc-ndevs 0); + kmem_free(sc-devs, sc-ndevs * sizeof(struct midi_dev *)); + sc-devs = NULL; + } mutex_enter(sc-lock); sc-isopen = 0;
CVS commit: [jmcneill-audiomp3] src/sys/dev/pci
Module Name:src Committed By: jmcneill Date: Sat Nov 19 23:19:01 UTC 2011 Modified Files: src/sys/dev/pci [jmcneill-audiomp3]: emuxki.c Log Message: adapt to audiomp api changes To generate a diff of this commit: cvs rdiff -u -r1.59.14.1 -r1.59.14.2 src/sys/dev/pci/emuxki.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/emuxki.c diff -u src/sys/dev/pci/emuxki.c:1.59.14.1 src/sys/dev/pci/emuxki.c:1.59.14.2 --- src/sys/dev/pci/emuxki.c:1.59.14.1 Sat Nov 19 21:49:42 2011 +++ src/sys/dev/pci/emuxki.c Sat Nov 19 23:19:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: emuxki.c,v 1.59.14.1 2011/11/19 21:49:42 jmcneill Exp $ */ +/* $NetBSD: emuxki.c,v 1.59.14.2 2011/11/19 23:19:00 jmcneill Exp $ */ /*- * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc. @@ -49,16 +49,17 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: emuxki.c,v 1.59.14.1 2011/11/19 21:49:42 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: emuxki.c,v 1.59.14.2 2011/11/19 23:19:00 jmcneill Exp $); #include sys/param.h #include sys/device.h #include sys/errno.h -#include sys/malloc.h #include sys/systm.h #include sys/audioio.h #include sys/select.h #include sys/mutex.h +#include sys/kmem.h +#include sys/malloc.h #include dev/audio_if.h #include dev/audiovar.h @@ -81,18 +82,16 @@ static int emuxki_detach(device_t, int); /* DMA mem mgmt */ static struct dmamem *dmamem_alloc(bus_dma_tag_t, size_t, bus_size_t, - int, struct malloc_type *, int); -static void dmamem_free(struct dmamem *, struct malloc_type *); + int); +static void dmamem_free(struct dmamem *); /* Emu10k1 init shutdown */ static int emuxki_init(struct emuxki_softc *); static void emuxki_shutdown(struct emuxki_softc *); /* Emu10k1 mem mgmt */ -static void *emuxki_pmem_alloc(struct emuxki_softc *, size_t, - struct malloc_type *,int); -static void *emuxki_rmem_alloc(struct emuxki_softc *, size_t, - struct malloc_type *,int); +static void *emuxki_pmem_alloc(struct emuxki_softc *, size_t); +static void *emuxki_rmem_alloc(struct emuxki_softc *, size_t); /* * Emu10k1 channels funcs : There is no direct access to channels, everything @@ -154,8 +153,8 @@ static int emuxki_set_port(void *, mixer static int emuxki_get_port(void *, mixer_ctrl_t *); static int emuxki_query_devinfo(void *, mixer_devinfo_t *); -static void*emuxki_allocm(void *, int, size_t, struct malloc_type *, int); -static void emuxki_freem(void *, void *, struct malloc_type *); +static void*emuxki_allocm(void *, int, size_t); +static void emuxki_freem(void *, void *, size_t); static paddr_t emuxki_mappage(void *, void *, off_t, int); static int emuxki_get_props(void *); @@ -241,22 +240,20 @@ static const struct audio_format emuxki_ */ static void -dmamem_delete(struct dmamem *mem, struct malloc_type *type) +dmamem_delete(struct dmamem *mem) { - free(mem-segs, type); - free(mem, type); + kmem_free(mem-segs, mem-nsegs * sizeof(*(mem-segs))); + kmem_free(mem, sizeof(*mem)); } static struct dmamem * -dmamem_alloc(bus_dma_tag_t dmat, size_t size, bus_size_t align, - int nsegs, struct malloc_type *type, int flags) +dmamem_alloc(bus_dma_tag_t dmat, size_t size, bus_size_t align, int nsegs) { struct dmamem *mem; - int bus_dma_flags; /* Allocate memory for structure */ - if ((mem = malloc(sizeof(*mem), type, flags)) == NULL) + if ((mem = kmem_alloc(sizeof(*mem), KM_SLEEP)) == NULL) return NULL; mem-dmat = dmat; mem-size = size; @@ -264,41 +261,40 @@ dmamem_alloc(bus_dma_tag_t dmat, size_t mem-nsegs = nsegs; mem-bound = 0; - mem-segs = malloc(mem-nsegs * sizeof(*(mem-segs)), type, flags); + mem-segs = kmem_alloc(mem-nsegs * sizeof(*(mem-segs)), KM_SLEEP); if (mem-segs == NULL) { - free(mem, type); + kmem_free(mem, sizeof(*mem)); return NULL; } - bus_dma_flags = (flags M_NOWAIT) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK; if (bus_dmamem_alloc(dmat, mem-size, mem-align, mem-bound, mem-segs, mem-nsegs, (mem-rsegs), - bus_dma_flags)) { - dmamem_delete(mem, type); + BUS_DMA_WAITOK)) { + dmamem_delete(mem); return NULL; } if (bus_dmamem_map(dmat, mem-segs, mem-nsegs, mem-size, - (mem-kaddr), bus_dma_flags | BUS_DMA_COHERENT)) { + (mem-kaddr), BUS_DMA_WAITOK | BUS_DMA_COHERENT)) { bus_dmamem_free(dmat, mem-segs, mem-nsegs); - dmamem_delete(mem, type); + dmamem_delete(mem); return NULL; } if (bus_dmamap_create(dmat, mem-size, mem-nsegs, mem-size, - mem-bound, bus_dma_flags, (mem-map))) { + mem-bound, BUS_DMA_WAITOK, (mem-map))) { bus_dmamem_unmap(dmat, mem-kaddr, mem-size); bus_dmamem_free(dmat, mem-segs, mem-nsegs); - dmamem_delete(mem, type); + dmamem_delete(mem); return NULL; } if (bus_dmamap_load(dmat, mem-map, mem-kaddr, - mem-size, NULL, bus_dma_flags)) { + mem-size, NULL, BUS_DMA_WAITOK)) {
CVS commit: [jmcneill-audiomp3] src/sys/dev/pci
Module Name:src Committed By: jmcneill Date: Sat Nov 19 23:31:26 UTC 2011 Modified Files: src/sys/dev/pci [jmcneill-audiomp3]: gcscaudio.c Log Message: adapt to audiomp api changes To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/dev/pci/gcscaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/gcscaudio.c diff -u src/sys/dev/pci/gcscaudio.c:1.7 src/sys/dev/pci/gcscaudio.c:1.7.4.1 --- src/sys/dev/pci/gcscaudio.c:1.7 Thu Jun 9 14:46:33 2011 +++ src/sys/dev/pci/gcscaudio.c Sat Nov 19 23:31:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gcscaudio.c,v 1.7 2011/06/09 14:46:33 joerg Exp $ */ +/* $NetBSD: gcscaudio.c,v 1.7.4.1 2011/11/19 23:31:26 jmcneill Exp $ */ /*- * Copyright (c) 2008 SHIMIZU Ryo r...@nerv.org @@ -27,11 +27,11 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: gcscaudio.c,v 1.7 2011/06/09 14:46:33 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: gcscaudio.c,v 1.7.4.1 2011/11/19 23:31:26 jmcneill Exp $); #include sys/param.h #include sys/systm.h -#include sys/malloc.h +#include sys/kmem.h #include sys/device.h #include sys/queue.h @@ -85,6 +85,8 @@ struct gcscaudio_softc_ch { struct gcscaudio_softc { struct device sc_dev; + kmutex_t sc_lock; + kmutex_t sc_intr_lock; pci_chipset_tag_t sc_pc; pcitag_t sc_pt; void *sc_ih; @@ -138,8 +140,8 @@ static int gcscaudio_getdev(void *, stru static int gcscaudio_set_port(void *, mixer_ctrl_t *); static int gcscaudio_get_port(void *, mixer_ctrl_t *); static int gcscaudio_query_devinfo(void *, mixer_devinfo_t *); -static void *gcscaudio_malloc(void *, int, size_t, struct malloc_type *, int); -static void gcscaudio_free(void *, void *, struct malloc_type *); +static void *gcscaudio_malloc(void *, int, size_t); +static void gcscaudio_free(void *, void *, size_t); static size_t gcscaudio_round_buffersize(void *, int, size_t); static paddr_t gcscaudio_mappage(void *, void *, off_t, int); static int gcscaudio_get_props(void *); @@ -168,7 +170,7 @@ static int gcscaudio_set_params_ch(struc audio_params_t *, stream_filter_list_t *); static int gcscaudio_allocate_dma(struct gcscaudio_softc *, size_t, void **, bus_dma_segment_t *, int, int *, - int, bus_dmamap_t *); + bus_dmamap_t *); CFATTACH_DECL(gcscaudio, sizeof (struct gcscaudio_softc), @@ -271,6 +273,8 @@ gcscaudio_attach(device_t parent, device sc-sc_dmat = pa-pa_dmat; LIST_INIT(sc-sc_dmalist); sc-sc_mch_split_buf = NULL; + mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); aprint_normal(: AMD Geode CS5536 Audio\n); @@ -286,7 +290,7 @@ gcscaudio_attach(device_t parent, device } intrstr = pci_intr_string(sc-sc_pc, ih); - sc-sc_ih = pci_intr_establish(sc-sc_pc, ih, IPL_AUDIO, + sc-sc_ih = pci_intr_establish(sc-sc_pc, ih, IPL_SCHED, gcscaudio_intr, sc); if (sc-sc_ih == NULL) { aprint_error_dev(sc-sc_dev, couldn't establish interrupt); @@ -301,7 +305,7 @@ gcscaudio_attach(device_t parent, device if (gcscaudio_allocate_dma(sc, sizeof(*sc-sc_prd.p_prdtables), (void **)(sc-sc_prd.p_prdtables), sc-sc_prd.p_prdsegs, 1, - (sc-sc_prd.p_prdnseg), M_WAITOK, (sc-sc_prd.p_prdmap)) != 0) + (sc-sc_prd.p_prdnseg), (sc-sc_prd.p_prdmap)) != 0) goto attach_failure_intr; sc-host_if.arg = sc; @@ -311,7 +315,7 @@ gcscaudio_attach(device_t parent, device sc-host_if.reset = gcscaudio_reset_codec; sc-host_if.spdif_event = gcscaudio_spdif_event_codec; - if ((rc = ac97_attach(sc-host_if, self)) != 0) { + if ((rc = ac97_attach(sc-host_if, self, sc-sc_lock)) != 0) { aprint_error_dev(sc-sc_dev, can't attach codec (error=%d)\n, rc); goto attach_failure_intr; @@ -607,7 +611,7 @@ gcscaudio_halt_output(void *arg) /* channel splitter */ sc-sc_mch_splitter = NULL; if (sc-sc_mch_split_buf) - gcscaudio_free(sc, sc-sc_mch_split_buf, M_DEVBUF); + gcscaudio_free(sc, sc-sc_mch_split_buf, sc-sc_mch_split_size); sc-sc_mch_split_buf = NULL; return 0; @@ -660,8 +664,7 @@ gcscaudio_query_devinfo(void *addr, mixe } static void * -gcscaudio_malloc(void *arg, int direction, size_t size, - struct malloc_type *pool, int flags) +gcscaudio_malloc(void *arg, int direction, size_t size) { struct gcscaudio_softc *sc; struct gcscaudio_dma *p; @@ -669,17 +672,15 @@ gcscaudio_malloc(void *arg, int directio sc = (struct gcscaudio_softc *)arg; - p = malloc(sizeof(*p), pool, flags); + p = kmem_alloc(sizeof(*p), KM_SLEEP); if (p == NULL) return NULL; p-size = size; error = gcscaudio_allocate_dma(sc, size, p-addr, - p-segs, sizeof(p-segs)/sizeof(p-segs[0]), p-nseg, - BUS_DMA_NOWAIT, p-map); - + p-segs, sizeof(p-segs)/sizeof(p-segs[0]), p-nseg, p-map); if (error) {
CVS commit: [jmcneill-audiomp3] src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sat Nov 19 23:40:07 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio [jmcneill-audiomp3]: hdafg.c hdaudio.c hdaudio_pci.c Log Message: adapt to audiomp api changes To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.4.1 src/sys/dev/pci/hdaudio/hdafg.c cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.8 -r1.8.6.1 src/sys/dev/pci/hdaudio/hdaudio_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/hdaudio/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.10 src/sys/dev/pci/hdaudio/hdafg.c:1.10.4.1 --- src/sys/dev/pci/hdaudio/hdafg.c:1.10 Tue Oct 25 00:00:13 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Sat Nov 19 23:40:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.10 2011/10/25 00:00:13 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.10.4.1 2011/11/19 23:40:07 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk @@ -60,7 +60,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.10 2011/10/25 00:00:13 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.10.4.1 2011/11/19 23:40:07 jmcneill Exp $); #include sys/types.h #include sys/param.h @@ -285,6 +285,8 @@ struct hdaudio_audiodev { struct hdafg_softc { device_t sc_dev; + kmutex_t sc_lock; + kmutex_t sc_intr_lock; struct hdaudio_softc *sc_host; struct hdaudio_codec *sc_codec; struct hdaudio_function_group *sc_fg; @@ -361,8 +363,8 @@ static int hdafg_halt_input(void *); static int hdafg_set_port(void *, mixer_ctrl_t *); static int hdafg_get_port(void *, mixer_ctrl_t *); static int hdafg_query_devinfo(void *, mixer_devinfo_t *); -static void * hdafg_allocm(void *, int, size_t, struct malloc_type *, int); -static void hdafg_freem(void *, void *, struct malloc_type *); +static void * hdafg_allocm(void *, int, size_t); +static void hdafg_freem(void *, void *, size_t); static int hdafg_getdev(void *, struct audio_device *); static size_t hdafg_round_buffersize(void *, int, size_t); static paddr_t hdafg_mappage(void *, void *, off_t, int); @@ -373,6 +375,7 @@ static int hdafg_trigger_output(void *, static int hdafg_trigger_input(void *, void *, void *, int, void (*)(void *), void *, const audio_params_t *); +static void hdafg_get_locks(void *, kmutex_t **, kmutex_t **); static const struct audio_hw_if hdafg_hw_if = { .query_encoding = hdafg_query_encoding, @@ -392,6 +395,7 @@ static const struct audio_hw_if hdafg_hw .get_props = hdafg_get_props, .trigger_output = hdafg_trigger_output, .trigger_input = hdafg_trigger_input, + .get_locks = hdafg_get_locks, }; static int @@ -3545,6 +3549,9 @@ hdafg_attach(device_t parent, device_t s sc-sc_dev = self; + mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); + callout_init(sc-sc_jack_callout, 0); callout_setfunc(sc-sc_jack_callout, hdafg_hp_switch_handler, sc); @@ -3713,6 +3720,9 @@ hdafg_detach(device_t self, int flags) if (mx) kmem_free(mx, sc-sc_nmixers * sizeof(*mx)); + mutex_destroy(sc-sc_lock); + mutex_destroy(sc-sc_intr_lock); + pmf_device_deregister(self); return 0; @@ -4032,8 +4042,7 @@ hdafg_query_devinfo(void *opaque, mixer_ } static void * -hdafg_allocm(void *opaque, int direction, size_t size, -struct malloc_type *type, int flags) +hdafg_allocm(void *opaque, int direction, size_t size) { struct hdaudio_audiodev *ad = opaque; struct hdaudio_stream *st; @@ -4056,7 +4065,7 @@ hdafg_allocm(void *opaque, int direction } static void -hdafg_freem(void *opaque, void *addr, struct malloc_type *type) +hdafg_freem(void *opaque, void *addr, size_t size) { struct hdaudio_audiodev *ad = opaque; struct hdaudio_stream *st; @@ -4167,6 +4176,15 @@ hdafg_trigger_input(void *opaque, void * return 0; } +static void +hdafg_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread) +{ + struct hdaudio_audiodev *ad = opaque; + + *intr = ad-ad_sc-sc_intr_lock; + *thread = ad-ad_sc-sc_lock; +} + static int hdafg_unsol(device_t self, uint8_t tag) { Index: src/sys/dev/pci/hdaudio/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.16 src/sys/dev/pci/hdaudio/hdaudio.c:1.16.2.1 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.16 Fri Nov 4 15:32:34 2011 +++ src/sys/dev/pci/hdaudio/hdaudio.c Sat Nov 19 23:40:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.16 2011/11/04 15:32:34 jakllsch Exp $ */ +/* $NetBSD: hdaudio.c,v 1.16.2.1 2011/11/19 23:40:07 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.16 2011/11/04 15:32:34 jakllsch Exp $); +__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.16.2.1 2011/11/19 23:40:07 jmcneill Exp $); #include
CVS commit: [jmcneill-audiomp3] src/sys/dev/ofisa
Module Name:src Committed By: mrg Date: Sun Nov 20 05:35:20 UTC 2011 Modified Files: src/sys/dev/ofisa [jmcneill-audiomp3]: joy_ofisa.c Log Message: make this compile again. i think it is even right. To generate a diff of this commit: cvs rdiff -u -r1.14.36.1 -r1.14.36.2 src/sys/dev/ofisa/joy_ofisa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ofisa/joy_ofisa.c diff -u src/sys/dev/ofisa/joy_ofisa.c:1.14.36.1 src/sys/dev/ofisa/joy_ofisa.c:1.14.36.2 --- src/sys/dev/ofisa/joy_ofisa.c:1.14.36.1 Sat Nov 19 21:49:40 2011 +++ src/sys/dev/ofisa/joy_ofisa.c Sun Nov 20 05:35:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: joy_ofisa.c,v 1.14.36.1 2011/11/19 21:49:40 jmcneill Exp $ */ +/* $NetBSD: joy_ofisa.c,v 1.14.36.2 2011/11/20 05:35:20 mrg Exp $ */ /*- * Copyright (c) 1996, 1998, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: joy_ofisa.c,v 1.14.36.1 2011/11/19 21:49:40 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: joy_ofisa.c,v 1.14.36.2 2011/11/20 05:35:20 mrg Exp $); #include sys/param.h #include sys/systm.h @@ -76,8 +76,8 @@ joy_ofisa_match(device_t parent, cfdata_ static void joy_ofisa_attach(device_t parent, device_t self, void *aux) { - struct joy_softc *sc = device_private(self); - struct joy_ofisa_softc *sc = device_private(self); + struct joy_ofisa_softc *osc = device_private(self); + struct joy_softc *sc = osc-sc_joy; struct ofisa_attach_args *aa = aux; struct ofisa_reg_desc reg; char *model = NULL;