Module Name:    src
Committed By:   matt
Date:           Thu Jan 14 00:27:24 UTC 2010

Modified Files:
        src/sys/arch/evbmips/adm5120 [matt-nb5-mips64]: mainbus.c
        src/sys/arch/evbmips/alchemy [matt-nb5-mips64]: mainbus.c
        src/sys/arch/evbmips/atheros [matt-nb5-mips64]: mainbus.c
        src/sys/arch/hpcmips/hpcmips [matt-nb5-mips64]: mainbus.c
        src/sys/arch/mipsco/mipsco [matt-nb5-mips64]: mainbus.c
        src/sys/arch/pmax/pmax [matt-nb5-mips64]: mainbus.c
        src/sys/arch/sgimips/sgimips [matt-nb5-mips64]: mainbus.c

Log Message:
device_t, CFATTACH_DECL_NEW, ansify, ...


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.62.1 src/sys/arch/evbmips/adm5120/mainbus.c
cvs rdiff -u -r1.8 -r1.8.96.1 src/sys/arch/evbmips/alchemy/mainbus.c
cvs rdiff -u -r1.4 -r1.4.86.1 src/sys/arch/evbmips/atheros/mainbus.c
cvs rdiff -u -r1.30 -r1.30.28.1 src/sys/arch/hpcmips/hpcmips/mainbus.c
cvs rdiff -u -r1.7 -r1.7.96.1 src/sys/arch/mipsco/mipsco/mainbus.c
cvs rdiff -u -r1.36 -r1.36.96.1 src/sys/arch/pmax/pmax/mainbus.c
cvs rdiff -u -r1.18 -r1.18.96.1 src/sys/arch/sgimips/sgimips/mainbus.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/evbmips/adm5120/mainbus.c
diff -u src/sys/arch/evbmips/adm5120/mainbus.c:1.1 src/sys/arch/evbmips/adm5120/mainbus.c:1.1.62.1
--- src/sys/arch/evbmips/adm5120/mainbus.c:1.1	Tue Mar 20 08:52:00 2007
+++ src/sys/arch/evbmips/adm5120/mainbus.c	Thu Jan 14 00:27:23 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.1 2007/03/20 08:52:00 dyoung Exp $ */
+/* $NetBSD: mainbus.c,v 1.1.62.1 2010/01/14 00:27:23 matt Exp $ */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1 2007/03/20 08:52:00 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1.62.1 2010/01/14 00:27:23 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -83,11 +83,11 @@
 
 #include "locators.h"
 
-static int	mainbus_match(struct device *, struct cfdata *, void *);
-static void	mainbus_attach(struct device *, struct device *, void *);
+static int	mainbus_match(device_t, cfdata_t, void *);
+static void	mainbus_attach(device_t, device_t, void *);
 static int	mainbus_print(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct mainbus_softc),
+CFATTACH_DECL_NEW(mainbus, sizeof(struct mainbus_softc),
     mainbus_match, mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
@@ -97,7 +97,7 @@
 	const char *md_name;
 };
 
