Subject: kern/3371: First crack at GUS PNP support
To: None <gnats-bugs@gnats.netbsd.org>
From: Gary D. Duzan <gary@wheel.tiac.net>
List: netbsd-bugs
Date: 03/21/1997 09:35:27
>Number:         3371
>Category:       kern
>Synopsis:       First crack at GUS PNP support
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 21 06:50:00 1997
>Last-Modified:
>Originator:     Gary D. Duzan
>Organization:
	Work not supported by any organization
>Release:        Mar 21, 1997
>Environment:
	
System: NetBSD wheel.tiac.net 1.2C NetBSD 1.2C (WHEEL) #0: Thu Mar 13 17:53:49 EST 1997 gary@wheel.tiac.net:/altroot/local/build/NetBSD/sys/arch/i386/compile/WHEEL i386


>Description:
	I've included diffs to split up gus.c into gus.c and gusvar.h
	and add a gus_isapnp driver to allow the card to be connected
	by the isapnp code. The card still won't make any noise, but I
	hope to get that fixed before too long.
	Note: This is my first real attempt at this stuff. If I missed
	something obvious, I'd appreciate comments.
>How-To-Repeat:
	Try it out.
>Fix:

*** /usr/src/sys/dev/isa/gus.c	Thu Mar 20 07:20:57 1997
--- ./sys/dev/isa/gus.c	Fri Mar 21 08:47:02 1997
***************
*** 128,133 ****
--- 128,134 ----
  #include <dev/isa/ad1848var.h>
  #include <dev/isa/cs4231var.h>
  #include "gusreg.h"
+ #include "gusvar.h"
  
  #ifdef AUDIO_DEBUG
  #define STATIC /* empty; for debugging symbols */
***************
*** 135,320 ****
  #define STATIC static
  #endif
  
