From afbea8995b3741ed1880eaf3a64d965d545da010 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 13 Apr 2006 00:30:19 +0000 Subject: [PATCH] Fix the MPU attachment on Aztech 1020 that has a separate mpu pnp device instead of having the mpu in io[1]. From doomwarriorx at gmail dot com. --- sys/arch/i386/conf/GENERIC | 5 +++-- sys/dev/isa/sb.c | 17 +++++++++++------ sys/dev/isapnp/isapnpdevs | 3 ++- sys/dev/isapnp/mpu_isapnp.c | 6 ++++-- sys/dev/isapnp/sb_isapnp.c | 12 +++++++++--- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index f62ceb91e8f9..514335f3e497 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.741 2006/04/12 03:41:51 martti Exp $ +# $NetBSD: GENERIC,v 1.742 2006/04/13 00:30:19 christos Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.741 $" +#ident "GENERIC-$Revision: 1.742 $" maxusers 32 # estimated number of users @@ -1181,6 +1181,7 @@ audio* at audiobus? # MPU 401 UARTs #mpu* at isa? port 0x330 irq 9 # MPU401 or compatible card +mpu* at isapnp? mpu* at cmpci? mpu* at eso? mpu* at fms? diff --git a/sys/dev/isa/sb.c b/sys/dev/isa/sb.c index ec680b3460e9..ffa4eedd1763 100644 --- a/sys/dev/isa/sb.c +++ b/sys/dev/isa/sb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sb.c,v 1.81 2005/12/11 12:22:03 christos Exp $ */ +/* $NetBSD: sb.c,v 1.82 2006/04/13 00:30:19 christos Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sb.c,v 1.81 2005/12/11 12:22:03 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sb.c,v 1.82 2006/04/13 00:30:19 christos Exp $"); #include "midi.h" @@ -234,16 +234,21 @@ sbattach(struct sbdsp_softc *sc) audio_attach_mi(&sb_hw_if, sc, &sc->sc_dev); #if NMPU > 0 - if (sc->sc_hasmpu) { + switch(sc->sc_hasmpu) { + default: + case -1: /* no mpu */ + break; + case 0: /* try to attach midi directly */ + midi_attach_mi(&sb_midi_hw_if, sc, &sc->sc_dev); + break; + case 1: /* search for mpu */ arg.type = AUDIODEV_TYPE_MPU; arg.hwif = 0; arg.hdl = 0; sc->sc_mpudev = config_found(&sc->sc_dev, &arg, audioprint); - } else { - midi_attach_mi(&sb_midi_hw_if, sc, &sc->sc_dev); + break; } #endif - if (sc->sc_model >= SB_20) { arg.type = AUDIODEV_TYPE_OPL; arg.hwif = 0; diff --git a/sys/dev/isapnp/isapnpdevs b/sys/dev/isapnp/isapnpdevs index e05838310c40..5e40407e8aba 100644 --- a/sys/dev/isapnp/isapnpdevs +++ b/sys/dev/isapnp/isapnpdevs @@ -1,4 +1,4 @@ -$NetBSD: isapnpdevs,v 1.58 2006/02/19 21:30:46 martin Exp $ +$NetBSD: isapnpdevs,v 1.59 2006/04/13 00:30:20 christos Exp $ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -178,6 +178,7 @@ devlogic le BUF0001 0 Melco Inc. LGY-IV */ devlogic mpu AZT0002 0 Aztech AZT2320 MPU401 MIDI devlogic mpu AZT2001 0 Aztech MPU401 MIDI +devlogic mpu AZT2004 0 Aztech AZT1020 MPU401 MIDI devlogic mpu CSC0003 0 CS4235 MPU401 MIDI /* diff --git a/sys/dev/isapnp/mpu_isapnp.c b/sys/dev/isapnp/mpu_isapnp.c index 307979f45f2a..7c7e273c88ea 100644 --- a/sys/dev/isapnp/mpu_isapnp.c +++ b/sys/dev/isapnp/mpu_isapnp.c @@ -1,7 +1,7 @@ -/* $NetBSD: mpu_isapnp.c,v 1.12 2006/03/29 06:51:47 thorpej Exp $ */ +/* $NetBSD: mpu_isapnp.c,v 1.13 2006/04/13 00:30:20 christos Exp $ */ #include -__KERNEL_RCSID(0, "$NetBSD: mpu_isapnp.c,v 1.12 2006/03/29 06:51:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mpu_isapnp.c,v 1.13 2006/04/13 00:30:20 christos Exp $"); #include "midi.h" @@ -83,6 +83,8 @@ mpu_isapnp_attach(parent, self, aux) printf("%s: %s %s\n", sc->sc_dev.dv_xname, ipa->ipa_devident, ipa->ipa_devclass); + sc->sc_mpu.model = "Roland MPU-401 MIDI UART"; + midi_attach_mi(&mpu_midi_hw_if, &sc->sc_mpu, &sc->sc_dev); sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num, diff --git a/sys/dev/isapnp/sb_isapnp.c b/sys/dev/isapnp/sb_isapnp.c index ebd405379c63..6136e0b2bb78 100644 --- a/sys/dev/isapnp/sb_isapnp.c +++ b/sys/dev/isapnp/sb_isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: sb_isapnp.c,v 1.45 2006/03/29 06:51:47 thorpej Exp $ */ +/* $NetBSD: sb_isapnp.c,v 1.46 2006/04/13 00:30:20 christos Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sb_isapnp.c,v 1.45 2006/03/29 06:51:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sb_isapnp.c,v 1.46 2006/04/13 00:30:20 christos Exp $"); #include #include @@ -135,7 +135,13 @@ sb_isapnp_attach(struct device *parent, struct device *self, void *aux) sc->sc_drq16 = -1; #if NMPU > 0 - if (ipa->ipa_nio > 1) { + /* + * Aztech 1020 don't store information about it's mpu in io[1] + * It has a seperate pnpdev for the mpu + */ + if (strcmp(ipa->ipa_devlogic, "AZT1016") == 0) + sc->sc_hasmpu = -1; + else if (ipa->ipa_nio > 1) { sc->sc_hasmpu = 1; sc->sc_mpu_iot = ipa->ipa_iot; sc->sc_mpu_ioh = ipa->ipa_io[1].h;