2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 * Mach Operating System
25 * Copyright (c) 1989 Carnegie-Mellon University
26 * Copyright (c) 1988 Carnegie-Mellon University
27 * Copyright (c) 1987 Carnegie-Mellon University
28 * All rights reserved. The CMU software License Agreement specifies
29 * the terms and conditions for use and redistribution.
33 * Revision 1.1.1.1 1997/09/03 20:53:37 roland
34 * Initial checkin of SGS release 244
36 * 2 July 1992 Mac Gillon at NeXT
37 * Changed HPPA subtypes to follow our practice.
39 * 11 September 1992 David E. Bohman at NeXT
40 * Added CPU_SUBTYPE_486SX to the i386 family.
42 * 16 July 1992 David E. Bohman at NeXT
43 * Added CPU_SUBTYPE_586 to the i386 family.
45 * 17-Dec-91 Peter King (king) at NeXT
46 * Added support for the XXX_ALL subtypes. These are used to
47 * tag object files that can run on any implementation of a
50 * 1-Mar-90 John Seamons (jks) at NeXT
51 * Redefined cpu_type and cpu_subtype definitions to indicate processor
52 * architecture instead of product types for the MC680x0.
54 * Revision 2.15 89/10/11 14:39:56 dlb
55 * Removed should_exit - replaced by action thread.
58 * Revision 2.14 89/07/14 17:21:39 rvb
59 * Added CPU types and subtypes for MC68030, MC68040, MC88000,
60 * HPPA, ARM and Sun4-SPARC.
63 * Revision 2.12 89/05/30 10:38:58 rvb
64 * Add R2000 machine types.
65 * [89/05/30 08:28:53 rvb]
67 * Revision 2.11 89/04/18 16:43:32 mwyoung
68 * Use <machine/vm_types.h> rather than <vm/vm_param.h> to get
69 * VM types. Remove old history... none of it was insightful.
71 * The variable declarations should be moved elsewhere.
76 * Machine independent machine abstraction.
77 * Copyright (C) 1986, Avadis Tevanian, Jr.
80 #ifndef _MACH_MACHINE_H_
81 #define _MACH_MACHINE_H_
83 #import <mach/machine/vm_types.h>
84 #import <mach/boolean.h>
87 * For each host, there is a maximum possible number of
88 * cpus that may be available in the system. This is the
89 * compile-time constant NCPUS, which is defined in cpus.h.
91 * In addition, there is a machine_slot specifier for each
92 * possible cpu in the system.
96 int major_version
; /* kernel major version id */
97 int minor_version
; /* kernel minor version id */
98 int max_cpus
; /* max number of cpus compiled */
99 int avail_cpus
; /* number actually available */
100 vm_size_t memory_size
; /* size of memory in bytes */
103 typedef struct machine_info
*machine_info_t
;
104 typedef struct machine_info machine_info_data_t
; /* bogus */
106 typedef int cpu_type_t
;
107 typedef int cpu_subtype_t
;
108 typedef integer_t cpu_threadtype_t
;
110 #define CPU_STATE_MAX 3
112 #define CPU_STATE_USER 0
113 #define CPU_STATE_SYSTEM 1
114 #define CPU_STATE_IDLE 2
116 struct machine_slot
{
117 boolean_t is_cpu
; /* is there a cpu in this slot? */
118 cpu_type_t cpu_type
; /* type of cpu */
119 cpu_subtype_t cpu_subtype
; /* subtype of cpu */
120 volatile boolean_t running
; /* is cpu running */
121 long cpu_ticks
[CPU_STATE_MAX
];
122 int clock_freq
; /* clock interrupt frequency */
125 typedef struct machine_slot
*machine_slot_t
;
126 typedef struct machine_slot machine_slot_data_t
; /* bogus */
129 extern struct machine_info machine_info
;
130 extern struct machine_slot machine_slot
[];
132 extern vm_offset_t interrupt_stack
[];
136 * Machine types known by all.
139 #define CPU_TYPE_ANY ((cpu_type_t) -1)
141 #define CPU_TYPE_VAX ((cpu_type_t) 1)
142 #define CPU_TYPE_ROMP ((cpu_type_t) 2)
143 #define CPU_TYPE_NS32032 ((cpu_type_t) 4)
144 #define CPU_TYPE_NS32332 ((cpu_type_t) 5)
145 #define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
146 #define CPU_TYPE_I386 ((cpu_type_t) 7)
147 #define CPU_TYPE_X86_64 ((cpu_type_t) (CPU_TYPE_I386 | CPU_ARCH_ABI64))
148 #define CPU_TYPE_MIPS ((cpu_type_t) 8)
149 #define CPU_TYPE_NS32532 ((cpu_type_t) 9)
150 #define CPU_TYPE_HPPA ((cpu_type_t) 11)
151 #define CPU_TYPE_ARM ((cpu_type_t) 12)
152 #define CPU_TYPE_MC88000 ((cpu_type_t) 13)
153 #define CPU_TYPE_SPARC ((cpu_type_t) 14)
154 #define CPU_TYPE_I860 ((cpu_type_t) 15) // big-endian
155 #define CPU_TYPE_I860_LITTLE ((cpu_type_t) 16) // little-endian
156 #define CPU_TYPE_RS6000 ((cpu_type_t) 17)
157 #define CPU_TYPE_MC98000 ((cpu_type_t) 18)
158 #define CPU_TYPE_POWERPC ((cpu_type_t) 18)
159 #define CPU_ARCH_ABI64 0x1000000
160 #define CPU_TYPE_POWERPC64 ((cpu_type_t)(CPU_TYPE_POWERPC | CPU_ARCH_ABI64))
161 #define CPU_TYPE_VEO ((cpu_type_t) 255)
165 * Machine subtypes (these are defined here, instead of in a machine
166 * dependent directory, so that any program can get all definitions
167 * regardless of where is it compiled).
171 * Capability bits used in the definition of cpu_subtype.
173 #define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
174 #define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
178 * Object files that are hand-crafted to run on any
179 * implementation of an architecture are tagged with
180 * CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
181 * the "ALL" subtype of an architecture except that it allows us
182 * to easily find object files that may need to be modified
183 * whenever a new implementation of an architecture comes out.
185 * It is the responsibility of the implementor to make sure the
186 * software handles unsupported implementations elegantly.
188 #define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
192 * VAX subtypes (these do *not* necessary conform to the actual cpu
193 * ID assigned by DEC available via the SID register).
196 #define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
197 #define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
198 #define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
199 #define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
200 #define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
201 #define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
202 #define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
203 #define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
204 #define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
205 #define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
206 #define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
207 #define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
208 #define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
214 #define CPU_SUBTYPE_RT_ALL ((cpu_subtype_t) 0)
215 #define CPU_SUBTYPE_RT_PC ((cpu_subtype_t) 1)
216 #define CPU_SUBTYPE_RT_APC ((cpu_subtype_t) 2)
217 #define CPU_SUBTYPE_RT_135 ((cpu_subtype_t) 3)
220 * 32032/32332/32532 subtypes.
223 #define CPU_SUBTYPE_MMAX_ALL ((cpu_subtype_t) 0)
224 #define CPU_SUBTYPE_MMAX_DPC ((cpu_subtype_t) 1) /* 032 CPU */
225 #define CPU_SUBTYPE_SQT ((cpu_subtype_t) 2)
226 #define CPU_SUBTYPE_MMAX_APC_FPU ((cpu_subtype_t) 3) /* 32081 FPU */
227 #define CPU_SUBTYPE_MMAX_APC_FPA ((cpu_subtype_t) 4) /* Weitek FPA */
228 #define CPU_SUBTYPE_MMAX_XPC ((cpu_subtype_t) 5) /* 532 CPU */
234 #define CPU_SUBTYPE_I386_ALL ((cpu_subtype_t) 3)
235 #define CPU_SUBTYPE_X86_64_ALL CPU_SUBTYPE_I386_ALL
236 #define CPU_SUBTYPE_386 ((cpu_subtype_t) 3)
237 #define CPU_SUBTYPE_486 ((cpu_subtype_t) 4)
238 #define CPU_SUBTYPE_486SX ((cpu_subtype_t) 4 + 128)
239 #define CPU_SUBTYPE_586 ((cpu_subtype_t) 5)
240 #define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
241 #define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
242 #define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
243 #define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
244 #define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
245 #define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
247 #define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
248 #define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
250 #define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
251 #define CPU_SUBTYPE_INTEL_MODEL_ALL 0
258 #define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
259 #define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
260 #define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
261 #define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
262 #define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4)
267 * The subtype definitions here are unusual for historical reasons.
268 * NeXT used to consider 68030 code as generic 68000 code. For
269 * backwards compatability:
271 * CPU_SUBTYPE_MC68030 symbol has been preserved for source code
274 * CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
275 * subtype as CPU_SUBTYPE_MC68030 for binary comatability.
277 * CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
278 * files to be tagged as containing 68030-specific instructions.
281 #define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
282 #define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
283 #define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
284 #define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
287 * HPPA subtypes for Hewlett-Packard HP-PA family of
288 * risc processors. Port by NeXT to 700 series.
291 #define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
292 #define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
293 #define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
296 * Acorn subtypes - Acorn Risc Machine port done by
297 * Olivetti System Software Laboratory
300 #define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
301 #define CPU_SUBTYPE_ARM_A500_ARCH ((cpu_subtype_t) 1)
302 #define CPU_SUBTYPE_ARM_A500 ((cpu_subtype_t) 2)
303 #define CPU_SUBTYPE_ARM_A440 ((cpu_subtype_t) 3)
304 #define CPU_SUBTYPE_ARM_M4 ((cpu_subtype_t) 4)
305 #define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
306 #define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
307 #define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
308 #define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
309 #define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9)
314 #define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
315 #define CPU_SUBTYPE_MMAX_JPC ((cpu_subtype_t) 1)
316 #define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
317 #define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
320 * MC98000 (PowerPC) subtypes
322 #define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
323 #define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
328 #define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
329 #define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
332 * I860 subtypes for NeXT-internal backwards compatability.
333 * These constants will be going away. DO NOT USE THEM!!!
335 #define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
336 #define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
339 * I860_LITTLE subtypes
341 #define CPU_SUBTYPE_I860_LITTLE_ALL ((cpu_subtype_t) 0)
342 #define CPU_SUBTYPE_I860_LITTLE ((cpu_subtype_t) 1)
347 #define CPU_SUBTYPE_RS6000_ALL ((cpu_subtype_t) 0)
348 #define CPU_SUBTYPE_RS6000 ((cpu_subtype_t) 1)
351 * Sun4 subtypes - port done at CMU
353 #define CPU_SUBTYPE_SUN4_ALL ((cpu_subtype_t) 0)
354 #define CPU_SUBTYPE_SUN4_260 ((cpu_subtype_t) 1)
355 #define CPU_SUBTYPE_SUN4_110 ((cpu_subtype_t) 2)
357 #define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
362 #define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
363 #define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
364 #define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
365 #define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
366 #define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
367 #define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
368 #define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
369 #define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
370 #define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
371 #define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
372 #define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
373 #define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
374 #define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
378 * Note: the CPU_SUBTYPE_VEO_ALL will likely change over time to be defined as
379 * one of the specific subtypes.
381 #define CPU_SUBTYPE_VEO_1 ((cpu_subtype_t) 1)
382 #define CPU_SUBTYPE_VEO_2 ((cpu_subtype_t) 2)
383 #define CPU_SUBTYPE_VEO_3 ((cpu_subtype_t) 3)
384 #define CPU_SUBTYPE_VEO_4 ((cpu_subtype_t) 4)
385 #define CPU_SUBTYPE_VEO_ALL CPU_SUBTYPE_VEO_2
387 #endif /* _MACH_MACHINE_H_ */