Sun Jan 14 15:24:06 2024 UTC (127d)
Pull up following revision(s) (requested by chs in ticket #542):

	sys/dev/pci/yds.c: revision 1.69
	sys/dev/pci/cmpci.c: revision 1.61
	sys/dev/pci/sv.c: revision 1.62
	sys/dev/pci/fms.c: revision 1.50

mpu / opl: add an interface attribute to config_found() calls for these

specify an interface attribute when attaching mpu and opl devices.
the PCI devices that are the parents of these midi devices
(cmpci, eso, fms, sv, yds) have two interface attributes:
"audiobus", and also one named the same as the parent device,
eg. "cmpci" has an interface attribute named "cmpci".
we must specify the latter one to attach these children.


(martin)
diff -r1.60 -r1.60.4.1 src/sys/dev/pci/cmpci.c
diff -r1.49 -r1.49.6.1 src/sys/dev/pci/fms.c
diff -r1.61 -r1.61.6.1 src/sys/dev/pci/sv.c
diff -r1.68 -r1.68.6.1 src/sys/dev/pci/yds.c

cvs diff -r1.60 -r1.60.4.1 src/sys/dev/pci/cmpci.c (expand / switch to unified diff)

--- src/sys/dev/pci/cmpci.c 2022/05/31 08:43:15 1.60
+++ src/sys/dev/pci/cmpci.c 2024/01/14 15:24:06 1.60.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cmpci.c,v 1.60 2022/05/31 08:43:15 andvar Exp $ */ 1/* $NetBSD: cmpci.c,v 1.60.4.1 2024/01/14 15:24:06 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000, 2001, 2008 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 Takuya SHIOZAKI <tshiozak@NetBSD.org> . 8 * by Takuya SHIOZAKI <tshiozak@NetBSD.org> .
9 * 9 *
10 * This code is derived from software contributed to The NetBSD Foundation 10 * This code is derived from software contributed to The NetBSD Foundation
11 * by ITOH Yasufumi. 11 * by ITOH Yasufumi.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -33,27 +33,27 @@ @@ -33,27 +33,27 @@
33 * 33 *
34 */ 34 */
35 35
36/* 36/*
37 * C-Media CMI8x38 Audio Chip Support. 37 * C-Media CMI8x38 Audio Chip Support.
38 * 38 *
39 * TODO: 39 * TODO:
40 * - 4ch / 6ch support. 40 * - 4ch / 6ch support.
41 * - Joystick support. 41 * - Joystick support.
42 * 42 *
43 */ 43 */
44 44
45#include <sys/cdefs.h> 45#include <sys/cdefs.h>
46__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.60 2022/05/31 08:43:15 andvar Exp $"); 46__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.60.4.1 2024/01/14 15:24:06 martin Exp $");
47 47
48#if defined(AUDIO_DEBUG) || defined(DEBUG) 48#if defined(AUDIO_DEBUG) || defined(DEBUG)
49#define DPRINTF(x) if (cmpcidebug) printf x 49#define DPRINTF(x) if (cmpcidebug) printf x
50int cmpcidebug = 0; 50int cmpcidebug = 0;
51#else 51#else
52#define DPRINTF(x) 52#define DPRINTF(x)
53#endif 53#endif
54 54
55#include "mpu.h" 55#include "mpu.h"
56 56
57#include <sys/param.h> 57#include <sys/param.h>
58#include <sys/systm.h> 58#include <sys/systm.h>
59#include <sys/kernel.h> 59#include <sys/kernel.h>
@@ -409,36 +409,36 @@ cmpci_attach(device_t parent, device_t s @@ -409,36 +409,36 @@ cmpci_attach(device_t parent, device_t s
409 mutex_destroy(&sc->sc_intr_lock); 409 mutex_destroy(&sc->sc_intr_lock);
410 return; 410 return;
411 } 411 }
412 aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", strintr); 412 aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", strintr);
413 413
414 sc->sc_dmat = pa->pa_dmat; 414 sc->sc_dmat = pa->pa_dmat;
415 415
416 audio_attach_mi(&cmpci_hw_if, sc, sc->sc_dev); 416 audio_attach_mi(&cmpci_hw_if, sc, sc->sc_dev);
417 417
418 /* attach OPL device */ 418 /* attach OPL device */
419 aa.type = AUDIODEV_TYPE_OPL; 419 aa.type = AUDIODEV_TYPE_OPL;
420 aa.hwif = NULL; 420 aa.hwif = NULL;
421 aa.hdl = NULL; 421 aa.hdl = NULL;
422 (void)config_found(sc->sc_dev, &aa, audioprint, CFARGS_NONE); 422 (void)config_found(sc->sc_dev, &aa, audioprint, CFARGS(.iattr = "cmpci"));
423 423
424 /* attach MPU-401 device */ 424 /* attach MPU-401 device */
425 aa.type = AUDIODEV_TYPE_MPU; 425 aa.type = AUDIODEV_TYPE_MPU;
426 aa.hwif = NULL; 426 aa.hwif = NULL;
427 aa.hdl = NULL; 427 aa.hdl = NULL;
428 if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, 428 if (bus_space_subregion(sc->sc_iot, sc->sc_ioh,
429 CMPCI_REG_MPU_BASE, CMPCI_REG_MPU_SIZE, &sc->sc_mpu_ioh) == 0) 429 CMPCI_REG_MPU_BASE, CMPCI_REG_MPU_SIZE, &sc->sc_mpu_ioh) == 0)
430 sc->sc_mpudev = config_found(sc->sc_dev, &aa, audioprint, 430 sc->sc_mpudev = config_found(sc->sc_dev, &aa, audioprint,
431 CFARGS_NONE); 431 CFARGS(.iattr = "cmpci"));
432 432
433 /* get initial value (this is 0 and may be omitted but just in case) */ 433 /* get initial value (this is 0 and may be omitted but just in case) */
434 sc->sc_reg_misc = bus_space_read_4(sc->sc_iot, sc->sc_ioh, 434 sc->sc_reg_misc = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
435 CMPCI_REG_MISC) & ~CMPCI_REG_SPDIF48K; 435 CMPCI_REG_MISC) & ~CMPCI_REG_SPDIF48K;
436 436
437 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_RESET, 0); 437 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_RESET, 0);
438 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_ADCMIX_L, 0); 438 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_ADCMIX_L, 0);
439 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_ADCMIX_R, 0); 439 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_ADCMIX_R, 0);
440 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_OUTMIX, 440 cmpci_mixerreg_write(sc, CMPCI_SB16_MIXER_OUTMIX,
441 CMPCI_SB16_SW_CD|CMPCI_SB16_SW_MIC | CMPCI_SB16_SW_LINE); 441 CMPCI_SB16_SW_CD|CMPCI_SB16_SW_MIC | CMPCI_SB16_SW_LINE);
442 for (i = 0; i < CMPCI_NDEVS; i++) { 442 for (i = 0; i < CMPCI_NDEVS; i++) {
443 switch (i) { 443 switch (i) {
444 /* 444 /*

cvs diff -r1.49 -r1.49.6.1 src/sys/dev/pci/fms.c (expand / switch to unified diff)

--- src/sys/dev/pci/fms.c 2021/08/07 16:19:14 1.49
+++ src/sys/dev/pci/fms.c 2024/01/14 15:24:06 1.49.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fms.c,v 1.49 2021/08/07 16:19:14 thorpej Exp $ */ 1/* $NetBSD: fms.c,v 1.49.6.1 2024/01/14 15:24:06 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2008 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 Witold J. Wnuk. 8 * by Witold J. Wnuk.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Forte Media FM801 Audio Device Driver 33 * Forte Media FM801 Audio Device Driver
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.49 2021/08/07 16:19:14 thorpej Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.49.6.1 2024/01/14 15:24:06 martin Exp $");
38 38
39#include "mpu.h" 39#include "mpu.h"
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/kernel.h> 43#include <sys/kernel.h>
44#include <sys/kmem.h> 44#include <sys/kmem.h>
45#include <sys/device.h> 45#include <sys/device.h>
46#include <sys/audioio.h> 46#include <sys/audioio.h>
47 47
48#include <sys/bus.h> 48#include <sys/bus.h>
49#include <sys/cpu.h> 49#include <sys/cpu.h>
50 50
@@ -315,32 +315,33 @@ fms_attach(device_t parent, device_t sel @@ -315,32 +315,33 @@ fms_attach(device_t parent, device_t sel
315 sc->host_if.reset = fms_reset_codec; 315 sc->host_if.reset = fms_reset_codec;
316 316
317 if (ac97_attach(&sc->host_if, self, &sc->sc_lock) != 0) { 317 if (ac97_attach(&sc->host_if, self, &sc->sc_lock) != 0) {
318 mutex_destroy(&sc->sc_intr_lock); 318 mutex_destroy(&sc->sc_intr_lock);
319 mutex_destroy(&sc->sc_lock); 319 mutex_destroy(&sc->sc_lock);
320 return; 320 return;
321 } 321 }
322 322
323 audio_attach_mi(&fms_hw_if, sc, sc->sc_dev); 323 audio_attach_mi(&fms_hw_if, sc, sc->sc_dev);
324 324
325 aa.type = AUDIODEV_TYPE_OPL; 325 aa.type = AUDIODEV_TYPE_OPL;
326 aa.hwif = NULL; 326 aa.hwif = NULL;
327 aa.hdl = NULL; 327 aa.hdl = NULL;
328 config_found(sc->sc_dev, &aa, audioprint, CFARGS_NONE); 328 config_found(sc->sc_dev, &aa, audioprint, CFARGS(.iattr = "fms"));
329 329
330 aa.type = AUDIODEV_TYPE_MPU; 330 aa.type = AUDIODEV_TYPE_MPU;
331 aa.hwif = NULL; 331 aa.hwif = NULL;
332 aa.hdl = NULL; 332 aa.hdl = NULL;
333 sc->sc_mpu_dev = config_found(sc->sc_dev, &aa, audioprint, CFARGS_NONE); 333 sc->sc_mpu_dev = config_found(sc->sc_dev, &aa, audioprint,
 334 CFARGS(.iattr = "fms"));
334} 335}
335 336
336/* 337/*
337 * Each AC-link frame takes 20.8us, data should be ready in next frame, 338 * Each AC-link frame takes 20.8us, data should be ready in next frame,
338 * we allow more than two. 339 * we allow more than two.
339 */ 340 */
340#define TIMO 50 341#define TIMO 50
341static int 342static int
342fms_read_codec(void *addr, uint8_t reg, uint16_t *val) 343fms_read_codec(void *addr, uint8_t reg, uint16_t *val)
343{ 344{
344 struct fms_softc *sc; 345 struct fms_softc *sc;
345 int i; 346 int i;
346 347

cvs diff -r1.61 -r1.61.6.1 src/sys/dev/pci/sv.c (expand / switch to unified diff)

--- src/sys/dev/pci/sv.c 2021/08/07 16:19:14 1.61
+++ src/sys/dev/pci/sv.c 2024/01/14 15:24:06 1.61.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sv.c,v 1.61 2021/08/07 16:19:14 thorpej Exp $ */ 1/* $NetBSD: sv.c,v 1.61.6.1 2024/01/14 15:24:06 martin Exp $ */
2/* $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */ 2/* $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. 5 * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Charles M. Hannum. 9 * by Charles M. Hannum.
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
@@ -57,27 +57,27 @@ @@ -57,27 +57,27 @@
57 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 57 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
58 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 58 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
59 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 59 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
61 * POSSIBILITY OF SUCH DAMAGE. 61 * POSSIBILITY OF SUCH DAMAGE.
62 */ 62 */
63 63
64/* 64/*
65 * S3 SonicVibes driver 65 * S3 SonicVibes driver
66 * Heavily based on the eap driver by Lennart Augustsson 66 * Heavily based on the eap driver by Lennart Augustsson
67 */ 67 */
68 68
69#include <sys/cdefs.h> 69#include <sys/cdefs.h>
70__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.61 2021/08/07 16:19:14 thorpej Exp $"); 70__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.61.6.1 2024/01/14 15:24:06 martin Exp $");
71 71
72#include <sys/param.h> 72#include <sys/param.h>
73#include <sys/systm.h> 73#include <sys/systm.h>
74#include <sys/kernel.h> 74#include <sys/kernel.h>
75#include <sys/kmem.h> 75#include <sys/kmem.h>
76#include <sys/device.h> 76#include <sys/device.h>
77 77
78#include <dev/pci/pcireg.h> 78#include <dev/pci/pcireg.h>
79#include <dev/pci/pcivar.h> 79#include <dev/pci/pcivar.h>
80#include <dev/pci/pcidevs.h> 80#include <dev/pci/pcidevs.h>
81 81
82#include <sys/audioio.h> 82#include <sys/audioio.h>
83#include <dev/audio/audio_if.h> 83#include <dev/audio/audio_if.h>
@@ -439,27 +439,27 @@ sv_attach(device_t parent, device_t self @@ -439,27 +439,27 @@ sv_attach(device_t parent, device_t self
439 reg = sv_read(sc, SV_CODEC_INTMASK); 439 reg = sv_read(sc, SV_CODEC_INTMASK);
440 reg &= ~(SV_INTMASK_DMAA | SV_INTMASK_DMAC); 440 reg &= ~(SV_INTMASK_DMAA | SV_INTMASK_DMAC);
441 reg |= SV_INTMASK_UD | SV_INTMASK_SINT | SV_INTMASK_MIDI; 441 reg |= SV_INTMASK_UD | SV_INTMASK_SINT | SV_INTMASK_MIDI;
442 sv_write(sc, SV_CODEC_INTMASK, reg); 442 sv_write(sc, SV_CODEC_INTMASK, reg);
443 sv_read(sc, SV_CODEC_STATUS); 443 sv_read(sc, SV_CODEC_STATUS);
444 444
445 sv_init_mixer(sc); 445 sv_init_mixer(sc);
446 446
447 audio_attach_mi(&sv_hw_if, sc, self); 447 audio_attach_mi(&sv_hw_if, sc, self);
448 448
449 arg.type = AUDIODEV_TYPE_OPL; 449 arg.type = AUDIODEV_TYPE_OPL;
450 arg.hwif = 0; 450 arg.hwif = 0;
451 arg.hdl = 0; 451 arg.hdl = 0;
452 (void)config_found(self, &arg, audioprint, CFARGS_NONE); 452 (void)config_found(self, &arg, audioprint, CFARGS(.iattr = "sv"));
453 453
454 sc->sc_pa = *pa; /* for deferred setup */ 454 sc->sc_pa = *pa; /* for deferred setup */
455 config_defer(self, sv_defer); 455 config_defer(self, sv_defer);
456} 456}
457 457
458#ifdef AUDIO_DEBUG 458#ifdef AUDIO_DEBUG
459void 459void
460sv_dumpregs(struct sv_softc *sc) 460sv_dumpregs(struct sv_softc *sc)
461{ 461{
462 int idx; 462 int idx;
463 463
464#if 0 464#if 0
465 for (idx = 0; idx < 0x50; idx += 4) 465 for (idx = 0; idx < 0x50; idx += 4)

cvs diff -r1.68 -r1.68.6.1 src/sys/dev/pci/yds.c (expand / switch to unified diff)

--- src/sys/dev/pci/yds.c 2021/08/07 16:19:14 1.68
+++ src/sys/dev/pci/yds.c 2024/01/14 15:24:06 1.68.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: yds.c,v 1.68 2021/08/07 16:19:14 thorpej Exp $ */ 1/* $NetBSD: yds.c,v 1.68.6.1 2024/01/14 15:24:06 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto. 4 * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
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.
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * Yamaha YMF724[B-F]/740[B-C]/744/754 29 * Yamaha YMF724[B-F]/740[B-C]/744/754
30 * 30 *
31 * Documentation links: 31 * Documentation links:
32 * - ftp://ftp.alsa-project.org/pub/manuals/yamaha/ 32 * - ftp://ftp.alsa-project.org/pub/manuals/yamaha/
33 * - ftp://ftp.alsa-project.org/pub/manuals/yamaha/pci/ 33 * - ftp://ftp.alsa-project.org/pub/manuals/yamaha/pci/
34 * 34 *
35 * TODO: 35 * TODO:
36 * - FM synth volume (difficult: mixed before ac97) 36 * - FM synth volume (difficult: mixed before ac97)
37 * - Digital in/out (SPDIF) support 37 * - Digital in/out (SPDIF) support
38 * - Effect?? 38 * - Effect??
39 */ 39 */
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.68 2021/08/07 16:19:14 thorpej Exp $"); 42__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.68.6.1 2024/01/14 15:24:06 martin Exp $");
43 43
44#include "mpu.h" 44#include "mpu.h"
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/systm.h> 47#include <sys/systm.h>
48#include <sys/kernel.h> 48#include <sys/kernel.h>
49#include <sys/fcntl.h> 49#include <sys/fcntl.h>
50#include <sys/kmem.h> 50#include <sys/kmem.h>
51#include <sys/device.h> 51#include <sys/device.h>
52#include <sys/proc.h> 52#include <sys/proc.h>
53 53
54#include <dev/pci/pcidevs.h> 54#include <dev/pci/pcidevs.h>
55#include <dev/pci/pcireg.h> 55#include <dev/pci/pcireg.h>
@@ -582,27 +582,28 @@ yds_configure_legacy(device_t self) @@ -582,27 +582,28 @@ yds_configure_legacy(device_t self)
582 if (SELECTABLE) { 582 if (SELECTABLE) {
583 pci_conf_write(sc->sc_pc, sc->sc_pcitag, 583 pci_conf_write(sc->sc_pc, sc->sc_pcitag,
584 YDS_PCI_LEGACY, reg | (i << (0+16))); 584 YDS_PCI_LEGACY, reg | (i << (0+16)));
585 delay(100*1000); /* wait 100ms */ 585 delay(100*1000); /* wait 100ms */
586 } else 586 } else
587 pci_conf_write(sc->sc_pc, sc->sc_pcitag, 587 pci_conf_write(sc->sc_pc, sc->sc_pcitag,
588 YDS_PCI_FM_BA, opl_addrs[i]); 588 YDS_PCI_FM_BA, opl_addrs[i]);
589 if (bus_space_map(sc->sc_opl_iot, 589 if (bus_space_map(sc->sc_opl_iot,
590 opl_addrs[i], 4, 0, &sc->sc_opl_ioh) == 0) { 590 opl_addrs[i], 4, 0, &sc->sc_opl_ioh) == 0) {
591 struct audio_attach_args aa; 591 struct audio_attach_args aa;
592 592
593 aa.type = AUDIODEV_TYPE_OPL; 593 aa.type = AUDIODEV_TYPE_OPL;
594 aa.hwif = aa.hdl = NULL; 594 aa.hwif = aa.hdl = NULL;
595 dev = config_found(self, &aa, audioprint, CFARGS_NONE); 595 dev = config_found(self, &aa, audioprint,
 596 CFARGS(.iattr = "yds"));
596 if (dev == 0) 597 if (dev == 0)
597 bus_space_unmap(sc->sc_opl_iot, 598 bus_space_unmap(sc->sc_opl_iot,
598 sc->sc_opl_ioh, 4); 599 sc->sc_opl_ioh, 4);
599 else { 600 else {
600 if (SELECTABLE) 601 if (SELECTABLE)
601 reg |= (i << (0+16)); 602 reg |= (i << (0+16));
602 break; 603 break;
603 } 604 }
604 } 605 }
605 } 606 }
606 if (dev == 0) { 607 if (dev == 0) {
607 reg &= ~YDS_PCI_LEGACY_FMEN; 608 reg &= ~YDS_PCI_LEGACY_FMEN;
608 pci_conf_write(sc->sc_pc, sc->sc_pcitag, 609 pci_conf_write(sc->sc_pc, sc->sc_pcitag,
@@ -618,27 +619,28 @@ yds_configure_legacy(device_t self) @@ -618,27 +619,28 @@ yds_configure_legacy(device_t self)
618 for (i = 0; i < sizeof(mpu_addrs) / sizeof(bus_addr_t); i++) { 619 for (i = 0; i < sizeof(mpu_addrs) / sizeof(bus_addr_t); i++) {
619 if (SELECTABLE) 620 if (SELECTABLE)
620 pci_conf_write(sc->sc_pc, sc->sc_pcitag, 621 pci_conf_write(sc->sc_pc, sc->sc_pcitag,
621 YDS_PCI_LEGACY, reg | (i << (4+16))); 622 YDS_PCI_LEGACY, reg | (i << (4+16)));
622 else 623 else
623 pci_conf_write(sc->sc_pc, sc->sc_pcitag, 624 pci_conf_write(sc->sc_pc, sc->sc_pcitag,
624 YDS_PCI_MPU_BA, mpu_addrs[i]); 625 YDS_PCI_MPU_BA, mpu_addrs[i]);
625 if (bus_space_map(sc->sc_mpu_iot, 626 if (bus_space_map(sc->sc_mpu_iot,
626 mpu_addrs[i], 2, 0, &sc->sc_mpu_ioh) == 0) { 627 mpu_addrs[i], 2, 0, &sc->sc_mpu_ioh) == 0) {
627 struct audio_attach_args aa; 628 struct audio_attach_args aa;
628 629
629 aa.type = AUDIODEV_TYPE_MPU; 630 aa.type = AUDIODEV_TYPE_MPU;
630 aa.hwif = aa.hdl = NULL; 631 aa.hwif = aa.hdl = NULL;
631 dev = config_found(self, &aa, audioprint, CFARGS_NONE); 632 dev = config_found(self, &aa, audioprint,
 633 CFARGS(.iattr = "yds"));
632 if (dev == 0) 634 if (dev == 0)
633 bus_space_unmap(sc->sc_mpu_iot, 635 bus_space_unmap(sc->sc_mpu_iot,
634 sc->sc_mpu_ioh, 2); 636 sc->sc_mpu_ioh, 2);
635 else { 637 else {
636 if (SELECTABLE) 638 if (SELECTABLE)
637 reg |= (i << (4+16)); 639 reg |= (i << (4+16));
638 break; 640 break;
639 } 641 }
640 } 642 }
641 } 643 }
642 if (dev == 0) { 644 if (dev == 0) {
643 reg &= ~(YDS_PCI_LEGACY_MEN | YDS_PCI_LEGACY_MIEN); 645 reg &= ~(YDS_PCI_LEGACY_MEN | YDS_PCI_LEGACY_MIEN);
644 pci_conf_write(sc->sc_pc, sc->sc_pcitag, YDS_PCI_LEGACY, reg); 646 pci_conf_write(sc->sc_pc, sc->sc_pcitag, YDS_PCI_LEGACY, reg);