Module Name:    src
Committed By:   matt
Date:           Wed Jan 13 21:16:14 UTC 2010

Modified Files:
        src/sys/arch/algor/algor [matt-nb5-mips64]: cpu.c
        src/sys/arch/arc/arc [matt-nb5-mips64]: cpu.c
        src/sys/arch/cobalt/cobalt [matt-nb5-mips64]: cpu.c
        src/sys/arch/evbmips/rmixl [matt-nb5-mips64]: cpu.c
        src/sys/arch/ews4800mips/ews4800mips [matt-nb5-mips64]: cpu.c
        src/sys/arch/hpcmips/hpcmips [matt-nb5-mips64]: cpu.c
        src/sys/arch/mipsco/mipsco [matt-nb5-mips64]: cpu.c
        src/sys/arch/newsmips/newsmips [matt-nb5-mips64]: cpu.c
        src/sys/arch/pmax/pmax [matt-nb5-mips64]: cpu.c
        src/sys/arch/sbmips/sbmips [matt-nb5-mips64]: cpu.c
        src/sys/arch/sgimips/sgimips [matt-nb5-mips64]: cpu.c

Log Message:
Deal with new cpu_identity()


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.96.1 src/sys/arch/algor/algor/cpu.c
cvs rdiff -u -r1.16 -r1.16.14.1 src/sys/arch/arc/arc/cpu.c
cvs rdiff -u -r1.10 -r1.10.16.1 src/sys/arch/cobalt/cobalt/cpu.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/evbmips/rmixl/cpu.c
cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/arch/ews4800mips/ews4800mips/cpu.c
cvs rdiff -u -r1.15.28.1 -r1.15.28.2 src/sys/arch/hpcmips/hpcmips/cpu.c
cvs rdiff -u -r1.7 -r1.7.96.1 src/sys/arch/mipsco/mipsco/cpu.c
cvs rdiff -u -r1.11 -r1.11.96.1 src/sys/arch/newsmips/newsmips/cpu.c
cvs rdiff -u -r1.24 -r1.24.96.1 src/sys/arch/pmax/pmax/cpu.c
cvs rdiff -u -r1.18.16.2 -r1.18.16.3 src/sys/arch/sbmips/sbmips/cpu.c
cvs rdiff -u -r1.21 -r1.21.36.1 src/sys/arch/sgimips/sgimips/cpu.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/algor/algor/cpu.c
diff -u src/sys/arch/algor/algor/cpu.c:1.6 src/sys/arch/algor/algor/cpu.c:1.6.96.1
--- src/sys/arch/algor/algor/cpu.c:1.6	Sun Dec 11 12:16:08 2005
+++ src/sys/arch/algor/algor/cpu.c	Wed Jan 13 21:16:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.6 2005/12/11 12:16:08 christos Exp $	*/
+/*	$NetBSD: cpu.c,v 1.6.96.1 2010/01/13 21:16:12 matt Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,23 +28,24 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.6 2005/12/11 12:16:08 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.6.96.1 2010/01/13 21:16:12 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
+#include <sys/cpu.h>
 
 #include <machine/autoconf.h>
 
-int	cpu_match(struct device *, struct cfdata *, void *);
-void	cpu_attach(struct device *, struct device *, void *);
+static int	cpu_match(device_t, cfdata_t, void *);
+static void	cpu_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof(struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpu_match, cpu_attach, NULL, NULL);
 extern struct cfdriver cpu_cd;
 
 int
-cpu_match(struct device *parent, struct cfdata *cf, void *aux)
+cpu_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -55,9 +56,13 @@
 }
 
 void
-cpu_attach(struct device *parent, struct device *dev, void *aux)
+cpu_attach(device_t parent, device_t self, void *aux)
 {
+	struct cpu_info * const ci = curcpu();
 
-	printf(": ");
-	cpu_identify();
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
+	aprint_normal(": ");
+	cpu_identify(self);
 }

Index: src/sys/arch/arc/arc/cpu.c
diff -u src/sys/arch/arc/arc/cpu.c:1.16 src/sys/arch/arc/arc/cpu.c:1.16.14.1
--- src/sys/arch/arc/arc/cpu.c:1.16	Sat Jul  5 08:46:25 2008
+++ src/sys/arch/arc/arc/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.16 2008/07/05 08:46:25 tsutsui Exp $	*/
+/*	$NetBSD: cpu.c,v 1.16.14.1 2010/01/13 21:16:13 matt Exp $	*/
 /*	$OpenBSD: cpu.c,v 1.8 1997/04/19 17:19:41 pefo Exp $ */
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.16 2008/07/05 08:46:25 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.16.14.1 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,11 +72,12 @@
 cpuattach(device_t parent, device_t self, void *aux)
 {
 
+	struct cpu_info * const ci = curcpu();
+
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
 	aprint_normal(": ");
 
-#if 1
-	cpu_identify();
-#else /* XXX - before do this, fix pmax, newsmips */
-	cpu_identify(dev);
-#endif
+	cpu_identify(self);
 }

