No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / mips / include / mips_param.h
bloba3de7f4a9d9fc09a64d4a8e0506fa4e8d0be4621
1 /* $NetBSD: mips_param.h,v 1.25 2009/08/13 05:15:09 matt Exp $ */
3 #ifdef _KERNEL
4 #include <machine/cpu.h>
5 #endif
7 /*
8 * No reason this can't be common
9 */
10 #if defined(__MIPSEB__)
11 # if defined(__mips_n32) || defined(__mips_n64)
12 # define _MACHINE_ARCH mips64eb
13 # define MACHINE_ARCH "mips64eb"
14 # define _MACHINE32_ARCH mipseb
15 # define MACHINE32_ARCH "mipseb"
16 # else
17 # define _MACHINE_ARCH mipseb
18 # define MACHINE_ARCH "mipseb"
19 # endif
20 #elif defined(__MIPSEL__)
21 # if defined(__mips_n32) || defined(__mips_n64)
22 # define _MACHINE_ARCH mips64el
23 # define MACHINE_ARCH "mips64el"
24 # define _MACHINE32_ARCH mipsel
25 # define MACHINE32_ARCH "mipsel"
26 # else
27 # define _MACHINE_ARCH mipsel
28 # define MACHINE_ARCH "mipsel"
29 #endif
30 #else
31 #error neither __MIPSEL__ nor __MIPSEB__ are defined.
32 #endif
35 * On mips, UPAGES is fixed by sys/arch/mips/mips/locore code
36 * to be the number of per-process-wired kernel-stack pages/PTES.
39 #define SSIZE 1 /* initial stack size/NBPG */
40 #define SINCR 1 /* increment of stack/NBPG */
42 #ifdef ENABLE_MIPS_16KB_PAGE
43 #define UPAGES 1 /* pages of u-area */
44 #define USPACE (UPAGES*NBPG) /* size of u-area in bytes */
45 #elif defined(ENABLE_MIPS_4KB_PAGE) || 1
46 #define UPAGES 2 /* pages of u-area */
47 #define USPACE (UPAGES*NBPG) /* size of u-area in bytes */
48 #else
49 #error ENABLE_MIPS_xKB_PAGE not defined
50 #endif
52 #ifndef MSGBUFSIZE
53 #define MSGBUFSIZE NBPG /* default message buffer size */
54 #endif
57 * Round p (pointer or byte index) up to a correctly-aligned value for all
58 * data types (int, long, ...). The result is u_int and must be cast to
59 * any desired pointer type.
61 * ALIGNED_POINTER is a boolean macro that checks whether an address
62 * is valid to fetch data elements of type t from on this architecture.
63 * This does not reflect the optimal alignment, just the possibility
64 * (within reasonable limits).
67 #define ALIGNBYTES 7
68 #define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES)
69 #define ALIGNED_POINTER(p,t) ((((uintptr_t)(p)) & (sizeof(t)-1)) == 0)
71 #ifdef ENABLE_MIPS_16KB_PAGE
72 #define NBPG 16384 /* bytes/page */
73 #define PGSHIFT 14 /* LOG2(NBPG) */
74 #else
75 #define NBPG 4096 /* bytes/page */
76 #define PGSHIFT 12 /* LOG2(NBPG) */
77 #endif
78 #define PGOFSET (NBPG-1) /* byte offset into page */
79 #define NPTEPG (NBPG/4)
81 #define NBSEG (NBPG*NPTEPG) /* bytes/segment */
82 #define SEGOFSET (NBSEG-1) /* byte offset into segment */
83 #define SEGSHIFT (2*PGSHIFT-2) /* LOG2(NBSEG) */
86 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
87 * logical pages.
89 #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
90 #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
93 * Mach derived conversion macros
95 #define mips_round_page(x) ((((uintptr_t)(x)) + NBPG - 1) & ~(NBPG-1))
96 #define mips_trunc_page(x) ((uintptr_t)(x) & ~(NBPG-1))
97 #define mips_btop(x) ((paddr_t)(x) >> PGSHIFT)
98 #define mips_ptob(x) ((paddr_t)(x) << PGSHIFT)
100 #ifdef __MIPSEL__
101 #define MID_MACHINE MID_PMAX /* MID_PMAX (little-endian) */
102 #endif
103 #ifdef __MIPSEB__
104 #define MID_MACHINE MID_MIPS /* MID_MIPS (big-endian) */
105 #endif
108 * Constants related to network buffer management.
109 * MCLBYTES must be no larger than NBPG (the software page size), and,
110 * on machines that exchange pages of input or output buffers with mbuf
111 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
112 * of the hardware page size.
114 #ifndef MSIZE
115 #ifdef _LP64
116 #define MSIZE 512 /* size of an mbuf */
117 #else
118 #define MSIZE 256 /* size of an mbuf */
119 #endif
121 #ifndef MCLSHIFT
122 # define MCLSHIFT 11 /* convert bytes to m_buf clusters */
123 #endif /* MCLSHIFT */
125 #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
127 #ifndef NMBCLUSTERS
128 #if defined(_KERNEL_OPT)
129 #include "opt_gateway.h"
130 #endif
132 #ifdef GATEWAY
133 #define NMBCLUSTERS 2048 /* map size, max cluster allocation */
134 #else
135 #define NMBCLUSTERS 1024 /* map size, max cluster allocation */
136 #endif
137 #endif
138 #endif