FreeBSD kernel sound device code
gusc.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1999 Seigo Tanimura
5 * Copyright (c) 1999 Ville-Pertti Keinonen
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/bus.h>
34#include <sys/malloc.h>
35#include <sys/module.h>
36#include <machine/resource.h>
37#include <machine/bus.h>
38#include <sys/rman.h>
39
40#ifdef HAVE_KERNEL_OPTION_HEADERS
41#include "opt_snd.h"
42#endif
43
44#include <dev/sound/pcm/sound.h>
45#include <dev/sound/chip.h>
46#include "bus_if.h"
47
48#include <isa/isavar.h>
49#include <isa/isa_common.h>
50
51SND_DECLARE_FILE("$FreeBSD$");
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 */
59static 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. */
67 void (*intr)(void *);
68 void *arg;
69};
70
71/* Here is the parameter structure per a device. */
72struct 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?) */
87};
88
89typedef struct gusc_softc *sc_p;
90
91static int gusc_probe(device_t dev);
92static int gusc_attach(device_t dev);
93static int gusisa_probe(device_t dev);
94static void gusc_intr(void *);
95static struct resource *gusc_alloc_resource(device_t bus, device_t child, int type, int *rid,
96 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags);
97static int gusc_release_resource(device_t bus, device_t child, int type, int rid,
98 struct resource *r);
99
100static device_t find_masterdev(sc_p scp);
101static int alloc_resource(sc_p scp);
102static int release_resource(sc_p scp);
103
104static devclass_t gusc_devclass;
105
106static int
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
164static void
165port_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
170static int
171port_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
180static int
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 * TODO: Support even older GUS cards. MIDI should work on
295 * all models.
296 */
297 return ENXIO;
298 }
299
300fail:
301 bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
302 return ENXIO;
303}
304
305static int
307{
308 sc_p scp;
309 void *ih;
310
311 gone_in_dev(dev, 14, "ISA sound driver");
312 scp = device_get_softc(dev);
313
314 bzero(scp, sizeof(*scp));
315
316 scp->dev = dev;
317 if (alloc_resource(scp)) {
318 release_resource(scp);
319 return (ENXIO);
320 }
321
322 if (scp->irq != NULL)
323 snd_setup_intr(dev, scp->irq, 0, gusc_intr, scp, &ih);
324 bus_generic_attach(dev);
325
326 return (0);
327}
328
329/*
330 * Handle interrupts on GUS devices until there aren't any left.
331 */
332static void
333gusc_intr(void *arg)
334{
335 sc_p scp = (sc_p)arg;
336 int did_something;
337
338 do {
339 did_something = 0;
340 if (scp->pcm_intr.intr != NULL &&
341 (port_rd(scp->io[2], 2) & 1)) {
342 (*scp->pcm_intr.intr)(scp->pcm_intr.arg);
343 did_something = 1;
344 }
345 if (scp->midi_intr.intr != NULL &&
346 (port_rd(scp->io[1], 0) & 0x80)) {
347 (*scp->midi_intr.intr)(scp->midi_intr.arg);
348 did_something = 1;
349 }
350 } while (did_something != 0);
351}
352
353static struct resource *
354gusc_alloc_resource(device_t bus, device_t child, int type, int *rid,
355 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
356{
357 sc_p scp;
358 int *alloced, rid_max, alloced_max;
359 struct resource **res;
360
361 scp = device_get_softc(bus);
362 switch (type) {
363 case SYS_RES_IOPORT:
364 alloced = scp->io_alloced;
365 res = scp->io;
366 rid_max = 2;
367 alloced_max = 2; /* pcm + midi (more to include synth) */
368 break;
369 case SYS_RES_IRQ:
370 alloced = &scp->irq_alloced;
371 res = &scp->irq;
372 rid_max = 0;
373 alloced_max = 2; /* pcm and midi share the single irq. */
374 break;
375 case SYS_RES_DRQ:
376 alloced = scp->drq_alloced;
377 res = scp->drq;
378 rid_max = 1;
379 alloced_max = 1;
380 break;
381 default:
382 return (NULL);
383 }
384
385 if (*rid > rid_max || alloced[*rid] == alloced_max)
386 return (NULL);
387
388 alloced[*rid]++;
389 return (res[*rid]);
390}
391
392static int
393gusc_release_resource(device_t bus, device_t child, int type, int rid,
394 struct resource *r)
395{
396 sc_p scp;
397 int *alloced, rid_max;
398
399 scp = device_get_softc(bus);
400 switch (type) {
401 case SYS_RES_IOPORT:
402 alloced = scp->io_alloced;
403 rid_max = 2;
404 break;
405 case SYS_RES_IRQ:
406 alloced = &scp->irq_alloced;
407 rid_max = 0;
408 break;
409 case SYS_RES_DRQ:
410 alloced = scp->drq_alloced;
411 rid_max = 1;
412 break;
413 default:
414 return (1);
415 }
416
417 if (rid > rid_max || alloced[rid] == 0)
418 return (1);
419
420 alloced[rid]--;
421 return (0);
422}
423
424static int
425gusc_setup_intr(device_t dev, device_t child, struct resource *irq, int flags,
426 driver_filter_t *filter,
427 driver_intr_t *intr, void *arg, void **cookiep)
428{
429 sc_p scp = (sc_p)device_get_softc(dev);
430 devclass_t devclass;
431
432 if (filter != NULL) {
433 printf("gusc.c: we cannot use a filter here\n");
434 return (EINVAL);
435 }
436 devclass = device_get_devclass(child);
437 if (strcmp(devclass_get_name(devclass), "midi") == 0) {
438 scp->midi_intr.intr = intr;
439 scp->midi_intr.arg = arg;
440 return 0;
441 } else if (strcmp(devclass_get_name(devclass), "pcm") == 0) {
442 scp->pcm_intr.intr = intr;
443 scp->pcm_intr.arg = arg;
444 return 0;
445 }
446 return bus_generic_setup_intr(dev, child, irq, flags,
447 filter,
448 intr, arg, cookiep);
449}
450
451static device_t
453{
454 int i, units;
455 devclass_t devclass;
456 device_t dev;
457
458 devclass = device_get_devclass(scp->dev);
459 units = devclass_get_maxunit(devclass);
460 dev = NULL;
461 for (i = 0 ; i < units ; i++) {
462 dev = devclass_get_device(devclass, i);
463 if (isa_get_vendorid(dev) == isa_get_vendorid(scp->dev)
464 && isa_get_logicalid(dev) == LOGICALID_PCM
465 && isa_get_serial(dev) == isa_get_serial(scp->dev))
466 break;
467 }
468 if (i == units)
469 return (NULL);
470
471 return (dev);
472}
473
474static int io_range[3] = {0x10, 0x8 , 0x4 };
475static int io_offset[3] = {0x0 , 0x100, 0x10c};
476static int
478{
479 int i, base, lid, flags;
480 device_t dev;
481
482 flags = 0;
483 if (isa_get_vendorid(scp->dev))
484 lid = isa_get_logicalid(scp->dev);
485 else {
486 lid = LOGICALID_NOPNP;
487 flags = device_get_flags(scp->dev);
488 }
489 switch(lid) {
490 case LOGICALID_PCM:
491 case LOGICALID_NOPNP: /* XXX Non-PnP */
492 if (lid == LOGICALID_NOPNP)
493 base = isa_get_port(scp->dev);
494 else
495 base = 0;
496 for (i = 0 ; i < nitems(scp->io); i++) {
497 if (scp->io[i] == NULL) {
498 scp->io_rid[i] = i;
499 if (base == 0)
500 scp->io[i] =
501 bus_alloc_resource_anywhere(scp->dev,
502 SYS_RES_IOPORT,
503 &scp->io_rid[i],
504 io_range[i],
505 RF_ACTIVE);
506 else
507 scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i],
508 base + io_offset[i],
509 base + io_offset[i] + io_range[i] - 1
510 , io_range[i], RF_ACTIVE);
511 if (scp->io[i] == NULL)
512 return (1);
513 scp->io_alloced[i] = 0;
514 }
515 }
516 if (scp->irq == NULL) {
517 scp->irq_rid = 0;
518 scp->irq =
519 bus_alloc_resource_any(scp->dev, SYS_RES_IRQ,
520 &scp->irq_rid,
521 RF_ACTIVE|RF_SHAREABLE);
522 if (scp->irq == NULL)
523 return (1);
524 scp->irq_alloced = 0;
525 }
526 for (i = 0 ; i < nitems(scp->drq); i++) {
527 if (scp->drq[i] == NULL) {
528 scp->drq_rid[i] = i;
529 if (base == 0 || i == 0)
530 scp->drq[i] =
531 bus_alloc_resource_any(
532 scp->dev, SYS_RES_DRQ,
533 &scp->drq_rid[i],
534 RF_ACTIVE);
535 else if ((flags & DV_F_DUAL_DMA) != 0)
536 /* XXX The secondary drq is specified in the flag. */
537 scp->drq[i] = bus_alloc_resource(scp->dev, SYS_RES_DRQ, &scp->drq_rid[i],
538 flags & DV_F_DRQ_MASK,
539 flags & DV_F_DRQ_MASK, 1, RF_ACTIVE);
540 if (scp->drq[i] == NULL)
541 return (1);
542 scp->drq_alloced[i] = 0;
543 }
544 }
545 break;
546 case LOGICALID_OPL:
547 if (scp->io[0] == NULL) {
548 scp->io_rid[0] = 0;
549 scp->io[0] = bus_alloc_resource_anywhere(scp->dev,
550 SYS_RES_IOPORT,
551 &scp->io_rid[0],
552 io_range[0],
553 RF_ACTIVE);
554 if (scp->io[0] == NULL)
555 return (1);
556 scp->io_alloced[0] = 0;
557 }
558 break;
559 case LOGICALID_MIDI:
560 if (scp->io[0] == NULL) {
561 scp->io_rid[0] = 0;
562 scp->io[0] = bus_alloc_resource_anywhere(scp->dev,
563 SYS_RES_IOPORT,
564 &scp->io_rid[0],
565 io_range[0],
566 RF_ACTIVE);
567 if (scp->io[0] == NULL)
568 return (1);
569 scp->io_alloced[0] = 0;
570 }
571 if (scp->irq == NULL) {
572 /* The irq is shared with pcm audio. */
573 dev = find_masterdev(scp);
574 if (dev == NULL)
575 return (1);
576 scp->irq_rid = 0;
577 scp->irq = BUS_ALLOC_RESOURCE(dev, NULL, SYS_RES_IRQ, &scp->irq_rid,
578 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
579 if (scp->irq == NULL)
580 return (1);
581 scp->irq_alloced = 0;
582 }
583 break;
584 }
585 return (0);
586}
587
588static int
590{
591 int i, lid;
592 device_t dev;
593
594 if (isa_get_vendorid(scp->dev))
595 lid = isa_get_logicalid(scp->dev);
596 else
597 lid = LOGICALID_NOPNP;
598
599 switch(lid) {
600 case LOGICALID_PCM:
601 case LOGICALID_NOPNP: /* XXX Non-PnP */
602 for (i = 0 ; i < nitems(scp->io); i++) {
603 if (scp->io[i] != NULL) {
604 bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[i], scp->io[i]);
605 scp->io[i] = NULL;
606 }
607 }
608 if (scp->irq != NULL) {
609 bus_release_resource(scp->dev, SYS_RES_IRQ, scp->irq_rid, scp->irq);
610 scp->irq = NULL;
611 }
612 for (i = 0 ; i < nitems(scp->drq); i++) {
613 if (scp->drq[i] != NULL) {
614 bus_release_resource(scp->dev, SYS_RES_DRQ, scp->drq_rid[i], scp->drq[i]);
615 scp->drq[i] = NULL;
616 }
617 }
618 break;
619 case LOGICALID_OPL:
620 if (scp->io[0] != NULL) {
621 bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[0], scp->io[0]);
622 scp->io[0] = NULL;
623 }
624 break;
625 case LOGICALID_MIDI:
626 if (scp->io[0] != NULL) {
627 bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[0], scp->io[0]);
628 scp->io[0] = NULL;
629 }
630 if (scp->irq != NULL) {
631 /* The irq is shared with pcm audio. */
632 dev = find_masterdev(scp);
633 if (dev == NULL)
634 return (1);
635 BUS_RELEASE_RESOURCE(dev, NULL, SYS_RES_IOPORT, scp->irq_rid, scp->irq);
636 scp->irq = NULL;
637 }
638 break;
639 }
640 return (0);
641}
642
643static device_method_t gusc_methods[] = {
644 /* Device interface */
645 DEVMETHOD(device_probe, gusc_probe),
646 DEVMETHOD(device_attach, gusc_attach),
647 DEVMETHOD(device_detach, bus_generic_detach),
648 DEVMETHOD(device_shutdown, bus_generic_shutdown),
649 DEVMETHOD(device_suspend, bus_generic_suspend),
650 DEVMETHOD(device_resume, bus_generic_resume),
651
652 /* Bus interface */
653 DEVMETHOD(bus_alloc_resource, gusc_alloc_resource),
654 DEVMETHOD(bus_release_resource, gusc_release_resource),
655 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
656 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
657 DEVMETHOD(bus_setup_intr, gusc_setup_intr),
658 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
659
660 DEVMETHOD_END
661};
662
663static driver_t gusc_driver = {
664 "gusc",
666 sizeof(struct gusc_softc),
667};
668
669/*
670 * gusc can be attached to an isa bus.
671 */
675MODULE_VERSION(snd_gusc, 1);
METHOD int intr
Definition: audio_dai_if.m:91
@ SCF_SYNTH
Definition: chip.h:38
@ SCF_PCM
Definition: chip.h:36
@ SCF_MIDI
Definition: chip.h:37
int type
Definition: dsp.c:386
u_int32_t count
Definition: feeder_if.m:86
#define LOGICALID_PCM
Definition: gusc.c:54
static int gusc_probe(device_t dev)
Definition: gusc.c:107
static driver_t gusc_driver
Definition: gusc.c:663
static struct isa_pnp_id gusc_ids[]
Definition: gusc.c:59
ISA_PNP_INFO(gusc_ids)
static device_method_t gusc_methods[]
Definition: gusc.c:643
static devclass_t gusc_devclass
Definition: gusc.c:104
static int io_range[3]
Definition: gusc.c:474
MODULE_VERSION(snd_gusc, 1)
static void port_wr(struct resource *r, int i, unsigned char v)
Definition: gusc.c:165
static int release_resource(sc_p scp)
Definition: gusc.c:589
static int gusc_attach(device_t dev)
Definition: gusc.c:306
static device_t find_masterdev(sc_p scp)
Definition: gusc.c:452
SND_DECLARE_FILE("$FreeBSD$")
struct gusc_softc * sc_p
Definition: gusc.c:89
static void gusc_intr(void *)
Definition: gusc.c:333
DRIVER_MODULE(snd_gusc, isa, gusc_driver, gusc_devclass, 0, 0)
static int port_rd(struct resource *r, int i)
Definition: gusc.c:171
#define LOGICALID_MIDI
Definition: gusc.c:56
static int gusisa_probe(device_t dev)
Definition: gusc.c:181
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)
Definition: gusc.c:425
static int gusc_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r)
Definition: gusc.c:393
#define LOGICALID_OPL
Definition: gusc.c:55
static struct resource * gusc_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
Definition: gusc.c:354
MODULE_DEPEND(snd_gusc, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
#define LOGICALID_NOPNP
Definition: gusc.c:53
static int alloc_resource(sc_p scp)
Definition: gusc.c:477
static int io_offset[3]
Definition: gusc.c:475
uint16_t base
Definition: hdaa.c:124
device_t child
Definition: hdac_if.m:33
uint8_t r
uint16_t fail
unsigned dev
Definition: mixer_if.m:59
uint16_t rid
u_int32_t val
u_int bus
int * irq
int snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand, void *param, void **cookiep)
Definition: sound.c:117
#define DV_F_DUAL_DMA
Definition: sound.h:369
#define SOUND_PREFVER
Definition: sound.h:103
#define SOUND_MAXVER
Definition: sound.h:104
#define DV_F_DRQ_MASK
Definition: sound.h:368
#define SOUND_MINVER
Definition: sound.h:102
void * arg
Definition: gusc.c:68
void(* intr)(void *)
Definition: gusc.c:67
struct resource * drq[2]
Definition: gusc.c:81
struct resource * irq
Definition: gusc.c:78
device_t dev
Definition: gusc.c:73
struct gusc_ihandler midi_intr
Definition: gusc.c:85
int drq_alloced[2]
Definition: gusc.c:82
int io_alloced[3]
Definition: gusc.c:76
int io_rid[3]
Definition: gusc.c:74
int drq_rid[2]
Definition: gusc.c:80
struct resource * io[3]
Definition: gusc.c:75
struct gusc_ihandler pcm_intr
Definition: gusc.c:86
int irq_rid
Definition: gusc.c:77
int irq_alloced
Definition: gusc.c:79
int func
Definition: chip.h:47