Module Name:    src
Committed By:   kiyohara
Date:           Tue Jun 25 13:56:59 UTC 2013

Modified Files:
        src/sys/arch/epoc32/conf: GENERIC files.epoc32
        src/sys/arch/epoc32/epoc32: external.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/epoc32/conf/GENERIC \
    src/sys/arch/epoc32/conf/files.epoc32
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/epoc32/epoc32/external.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/epoc32/conf/GENERIC
diff -u src/sys/arch/epoc32/conf/GENERIC:1.1 src/sys/arch/epoc32/conf/GENERIC:1.2
--- src/sys/arch/epoc32/conf/GENERIC:1.1	Sun Apr 28 12:11:25 2013
+++ src/sys/arch/epoc32/conf/GENERIC	Tue Jun 25 13:56:59 2013
@@ -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 @@ include		"arch/epoc32/conf/std.epoc32"
 
 #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 @@ wsdisplay* at wmlcd? console ?
 
 epockbd* at clpssoc?
 epockbd* at windermere?
-#epockbd* at external? addr 0x10000030, 0x10000004
 wskbd*	at epockbd?
 
 #spi*	at clpsssi*
@@ -167,7 +166,12 @@ wskbd*	at epockbd?
 #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
Index: src/sys/arch/epoc32/conf/files.epoc32
diff -u src/sys/arch/epoc32/conf/files.epoc32:1.1 src/sys/arch/epoc32/conf/files.epoc32:1.2
--- src/sys/arch/epoc32/conf/files.epoc32:1.1	Sun Apr 28 12:11:25 2013
+++ src/sys/arch/epoc32/conf/files.epoc32	Tue Jun 25 13:56:59 2013
@@ -21,7 +21,7 @@ device	internal { }: pic, pic_splfuncs
 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

Index: src/sys/arch/epoc32/epoc32/external.c
diff -u src/sys/arch/epoc32/epoc32/external.c:1.1 src/sys/arch/epoc32/epoc32/external.c:1.2
--- src/sys/arch/epoc32/epoc32/external.c:1.1	Sun Apr 28 12:11:26 2013
+++ src/sys/arch/epoc32/epoc32/external.c	Tue Jun 25 13:56:59 2013
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: external.c,v
 
 #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 @@ external_match(device_t parent, cfdata_t
 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

Reply via email to