xref: /netbsd-src/sys/arch/sparc/include/cpuconf.h (revision d710132b4b8ce7f7cccaaf660cb16aa16b4077a0)
1 /*	$NetBSD: cpuconf.h,v 1.1 2003/04/09 16:22:33 thorpej Exp $	*/
2 
3 /*
4  * Copyright (c) 1992, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This software was developed by the Computer Systems Engineering group
8  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9  * contributed to Berkeley.
10  *
11  * All advertising materials mentioning features or use of this software
12  * must display the following acknowledgement:
13  *	This product includes software developed by the University of
14  *	California, Lawrence Berkeley Laboratory.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions
18  * are met:
19  * 1. Redistributions of source code must retain the above copyright
20  *    notice, this list of conditions and the following disclaimer.
21  * 2. Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the
23  *    documentation and/or other materials provided with the distribution.
24  * 3. All advertising materials mentioning features or use of this software
25  *    must display the following acknowledgement:
26  *	This product includes software developed by the University of
27  *	California, Berkeley and its contributors.
28  * 4. Neither the name of the University nor the names of its contributors
29  *    may be used to endorse or promote products derived from this software
30  *    without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
33  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
36  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42  * SUCH DAMAGE.
43  *
44  *	@(#)param.h	8.1 (Berkeley) 6/11/93
45  */
46 /*
47  * Sun4M support by Aaron Brown, Harvard University.
48  * Changes Copyright (c) 1995 The President and Fellows of Harvard College.
49  * All rights reserved.
50  */
51 
52 #ifndef _SPARC_CPUCONF_H_
53 #define	_SPARC_CPUCONF_H_
54 
55 /*
56  * Values for the cputyp variable.
57  */
58 #define	CPU_SUN4	0
59 #define	CPU_SUN4C	1
60 #define	CPU_SUN4M	2
61 #define	CPU_SUN4U	3
62 #define	CPU_SUN4D	4
63 
64 #if defined(_KERNEL) || defined(_STANDALONE)
65 
66 #if defined(_KERNEL_OPT)
67 #include "opt_sparc_arch.h"
68 #endif /* _KERNEL_OPT */
69 
70 #ifndef _LOCORE
71 extern int cputyp;
72 #endif
73 
74 /*
75  * Shorthand CPU-type macros.  Let the compiler optimize away code
76  * conditional on constants.
77  */
78 
79 /*
80  * Step 1: Count the number of CPU types configured into the kernel.
81  */
82 #if defined(_KERNEL_OPT)
83 #define	CPU_NTYPES	(defined(SUN4) + defined(SUN4C) + \
84 			 defined(SUN4M) + defined(SUN4D))
85 #else
86 #define	CPU_NTYPES	0
87 #endif
88 
89 /*
90  * Step 2: Define the CPU type predicates.  Rules:
91  *
92  *	* If multiple CPU types are configured in, and the CPU type
93  *	  is not one of them, then the test is always false.
94  *
95  *	* If exactly one CPU type is configured in, and it's this
96  *	  one, then the test is always true.
97  *
98  *	* Otherwise, we have to reference the cputyp variable.
99  */
100 #if CPU_NTYPES != 0 && !defined(SUN4)
101 #	define CPU_ISSUN4	(0)
102 #elif CPU_NTYPES == 1 && defined(SUN4)
103 #	define CPU_ISSUN4	(1)
104 #else
105 #	define CPU_ISSUN4	(cputyp == CPU_SUN4)
106 #endif
107 
108 #if CPU_NTYPES != 0 && !defined(SUN4C)
109 #	define CPU_ISSUN4C	(0)
110 #elif CPU_NTYPES == 1 && defined(SUN4C)
111 #	define CPU_ISSUN4C	(1)
112 #else
113 #	define CPU_ISSUN4C	(cputyp == CPU_SUN4C)
114 #endif
115 
116 #if CPU_NTYPES != 0 && !defined(SUN4M)
117 #	define CPU_ISSUN4M	(0)
118 #elif CPU_NTYPES == 1 && defined(SUN4M)
119 #	define CPU_ISSUN4M	(1)
120 #else
121 #	define CPU_ISSUN4M	(cputyp == CPU_SUN4M)
122 #endif
123 
124 #if CPU_NTYPES != 0 && !defined(SUN4D)
125 #	define CPU_ISSUN4D	(0)
126 #elif CPU_NTYPES == 1 && defined(SUN4D)
127 #	define CPU_ISSUN4D	(1)
128 #else
129 #	define CPU_ISSUN4D	(cputyp == CPU_SUN4D)
130 #endif
131 
132 #define	CPU_ISSUN4U		(0)
133 
134 /*
135  * Step 3: Sun4M and Sun4D systems have an SRMMU.  Define some
136  * short-hand for this.
137  */
138 #define	CPU_HAS_SRMMU		(CPU_ISSUN4M || CPU_ISSUN4D)
139 
140 #endif /* _KERNEL || _STANDALONE */
141 
142 #endif /* _SPARC_CPUCONF_H_ */
143