1 /* $NetBSD: cpu.c,v 1.12 2003/07/15 00:04:41 lukem Exp $ */ 2 /* $OpenBSD: cpu.c,v 1.8 1997/04/19 17:19:41 pefo Exp $ */ 3 4 /* 5 * Copyright (c) 1997 Per Fogelstrom 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed under OpenBSD by 18 * Per Fogelstrom. 19 * 4. The name of the author may not be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 23 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 26 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 */ 35 36 #include <sys/cdefs.h> 37 __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.12 2003/07/15 00:04:41 lukem Exp $"); 38 39 #include <sys/param.h> 40 #include <sys/systm.h> 41 #include <sys/proc.h> 42 #include <sys/user.h> 43 #include <sys/device.h> 44 45 #include <uvm/uvm_extern.h> 46 47 #include <machine/cpu.h> 48 #include <machine/autoconf.h> 49 50 51 /* Definition of the driver for autoconfig. */ 52 static int cpumatch(struct device *, struct cfdata *, void *); 53 static void cpuattach(struct device *, struct device *, void *); 54 55 CFATTACH_DECL(cpu, sizeof(struct device), 56 cpumatch, cpuattach, NULL, NULL); 57 extern struct cfdriver cpu_cd; 58 59 static int 60 cpumatch(parent, match, aux) 61 struct device *parent; 62 struct cfdata *match; 63 void *aux; 64 { 65 struct confargs *ca = aux; 66 67 /* make sure that we're looking for a CPU. */ 68 if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) 69 return (0); 70 71 return (1); 72 } 73 74 static void 75 cpuattach(parent, dev, aux) 76 struct device *parent; 77 struct device *dev; 78 void *aux; 79 { 80 81 printf(": "); 82 83 #if 1 84 cpu_identify(); 85 #else /* XXX - before do this, fix pmax, newsmips */ 86 cpu_identify(dev); 87 #endif 88 } 89