Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm Use indirect configuration for on-board devi...



details:   https://anonhg.NetBSD.org/src/rev/76f11cb97de6
branches:  trunk
changeset: 537628:76f11cb97de6
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Oct 03 20:14:58 2002 +0000

description:
Use indirect configuration for on-board devices (i.e. those things
attached to "obio") on the IQ80310 and IQ80321.  It makes more sense
to do it this way for this type of system (the goal being to encapsulate
as much information about the board as possible into one file).

diffstat:

 sys/arch/evbarm/conf/IQ80310       |   9 +++-
 sys/arch/evbarm/conf/IQ80321       |   4 +-
 sys/arch/evbarm/conf/TEAMASA_NPWR  |   6 ++-
 sys/arch/evbarm/conf/files.iq80310 |   4 +-
 sys/arch/evbarm/conf/files.iq80321 |   4 +-
 sys/arch/evbarm/iq80310/com_obio.c |   9 +---
 sys/arch/evbarm/iq80310/obio.c     |  70 +++++++++++--------------------------
 sys/arch/evbarm/iq80310/obiovar.h  |   3 +-
 sys/arch/evbarm/iq80321/com_obio.c |   9 +---
 sys/arch/evbarm/iq80321/obio.c     |  54 ++++++++++++----------------
 sys/arch/evbarm/iq80321/obiovar.h  |   3 +-
 11 files changed, 70 insertions(+), 105 deletions(-)

diffs (truncated from 393 to 300 lines):

diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/conf/IQ80310
--- a/sys/arch/evbarm/conf/IQ80310      Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/conf/IQ80310      Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: IQ80310,v 1.19 2002/09/18 02:43:57 lukem Exp $
+#      $NetBSD: IQ80310,v 1.20 2002/10/03 20:14:58 thorpej Exp $
 #
 #      IQ80310 -- Intel IQ80310 Evaluation Board Kernel
 #
@@ -145,7 +145,12 @@
 
 # On-board device support
 obio*          at mainbus?
-com*           at obio? addr ?         # on-board XR 16550 UARTs
+
+# On-board XR 16550 UARTs.
+# Order these so the first UART matches is the one at J9
+# and the second one is the one at J10.
+com0           at obio? addr 0xfe810000 xint3 3
+com1           at obio? addr 0xfe800000 xint3 2
 
 # i80312 Companion I/O support
 iopxs*         at mainbus?
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/conf/IQ80321
--- a/sys/arch/evbarm/conf/IQ80321      Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/conf/IQ80321      Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: IQ80321,v 1.13 2002/09/18 02:43:57 lukem Exp $
+#      $NetBSD: IQ80321,v 1.14 2002/10/03 20:14:58 thorpej Exp $
 #
 #      IQ80321 -- Intel IQ80321 Evaluation Board Kernel
 #
@@ -144,7 +144,7 @@
 
 # On-board device support
 obio*          at mainbus?
-com*           at obio? addr ?         # on-board TI 165C50 UART
+com0           at obio? addr 0xfe800000 xint 1 # on-board TI 165C50 UART
 
 # i80321 I/O Processor peripheral support
 iopxs*         at mainbus?
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/conf/TEAMASA_NPWR
--- a/sys/arch/evbarm/conf/TEAMASA_NPWR Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/conf/TEAMASA_NPWR Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: TEAMASA_NPWR,v 1.22 2002/09/18 02:43:57 lukem Exp $
+#      $NetBSD: TEAMASA_NPWR,v 1.23 2002/10/03 20:14:58 thorpej Exp $
 #
 #      TEAMASA_NPWR -- Team ASA, Inc. Npwr -- XScale/IOP310-based
 #      server appliance.
@@ -152,7 +152,9 @@
 
 # On-board device support
 obio*          at mainbus?
-com*           at obio? addr ?         # on-board XR 16550 UARTs
+
+# On-board 16550 UART
+com0           at obio? addr 0xfe810000 xint3 3   
 
 # i80312 Companion I/O support
 iopxs*         at mainbus?
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/conf/files.iq80310
--- a/sys/arch/evbarm/conf/files.iq80310        Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/conf/files.iq80310        Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.iq80310,v 1.8 2002/04/12 19:02:31 thorpej Exp $
+#      $NetBSD: files.iq80310,v 1.9 2002/10/03 20:14:58 thorpej Exp $
 #
 # Intel IQ80310 evaluation board configuration info
 #
