1 /* $NetBSD: cpu.c,v 1.11 2002/10/02 04:59:47 thorpej 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/param.h> 37 #include <sys/systm.h> 38 #include <sys/proc.h> 39 #include <sys/user.h> 40 #include <sys/device.h> 41 42 #include <uvm/uvm_extern.h> 43 44 #include <machine/cpu.h> 45 #include <machine/autoconf.h> 46 47 48 /* Definition of the driver for autoconfig. */ 49 static int cpumatch(struct device *, struct cfdata *, void *); 50 static void cpuattach(struct device *, struct device *, void *); 51 52 CFATTACH_DECL(cpu, sizeof(struct device), 53 cpumatch, cpuattach, NULL, NULL); 54 extern struct cfdriver cpu_cd; 55 56 static int 57 cpumatch(parent, match, aux) 58 struct device *parent; 59 struct cfdata *match; 60 void *aux; 61 { 62 struct confargs *ca = aux; 63 64 /* make sure that we're looking for a CPU. */ 65 if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) 66 return (0); 67 68 return (1); 69 } 70 71 static void 72 cpuattach(parent, dev, aux) 73 struct device *parent; 74 struct device *dev; 75 void *aux; 76 { 77 78 printf(": "); 79 80 #if 1 81 cpu_identify(); 82 #else /* XXX - before do this, fix pmax, newsmips */ 83 cpu_identify(dev); 84 #endif 85 } 86