1 /* $OpenBSD: param.h,v 1.41 2018/09/14 13:58:20 claudio Exp $ */ 2 3 /* 4 * Copyright (c) 1992, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This software was developed by the Computer Systems Engineering group 8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 9 * contributed to Berkeley. 10 * 11 * All advertising materials mentioning features or use of this software 12 * must display the following acknowledgement: 13 * This product includes software developed by the University of 14 * California, Lawrence Berkeley Laboratory. 15 * 16 * Redistribution and use in source and binary forms, with or without 17 * modification, are permitted provided that the following conditions 18 * are met: 19 * 1. Redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer. 21 * 2. Redistributions in binary form must reproduce the above copyright 22 * notice, this list of conditions and the following disclaimer in the 23 * documentation and/or other materials provided with the distribution. 24 * 3. Neither the name of the University nor the names of its contributors 25 * may be used to endorse or promote products derived from this software 26 * without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 * SUCH DAMAGE. 39 */ 40 41 /* 42 * Copyright (c) 1996-1999 Eduardo Horvath 43 * 44 * Redistribution and use in source and binary forms, with or without 45 * modification, are permitted provided that the following conditions 46 * are met: 47 * 1. Redistributions of source code must retain the above copyright 48 * notice, this list of conditions and the following disclaimer. 49 * 50 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60 * SUCH DAMAGE. 61 * 62 */ 63 64 #ifndef _MACHINE_PARAM_H_ 65 #define _MACHINE_PARAM_H_ 66 67 #define _MACHINE sparc64 68 #define MACHINE "sparc64" 69 #define _MACHINE_ARCH sparc64 70 #define MACHINE_ARCH "sparc64" 71 #define MID_MACHINE MID_SPARC64 72 73 #define PAGE_SHIFT 13 74 #define PAGE_SIZE (1 << PAGE_SHIFT) 75 #define PAGE_MASK (PAGE_SIZE - 1) 76 77 /* 78 * Here are all the magic kernel virtual addresses and how they're allocated. 79 * 80 * First, the PROM is usually a fixed-sized block from 0x00000000f0000000 to 81 * 0x00000000f0100000. It also uses some space around 0x00000000fff00000 to 82 * map in device registers. The rest is pretty much ours to play with. 83 * 84 * The kernel starts at KERNBASE. Here's the layout. We use macros to set 85 * the addresses so we can relocate everything easily. We use 4MB locked TTEs 86 * to map in the kernel text and data segments. Any extra pages are recycled, 87 * so they can potentially be double-mapped. This shouldn't really be a 88 * problem since they're unused, but wild pointers can cause silent data 89 * corruption if they are in those segments. 90 * 91 * 0x0000000000000000: 64K NFO page zero 92 * 0x0000000000010000: Userland or PROM 93 * KERNBASE: 4MB kernel text and read only data 94 * This is mapped in the ITLB and 95 * Read-Only in the DTLB 96 * KERNBASE+0x400000: 4MB kernel data and BSS -- not in ITLB 97 * Contains context table, kernel pmap, 98 * and other important structures. 99 * KERNBASE+0x800000: Unmapped page -- redzone 100 * KERNBASE+0x802000: Process 0 stack and u-area 101 * KERNBASE+0x806000: 2 pages for pmap_copy_page and /dev/mem 102 * KERNBASE+0x80a000: Start of kernel VA segment 103 * KERNEND: End of kernel VA segment 104 * KERNEND+0x02000: Auxreg_va (unused?) 105 * KERNEND+0x04000: TMPMAP_VA (unused?) 106 * KERNEND+0x06000: message buffer. 107 * KERNEND+0x010000: 64K locked TTE -- different for each CPU 108 * Contains interrupt stack, cpu_info structure, 109 * and 32KB kernel TSB. 110 * 111 */ 112 #define KERNBASE 0x001000000 /* start of kernel virtual space */ 113 114 #ifdef _KERNEL 115 116 #define KERNEND 0x0e0000000 /* end of kernel virtual space */ 117 118 #define _MAXNBPG 8192 /* fixed VAs, independent of actual NBPG */ 119 120 #define AUXREG_VA ( KERNEND + _MAXNBPG) /* 1 page REDZONE */ 121 #define TMPMAP_VA ( AUXREG_VA + _MAXNBPG) 122 #define MSGBUF_VA ( TMPMAP_VA + _MAXNBPG) 123 /* 124 * Here's the location of the interrupt stack and CPU structure. 125 */ 126 #define INTSTACK ( KERNEND + 8*_MAXNBPG)/* 64K after kernel end */ 127 #define EINTSTACK ( INTSTACK + 2*USPACE) /* 32KB */ 128 #define CPUINFO_VA ( EINTSTACK) 129 130 #define NBPG PAGE_SIZE /* bytes/page */ 131 #define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */ 132 #define PGOFSET PAGE_MASK /* byte offset into page */ 133 134 #define UPAGES 2 /* pages of u-area */ 135 #define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */ 136 #define USPACE_ALIGN 0 /* u-area alignment 0-none */ 137 138 #define NMBCLUSTERS (64 * 1024) /* max cluster allocation */ 139 140 #ifndef MSGBUFSIZE 141 #define MSGBUFSIZE (1 * PAGE_SIZE) 142 #endif 143 144 /* 145 * Maximum size of the kernel malloc arena in PAGE_SIZE-sized 146 * logical pages. 147 */ 148 #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) 149 150 #ifndef _LOCORE 151 152 extern void delay(unsigned int); 153 #define DELAY(n) delay(n) 154 155 extern int cputyp; 156 157 #if defined (SUN4US) || defined (SUN4V) 158 #define CPU_ISSUN4U (cputyp == CPU_SUN4U) 159 #define CPU_ISSUN4US (cputyp == CPU_SUN4US) 160 #define CPU_ISSUN4V (cputyp == CPU_SUN4V) 161 #else 162 #define CPU_ISSUN4U (1) 163 #define CPU_ISSUN4US (0) 164 #define CPU_ISSUN4V (0) 165 #endif 166 167 #endif /* _LOCORE */ 168 169 /* 170 * Values for the cputyp variable. 171 */ 172 #define CPU_SUN4 0 173 #define CPU_SUN4C 1 174 #define CPU_SUN4M 2 175 #define CPU_SUN4U 3 176 #define CPU_SUN4US 4 177 #define CPU_SUN4V 5 178 179 /* 180 * On a sun4u machine, the page size is 8192. 181 */ 182 183 #ifndef _LOCORE 184 #include <machine/cpu.h> 185 #endif 186 187 #endif /* _KERNEL */ 188 189 #endif /* _MACHINE_PARAM_H_ */ 190