Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp700 Redo the way devices are found.



details:   https://anonhg.NetBSD.org/src/rev/9e04e03db614
branches:  trunk
changeset: 760823:9e04e03db614
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Jan 13 21:15:13 2011 +0000

description:
Redo the way devices are found.

Probe "Snake" machines with PDC_MEMMAP and others with PDC_SYSTEM_MAP.

Some PDCs don't tell us about all devices and/or the whole device tree.
Walk each bus to find these unreported devices.

diffstat:

 sys/arch/hp700/dev/astro.c        |   16 +-
 sys/arch/hp700/dev/dino.c         |   11 +-
 sys/arch/hp700/dev/gecko.c        |    7 +-
 sys/arch/hp700/dev/lasi.c         |   13 +-
 sys/arch/hp700/dev/pdc.c          |   79 ++++++-
 sys/arch/hp700/dev/phantomas.c    |    8 +-
 sys/arch/hp700/dev/uturn.c        |   29 +--
 sys/arch/hp700/gsc/gscbus.c       |   10 +-
 sys/arch/hp700/hp700/autoconf.c   |  427 +++++++++++++++++++++++++++++++------
 sys/arch/hp700/hp700/machdep.c    |    5 +-
 sys/arch/hp700/hp700/mainbus.c    |   66 +----
 sys/arch/hp700/include/autoconf.h |   11 +-
 sys/arch/hp700/include/iomod.h    |    6 +-
 sys/arch/hp700/include/pdc.h      |   10 +-
 14 files changed, 501 insertions(+), 197 deletions(-)

diffs (truncated from 1139 to 300 lines):

diff -r 9a4daa7c5d13 -r 9e04e03db614 sys/arch/hp700/dev/astro.c
--- a/sys/arch/hp700/dev/astro.c        Thu Jan 13 21:12:49 2011 +0000
+++ b/sys/arch/hp700/dev/astro.c        Thu Jan 13 21:15:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: astro.c,v 1.12 2011/01/04 10:42:33 skrll Exp $ */
+/*     $NetBSD: astro.c,v 1.13 2011/01/13 21:15:13 skrll Exp $ */
 
 /*     $OpenBSD: astro.c,v 1.8 2007/10/06 23:50:54 krw Exp $   */
 
@@ -156,7 +156,7 @@
 
 int    astro_match(device_t, cfdata_t, void *);
 void   astro_attach(device_t, device_t, void *);
-static void astro_callback(device_t self, struct confargs *ca);
+static device_t astro_callback(device_t self, struct confargs *ca);
 
 CFATTACH_DECL_NEW(astro, sizeof(struct astro_softc),
     astro_match, astro_attach, NULL, NULL);
@@ -232,6 +232,7 @@
        psize_t size;
        vaddr_t va;
        paddr_t pa;
+       void *p;
        struct vm_page *m;
        struct pglist mlist;
        int iova_bits;
@@ -244,8 +245,8 @@
                aprint_error(": can't map IO space\n");
                return;
        }
-       sc->sc_regs = r = (struct astro_regs *)ca->ca_hpa;
-
+       p = bus_space_vaddr(ca->ca_iot, ioh);
+       sc->sc_regs = r = p;
        rid = le32toh(r->rid);
        aprint_normal(": Astro rev %d.%d\n", (rid & 7) + 1, (rid >> 3) & 3);
 
@@ -333,18 +334,17 @@
        sc->sc_dmatag._cookie = sc;
 
        nca = *ca;      /* clone from us */
-//     nca.ca_hpamask = HPPA_IOBEGIN;
        nca.ca_dmatag = &sc->sc_dmatag;
-       nca.ca_hpabase = 0; /* HPPA_UNDEF */
+       nca.ca_hpabase = IOMOD_IO_IO_LOW(p);
        nca.ca_nmodules = MAXMODBUS;
        pdc_scanbus(self, &nca, astro_callback);
 }
 
-static void
+static device_t
 astro_callback(device_t self, struct confargs *ca)
 {
 
-       config_found_sm_loc(self, "gedoens", NULL, ca, mbprint, mbsubmatch);
+       return config_found_sm_loc(self, "gedoens", NULL, ca, mbprint, mbsubmatch);
 }
 
 int
diff -r 9a4daa7c5d13 -r 9e04e03db614 sys/arch/hp700/dev/dino.c
--- a/sys/arch/hp700/dev/dino.c Thu Jan 13 21:12:49 2011 +0000
+++ b/sys/arch/hp700/dev/dino.c Thu Jan 13 21:15:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dino.c,v 1.27 2010/12/05 12:19:09 skrll Exp $ */
+/*     $NetBSD: dino.c,v 1.28 2011/01/13 21:15:13 skrll Exp $ */
 
 /*     $OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $ */
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.27 2010/12/05 12:19:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.28 2011/01/13 21:15:13 skrll Exp $");
 
 /* #include "cardbus.h" */
 