Index: src/sys/arch/cobalt/cobalt/cpu.c
diff -u src/sys/arch/cobalt/cobalt/cpu.c:1.10 src/sys/arch/cobalt/cobalt/cpu.c:1.10.16.1
--- src/sys/arch/cobalt/cobalt/cpu.c:1.10	Fri May  9 10:59:55 2008
+++ src/sys/arch/cobalt/cobalt/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.10 2008/05/09 10:59:55 tsutsui Exp $	*/
+/*	$NetBSD: cpu.c,v 1.10.16.1 2010/01/13 21:16:13 matt Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,18 +28,19 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10 2008/05/09 10:59:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10.16.1 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
+#include <sys/cpu.h>
 
 #include <machine/autoconf.h>
 
 #include "ioconf.h"
 
-int	cpu_match(device_t, cfdata_t, void *);
-void	cpu_attach(device_t, device_t, void *);
+static int	cpu_match(device_t, cfdata_t, void *);
+static void	cpu_attach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(cpu, 0,
     cpu_match, cpu_attach, NULL, NULL);
@@ -55,6 +56,11 @@
 cpu_attach(device_t parent, device_t self, void *aux)
 {
 
+	struct cpu_info * const ci = curcpu();
+
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
 	aprint_normal(": ");
-	cpu_identify();
+	cpu_identify(self);
 }

Index: src/sys/arch/evbmips/rmixl/cpu.c
diff -u src/sys/arch/evbmips/rmixl/cpu.c:1.1.2.2 src/sys/arch/evbmips/rmixl/cpu.c:1.1.2.3
--- src/sys/arch/evbmips/rmixl/cpu.c:1.1.2.2	Wed Jan 13 09:41:53 2010
+++ src/sys/arch/evbmips/rmixl/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.1.2.2 2010/01/13 09:41:53 cliff Exp $	*/
+/*	$NetBSD: cpu.c,v 1.1.2.3 2010/01/13 21:16:13 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1.2.2 2010/01/13 09:41:53 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1.2.3 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -46,32 +46,61 @@
 #include <sys/cpu.h>
 #include <evbmips/rmixl/cpucorevar.h>
 
-static int	cpu_match(struct device *, struct cfdata *, void *);
-static void	cpu_attach(struct device *, struct device *, void *);
+static int	cpu_match(device_t, cfdata_t, void *);
+static void	cpu_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof(struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpu_match, cpu_attach, NULL, NULL);
 
 static int
-cpu_match(struct device *parent, struct cfdata *cf, void *aux)
+cpu_match(device_t parent, cfdata_t cf, void *aux)
 {
-	struct cpucore_attach_args *aa = aux;
+	struct cpucore_attach_args *ca = aux;
 	int thread = cf->cf_loc[CPUCORECF_THREAD];
 
-	if (strncmp(aa->ca_name, cf->cf_name, strlen(cf->cf_name)) == 0) {
+	if (strncmp(ca->ca_name, cf->cf_name, strlen(cf->cf_name)) == 0
 #ifndef MULTIPROCESSOR
-	    if (aa->ca_thread == 0)
+	    && ca->ca_thread == 0
 #endif
-		if ((thread == CPUCORECF_THREAD_DEFAULT)
-		||  (thread == aa->ca_thread))
+	    && (thread == CPUCORECF_THREAD_DEFAULT || thread == ca->ca_thread))
 			return 1;
-	}
 
 	return 0;
 }
 
 static void
-cpu_attach(struct device *parent, struct device *self, void *aux)
+cpu_attach(device_t parent, device_t self, void *aux)
 {
-	printf("\n");
+	struct cpucore_attach_args *ca = aux;
+	if (ca->ca_thread == 0 && ca->ca_core == 0) {
+		struct cpu_info * const ci = curcpu();
+		ci->ci_dev = self;
+		self->dv_private = ci;
+#ifdef MULTIPROCESSOR
+	} else {
+		struct pglist pglist;
+
+		/*
+		 * Grab a page from the first 256MB to use to store
+		 * exception vectors and cpu_info for this cpu.
+		 */
+		error = uvm_pglistalloc(PAGE_SIZE,
+		    0, 0x10000000,
+		    PAGE_SIZE, PAGE_SIZE, &pglist, 1, false);
+		if (error) {
+			aprint_error(": failed to allocte exception vectors\n");
+			return;
+		}
+
+		const paddr_t pa = VM_PAGE_TO_PHYS(TAILQ_FIRST(&pglist));
+		const vaddr_t va = MIPS_PHYS_TO_KSEG0(pa);
+		struct cpu_info * const ci = (void *) (va + 0x400);
+		memset(va, 0, PAGE_SIZE);
+		ci->ci_ebase = va;
+		ci->ci_ebase_pa = pa;
+		ci->ci_dev = self;
+		self->dv_private = ci;
+#endif
+	}
+	aprint_normal("\n");
 }