- /*
-  * Software state of a single "voice" on the GUS
-  */
- 
- struct gus_voice {
- 
- 	/*
- 	 * Various control bits
- 	 */
- 
- 	unsigned char voccntl;	/* State of voice control register */
- 	unsigned char volcntl;	/* State of volume control register */
- 	unsigned char pan_pos;	/* Position of volume panning (4 bits) */
- 	int rate;		/* Sample rate of voice being played back */
- 
- 	/*
- 	 * Address of the voice data into the GUS's DRAM.  20 bits each
- 	 */
- 
- 	u_long start_addr;	/* Starting address of voice data loop area */
- 	u_long end_addr;	/* Ending address of voice data loop */
- 	u_long current_addr;	/* Beginning address of voice data
- 				   (start playing here) */
- 
- 	/*
- 	 * linear volume values for the GUS's volume ramp.  0-511 (9 bits).
- 	 * These values must be translated into the logarithmic values using
- 	 * gus_log_volumes[]
- 	 */
- 
- 	int start_volume;	/* Starting position of volume ramp */
- 	int current_volume;	/* Current position of volume on volume ramp */
- 	int end_volume;		/* Ending position of volume on volume ramp */
- };
- 
- /*
-  * Software state of GUS
-  */
- 
- struct gus_softc {
- 	struct device sc_dev;		/* base device */
- 	struct isadev sc_id;		/* ISA device */
- 	void *sc_ih;			/* interrupt vector */
- 
- 	int sc_iobase;			/* I/O base address */
- 	int sc_irq;			/* IRQ used */
- 	int sc_drq;			/* DMA channel for play */
- 	int sc_recdrq;			/* DMA channel for recording */
- 
- 	int sc_flags;			/* Various flags about the GUS */
- #define GUS_MIXER_INSTALLED	0x01	/* An ICS mixer is installed */
- #define GUS_LOCKED		0x02	/* GUS is busy doing multi-phase DMA */
- #define GUS_CODEC_INSTALLED	0x04	/* CS4231 installed/MAX */
- #define GUS_PLAYING		0x08	/* GUS is playing a voice */
- #define GUS_DMAOUT_ACTIVE	0x10	/* GUS is busy doing audio DMA */
- #define GUS_DMAIN_ACTIVE	0x20	/* GUS is busy sampling  */
- #define GUS_OPEN		0x100	/* GUS is open */
- 	int sc_dsize;			/* Size of GUS DRAM */
- 	int sc_voices;			/* Number of active voices */
- 	u_char sc_revision;		/* Board revision of GUS */
- 	u_char sc_mixcontrol;		/* Value of GUS_MIX_CONTROL register */
- 
- 	u_long sc_orate;		/* Output sampling rate */
- 	u_long sc_irate;		/* Input sampling rate */
- 
- 	int sc_encoding;		/* Current data encoding type */
- 	int sc_precision;		/* # of bits of precision */
- 	int sc_channels;		/* Number of active channels */
- 	int sc_blocksize;		/* Current blocksize */
- 	int sc_chanblocksize;		/* Current blocksize for each in-use
- 					   channel */
- 	short sc_nbufs;			/* how many on-GUS bufs per-channel */
- 	short sc_bufcnt;		/* how many need to be played */
- 	void *sc_deintr_buf;		/* deinterleave buffer for stereo */
- 
- 	int sc_ogain;			/* Output gain control */
- 	u_char sc_out_port;		/* Current out port (generic only) */
- 	u_char sc_in_port;		/* keep track of it when no codec */
- 
- 	void (*sc_dmaoutintr) __P((void*)); /* DMA completion intr handler */
- 	void *sc_outarg;		/* argument for sc_dmaoutintr() */
- 	u_char *sc_dmaoutaddr;		/* for isa_dmadone */
- 	u_long sc_gusaddr;		/* where did we just put it? */
- 	int sc_dmaoutcnt;		/* for isa_dmadone */
- 
- 	void (*sc_dmainintr) __P((void*)); /* DMA completion intr handler */
- 	void *sc_inarg;			/* argument for sc_dmaoutintr() */
- 	u_char *sc_dmainaddr;		/* for isa_dmadone */
- 	int sc_dmaincnt;		/* for isa_dmadone */
- 
- 	struct stereo_dma_intr {
- 		void (*intr)__P((void *));
- 		void *arg;
- 		u_char *buffer;
- 		u_long dmabuf;
- 		int size;
- 		int flags;
- 	} sc_stereo;
- 
- 	/*
- 	 * State information for linear audio layer
- 	 */
- 
- 	int sc_dmabuf;			/* Which ring buffer we're DMA'ing to */
- 	int sc_playbuf;			/* Which ring buffer we're playing */
- 
- 	/*
- 	 * Voice information array.  All voice-specific information is stored
- 	 * here
- 	 */
- 
- 	struct gus_voice sc_voc[32];	/* Voice data for each voice */
- 	union {
- 		struct ics2101_softc sc_mixer_u;
- 		struct ad1848_softc sc_codec_u;
- 	} u;
- #define sc_mixer u.sc_mixer_u
- #define sc_codec u.sc_codec_u
- };
- 
- struct ics2101_volume {
- 	u_char left;
- 	u_char right;
- };
- 
- #define HAS_CODEC(sc) ((sc)->sc_flags & GUS_CODEC_INSTALLED)
- #define HAS_MIXER(sc) ((sc)->sc_flags & GUS_MIXER_INSTALLED)
- 
- /*
-  * Mixer devices for ICS2101
-  */
- /* MIC IN mute, line in mute, line out mute are first since they can be done
-    even if no ICS mixer. */
- #define GUSICS_MIC_IN_MUTE		0
- #define GUSICS_LINE_IN_MUTE		1
- #define GUSICS_MASTER_MUTE		2
- #define GUSICS_CD_MUTE			3
- #define GUSICS_DAC_MUTE			4
- #define GUSICS_MIC_IN_LVL		5
- #define GUSICS_LINE_IN_LVL		6
- #define GUSICS_CD_LVL			7
- #define GUSICS_DAC_LVL			8
- #define GUSICS_MASTER_LVL		9
- 
- #define GUSICS_RECORD_SOURCE		10
- 
- /* Classes */
- #define GUSICS_INPUT_CLASS		11
- #define GUSICS_OUTPUT_CLASS		12
- #define GUSICS_RECORD_CLASS		13
- 
- /*
-  * Mixer & MUX devices for CS4231
-  */
- #define GUSMAX_MIX_IN			0 /* input to MUX from mixer output */
- #define GUSMAX_MONO_LVL			1 /* mic input to MUX;
- 					     also mono mixer input */
- #define GUSMAX_DAC_LVL			2 /* input to MUX; also mixer input */
- #define GUSMAX_LINE_IN_LVL		3 /* input to MUX; also mixer input */
- #define GUSMAX_CD_LVL			4 /* mixer input only */
- #define GUSMAX_MONITOR_LVL		5 /* digital mix (?) */
- #define GUSMAX_OUT_LVL			6 /* output level. (?) */
- #define GUSMAX_SPEAKER_LVL		7 /* pseudo-device for mute */
- #define GUSMAX_LINE_IN_MUTE		8 /* pre-mixer */
- #define GUSMAX_DAC_MUTE			9 /* pre-mixer */
- #define GUSMAX_CD_MUTE			10 /* pre-mixer */
- #define GUSMAX_MONO_MUTE		11 /* pre-mixer--microphone/mono */
- #define GUSMAX_MONITOR_MUTE		12 /* post-mixer level/mute */
- #define GUSMAX_SPEAKER_MUTE		13 /* speaker mute */
- 
- #define GUSMAX_REC_LVL			14 /* post-MUX gain */
- 
- #define GUSMAX_RECORD_SOURCE		15
- 
- /* Classes */
- #define GUSMAX_INPUT_CLASS		16
- #define GUSMAX_RECORD_CLASS		17
- #define GUSMAX_MONITOR_CLASS		18
- #define GUSMAX_OUTPUT_CLASS		19
- 
  #ifdef AUDIO_DEBUG
  #define GUSPLAYDEBUG	/*XXX*/
  extern void Dprintf __P((const char *, ...));
