Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/dreamcast Make the "maple" bus a direct config bus....



details:   https://anonhg.NetBSD.org/src/rev/697949002276
branches:  trunk
changeset: 503083:697949002276
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jan 31 00:14:29 2001 +0000

description:
Make the "maple" bus a direct config bus.  Now, when a device is
not configured into the kernel, you know about it, e.g.:

Dreamcast Controller         at maple0 port 0 not configured

diffstat:

 sys/arch/dreamcast/conf/GENERIC         |   4 +-
 sys/arch/dreamcast/conf/files.dreamcast |   4 +-
 sys/arch/dreamcast/dev/maple/maple.c    |  39 +++++++++++++++++++-------------
 3 files changed, 27 insertions(+), 20 deletions(-)

diffs (142 lines):

diff -r cd569c2ab223 -r 697949002276 sys/arch/dreamcast/conf/GENERIC
--- a/sys/arch/dreamcast/conf/GENERIC   Wed Jan 31 00:08:35 2001 +0000
+++ b/sys/arch/dreamcast/conf/GENERIC   Wed Jan 31 00:14:29 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERIC,v 1.4 2001/01/21 23:38:34 marcus Exp $
+#      $NetBSD: GENERIC,v 1.5 2001/01/31 00:14:29 thorpej Exp $
 #
 #      GENERIC -- everything that's currently supported
 #
@@ -116,7 +116,7 @@
 
 pvr0    at shb?
 
-mkbd*  at maple?
+mkbd*  at maple? port ? subunit ?
 
 wsdisplay*      at pvr? console ?
 wskbd*          at mkbd? console ?
diff -r cd569c2ab223 -r 697949002276 sys/arch/dreamcast/conf/files.dreamcast
--- a/sys/arch/dreamcast/conf/files.dreamcast   Wed Jan 31 00:08:35 2001 +0000
+++ b/sys/arch/dreamcast/conf/files.dreamcast   Wed Jan 31 00:14:29 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.dreamcast,v 1.4 2001/01/21 23:38:34 marcus Exp $
+#      $NetBSD: files.dreamcast,v 1.5 2001/01/31 00:14:29 thorpej Exp $
 #
 # new style config file for sh3 architecture
 #
@@ -18,7 +18,7 @@
                        BSC_RTCSR_VAL BSC_RTCNT_VAL BSC_RTCOR_VAL BSC_RFCR_VAL
                        BSC_PCR_VAL FRQCR_VAL PFC_SCPCR_VAL
 
-device maple { }
+device maple { [port = -1], [subunit = -1] }
 attach maple at shb
 file   arch/dreamcast/dev/maple/maple.c        maple
 
diff -r cd569c2ab223 -r 697949002276 sys/arch/dreamcast/dev/maple/maple.c
--- a/sys/arch/dreamcast/dev/maple/maple.c      Wed Jan 31 00:08:35 2001 +0000
+++ b/sys/arch/dreamcast/dev/maple/maple.c      Wed Jan 31 00:14:29 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: maple.c,v 1.3 2001/01/21 22:45:57 marcus Exp $ */
+/*     $NetBSD: maple.c,v 1.4 2001/01/31 00:14:30 thorpej Exp $        */
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -63,6 +63,7 @@
 static int     maplematch __P((struct device *, struct cfdata *, void *));
 static void    mapleattach __P((struct device *, struct device *, void *));
 static int     mapleprint __P((void *, const char *));
+static int     maplesubmatch __P((struct device *, struct cfdata *, void *));
 static void    maple_attach_dev __P((struct maple_softc *, int, int));
 static void    maple_begin_txbuf __P((struct maple_softc *));
 static int     maple_end_txbuf __P((struct maple_softc *));
@@ -89,8 +90,6 @@
        sizeof(struct maple_softc), maplematch, mapleattach
 };
 
-int    maplesearch __P((struct device *, struct cfdata *, void *));
-
 static int
 maplematch(parent, cf, aux)
        struct device *parent;
@@ -106,7 +105,6 @@
        return (1);
 }
 
-
 static void
 maple_attach_dev(sc, port, subunit)
        struct maple_softc *sc;
@@ -114,10 +112,12 @@
        int subunit;
 {
        struct maple_attach_args ma;
+
        ma.ma_port = port;
        ma.ma_subunit = subunit;
        ma.ma_devinfo = &sc->sc_unit[port][subunit].devinfo;
-       config_search(maplesearch, &sc->sc_dev, &ma);
+
+       (void) config_found_sm(&sc->sc_dev, &ma, mapleprint, maplesubmatch);
 }
 
 static void
@@ -395,7 +395,6 @@
        uvm_pglistfree(&mlist);
 }
 
-
 static void
 mapleattach(parent, self, aux)
        struct device *parent, *self;
@@ -455,26 +454,35 @@
        struct maple_attach_args *ma = aux;
 
        if (pnp != NULL)
-               printf("%s", pnp);
+               printf("%.*s at %s",
+                   (int)sizeof(ma->ma_devinfo->di_product_name),
+                   ma->ma_devinfo->di_product_name, pnp);
 
-       printf(" port %c", ma->ma_port+'A');
+       printf(" port %d", ma->ma_port);
 
        if (ma->ma_subunit != 0)
-         printf("%d", ma->ma_subunit);
+               printf(" subunit %d", ma->ma_subunit);
 
        return (UNCONF);
 }
 
-int
-maplesearch(parent, cf, aux)
+static int
+maplesubmatch(parent, match, aux)
        struct device *parent;
-       struct cfdata *cf;
+       struct cfdata *match;
        void *aux;
 {
-       if ((*cf->cf_attach->ca_match)(parent, cf, aux) > 0)
-         config_attach(parent, cf, aux, mapleprint);
+       struct maple_attach_args *ma = aux;
+
+       if (match->cf_loc[MAPLECF_PORT] != MAPLECF_PORT_DEFAULT &&
+           match->cf_loc[MAPLECF_PORT] != ma->ma_port)
+               return (0);
 
-       return (0);
+       if (match->cf_loc[MAPLECF_SUBUNIT] != MAPLECF_SUBUNIT_DEFAULT &&
+           match->cf_loc[MAPLECF_SUBUNIT] != ma->ma_subunit)
+               return (0);
+
+       return ((*match->cf_attach->ca_match)(parent, match, aux));
 }
 
 u_int32_t
@@ -493,4 +501,3 @@
                break;
        return (0);
 }
-



Home | Main Index | Thread Index | Old Index