@@ -23,7 +23,7 @@
 file   arch/evbarm/iq80310/iq80310_pci.c
 
 # IQ80310 on-board devices (including CPLD)
-device obio {[addr = -1]}: bus_space_generic
+device obio {addr, [xint3 = -1]}: bus_space_generic
 attach obio at mainbus
 file   arch/evbarm/iq80310/obio.c                      obio
 file   arch/evbarm/iq80310/obio_space.c                obio
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/conf/files.iq80321
--- a/sys/arch/evbarm/conf/files.iq80321        Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/conf/files.iq80321        Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.iq80321,v 1.2 2002/04/12 19:02:31 thorpej Exp $
+#      $NetBSD: files.iq80321,v 1.3 2002/10/03 20:14:58 thorpej Exp $
 #
 # Intel IQ80321 evaluation board configuration info
 #
@@ -11,7 +11,7 @@
 file   arch/evbarm/iq80321/iq80321_pci.c
 
 # IQ80321 on-board devices
-device obio {[addr = -1]}: bus_space_generic
+device obio {addr, [xint = -1]}: bus_space_generic
 attach obio at mainbus
 file   arch/evbarm/iq80321/obio.c                      obio
 file   arch/evbarm/iq80321/obio_space.c                obio
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/iq80310/com_obio.c
--- a/sys/arch/evbarm/iq80310/com_obio.c        Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/iq80310/com_obio.c        Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com_obio.c,v 1.7 2002/10/02 05:10:34 thorpej Exp $     */
+/*     $NetBSD: com_obio.c,v 1.8 2002/10/03 20:14:58 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -64,12 +64,9 @@
 int
 com_obio_match(struct device *parent, struct cfdata *cf, void *aux)
 {
-       struct obio_attach_args *oba = aux;
 
-       if (strcmp(cf->cf_name, oba->oba_name) == 0)
-               return (1);
-
-       return (0);
+       /* We take it on faith that the device is there. */
+       return (1);
 }
 
 void
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/iq80310/obio.c
--- a/sys/arch/evbarm/iq80310/obio.c    Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/iq80310/obio.c    Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obio.c,v 1.10 2002/10/02 05:10:35 thorpej Exp $        */
+/*     $NetBSD: obio.c,v 1.11 2002/10/03 20:14:58 thorpej Exp $        */
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -63,39 +63,11 @@
     obio_match, obio_attach, NULL, NULL);
 
 int    obio_print(void *, const char *);
-int    obio_submatch(struct device *, struct cfdata *, void *);
+int    obio_search(struct device *, struct cfdata *, void *);
 
 /* there can be only one */
 int    obio_found;
 
-struct {
-       const char *od_name;
-       bus_addr_t od_addr;
-       int od_irq;
-} obio_devices[] =
-#if defined(IOP310_TEAMASA_NPWR)
-{
-       /*
-        * There is only one UART on the Npwr.
-        */
-       { "com",        IQ80310_UART2,          XINT3_IRQ(XINT3_UART2) },
-
-       { NULL,         0,                      0 },
-};
-#else /* Default to stock IQ80310 */
-{
-       /*
-        * Order these so the first UART matched is the one at J9
-        * and the second is the one at J10.  (This is the same
-        * ordering RedBoot uses.)
-        */
-       { "com",        IQ80310_UART2,          XINT3_IRQ(XINT3_UART2) },
-       { "com",        IQ80310_UART1,          XINT3_IRQ(XINT3_UART1) },
-
-       { NULL,         0,                      0 },
-};
-#endif /* list of IQ80310-based designs */
-
 int
 obio_match(struct device *parent, struct cfdata *cf, void *aux)
 {
@@ -120,8 +92,6 @@
 void
 obio_attach(struct device *parent, struct device *self, void *aux)
 {
-       struct obio_attach_args oba;
-       int i;
 
        obio_found = 1;
 
@@ -147,13 +117,11 @@
     }
 #endif /* list of IQ80310-based designs */
 
-       for (i = 0; obio_devices[i].od_name != NULL; i++) {
-               oba.oba_name = obio_devices[i].od_name;
-               oba.oba_st = &obio_bs_tag;
-               oba.oba_addr = obio_devices[i].od_addr;
-               oba.oba_irq = obio_devices[i].od_irq;
-               (void) config_found_sm(self, &oba, obio_print, obio_submatch);
-       }
+       /*
+        * Attach all the on-board devices as described in the kernel
+        * configuration file.
+        */
+       config_search(obio_search, self, NULL);
 }
 
 int
