|
|
1.1 root 1: /*
2: * Copyright (c) 1988 University of Utah.
3: * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
4: * All rights reserved.
5: *
6: * This code is derived from software contributed to Berkeley by
7: * the Systems Programming Group of the University of Utah Computer
8: * Science Department.
9: *
10: * Redistribution is only permitted until one year after the first shipment
11: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
12: * binary forms are permitted provided that: (1) source distributions retain
13: * this entire copyright notice and comment, and (2) distributions including
14: * binaries display the following acknowledgement: This product includes
15: * software developed by the University of California, Berkeley and its
16: * contributors'' in the documentation or other materials provided with the
17: * distribution and in all advertising materials mentioning features or use
18: * of this software. Neither the name of the University nor the names of
19: * its contributors may be used to endorse or promote products derived from
20: * this software without specific prior written permission.
21: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
22: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
23: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24: *
25: * from: Utah $Hdr: machparam.h 1.11 89/08/14$
26: *
27: * @(#)machparam.h 7.1 (Berkeley) 5/8/90
28: */
29:
30: /*
31: * Machine dependent constants for HP9000 series 300.
32: */
33: #define MACHINE "hp300"
34:
35: #ifndef BYTE_ORDER
36: #include <machine/endian.h>
37: #endif
38:
39: #include <machine/machlimits.h>
40:
41: #define NBPG 4096 /* bytes/page */
42: #define PGOFSET (NBPG-1) /* byte offset into page */
43: #define PGSHIFT 12 /* LOG2(NBPG) */
44: #define NPTEPG (NBPG/(sizeof (struct pte)))
45:
46: #define NBSEG (1024*NBPG) /* bytes/segment */
47: #define SEGOFSET (NBSEG-1) /* byte offset into segment */
48: #define SEGSHIFT 22 /* LOG2(NBSEG) */
49:
50: #define KERNBASE 0x00000000 /* start of kernel virtual */
51: #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
52:
53: #define DEV_BSIZE 512
54: #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
55: #define BLKDEV_IOSIZE 2048
56: #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
57:
58: #define CLSIZE 1
59: #define CLSIZELOG2 0
60:
61: #define SSIZE 1 /* initial stack size/NBPG */
62: #define SINCR 1 /* increment of stack/NBPG */
63:
64: #define UPAGES 3 /* pages of u-area */
65:
66: /*
67: * Constants related to network buffer management.
68: * MCLBYTES must be no larger than CLBYTES (the software page size), and,
69: * on machines that exchange pages of input or output buffers with mbuf
70: * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
71: * of the hardware page size.
72: */
73: #define MSIZE 128 /* size of an mbuf */
74: #define MCLBYTES 1024
75: #define MCLSHIFT 10
76: #define MCLOFSET (MCLBYTES - 1)
77: #ifndef NMBCLUSTERS
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: #endif
84:
85: /*
86: * Size of kernel malloc arena in CLBYTES-sized logical pages
87: */
88: #ifndef NKMEMCLUSTERS
89: #define NKMEMCLUSTERS (512*1024/CLBYTES)
90: #endif
91:
92: /*
93: * Some macros for units conversion
94: */
95: /* Core clicks (4096 bytes) to segments and vice versa */
96: #define ctos(x) (x)
97: #define stoc(x) (x)
98:
99: /* Core clicks (4096 bytes) to disk blocks */
100: #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
101: #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
102: #define dtob(x) ((x)<<DEV_BSHIFT)
103:
104: /* clicks to bytes */
105: #define ctob(x) ((x)<<PGSHIFT)
106:
107: /* bytes to clicks */
108: #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
109:
110: #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
111: ((unsigned)(bytes) >> DEV_BSHIFT)
112: #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
113: ((unsigned)(db) << DEV_BSHIFT)
114:
115: /*
116: * Map a ``block device block'' to a file system block.
117: * This should be device dependent, and will be if we
118: * add an entry to cdevsw/bdevsw for that purpose.
119: * For now though just use DEV_BSIZE.
120: */
121: #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
122:
123: /*
124: * Macros to decode processor status word.
125: */
126: #define USERMODE(ps) (((ps) & PSL_S) == 0)
127: #define BASEPRI(ps) (((ps) & PSL_IPL7) == 0)
128:
129: #ifdef KERNEL
130: #ifndef LOCORE
131: int cpuspeed;
132: #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
133: #endif
134:
135: #else KERNEL
136: #define DELAY(n) { register int N = (n); while (--N > 0); }
137: #endif KERNEL
138:
139: #ifdef HPUXCOMPAT
140: /*
141: * Constants/macros for HPUX multiple mapping of user address space.
142: * Pages in the first 256Mb are mapped in at every 256Mb segment.
143: */
144: #define HPMMMASK 0xF0000000
145: #define ISHPMMADDR(v) \
146: ((u.u_pcb.pcb_flags&PCB_HPUXMMAP) && ((unsigned)(v)&HPMMMASK) != HPMMMASK)
147: #define HPMMBASEADDR(v) ((unsigned)(v) & ~HPMMMASK)
148: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.