summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1998-07-23 19:30:44 +0000
committerchristos <christos@NetBSD.org>1998-07-23 19:30:44 +0000
commitbdb2269a462b5df891fd7991f4ef6cb7819649ce (patch)
tree6702e61210a5288251afb02ef4e79ab9aa0ef41f /sys/dev
parent8d611b5f32023f0e6e10125cae4a52f871284639 (diff)
Create a master list of pnp logical and compatibility device codes instead
of hard-coding it into each driver and use a centralized probe function.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isapnp/Makefile4
-rw-r--r--sys/dev/isapnp/Makefile.isapnpdevs10
-rw-r--r--sys/dev/isapnp/aic_isapnp.c10
-rw-r--r--sys/dev/isapnp/com_isapnp.c17
-rw-r--r--sys/dev/isapnp/devlist2h.awk172
-rw-r--r--sys/dev/isapnp/files.isapnp3
-rw-r--r--sys/dev/isapnp/gus_isapnp.c14
-rw-r--r--sys/dev/isapnp/i82365_isapnp.c9
-rw-r--r--sys/dev/isapnp/if_ep_isapnp.c14
-rw-r--r--sys/dev/isapnp/if_le_isapnp.c20
-rw-r--r--sys/dev/isapnp/if_ne_isapnp.c38
-rw-r--r--sys/dev/isapnp/isapnp.c26
-rw-r--r--sys/dev/isapnp/isapnpdevs137
-rw-r--r--sys/dev/isapnp/isapnpvar.h7
-rw-r--r--sys/dev/isapnp/sb_isapnp.c25
-rw-r--r--sys/dev/isapnp/wdc_isapnp.c10
-rw-r--r--sys/dev/isapnp/wss_isapnp.c10
-rw-r--r--sys/dev/isapnp/ym_isapnp.c10
18 files changed, 394 insertions, 142 deletions
diff --git a/sys/dev/isapnp/Makefile b/sys/dev/isapnp/Makefile
index 62306b95008..4f7e442d246 100644
--- a/sys/dev/isapnp/Makefile
+++ b/sys/dev/isapnp/Makefile
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.1 1998/06/12 23:22:51 cgd Exp $
+# $NetBSD: Makefile,v 1.2 1998/07/23 19:30:44 christos Exp $
+
+# use 'make -f Makefile.isapnpdevs' to make isapnpdevs.h and isapnpdevs.c
INCSDIR= /usr/include/dev/isapnp
diff --git a/sys/dev/isapnp/Makefile.isapnpdevs b/sys/dev/isapnp/Makefile.isapnpdevs
new file mode 100644
index 00000000000..ed17b3959f2
--- /dev/null
+++ b/sys/dev/isapnp/Makefile.isapnpdevs
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile.isapnpdevs,v 1.1 1998/07/23 19:30:44 christos Exp $
+
+AWK= awk
+
+# Kill shuttle .c rule
+.c:
+
+isapnpdevs.h isapnpdevs.c: isapnpdevs devlist2h.awk
+ /bin/rm -f isapnpdevs.h isapnpdevs.c
+ ${AWK} -f devlist2h.awk isapnpdevs
diff --git a/sys/dev/isapnp/aic_isapnp.c b/sys/dev/isapnp/aic_isapnp.c
index ef75b9f2135..ec4a55c94cb 100644
--- a/sys/dev/isapnp/aic_isapnp.c
+++ b/sys/dev/isapnp/aic_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aic_isapnp.c,v 1.2 1998/06/09 07:28:30 thorpej Exp $ */
+/* $NetBSD: aic_isapnp.c,v 1.3 1998/07/23 19:30:44 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -46,6 +46,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsipiconf.h>
@@ -73,12 +74,7 @@ aic_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
- if (strcmp(ipa->ipa_devlogic, "ADP1520")) /* Adaptec AHA-1520B */
- return (0);
-
- return (1);
+ return isapnp_devmatch(aux, &isapnp_aic_devinfo);
}
void
diff --git a/sys/dev/isapnp/com_isapnp.c b/sys/dev/isapnp/com_isapnp.c
index 983f3d333e7..96fec65abc3 100644
--- a/sys/dev/isapnp/com_isapnp.c
+++ b/sys/dev/isapnp/com_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com_isapnp.c,v 1.12 1998/04/25 10:58:24 drochner Exp $ */
+/* $NetBSD: com_isapnp.c,v 1.13 1998/07/23 19:30:44 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -52,6 +52,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/ic/comvar.h>
@@ -75,19 +76,7 @@ com_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
-
- if (strcmp(ipa->ipa_devlogic, "BDP3336") && /* Best Data Prods. 336F */
- strcmp(ipa->ipa_devlogic, "OZO8039") && /* Zoom 56k flex */
- strcmp(ipa->ipa_devlogic, "BRI1400") && /* Boca 33.6 PnP */
- strcmp(ipa->ipa_devlogic, "ROK0010") && /* Rockwell ? */
- strcmp(ipa->ipa_devlogic, "USR2070") && /* USR Sportster 56k */
- strcmp(ipa->ipa_devcompat, "PNP0500") && /* generic 8250/16450 */
- strcmp(ipa->ipa_devcompat, "PNP0501")) /* generic 16550A */
- return (0);
-
- return (1);
+ return isapnp_devmatch(aux, &isapnp_com_devinfo);
}
void
diff --git a/sys/dev/isapnp/devlist2h.awk b/sys/dev/isapnp/devlist2h.awk
new file mode 100644
index 00000000000..e247252126e
--- /dev/null
+++ b/sys/dev/isapnp/devlist2h.awk
@@ -0,0 +1,172 @@
+#! /usr/bin/awk -f
+# $NetBSD: devlist2h.awk,v 1.1 1998/07/23 19:30:44 christos Exp $
+#
+# Copyright (c) 1998, Christos Zoulas
+# Copyright (c) 1995, 1996 Christopher G. Demetriou
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by Christopher G. Demetriou.
+# This product includes software developed by Christos Zoulas
+# 4. The name of the author(s) may not be used to endorse or promote products
+# derived from this software without specific prior written permission
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+function collectline(f, line) {
+ oparen = 0
+ line = ""
+ while (f <= NF) {
+ if ($f == "#") {
+ line = line "("
+ oparen = 1
+ f++
+ continue
+ }
+ if (oparen) {
+ line = line $f
+ if (f < NF)
+ line = line " "
+ f++
+ continue
+ }
+ line = line $f
+ if (f < NF)
+ line = line " "
+ f++
+ }
+ if (oparen)
+ line = line ")"
+ return line
+}
+function checkdecl() {
+ done = 1
+ if (!decl) {
+ decl = 1;
+ printf("struct isapnp_devinfo {\n") > hfile
+ printf("\tconst char *const *devlogic;\n") > hfile
+ printf("\tconst char *const *devcompat;\n") > hfile
+ printf("};\n\n") > hfile
+ printf("#include <sys/param.h>\n") > cfile
+ printf("#include <dev/isapnp/isapnpdevs.h>\n\n") > cfile
+ }
+}
+BEGIN {
+ decl = done = ncompat = nlogicals = ndriver = 0
+ cfile="isapnpdevs.c"
+ hfile="isapnpdevs.h"
+}
+NR == 1 {
+ VERSION = $0
+ gsub("\\$", "", VERSION)
+
+ printf("/*\t\$NetBSD\$\t*/\n\n") > cfile
+ printf("/*\n") > cfile
+ printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
+ > cfile
+ printf(" *\n") > cfile
+ printf(" * generated from:\n") > cfile
+ printf(" *\t%s\n", VERSION) > cfile
+ printf(" */\n") > cfile
+
+ printf("/*\t\$NetBSD\$\t*/\n\n") > hfile
+ printf("/*\n") > hfile
+ printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
+ > hfile
+ printf(" *\n") > hfile
+ printf(" * generated from:\n") > hfile
+ printf(" *\t%s\n", VERSION) > hfile
+ printf(" */\n") > hfile
+ printf("\n") > hfile
+ next
+}
+$1 == "driver" {
+ checkdecl()
+ ndriver++
+
+ driverindex[$2] = ndriver;
+ driver[ndriver, 1] = $2;
+ driver[ndriver, 2] = collectline(3, line);
+ printf("/* %s */\n", driver[ndriver, 2]) > hfile
+ printf("extern const struct isapnp_devinfo isapnp_%s_devinfo;\n",
+ driver[ndriver, 1]) > hfile
+ next
+}
+$1 == "devlogic" {
+ checkdecl()
+ nlogicals++
+
+ logicals[nlogicals, 1] = $2;
+ logicals[nlogicals, 2] = $3;
+ logicals[nlogicals, 3] = collectline(4, line);
+ next
+}
+$1 == "devcompat" {
+ checkdecl()
+ ncompats++
+
+ compats[ncompats, 1] = $2;
+ compats[ncompats, 2] = $3;
+ compats[ncompats, 3] = collectline(4, line);
+ next
+}
+{
+ if (!done) {
+ if ($0 == "")
+ blanklines++
+ print $0 > hfile
+ if (blanklines < 2)
+ print $0 > cfile
+ }
+}
+END {
+ # print out the match tables
+
+ printf("\n") > cfile
+
+ for (i = 1; i <= ndriver; i++) {
+ printf("/* %s */\n", driver[i, 2]) > cfile
+ printf("static const char *isapnp_%s_devlogic[] = {\n",
+ driver[i, 1]) > cfile
+ for (j = 1; j <= nlogicals; j++) {
+ if (logicals[j, 1] == driver[i, 1]) {
+ printf("\t\"%s\",\t/* %s */\n", logicals[j, 2],
+ logicals[j, 3]) > cfile
+ }
+ }
+ printf("\tNULL\n};\n") > cfile
+ printf("static const char *isapnp_%s_devcompat[] = {\n",
+ driver[i, 1]) > cfile
+ for (j = 1; j <= ncompats; j++) {
+ if (compats[j, 1] == driver[i, 1]) {
+ printf("\t\"%s\",\t/* %s */\n", compats[j, 2],
+ compats[j, 3]) > cfile
+ }
+ }
+ printf("\tNULL\n};\n") > cfile
+ printf("const struct isapnp_devinfo isapnp_%s_devinfo = {\n",
+ driver[i, 1]) > cfile
+ printf("\tisapnp_%s_devlogic, isapnp_%s_devcompat\n};\n",
+ driver[i, 1], driver[i, 1]) > cfile
+ printf("\n") > cfile;
+
+ }
+}
diff --git a/sys/dev/isapnp/files.isapnp b/sys/dev/isapnp/files.isapnp
index 34b51a7a4df..e3b00c77c85 100644
--- a/sys/dev/isapnp/files.isapnp
+++ b/sys/dev/isapnp/files.isapnp
@@ -1,4 +1,4 @@
-# $NetBSD: files.isapnp,v 1.14 1998/07/21 17:36:06 drochner Exp $
+# $NetBSD: files.isapnp,v 1.15 1998/07/23 19:30:44 christos Exp $
#
# Config file and device description for machine-independent ISAPnP code.
# Included by ports that need it.
@@ -12,6 +12,7 @@ attach isapnp at isa
file dev/isapnp/isapnp.c isapnp
file dev/isapnp/isapnpdebug.c isapnp
file dev/isapnp/isapnpres.c isapnp
+file dev/isapnp/isapnpdevs.c isapnp
# 3Com 3C509B
attach ep at isapnp with ep_isapnp
diff --git a/sys/dev/isapnp/gus_isapnp.c b/sys/dev/isapnp/gus_isapnp.c
index f5703fcc611..e65eaebdede 100644
--- a/sys/dev/isapnp/gus_isapnp.c
+++ b/sys/dev/isapnp/gus_isapnp.c
@@ -1,7 +1,7 @@
#include "guspnp.h"
#if NGUSPNP > 0
-/* $NetBSD: gus_isapnp.c,v 1.8 1998/06/09 07:28:30 thorpej Exp $ */
+/* $NetBSD: gus_isapnp.c,v 1.9 1998/07/23 19:30:45 christos Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -64,6 +64,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/ic/interwavevar.h>
@@ -133,14 +134,11 @@ gus_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
+ if (!isapnp_devmatch(aux, &isapnp_gus_devinfo))
+ return 0;
- if (!strcmp(ipa->ipa_devlogic, "GRV0000")) {
- gus_0 = 1;
- return 1;
- /* we'll add support for other logical devices later */
- }
- return 0;
+ gus_0 = 1;
+ return 1;
}
diff --git a/sys/dev/isapnp/i82365_isapnp.c b/sys/dev/isapnp/i82365_isapnp.c
index 83ce9302220..a291a37b463 100644
--- a/sys/dev/isapnp/i82365_isapnp.c
+++ b/sys/dev/isapnp/i82365_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82365_isapnp.c,v 1.3 1998/06/23 04:19:23 sommerfe Exp $ */
+/* $NetBSD: i82365_isapnp.c,v 1.4 1998/07/23 19:30:45 christos Exp $ */
/*
* Copyright (c) 1998 Bill Sommerfeld. All rights reserved.
@@ -48,6 +48,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/pcmcia/pcmciareg.h>
#include <dev/pcmcia/pcmciavar.h>
@@ -96,11 +97,7 @@ pcic_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
- if (strcmp(ipa->ipa_devlogic, "PNP0E00"))
- return 0;
- return 1;
+ return isapnp_devmatch(aux, &isapnp_pcic_devinfo);
}
void
diff --git a/sys/dev/isapnp/if_ep_isapnp.c b/sys/dev/isapnp/if_ep_isapnp.c
index 077eb78ac32..d09d89b4f07 100644
--- a/sys/dev/isapnp/if_ep_isapnp.c
+++ b/sys/dev/isapnp/if_ep_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ep_isapnp.c,v 1.14 1998/07/05 06:49:14 jonathan Exp $ */
+/* $NetBSD: if_ep_isapnp.c,v 1.15 1998/07/23 19:30:45 christos Exp $ */
/*
* Copyright (c) 1997 Jonathan Stone <jonathan@NetBSD.org>
@@ -74,6 +74,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
@@ -91,16 +92,7 @@ ep_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
- if (strcmp(ipa->ipa_devlogic, "TCM5090") &&
- strcmp(ipa->ipa_devlogic, "TCM5091") &&
- strcmp(ipa->ipa_devlogic, "TCM5094") &&
- strcmp(ipa->ipa_devlogic, "TCM5095") &&
- strcmp(ipa->ipa_devlogic, "TCM5098"))
- return (0);
-
- return (1);
+ return isapnp_devmatch(aux, &isapnp_ep_devinfo);
}
void
diff --git a/sys/dev/isapnp/if_le_isapnp.c b/sys/dev/isapnp/if_le_isapnp.c
index dd90ac6dc99..75a495e08da 100644
--- a/sys/dev/isapnp/if_le_isapnp.c
+++ b/sys/dev/isapnp/if_le_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le_isapnp.c,v 1.14 1998/07/21 17:36:06 drochner Exp $ */
+/* $NetBSD: if_le_isapnp.c,v 1.15 1998/07/23 19:30:45 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -112,6 +112,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/ic/lancereg.h>
#include <dev/ic/lancevar.h>
@@ -131,14 +132,6 @@ static void le_isapnp_wrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
static u_int16_t le_isapnp_rdcsr __P((struct lance_softc *, u_int16_t));
-/*
- * Names accepted by the match routine.
- */
-static char *if_le_isapnp_devnames[] = {
- "TKN0010",
- 0
-};
-
#define LE_ISAPNP_MEMSIZE 16384
static void
@@ -175,14 +168,7 @@ le_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
- char **card_name = &if_le_isapnp_devnames[0];
-
- while (*card_name)
- if(!strcmp(ipa->ipa_devlogic, *card_name++))
- return(1);
-
- return (0);
+ return isapnp_devmatch(ipa, &isapnp_le_dev);
}
void
diff --git a/sys/dev/isapnp/if_ne_isapnp.c b/sys/dev/isapnp/if_ne_isapnp.c
index 9ce4070fce7..c36e110ced4 100644
--- a/sys/dev/isapnp/if_ne_isapnp.c
+++ b/sys/dev/isapnp/if_ne_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ne_isapnp.c,v 1.6 1998/07/05 06:49:14 jonathan Exp $ */
+/* $NetBSD: if_ne_isapnp.c,v 1.7 1998/07/23 19:30:45 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -87,6 +87,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
static int ne_isapnp_match __P((struct device *, struct cfdata *, void *));
static void ne_isapnp_attach __P((struct device *, struct device *, void *));
@@ -102,38 +103,13 @@ struct cfattach ne_isapnp_ca = {
sizeof(struct ne_isapnp_softc), ne_isapnp_match, ne_isapnp_attach
};
-
-/*
- * Names accepted by the match routine.
- */
-static const struct ne_pnpid {
- const char *id_devlogic;
- const char *id_devcompat;
-} if_ne_isapnp_pnpids[] = {
- { NULL, "PNP80D6" }, /* Digital DE305 ISAPnP */
- { NULL, NULL }
-};
-
static int
-ne_isapnp_match(
- struct device *parent,
- struct cfdata *match,
- void *aux)
+ne_isapnp_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
{
- struct isapnp_attach_args *ipa = aux;
- const struct ne_pnpid *pnpid = if_ne_isapnp_pnpids;
-
- while (pnpid->id_devlogic != NULL || pnpid->id_devcompat != NULL) {
- if (pnpid->id_devlogic != NULL
- && !strcmp(ipa->ipa_devlogic, pnpid->id_devlogic))
- return(1);
- if (pnpid->id_devcompat != NULL
- && !strcmp(ipa->ipa_devcompat, pnpid->id_devcompat))
- return(1);
- pnpid++;
- }
-
- return (0);
+ return isapnp_devmatch(aux, &isapnp_ne_devinfo);
}
static void
diff --git a/sys/dev/isapnp/isapnp.c b/sys/dev/isapnp/isapnp.c
index de18142b8fb..358bb02d339 100644
--- a/sys/dev/isapnp/isapnp.c
+++ b/sys/dev/isapnp/isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: isapnp.c,v 1.19 1998/06/09 07:28:31 thorpej Exp $ */
+/* $NetBSD: isapnp.c,v 1.20 1998/07/23 19:30:45 christos Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -45,6 +45,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
static void isapnp_init __P((struct isapnp_softc *));
static __inline u_char isapnp_shift_bit __P((struct isapnp_softc *));
@@ -569,6 +570,27 @@ isapnp_submatch(parent, match, aux)
struct cfdata *cf = (struct cfdata *) match;
return ((*cf->cf_attach->ca_match)(parent, match, aux));
}
+
+/* isapnp_devmatch():
+ * Match a probed device with the information from the driver
+ */
+int
+isapnp_devmatch(ipa, dinfo)
+ const struct isapnp_attach_args *ipa;
+ const struct isapnp_devinfo *dinfo;
+{
+ const char *const *name;
+
+ for (name = dinfo->devlogic; *name; name++)
+ if (strcmp(*name, ipa->ipa_devlogic) == 0)
+ return 1;
+
+ for (name = dinfo->devcompat; *name; name++)
+ if (strcmp(*name, ipa->ipa_devcompat) == 0)
+ return 1;
+
+ return 0;
+}
#endif
@@ -594,7 +616,7 @@ isapnp_find(sc, all)
sc->sc_read_port = p;
if (isapnp_map_readport(sc))
continue;
- DPRINTF(("%s: Trying port %x\n", sc->sc_dev.dv_xname, p));
+ DPRINTF(("%s: Trying port %x\r", sc->sc_dev.dv_xname, p));
if (isapnp_findcard(sc))
break;
isapnp_unmap_readport(sc);
diff --git a/sys/dev/isapnp/isapnpdevs b/sys/dev/isapnp/isapnpdevs
new file mode 100644
index 00000000000..839c8eb83e8
--- /dev/null
+++ b/sys/dev/isapnp/isapnpdevs
@@ -0,0 +1,137 @@
+$NetBSD: isapnpdevs,v 1.1 1998/07/23 19:30:45 christos Exp $
+
+/*
+ * Copyright (c) 1998, Christos Zoulas
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christos Zoulas
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * List of known drivers
+ */
+driver aic Adaptec SCSI
+driver com National Semiconductor Serial
+driver ep 3Com 3CXXX Ethernet
+driver joy Generic Joystick
+driver gus Gravis Ultrasound
+driver le Lance Ethernet
+driver ne NE2000 Ethernet
+driver pcic PCMCIA bridge
+driver sb Creative Soundblaster
+driver wdc Western Digital Disk Controller
+driver wss Microsoft Sound System
+driver ym Yamaha Sound
+
+/*
+ * aic
+ */
+devlogic aic ADP1520 Adaptec AHA-1520B
+
+/*
+ * com
+ */
+devlogic com BDP3336 Best Data Prods. 336F
+devlogic com OZO8039 Zoom 56k flex
+devlogic com BRI1400 Boca 33.6 PnP
+devlogic com ROK0010 Rockwell ?
+devlogic com USR2070 USR Sportster 56k
+devcompat com PNP0500 Generic 8250/16450
+devcompat com PNP0501 Generic 16550A
+
+/*
+ * ep
+ */
+devlogic ep TCM5090 3Com 3c509B
+devlogic ep TCM5091 3Com 3c509B-1
+devlogic ep TCM5094 3Com 3c509B-4
+devlogic ep TCM5095 3Com 3c509B-5
+devlogic ep TCM5098 3Com 3c509B-8
+
+/*
+ * joy
+ */
+devlogic joy CSCA801 Terratec EWS64XL
+devlogic joy CTL7002 Creative Vibra16CL
+devlogic joy ESS0001 ESS1868
+devlogic joy OPT0001 OPTi Audio 16
+devlogic joy PNPB02F XXX broken GUS PnP
+devcompat joy PNPB02F generic
+
+/*
+ * gus
+ */
+devlogic gus GRV0000 Gravis Ultrasound
+
+/*
+ * le
+ */
+devlogic le TKN0010 Lance Ethernet
+
+/*
+ * ne
+ */
+devcompat ne PNP80D6 Digital DE305 ISAPnP
+
+/*
+ * pcic
+ */
+devcompat pcic PNP0E00 PCIC Compatible PCMCIA Bridge
+
+/*
+ * sb
+ */
+devlogic sb ADS7150 AD1815
+devlogic sb ADS7180 AD1816
+devlogic sb CTL0001 SB
+devlogic sb CTL0031 SB AWE32
+devlogic sb CTL0041 SB16 PnP (CT4131)
+devlogic sb CTL0043 SB16 PnP (CT4170)
+devlogic sb CTL0042 SB AWE64 Value
+devlogic sb CTL0044 SB AWE64 Gold
+devlogic sb CTL0045 SB AWE64 Value
+devlogic sb ESS1868 ESS1868
+devlogic sb OPT9250 Televideo card, Opti
+devcompat sb PNPB000 Generic SB 1.5
+devcompat sb PNPB001 Generic SB 2.0
+devcompat sb PNPB002 Generic SB Pro
+devcompat sb PNPB003 Generic SB 16
+
+/*
+ * wdc
+ */
+devcompat wdc PNP0600 Western Digital Compatible Controller
+
+/*
+ * wss
+ */
+devlogic wss CSC0000 Windows Sound System
+
+/*
+ * ym
+ */
+devlogic ym YMH0021 OPL3-SA3
diff --git a/sys/dev/isapnp/isapnpvar.h b/sys/dev/isapnp/isapnpvar.h
index 9aae11c98ac..44db81f2132 100644
--- a/sys/dev/isapnp/isapnpvar.h
+++ b/sys/dev/isapnp/isapnpvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: isapnpvar.h,v 1.8 1998/06/09 00:05:19 thorpej Exp $ */
+/* $NetBSD: isapnpvar.h,v 1.9 1998/07/23 19:30:46 christos Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -180,6 +180,11 @@ int isapnp_config __P((bus_space_tag_t, bus_space_tag_t,
struct isapnp_attach_args *));
void isapnp_unconfig __P((bus_space_tag_t, bus_space_tag_t,
struct isapnp_attach_args *));
+#ifdef _KERNEL
+struct isapnp_devinfo;
+int isapnp_devmatch __P((const struct isapnp_attach_args *,
+ const struct isapnp_devinfo *));
+#endif
#ifdef DEBUG_ISAPNP
void isapnp_print_mem __P((const char *, const struct isapnp_region *));
diff --git a/sys/dev/isapnp/sb_isapnp.c b/sys/dev/isapnp/sb_isapnp.c
index 8b99750eb88..1ecc10c904f 100644
--- a/sys/dev/isapnp/sb_isapnp.c
+++ b/sys/dev/isapnp/sb_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sb_isapnp.c,v 1.26 1998/06/29 22:42:32 thorpej Exp $ */
+/* $NetBSD: sb_isapnp.c,v 1.27 1998/07/23 19:30:46 christos Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -53,6 +53,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/isa/sbreg.h>
#include <dev/isa/sbvar.h>
@@ -79,30 +80,10 @@ sb_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
- if (strcmp(ipa->ipa_devlogic, "ADS7150") && /* AD1815 */
- strcmp(ipa->ipa_devlogic, "ADS7180") && /* AD1816 */
- strcmp(ipa->ipa_devlogic, "CTL0001") &&
- strcmp(ipa->ipa_devlogic, "CTL0031") && /* SB AWE32 */
- strcmp(ipa->ipa_devlogic, "CTL0041") && /* SB16 PnP (CT4131) */
- strcmp(ipa->ipa_devlogic, "CTL0043") && /* SB16 PnP (CT4170) */
- strcmp(ipa->ipa_devlogic, "CTL0042") && /* SB AWE64 Value */
- strcmp(ipa->ipa_devlogic, "CTL0044") && /* SB AWE64 Gold */
- strcmp(ipa->ipa_devlogic, "CTL0045") && /* SB AWE64 Value */
- strcmp(ipa->ipa_devlogic, "ESS1868") &&
- strcmp(ipa->ipa_devlogic, "OPT9250") && /* Televideo card, Opti */
- strcmp(ipa->ipa_devcompat, "PNPB000") && /* generic SB 1.5 */
- strcmp(ipa->ipa_devcompat, "PNPB001") && /* generic SB 2.0 */
- strcmp(ipa->ipa_devcompat, "PNPB002") && /* generic SB Pro */
- strcmp(ipa->ipa_devcompat, "PNPB003")) /* generic SB 16 */
- return (0);
-
- return (1);
+ return isapnp_devmatch(aux, &isapnp_sb_devinfo);
}
-
/*
* Attach hardware to driver, attach hardware driver to audio
* pseudo-device driver.
diff --git a/sys/dev/isapnp/wdc_isapnp.c b/sys/dev/isapnp/wdc_isapnp.c
index a722279188b..81cbc2e3251 100644
--- a/sys/dev/isapnp/wdc_isapnp.c
+++ b/sys/dev/isapnp/wdc_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc_isapnp.c,v 1.4 1998/06/09 07:28:31 thorpej Exp $ */
+/* $NetBSD: wdc_isapnp.c,v 1.5 1998/07/23 19:30:46 christos Exp $ */
/*
* Copyright (c) 1997 Charles M. Hannum. All rights reserved.
@@ -47,6 +47,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/ic/wdcreg.h>
#include <dev/ic/wdcvar.h>
@@ -78,12 +79,7 @@ wdc_isapnp_probe(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
- if (strcmp(ipa->ipa_devcompat, "PNP0600"))
- return (0);
-
- return (1);
+ return isapnp_devmatch(aux, &isapnp_wdc_devinfo);
}
void
diff --git a/sys/dev/isapnp/wss_isapnp.c b/sys/dev/isapnp/wss_isapnp.c
index e95651ed38f..ebde54b5430 100644
--- a/sys/dev/isapnp/wss_isapnp.c
+++ b/sys/dev/isapnp/wss_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wss_isapnp.c,v 1.1 1998/06/30 17:28:00 augustss Exp $ */
+/* $NetBSD: wss_isapnp.c,v 1.2 1998/07/23 19:30:46 christos Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -53,6 +53,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/isa/ad1848var.h>
#include <dev/isa/madreg.h>
@@ -80,12 +81,7 @@ wss_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
- if (strcmp(ipa->ipa_devlogic, "CSC0000") == 0)
- return (1);
-
- return (0);
+ return isapnp_devmatch(aux, &isapnp_wss_dev);
}
diff --git a/sys/dev/isapnp/ym_isapnp.c b/sys/dev/isapnp/ym_isapnp.c
index e1f5c8571e3..593dcc9fd55 100644
--- a/sys/dev/isapnp/ym_isapnp.c
+++ b/sys/dev/isapnp/ym_isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ym_isapnp.c,v 1.3 1998/06/09 00:05:20 thorpej Exp $ */
+/* $NetBSD: ym_isapnp.c,v 1.4 1998/07/23 19:30:46 christos Exp $ */
/*
@@ -58,6 +58,7 @@
#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
+#include <dev/isapnp/isapnpdevs.h>
#include <dev/ic/ad1848reg.h>
#include <dev/isa/ad1848var.h>
@@ -89,12 +90,7 @@ ym_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
- struct isapnp_attach_args *ipa = aux;
-
- if (strcmp(ipa->ipa_devlogic, "YMH0021")) /* OPL3-SA3 */
- return 0;
-
- return 1;
+ return isapnp_devmatch(aux, &isapnp_ym_devinfo);
}
/*