xref: /netbsd-src/sys/arch/arc/arc/cpu.c (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: cpu.c,v 1.17 2009/11/27 03:23:04 rmind 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.17 2009/11/27 03:23:04 rmind 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 <machine/cpu.h>
47 #include <machine/autoconf.h>
48 
49 #include "ioconf.h"
50 
51 /* Definition of the driver for autoconfig. */
52 static int	cpumatch(device_t, cfdata_t, void *);
53 static void	cpuattach(device_t, device_t, void *);
54 
55 CFATTACH_DECL_NEW(cpu, 0,
56     cpumatch, cpuattach, NULL, NULL);
57 
58 static int
59 cpumatch(device_t parent, cfdata_t cf, void *aux)
60 {
61 	struct confargs *ca = aux;
62 
63 	/* make sure that we're looking for a CPU. */
64 	if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0)
65 		return 0;
66 
67 	return 1;
68 }
69 
70 static void
71 cpuattach(device_t parent, device_t self, void *aux)
72 {
73 
74 	aprint_normal(": ");
75 
76 #if 1
77 	cpu_identify();
78 #else /* XXX - before do this, fix pmax, newsmips */
79 	cpu_identify(dev);
80 #endif
81 }
82