]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/mips/include/param.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306956, and update
[FreeBSD/FreeBSD.git] / sys / mips / include / param.h
1 /*      $OpenBSD: param.h,v 1.11 1998/08/30 22:05:35 millert Exp $ */
2
3 /*-
4  * Copyright (c) 1988 University of Utah.
5  * Copyright (c) 1992, 1993
6  *      The Regents of the University of California.  All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * the Systems Programming Group of the University of Utah Computer
10  * Science Department and Ralph Campbell.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *      from: Utah Hdr: machparam.h 1.11 89/08/14
37  *      from: @(#)param.h       8.1 (Berkeley) 6/10/93
38  *      JNPR: param.h,v 1.6.2.1 2007/09/10 07:49:36 girish
39  * $FreeBSD$
40  */
41
42 #ifndef _MIPS_INCLUDE_PARAM_H_
43 #define _MIPS_INCLUDE_PARAM_H_
44
45 #include <machine/_align.h>
46
47 #include <sys/cdefs.h>
48 #ifdef _KERNEL
49 #ifndef _LOCORE
50 #include <machine/cpu.h>
51 #endif
52 #endif
53
54 #define __PCI_REROUTE_INTERRUPT
55
56 #if _BYTE_ORDER == _BIG_ENDIAN
57 # define _EL_SUFFIX ""
58 #else
59 # define _EL_SUFFIX "el"
60 #endif
61
62 #ifdef __mips_n64
63 # define _N64_SUFFIX "64"
64 #elif defined(__mips_n32)
65 # define _N64_SUFFIX "n32"
66 #else
67 # define _N64_SUFFIX ""
68 #endif
69
70 #ifdef __mips_hard_float
71 # define _HF_SUFFIX "hf"
72 #else
73 # define _HF_SUFFIX ""
74 #endif
75
76 #ifndef MACHINE
77 # define MACHINE        "mips"
78 #endif
79 #ifndef MACHINE_ARCH
80 # define MACHINE_ARCH   "mips" _N64_SUFFIX _EL_SUFFIX _HF_SUFFIX
81 #endif
82 #ifdef __mips_n64
83 # ifndef MACHINE_ARCH32
84 #  define MACHINE_ARCH32 "mips" _EL_SUFFIX _HF_SUFFIX
85 # endif
86 #endif
87
88 /*
89  * OBJFORMAT_NAMES is a comma-separated list of the object formats
90  * that are supported on the architecture.
91  */
92 #define OBJFORMAT_NAMES         "elf"
93 #define OBJFORMAT_DEFAULT       "elf"
94
95 #define MID_MACHINE     0       /* None but has to be defined */
96
97 #ifdef SMP
98 #define MAXSMPCPU       32
99 #ifndef MAXCPU
100 #define MAXCPU          MAXSMPCPU
101 #endif
102 #else
103 #define MAXSMPCPU       1
104 #define MAXCPU          1
105 #endif
106
107 #ifndef MAXMEMDOM
108 #define MAXMEMDOM       1
109 #endif
110
111 /*
112  * Round p (pointer or byte index) up to a correctly-aligned value for all
113  * data types (int, long, ...).   The result is u_int and must be cast to
114  * any desired pointer type.
115  */
116
117 #define ALIGNBYTES      _ALIGNBYTES
118 #define ALIGN(p)        _ALIGN(p)
119 /*
120  * ALIGNED_POINTER is a boolean macro that checks whether an address
121  * is valid to fetch data elements of type t from on this architecture.
122  * This does not reflect the optimal alignment, just the possibility
123  * (within reasonable limits). 
124  */
125 #define ALIGNED_POINTER(p, t)   ((((unsigned long)(p)) & (sizeof (t) - 1)) == 0)
126
127 /*
128  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
129  * architecture.  It should be used with appropriate caution.
130  */
131 #define CACHE_LINE_SHIFT        6
132 #define CACHE_LINE_SIZE         (1 << CACHE_LINE_SHIFT)
133
134 #define PAGE_SHIFT              12              /* LOG2(PAGE_SIZE) */
135 #define PAGE_SIZE               (1<<PAGE_SHIFT) /* bytes/page */
136 #define PAGE_MASK               (PAGE_SIZE-1)
137
138 #define NPTEPG                  (PAGE_SIZE/(sizeof (pt_entry_t)))
139 #define NPDEPG                  (PAGE_SIZE/(sizeof (pd_entry_t)))
140
141 #if defined(__mips_n32) || defined(__mips_n64) /*  PHYSADDR_64_BIT */
142 #define NPTEPGSHIFT             9               /* LOG2(NPTEPG) */
143 #else
144 #define NPTEPGSHIFT             10               /* LOG2(NPTEPG) */
145 #endif
146
147 #ifdef __mips_n64
148 #define NPDEPGSHIFT             9               /* LOG2(NPTEPG) */
149 #define SEGSHIFT                (PAGE_SHIFT + NPTEPGSHIFT + NPDEPGSHIFT)
150 #define NBSEG                   (1ul << SEGSHIFT)
151 #define PDRSHIFT                (PAGE_SHIFT + NPTEPGSHIFT)
152 #define PDRSIZE                 (1ul << PDRSHIFT)
153 #define PDRMASK                 ((1 << PDRSHIFT) - 1)
154 #else
155 #define NPDEPGSHIFT             10               /* LOG2(NPTEPG) */
156 #define SEGSHIFT                (PAGE_SHIFT + NPTEPGSHIFT)
157 #define NBSEG                   (1 << SEGSHIFT) /* bytes/segment */
158 #define PDRSHIFT                SEGSHIFT        /* alias for SEG in 32 bit */
159 #define PDRSIZE                 (1ul << PDRSHIFT)
160 #define PDRMASK                 ((1 << PDRSHIFT) - 1)
161 #endif
162 #define NBPDR                   (1 << PDRSHIFT) /* bytes/pagedir */
163 #define SEGMASK                 (NBSEG - 1)     /* byte offset into segment */
164
165 #define MAXPAGESIZES            1               /* max supported pagesizes */
166
167 #define MAXDUMPPGS              1               /* xxx: why is this only one? */
168
169 /*
170  * The kernel stack needs to be aligned on a (PAGE_SIZE * 2) boundary.
171  */
172 #define KSTACK_PAGES            2       /* kernel stack */
173 #define KSTACK_GUARD_PAGES      2       /* pages of kstack guard; 0 disables */
174
175 /*
176  * Mach derived conversion macros
177  */
178 #define round_page(x)           (((x) + PAGE_MASK) & ~PAGE_MASK)
179 #define trunc_page(x)           ((x) & ~PAGE_MASK)
180
181 #define atop(x)                 ((x) >> PAGE_SHIFT)
182 #define ptoa(x)                 ((x) << PAGE_SHIFT)
183
184 #define pgtok(x)                ((x) * (PAGE_SIZE / 1024))
185
186 #ifdef _KERNEL
187 #define NO_FUEWORD      1
188 #endif
189
190 #endif /* !_MIPS_INCLUDE_PARAM_H_ */