Commit | Line | Data |
---|---|---|
80992c50 KB |
1 | /*- |
2 | * Copyright (c) 1982, 1986 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.proprietary.c% | |
da7c5cc6 | 6 | * |
80992c50 | 7 | * @(#)param.h 7.19 (Berkeley) %G% |
da7c5cc6 | 8 | */ |
4c542963 SL |
9 | |
10 | /* | |
9487ea54 | 11 | * Machine dependent constants for VAX. |
4c542963 | 12 | */ |
49c8d125 KB |
13 | #define MACHINE "vax" |
14 | ||
e7d5dea8 MK |
15 | /* |
16 | * Round p (pointer or byte index) up to a correctly-aligned value | |
17 | * for all data types (int, long, ...). The result is u_int and | |
18 | * must be cast to any desired pointer type. | |
19 | */ | |
20 | #define ALIGN(p) (((u_int)(p) + (sizeof(int) - 1)) &~ (sizeof(int) - 1)) | |
21 | ||
58b14b46 MK |
22 | #define KERNBASE 0x80000000 /* start of kernel virtual */ |
23 | #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) | |
24 | ||
5e09dfcf MK |
25 | #define NBPG 512 /* bytes/page */ |
26 | #define PGOFSET (NBPG-1) /* byte offset into page */ | |
27 | #define PGSHIFT 9 /* LOG2(NBPG) */ | |
28 | #define NPTEPG (NBPG/(sizeof (struct pte))) | |
29 | ||
9487ea54 | 30 | #define KERNBASE 0x80000000 /* start of kernel virtual */ |
2ecce9fd | 31 | #define KERNTEXTOFF KERNBASE /* start of kernel text */ |
9487ea54 KB |
32 | #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) |
33 | ||
dd94cc44 | 34 | #ifndef SECSIZE |
5e09dfcf MK |
35 | #define DEV_BSIZE 512 |
36 | #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ | |
37 | #define BLKDEV_IOSIZE 2048 | |
58b14b46 | 38 | #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ |
dd94cc44 MK |
39 | #else SECSIZE |
40 | /* | |
41 | * Devices without disk labels and the swap virtual device | |
42 | * use "blocks" of exactly pagesize. Devices with disk labels | |
43 | * use device-dependent sector sizes for block and character interfaces. | |
44 | */ | |
45 | #define DEV_BSIZE NBPG | |
46 | #define DEV_BSHIFT PGSHIFT /* log2(DEV_BSIZE) */ | |
47 | #define BLKDEV_IOSIZE NBPG /* NBPG for unlabeled block devices */ | |
48 | #endif SECSIZE | |
49 | #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ | |
4c542963 SL |
50 | |
51 | #define CLSIZE 2 | |
52 | #define CLSIZELOG2 1 | |
53 | ||
efa8b34c | 54 | /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ |
5e09dfcf MK |
55 | #define SSIZE 4 /* initial stack size/NBPG */ |
56 | #define SINCR 4 /* increment of stack/NBPG */ | |
4c542963 | 57 | |
3697b9ee | 58 | #define UPAGES 16 /* pages of u-area */ |
4c542963 | 59 | |
d58c675e MK |
60 | /* |
61 | * Constants related to network buffer management. | |
62 | * MCLBYTES must be no larger than CLBYTES (the software page size), and, | |
63 | * on machines that exchange pages of input or output buffers with mbuf | |
64 | * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple | |
65 | * of the hardware page size. | |
66 | */ | |
67 | #define MSIZE 128 /* size of an mbuf */ | |
68 | #define MAPPED_MBUFS /* can do scatter-gather I/O */ | |
69 | #if CLBYTES > 1024 | |
70 | #define MCLBYTES 1024 | |
71 | #define MCLSHIFT 10 | |
72 | #define MCLOFSET (MCLBYTES - 1) | |
73 | #else | |
74 | #define MCLBYTES CLBYTES | |
75 | #define MCLSHIFT CLSHIFT | |
76 | #define MCLOFSET CLOFSET | |
77 | #endif | |
78 | #ifdef GATEWAY | |
79 | #define NMBCLUSTERS 512 /* map size, max cluster allocation */ | |
80 | #else | |
81 | #define NMBCLUSTERS 256 /* map size, max cluster allocation */ | |
82 | #endif | |
83 | ||
a2b92cf4 KM |
84 | /* |
85 | * Size of kernel malloc arena in CLBYTES-sized logical pages | |
86 | */ | |
87 | #ifndef NKMEMCLUSTERS | |
88 | #define NKMEMCLUSTERS (512*1024/CLBYTES) | |
89 | #endif | |
90 | ||
4c542963 SL |
91 | /* |
92 | * Some macros for units conversion | |
93 | */ | |
94 | /* Core clicks (512 bytes) to segments and vice versa */ | |
95 | #define ctos(x) (x) | |
96 | #define stoc(x) (x) | |
97 | ||
dd94cc44 | 98 | #ifndef SECSIZE |
4c542963 SL |
99 | /* Core clicks (512 bytes) to disk blocks */ |
100 | #define ctod(x) (x) | |
101 | #define dtoc(x) (x) | |
dd94cc44 MK |
102 | #define dtob(x) ((x)<<PGSHIFT) |
103 | #else SECSIZE | |
104 | /* Core clicks (512 bytes) to disk blocks; deprecated */ | |
105 | #define ctod(x) (x) /* XXX */ | |
106 | #define dtoc(x) (x) /* XXX */ | |
107 | #define dtob(x) ((x)<<PGSHIFT) /* XXX */ | |
108 | #endif SECSIZE | |
4c542963 SL |
109 | |
110 | /* clicks to bytes */ | |
111 | #define ctob(x) ((x)<<9) | |
112 | ||
113 | /* bytes to clicks */ | |
114 | #define btoc(x) ((((unsigned)(x)+511)>>9)) | |
115 | ||
dd94cc44 | 116 | #ifndef SECSIZE |
5e09dfcf MK |
117 | #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ |
118 | ((unsigned)(bytes) >> DEV_BSHIFT) | |
119 | #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ | |
120 | ((unsigned)(db) << DEV_BSHIFT) | |
121 | ||
122 | /* | |
123 | * Map a ``block device block'' to a file system block. | |
124 | * This should be device dependent, and will be if we | |
125 | * add an entry to cdevsw/bdevsw for that purpose. | |
126 | * For now though just use DEV_BSIZE. | |
127 | */ | |
128 | #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) | |
dd94cc44 MK |
129 | #else SECSIZE |
130 | /* bytes to "disk blocks" and back; deprecated */ | |
131 | #define btodb(bytes) ((unsigned)(bytes) >> DEV_BSHIFT) /* XXX */ | |
132 | #define dbtob(db) ((unsigned)(db) << DEV_BSHIFT) /* XXX */ | |
133 | #endif SECSIZE | |
5e09dfcf | 134 | |
4c542963 SL |
135 | /* |
136 | * Macros to decode processor status word. | |
137 | */ | |
138 | #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) | |
8664db0b | 139 | #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) |
4c542963 | 140 | |
3327052b MK |
141 | #ifdef KERNEL |
142 | #ifndef LOCORE | |
143 | int cpuspeed; | |
3327052b | 144 | #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } |
837583eb | 145 | #endif |
3327052b MK |
146 | |
147 | #else KERNEL | |
4c542963 | 148 | #define DELAY(n) { register int N = (n); while (--N > 0); } |
3327052b | 149 | #endif KERNEL |