]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/mips/include/param.h
MFV on tzdata2008e:
[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  * 4. 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 _MACHINE_PARAM_H_
43 #define _MACHINE_PARAM_H_
44
45 #include <sys/cdefs.h>
46 #ifdef _KERNEL
47 #ifdef _LOCORE
48 #include <machine/psl.h>
49 #else
50 #include <machine/cpu.h>
51 #endif
52 #endif
53
54 #define __PCI_REROUTE_INTERRUPT
55
56 #ifndef MACHINE
57 #define MACHINE         "mips"
58 #endif
59 #ifndef MACHINE_ARCH
60 #define MACHINE_ARCH    "mips"
61 #endif
62
63 /*
64  * OBJFORMAT_NAMES is a comma-separated list of the object formats
65  * that are supported on the architecture.
66  */
67 #define OBJFORMAT_NAMES         "elf"
68 #define OBJFORMAT_DEFAULT       "elf"
69
70 #define MID_MACHINE     0       /* None but has to be defined */
71
72 #ifdef SMP
73 #define MAXSMPCPU       16
74 #define MAXCPU          MAXSMPCPU
75 #else
76 #define MAXSMPCPU       1
77 #define MAXCPU          1
78 #endif
79
80 /*
81  * Round p (pointer or byte index) up to a correctly-aligned value for all
82  * data types (int, long, ...).   The result is u_int and must be cast to
83  * any desired pointer type.
84  */
85 #define _ALIGNBYTES     7
86 #define _ALIGN(p)       (((u_int)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
87 #define ALIGNED_POINTER(p, t)   ((((u_int32_t)(p)) & (sizeof (t) - 1)) == 0)
88
89 #define ALIGNBYTES      _ALIGNBYTES
90 #define ALIGN(p)        _ALIGN(p)
91
92 #define NBPG            4096            /* bytes/page */
93 #define PGOFSET         (NBPG-1)        /* byte offset into page */
94 #define PGSHIFT         12              /* LOG2(NBPG) */
95
96 #define PAGE_SHIFT      12              /* LOG2(PAGE_SIZE) */
97 #define PAGE_SIZE       (1<<PAGE_SHIFT) /* bytes/page */
98 #define PAGE_MASK       (PAGE_SIZE-1)
99 #define NPTEPG          (PAGE_SIZE/(sizeof (pt_entry_t)))
100
101 #define NBSEG           0x400000        /* bytes/segment */
102 #define SEGOFSET        (NBSEG-1)       /* byte offset into segment */
103 #define SEGSHIFT        22              /* LOG2(NBSEG) */
104
105 /* XXXimp: This has moved to vmparam.h */
106 /* Also, this differs from the mips2 definition, but likely is better */
107 /* since this means the kernel won't chew up TLBs when it is executing */
108 /* code */
109 #define KERNBASE        0x80000000      /* start of kernel virtual */
110 #define BTOPKERNBASE    ((u_long)KERNBASE >> PGSHIFT)
111
112 #define DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
113 #define BLKDEV_IOSIZE   2048
114 #define DFLTPHYS        (64 * 1024)     /* default max raw I/O transfer size */
115
116 #define MAXPHYS         (128 * 1024)    /* max raw I/O transfer size */
117
118 #define MAXDUMPPGS      1
119
120 #define CLSIZE          1
121 #define CLBYTES         (CLSIZE * NBPG)
122 #define CLSIZELOG2      0
123
124 /*
125  * NOTE: In FreeBSD, Uarea's don't have a fixed address.
126  *       Therefore, any code imported from OpenBSD which depends on
127  *       UADDR, UVPN and KERNELSTACK requires porting.
128  */
129 #define KSTACK_PAGES            3       /* kernel stack*/
130 #define KSTACK_GUARD_PAGES      0       /* pages of kstack guard; 0 disables */
131
132 #define UPAGES                  2
133
134 /*
135  * Constants related to network buffer management.
136  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
137  * on machines that exchange pages of input or output buffers with mbuf
138  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
139  * of the hardware page size.
140  */
141 #ifndef MSIZE
142 #define MSIZE           256             /* size of an mbuf */
143 #endif /* MSIZE */
144
145 #ifndef MCLSHIFT
146 #define MCLSHIFT        11
147 #endif /* MCLSHIFT */
148 #define MCLBYTES        (1 << MCLSHIFT) /* enough for whole Ethernet packet */
149 #define MCLOFSET        (MCLBYTES - 1)
150
151 /*
152  * Size of kernel malloc arena in CLBYTES-sized logical pages
153  */
154 #ifndef NKMEMCLUSTERS
155 #define NKMEMCLUSTERS   (4096*1024/CLBYTES)
156 #endif
157
158 /* pages ("clicks") (4096 bytes) to disk blocks */
159 #define ctod(x)         ((x) << (PGSHIFT - DEV_BSHIFT))
160 #define dtoc(x)         ((x) >> (PGSHIFT - DEV_BSHIFT))
161
162 /* pages to bytes */
163 #define ctob(x)         ((x) << PGSHIFT)
164 #define btoc(x)         (((x) + PGOFSET) >> PGSHIFT)
165
166 /* bytes to disk blocks */
167 #define btodb(x)        ((x) >> DEV_BSHIFT)
168 #define dbtob(x)        ((x) << DEV_BSHIFT)
169
170 /*
171  * Map a ``block device block'' to a file system block.
172  * This should be device dependent, and should use the bsize
173  * field from the disk label.
174  * For now though just use DEV_BSIZE.
175  */
176 #define bdbtofsb(bn)    ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
177
178 /*
179  * Conversion macros
180  */
181 #define mips_round_page(x)      ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
182 #define mips_trunc_page(x)      ((unsigned)(x) & ~(NBPG-1))
183 #define mips_btop(x)            ((unsigned)(x) >> PGSHIFT)
184 #define mips_ptob(x)            ((unsigned)(x) << PGSHIFT)
185 #define round_page              mips_round_page
186 #define trunc_page              mips_trunc_page
187 #define atop(x)                 ((unsigned long)(x) >> PAGE_SHIFT)
188 #define ptoa(x)                 ((unsigned long)(x) << PAGE_SHIFT)
189
190 #define pgtok(x)                ((x) * (PAGE_SIZE / 1024))
191
192 #ifndef _KERNEL
193 #define DELAY(n)        { register int N = (n); while (--N > 0); }
194 #endif /* !_KERNEL */
195
196 #endif /* !_MACHINE_PARAM_H_ */