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