Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/pnpbios Add ability to customize I/O region an...
details: https://anonhg.NetBSD.org/src/rev/58e713a37c42
branches: trunk
changeset: 482743:58e713a37c42
user: groo <groo%NetBSD.org@localhost>
date: Sun Feb 20 22:03:49 2000 +0000
description:
Add ability to customize I/O region and DAC offset based on pnpbios idstr.
Add CSC0000 id from Dell Latitude CPi.
diffstat:
sys/arch/i386/pnpbios/wss_pnpbios.c | 47 +++++++++++++++++++++++++++++++++---
1 files changed, 42 insertions(+), 5 deletions(-)
diffs (97 lines):
diff -r 7c842cf0a333 -r 58e713a37c42 sys/arch/i386/pnpbios/wss_pnpbios.c
--- a/sys/arch/i386/pnpbios/wss_pnpbios.c Sun Feb 20 21:42:26 2000 +0000
+++ b/sys/arch/i386/pnpbios/wss_pnpbios.c Sun Feb 20 22:03:49 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wss_pnpbios.c,v 1.2 1999/11/14 02:15:51 thorpej Exp $ */
+/* $NetBSD: wss_pnpbios.c,v 1.3 2000/02/20 22:03:49 groo Exp $ */
/*
* Copyright (c) 1999
* Matthias Drochner. All rights reserved.
@@ -49,11 +49,42 @@
int wss_pnpbios_match __P((struct device *, struct cfdata *, void *));
void wss_pnpbios_attach __P((struct device *, struct device *, void *));
+int wss_pnpbios_hints_index __P((const char *));
+
struct cfattach wss_pnpbios_ca = {
sizeof(struct wss_softc), wss_pnpbios_match, wss_pnpbios_attach
};
+struct wss_pnpbios_hint {
+ char idstr[8];
+ int io_region_idx_ad1848; /* which region index is the DAC? */
+ int io_region_idx_opl; /* which region index is the OPL? */
+ int offset_ad1848; /* offset from start of DAC region */
+};
+
+struct wss_pnpbios_hint wss_pnpbios_hints[] = {
+ { "NMX2210", 1, 2, WSS_CODEC },
+ { "CSC0000", 0, 1, 0 }, /* Dell Latitude CPi */
+ { { 0 }, 0, 0, 0 }
+};
+
+
+int
+wss_pnpbios_hints_index(idstr)
+ const char *idstr;
+{
+ int idx = 0;
+
+ while (wss_pnpbios_hints[idx].idstr[0] != 0) {
+ if (!strcmp(wss_pnpbios_hints[idx].idstr, idstr))
+ return idx;
+ ++idx;
+ }
+
+ return -1;
+}
+
int
wss_pnpbios_match(parent, match, aux)
struct device *parent;
@@ -62,7 +93,7 @@
{
struct pnpbiosdev_attach_args *aa = aux;
- if (strcmp(aa->idstr, "NMX2210"))
+ if (wss_pnpbios_hints_index(aa->idstr) == -1)
return (0);
return (2); /* beat sb */
@@ -76,6 +107,8 @@
struct wss_softc *sc = (void *)self;
struct pnpbiosdev_attach_args *aa = aux;
struct audio_attach_args arg;
+ struct wss_pnpbios_hint *wph;
+
#if 0
static u_char interrupt_bits[12] = {
-1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20
@@ -83,11 +116,15 @@
static u_char dma_bits[4] = {1, 2, 0, 3};
#endif
- if (pnpbios_io_map(aa->pbt, aa->resc, 1, &sc->sc_iot, &sc->sc_ioh)) {
+ wph = &wss_pnpbios_hints[wss_pnpbios_hints_index(aa->idstr)];
+
+ if (pnpbios_io_map(aa->pbt, aa->resc, wph->io_region_idx_ad1848,
+ &sc->sc_iot, &sc->sc_ioh)) {
printf(": can't map i/o space\n");
return;
}
- if (pnpbios_io_map(aa->pbt, aa->resc, 2, &sc->sc_iot, &sc->sc_opl_ioh)) {
+ if (pnpbios_io_map(aa->pbt, aa->resc, wph->io_region_idx_opl,
+ &sc->sc_iot, &sc->sc_opl_ioh)) {
printf(": can't map i/o space\n");
return;
}
@@ -107,7 +144,7 @@
sc->wss_recdrq = -1;
sc->sc_ad1848.sc_ad1848.sc_iot = sc->sc_iot;
- bus_space_subregion(sc->sc_iot, sc->sc_ioh, WSS_CODEC, 4,
+ bus_space_subregion(sc->sc_iot, sc->sc_ioh, wph->offset_ad1848, 4,
&sc->sc_ad1848.sc_ad1848.sc_ioh);
printf("\n");
Home |
Main Index |
Thread Index |
Old Index