Tue Aug 1 14:57:27 2023 UTC ()
Pull up following revision(s) (requested by riastradh in ticket #286):

	sys/dev/isapnp/sb_isapnp.c: revision 1.54
	sys/dev/ofisa/sb_ofisa.c: revision 1.24

sb(4): Fix missing mutex initialization at isapnp and ofisa.
PR kern/57363


(martin)
diff -r1.53 -r1.53.28.1 src/sys/dev/isapnp/sb_isapnp.c
diff -r1.23 -r1.23.18.1 src/sys/dev/ofisa/sb_ofisa.c

cvs diff -r1.53 -r1.53.28.1 src/sys/dev/isapnp/sb_isapnp.c (expand / switch to unified diff)

--- src/sys/dev/isapnp/sb_isapnp.c 2019/05/08 13:40:18 1.53
+++ src/sys/dev/isapnp/sb_isapnp.c 2023/08/01 14:57:27 1.53.28.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sb_isapnp.c,v 1.53 2019/05/08 13:40:18 isaki Exp $ */ 1/* $NetBSD: sb_isapnp.c,v 1.53.28.1 2023/08/01 14:57:27 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1991-1993 Regents of the University of California. 4 * Copyright (c) 1991-1993 Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE. 33 * SUCH DAMAGE.
34 * 34 *
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: sb_isapnp.c,v 1.53 2019/05/08 13:40:18 isaki Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: sb_isapnp.c,v 1.53.28.1 2023/08/01 14:57:27 martin Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/errno.h> 42#include <sys/errno.h>
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <sys/syslog.h> 44#include <sys/syslog.h>
45#include <sys/device.h> 45#include <sys/device.h>
46#include <sys/proc.h> 46#include <sys/proc.h>
47 47
48#include <sys/bus.h> 48#include <sys/bus.h>
49 49
50#include <sys/audioio.h> 50#include <sys/audioio.h>
51#include <dev/audio/audio_if.h> 51#include <dev/audio/audio_if.h>
@@ -148,20 +148,23 @@ sb_isapnp_attach(device_t parent, device @@ -148,20 +148,23 @@ sb_isapnp_attach(device_t parent, device
148 sc->sc_hasmpu = SBMPU_NONE; 148 sc->sc_hasmpu = SBMPU_NONE;
149 else if (ipa->ipa_nio > 1) { 149 else if (ipa->ipa_nio > 1) {
150 sc->sc_hasmpu = SBMPU_EXTERNAL; 150 sc->sc_hasmpu = SBMPU_EXTERNAL;
151 sc->sc_mpu_iot = ipa->ipa_iot; 151 sc->sc_mpu_iot = ipa->ipa_iot;
152 sc->sc_mpu_ioh = ipa->ipa_io[1].h; 152 sc->sc_mpu_ioh = ipa->ipa_io[1].h;
153 } 153 }
154#endif 154#endif
155 155
156 if (!sbmatch(sc, 0, device_cfdata(self))) { 156 if (!sbmatch(sc, 0, device_cfdata(self))) {
157 aprint_error_dev(self, "sbmatch failed\n"); 157 aprint_error_dev(self, "sbmatch failed\n");
158 return; 158 return;
159 } 159 }
160 160
 161 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 162 mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
 163
161 sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num, 164 sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num,
162 ipa->ipa_irq[0].type, IPL_AUDIO, sbdsp_intr, sc); 165 ipa->ipa_irq[0].type, IPL_AUDIO, sbdsp_intr, sc);
163 166
164 aprint_normal_dev(self, "%s %s", ipa->ipa_devident, ipa->ipa_devclass); 167 aprint_normal_dev(self, "%s %s", ipa->ipa_devident, ipa->ipa_devclass);
165 168
166 sbattach(sc); 169 sbattach(sc);
167} 170}

cvs diff -r1.23 -r1.23.18.1 src/sys/dev/ofisa/sb_ofisa.c (expand / switch to unified diff)

--- src/sys/dev/ofisa/sb_ofisa.c 2021/01/27 03:10:21 1.23
+++ src/sys/dev/ofisa/sb_ofisa.c 2023/08/01 14:57:27 1.23.18.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sb_ofisa.c,v 1.23 2021/01/27 03:10:21 thorpej Exp $ */ 1/* $NetBSD: sb_ofisa.c,v 1.23.18.1 2023/08/01 14:57:27 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center. 9 * NASA Ames Research Center.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: sb_ofisa.c,v 1.23 2021/01/27 03:10:21 thorpej Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: sb_ofisa.c,v 1.23.18.1 2023/08/01 14:57:27 martin Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/device.h> 38#include <sys/device.h>
39 39
40#include <sys/bus.h> 40#include <sys/bus.h>
41#include <sys/intr.h> 41#include <sys/intr.h>
42 42
43#include <sys/audioio.h> 43#include <sys/audioio.h>
44#include <dev/audio/audio_if.h> 44#include <dev/audio/audio_if.h>
45#include <dev/midi_if.h> 45#include <dev/midi_if.h>
46 46
47#include <dev/ofw/openfirm.h> 47#include <dev/ofw/openfirm.h>
@@ -160,20 +160,23 @@ sb_ofisa_attach(device_t parent, device_ @@ -160,20 +160,23 @@ sb_ofisa_attach(device_t parent, device_
160 } 160 }
161 } 161 }
162 162
163 if (sc->sc_drq8 == DRQUNK) { 163 if (sc->sc_drq8 == DRQUNK) {
164 aprint_error(": no 8-bit DMA channel\n"); 164 aprint_error(": no 8-bit DMA channel\n");
165 return; 165 return;
166 } 166 }
167 167
168 if (sbmatch(sc) == 0) { 168 if (sbmatch(sc) == 0) {
169 aprint_error(": sbmatch failed\n"); 169 aprint_error(": sbmatch failed\n");
170 return; 170 return;
171 } 171 }
172 172
 173 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 174 mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
 175
173 sc->sc_ih = isa_intr_establish(aa->ic, intr.irq, IST_EDGE, IPL_AUDIO, 176 sc->sc_ih = isa_intr_establish(aa->ic, intr.irq, IST_EDGE, IPL_AUDIO,
174 sbdsp_intr, sc); 177 sbdsp_intr, sc);
175 178
176 ofisa_print_model(self, aa->oba.oba_phandle); 179 ofisa_print_model(self, aa->oba.oba_phandle);
177 180
178 sbattach(sc); 181 sbattach(sc);
179} 182}