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