@@ -135,12 +135,11 @@
 
 int    dinomatch(device_t, struct cfdata *, void *);
 void   dinoattach(device_t, device_t, void *);
-static void    dino_callback(device_t, struct confargs *);
+static device_t        dino_callback(device_t, struct confargs *);
 
 CFATTACH_DECL_NEW(dino, sizeof(struct dino_softc), dinomatch, dinoattach, NULL,
     NULL);
 
-
 void dino_attach_hook(device_t, device_t,
     struct pcibus_attach_args *);
 void dino_enable_bus(struct dino_softc *, int);
@@ -1734,9 +1733,9 @@
        config_found_ia(self, "pcibus", &pba, pcibusprint);
 }
 
-static void
+static device_t
 dino_callback(device_t self, struct confargs *ca)
 {
 
-       config_found_sm_loc(self, "dino", NULL, ca, mbprint, mbsubmatch);
+       return config_found_sm_loc(self, "dino", NULL, ca, mbprint, mbsubmatch);
 }
diff -r 9a4daa7c5d13 -r 9e04e03db614 sys/arch/hp700/dev/gecko.c
--- a/sys/arch/hp700/dev/gecko.c        Thu Jan 13 21:12:49 2011 +0000
+++ b/sys/arch/hp700/dev/gecko.c        Thu Jan 13 21:15:13 2011 +0000
@@ -38,7 +38,7 @@
 
 int    gecko_match(device_t, cfdata_t, void *);
 void   gecko_attach(device_t, device_t, void *);
-static void gecko_callback(device_t, struct confargs *);
+static device_t gecko_callback(device_t, struct confargs *);
 
 CFATTACH_DECL_NEW(gecko, sizeof(struct gecko_softc), gecko_match,
     gecko_attach, NULL, NULL);
@@ -86,10 +86,11 @@
        pdc_scanbus(self, &nca, gecko_callback);
 }
 
-static void
+static device_t
 gecko_callback(device_t self, struct confargs *ca)
 {
 
-       config_found_sm_loc(self, "gedoens", NULL, ca, mbprint, mbsubmatch);
+       return config_found_sm_loc(self, "gedoens", NULL, ca, mbprint,
+           mbsubmatch);
 }
 
diff -r 9a4daa7c5d13 -r 9e04e03db614 sys/arch/hp700/dev/lasi.c
--- a/sys/arch/hp700/dev/lasi.c Thu Jan 13 21:12:49 2011 +0000
+++ b/sys/arch/hp700/dev/lasi.c Thu Jan 13 21:15:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lasi.c,v 1.18 2011/01/04 10:42:33 skrll Exp $  */
+/*     $NetBSD: lasi.c,v 1.19 2011/01/13 21:15:13 skrll Exp $  */
 
 /*     $OpenBSD: lasi.c,v 1.4 2001/06/09 03:57:19 mickey Exp $ */
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.18 2011/01/04 10:42:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.19 2011/01/13 21:15:13 skrll Exp $");
 
 #undef LASIDEBUG
 
@@ -197,15 +197,6 @@
 
        /* Attach the GSC bus. */
        ga.ga_ca = *ca; /* clone from us */
-       if (strcmp(parent->dv_xname, "mainbus0") == 0) {
-               ga.ga_dp.dp_bc[0] = ga.ga_dp.dp_bc[1];
-               ga.ga_dp.dp_bc[1] = ga.ga_dp.dp_bc[2];
-               ga.ga_dp.dp_bc[2] = ga.ga_dp.dp_bc[3];
-               ga.ga_dp.dp_bc[3] = ga.ga_dp.dp_bc[4];
-               ga.ga_dp.dp_bc[4] = ga.ga_dp.dp_bc[5];
-               ga.ga_dp.dp_bc[5] = ga.ga_dp.dp_mod;
-               ga.ga_dp.dp_mod = 0;
-       }
 
        ga.ga_name = "gsc";
        ga.ga_int_reg = &sc->sc_int_reg;
diff -r 9a4daa7c5d13 -r 9e04e03db614 sys/arch/hp700/dev/pdc.c
--- a/sys/arch/hp700/dev/pdc.c  Thu Jan 13 21:12:49 2011 +0000
+++ b/sys/arch/hp700/dev/pdc.c  Thu Jan 13 21:15:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pdc.c,v 1.37 2011/01/04 10:42:33 skrll Exp $   */
+/*     $NetBSD: pdc.c,v 1.38 2011/01/13 21:15:14 skrll Exp $   */
 
 /*     $OpenBSD: pdc.c,v 1.14 2001/04/29 21:05:43 mickey Exp $ */
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pdc.c,v 1.37 2011/01/04 10:42:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pdc.c,v 1.38 2011/01/13 21:15:14 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -48,6 +48,7 @@
 #include <machine/autoconf.h>
 
 #include <hp700/hp700/machdep.h>
