home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Headers / mach / machine.h < prev    next >
Text File  |  1997-04-27  |  10KB  |  318 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    machine.h,v $
  29.  * Revision 2.17  93/02/04  07:49:46  danner
  30.  *     PS2 support.
  31.  *     [93/01/18            prithvi]
  32.  * 
  33.  * Revision 2.16  93/01/14  17:44:40  danner
  34.  *     Cleanup.
  35.  *     [92/06/10            pds]
  36.  *     Added Alpha architecture, and some initial machine types.
  37.  *     [92/06/06            af]
  38.  * 
  39.  * Revision 2.15  92/08/03  17:18:04  jfriedl
  40.  *     Added pc532.
  41.  *     [92/05/15            jvh]
  42.  * 
  43.  * Revision 2.14  92/02/19  15:08:38  elf
  44.  *     Added more Sparc subtypes.
  45.  *     [92/02/19            rpd]
  46.  * 
  47.  * Revision 2.13  91/12/10  16:32:50  jsb
  48.  *     Fixes from Intel
  49.  *     [91/12/10  15:51:57  jsb]
  50.  * 
  51.  * Revision 2.12  91/07/31  17:53:56  dbg
  52.  *     Remove declaration of interrupt_stack - it is machine-dependent.
  53.  *     Changed CPU_SUBTYPE_LUNA88K - there's already a (potential)
  54.  *     mc88000 port.
  55.  *     [91/07/26            dbg]
  56.  * 
  57.  * Revision 2.11  91/07/09  23:22:06  danner
  58.  *        Added CPU_SUBTYPE_LUNA88K
  59.  *     [91/05/06            danner]
  60.  * 
  61.  * Revision 2.10  91/05/14  16:55:24  mrt
  62.  *     Correcting copyright
  63.  * 
  64.  * Revision 2.9  91/05/08  12:49:54  dbg
  65.  *     Add CPU_SUBTYPE_SYMMETRY.
  66.  *     [91/04/26  14:44:44  dbg]
  67.  * 
  68.  * Revision 2.8  91/02/05  17:33:48  mrt
  69.  *     Changed to new Mach copyright
  70.  *     [91/02/01  17:18:51  mrt]
  71.  * 
  72.  * Revision 2.7  90/12/04  14:51:27  jsb
  73.  *     Renamed CPU_SUBTYPE_iPSC2 as CPU_SUBTYPE_iPSC386.
  74.  *     [90/12/03  22:22:25  jsb]
  75.  * 
  76.  * Revision 2.6  90/11/25  17:48:28  jsb
  77.  *     Added CPU_TYPE_I860 and CPU_SUBTYPE_iPSC860.
  78.  *     [90/11/25  16:51:44  jsb]
  79.  * 
  80.  * Revision 2.5  90/09/23  17:45:42  jsb
  81.  *     Added CPU_SUBTYPE_iPSC2.
  82.  *     [90/09/21  16:43:01  jsb]
  83.  * 
  84.  * Revision 2.4  90/08/07  22:23:05  rpd
  85.  *     Added new MIPS subtypes for R3000, fix old defs.
  86.  *     [90/08/07  15:54:40  af]
  87.  * 
  88.  * Revision 2.2.4.1  90/06/11  10:59:52  af
  89.  *     Added new MIPS subtypes for R3000, fix old defs.
  90.  * 
  91.  * Revision 2.3  90/06/02  14:58:47  rpd
  92.  *     Picked up new cpu types.
  93.  *     [90/03/26  22:34:38  rpd]
  94.  * 
  95.  * Revision 2.2  89/11/29  14:09:32  af
  96.  *     Changes for MACH_KERNEL:
  97.  *     . Removed should_exit.
  98.  * 
  99.  *     17-May-1989 Randall W. Dean (rwd)
  100.  *     changed machine/vm_types.h to mach/vm_param.h
  101.  *     [89/05/23            dbg]
  102.  * 
  103.  * Revision 2.1  89/08/03  16:02:33  rwd
  104.  * Created.
  105.  * 
  106.  * Revision 2.11  89/04/18  16:43:32  mwyoung
  107.  *     Use <machine/vm_types.h> rather than <vm/vm_param.h> to get
  108.  *     VM types.  Remove old history... none of it was insightful.
  109.  * 
  110.  *     The variable declarations should be moved elsewhere.
  111.  *     [89/01/24            mwyoung]
  112.  * 
  113.  */
  114. /*    File:    machine.h
  115.  *    Author:    Avadis Tevanian, Jr.
  116.  *    Date:    1986
  117.  *
  118.  *    Machine independent machine abstraction.
  119.  */
  120.  
  121. #ifndef    _MACH_MACHINE_H_
  122. #define _MACH_MACHINE_H_
  123.  
  124. #import <mach/machine/vm_types.h>
  125. #import <mach/boolean.h>
  126.  
  127. /*
  128.  *    For each host, there is a maximum possible number of
  129.  *    cpus that may be available in the system.  This is the
  130.  *    compile-time constant NCPUS, which is defined in cpus.h.
  131.  *
  132.  *    In addition, there is a machine_slot specifier for each
  133.  *    possible cpu in the system.
  134.  */
  135.  
  136. struct machine_info {
  137.     integer_t    major_version;    /* kernel major version id */
  138.     integer_t    minor_version;    /* kernel minor version id */
  139.     integer_t    max_cpus;    /* max number of cpus compiled */
  140.     integer_t    avail_cpus;    /* number actually available */
  141.     vm_size_t    memory_size;    /* size of memory in bytes */
  142. };
  143.  
  144. typedef struct machine_info    *machine_info_t;
  145. typedef struct machine_info    machine_info_data_t;    /* bogus */
  146.  
  147. typedef integer_t    cpu_type_t;
  148. typedef integer_t    cpu_subtype_t;
  149.  
  150. #define CPU_STATE_MAX        3
  151.  
  152. #define CPU_STATE_USER        0
  153. #define CPU_STATE_SYSTEM    1
  154. #define CPU_STATE_IDLE        2
  155.  
  156. struct machine_slot {
  157. /*boolean_t*/integer_t    is_cpu;        /* is there a cpu in this slot? */
  158.     cpu_type_t    cpu_type;    /* type of cpu */
  159.     cpu_subtype_t    cpu_subtype;    /* subtype of cpu */
  160. /*boolean_t*/integer_t    running;    /* is cpu running */
  161.     integer_t    cpu_ticks[CPU_STATE_MAX];
  162.     integer_t    clock_freq;    /* clock interrupt frequency */
  163. };
  164.  
  165. typedef struct machine_slot    *machine_slot_t;
  166. typedef struct machine_slot    machine_slot_data_t;    /* bogus */
  167.  
  168. #ifdef    KERNEL
  169. extern struct machine_info    machine_info;
  170. extern struct machine_slot    machine_slot[];
  171.  
  172. extern vm_offset_t        interrupt_stack[];
  173. #endif    KERNEL
  174.  
  175. /*
  176.  *    Machine types known by all.
  177.  */
  178.  
  179. #define CPU_TYPE_ANY        ((cpu_type_t) -1)
  180.  
  181. #define CPU_TYPE_VAX        ((cpu_type_t) 1)
  182. /* skip                ((cpu_type_t) 2)    */
  183. /* skip                ((cpu_type_t) 3)    */
  184. /* skip                ((cpu_type_t) 4)    */
  185. /* skip                ((cpu_type_t) 5)    */
  186. #define    CPU_TYPE_MC680x0    ((cpu_type_t) 6)
  187. #define CPU_TYPE_I386        ((cpu_type_t) 7)
  188. /* skip CPU_TYPE_MIPS        ((cpu_type_t) 8)    */
  189. /* skip             ((cpu_type_t) 9)    */
  190. #define CPU_TYPE_MC98000    ((cpu_type_t) 10)
  191. #define CPU_TYPE_HPPA           ((cpu_type_t) 11)
  192. /* skip CPU_TYPE_ARM        ((cpu_type_t) 12)    */
  193. #define CPU_TYPE_MC88000    ((cpu_type_t) 13)
  194. #define CPU_TYPE_SPARC        ((cpu_type_t) 14)
  195. #define CPU_TYPE_I860        ((cpu_type_t) 15)
  196. /* skip    CPU_TYPE_ALPHA        ((cpu_type_t) 16)    */
  197.  
  198. /*
  199.  *    Machine subtypes (these are defined here, instead of in a machine
  200.  *    dependent directory, so that any program can get all definitions
  201.  *    regardless of where is it compiled).
  202.  */
  203.  
  204. /*
  205.  *    Object files that are hand-crafted to run on any
  206.  *    implementation of an architecture are tagged with
  207.  *    CPU_SUBTYPE_MULTIPLE.  This functions essentially the same as
  208.  *    the "ALL" subtype of an architecture except that it allows us
  209.  *    to easily find object files that may need to be modified
  210.  *    whenever a new implementation of an architecture comes out.
  211.  *
  212.  *    It is the responsibility of the implementor to make sure the
  213.  *    software handles unsupported implementations elegantly.
  214.  */
  215. #define    CPU_SUBTYPE_MULTIPLE        ((cpu_subtype_t) -1)
  216. #define CPU_SUBTYPE_LITTLE_ENDIAN    ((cpu_subtype_t) 0)
  217. #define CPU_SUBTYPE_BIG_ENDIAN        ((cpu_subtype_t) 1)
  218.  
  219. /*
  220.  *    VAX subtypes (these do *not* necessary conform to the actual cpu
  221.  *    ID assigned by DEC available via the SID register).
  222.  */
  223.  
  224. #define    CPU_SUBTYPE_VAX_ALL    ((cpu_subtype_t) 0) 
  225. #define CPU_SUBTYPE_VAX780    ((cpu_subtype_t) 1)
  226. #define CPU_SUBTYPE_VAX785    ((cpu_subtype_t) 2)
  227. #define CPU_SUBTYPE_VAX750    ((cpu_subtype_t) 3)
  228. #define CPU_SUBTYPE_VAX730    ((cpu_subtype_t) 4)
  229. #define CPU_SUBTYPE_UVAXI    ((cpu_subtype_t) 5)
  230. #define CPU_SUBTYPE_UVAXII    ((cpu_subtype_t) 6)
  231. #define CPU_SUBTYPE_VAX8200    ((cpu_subtype_t) 7)
  232. #define CPU_SUBTYPE_VAX8500    ((cpu_subtype_t) 8)
  233. #define CPU_SUBTYPE_VAX8600    ((cpu_subtype_t) 9)
  234. #define CPU_SUBTYPE_VAX8650    ((cpu_subtype_t) 10)
  235. #define CPU_SUBTYPE_VAX8800    ((cpu_subtype_t) 11)
  236. #define CPU_SUBTYPE_UVAXIII    ((cpu_subtype_t) 12)
  237.  
  238. /*
  239.  *     680x0 subtypes
  240.  *
  241.  * The subtype definitions here are unusual for historical reasons.
  242.  * NeXT used to consider 68030 code as generic 68000 code.  For
  243.  * backwards compatability:
  244.  * 
  245.  *    CPU_SUBTYPE_MC68030 symbol has been preserved for source code
  246.  *    compatability.
  247.  *
  248.  *    CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
  249.  *    subtype as CPU_SUBTYPE_MC68030 for binary comatability.
  250.  *
  251.  *    CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
  252.  *    files to be tagged as containing 68030-specific instructions.
  253.  */
  254.  
  255. #define    CPU_SUBTYPE_MC680x0_ALL        ((cpu_subtype_t) 1)
  256. #define CPU_SUBTYPE_MC68030        ((cpu_subtype_t) 1) /* compat */
  257. #define CPU_SUBTYPE_MC68040        ((cpu_subtype_t) 2) 
  258. #define    CPU_SUBTYPE_MC68030_ONLY    ((cpu_subtype_t) 3)
  259.  
  260. /*
  261.  *    I386 subtypes.
  262.  */
  263.  
  264. #define    CPU_SUBTYPE_I386_ALL    ((cpu_subtype_t) 3)
  265. #define CPU_SUBTYPE_386        ((cpu_subtype_t) 3)
  266. #define CPU_SUBTYPE_486        ((cpu_subtype_t) 4)
  267. #define CPU_SUBTYPE_486SX    ((cpu_subtype_t) 4 + 128)
  268. #define CPU_SUBTYPE_586        ((cpu_subtype_t) 5)
  269. #define CPU_SUBTYPE_586SX    ((cpu_subtype_t) 5 + 128)
  270.  
  271. /*
  272.  *    Mips subtypes.
  273.  */
  274.  
  275. #define    CPU_SUBTYPE_MIPS_ALL    ((cpu_subtype_t) 0)
  276. #define CPU_SUBTYPE_MIPS_R2300    ((cpu_subtype_t) 1)
  277. #define CPU_SUBTYPE_MIPS_R2600    ((cpu_subtype_t) 2)
  278. #define CPU_SUBTYPE_MIPS_R2800    ((cpu_subtype_t) 3)
  279. #define CPU_SUBTYPE_MIPS_R2000a    ((cpu_subtype_t) 4)    /* pmax */
  280. #define CPU_SUBTYPE_MIPS_R2000    ((cpu_subtype_t) 5)
  281. #define CPU_SUBTYPE_MIPS_R3000a    ((cpu_subtype_t) 6)    /* 3max */
  282. #define CPU_SUBTYPE_MIPS_R3000    ((cpu_subtype_t) 7)
  283.  
  284. /*
  285.  *    MC98000 (PowerPC) subtypes
  286.  */
  287. #define    CPU_SUBTYPE_MC98000_ALL    ((cpu_subtype_t) 0)
  288. #define CPU_SUBTYPE_MC98601    ((cpu_subtype_t) 1)
  289.  
  290. /*
  291.  *    HPPA subtypes for Hewlett-Packard HP-PA family of
  292.  *    risc processors. Port by NeXT to 700 series. 
  293.  */
  294.  
  295. #define    CPU_SUBTYPE_HPPA_ALL        ((cpu_subtype_t) 0)
  296. #define CPU_SUBTYPE_HPPA_7100        ((cpu_subtype_t) 0) /* compat */
  297. #define CPU_SUBTYPE_HPPA_7100LC        ((cpu_subtype_t) 1)
  298.  
  299. /*
  300.  *    MC88000 subtypes.
  301.  */
  302. #define    CPU_SUBTYPE_MC88000_ALL    ((cpu_subtype_t) 0)
  303. #define CPU_SUBTYPE_MC88100    ((cpu_subtype_t) 1)
  304. #define CPU_SUBTYPE_MC88110    ((cpu_subtype_t) 2)
  305.  
  306. /*
  307.  *    SPARC subtypes
  308.  */
  309. #define    CPU_SUBTYPE_SPARC_ALL        ((cpu_subtype_t) 0)
  310.  
  311. /*
  312.  *    I860 subtypes
  313.  */
  314. #define CPU_SUBTYPE_I860_ALL    ((cpu_subtype_t) 0)
  315. #define CPU_SUBTYPE_I860_860    ((cpu_subtype_t) 1)
  316.  
  317. #endif    _MACH_MACHINE_H_
  318.