-struct mainbusdev mainbusdevs[] = {
+const struct mainbusdev mainbusdevs[] = {
 	{"cpu"		},
 	{"obio"		},
 	{"extio"	},
@@ -110,11 +110,11 @@
 {
 	if (bus_space_map(sc->sc_obiot, ADM5120_BASE_SWITCH, 512, 0,
 	                  &sc->sc_gpioh) != 0){
-		printf("%s: unable to map switch\n", device_xname(&sc->sc_dev));
+		aprint_error_dev(sc->sc_dev, "unable to map switch\n");
 		return;
 	}
 #if 0
-	printf("%s: memcont 0x%08" PRIx32 "\n", device_xname(&sc->sc_dev),
+	aprint_normal_dev(sc->sc_dev, "memcont 0x%08" PRIx32 "\n",
 	    bus_space_read_4(sc->sc_obiot, sc->sc_gpioh, 0x1c));
 #endif
 	sc->sc_gpio = admgpio_attach(sc);
@@ -122,22 +122,23 @@
 
 
 static int
-mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
 	return !mainbus_found;
 }
 
 static void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mainbus_softc *sc = (struct mainbus_softc *)self;
+	struct mainbus_softc *sc = device_private(self);
 	struct mainbus_attach_args ma;
-	struct mainbusdev *md;
+	const struct mainbusdev *md;
 	struct adm5120_config *admc = &adm5120_configuration;
 
 	mainbus_found = 1;
-	printf("\n");
+	aprint_normal("\n");
 
+	sc->sc_dev = self;
 	sc->sc_obiot = &admc->obio_space;
 
 	mainbus_gpio_attach(sc);

Index: src/sys/arch/evbmips/alchemy/mainbus.c
diff -u src/sys/arch/evbmips/alchemy/mainbus.c:1.8 src/sys/arch/evbmips/alchemy/mainbus.c:1.8.96.1
--- src/sys/arch/evbmips/alchemy/mainbus.c:1.8	Sun Dec 11 12:17:11 2005
+++ src/sys/arch/evbmips/alchemy/mainbus.c	Thu Jan 14 00:27:23 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.8 2005/12/11 12:17:11 christos Exp $ */
+/* $NetBSD: mainbus.c,v 1.8.96.1 2010/01/14 00:27:23 matt Exp $ */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2005/12/11 12:17:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8.96.1 2010/01/14 00:27:23 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,11 +47,11 @@
 
 #include "locators.h"
 
-static int	mainbus_match(struct device *, struct cfdata *, void *);
-static void	mainbus_attach(struct device *, struct device *, void *);
+static int	mainbus_match(device_t, cfdata_t, void *);
+static void	mainbus_attach(device_t, device_t, void *);
 static int	mainbus_print(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
@@ -61,7 +61,7 @@
 	const char *md_name;
 };
 
-struct mainbusdev mainbusdevs[] = {
+const struct mainbusdev mainbusdevs[] = {
 	{ "cpu",	},
 	{ "aubus",	},
 	{ "obio",	},
@@ -69,10 +69,7 @@
 };
 
 static int
-mainbus_match(parent, match, aux)
-	struct device *parent;
-	struct cfdata *match;
-	void *aux;
+mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	if (mainbus_found)
@@ -82,12 +79,9 @@
 }
 
 static void
-mainbus_attach(parent, self, aux)
-	struct device *parent;
-	struct device *self;
-	void *aux;
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mainbusdev *md;
+	const struct mainbusdev *md;
 
 	mainbus_found = 1;
 	printf("\n");

Index: src/sys/arch/evbmips/atheros/mainbus.c
diff -u src/sys/arch/evbmips/atheros/mainbus.c:1.4 src/sys/arch/evbmips/atheros/mainbus.c:1.4.86.1
--- src/sys/arch/evbmips/atheros/mainbus.c:1.4	Thu Jun  8 22:47:26 2006
+++ src/sys/arch/evbmips/atheros/mainbus.c	Thu Jan 14 00:27:23 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.4 2006/06/08 22:47:26 gdamore Exp $ */
+/* $NetBSD: mainbus.c,v 1.4.86.1 2010/01/14 00:27:23 matt Exp $ */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2006/06/08 22:47:26 gdamore Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4.86.1 2010/01/14 00:27:23 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,11 +47,11 @@
 
 #include "locators.h"
 
-static int	mainbus_match(struct device *, struct cfdata *, void *);
-static void	mainbus_attach(struct device *, struct device *, void *);
+static int	mainbus_match(device_t, cfdata_t, void *);
+static void	mainbus_attach(device_t, device_t, void *);
 static int	mainbus_print(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
@@ -69,7 +69,7 @@
 };
 
 static int
-mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	if (mainbus_found)
@@ -79,15 +79,16 @@
 }
 
 static void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mainbusdev *md;
+	const struct mainbusdev *md;
 
 	mainbus_found = 1;
 	printf("\n");
 
 	for (md = mainbusdevs; md->md_name != NULL; md++) {
-		config_found_ia(self, "mainbus", md, mainbus_print);
+		struct mainbusdev ma = *md;
+		config_found_ia(self, "mainbus", &ma, mainbus_print);
 	}
 }
 

Index: src/sys/arch/hpcmips/hpcmips/mainbus.c
diff -u src/sys/arch/hpcmips/hpcmips/mainbus.c:1.30 src/sys/arch/hpcmips/hpcmips/mainbus.c:1.30.28.1
--- src/sys/arch/hpcmips/hpcmips/mainbus.c:1.30	Fri Jan  4 22:13:56 2008
+++ src/sys/arch/hpcmips/hpcmips/mainbus.c	Thu Jan 14 00:27:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.30 2008/01/04 22:13:56 ad Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.30.28.1 2010/01/14 00:27:23 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30 2008/01/04 22:13:56 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30.28.1 2010/01/14 00:27:23 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,28 +54,27 @@
 #define STATIC	static
 #endif
 
-STATIC int mainbus_match(struct device *, struct cfdata *, void *);
-STATIC void mainbus_attach(struct device *, struct device *, void *);
-STATIC int mainbus_search(struct device *, struct cfdata *,
-			  const int *, void *);
+STATIC int mainbus_match(device_t, cfdata_t, void *);
+STATIC void mainbus_attach(device_t, device_t, void *);
+STATIC int mainbus_search(device_t, cfdata_t, const int *, void *);
 STATIC int mainbus_print(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 STATIC int __mainbus_attached;
 
 int
-mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return (__mainbus_attached ? 0 : 1);	/* don't attach twice */
 }
 
 void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	static const char *devnames[] = {	/* ATTACH ORDER */
+	static const char * const devnames[] = {	/* ATTACH ORDER */
 		"cpu",				/* 1. CPU */
 		"vrip", "vr4102ip", "vr4122ip",
 		"vr4181ip",			/* 2. System BUS */
@@ -106,8 +105,7 @@
 }
 
 int
-mainbus_search(struct device *parent, struct cfdata *cf,
-	       const int *ldesc, void *aux)
+mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct mainbus_attach_args *ma = (void *)aux;
 	int locator = cf->cf_loc[MAINBUSCF_PLATFORM];

Index: src/sys/arch/mipsco/mipsco/mainbus.c
diff -u src/sys/arch/mipsco/mipsco/mainbus.c:1.7 src/sys/arch/mipsco/mipsco/mainbus.c:1.7.96.1
--- src/sys/arch/mipsco/mipsco/mainbus.c:1.7	Sun Dec 11 12:18:13 2005
+++ src/sys/arch/mipsco/mipsco/mainbus.c	Thu Jan 14 00:27:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.7 2005/12/11 12:18:13 christos Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.7.96.1 2010/01/14 00:27:24 matt Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7 2005/12/11 12:18:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7.96.1 2010/01/14 00:27:24 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -38,25 +38,18 @@
 
 #include <machine/autoconf.h>
 
-struct mainbus_softc {
-	struct device sc_dev;
-};
-
 /* Definition of the mainbus driver. */
-static int	mbmatch __P((struct device *, struct cfdata *, void *));
-static void	mbattach __P((struct device *, struct device *, void *));
-static int	mbprint __P((void *, const char *));
+static int	mbmatch(device_t, cfdata_t, void *);
+static void	mbattach(device_t, device_t, void *);
+static int	mbprint(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct mainbus_softc),
+CFATTACH_DECL_NEW(mainbus, 0,
     mbmatch, mbattach, NULL, NULL);
 
 static int mb_attached;
 
 static int
-mbmatch(parent, cfdata, aux)
-	struct device *parent;
-	struct cfdata *cfdata;
-	void *aux;
+mbmatch(device_t parent, cfdata_t cfdata, void *aux)
 {
 
 	if (mb_attached)
@@ -66,21 +59,17 @@
 }
 
 static void
-mbattach(parent, self, aux)
-	struct device *parent;
-	struct device *self;
-	void *aux;
+mbattach(device_t parent, device_t self, void *aux)
 {
-	register struct device *mb = self;
 	struct confargs nca;
 
 	mb_attached = 1;
 
-	printf("\n");
+	aprint_normal("\n");
 
 	nca.ca_name = "cpu";
 	nca.ca_addr = 0;
-	config_found(mb, &nca, mbprint);
+	config_found(self, &nca, mbprint);
 
 	nca.ca_name = "obio";
 	nca.ca_addr = 0;

Index: src/sys/arch/pmax/pmax/mainbus.c
diff -u src/sys/arch/pmax/pmax/mainbus.c:1.36 src/sys/arch/pmax/pmax/mainbus.c:1.36.96.1
--- src/sys/arch/pmax/pmax/mainbus.c:1.36	Sun Dec 11 12:18:39 2005
+++ src/sys/arch/pmax/pmax/mainbus.c	Thu Jan 14 00:27:24 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.36 2005/12/11 12:18:39 christos Exp $ */
+/* $NetBSD: mainbus.c,v 1.36.96.1 2010/01/14 00:27:24 matt Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.36 2005/12/11 12:18:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.36.96.1 2010/01/14 00:27:24 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,20 +39,17 @@
 #include <machine/autoconf.h>
 
 /* Definition of the mainbus driver. */
-static int	mbmatch __P((struct device *, struct cfdata *, void *));
-static void	mbattach __P((struct device *, struct device *, void *));
-static int	mbprint __P((void *, const char *));
+static int	mbmatch(device_t, cfdata_t, void *);
+static void	mbattach(device_t, device_t, void *);
+static int	mbprint(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mbmatch, mbattach, NULL, NULL);
 
 static int mainbus_found;
 
 static int
-mbmatch(parent, cf, aux)
-	struct device *parent;
-	struct cfdata *cf;
-	void *aux;
+mbmatch(device_t parent, cfdata_t cf, void *aux)
 {
 
 	if (mainbus_found)
@@ -64,10 +61,7 @@
 int ncpus = 0;	/* only support uniprocessors, for now */
 
 static void
-mbattach(parent, self, aux)
-	struct device *parent;
-	struct device *self;
-	void *aux;
+mbattach(device_t parent, device_t self, void *aux)
 {
 	struct mainbus_attach_args ma;
 
@@ -92,9 +86,7 @@
 }
 
 static int
-mbprint(aux, pnp)
-	void *aux;
-	const char *pnp;
+mbprint(void *aux, const char *pnp)
 {
 
 	if (pnp)

Index: src/sys/arch/sgimips/sgimips/mainbus.c
diff -u src/sys/arch/sgimips/sgimips/mainbus.c:1.18 src/sys/arch/sgimips/sgimips/mainbus.c:1.18.96.1
--- src/sys/arch/sgimips/sgimips/mainbus.c:1.18	Sun Dec 11 12:18:58 2005
+++ src/sys/arch/sgimips/sgimips/mainbus.c	Thu Jan 14 00:27:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.18 2005/12/11 12:18:58 christos Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.18.96.1 2010/01/14 00:27:24 matt Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.18 2005/12/11 12:18:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.18.96.1 2010/01/14 00:27:24 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,38 +49,35 @@
 
 #include "locators.h"
 
-static int	mainbus_match(struct device *, struct cfdata *, void *);
-static void	mainbus_attach(struct device *, struct device *, void *);
-static int	mainbus_search(struct device *, struct cfdata *,
-			       const int *, void *);
+static int	mainbus_match(device_t, cfdata_t, void *);
+static void	mainbus_attach(device_t, device_t, void *);
+static int	mainbus_search(device_t, cfdata_t, const int *, void *);
 int		mainbus_print(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 static int
-mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
 	return 1;
 }
 
 static void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct mainbus_attach_args ma;
 
-	printf(": %s [%s, %s], %d processor%s", arcbios_system_identifier,
+	aprint_normal(": %s [%s, %s], %d processor%s\n",
+	    arcbios_system_identifier,
 	    arcbios_sysid_vendor, arcbios_sysid_product,
 	    ncpus, ncpus == 1 ? "" : "s");
 
-	printf("\n");
-
 	config_search_ia(mainbus_search, self, "mainbus", &ma);
 }
 
 static int
-mainbus_search(struct device *parent, struct cfdata *cf,
-	       const int *ldesc, void *aux)
+mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 

Reply via email to