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