--- 136,141 ----
***************
*** 721,726 ****
--- 542,549 ----
  	sc->sc_drq = ia->ia_drq;
  	sc->sc_recdrq = recdrq;
  
+ 	sc->sc_ic = ia->ia_ic;
+ 
  	ia->ia_iobase = sc->sc_iobase;
  	ia->ia_iosize = 16;		/* XXX */
  	return(1);
***************
*** 785,792 ****
  	void *aux;
  {
  	register struct gus_softc *sc = (void *) self;
! 	register struct isa_attach_args *ia = aux;
! 	register int port = ia->ia_iobase;
  	int		i;
  	register unsigned char	c,d,m;
  
--- 608,614 ----
  	void *aux;
  {
  	register struct gus_softc *sc = (void *) self;
! 	register int port = sc->sc_iobase;
  	int		i;
  	register unsigned char	c,d,m;
  
***************
*** 817,823 ****
  
  	m = GUSMASK_LINE_IN|GUSMASK_LINE_OUT;		/* disable all */
  
! 	c = ((unsigned char) gus_irq_map[ia->ia_irq]) | GUSMASK_BOTH_RQ;
  
  	if (sc->sc_recdrq == sc->sc_drq)
  		d = (unsigned char) (gus_drq_map[sc->sc_drq] |
--- 639,645 ----
  
  	m = GUSMASK_LINE_IN|GUSMASK_LINE_OUT;		/* disable all */
  
! 	c = ((unsigned char) gus_irq_map[sc->sc_irq]) | GUSMASK_BOTH_RQ;
  
  	if (sc->sc_recdrq == sc->sc_drq)
  		d = (unsigned char) (gus_drq_map[sc->sc_drq] |
***************
*** 927,933 ****
  	/* XXX we shouldn't have to use splgus == splclock, nor should
  	 * we use IPL_CLOCK.
  	 */
! 	sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
  	    IPL_AUDIO, gusintr, sc /* sc->sc_gusdsp */);
  
  	/*
--- 749,755 ----
  	/* XXX we shouldn't have to use splgus == splclock, nor should
  	 * we use IPL_CLOCK.
  	 */
! 	sc->sc_ih = isa_intr_establish(sc->sc_ic, sc->sc_irq, IST_EDGE,
  	    IPL_AUDIO, gusintr, sc /* sc->sc_gusdsp */);
  
  	/*
*** /dev/null	Fri Mar 21 02:04:02 1997
--- ./sys/dev/isa/gusvar.h	Sat Feb  8 23:24:02 1997
***************
*** 0 ****
--- 1,219 ----
+ /*	$NetBSD$	*/
+ 
+ /*-
+  * Copyright (c) 1996 The NetBSD Foundation, Inc.
+  * All rights reserved.
+  *
+  * This code is derived from software contributed to The NetBSD Foundation
+  * by Ken Hornstein and John Kohl.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. All advertising materials mentioning features or use of this software
+  *    must display the following acknowledgement:
+  *        This product includes software developed by the NetBSD 
+  *	  Foundation, Inc. and its contributors.
+  * 4. Neither the name of The NetBSD Foundation nor the names of its 
+  *    contributors may be used to endorse or promote products derived 
+  *    from this software without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+ 
+ /*
+  * Software state of a single "voice" on the GUS
+  */
+ 
+ struct gus_voice {
+ 
+ 	/*
+ 	 * Various control bits
+ 	 */
+ 
+ 	unsigned char voccntl;	/* State of voice control register */
+ 	unsigned char volcntl;	/* State of volume control register */
+ 	unsigned char pan_pos;	/* Position of volume panning (4 bits) */
+ 	int rate;		/* Sample rate of voice being played back */
+ 
+ 	/*
+ 	 * Address of the voice data into the GUS's DRAM.  20 bits each
+ 	 */
+ 
+ 	u_long start_addr;	/* Starting address of voice data loop area */
+ 	u_long end_addr;	/* Ending address of voice data loop */
+ 	u_long current_addr;	/* Beginning address of voice data
+ 				   (start playing here) */
+ 
+ 	/*
+ 	 * linear volume values for the GUS's volume ramp.  0-511 (9 bits).
+ 	 * These values must be translated into the logarithmic values using
+ 	 * gus_log_volumes[]
+ 	 */
+ 
+ 	int start_volume;	/* Starting position of volume ramp */
+ 	int current_volume;	/* Current position of volume on volume ramp */
+ 	int end_volume;		/* Ending position of volume on volume ramp */
+ };
+ 
+ /*
+  * Software state of GUS
+  */
+ 
+ struct gus_softc {
+ 	struct device sc_dev;		/* base device */
+ 	struct isadev sc_id;		/* ISA device */
+ 	void *sc_ih;			/* interrupt vector */
+ 
+ 	int sc_iobase;			/* I/O base address */
+ 	int sc_irq;			/* IRQ used */
+ 	int sc_drq;			/* DMA channel for play */
+ 	int sc_recdrq;			/* DMA channel for recording */
+ 	isa_chipset_tag_t sc_ic;	/* Copied from ia or ipa */
+ 
+ 	int sc_flags;			/* Various flags about the GUS */
+ #define GUS_MIXER_INSTALLED	0x01	/* An ICS mixer is installed */
+ #define GUS_LOCKED		0x02	/* GUS is busy doing multi-phase DMA */
+ #define GUS_CODEC_INSTALLED	0x04	/* CS4231 installed/MAX */
+ #define GUS_PLAYING		0x08	/* GUS is playing a voice */
+ #define GUS_DMAOUT_ACTIVE	0x10	/* GUS is busy doing audio DMA */
+ #define GUS_DMAIN_ACTIVE	0x20	/* GUS is busy sampling  */
+ #define GUS_OPEN		0x100	/* GUS is open */
+ 	int sc_dsize;			/* Size of GUS DRAM */
+ 	int sc_voices;			/* Number of active voices */
+ 	u_char sc_revision;		/* Board revision of GUS */
+ 	u_char sc_mixcontrol;		/* Value of GUS_MIX_CONTROL register */
+ 
+ 	u_long sc_orate;		/* Output sampling rate */
+ 	u_long sc_irate;		/* Input sampling rate */
+ 
+ 	int sc_encoding;		/* Current data encoding type */
+ 	int sc_precision;		/* # of bits of precision */
+ 	int sc_channels;		/* Number of active channels */
+ 	int sc_blocksize;		/* Current blocksize */
+ 	int sc_chanblocksize;		/* Current blocksize for each in-use
+ 					   channel */
+ 	short sc_nbufs;			/* how many on-GUS bufs per-channel */
+ 	short sc_bufcnt;		/* how many need to be played */
+ 	void *sc_deintr_buf;		/* deinterleave buffer for stereo */
+ 
+ 	int sc_ogain;			/* Output gain control */
+ 	u_char sc_out_port;		/* Current out port (generic only) */
+ 	u_char sc_in_port;		/* keep track of it when no codec */
+ 
+ 	void (*sc_dmaoutintr) __P((void*)); /* DMA completion intr handler */
+ 	void *sc_outarg;		/* argument for sc_dmaoutintr() */
+ 	u_char *sc_dmaoutaddr;		/* for isa_dmadone */
+ 	u_long sc_gusaddr;		/* where did we just put it? */
+ 	int sc_dmaoutcnt;		/* for isa_dmadone */
+ 
+ 	void (*sc_dmainintr) __P((void*)); /* DMA completion intr handler */
+ 	void *sc_inarg;			/* argument for sc_dmaoutintr() */
+ 	u_char *sc_dmainaddr;		/* for isa_dmadone */
+ 	int sc_dmaincnt;		/* for isa_dmadone */
+ 
+ 	struct stereo_dma_intr {
+ 		void (*intr)__P((void *));
+ 		void *arg;
+ 		u_char *buffer;
+ 		u_long dmabuf;
+ 		int size;
+ 		int flags;
+ 	} sc_stereo;
+ 
+ 	/*
+ 	 * State information for linear audio layer
+ 	 */
+ 
+ 	int sc_dmabuf;			/* Which ring buffer we're DMA'ing to */
+ 	int sc_playbuf;			/* Which ring buffer we're playing */
+ 
+ 	/*
+ 	 * Voice information array.  All voice-specific information is stored
+ 	 * here
+ 	 */
+ 
+ 	struct gus_voice sc_voc[32];	/* Voice data for each voice */
+ 	union {
+ 		struct ics2101_softc sc_mixer_u;
+ 		struct ad1848_softc sc_codec_u;
+ 	} u;
+ #define sc_mixer u.sc_mixer_u
+ #define sc_codec u.sc_codec_u
+ };
+ 
+ struct ics2101_volume {
+ 	u_char left;
+ 	u_char right;
+ };
+ 
+ #define HAS_CODEC(sc) ((sc)->sc_flags & GUS_CODEC_INSTALLED)
+ #define HAS_MIXER(sc) ((sc)->sc_flags & GUS_MIXER_INSTALLED)
+ 
+ /*
+  * Mixer devices for ICS2101
+  */
+ /* MIC IN mute, line in mute, line out mute are first since they can be done
+    even if no ICS mixer. */
+ #define GUSICS_MIC_IN_MUTE		0
+ #define GUSICS_LINE_IN_MUTE		1
+ #define GUSICS_MASTER_MUTE		2
+ #define GUSICS_CD_MUTE			3
+ #define GUSICS_DAC_MUTE			4
+ #define GUSICS_MIC_IN_LVL		5
+ #define GUSICS_LINE_IN_LVL		6
+ #define GUSICS_CD_LVL			7
+ #define GUSICS_DAC_LVL			8
+ #define GUSICS_MASTER_LVL		9
+ 
+ #define GUSICS_RECORD_SOURCE		10
+ 
+ /* Classes */
+ #define GUSICS_INPUT_CLASS		11
+ #define GUSICS_OUTPUT_CLASS		12
+ #define GUSICS_RECORD_CLASS		13
+ 
+ /*
+  * Mixer & MUX devices for CS4231
+  */
+ #define GUSMAX_MIX_IN			0 /* input to MUX from mixer output */
+ #define GUSMAX_MONO_LVL			1 /* mic input to MUX;
+ 					     also mono mixer input */
+ #define GUSMAX_DAC_LVL			2 /* input to MUX; also mixer input */
+ #define GUSMAX_LINE_IN_LVL		3 /* input to MUX; also mixer input */
+ #define GUSMAX_CD_LVL			4 /* mixer input only */
+ #define GUSMAX_MONITOR_LVL		5 /* digital mix (?) */
+ #define GUSMAX_OUT_LVL			6 /* output level. (?) */
+ #define GUSMAX_SPEAKER_LVL		7 /* pseudo-device for mute */
+ #define GUSMAX_LINE_IN_MUTE		8 /* pre-mixer */
+ #define GUSMAX_DAC_MUTE			9 /* pre-mixer */
+ #define GUSMAX_CD_MUTE			10 /* pre-mixer */
+ #define GUSMAX_MONO_MUTE		11 /* pre-mixer--microphone/mono */
+ #define GUSMAX_MONITOR_MUTE		12 /* post-mixer level/mute */
+ #define GUSMAX_SPEAKER_MUTE		13 /* speaker mute */
+ 
+ #define GUSMAX_REC_LVL			14 /* post-MUX gain */
+ 
+ #define GUSMAX_RECORD_SOURCE		15
+ 
+ /* Classes */
+ #define GUSMAX_INPUT_CLASS		16
+ #define GUSMAX_RECORD_CLASS		17
+ #define GUSMAX_MONITOR_CLASS		18
+ #define GUSMAX_OUTPUT_CLASS		19
+ 
*** /dev/null	Fri Mar 21 02:04:02 1997
--- ./sys/dev/isapnp/gus_isapnp.c	Sat Feb  8 23:26:54 1997
***************
*** 0 ****
--- 1,125 ----
+ /*	$NetBSD$	*/
+ 
+ /*
+  * Copyright (c) 1991-1993 Regents of the University of California.
+  * All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. All advertising materials mentioning features or use of this software
+  *    must display the following acknowledgement:
+  *	This product includes software developed by the Computer Systems
+  *	Engineering Group at Lawrence Berkeley Laboratory.
+  * 4. Neither the name of the University nor of the Laboratory may be used
+  *    to endorse or promote products derived from this software without
+  *    specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  *
+  */
+ 
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/errno.h>
+ #include <sys/ioctl.h>
+ #include <sys/syslog.h>
+ #include <sys/device.h>
+ #include <sys/proc.h>
+ 
+ #include <machine/bus.h>
+ 
+ #include <sys/audioio.h>
+ #include <dev/audio_if.h>
+ #include <dev/mulaw.h>
+ 
+ #include <dev/isa/isavar.h>
+ #include <dev/isa/isadmavar.h>
+ 
+ #include <dev/ic/ics2101reg.h>
+ #include <dev/ic/ad1848reg.h>
+ #include <dev/isa/ics2101var.h>
+ #include <dev/isa/ad1848var.h>
+ 
+ #include <dev/isapnp/isapnpreg.h>
+ #include <dev/isapnp/isapnpvar.h>
+ 
+ #include <dev/isa/gusreg.h>
+ #include <dev/isa/gusvar.h>
+ 
+ int	gus_isapnp_match __P((struct device *, void *, void *));
+ void	gus_isapnp_attach __P((struct device *, struct device *, void *));
+ 
+ void    gusattach __P((struct device *, struct device *, void *));
+ 
+ struct cfattach gus_isapnp_ca = {
+ 	sizeof(struct gus_softc), gus_isapnp_match, gus_isapnp_attach
+ };
+ 
+ 
+ /*
+  * Probe / attach routines.
+  */
+ 
+ /*
+  * Probe for the Ultrasound PNP hardware.
+  */
+ int
+ gus_isapnp_match(parent, match, aux)
+ 	struct device *parent;
+ 	void *match, *aux;
+ {
+ 	struct isapnp_attach_args *ipa = aux;
+ 
+ 	return strcmp(ipa->ipa_devlogic, "GRV0000") == 0;
+ }
+ 
+ 
+ 
+ /*
+  * Attach hardware to driver, attach hardware driver to audio
+  * pseudo-device driver.
+  */
+ void
+ gus_isapnp_attach(parent, self, aux)
+ 	struct device *parent, *self;
+ 	void *aux;
+ {
+ 	struct gus_softc *sc = (struct gus_softc *)self;
+ 	struct isapnp_attach_args *ipa = aux;
+ 
+ 	sc->sc_ic = ipa->ipa_ic;
+ 
+ 	sc->sc_iobase = ipa->ipa_io[0].base;
+ 
+ 	sc->sc_irq = ipa->ipa_irq[0].num;
+ 	sc->sc_drq = ipa->ipa_drq[0].num;
+ 	sc->sc_recdrq = ipa->ipa_drq[1].num;
+ 
+ 	printf("\n");
+ 
+ 	if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) {
+ 		printf("%s: error in region allocation\n", sc->sc_dev.dv_xname);
+ 		return;
+ 	}
+ 
+ 	printf("%s: %s %s", sc->sc_dev.dv_xname, ipa->ipa_devident,
+ 	    ipa->ipa_devclass);
+ 
+ 	gusattach(parent, self, 0);
+ }
*** /usr/src/sys/dev/isapnp/files.isapnp	Thu Jan 23 07:22:29 1997
--- ./sys/dev/isapnp/files.isapnp	Sat Feb  8 22:35:56 1997
***************
*** 24,26 ****
--- 24,30 ----
  # SoundBlaster family
  attach	sb at isapnp with sb_isapnp
  file	dev/isapnp/sb_isapnp.c			sb_isapnp
+ 
+ # Gravis UltraSound PNP
+ attach	gus at isapnp with gus_isapnp
+ file	dev/isapnp/gus_isapnp.c			gus_isapnp
>Audit-Trail:
>Unformatted: