Annotation of sys/arch/m68k/include/param.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: param.h,v 1.22 2007/05/28 21:02:49 thib Exp $ */
2: /* $NetBSD: param.h,v 1.2 1997/06/10 18:21:23 veego Exp $ */
3:
4: /*
5: * Copyright (c) 1988 University of Utah.
6: * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
7: * All rights reserved.
8: *
9: * This code is derived from software contributed to Berkeley by
10: * the Systems Programming Group of the University of Utah Computer
11: * Science Department.
12: *
13: * Redistribution and use in source and binary forms, with or without
14: * modification, are permitted provided that the following conditions
15: * are met:
16: * 1. Redistributions of source code must retain the above copyright
17: * notice, this list of conditions and the following disclaimer.
18: * 2. Redistributions in binary form must reproduce the above copyright
19: * notice, this list of conditions and the following disclaimer in the
20: * documentation and/or other materials provided with the distribution.
21: * 3. Neither the name of the University nor the names of its contributors
22: * may be used to endorse or promote products derived from this software
23: * without specific prior written permission.
24: *
25: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35: * SUCH DAMAGE.
36: *
37: * from: Utah $Hdr: machparam.h 1.16 92/12/20$
38: *
39: * @(#)param.h 8.1 (Berkeley) 6/10/93
40: */
41: #ifndef _M68K_PARAM_H_
42: #define _M68K_PARAM_H_
43:
44: /*
45: * Machine independent constants for m68k
46: */
47: #define _MACHINE_ARCH m68k
48: #define MACHINE_ARCH "m68k"
49: #define MID_MACHINE MID_M68K
50:
51: /*
52: * Round p (pointer or byte index) up to a correctly-aligned value for all
53: * data types (int, long, ...). The result is u_int and must be cast to
54: * any desired pointer type.
55: *
56: * ALIGNED_POINTER is a boolean macro that checks whether an address
57: * is valid to fetch data elements of type t from on this architecture.
58: * This does not reflect the optimal alignment, just the possibility
59: * (within reasonable limits).
60: *
61: */
62: #define ALIGNBYTES (sizeof(int) - 1)
63: #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
64: #define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
65:
66: #define PAGE_SIZE (1 << PAGE_SHIFT)
67: #define PAGE_MASK (PAGE_SIZE - 1)
68:
69: #define PGSHIFT PAGE_SHIFT
70: #define NBPG (1 << PGSHIFT) /* bytes/page */
71: #define PGOFSET (NBPG-1) /* byte offset into page */
72:
73: #define NPTEPG (PAGE_SIZE / (sizeof(pt_entry_t)))
74:
75: #define BTOPKERNBASE ((u_long)KERNBASE >> PAGE_SHIFT)
76:
77: #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
78: #define DEV_BSIZE (1 << DEV_BSHIFT)
79: #define BLKDEV_IOSIZE 2048
80: #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
81:
82: #define SEGSHIFT020 (34 - PAGE_SHIFT)
83: #define SEGSHIFT040 (18)
84: #ifndef SEGSHIFT
85: #if defined(M68040) || defined(M68060)
86: #if defined(M68020) || defined(M68030)
87: #define SEGSHIFT ((mmutype <= MMU_68040) ? SEGSHIFT040 : SEGSHIFT020)
88: #else
89: #define SEGSHIFT SEGSHIFT040
90: #endif
91: #else
92: #define SEGSHIFT SEGSHIFT020
93: #endif
94: #define NBSEG (1 << SEGSHIFT)
95: #define SEGOFSET (NBSEG - 1)
96: #endif
97:
98: /* mac68k use 3 pages of u-area */
99: #ifndef UPAGES
100: #define UPAGES 2 /* pages of u-area */
101: #endif
102: #define USPACE (UPAGES * PAGE_SIZE)
103: #define USPACE_ALIGN (0) /* u-area alignment 0-none */
104:
105: /*
106: * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
107: * logical pages.
108: */
109: #define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
110: #define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
111:
112: /*
113: * Constants related to network buffer management.
114: */
115: #define NMBCLUSTERS 1024 /* map size, max cluster allocation */
116:
117: /* pages ("clicks") to disk blocks */
118: #define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
119: #define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
120:
121: /* pages to bytes */
122: #define ctob(x) ((x) << PAGE_SHIFT)
123: #define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT)
124:
125: /* bytes to disk blocks */
126: #define btodb(x) ((x) >> DEV_BSHIFT)
127: #define dbtob(x) ((x) << DEV_BSHIFT)
128:
129: /*
130: * Mach derived conversion macros
131: */
132: #define m68k_round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET)
133: #define m68k_trunc_seg(x) ((unsigned)(x) & ~SEGOFSET)
134: #define m68k_page_offset(x) ((unsigned)(x) & PGOFSET)
135:
136: #ifdef COMPAT_HPUX
137: /*
138: * Constants/macros for HPUX multiple mapping of user address space.
139: * Pages in the first 256Mb are mapped in at every 256Mb segment.
140: */
141: #define HPMMMASK 0xF0000000
142: #define ISHPMMADDR(p, v) \
143: (((p)->p_md.md_flags & MDP_HPUXMMAP) && \
144: ((unsigned)(v) & HPMMMASK) && \
145: ((unsigned)(v) & HPMMMASK) != HPMMMASK)
146: #define HPMMBASEADDR(v) \
147: ((unsigned)(v) & ~HPMMMASK)
148: #endif /* COMPAT_HPUX */
149:
150: #include <machine/cpu.h>
151:
152: #endif /* !_M68K_PARAM_H_ */
CVSweb