@@ -161,22 +129,28 @@
 {
        struct obio_attach_args *oba = aux;
 
-       if (pnp)
-               printf("%s at %s", oba->oba_name, pnp);
-
        printf(" addr 0x%08lx", oba->oba_addr);
+       if (oba->oba_irq != -1)
+               printf(" xint3 %d", IRQ_XINT3(oba->oba_irq));
 
        return (UNCONF);
 }
 
 int
-obio_submatch(struct device *parent, struct cfdata *cf, void *aux)
+obio_search(struct device *parent, struct cfdata *cf, void *aux)
 {
-       struct obio_attach_args *oba = aux;
+       struct obio_attach_args oba;
+
+       oba.oba_st = &obio_bs_tag;
+       oba.oba_addr = cf->cf_loc[OBIOCF_ADDR];
 
-       if (cf->cf_loc[OBIOCF_ADDR] != OBIOCF_ADDR_DEFAULT &&
-           cf->cf_loc[OBIOCF_ADDR] != oba->oba_addr)
-               return (0);
+       if (cf->cf_loc[OBIOCF_XINT3] != OBIOCF_XINT3_DEFAULT)
+               oba.oba_irq = XINT3_IRQ(cf->cf_loc[OBIOCF_XINT3]);
+       else
+               oba.oba_irq = -1;
 
-       return (config_match(parent, cf, aux));
+       if (config_match(parent, cf, &oba) > 0)
+               config_attach(parent, cf, &oba, obio_print);
+
+       return (0);
 }
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/iq80310/obiovar.h
--- a/sys/arch/evbarm/iq80310/obiovar.h Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/iq80310/obiovar.h Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obiovar.h,v 1.1 2001/11/07 00:33:26 thorpej Exp $      */
+/*     $NetBSD: obiovar.h,v 1.2 2002/10/03 20:14:58 thorpej Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -39,7 +39,6 @@
 #define        _IQ80310_OBIOVAR_H_
 
 struct obio_attach_args {
-       const char *oba_name;           /* name of device */
        bus_space_tag_t oba_st;         /* bus space tag */
        bus_addr_t oba_addr;            /* address of device */
        int oba_irq;                    /* CPLD interrupt bit # */
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/iq80321/com_obio.c
--- a/sys/arch/evbarm/iq80321/com_obio.c        Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/iq80321/com_obio.c        Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com_obio.c,v 1.5 2002/10/02 05:10:35 thorpej Exp $     */
+/*     $NetBSD: com_obio.c,v 1.6 2002/10/03 20:14:58 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -65,12 +65,9 @@
 int
 com_obio_match(struct device *parent, struct cfdata *cf, void *aux)
 {
-       struct obio_attach_args *oba = aux;
 
-       if (strcmp(cf->cf_name, oba->oba_name) == 0)
-               return (1);
-
-       return (0);
+       /* We take it on faith that the device is there. */
+       return (1);
 }
 
 void
diff -r 479bd682aa9a -r 76f11cb97de6 sys/arch/evbarm/iq80321/obio.c
--- a/sys/arch/evbarm/iq80321/obio.c    Thu Oct 03 20:11:42 2002 +0000
+++ b/sys/arch/evbarm/iq80321/obio.c    Thu Oct 03 20:14:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obio.c,v 1.5 2002/10/02 05:10:35 thorpej Exp $ */
+/*     $NetBSD: obio.c,v 1.6 2002/10/03 20:14:59 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -61,22 +61,11 @@
     obio_match, obio_attach, NULL, NULL);
 
 int    obio_print(void *, const char *);
-int    obio_submatch(struct device *, struct cfdata *, void *);
+int    obio_search(struct device *, struct cfdata *, void *);
 
 /* there can be only one */
 int    obio_found;
 
-struct {
-       const char *od_name;
-       bus_addr_t od_addr;



Home | Main Index | Thread Index | Old Index