10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 22*722Smuffin /* 23*722Smuffin * Copyright 1989 Sun Microsystems, Inc. All rights reserved. 24*722Smuffin * Use is subject to license terms. 25*722Smuffin */ 26*722Smuffin 27*722Smuffin #ifndef _sun4_param_h 28*722Smuffin #define _sun4_param_h 29*722Smuffin 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * This file is intended to contain the basic 340Sstevel@tonic-gate * specific details of a given architecture. 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate /* 380Sstevel@tonic-gate * Machine dependent constants for Sun4. 390Sstevel@tonic-gate */ 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* 420Sstevel@tonic-gate * Define the VAC symbol if we could run on a machine 430Sstevel@tonic-gate * which has a Virtual Address Cache (e.g. SUN4_260) 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate #if defined(SUN4_260) || defined(SUN4_470) || defined(SUN4_330) 460Sstevel@tonic-gate #define VAC 470Sstevel@tonic-gate #else 480Sstevel@tonic-gate #undef VAC 49*722Smuffin #endif /* SUN4_260 || SUN4_470 || SUN4_330 */ 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 520Sstevel@tonic-gate * Define the FPU symbol if we could run on a machine with an external 530Sstevel@tonic-gate * FPU (i.e. not integrated with the normal machine state like the vax). 540Sstevel@tonic-gate */ 550Sstevel@tonic-gate #define FPU 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* 580Sstevel@tonic-gate * Define the MMU_3LEVEL symbol if we could run on a machine with 590Sstevel@tonic-gate * a three level mmu. We also assume these machines have region 600Sstevel@tonic-gate * and user cache flush operations. 610Sstevel@tonic-gate */ 620Sstevel@tonic-gate #ifdef SUN4_470 630Sstevel@tonic-gate #define MMU_3LEVEL 640Sstevel@tonic-gate #else 650Sstevel@tonic-gate #undef MMU_3LEVEL 66*722Smuffin #endif /* SUN4_470 */ 670Sstevel@tonic-gate 680Sstevel@tonic-gate /* 690Sstevel@tonic-gate * Define IOC if we could run on machines that have an I/O cache. 700Sstevel@tonic-gate */ 710Sstevel@tonic-gate #ifdef SUN4_470 720Sstevel@tonic-gate #define IOC 730Sstevel@tonic-gate #else 740Sstevel@tonic-gate #undef IOC 75*722Smuffin #endif /* SUN4_470 */ 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* 780Sstevel@tonic-gate * Define BCOPY_BUF if we could run on machines that have a bcopy buffer. 790Sstevel@tonic-gate */ 800Sstevel@tonic-gate #ifdef SUN4_470 810Sstevel@tonic-gate #define BCOPY_BUF 820Sstevel@tonic-gate #else 830Sstevel@tonic-gate #undef BCOPY_BUF 84*722Smuffin #endif /* SUN4_470 */ 850Sstevel@tonic-gate 860Sstevel@tonic-gate /* 870Sstevel@tonic-gate * Define VA_HOLE for machines that have a hole in the virtual address space. 880Sstevel@tonic-gate */ 890Sstevel@tonic-gate #if defined(SUN4_260) || defined(SUN4_110) || defined(SUN4_330) 900Sstevel@tonic-gate #define VA_HOLE 910Sstevel@tonic-gate #else 920Sstevel@tonic-gate #undef VA_HOLE 93*722Smuffin #endif /* SUN4_260 || SUN4_110 || SUN4_330 */ 940Sstevel@tonic-gate 950Sstevel@tonic-gate /* 960Sstevel@tonic-gate * MMU_PAGES* describes the physical page size used by the mapping hardware. 970Sstevel@tonic-gate * PAGES* describes the logical page size used by the system. 980Sstevel@tonic-gate */ 990Sstevel@tonic-gate 1000Sstevel@tonic-gate #define MMU_PAGESIZE 0x2000 /* 8192 bytes */ 1010Sstevel@tonic-gate #define MMU_PAGESHIFT 13 /* log2(MMU_PAGESIZE) */ 1020Sstevel@tonic-gate #define MMU_PAGEOFFSET (MMU_PAGESIZE-1)/* Mask of address bits in page */ 1030Sstevel@tonic-gate #define MMU_PAGEMASK (~MMU_PAGEOFFSET) 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #define PAGESIZE 0x2000 /* All of the above, for logical */ 1060Sstevel@tonic-gate #define PAGESHIFT 13 1070Sstevel@tonic-gate #define PAGEOFFSET (PAGESIZE - 1) 1080Sstevel@tonic-gate #define PAGEMASK (~PAGEOFFSET) 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate /* 1110Sstevel@tonic-gate * DATA_ALIGN is used to define the alignment of the Unix data segment. 1120Sstevel@tonic-gate */ 1130Sstevel@tonic-gate #define DATA_ALIGN 0x2000 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate /* 1160Sstevel@tonic-gate * Some random macros for units conversion. 1170Sstevel@tonic-gate */ 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate /* 1200Sstevel@tonic-gate * MMU pages to bytes, and back (with and without rounding) 1210Sstevel@tonic-gate */ 1220Sstevel@tonic-gate #define mmu_ptob(x) ((x) << MMU_PAGESHIFT) 1230Sstevel@tonic-gate #define mmu_btop(x) (((unsigned)(x)) >> MMU_PAGESHIFT) 1240Sstevel@tonic-gate #define mmu_btopr(x) ((((unsigned)(x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT)) 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate /* 1270Sstevel@tonic-gate * pages to bytes, and back (with and without rounding) 1280Sstevel@tonic-gate */ 1290Sstevel@tonic-gate #define ptob(x) ((x) << PAGESHIFT) 1300Sstevel@tonic-gate #define btop(x) (((unsigned)(x)) >> PAGESHIFT) 1310Sstevel@tonic-gate #define btopr(x) ((((unsigned)(x) + PAGEOFFSET) >> PAGESHIFT)) 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate /* 1340Sstevel@tonic-gate * 2 versions of pages to disk blocks 1350Sstevel@tonic-gate */ 1360Sstevel@tonic-gate #define mmu_ptod(x) ((x) << (MMU_PAGESHIFT - DEV_BSHIFT)) 1370Sstevel@tonic-gate #define ptod(x) ((x) << (PAGESHIFT - DEV_BSHIFT)) 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate /* 1400Sstevel@tonic-gate * Delay units are in microseconds. 1410Sstevel@tonic-gate */ 1420Sstevel@tonic-gate #define DELAY(n) usec_delay(n) 1430Sstevel@tonic-gate #define CDELAY(c, n) \ 1440Sstevel@tonic-gate { \ 1450Sstevel@tonic-gate register int N = n; \ 1460Sstevel@tonic-gate while (--N > 0) { \ 1470Sstevel@tonic-gate if (c) \ 1480Sstevel@tonic-gate break; \ 1490Sstevel@tonic-gate usec_delay(1); \ 1500Sstevel@tonic-gate } \ 1510Sstevel@tonic-gate } 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate #define UPAGES 2 /* pages of u-area, NOT including red zone */ 1540Sstevel@tonic-gate #define KERNSTACK 0x3000 /* size of kernel stack in u-area */ 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate /* 1570Sstevel@tonic-gate * KERNSIZE the amount of vitual address space the kernel 1580Sstevel@tonic-gate * uses in all contexts. 1590Sstevel@tonic-gate */ 1600Sstevel@tonic-gate #define KERNELSIZE (128*1024*1024) 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate /* 1630Sstevel@tonic-gate * KERNELBASE is the virtual address which 1640Sstevel@tonic-gate * the kernel text/data mapping starts in all contexts. 1650Sstevel@tonic-gate */ 1660Sstevel@tonic-gate #define KERNELBASE (0-KERNELSIZE) 1670Sstevel@tonic-gate 1680Sstevel@tonic-gate /* 1690Sstevel@tonic-gate * SYSBASE is the virtual address which 1700Sstevel@tonic-gate * the kernel allocated memory mapping starts in all contexts. 1710Sstevel@tonic-gate */ 1720Sstevel@tonic-gate #define SYSBASE (0-(16*1024*1024)) 1730Sstevel@tonic-gate 1740Sstevel@tonic-gate /* 1750Sstevel@tonic-gate * Msgbuf size. 1760Sstevel@tonic-gate */ 1770Sstevel@tonic-gate #define MSG_BSIZE ((7 * 1024) - sizeof (struct msgbuf_hd)) 1780Sstevel@tonic-gate 1790Sstevel@tonic-gate /* 1800Sstevel@tonic-gate * XXX - Macros for compatibility 1810Sstevel@tonic-gate */ 1820Sstevel@tonic-gate /* Clicks (MMU PAGES) to disk blocks */ 1830Sstevel@tonic-gate #define ctod(x) mmu_ptod(x) 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate /* Clicks (MMU PAGES) to bytes, and back (with rounding) */ 1860Sstevel@tonic-gate #define ctob(x) mmu_ptob(x) 1870Sstevel@tonic-gate #define btoc(x) mmu_btopr(x) 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate /* 1900Sstevel@tonic-gate * XXX - Old names for some backwards compatibility 1910Sstevel@tonic-gate */ 1920Sstevel@tonic-gate #define NBPG MMU_PAGESIZE 1930Sstevel@tonic-gate #define PGOFSET MMU_PAGEOFFSET 1940Sstevel@tonic-gate #define PGSHIFT MMU_PAGESHIFT 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate #define CLSIZE 1 1970Sstevel@tonic-gate #define CLSIZELOG2 0 1980Sstevel@tonic-gate #define CLBYTES PAGESIZE 1990Sstevel@tonic-gate #define CLOFSET PAGEOFFSET 2000Sstevel@tonic-gate #define CLSHIFT PAGESHIFT 2010Sstevel@tonic-gate #define clrnd(i) (i) 2020Sstevel@tonic-gate 203*722Smuffin #endif /* !_sun4_param_h */ 204