xref: /NextBSD/sys/dev/sound/isa/gusc.c (revision 4bf303e5af1834cdd3092175eeca7676420229c4)
1 /*-
2  * Copyright (c) 1999 Seigo Tanimura
3  * Copyright (c) 1999 Ville-Pertti Keinonen
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #include <sys/param.h>
29 #include <sys/systm.h>
30 #include <sys/kernel.h>
31 #include <sys/bus.h>
32 #include <sys/malloc.h>
33 #include <sys/module.h>
34 #include <machine/resource.h>
35 #include <machine/bus.h>
36 #include <sys/rman.h>
37 
38 #ifdef HAVE_KERNEL_OPTION_HEADERS
39 #include "opt_snd.h"
40 #endif
41 
42 #include <dev/sound/pcm/sound.h>
43 #include <dev/sound/chip.h>
44 #include "bus_if.h"
45 
46 #include <isa/isavar.h>
47 #include <isa/isa_common.h>
48 
49 SND_DECLARE_FILE("$FreeBSD$");
50 
51 #define LOGICALID_NOPNP 0
52 #define LOGICALID_PCM   0x0000561e
53 #define LOGICALID_OPL   0x0300561e
54 #define LOGICALID_MIDI  0x0400561e
55 
56 /* PnP IDs */
57 static struct isa_pnp_id gusc_ids[] = {
58 	{LOGICALID_PCM,  "GRV0000 Gravis UltraSound PnP PCM"},	/* GRV0000 */
59 	{LOGICALID_OPL,  "GRV0003 Gravis UltraSound PnP OPL"},	/* GRV0003 */
60 	{LOGICALID_MIDI, "GRV0004 Gravis UltraSound PnP MIDI"},	/* GRV0004 */
61 };
62 
63 /* Interrupt handler.  */
64 struct gusc_ihandler {
65 	void (*intr)(void *);
66 	void *arg;
67 };
68 
69 /* Here is the parameter structure per a device. */
70 struct gusc_softc {
71 	device_t dev; /* device */
72 	int io_rid[3]; /* io port rids */
73 	struct resource *io[3]; /* io port resources */
74 	int io_alloced[3]; /* io port alloc flag */
75 	int irq_rid; /* irq rids */
76 	struct resource *irq; /* irq resources */
77 	int irq_alloced; /* irq alloc flag */
78 	int drq_rid[2]; /* drq rids */
79 	struct resource *drq[2]; /* drq resources */
80 	int drq_alloced[2]; /* drq alloc flag */
81 
82 	/* Interrupts are shared (XXX non-PnP only?) */
83 	struct gusc_ihandler midi_intr;
84 	struct gusc_ihandler pcm_intr;
85 };
86 
87 typedef struct gusc_softc *sc_p;
88 
89 static int gusc_probe(device_t dev);
90 static int gusc_attach(device_t dev);
91 static int gusisa_probe(device_t dev);
92 static void gusc_intr(void *);
93 static struct resource *gusc_alloc_resource(device_t bus, device_t child, int type, int *rid,
94 					      u_long start, u_long end, u_long count, u_int flags);
95 static int gusc_release_resource(device_t bus, device_t child, int type, int rid,
96 				   struct resource *r);
97 
98 static device_t find_masterdev(sc_p scp);
99 static int alloc_resource(sc_p scp);
100 static int release_resource(sc_p scp);
101 
102 static devclass_t gusc_devclass;
103 
104 static int
gusc_probe(device_t dev)105 gusc_probe(device_t dev)
106 {
107 	device_t child;
108 	u_int32_t logical_id;
109 	char *s;
110 	struct sndcard_func *func;
111 	int ret;
112 
113 	logical_id = isa_get_logicalid(dev);
114 	s = NULL;
115 
116 	/* Check isapnp ids */
117 	if (logical_id != 0 && (ret = ISA_PNP_PROBE(device_get_parent(dev), dev, gusc_ids)) != 0)
118 		return (ret);
119 	else {
120 		if (logical_id == 0)
121 			return gusisa_probe(dev);
122 	}
123 
124 	switch (logical_id) {
125 	case LOGICALID_PCM:
126 		s = "Gravis UltraSound Plug & Play PCM";
127 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
128 		if (func == NULL)
129 			return (ENOMEM);
130 		func->func = SCF_PCM;
131 		child = device_add_child(dev, "pcm", -1);
132 		device_set_ivars(child, func);
133 		break;
134 	case LOGICALID_OPL:
135 		s = "Gravis UltraSound Plug & Play OPL";
136 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
137 		if (func == NULL)
138 			return (ENOMEM);
139 		func->func = SCF_SYNTH;
140 		child = device_add_child(dev, "midi", -1);
141 		device_set_ivars(child, func);
142 		break;
143 	case LOGICALID_MIDI:
144 		s = "Gravis UltraSound Plug & Play MIDI";
145 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
146 		if (func == NULL)
147 			return (ENOMEM);
148 		func->func = SCF_MIDI;
149 		child = device_add_child(dev, "midi", -1);
150 		device_set_ivars(child, func);
151 		break;
152 	}
153 
154 	if (s != NULL) {
155 		device_set_desc(dev, s);
156 		return (0);
157 	}
158 
159 	return (ENXIO);
160 }
161 
162 static void
port_wr(struct resource * r,int i,unsigned char v)163 port_wr(struct resource *r, int i, unsigned char v)
164 {
165 	bus_space_write_1(rman_get_bustag(r), rman_get_bushandle(r), i, v);
166 }
167 
168 static int
port_rd(struct resource * r,int i)169 port_rd(struct resource *r, int i)
170 {
171 	return bus_space_read_1(rman_get_bustag(r), rman_get_bushandle(r), i);
172 }
173 
174 /*
175  * Probe for an old (non-PnP) GUS card on the ISA bus.
176  */
177 
178 static int
gusisa_probe(device_t dev)179 gusisa_probe(device_t dev)
180 {
181 	device_t child;
182 	struct resource *res, *res2;
183 	int base, rid, rid2, s, flags;
184 	unsigned char val;
185 
186 	base = isa_get_port(dev);
187 	flags = device_get_flags(dev);
188 	rid = 1;
189 	res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, base + 0x100,
190 				 base + 0x107, 8, RF_ACTIVE);
191 
192 	if (res == NULL)
193 		return ENXIO;
194 
195 	res2 = NULL;
196 
197 	/*
198 	 * Check for the presence of some GUS card.  Reset the card,
199 	 * then see if we can access the memory on it.
200 	 */
201 
202 	port_wr(res, 3, 0x4c);
203 	port_wr(res, 5, 0);
204 	DELAY(30 * 1000);
205 
206 	port_wr(res, 3, 0x4c);
207 	port_wr(res, 5, 1);
208 	DELAY(30 * 1000);
209 
210 	s = splhigh();
211 
212 	/* Write to DRAM.  */
213 
214 	port_wr(res, 3, 0x43);		/* Register select */
215 	port_wr(res, 4, 0);		/* Low addr */
216 	port_wr(res, 5, 0);		/* Med addr */
217 
218 	port_wr(res, 3, 0x44);		/* Register select */
219 	port_wr(res, 4, 0);		/* High addr */
220 	port_wr(res, 7, 0x55);		/* DRAM */
221 
222 	/* Read from DRAM.  */
223 
224 	port_wr(res, 3, 0x43);		/* Register select */
225 	port_wr(res, 4, 0);		/* Low addr */
226 	port_wr(res, 5, 0);		/* Med addr */
227 
228 	port_wr(res, 3, 0x44);		/* Register select */
229 	port_wr(res, 4, 0);		/* High addr */
230 	val = port_rd(res, 7);		/* DRAM */
231 
232 	splx(s);
233 
234 	if (val != 0x55)
235 		goto fail;
236 
237 	rid2 = 0;
238 	res2 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid2, base, base, 1,
239 				  RF_ACTIVE);
240 
241 	if (res2 == NULL)
242 		goto fail;
243 
244 	s = splhigh();
245 	port_wr(res2, 0x0f, 0x20);
246 	val = port_rd(res2, 0x0f);
247 	splx(s);
248 
249 	if (val == 0xff || (val & 0x06) == 0)
250 		val = 0;
251 	else {
252 		val = port_rd(res2, 0x506);	/* XXX Out of range.  */
253 		if (val == 0xff)
254 			val = 0;
255 	}
256 
257 	bus_release_resource(dev, SYS_RES_IOPORT, rid2, res2);
258 	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
259 
260 	if (val >= 10) {
261 		struct sndcard_func *func;
262 
263 		/* Looks like a GUS MAX.  Set the rest of the resources.  */
264 
265 		bus_set_resource(dev, SYS_RES_IOPORT, 2, base + 0x10c, 8);
266 
267 		if (flags & DV_F_DUAL_DMA)
268 			bus_set_resource(dev, SYS_RES_DRQ, 1,
269 					 flags & DV_F_DRQ_MASK, 1);
270 
271 		/* We can support the CS4231 and MIDI devices.  */
272 
273 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
274 		if (func == NULL)
275 			return ENOMEM;
276 		func->func = SCF_MIDI;
277 		child = device_add_child(dev, "midi", -1);
278 		device_set_ivars(child, func);
279 
280 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
281 		if (func == NULL)
282 			printf("xxx: gus pcm not attached, out of memory\n");
283 		else {
284 			func->func = SCF_PCM;
285 			child = device_add_child(dev, "pcm", -1);
286 			device_set_ivars(child, func);
287 		}
288 		device_set_desc(dev, "Gravis UltraSound MAX");
289 		return 0;
290 	} else {
291 
292 		/*
293 		 * TODO: Support even older GUS cards.  MIDI should work on
294 		 * all models.
295 		 */
296 		return ENXIO;
297 	}
298 
299 fail:
300 	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
301 	return ENXIO;
302 }
303 
304 static int
gusc_attach(device_t dev)305 gusc_attach(device_t dev)
306 {
307 	sc_p scp;
308 	void *ih;
309 
310 	scp = device_get_softc(dev);
311 
312 	bzero(scp, sizeof(*scp));
313 
314 	scp->dev = dev;
315 	if (alloc_resource(scp)) {
316 		release_resource(scp);
317 		return (ENXIO);
318 	}
319 
320 	if (scp->irq != NULL)
321 		snd_setup_intr(dev, scp->irq, 0, gusc_intr, scp, &ih);
322 	bus_generic_attach(dev);
323 
324 	return (0);
325 }
326 
327 /*
328  * Handle interrupts on GUS devices until there aren't any left.
329  */
330 static void
gusc_intr(void * arg)331 gusc_intr(void *arg)
332 {
333 	sc_p scp = (sc_p)arg;
334 	int did_something;
335 
336 	do {
337 		did_something = 0;
338 		if (scp->pcm_intr.intr != NULL &&
339 		    (port_rd(scp->io[2], 2) & 1)) {
340 			(*scp->pcm_intr.intr)(scp->pcm_intr.arg);
341 			did_something = 1;
342 		}
343 		if (scp->midi_intr.intr != NULL &&
344 		    (port_rd(scp->io[1], 0) & 0x80)) {
345 			(*scp->midi_intr.intr)(scp->midi_intr.arg);
346 			did_something = 1;
347 		}
348 	} while (did_something != 0);
349 }
350 
351 static struct resource *
gusc_alloc_resource(device_t bus,device_t child,int type,int * rid,u_long start,u_long end,u_long count,u_int flags)352 gusc_alloc_resource(device_t bus, device_t child, int type, int *rid,
353 		      u_long start, u_long end, u_long count, u_int flags)
354 {
355 	sc_p scp;
356 	int *alloced, rid_max, alloced_max;
357 	struct resource **res;
358 
359 	scp = device_get_softc(bus);
360 	switch (type) {
361 	case SYS_RES_IOPORT:
362 		alloced = scp->io_alloced;
363 		res = scp->io;
364 		rid_max = 2;
365 		alloced_max = 2; /* pcm + midi (more to include synth) */
366 		break;
367 	case SYS_RES_IRQ:
368 		alloced = &scp->irq_alloced;
369 		res = &scp->irq;
370 		rid_max = 0;
371 		alloced_max = 2; /* pcm and midi share the single irq. */
372 		break;
373 	case SYS_RES_DRQ:
374 		alloced = scp->drq_alloced;
375 		res = scp->drq;
376 		rid_max = 1;
377 		alloced_max = 1;
378 		break;
379 	default:
380 		return (NULL);
381 	}
382 
383 	if (*rid > rid_max || alloced[*rid] == alloced_max)
384 		return (NULL);
385 
386 	alloced[*rid]++;
387 	return (res[*rid]);
388 }
389 
390 static int
gusc_release_resource(device_t bus,device_t child,int type,int rid,struct resource * r)391 gusc_release_resource(device_t bus, device_t child, int type, int rid,
392 			struct resource *r)
393 {
394 	sc_p scp;
395 	int *alloced, rid_max;
396 
397 	scp = device_get_softc(bus);
398 	switch (type) {
399 	case SYS_RES_IOPORT:
400 		alloced = scp->io_alloced;
401 		rid_max = 2;
402 		break;
403 	case SYS_RES_IRQ:
404 		alloced = &scp->irq_alloced;
405 		rid_max = 0;
406 		break;
407 	case SYS_RES_DRQ:
408 		alloced = scp->drq_alloced;
409 		rid_max = 1;
410 		break;
411 	default:
412 		return (1);
413 	}
414 
415 	if (rid > rid_max || alloced[rid] == 0)
416 		return (1);
417 
418 	alloced[rid]--;
419 	return (0);
420 }
421 
422 static int
gusc_setup_intr(device_t dev,device_t child,struct resource * irq,int flags,driver_filter_t * filter,driver_intr_t * intr,void * arg,void ** cookiep)423 gusc_setup_intr(device_t dev, device_t child, struct resource *irq, int flags,
424 		driver_filter_t *filter,
425 		driver_intr_t *intr, void *arg, void **cookiep)
426 {
427 	sc_p scp = (sc_p)device_get_softc(dev);
428 	devclass_t devclass;
429 
430 	if (filter != NULL) {
431 		printf("gusc.c: we cannot use a filter here\n");
432 		return (EINVAL);
433 	}
434 	devclass = device_get_devclass(child);
435 	if (strcmp(devclass_get_name(devclass), "midi") == 0) {
436 		scp->midi_intr.intr = intr;
437 		scp->midi_intr.arg = arg;
438 		return 0;
439 	} else if (strcmp(devclass_get_name(devclass), "pcm") == 0) {
440 		scp->pcm_intr.intr = intr;
441 		scp->pcm_intr.arg = arg;
442 		return 0;
443 	}
444 	return bus_generic_setup_intr(dev, child, irq, flags,
445 				filter,
446 				intr, arg, cookiep);
447 }
448 
449 static device_t
find_masterdev(sc_p scp)450 find_masterdev(sc_p scp)
451 {
452 	int i, units;
453 	devclass_t devclass;
454 	device_t dev;
455 
456 	devclass = device_get_devclass(scp->dev);
457 	units = devclass_get_maxunit(devclass);
458 	dev = NULL;
459 	for (i = 0 ; i < units ; i++) {
460 		dev = devclass_get_device(devclass, i);
461 		if (isa_get_vendorid(dev) == isa_get_vendorid(scp->dev)
462 		    && isa_get_logicalid(dev) == LOGICALID_PCM
463 		    && isa_get_serial(dev) == isa_get_serial(scp->dev))
464 			break;
465 	}
466 	if (i == units)
467 		return (NULL);
468 
469 	return (dev);
470 }
471 
472 static int io_range[3]  = {0x10, 0x8  , 0x4  };
473 static int io_offset[3] = {0x0 , 0x100, 0x10c};
474 static int
alloc_resource(sc_p scp)475 alloc_resource(sc_p scp)
476 {
477 	int i, base, lid, flags;
478 	device_t dev;
479 
480 	flags = 0;
481 	if (isa_get_vendorid(scp->dev))
482 		lid = isa_get_logicalid(scp->dev);
483 	else {
484 		lid = LOGICALID_NOPNP;
485 		flags = device_get_flags(scp->dev);
486 	}
487 	switch(lid) {
488 	case LOGICALID_PCM:
489 	case LOGICALID_NOPNP:		/* XXX Non-PnP */
490 		if (lid == LOGICALID_NOPNP)
491 			base = isa_get_port(scp->dev);
492 		else
493 			base = 0;
494 		for (i = 0 ; i < sizeof(scp->io) / sizeof(*scp->io) ; i++) {
495 			if (scp->io[i] == NULL) {
496 				scp->io_rid[i] = i;
497 				if (base == 0)
498 					scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i],
499 									0, ~0, io_range[i], RF_ACTIVE);
500 				else
501 					scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i],
502 									base + io_offset[i],
503 									base + io_offset[i] + io_range[i] - 1
504 									, io_range[i], RF_ACTIVE);
505 				if (scp->io[i] == NULL)
506 					return (1);
507 				scp->io_alloced[i] = 0;
508 			}
509 		}
510 		if (scp->irq == NULL) {
511 			scp->irq_rid = 0;
512 			scp->irq =
513 				bus_alloc_resource_any(scp->dev, SYS_RES_IRQ,
514 						       &scp->irq_rid,
515 						       RF_ACTIVE|RF_SHAREABLE);
516 			if (scp->irq == NULL)
517 				return (1);
518 			scp->irq_alloced = 0;
519 		}
520 		for (i = 0 ; i < sizeof(scp->drq) / sizeof(*scp->drq) ; i++) {
521 			if (scp->drq[i] == NULL) {
522 				scp->drq_rid[i] = i;
523 				if (base == 0 || i == 0)
524 					scp->drq[i] =
525 						bus_alloc_resource_any(
526 							scp->dev, SYS_RES_DRQ,
527 							&scp->drq_rid[i],
528 							RF_ACTIVE);
529 				else if ((flags & DV_F_DUAL_DMA) != 0)
530 					/* XXX The secondary drq is specified in the flag. */
531 					scp->drq[i] = bus_alloc_resource(scp->dev, SYS_RES_DRQ, &scp->drq_rid[i],
532 									 flags & DV_F_DRQ_MASK,
533 									 flags & DV_F_DRQ_MASK, 1, RF_ACTIVE);
534 				if (scp->drq[i] == NULL)
535 					return (1);
536 				scp->drq_alloced[i] = 0;
537 			}
538 		}
539 		break;
540 	case LOGICALID_OPL:
541 		if (scp->io[0] == NULL) {
542 			scp->io_rid[0] = 0;
543 			scp->io[0] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[0],
544 							0, ~0, io_range[0], RF_ACTIVE);
545 			if (scp->io[0] == NULL)
546 				return (1);
547 			scp->io_alloced[0] = 0;
548 		}
549 		break;
550 	case LOGICALID_MIDI:
551 		if (scp->io[0] == NULL) {
552 			scp->io_rid[0] = 0;
553 			scp->io[0] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[0],
554 							0, ~0, io_range[0], RF_ACTIVE);
555 			if (scp->io[0] == NULL)
556 				return (1);
557 			scp->io_alloced[0] = 0;
558 		}
559 		if (scp->irq == NULL) {
560 			/* The irq is shared with pcm audio. */
561 			dev = find_masterdev(scp);
562 			if (dev == NULL)
563 				return (1);
564 			scp->irq_rid = 0;
565 			scp->irq = BUS_ALLOC_RESOURCE(dev, NULL, SYS_RES_IRQ, &scp->irq_rid,
566 						      0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
567 			if (scp->irq == NULL)
568 				return (1);
569 			scp->irq_alloced = 0;
570 		}
571 		break;
572 	}
573 	return (0);
574 }
575 
576 static int
release_resource(sc_p scp)577 release_resource(sc_p scp)
578 {
579 	int i, lid;
580 	device_t dev;
581 
582 	if (isa_get_vendorid(scp->dev))
583 		lid = isa_get_logicalid(scp->dev);
584 	else
585 		lid = LOGICALID_NOPNP;
586 
587 	switch(lid) {
588 	case LOGICALID_PCM:
589 	case LOGICALID_NOPNP:		/* XXX Non-PnP */
590 		for (i = 0 ; i < sizeof(scp->io) / sizeof(*scp->io) ; i++) {
591 			if (scp->io[i] != NULL) {
592 				bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[i], scp->io[i]);
593 				scp->io[i] = NULL;
594 			}
595 		}
596 		if (scp->irq != NULL) {
597 			bus_release_resource(scp->dev, SYS_RES_IRQ, scp->irq_rid, scp->irq);
598 			scp->irq = NULL;
599 		}
600 		for (i = 0 ; i < sizeof(scp->drq) / sizeof(*scp->drq) ; i++) {
601 			if (scp->drq[i] != NULL) {
602 				bus_release_resource(scp->dev, SYS_RES_DRQ, scp->drq_rid[i], scp->drq[i]);
603 				scp->drq[i] = NULL;
604 			}
605 		}
606 		break;
607 	case LOGICALID_OPL:
608 		if (scp->io[0] != NULL) {
609 			bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[0], scp->io[0]);
610 			scp->io[0] = NULL;
611 		}
612 		break;
613 	case LOGICALID_MIDI:
614 		if (scp->io[0] != NULL) {
615 			bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[0], scp->io[0]);
616 			scp->io[0] = NULL;
617 		}
618 		if (scp->irq != NULL) {
619 			/* The irq is shared with pcm audio. */
620 			dev = find_masterdev(scp);
621 			if (dev == NULL)
622 				return (1);
623 			BUS_RELEASE_RESOURCE(dev, NULL, SYS_RES_IOPORT, scp->irq_rid, scp->irq);
624 			scp->irq = NULL;
625 		}
626 		break;
627 	}
628 	return (0);
629 }
630 
631 static device_method_t gusc_methods[] = {
632 	/* Device interface */
633 	DEVMETHOD(device_probe,		gusc_probe),
634 	DEVMETHOD(device_attach,	gusc_attach),
635 	DEVMETHOD(device_detach,	bus_generic_detach),
636 	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
637 	DEVMETHOD(device_suspend,	bus_generic_suspend),
638 	DEVMETHOD(device_resume,	bus_generic_resume),
639 
640 	/* Bus interface */
641 	DEVMETHOD(bus_alloc_resource,	gusc_alloc_resource),
642 	DEVMETHOD(bus_release_resource,	gusc_release_resource),
643 	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
644 	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
645 	DEVMETHOD(bus_setup_intr,	gusc_setup_intr),
646 	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
647 
648 	DEVMETHOD_END
649 };
650 
651 static driver_t gusc_driver = {
652 	"gusc",
653 	gusc_methods,
654 	sizeof(struct gusc_softc),
655 };
656 
657 /*
658  * gusc can be attached to an isa bus.
659  */
660 DRIVER_MODULE(snd_gusc, isa, gusc_driver, gusc_devclass, 0, 0);
661 DRIVER_MODULE(snd_gusc, acpi, gusc_driver, gusc_devclass, 0, 0);
662 MODULE_DEPEND(snd_gusc, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER);
663 MODULE_VERSION(snd_gusc, 1);
664 
665 
666