home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / mach / machine.h < prev    next >
Text File  |  1993-10-19  |  9KB  |  306 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * Copyright (c) 1988 Carnegie-Mellon University
  5.  * Copyright (c) 1987 Carnegie-Mellon University
  6.  * All rights reserved.  The CMU software License Agreement specifies
  7.  * the terms and conditions for use and redistribution.
  8.  */
  9. /*
  10.  * HISTORY
  11.  * $Log:    machine.h,v $
  12.  * 11 September 1992 David E. Bohman at NeXT
  13.  *    Added CPU_SUBTYPE_486SX to the i386 family.
  14.  *
  15.  * 16 July 1992 David E. Bohman at NeXT
  16.  *    Added CPU_SUBTYPE_586 to the i386 family.
  17.  *
  18.  * 17-Dec-91  Peter King (king) at NeXT
  19.  *    Added support for the XXX_ALL subtypes.  These are used to
  20.  *    tag object files that can run on any implementation of a
  21.  *    particular family.
  22.  *
  23.  *  1-Mar-90  John Seamons (jks) at NeXT
  24.  *    Redefined cpu_type and cpu_subtype definitions to indicate processor
  25.  *    architecture instead of product types for the MC680x0.
  26.  *
  27.  * Revision 2.15  89/10/11  14:39:56  dlb
  28.  *     Removed should_exit - replaced by action thread.
  29.  *     [89/01/25            dlb]
  30.  * 
  31.  * Revision 2.14  89/07/14  17:21:39  rvb
  32.  *     Added CPU types and subtypes for MC68030, MC68040, MC88000,
  33.  *     HPPA, ARM and Sun4-SPARC.
  34.  *     [89/07/13            mrt]
  35.  * 
  36.  * Revision 2.12  89/05/30  10:38:58  rvb
  37.  *     Add R2000 machine types.
  38.  *     [89/05/30  08:28:53  rvb]
  39.  * 
  40.  * Revision 2.11  89/04/18  16:43:32  mwyoung
  41.  *     Use <machine/vm_types.h> rather than <vm/vm_param.h> to get
  42.  *     VM types.  Remove old history... none of it was insightful.
  43.  * 
  44.  *     The variable declarations should be moved elsewhere.
  45.  *     [89/01/24            mwyoung]
  46.  * 
  47.  */
  48. /*
  49.  *    Machine independent machine abstraction.
  50.  *    Copyright (C) 1986, Avadis Tevanian, Jr.
  51.  */
  52.  
  53. #ifndef    _MACH_MACHINE_H_
  54. #define _MACH_MACHINE_H_
  55.  
  56. #import <mach/machine/vm_types.h>
  57. #import <mach/boolean.h>
  58.  
  59. /*
  60.  *    For each host, there is a maximum possible number of
  61.  *    cpus that may be available in the system.  This is the
  62.  *    compile-time constant NCPUS, which is defined in cpus.h.
  63.  *
  64.  *    In addition, there is a machine_slot specifier for each
  65.  *    possible cpu in the system.
  66.  */
  67.  
  68. struct machine_info {
  69.     int        major_version;    /* kernel major version id */
  70.     int        minor_version;    /* kernel minor version id */
  71.     int        max_cpus;    /* max number of cpus compiled */
  72.     int        avail_cpus;    /* number actually available */
  73.     vm_size_t    memory_size;    /* size of memory in bytes */
  74. };
  75.  
  76. typedef struct machine_info    *machine_info_t;
  77. typedef struct machine_info    machine_info_data_t;    /* bogus */
  78.  
  79. typedef int    cpu_type_t;
  80. typedef int    cpu_subtype_t;
  81.  
  82. #define CPU_STATE_MAX        3
  83.  
  84. #define CPU_STATE_USER        0
  85. #define CPU_STATE_SYSTEM    1
  86. #define CPU_STATE_IDLE        2
  87.  
  88. struct machine_slot {
  89.     boolean_t    is_cpu;        /* is there a cpu in this slot? */
  90.     cpu_type_t    cpu_type;    /* type of cpu */
  91.     cpu_subtype_t    cpu_subtype;    /* subtype of cpu */
  92.     volatile boolean_t running;    /* is cpu running */
  93.     long        cpu_ticks[CPU_STATE_MAX];
  94.     int        clock_freq;    /* clock interrupt frequency */
  95. };
  96.  
  97. typedef struct machine_slot    *machine_slot_t;
  98. typedef struct machine_slot    machine_slot_data_t;    /* bogus */
  99.  
  100. #ifdef    KERNEL
  101. extern struct machine_info    machine_info;
  102. extern struct machine_slot    machine_slot[];
  103.  
  104. extern vm_offset_t        interrupt_stack[];
  105. #endif    KERNEL
  106.  
  107. /*
  108.  *    Machine types known by all.
  109.  */
  110.  
  111. #define CPU_TYPE_ANY        ((cpu_type_t) -1)
  112.  
  113. #define CPU_TYPE_VAX        ((cpu_type_t) 1)
  114. #define CPU_TYPE_ROMP        ((cpu_type_t) 2)
  115. #define CPU_TYPE_NS32032    ((cpu_type_t) 4)
  116. #define CPU_TYPE_NS32332        ((cpu_type_t) 5)
  117. #define    CPU_TYPE_MC680x0    ((cpu_type_t) 6)
  118. #define CPU_TYPE_I386        ((cpu_type_t) 7)
  119. #define CPU_TYPE_MIPS        ((cpu_type_t) 8)
  120. #define CPU_TYPE_NS32532        ((cpu_type_t) 9)
  121. #define CPU_TYPE_HPPA           ((cpu_type_t) 11)
  122. #define CPU_TYPE_ARM        ((cpu_type_t) 12)
  123. #define CPU_TYPE_MC88000    ((cpu_type_t) 13)
  124. #define CPU_TYPE_SPARC        ((cpu_type_t) 14)
  125. #define CPU_TYPE_I860        ((cpu_type_t) 15) // big-endian
  126. #define    CPU_TYPE_I860_LITTLE    ((cpu_type_t) 16) // little-endian
  127. #define CPU_TYPE_RS6000        ((cpu_type_t) 17)
  128. #define CPU_TYPE_MC98000    ((cpu_type_t) 18)
  129.         
  130.  
  131. /*
  132.  *    Machine subtypes (these are defined here, instead of in a machine
  133.  *    dependent directory, so that any program can get all definitions
  134.  *    regardless of where is it compiled).
  135.  */
  136.  
  137. /*
  138.  *    Object files that are hand-crafted to run on any
  139.  *    implementation of an architecture are tagged with
  140.  *    CPU_SUBTYPE_MULTIPLE.  This functions essentially the same as
  141.  *    the "ALL" subtype of an architecture except that it allows us
  142.  *    to easily find object files that may need to be modified
  143.  *    whenever a new implementation of an architecture comes out.
  144.  *
  145.  *    It is the responsibility of the implementor to make sure the
  146.  *    software handles unsupported implementations elegantly.
  147.  */
  148. #define    CPU_SUBTYPE_MULTIPLE    ((cpu_subtype_t) -1)
  149.  
  150.  
  151. /*
  152.  *    VAX subtypes (these do *not* necessary conform to the actual cpu
  153.  *    ID assigned by DEC available via the SID register).
  154.  */
  155.  
  156. #define    CPU_SUBTYPE_VAX_ALL    ((cpu_subtype_t) 0) 
  157. #define CPU_SUBTYPE_VAX780    ((cpu_subtype_t) 1)
  158. #define CPU_SUBTYPE_VAX785    ((cpu_subtype_t) 2)
  159. #define CPU_SUBTYPE_VAX750    ((cpu_subtype_t) 3)
  160. #define CPU_SUBTYPE_VAX730    ((cpu_subtype_t) 4)
  161. #define CPU_SUBTYPE_UVAXI    ((cpu_subtype_t) 5)
  162. #define CPU_SUBTYPE_UVAXII    ((cpu_subtype_t) 6)
  163. #define CPU_SUBTYPE_VAX8200    ((cpu_subtype_t) 7)
  164. #define CPU_SUBTYPE_VAX8500    ((cpu_subtype_t) 8)
  165. #define CPU_SUBTYPE_VAX8600    ((cpu_subtype_t) 9)
  166. #define CPU_SUBTYPE_VAX8650    ((cpu_subtype_t) 10)
  167. #define CPU_SUBTYPE_VAX8800    ((cpu_subtype_t) 11)
  168. #define CPU_SUBTYPE_UVAXIII    ((cpu_subtype_t) 12)
  169.  
  170. /*
  171.  *    ROMP subtypes.
  172.  */
  173.  
  174. #define    CPU_SUBTYPE_RT_ALL    ((cpu_subtype_t) 0)
  175. #define CPU_SUBTYPE_RT_PC    ((cpu_subtype_t) 1)
  176. #define CPU_SUBTYPE_RT_APC    ((cpu_subtype_t) 2)
  177. #define CPU_SUBTYPE_RT_135    ((cpu_subtype_t) 3)
  178.  
  179. /*
  180.  *    32032/32332/32532 subtypes.
  181.  */
  182.  
  183. #define    CPU_SUBTYPE_MMAX_ALL        ((cpu_subtype_t) 0)
  184. #define CPU_SUBTYPE_MMAX_DPC        ((cpu_subtype_t) 1)    /* 032 CPU */
  185. #define CPU_SUBTYPE_SQT            ((cpu_subtype_t) 2)
  186. #define CPU_SUBTYPE_MMAX_APC_FPU    ((cpu_subtype_t) 3)    /* 32081 FPU */
  187. #define CPU_SUBTYPE_MMAX_APC_FPA    ((cpu_subtype_t) 4)    /* Weitek FPA */
  188. #define CPU_SUBTYPE_MMAX_XPC        ((cpu_subtype_t) 5)    /* 532 CPU */
  189.  
  190. /*
  191.  *    I386 subtypes.
  192.  */
  193.  
  194. #define    CPU_SUBTYPE_I386_ALL    ((cpu_subtype_t) 3)
  195. #define CPU_SUBTYPE_386        ((cpu_subtype_t) 3)
  196. #define CPU_SUBTYPE_486        ((cpu_subtype_t) 4)
  197. #define CPU_SUBTYPE_486SX    ((cpu_subtype_t) 4 + 128)
  198. #define CPU_SUBTYPE_586        ((cpu_subtype_t) 5)
  199. #define CPU_SUBTYPE_586SX    ((cpu_subtype_t) 5 + 128)
  200.  
  201. /*
  202.  *    Mips subtypes.
  203.  */
  204.  
  205. #define    CPU_SUBTYPE_MIPS_ALL    ((cpu_subtype_t) 0)
  206. #define CPU_SUBTYPE_MIPS_R2300    ((cpu_subtype_t) 1)
  207. #define CPU_SUBTYPE_MIPS_R2600    ((cpu_subtype_t) 2)
  208. #define CPU_SUBTYPE_MIPS_R2800    ((cpu_subtype_t) 3)
  209. #define CPU_SUBTYPE_MIPS_R2000a    ((cpu_subtype_t) 4)
  210.  
  211. /*
  212.  *     680x0 subtypes
  213.  *
  214.  * The subtype definitions here are unusual for historical reasons.
  215.  * NeXT used to consider 68030 code as generic 68000 code.  For
  216.  * backwards compatability:
  217.  * 
  218.  *    CPU_SUBTYPE_MC68030 symbol has been preserved for source code
  219.  *    compatability.
  220.  *
  221.  *    CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
  222.  *    subtype as CPU_SUBTYPE_MC68030 for binary comatability.
  223.  *
  224.  *    CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
  225.  *    files to be tagged as containing 68030-specific instructions.
  226.  */
  227.  
  228. #define    CPU_SUBTYPE_MC680x0_ALL        ((cpu_subtype_t) 1)
  229. #define CPU_SUBTYPE_MC68030        ((cpu_subtype_t) 1) // compat
  230. #define CPU_SUBTYPE_MC68040        ((cpu_subtype_t) 2) 
  231. #define    CPU_SUBTYPE_MC68030_ONLY    ((cpu_subtype_t) 3)
  232.  
  233. /*
  234.  *    HPPA subtypes  Hewlett-Packard HP-PA family of
  235.  *    risc processors 800 series workstations.
  236.  *    Port done by Hewlett-Packard
  237.  */
  238.  
  239. #define    CPU_SUBTYPE_HPPA_ALL    ((cpu_subtype_t) 0)
  240. #define CPU_SUBTYPE_HPPA_825    ((cpu_subtype_t) 1)
  241. #define CPU_SUBTYPE_HPPA_835    ((cpu_subtype_t) 2)
  242. #define CPU_SUBTYPE_HPPA_840    ((cpu_subtype_t) 3)
  243. #define CPU_SUBTYPE_HPPA_850    ((cpu_subtype_t) 4)
  244. #define CPU_SUBTYPE_HPPA_855    ((cpu_subtype_t) 5)
  245.  
  246. /* 
  247.  *     Acorn subtypes - Acorn Risc Machine port done by
  248.  *        Olivetti System Software Laboratory
  249.  */
  250.  
  251. #define    CPU_SUBTYPE_ARM_ALL        ((cpu_subtype_t) 0)
  252. #define CPU_SUBTYPE_ARM_A500_ARCH    ((cpu_subtype_t) 1)
  253. #define CPU_SUBTYPE_ARM_A500        ((cpu_subtype_t) 2)
  254. #define CPU_SUBTYPE_ARM_A440        ((cpu_subtype_t) 3)
  255. #define CPU_SUBTYPE_ARM_M4        ((cpu_subtype_t) 4)
  256. #define CPU_SUBTYPE_ARM_A680        ((cpu_subtype_t) 5)
  257.  
  258. /*
  259.  *    MC88000 subtypes
  260.  */
  261. #define    CPU_SUBTYPE_MC88000_ALL    ((cpu_subtype_t) 0)
  262. #define CPU_SUBTYPE_MMAX_JPC    ((cpu_subtype_t) 1)
  263. #define CPU_SUBTYPE_MC88100    ((cpu_subtype_t) 1)
  264. #define CPU_SUBTYPE_MC88110    ((cpu_subtype_t) 2)
  265.  
  266. /*
  267.  *    MC98000 (PowerPC) subtypes
  268.  */
  269. #define    CPU_SUBTYPE_MC98000_ALL    ((cpu_subtype_t) 0)
  270. #define CPU_SUBTYPE_MC98601    ((cpu_subtype_t) 1)
  271.  
  272. /*
  273.  *    I860 subtypes
  274.  */
  275. #define CPU_SUBTYPE_I860_ALL    ((cpu_subtype_t) 0)
  276. #define CPU_SUBTYPE_I860_860    ((cpu_subtype_t) 1)
  277.  
  278. /*
  279.  *     I860 subtypes for NeXT-internal backwards compatability.
  280.  *    These constants will be going away.  DO NOT USE THEM!!!
  281.  */
  282. #define CPU_SUBTYPE_LITTLE_ENDIAN    ((cpu_subtype_t) 0)
  283. #define CPU_SUBTYPE_BIG_ENDIAN        ((cpu_subtype_t) 1)
  284.  
  285. /*
  286.  *    I860_LITTLE subtypes
  287.  */
  288. #define    CPU_SUBTYPE_I860_LITTLE_ALL    ((cpu_subtype_t) 0)
  289. #define    CPU_SUBTYPE_I860_LITTLE    ((cpu_subtype_t) 1)
  290.  
  291. /*
  292.  *    RS6000 subtypes
  293.  */
  294. #define    CPU_SUBTYPE_RS6000_ALL    ((cpu_subtype_t) 0)
  295. #define CPU_SUBTYPE_RS6000    ((cpu_subtype_t) 1)
  296.  
  297. /*
  298.  *    Sun4 subtypes - port done at CMU
  299.  */
  300. #define    CPU_SUBTYPE_SUN4_ALL        ((cpu_subtype_t) 0)
  301. #define CPU_SUBTYPE_SUN4_260        ((cpu_subtype_t) 1)
  302. #define CPU_SUBTYPE_SUN4_110        ((cpu_subtype_t) 2)
  303.  
  304.  
  305. #endif    _MACH_MACHINE_H_
  306.