Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/epoc32 Configuration of external devices move to GE...



details:   https://anonhg.NetBSD.org/src/rev/3be22da2d661
branches:  trunk
changeset: 787591:3be22da2d661
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Tue Jun 25 13:56:59 2013 +0000

description:
Configuration of external devices move to GENERIC.  External bus does't know
attaching devices.

diffstat:

 sys/arch/epoc32/conf/GENERIC      |  12 ++++++---
 sys/arch/epoc32/conf/files.epoc32 |   2 +-
 sys/arch/epoc32/epoc32/external.c |  47 +++++++++++++++++++-------------------
 3 files changed, 33 insertions(+), 28 deletions(-)

diffs (141 lines):

diff -r 168d1985bd79 -r 3be22da2d661 sys/arch/epoc32/conf/GENERIC
--- a/sys/arch/epoc32/conf/GENERIC      Tue Jun 25 13:02:53 2013 +0000
+++ b/sys/arch/epoc32/conf/GENERIC      Tue Jun 25 13:56:59 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERIC,v 1.1 2013/04/28 12:11:25 kiyohara Exp $
+#      $NetBSD: GENERIC,v 1.2 2013/06/25 13:56:59 kiyohara Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 #options       INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.1 $"
+#ident                 "GENERIC-$Revision: 1.2 $"
 
 maxusers       32                      # estimated number of users
 
@@ -157,7 +157,6 @@
 
 epockbd* at clpssoc?
 epockbd* at windermere?
-#epockbd* at external? addr 0x10000030, 0x10000004
 wskbd* at epockbd?
 
 #spi*  at clpsssi*
@@ -167,7 +166,12 @@
 #audio* at audio?
 
 # External devices
-etna* at external?                             # ETNA Controller
+
+#epockbd* at external? addr 0x10000030 addr2 0x10000004                # Series 7
+
+# ETNA Controller
+etna* at external? addr 0x20000000 addr2 0x40000000 irq 5      # 5mx
+etna* at external? addr 0x50000000 addr2 0x30000000 irq 5      # 5mx Pro
 pcmcia* at etna?
 
 wdc* at pcmcia?                                        # CF
diff -r 168d1985bd79 -r 3be22da2d661 sys/arch/epoc32/conf/files.epoc32
--- a/sys/arch/epoc32/conf/files.epoc32 Tue Jun 25 13:02:53 2013 +0000
+++ b/sys/arch/epoc32/conf/files.epoc32 Tue Jun 25 13:56:59 2013 +0000
@@ -21,7 +21,7 @@
 attach internal at mainbus
 file   arch/epoc32/epoc32/internal.c           internal
 
-device external { }
+device external {[addr = -1], [addr2 = -1], [irq = -1]}
 attach external at mainbus
 file   arch/epoc32/epoc32/external.c           external
 file   arch/epoc32/epoc32/external_io.c        external
diff -r 168d1985bd79 -r 3be22da2d661 sys/arch/epoc32/epoc32/external.c
--- a/sys/arch/epoc32/epoc32/external.c Tue Jun 25 13:02:53 2013 +0000
+++ b/sys/arch/epoc32/epoc32/external.c Tue Jun 25 13:56:59 2013 +0000
@@ -1,6 +1,6 @@
-/*     $NetBSD: external.c,v 1.1 2013/04/28 12:11:26 kiyohara Exp $    */
+/*     $NetBSD: external.c,v 1.2 2013/06/25 13:56:59 kiyohara Exp $    */
 /*
- * Copyright (c) 2012 KIYOHARA Takashi
+ * Copyright (c) 2012, 2013 KIYOHARA Takashi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: external.c,v 1.1 2013/04/28 12:11:26 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: external.c,v 1.2 2013/06/25 13:56:59 kiyohara Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -35,24 +35,18 @@
 
 #include <machine/epoc32.h>
 
+#include "locators.h"
+
 extern struct bus_space external_bs_tag;
 
 static int external_match(device_t, cfdata_t, void *);
 static void external_attach(device_t parent, device_t self, void *aux);
 
+static int external_search(device_t, cfdata_t, const int *, void *);
 static int external_print(void *, const char *);
 
 CFATTACH_DECL_NEW(external, 0, external_match, external_attach, NULL, NULL);
 
-static const struct {
-       const char *name;
-       bus_addr_t addr;
-       bus_addr_t addr2;
-       int irq;
-} knowndevs[] = {
-       { "etna",       0x20000000, 0x40000000, 5 },    /* 5mx */
-       { "etna",       0x50000000, 0x30000000, 5 },    /* 5mx pro */
-};
 
 /* ARGSUSED */
 static int
@@ -66,21 +60,28 @@
 static void
 external_attach(device_t parent, device_t self, void *aux)
 {
-       struct external_attach_args aa;
-       int i;
 
        aprint_naive("\n");
        aprint_normal("\n");
 
-       for (i = 0; i < __arraycount(knowndevs); i++) {
-               aa.name = knowndevs[i].name;
-               aa.iot = &external_bs_tag;
-               aa.addr = knowndevs[i].addr;
-               aa.addr2 = knowndevs[i].addr2;
-               aa.irq = knowndevs[i].irq;
-               config_found_sm_loc(self, "external", NULL, &aa,
-                   external_print, NULL);
-       }
+       config_search_ia(external_search, self, "external", NULL);
+}
+
+/* ARGSUSED */
+static int
+external_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
+{
+       struct external_attach_args aa;
+
+       aa.name = cf->cf_name;
+       aa.iot = &external_bs_tag;
+       aa.addr = cf->cf_loc[EXTERNALCF_ADDR];
+       aa.addr2 = cf->cf_loc[EXTERNALCF_ADDR2];
+       aa.irq = cf->cf_loc[EXTERNALCF_IRQ];
+       if (config_match(parent, cf, &aa))
+               config_attach(parent, cf, &aa, external_print);
+
+       return 0;
 }
 
 static int



Home | Main Index | Thread Index | Old Index