summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k/dev/obio.c
diff options
context:
space:
mode:
authorbriggs <briggs@cvs.openbsd.org>1997-01-24 01:35:55 +0000
committerbriggs <briggs@cvs.openbsd.org>1997-01-24 01:35:55 +0000
commit2cf4fbaafa89ff9455907432816daebe394b533b (patch)
tree14fe32451db6302b379b04d7ca3df0c07d26dce7 /sys/arch/mac68k/dev/obio.c
parent2ebc04f559b55bc6705d62e51a00406bee8ef115 (diff)
Sync w/ NETBSD_CURRENT_971122.
Diffstat (limited to 'sys/arch/mac68k/dev/obio.c')
-rw-r--r--sys/arch/mac68k/dev/obio.c92
1 files changed, 65 insertions, 27 deletions
diff --git a/sys/arch/mac68k/dev/obio.c b/sys/arch/mac68k/dev/obio.c
index 5603bae9537..e4def800b1c 100644
--- a/sys/arch/mac68k/dev/obio.c
+++ b/sys/arch/mac68k/dev/obio.c
@@ -1,11 +1,13 @@
-/* $OpenBSD: obio.c,v 1.1 1996/05/26 19:02:08 briggs Exp $ */
-/* $NetBSD: obio.c,v 1.1 1996/05/05 06:17:07 briggs Exp $ */
+/* $OpenBSD: obio.c,v 1.2 1997/01/24 01:35:36 briggs Exp $ */
+/* $NetBSD: obio.c,v 1.5 1996/12/17 06:47:37 scottr Exp $ */
/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to the NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -16,31 +18,35 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Adam Glass and Gordon Ross.
- * 4. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <machine/autoconf.h>
-#include <machine/pte.h>
+#include <mac68k/dev/obiovar.h>
-static int obio_match __P((struct device *, void *, void *));
-static void obio_attach __P((struct device *, struct device *, void *));
+static int obio_match __P((struct device *, struct cfdata *, void *));
+static void obio_attach __P((struct device *, struct device *, void *));
+static int obio_print __P((void *, const char *));
+static int obio_search __P((struct device *, struct cfdata *, void *));
struct cfattach obio_ca = {
sizeof(struct device), obio_match, obio_attach
@@ -51,15 +57,19 @@ struct cfdriver obio_cd = {
};
static int
-obio_match(parent, vcf, aux)
+obio_match(parent, cf, aux)
struct device *parent;
- void *vcf, *aux;
+ struct cfdata *cf;
+ void *aux;
{
- struct confargs *ca = aux;
+ static int obio_matched = 0;
- if (ca->ca_bustype != BUS_OBIO)
+ /* Allow only one instance. */
+ if (obio_matched)
return (0);
- return(1);
+
+ obio_matched = 1;
+ return (1);
}
static void
@@ -70,5 +80,33 @@ obio_attach(parent, self, aux)
{
printf("\n");
- (void) config_search(bus_scan, self, aux);
+ /* Search for and attach children. */
+ (void) config_search(obio_search, self, aux);
+}
+
+int
+obio_print(args, name)
+ void *args;
+ const char *name;
+{
+ struct obio_attach_args *oa = (struct obio_attach_args *) args;
+
+ if (oa->oa_addr)
+ printf(" addr %p", oa->oa_addr);
+
+ return (UNCONF);
+}
+
+int
+obio_search(parent, cf, aux)
+ struct device *parent;
+ struct cfdata *cf;
+ void *aux;
+{
+ struct obio_attach_args oa;
+
+ bzero(&oa, sizeof(oa));
+ if ((*cf->cf_attach->ca_match)(parent, cf, &oa) > 0)
+ config_attach(parent, cf, &oa, obio_print);
+ return (0);
}