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