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