1 /* $NetBSD: cpu.c,v 1.20 2015/06/24 06:19:52 matt 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.20 2015/06/24 06:19:52 matt Exp $"); 38 39 #include <sys/param.h> 40 #include <sys/systm.h> 41 #include <sys/proc.h> 42 #include <sys/device.h> 43 44 #include <uvm/uvm_extern.h> 45 46 #include <mips/locore.h> 47 48 #include <machine/autoconf.h> 49 50 #include "ioconf.h" 51 52 /* Definition of the driver for autoconfig. */ 53 static int cpumatch(device_t, cfdata_t, void *); 54 static void cpuattach(device_t, device_t, void *); 55 56 CFATTACH_DECL_NEW(cpu, 0, 57 cpumatch, cpuattach, NULL, NULL); 58 59 static int 60 cpumatch(device_t parent, cfdata_t cf, 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(device_t parent, device_t self, void *aux) 73 { 74 75 struct cpu_info * const ci = curcpu(); 76 77 ci->ci_dev = self; 78 self->dv_private = ci; 79 80 aprint_normal(": "); 81 82 cpu_identify(self); 83 } 84