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