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