Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / sparc / include / cpuconf.h
blob6a16969fec348c47ed647996715042d35064daf7
1 /* $NetBSD: cpuconf.h,v 1.1.2.4 2005/01/17 19:30:19 skrll Exp $ */
3 /*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
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.
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.
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. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
40 * @(#)param.h 8.1 (Berkeley) 6/11/93
43 * Sun4M support by Aaron Brown, Harvard University.
44 * Changes Copyright (c) 1995 The President and Fellows of Harvard College.
45 * All rights reserved.
48 #ifndef _SPARC_CPUCONF_H_
49 #define _SPARC_CPUCONF_H_
52 * Values for the cputyp variable.
54 #define CPU_SUN4 0
55 #define CPU_SUN4C 1
56 #define CPU_SUN4M 2
57 #define CPU_SUN4U 3
58 #define CPU_SUN4D 4
60 #if defined(_KERNEL) || defined(_STANDALONE)
62 #if defined(_KERNEL_OPT)
63 #include "opt_sparc_arch.h"
64 #endif /* _KERNEL_OPT */
66 #ifndef _LOCORE
67 extern int cputyp;
68 #endif
70 /*
71 * Shorthand CPU-type macros. Let the compiler optimize away code
72 * conditional on constants.
76 * Step 1: Count the number of CPU types configured into the kernel.
78 #if defined(_KERNEL_OPT)
79 #define CPU_NTYPES (defined(SUN4) + defined(SUN4C) + \
80 defined(SUN4M) + defined(SUN4D))
81 #else
82 #define CPU_NTYPES 0
83 #endif
86 * Step 2: Define the CPU type predicates. Rules:
88 * * If multiple CPU types are configured in, and the CPU type
89 * is not one of them, then the test is always false.
91 * * If exactly one CPU type is configured in, and it's this
92 * one, then the test is always true.
94 * * Otherwise, we have to reference the cputyp variable.
96 #if CPU_NTYPES != 0 && !defined(SUN4)
97 # define CPU_ISSUN4 (0)
98 #elif CPU_NTYPES == 1 && defined(SUN4)
99 # define CPU_ISSUN4 (1)
100 #else
101 # define CPU_ISSUN4 (cputyp == CPU_SUN4)
102 #endif
104 #if CPU_NTYPES != 0 && !defined(SUN4C)
105 # define CPU_ISSUN4C (0)
106 #elif CPU_NTYPES == 1 && defined(SUN4C)
107 # define CPU_ISSUN4C (1)
108 #else
109 # define CPU_ISSUN4C (cputyp == CPU_SUN4C)
110 #endif
112 #if CPU_NTYPES != 0 && !defined(SUN4M)
113 # define CPU_ISSUN4M (0)
114 #elif CPU_NTYPES == 1 && defined(SUN4M)
115 # define CPU_ISSUN4M (1)
116 #else
117 # define CPU_ISSUN4M (cputyp == CPU_SUN4M)
118 #endif
120 #if CPU_NTYPES != 0 && !defined(SUN4D)
121 # define CPU_ISSUN4D (0)
122 #elif CPU_NTYPES == 1 && defined(SUN4D)
123 # define CPU_ISSUN4D (1)
124 #else
125 # define CPU_ISSUN4D (cputyp == CPU_SUN4D)
126 #endif
128 #define CPU_ISSUN4U (0)
131 * Step 3: Define some short-hand for the different MMUs.
133 #define CPU_HAS_SRMMU (CPU_ISSUN4M || CPU_ISSUN4D)
134 #define CPU_HAS_SUNMMU (CPU_ISSUN4 || CPU_ISSUN4C)
136 #endif /* _KERNEL || _STANDALONE */
138 #endif /* _SPARC_CPUCONF_H_ */