Index: src/sys/arch/ews4800mips/ews4800mips/cpu.c
diff -u src/sys/arch/ews4800mips/ews4800mips/cpu.c:1.3 src/sys/arch/ews4800mips/ews4800mips/cpu.c:1.3.22.1
--- src/sys/arch/ews4800mips/ews4800mips/cpu.c:1.3	Fri Apr  4 16:33:05 2008
+++ src/sys/arch/ews4800mips/ews4800mips/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.3 2008/04/04 16:33:05 tsutsui Exp $	*/
+/*	$NetBSD: cpu.c,v 1.3.22.1 2010/01/13 21:16:13 matt Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang.  All rights reserved.
@@ -26,18 +26,19 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.3 2008/04/04 16:33:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.3.22.1 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
+#include <sys/cpu.h>
 
 #include <machine/autoconf.h>
 
 #include "ioconf.h"
 
-int cpumatch(device_t, cfdata_t, void *);
-void cpuattach(device_t, device_t, void *);
+static int cpumatch(device_t, cfdata_t, void *);
+static void cpuattach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(cpu, 0,
     cpumatch, cpuattach, NULL, NULL);
@@ -60,8 +61,13 @@
 cpuattach(device_t parent, device_t self, void *aux)
 {
 
+	struct cpu_info * const ci = curcpu();
+
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
 	aprint_normal(": ");
 	cpu_attached = 1;
 
-	cpu_identify();
+	cpu_identify(self);
 }

Index: src/sys/arch/hpcmips/hpcmips/cpu.c
diff -u src/sys/arch/hpcmips/hpcmips/cpu.c:1.15.28.1 src/sys/arch/hpcmips/hpcmips/cpu.c:1.15.28.2
--- src/sys/arch/hpcmips/hpcmips/cpu.c:1.15.28.1	Wed Aug 26 03:46:39 2009
+++ src/sys/arch/hpcmips/hpcmips/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.15.28.1 2009/08/26 03:46:39 matt Exp $	*/
+/*	$NetBSD: cpu.c,v 1.15.28.2 2010/01/13 21:16:13 matt Exp $	*/
 /*-
  * Copyright (c) 1999 Shin Takemura, All rights reserved.
  * Copyright (c) 1999-2001 SATO Kazumi, All rights reserved.
@@ -56,27 +56,28 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.15.28.1 2009/08/26 03:46:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.15.28.2 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
+#include <sys/cpu.h>
 #include <sys/bus.h>
 
 #include <machine/sysconf.h>
 #include <machine/autoconf.h>
 
 /* Definition of the driver for autoconfig. */
-static int	cpumatch(struct device *, struct cfdata *, void *);
-static void	cpuattach(struct device *, struct device *, void *);
+static int	cpumatch(device_t, cfdata_t, void *);
+static void	cpuattach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof (struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpumatch, cpuattach, NULL, NULL);
 
 extern struct cfdriver cpu_cd;
 
 static int
-cpumatch(struct device *parent, struct cfdata *cf, void *aux)
+cpumatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -85,12 +86,16 @@
 }
 
 static void
