xref: /titanic_41/usr/src/lib/libbc/inc/include/sun4/param.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1989 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _sun4_param_h
28 #define	_sun4_param_h
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * This file is intended to contain the basic
34  * specific details of a given architecture.
35  */
36 
37 /*
38  * Machine dependent constants for Sun4.
39  */
40 
41 /*
42  * Define the VAC symbol if we could run on a machine
43  * which has a Virtual Address Cache (e.g. SUN4_260)
44  */
45 #if defined(SUN4_260) || defined(SUN4_470) || defined(SUN4_330)
46 #define VAC
47 #else
48 #undef VAC
49 #endif	/* SUN4_260 || SUN4_470 || SUN4_330 */
50 
51 /*
52  * Define the FPU symbol if we could run on a machine with an external
53  * FPU (i.e. not integrated with the normal machine state like the vax).
54  */
55 #define FPU
56 
57 /*
58  * Define the MMU_3LEVEL symbol if we could run on a machine with
59  * a three level mmu.   We also assume these machines have region
60  * and user cache flush operations.
61  */
62 #ifdef SUN4_470
63 #define MMU_3LEVEL
64 #else
65 #undef MMU_3LEVEL
66 #endif	/* SUN4_470 */
67 
68 /*
69  * Define IOC if we could run on machines that have an I/O cache.
70  */
71 #ifdef SUN4_470
72 #define IOC
73 #else
74 #undef IOC
75 #endif	/* SUN4_470 */
76 
77 /*
78  * Define BCOPY_BUF if we could run on machines that have a bcopy buffer.
79  */
80 #ifdef SUN4_470
81 #define BCOPY_BUF
82 #else
83 #undef BCOPY_BUF
84 #endif	/* SUN4_470 */
85 
86 /*
87  * Define VA_HOLE for machines that have a hole in the virtual address space.
88  */
89 #if defined(SUN4_260) || defined(SUN4_110) || defined(SUN4_330)
90 #define VA_HOLE
91 #else
92 #undef VA_HOLE
93 #endif	/* SUN4_260 || SUN4_110 || SUN4_330 */
94 
95 /*
96  * MMU_PAGES* describes the physical page size used by the mapping hardware.
97  * PAGES* describes the logical page size used by the system.
98  */
99 
100 #define	MMU_PAGESIZE	0x2000		/* 8192 bytes */
101 #define	MMU_PAGESHIFT	13		/* log2(MMU_PAGESIZE) */
102 #define	MMU_PAGEOFFSET	(MMU_PAGESIZE-1)/* Mask of address bits in page */
103 #define	MMU_PAGEMASK	(~MMU_PAGEOFFSET)
104 
105 #define	PAGESIZE	0x2000		/* All of the above, for logical */
106 #define	PAGESHIFT	13
107 #define	PAGEOFFSET	(PAGESIZE - 1)
108 #define	PAGEMASK	(~PAGEOFFSET)
109 
110 /*
111  * DATA_ALIGN is used to define the alignment of the Unix data segment.
112  */
113 #define	DATA_ALIGN	0x2000
114 
115 /*
116  * Some random macros for units conversion.
117  */
118 
119 /*
120  * MMU pages to bytes, and back (with and without rounding)
121  */
122 #define	mmu_ptob(x)	((x) << MMU_PAGESHIFT)
123 #define	mmu_btop(x)	(((unsigned)(x)) >> MMU_PAGESHIFT)
124 #define	mmu_btopr(x)	((((unsigned)(x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT))
125 
126 /*
127  * pages to bytes, and back (with and without rounding)
128  */
129 #define	ptob(x)		((x) << PAGESHIFT)
130 #define	btop(x)		(((unsigned)(x)) >> PAGESHIFT)
131 #define	btopr(x)	((((unsigned)(x) + PAGEOFFSET) >> PAGESHIFT))
132 
133 /*
134  * 2 versions of pages to disk blocks
135  */
136 #define	mmu_ptod(x)	((x) << (MMU_PAGESHIFT - DEV_BSHIFT))
137 #define	ptod(x)		((x) << (PAGESHIFT - DEV_BSHIFT))
138 
139 /*
140  * Delay units are in microseconds.
141  */
142 #define	DELAY(n)	usec_delay(n)
143 #define	CDELAY(c, n)	\
144 { \
145 	register int N = n; \
146 	while (--N > 0) { \
147 		if (c) \
148 			break; \
149 		usec_delay(1); \
150 	} \
151 }
152 
153 #define	UPAGES		2	/* pages of u-area, NOT including red zone */
154 #define	KERNSTACK	0x3000	/* size of kernel stack in u-area */
155 
156 /*
157  * KERNSIZE the amount of vitual address space the kernel
158  * uses in all contexts.
159  */
160 #define KERNELSIZE	(128*1024*1024)
161 
162 /*
163  * KERNELBASE is the virtual address which
164  * the kernel text/data mapping starts in all contexts.
165  */
166 #define	KERNELBASE	(0-KERNELSIZE)
167 
168 /*
169  * SYSBASE is the virtual address which
170  * the kernel allocated memory mapping starts in all contexts.
171  */
172 #define	SYSBASE		(0-(16*1024*1024))
173 
174 /*
175  * Msgbuf size.
176  */
177 #define MSG_BSIZE       ((7 * 1024) - sizeof (struct msgbuf_hd))
178 
179 /*
180  * XXX - Macros for compatibility
181  */
182 /* Clicks (MMU PAGES) to disk blocks */
183 #define	ctod(x)		mmu_ptod(x)
184 
185 /* Clicks (MMU PAGES) to bytes, and back (with rounding) */
186 #define	ctob(x)		mmu_ptob(x)
187 #define	btoc(x)		mmu_btopr(x)
188 
189 /*
190  * XXX - Old names for some backwards compatibility
191  */
192 #define	NBPG		MMU_PAGESIZE
193 #define	PGOFSET		MMU_PAGEOFFSET
194 #define	PGSHIFT		MMU_PAGESHIFT
195 
196 #define	CLSIZE		1
197 #define	CLSIZELOG2	0
198 #define	CLBYTES		PAGESIZE
199 #define	CLOFSET		PAGEOFFSET
200 #define	CLSHIFT		PAGESHIFT
201 #define	clrnd(i)	(i)
202 
203 #endif /* !_sun4_param_h */
204