]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * Mach Operating System | |
27 | * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University | |
28 | * All Rights Reserved. | |
29 | * | |
30 | * Permission to use, copy, modify and distribute this software and its | |
31 | * documentation is hereby granted, provided that both the copyright | |
32 | * notice and this permission notice appear in all copies of the | |
33 | * software, derivative works or modified versions, and any portions | |
34 | * thereof, and that both notices appear in supporting documentation. | |
35 | * | |
36 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
37 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
38 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
39 | * | |
40 | * Carnegie Mellon requests users of this software to return to | |
41 | * | |
42 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
43 | * School of Computer Science | |
44 | * Carnegie Mellon University | |
45 | * Pittsburgh PA 15213-3890 | |
46 | * | |
47 | * any improvements or extensions that they make and grant Carnegie Mellon | |
48 | * the rights to redistribute these changes. | |
49 | */ | |
50 | /* File: machine.h | |
51 | * Author: Avadis Tevanian, Jr. | |
52 | * Date: 1986 | |
53 | * | |
54 | * Machine independent machine abstraction. | |
55 | */ | |
56 | ||
57 | #ifndef _MACH_MACHINE_H_ | |
58 | #define _MACH_MACHINE_H_ | |
59 | ||
9bccf70c A |
60 | #include <sys/appleapiopts.h> |
61 | ||
1c79356b A |
62 | #include <mach/machine/vm_types.h> |
63 | #include <mach/boolean.h> | |
64 | ||
65 | /* | |
66 | * For each host, there is a maximum possible number of | |
67 | * cpus that may be available in the system. This is the | |
68 | * compile-time constant NCPUS, which is defined in cpus.h. | |
69 | * | |
70 | * In addition, there is a machine_slot specifier for each | |
71 | * possible cpu in the system. | |
72 | */ | |
73 | ||
74 | struct machine_info { | |
75 | integer_t major_version; /* kernel major version id */ | |
76 | integer_t minor_version; /* kernel minor version id */ | |
77 | integer_t max_cpus; /* max number of cpus compiled */ | |
78 | integer_t avail_cpus; /* number actually available */ | |
79 | vm_size_t memory_size; /* size of memory in bytes */ | |
80 | }; | |
81 | ||
82 | typedef struct machine_info *machine_info_t; | |
83 | typedef struct machine_info machine_info_data_t; /* bogus */ | |
84 | ||
85 | typedef integer_t cpu_type_t; | |
86 | typedef integer_t cpu_subtype_t; | |
87 | ||
88 | #define CPU_STATE_MAX 4 | |
89 | ||
90 | #define CPU_STATE_USER 0 | |
91 | #define CPU_STATE_SYSTEM 1 | |
92 | #define CPU_STATE_IDLE 2 | |
93 | #define CPU_STATE_NICE 3 | |
94 | ||
9bccf70c A |
95 | #ifdef KERNEL_PRIVATE |
96 | #ifdef __APPLE_API_UNSTABLE | |
97 | ||
1c79356b A |
98 | struct machine_slot { |
99 | /*boolean_t*/integer_t is_cpu; /* is there a cpu in this slot? */ | |
100 | cpu_type_t cpu_type; /* type of cpu */ | |
101 | cpu_subtype_t cpu_subtype; /* subtype of cpu */ | |
102 | /*boolean_t*/integer_t running; /* is cpu running */ | |
103 | integer_t cpu_ticks[CPU_STATE_MAX]; | |
104 | integer_t clock_freq; /* clock interrupt frequency */ | |
105 | }; | |
106 | ||
107 | typedef struct machine_slot *machine_slot_t; | |
108 | typedef struct machine_slot machine_slot_data_t; /* bogus */ | |
109 | ||
1c79356b A |
110 | extern struct machine_info machine_info; |
111 | extern struct machine_slot machine_slot[]; | |
9bccf70c A |
112 | |
113 | #endif /* __APPLE_API_UNSTABLE */ | |
114 | #endif /* KERNEL_PRIVATE */ | |
1c79356b A |
115 | |
116 | /* | |
117 | * Machine types known by all. | |
118 | */ | |
119 | ||
120 | #define CPU_TYPE_ANY ((cpu_type_t) -1) | |
121 | ||
122 | #define CPU_TYPE_VAX ((cpu_type_t) 1) | |
123 | /* skip ((cpu_type_t) 2) */ | |
124 | /* skip ((cpu_type_t) 3) */ | |
125 | /* skip ((cpu_type_t) 4) */ | |
126 | /* skip ((cpu_type_t) 5) */ | |
127 | #define CPU_TYPE_MC680x0 ((cpu_type_t) 6) | |
128 | #define CPU_TYPE_I386 ((cpu_type_t) 7) | |
129 | /* skip CPU_TYPE_MIPS ((cpu_type_t) 8) */ | |
130 | /* skip ((cpu_type_t) 9) */ | |
131 | #define CPU_TYPE_MC98000 ((cpu_type_t) 10) | |
132 | #define CPU_TYPE_HPPA ((cpu_type_t) 11) | |
133 | /* skip CPU_TYPE_ARM ((cpu_type_t) 12) */ | |
134 | #define CPU_TYPE_MC88000 ((cpu_type_t) 13) | |
135 | #define CPU_TYPE_SPARC ((cpu_type_t) 14) | |
136 | #define CPU_TYPE_I860 ((cpu_type_t) 15) | |
137 | /* skip CPU_TYPE_ALPHA ((cpu_type_t) 16) */ | |
138 | /* skip ((cpu_type_t) 17) */ | |
139 | #define CPU_TYPE_POWERPC ((cpu_type_t) 18) | |
140 | ||
141 | ||
142 | /* | |
143 | * Machine subtypes (these are defined here, instead of in a machine | |
144 | * dependent directory, so that any program can get all definitions | |
145 | * regardless of where is it compiled). | |
146 | */ | |
147 | ||
148 | /* | |
149 | * Object files that are hand-crafted to run on any | |
150 | * implementation of an architecture are tagged with | |
151 | * CPU_SUBTYPE_MULTIPLE. This functions essentially the same as | |
152 | * the "ALL" subtype of an architecture except that it allows us | |
153 | * to easily find object files that may need to be modified | |
154 | * whenever a new implementation of an architecture comes out. | |
155 | * | |
156 | * It is the responsibility of the implementor to make sure the | |
157 | * software handles unsupported implementations elegantly. | |
158 | */ | |
159 | #define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1) | |
160 | #define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0) | |
161 | #define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1) | |
162 | ||
163 | /* | |
164 | * VAX subtypes (these do *not* necessary conform to the actual cpu | |
165 | * ID assigned by DEC available via the SID register). | |
166 | */ | |
167 | ||
168 | #define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0) | |
169 | #define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1) | |
170 | #define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2) | |
171 | #define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3) | |
172 | #define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4) | |
173 | #define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5) | |
174 | #define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6) | |
175 | #define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7) | |
176 | #define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8) | |
177 | #define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9) | |
178 | #define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10) | |
179 | #define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11) | |
180 | #define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12) | |
181 | ||
182 | /* | |
183 | * 680x0 subtypes | |
184 | * | |
185 | * The subtype definitions here are unusual for historical reasons. | |
186 | * NeXT used to consider 68030 code as generic 68000 code. For | |
187 | * backwards compatability: | |
188 | * | |
189 | * CPU_SUBTYPE_MC68030 symbol has been preserved for source code | |
190 | * compatability. | |
191 | * | |
192 | * CPU_SUBTYPE_MC680x0_ALL has been defined to be the same | |
193 | * subtype as CPU_SUBTYPE_MC68030 for binary comatability. | |
194 | * | |
195 | * CPU_SUBTYPE_MC68030_ONLY has been added to allow new object | |
196 | * files to be tagged as containing 68030-specific instructions. | |
197 | */ | |
198 | ||
199 | #define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1) | |
200 | #define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */ | |
201 | #define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2) | |
202 | #define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3) | |
203 | ||
204 | /* | |
205 | * I386 subtypes. | |
206 | */ | |
207 | ||
208 | #define CPU_SUBTYPE_I386_ALL ((cpu_subtype_t) 3) | |
209 | #define CPU_SUBTYPE_386 ((cpu_subtype_t) 3) | |
210 | #define CPU_SUBTYPE_486 ((cpu_subtype_t) 4) | |
211 | #define CPU_SUBTYPE_486SX ((cpu_subtype_t) 4 + 128) | |
212 | #define CPU_SUBTYPE_586 ((cpu_subtype_t) 5) | |
213 | #define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4)) | |
214 | #define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0) | |
215 | #define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1) | |
216 | #define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3) | |
217 | #define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5) | |
218 | ||
219 | #define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15) | |
220 | #define CPU_SUBTYPE_INTEL_FAMILY_MAX 15 | |
221 | ||
222 | #define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4) | |
223 | #define CPU_SUBTYPE_INTEL_MODEL_ALL 0 | |
224 | ||
225 | /* | |
226 | * Mips subtypes. | |
227 | */ | |
228 | ||
229 | #define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0) | |
230 | #define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1) | |
231 | #define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2) | |
232 | #define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3) | |
233 | #define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */ | |
234 | #define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5) | |
235 | #define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */ | |
236 | #define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7) | |
237 | ||
238 | /* | |
239 | * MC98000 (PowerPC) subtypes | |
240 | */ | |
241 | #define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0) | |
242 | #define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1) | |
243 | ||
244 | /* | |
245 | * HPPA subtypes for Hewlett-Packard HP-PA family of | |
246 | * risc processors. Port by NeXT to 700 series. | |
247 | */ | |
248 | ||
249 | #define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0) | |
250 | #define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */ | |
251 | #define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1) | |
252 | ||
253 | /* | |
254 | * MC88000 subtypes. | |
255 | */ | |
256 | #define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0) | |
257 | #define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1) | |
258 | #define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2) | |
259 | ||
260 | /* | |
261 | * SPARC subtypes | |
262 | */ | |
263 | #define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0) | |
264 | ||
265 | /* | |
266 | * I860 subtypes | |
267 | */ | |
268 | #define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0) | |
269 | #define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1) | |
270 | ||
271 | /* | |
272 | * PowerPC subtypes | |
273 | */ | |
274 | #define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0) | |
275 | #define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1) | |
276 | #define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2) | |
277 | #define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3) | |
278 | #define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4) | |
279 | #define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5) | |
280 | #define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6) | |
281 | #define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7) | |
282 | #define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8) | |
283 | #define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9) | |
284 | #define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10) | |
285 | #define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11) | |
55e303ae | 286 | #define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100) |
1c79356b A |
287 | |
288 | #endif /* _MACH_MACHINE_H_ */ |