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