-
Notifications
You must be signed in to change notification settings - Fork 7
/
machine.h
270 lines (226 loc) · 8.36 KB
/
machine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/* File: machine.h
* Author: Avadis Tevanian, Jr.
* Date: 1986
*
* Machine independent machine abstraction.
*/
#ifndef _MACH_MACHINE_H_
#define _MACH_MACHINE_H_
#include <mach/machine/vm_types.h>
#include <mach/boolean.h>
/*
* For each host, there is a maximum possible number of
* cpus that may be available in the system. This is the
* compile-time constant NCPUS, which is defined in cpus.h.
*
* In addition, there is a machine_slot specifier for each
* possible cpu in the system.
*/
int ncpu;
struct machine_info {
integer_t major_version; /* kernel major version id */
integer_t minor_version; /* kernel minor version id */
integer_t max_cpus; /* max number of cpus compiled */
integer_t avail_cpus; /* number actually available */
vm_size_t memory_size; /* size of memory in bytes */
};
typedef struct machine_info *machine_info_t;
typedef struct machine_info machine_info_data_t; /* bogus */
typedef integer_t cpu_type_t;
typedef integer_t cpu_subtype_t;
#define CPU_STATE_MAX 3
#define CPU_STATE_USER 0
#define CPU_STATE_SYSTEM 1
#define CPU_STATE_IDLE 2
struct machine_slot {
/*boolean_t*/integer_t is_cpu; /* is there a cpu in this slot? */
cpu_type_t cpu_type; /* type of cpu */
cpu_subtype_t cpu_subtype; /* subtype of cpu */
/*boolean_t*/integer_t running; /* is cpu running */
integer_t apic_id; /* apic id of the cpu */
integer_t cpu_ticks[CPU_STATE_MAX];
integer_t clock_freq; /* clock interrupt frequency */
};
typedef struct machine_slot *machine_slot_t;
typedef struct machine_slot machine_slot_data_t; /* bogus */
#ifdef MACH_KERNEL
extern struct machine_info machine_info;
extern struct machine_slot machine_slot[NCPUS];
#endif /* MACH_KERNEL */
/*
* Machine types known by all.
*
* When adding new types & subtypes, please also update slot_name.c
* in the libmach sources.
*/
#define CPU_TYPE_VAX ((cpu_type_t) 1)
#define CPU_TYPE_ROMP ((cpu_type_t) 2)
#define CPU_TYPE_MC68020 ((cpu_type_t) 3)
#define CPU_TYPE_NS32032 ((cpu_type_t) 4)
#define CPU_TYPE_NS32332 ((cpu_type_t) 5)
#define CPU_TYPE_NS32532 ((cpu_type_t) 6)
#define CPU_TYPE_I386 ((cpu_type_t) 7)
#define CPU_TYPE_MIPS ((cpu_type_t) 8)
#define CPU_TYPE_MC68030 ((cpu_type_t) 9)
#define CPU_TYPE_MC68040 ((cpu_type_t) 10)
#define CPU_TYPE_HPPA ((cpu_type_t) 11)
#define CPU_TYPE_ARM ((cpu_type_t) 12)
#define CPU_TYPE_MC88000 ((cpu_type_t) 13)
#define CPU_TYPE_SPARC ((cpu_type_t) 14)
#define CPU_TYPE_I860 ((cpu_type_t) 15)
#define CPU_TYPE_ALPHA ((cpu_type_t) 16)
#define CPU_TYPE_I486 ((cpu_type_t) 17)
#define CPU_TYPE_PENTIUM ((cpu_type_t) 18)
#define CPU_TYPE_PENTIUMPRO ((cpu_type_t) 19)
#define CPU_TYPE_POWERPC ((cpu_type_t) 20)
/*
* Machine subtypes (these are defined here, instead of in a machine
* dependent directory, so that any program can get all definitions
* regardless of where is it compiled).
*/
/*
* VAX subtypes (these do *not* necessarily conform to the actual cpu
* ID assigned by DEC available via the SID register).
*/
#define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
#define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
#define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
#define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
#define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
#define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
#define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
/*
* ROMP subtypes.
*/
#define CPU_SUBTYPE_RT_PC ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_RT_APC ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_RT_135 ((cpu_subtype_t) 3)
/*
* 68020 subtypes.
*/
#define CPU_SUBTYPE_SUN3_50 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_SUN3_160 ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_SUN3_260 ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_SUN3_110 ((cpu_subtype_t) 4)
#define CPU_SUBTYPE_SUN3_60 ((cpu_subtype_t) 5)
#define CPU_SUBTYPE_HP_320 ((cpu_subtype_t) 6)
/* 16.67 Mhz HP 300 series, custom MMU [HP 320] */
#define CPU_SUBTYPE_HP_330 ((cpu_subtype_t) 7)
/* 16.67 Mhz HP 300 series, MC68851 MMU [HP 318,319,330,349] */
#define CPU_SUBTYPE_HP_350 ((cpu_subtype_t) 8)
/* 25.00 Mhz HP 300 series, custom MMU [HP 350] */
/*
* 32032/32332/32532 subtypes.
*/
#define CPU_SUBTYPE_MMAX_DPC ((cpu_subtype_t) 1) /* 032 CPU */
#define CPU_SUBTYPE_SQT ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_MMAX_APC_FPU ((cpu_subtype_t) 3) /* 32081 FPU */
#define CPU_SUBTYPE_MMAX_APC_FPA ((cpu_subtype_t) 4) /* Weitek FPA */
#define CPU_SUBTYPE_MMAX_XPC ((cpu_subtype_t) 5) /* 532 CPU */
#define CPU_SUBTYPE_PC532 ((cpu_subtype_t) 6) /* pc532 board */
/*
* 80386/80486 subtypes.
*/
#define CPU_SUBTYPE_AT386 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_EXL ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_iPSC386 ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_SYMMETRY ((cpu_subtype_t) 4)
#define CPU_SUBTYPE_PS2 ((cpu_subtype_t) 5) /* PS/2 w/ MCA */
/*
* Mips subtypes.
*/
#define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
#define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
#define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
#define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
/*
* MC68030 subtypes.
*/
#define CPU_SUBTYPE_NeXT ((cpu_subtype_t) 1)
/* NeXt thinks MC68030 is 6 rather than 9 */
#define CPU_SUBTYPE_HP_340 ((cpu_subtype_t) 2)
/* 16.67 Mhz HP 300 series [HP 332,340] */
#define CPU_SUBTYPE_HP_360 ((cpu_subtype_t) 3)
/* 25.00 Mhz HP 300 series [HP 360] */
#define CPU_SUBTYPE_HP_370 ((cpu_subtype_t) 4)
/* 33.33 Mhz HP 300 series [HP 370] */
/*
* HPPA subtypes.
*/
#define CPU_SUBTYPE_HPPA_825 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_HPPA_835 ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_HPPA_840 ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_HPPA_850 ((cpu_subtype_t) 4)
#define CPU_SUBTYPE_HPPA_855 ((cpu_subtype_t) 5)
/*
* ARM subtypes.
*/
#define CPU_SUBTYPE_ARM_A500_ARCH ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_ARM_A500 ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_ARM_A440 ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_ARM_M4 ((cpu_subtype_t) 4)
#define CPU_SUBTYPE_ARM_A680 ((cpu_subtype_t) 5)
/*
* MC88000 subtypes.
*/
#define CPU_SUBTYPE_MMAX_JPC ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_LUNA88K ((cpu_subtype_t) 2)
/*
* Sparc subtypes.
*/
#define CPU_SUBTYPE_SUN4_260 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_SUN4_110 ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_SUN4_330 ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_SUN4C_60 ((cpu_subtype_t) 4)
#define CPU_SUBTYPE_SUN4C_65 ((cpu_subtype_t) 5)
#define CPU_SUBTYPE_SUN4C_20 ((cpu_subtype_t) 6)
#define CPU_SUBTYPE_SUN4C_30 ((cpu_subtype_t) 7)
#define CPU_SUBTYPE_SUN4C_40 ((cpu_subtype_t) 8)
#define CPU_SUBTYPE_SUN4C_50 ((cpu_subtype_t) 9)
#define CPU_SUBTYPE_SUN4C_75 ((cpu_subtype_t) 10)
/*
* i860 subtypes.
*/
#define CPU_SUBTYPE_iPSC860 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_OKI860 ((cpu_subtype_t) 2)
/*
* Alpha subtypes.
*/
#define CPU_SUBTYPE_ALPHA_EV3 ((cpu_subtype_t) 1)
#define CPU_SUBTYPE_ALPHA_EV4 ((cpu_subtype_t) 2)
#define CPU_SUBTYPE_ALPHA_ISP ((cpu_subtype_t) 3)
#define CPU_SUBTYPE_ALPHA_21064 ((cpu_subtype_t) 4)
#endif /* _MACH_MACHINE_H_ */