+#include <hp700/dev/cpudevs.h>
 
 typedef
 struct pdc_softc {
@@ -58,6 +59,8 @@
 
 pdcio_t pdc;
 
+enum pdc_type pdc_type;
+
 static struct pdc_result pdcret1 PDC_ALIGNMENT;
 static struct pdc_result pdcret2 PDC_ALIGNMENT;
 
@@ -145,6 +148,78 @@
        todr_attach(&todr);
 }
 
+void
+pdc_settype(int modelno)
+{
+       switch (modelno) {
+               /* 720, 750, 730, 735, 755 */
+       case HPPA_BOARD_HP720:
+       case HPPA_BOARD_HP750_66:
+       case HPPA_BOARD_HP730_66:
+       case HPPA_BOARD_HP735_99:
+       case HPPA_BOARD_HP755_99:
+       case HPPA_BOARD_HP755_125:
+       case HPPA_BOARD_HP735_130:
+
+               /* 710, 705, 7[12]5 */
+       case HPPA_BOARD_HP710:
+       case HPPA_BOARD_HP705:
+       case HPPA_BOARD_HP715_50:
+       case HPPA_BOARD_HP715_33:
+       case HPPA_BOARD_HP715S_50:
+       case HPPA_BOARD_HP715S_33:
+       case HPPA_BOARD_HP715T_50:
+       case HPPA_BOARD_HP715T_33:
+       case HPPA_BOARD_HP715_75:
+       case HPPA_BOARD_HP715_99:
+       case HPPA_BOARD_HP725_50:
+       case HPPA_BOARD_HP725_75:
+       case HPPA_BOARD_HP725_99:
+
+               /* 745, 742, 747 */
+       case HPPA_BOARD_HP745I_50:
+       case HPPA_BOARD_HP742I_50:
+       case HPPA_BOARD_HP747I_100:
+
+               /* 712/{60,80,100,120}, 715/{64,80,100,...}, etc */
+       case HPPA_BOARD_HP712_60:
+       case HPPA_BOARD_HP712_80:
+       case HPPA_BOARD_HP712_100:
+       case HPPA_BOARD_HP743I_64:
+       case HPPA_BOARD_HP743I_100:
+       case HPPA_BOARD_HP712_120:
+       case HPPA_BOARD_HP715_80:
+       case HPPA_BOARD_HP715_64:
+       case HPPA_BOARD_HP715_100:
+       case HPPA_BOARD_HP715_100XC:
+       case HPPA_BOARD_HP725_100:
+       case HPPA_BOARD_HP725_120:
+       case HPPA_BOARD_HP715_100L:
+       case HPPA_BOARD_HP715_120L:
+       case HPPA_BOARD_HP725_80L:
+       case HPPA_BOARD_HP725_100L:
+       case HPPA_BOARD_HP725_120L:
+       case HPPA_BOARD_HP743_50:
+       case HPPA_BOARD_HP743_100:
+       case HPPA_BOARD_HP715_80M:
+       case HPPA_BOARD_HP811:
+       case HPPA_BOARD_HP801:
+       case HPPA_BOARD_HP743T:
+               pdc_type = PDC_TYPE_SNAKE;
+               break;
+
+       default:
+               pdc_type = PDC_TYPE_UNKNOWN;
+       }
+}
+
+enum pdc_type
+pdc_gettype(void)
+{
+
+       return pdc_type;
+}
+
 int
 pdcmatch(device_t parent, cfdata_t cf, void *aux)
 {
diff -r 9a4daa7c5d13 -r 9e04e03db614 sys/arch/hp700/dev/phantomas.c
--- a/sys/arch/hp700/dev/phantomas.c    Thu Jan 13 21:12:49 2011 +0000
+++ b/sys/arch/hp700/dev/phantomas.c    Thu Jan 13 21:15:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: phantomas.c,v 1.7 2009/11/03 05:07:25 snj Exp $        */
+/*     $NetBSD: phantomas.c,v 1.8 2011/01/13 21:15:14 skrll Exp $      */
 /*     $OpenBSD: phantomas.c,v 1.1 2002/12/18 23:52:45 mickey Exp $    */
 
 /*
@@ -42,7 +42,7 @@
 
 int    phantomasmatch(device_t, cfdata_t, void *);
 void   phantomasattach(device_t, device_t, void *);
-static void phantomas_callback(device_t self, struct confargs *ca);
+static device_t phantomas_callback(device_t self, struct confargs *ca);
 
 CFATTACH_DECL_NEW(phantomas, sizeof(struct phantomas_softc),
     phantomasmatch, phantomasattach, NULL, NULL);
@@ -74,9 +74,9 @@
        pdc_scanbus(self, &nca, phantomas_callback);
 }
 
-static void



Home | Main Index | Thread Index | Old Index