-cpuattach(struct device *parent, struct device *dev, void *aux)
+cpuattach(device_t parent, device_t self, void *aux)
 {
+	struct cpu_info * const ci = curcpu();
 
-	printf(": ");
+	ci->ci_dev = self;
+	self->dv_private = ci;
 
-	cpu_identify();
+	aprint_normal(": ");
+
+	cpu_identify(self);
 
 	/* install CPU specific idle routine if any. */
 	if (platform.cpu_idle != NULL)

Index: src/sys/arch/mipsco/mipsco/cpu.c
diff -u src/sys/arch/mipsco/mipsco/cpu.c:1.7 src/sys/arch/mipsco/mipsco/cpu.c:1.7.96.1
--- src/sys/arch/mipsco/mipsco/cpu.c:1.7	Sun Dec 11 12:18:13 2005
+++ src/sys/arch/mipsco/mipsco/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.7 2005/12/11 12:18:13 christos Exp $	*/
+/*	$NetBSD: cpu.c,v 1.7.96.1 2010/01/13 21:16:13 matt Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,33 +28,28 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.7 2005/12/11 12:18:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.7.96.1 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/cpu.h>
 #include <sys/systm.h>
 
-#include <machine/cpu.h>
 #include <machine/autoconf.h>
 
 #include <mips/locore.h>
 
 /* Definition of the driver for autoconfig. */
-static int	cpumatch(struct device *, struct cfdata *, void *);
-static void	cpuattach(struct device *, struct device *, void *);
+static int	cpumatch(device_t, cfdata_t, void *);
+static void	cpuattach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof(struct device),
+CFATTACH_DECL(cpu, 0,
     cpumatch, cpuattach, NULL, NULL);
 
 extern struct cfdriver cpu_cd;
 
-extern void cpu_identify __P((void));
-
 static int
-cpumatch(parent, cfdata, aux)
-	struct device *parent;
-	struct cfdata *cfdata;
-	void *aux;
+cpumatch(device_t parent, cfdata_t cfdata, void *aux)
 {
 	struct confargs *ca = aux;
 
@@ -66,12 +61,13 @@
 }
 
 static void
-cpuattach(parent, dev, aux)
-	struct device *parent;
-	struct device *dev;
-	void *aux;
+cpuattach(device_t parent, device_t self, void *aux)
 {
+	struct cpu_info * const ci = curcpu();
+
+	ci->ci_dev = self;
+	self->dv_private = ci;
 
-	printf(": ");
-	cpu_identify();
+	aprint_normal(": ");
+	cpu_identify(self);
 }

Index: src/sys/arch/newsmips/newsmips/cpu.c
diff -u src/sys/arch/newsmips/newsmips/cpu.c:1.11 src/sys/arch/newsmips/newsmips/cpu.c:1.11.96.1
--- src/sys/arch/newsmips/newsmips/cpu.c:1.11	Sun Dec 11 12:18:25 2005
+++ src/sys/arch/newsmips/newsmips/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.11 2005/12/11 12:18:25 christos Exp $	*/
+/*	$NetBSD: cpu.c,v 1.11.96.1 2010/01/13 21:16:13 matt Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,28 +28,28 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.11 2005/12/11 12:18:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.11.96.1 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/cpu.h>
 #include <sys/systm.h>
 
 #include <mips/locore.h>
 
-#include <machine/cpu.h>
 #include <machine/autoconf.h>
 
 /* Definition of the driver for autoconfig. */
-static int	cpumatch(struct device *, struct cfdata *, void *);
-static void	cpuattach(struct device *, struct device *, void *);
+static int	cpumatch(device_t, cfdata_t, void *);
+static void	cpuattach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof(struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpumatch, cpuattach, NULL, NULL);
 
 extern struct cfdriver cpu_cd;
 
 static int
-cpumatch(struct device *parent, struct cfdata *cfdata, void *aux)
+cpumatch(device_t parent, cfdata_t cfdata, void *aux)
 {
 	struct confargs *ca = aux;
 
@@ -61,9 +61,13 @@
 }
 
 static void
-cpuattach(struct device *parent, struct device *dev, void *aux)
+cpuattach(device_t parent, device_t self, void *aux)
 {
+	struct cpu_info * const ci = curcpu();
 
-	printf(": ");
-	cpu_identify();
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
+	aprint_normal(": ");
+	cpu_identify(self);
 }

Index: src/sys/arch/pmax/pmax/cpu.c
diff -u src/sys/arch/pmax/pmax/cpu.c:1.24 src/sys/arch/pmax/pmax/cpu.c:1.24.96.1
--- src/sys/arch/pmax/pmax/cpu.c:1.24	Sun Dec 11 12:18:39 2005
+++ src/sys/arch/pmax/pmax/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.24 2005/12/11 12:18:39 christos Exp $ */
+/* $NetBSD: cpu.c,v 1.24.96.1 2010/01/13 21:16:13 matt Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,28 +28,26 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.24 2005/12/11 12:18:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.24.96.1 2010/01/13 21:16:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
+#include <sys/cpu.h>
 
 #include <mips/locore.h>
 
 #include <machine/autoconf.h>
 
-static int	cpumatch __P((struct device *, struct cfdata *, void *));
-static void	cpuattach __P((struct device *, struct device *, void *));
+static int	cpumatch(device_t, cfdata_t, void *);
+static void	cpuattach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof (struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpumatch, cpuattach, NULL, NULL);
 extern struct cfdriver cpu_cd;
 
 static int
-cpumatch(parent, cf, aux)
-	struct device *parent;
-	struct cfdata *cf;
-	void *aux;
+cpumatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -61,11 +59,14 @@
 }
 
 static void
-cpuattach(parent, dev, aux)
-	struct device *parent, *dev;
-	void *aux;
+cpuattach(device_t parent, device_t self, void *aux)
 {
 
-	printf(": ");
-	cpu_identify();
+	struct cpu_info * const ci = curcpu();
+
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
+	aprint_normal(": ");
+	cpu_identify(self);
 }

Index: src/sys/arch/sbmips/sbmips/cpu.c
diff -u src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.2 src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.3
--- src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.2	Tue Jan 12 18:21:17 2010
+++ src/sys/arch/sbmips/sbmips/cpu.c	Wed Jan 13 21:16:13 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.18.16.2 2010/01/12 18:21:17 matt Exp $ */
+/* $NetBSD: cpu.c,v 1.18.16.3 2010/01/13 21:16:13 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18.16.2 2010/01/12 18:21:17 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18.16.3 2010/01/13 21:16:13 matt Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -135,12 +135,12 @@
 	 */
 	if (found == 1) {
 		aprint_normal("%s: ", xname);
-		cpu_identify();
+		cpu_identify(self);
 	} else {
 #if defined(MULTIPROCESSOR)
 # error!
 #else
-		printf("%s: processor off-line; multiprocessor support "
+		aprint_normal("%s: processor off-line; multiprocessor support "
 		    "not present in kernel\n", xname);
 #endif
 	}

Index: src/sys/arch/sgimips/sgimips/cpu.c
diff -u src/sys/arch/sgimips/sgimips/cpu.c:1.21 src/sys/arch/sgimips/sgimips/cpu.c:1.21.36.1
--- src/sys/arch/sgimips/sgimips/cpu.c:1.21	Mon Dec  3 15:34:17 2007
+++ src/sys/arch/sgimips/sgimips/cpu.c	Wed Jan 13 21:16:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.21 2007/12/03 15:34:17 ad Exp $	*/
+/*	$NetBSD: cpu.c,v 1.21.36.1 2010/01/13 21:16:14 matt Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.21 2007/12/03 15:34:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.21.36.1 2010/01/13 21:16:14 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -55,7 +55,7 @@
 
 static int	cpu_match(struct device *, struct cfdata *, void *);
 static void	cpu_attach(struct device *, struct device *, void *);
-void		cpu_intr(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
+void		cpu_intr(u_int32_t, u_int32_t, vaddr_t, u_int32_t);
 void *cpu_intr_establish(int, int, int (*func)(void *), void *);
 void		mips1_fpu_intr(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
 
@@ -82,7 +82,7 @@
 static struct evcnt mips_spurint_evcnt =
 	EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "mips", "spurious interrupts");
 
-CFATTACH_DECL(cpu, sizeof(struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpu_match, cpu_attach, NULL, NULL);
 
 static int
@@ -94,8 +94,13 @@
 static void
 cpu_attach(struct device *parent, struct device *self, void *aux)
 {
-	printf(": ");
-	cpu_identify();
+	struct cpu_info * const ci = curcpu();
+
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
+	aprint_normal(": ");
+	cpu_identify(self);
 }
 
 /*
@@ -103,7 +108,7 @@
  * sorts of Bad Things(tm) to happen, including kernel stack overflows.
  */
 void
-cpu_intr(u_int32_t status, u_int32_t cause, u_int32_t pc, u_int32_t ipending)
+cpu_intr(u_int32_t status, u_int32_t cause, vaddr_t pc, u_int32_t ipending)
 {
 	struct cpu_info *ci;
 

Reply via email to