xref: /netbsd/sys/arch/arc/arc/cpu.c (revision bf9ec67e)
1 /*	$NetBSD: cpu.c,v 1.9 2000/06/29 08:34:09 mrg 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 struct cfattach cpu_ca = {
53 	sizeof(struct device), cpumatch, cpuattach
54 };
55 extern struct cfdriver cpu_cd;
56 
57 static int
58 cpumatch(parent, match, aux)
59 	struct device *parent;
60 	struct cfdata *match;
61 	void *aux;
62 {
63 	struct confargs *ca = aux;
64 
65 	/* make sure that we're looking for a CPU. */
66 	if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0)
67 		return (0);
68 
69 	return (1);
70 }
71 
72 static void
73 cpuattach(parent, dev, aux)
74 	struct device *parent;
75 	struct device *dev;
76 	void *aux;
77 {
78 
79 	printf(": ");
80 
81 #if 1
82 	cpu_identify();
83 #else /* XXX - before do this, fix pmax, newsmips */
84 	cpu_identify(dev);
85 #endif
86 }
87