Deleted Added
sdiff udiff text old ( 58385 ) new ( 60711 )
full compact
1/*-
2 * Copyright (c) 1999 Seigo Tanimura
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/sound/isa/sbc.c 58385 2000-03-20 15:34:27Z cg $
27 */
28
29#include "isa.h"
30
31#include <dev/sound/chip.h>
32#include <dev/sound/pcm/sound.h>
33#include <dev/sound/isa/sb.h>
34

--- 46 unchanged lines hidden (view full) ---

81
82static int alloc_resource(struct sbc_softc *scp);
83static int release_resource(struct sbc_softc *scp);
84
85static devclass_t sbc_devclass;
86
87static int io_range[3] = {0x10, 0x2, 0x4};
88
89static int sb_rd(struct resource *io, int reg);
90static void sb_wr(struct resource *io, int reg, u_int8_t val);
91static int sb_dspready(struct resource *io);
92static int sb_cmd(struct resource *io, u_char val);
93static u_int sb_get_byte(struct resource *io);
94static void sb_setmixer(struct resource *io, u_int port, u_int value);
95
96static int

--- 132 unchanged lines hidden (view full) ---

229 if (lid == 0x01000000 && vid != 0x01009305) /* ALS0001 */
230 return ENXIO;
231 /* Check pnp ids */
232 return ISA_PNP_PROBE(device_get_parent(dev), dev, sbc_ids);
233 } else {
234 int rid = 0, ver;
235 struct resource *io;
236
237 io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
238 0, ~0, 16, RF_ACTIVE);
239 if (!io) goto bad;
240 if (sb_reset_dsp(io)) goto bad2;
241 ver = sb_identify_board(io);
242 if (ver == 0) goto bad2;
243 switch ((ver & 0x00000f00) >> 8) {
244 case 1:
245 case 2:
246 s = "Soundblaster";
247 break;

--- 71 unchanged lines hidden (view full) ---

319 scp->drq[0] = scp->drq[1];
320 scp->drq[1] = r;
321 dl = rman_get_start(scp->drq[0]);
322 dh = rman_get_start(scp->drq[1]);
323 }
324 /* soft irq/dma configuration */
325 x = -1;
326 irq = rman_get_start(scp->irq[0]);
327 if (irq == 5) x = 2;
328 else if (irq == 7) x = 4;
329 else if (irq == 9) x = 1;
330 else if (irq == 10) x = 8;
331 if (x == -1) {
332 err = "bad irq (5/7/9/10 valid)";
333 goto bad;
334 }
335 else sb_setmixer(scp->io[0], IRQ_NR, x);
336 sb_setmixer(scp->io[0], DMA_NR, (1 << dh) | (1 << dl));
337 device_printf(dev, "setting card to irq %d, drq %d", irq, dl);
338 if (dl != dh) printf(", %d", dh);
339 printf("\n");
340 break;
341 }
342
343 switch (logical_id) {
344 case 0x43008c0e: /* CTL0043 */

--- 113 unchanged lines hidden (view full) ---

458
459static struct resource *
460sbc_alloc_resource(device_t bus, device_t child, int type, int *rid,
461 u_long start, u_long end, u_long count, u_int flags)
462{
463 struct sbc_softc *scp;
464 int *alloced, rid_max, alloced_max;
465 struct resource **res;
466
467 scp = device_get_softc(bus);
468 switch (type) {
469 case SYS_RES_IOPORT:
470 alloced = scp->io_alloced;
471 res = scp->io;
472 rid_max = IO_MAX - 1;
473 alloced_max = 1;
474 break;
475 case SYS_RES_DRQ:
476 alloced = scp->drq_alloced;
477 res = scp->drq;
478 rid_max = DRQ_MAX - 1;
479 alloced_max = 1;
480 break;

--- 84 unchanged lines hidden (view full) ---

565
566static int
567alloc_resource(struct sbc_softc *scp)
568{
569 int i;
570
571 for (i = 0 ; i < IO_MAX ; i++) {
572 if (scp->io[i] == NULL) {
573 scp->io_rid[i] = i;
574 scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i],
575 0, ~0, io_range[i], RF_ACTIVE);
576 if (i == 0 && scp->io[i] == NULL)
577 return (1);
578 scp->io_alloced[i] = 0;
579 }
580 }
581 for (i = 0 ; i < DRQ_MAX ; i++) {
582 if (scp->drq[i] == NULL) {
583 scp->drq_rid[i] = i;

--- 77 unchanged lines hidden ---