xref: /titanic_52/usr/src/lib/libbc/inc/include/sun4/param.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*5d54f3d8Smuffin  * Copyright 1989 Sun Microsystems, Inc.  All rights reserved.
24*5d54f3d8Smuffin  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _sun4_param_h
287c478bd9Sstevel@tonic-gate #define	_sun4_param_h
297c478bd9Sstevel@tonic-gate 
30*5d54f3d8Smuffin #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*5d54f3d8Smuffin 
32*5d54f3d8Smuffin /*
33*5d54f3d8Smuffin  * This file is intended to contain the basic
34*5d54f3d8Smuffin  * specific details of a given architecture.
35*5d54f3d8Smuffin  */
36*5d54f3d8Smuffin 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * Machine dependent constants for Sun4.
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * Define the VAC symbol if we could run on a machine
437c478bd9Sstevel@tonic-gate  * which has a Virtual Address Cache (e.g. SUN4_260)
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate #if defined(SUN4_260) || defined(SUN4_470) || defined(SUN4_330)
467c478bd9Sstevel@tonic-gate #define VAC
477c478bd9Sstevel@tonic-gate #else
487c478bd9Sstevel@tonic-gate #undef VAC
49*5d54f3d8Smuffin #endif	/* SUN4_260 || SUN4_470 || SUN4_330 */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * Define the FPU symbol if we could run on a machine with an external
537c478bd9Sstevel@tonic-gate  * FPU (i.e. not integrated with the normal machine state like the vax).
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate #define FPU
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /*
587c478bd9Sstevel@tonic-gate  * Define the MMU_3LEVEL symbol if we could run on a machine with
597c478bd9Sstevel@tonic-gate  * a three level mmu.   We also assume these machines have region
607c478bd9Sstevel@tonic-gate  * and user cache flush operations.
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate #ifdef SUN4_470
637c478bd9Sstevel@tonic-gate #define MMU_3LEVEL
647c478bd9Sstevel@tonic-gate #else
657c478bd9Sstevel@tonic-gate #undef MMU_3LEVEL
66*5d54f3d8Smuffin #endif	/* SUN4_470 */
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Define IOC if we could run on machines that have an I/O cache.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #ifdef SUN4_470
727c478bd9Sstevel@tonic-gate #define IOC
737c478bd9Sstevel@tonic-gate #else
747c478bd9Sstevel@tonic-gate #undef IOC
75*5d54f3d8Smuffin #endif	/* SUN4_470 */
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Define BCOPY_BUF if we could run on machines that have a bcopy buffer.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate #ifdef SUN4_470
817c478bd9Sstevel@tonic-gate #define BCOPY_BUF
827c478bd9Sstevel@tonic-gate #else
837c478bd9Sstevel@tonic-gate #undef BCOPY_BUF
84*5d54f3d8Smuffin #endif	/* SUN4_470 */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * Define VA_HOLE for machines that have a hole in the virtual address space.
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate #if defined(SUN4_260) || defined(SUN4_110) || defined(SUN4_330)
907c478bd9Sstevel@tonic-gate #define VA_HOLE
917c478bd9Sstevel@tonic-gate #else
927c478bd9Sstevel@tonic-gate #undef VA_HOLE
93*5d54f3d8Smuffin #endif	/* SUN4_260 || SUN4_110 || SUN4_330 */
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate /*
967c478bd9Sstevel@tonic-gate  * MMU_PAGES* describes the physical page size used by the mapping hardware.
977c478bd9Sstevel@tonic-gate  * PAGES* describes the logical page size used by the system.
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate #define	MMU_PAGESIZE	0x2000		/* 8192 bytes */
1017c478bd9Sstevel@tonic-gate #define	MMU_PAGESHIFT	13		/* log2(MMU_PAGESIZE) */
1027c478bd9Sstevel@tonic-gate #define	MMU_PAGEOFFSET	(MMU_PAGESIZE-1)/* Mask of address bits in page */
1037c478bd9Sstevel@tonic-gate #define	MMU_PAGEMASK	(~MMU_PAGEOFFSET)
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate #define	PAGESIZE	0x2000		/* All of the above, for logical */
1067c478bd9Sstevel@tonic-gate #define	PAGESHIFT	13
1077c478bd9Sstevel@tonic-gate #define	PAGEOFFSET	(PAGESIZE - 1)
1087c478bd9Sstevel@tonic-gate #define	PAGEMASK	(~PAGEOFFSET)
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  * DATA_ALIGN is used to define the alignment of the Unix data segment.
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate #define	DATA_ALIGN	0x2000
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate /*
1167c478bd9Sstevel@tonic-gate  * Some random macros for units conversion.
1177c478bd9Sstevel@tonic-gate  */
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * MMU pages to bytes, and back (with and without rounding)
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate #define	mmu_ptob(x)	((x) << MMU_PAGESHIFT)
1237c478bd9Sstevel@tonic-gate #define	mmu_btop(x)	(((unsigned)(x)) >> MMU_PAGESHIFT)
1247c478bd9Sstevel@tonic-gate #define	mmu_btopr(x)	((((unsigned)(x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT))
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate /*
1277c478bd9Sstevel@tonic-gate  * pages to bytes, and back (with and without rounding)
1287c478bd9Sstevel@tonic-gate  */
1297c478bd9Sstevel@tonic-gate #define	ptob(x)		((x) << PAGESHIFT)
1307c478bd9Sstevel@tonic-gate #define	btop(x)		(((unsigned)(x)) >> PAGESHIFT)
1317c478bd9Sstevel@tonic-gate #define	btopr(x)	((((unsigned)(x) + PAGEOFFSET) >> PAGESHIFT))
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate /*
1347c478bd9Sstevel@tonic-gate  * 2 versions of pages to disk blocks
1357c478bd9Sstevel@tonic-gate  */
1367c478bd9Sstevel@tonic-gate #define	mmu_ptod(x)	((x) << (MMU_PAGESHIFT - DEV_BSHIFT))
1377c478bd9Sstevel@tonic-gate #define	ptod(x)		((x) << (PAGESHIFT - DEV_BSHIFT))
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate /*
1407c478bd9Sstevel@tonic-gate  * Delay units are in microseconds.
1417c478bd9Sstevel@tonic-gate  */
1427c478bd9Sstevel@tonic-gate #define	DELAY(n)	usec_delay(n)
1437c478bd9Sstevel@tonic-gate #define	CDELAY(c, n)	\
1447c478bd9Sstevel@tonic-gate { \
1457c478bd9Sstevel@tonic-gate 	register int N = n; \
1467c478bd9Sstevel@tonic-gate 	while (--N > 0) { \
1477c478bd9Sstevel@tonic-gate 		if (c) \
1487c478bd9Sstevel@tonic-gate 			break; \
1497c478bd9Sstevel@tonic-gate 		usec_delay(1); \
1507c478bd9Sstevel@tonic-gate 	} \
1517c478bd9Sstevel@tonic-gate }
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate #define	UPAGES		2	/* pages of u-area, NOT including red zone */
1547c478bd9Sstevel@tonic-gate #define	KERNSTACK	0x3000	/* size of kernel stack in u-area */
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate  * KERNSIZE the amount of vitual address space the kernel
1587c478bd9Sstevel@tonic-gate  * uses in all contexts.
1597c478bd9Sstevel@tonic-gate  */
1607c478bd9Sstevel@tonic-gate #define KERNELSIZE	(128*1024*1024)
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate /*
1637c478bd9Sstevel@tonic-gate  * KERNELBASE is the virtual address which
1647c478bd9Sstevel@tonic-gate  * the kernel text/data mapping starts in all contexts.
1657c478bd9Sstevel@tonic-gate  */
1667c478bd9Sstevel@tonic-gate #define	KERNELBASE	(0-KERNELSIZE)
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate /*
1697c478bd9Sstevel@tonic-gate  * SYSBASE is the virtual address which
1707c478bd9Sstevel@tonic-gate  * the kernel allocated memory mapping starts in all contexts.
1717c478bd9Sstevel@tonic-gate  */
1727c478bd9Sstevel@tonic-gate #define	SYSBASE		(0-(16*1024*1024))
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate /*
1757c478bd9Sstevel@tonic-gate  * Msgbuf size.
1767c478bd9Sstevel@tonic-gate  */
1777c478bd9Sstevel@tonic-gate #define MSG_BSIZE       ((7 * 1024) - sizeof (struct msgbuf_hd))
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /*
1807c478bd9Sstevel@tonic-gate  * XXX - Macros for compatibility
1817c478bd9Sstevel@tonic-gate  */
1827c478bd9Sstevel@tonic-gate /* Clicks (MMU PAGES) to disk blocks */
1837c478bd9Sstevel@tonic-gate #define	ctod(x)		mmu_ptod(x)
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate /* Clicks (MMU PAGES) to bytes, and back (with rounding) */
1867c478bd9Sstevel@tonic-gate #define	ctob(x)		mmu_ptob(x)
1877c478bd9Sstevel@tonic-gate #define	btoc(x)		mmu_btopr(x)
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate /*
1907c478bd9Sstevel@tonic-gate  * XXX - Old names for some backwards compatibility
1917c478bd9Sstevel@tonic-gate  */
1927c478bd9Sstevel@tonic-gate #define	NBPG		MMU_PAGESIZE
1937c478bd9Sstevel@tonic-gate #define	PGOFSET		MMU_PAGEOFFSET
1947c478bd9Sstevel@tonic-gate #define	PGSHIFT		MMU_PAGESHIFT
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate #define	CLSIZE		1
1977c478bd9Sstevel@tonic-gate #define	CLSIZELOG2	0
1987c478bd9Sstevel@tonic-gate #define	CLBYTES		PAGESIZE
1997c478bd9Sstevel@tonic-gate #define	CLOFSET		PAGEOFFSET
2007c478bd9Sstevel@tonic-gate #define	CLSHIFT		PAGESHIFT
2017c478bd9Sstevel@tonic-gate #define	clrnd(i)	(i)
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate #endif /* !_sun4_param_h */
204