1 /* $OpenBSD: param.h,v 1.12 2007/12/31 09:23:53 martin Exp $ */ 2 /* 3 * Copyright (c) 1999 Steve Murphree, Jr. 4 * Copyright (c) 1988 University of Utah. 5 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * the Systems Programming Group of the University of Utah Computer 10 * Science Department. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. Neither the name of the University nor the names of its contributors 21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: Utah $Hdr: machparam.h 1.11 89/08/14$ 37 * 38 * @(#)param.h 7.8 (Berkeley) 6/28/91 39 */ 40 #ifndef _M88K_PARAM_H_ 41 #define _M88K_PARAM_H_ 42 43 #ifdef _KERNEL 44 #ifndef _LOCORE 45 #include <machine/cpu.h> 46 #endif /* _LOCORE */ 47 #endif 48 49 #define _MACHINE_ARCH m88k 50 #define MACHINE_ARCH "m88k" 51 #define MID_MACHINE MID_M88K 52 53 /* 54 * Round p (pointer or byte index) down to a correctly-aligned value 55 * for all data types (int, long, ...). The result is u_int and 56 * must be cast to any desired pointer type. ALIGN() is used for 57 * aligning stack, which needs to be on a double word boundary for 58 * 88k. 59 */ 60 61 #define ALIGNBYTES 15 /* 64 bit alignment */ 62 #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) 63 #define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) 64 65 #define NBPG (1 << PGSHIFT) /* bytes/page */ 66 #define PGOFSET (NBPG-1) /* byte offset into page */ 67 #define PGSHIFT 12 /* LOG2(NBPG) */ 68 69 #define PAGE_SHIFT 12 70 #define PAGE_SIZE (1 << PAGE_SHIFT) 71 #define PAGE_MASK (PAGE_SIZE - 1) 72 73 #define NPTEPG (PAGE_SIZE / (sizeof(pt_entry_t))) 74 75 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 76 #define DEV_BSIZE (1 << DEV_BSHIFT) 77 #define BLKDEV_IOSIZE 2048 78 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 79 80 #define UPAGES 2 /* pages of u-area */ 81 #define USPACE (UPAGES * NBPG) 82 #define USPACE_ALIGN (0) /* u-area alignment 0-none */ 83 84 /* 85 * Constants related to network buffer management. 86 */ 87 #define NMBCLUSTERS 2048 /* map size, max cluster allocation */ 88 89 /* 90 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 91 * logical pages. 92 */ 93 #define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) 94 #define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) 95 96 #define MSGBUFSIZE PAGE_SIZE 97 98 /* pages ("clicks") to disk blocks */ 99 #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) 100 #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) 101 102 /* bytes to disk blocks */ 103 #define btodb(x) ((x) >> DEV_BSHIFT) 104 #define dbtob(x) ((x) << DEV_BSHIFT) 105 106 /* 107 * Get interrupt glue. 108 */ 109 #include <machine/intr.h> 110 111 #ifdef _KERNEL 112 113 #define DELAY(x) delay(x) 114 115 #if !defined(_LOCORE) 116 extern void delay(int); 117 extern int cputyp; 118 #endif 119 120 /* 121 * Values for the cputyp variable. 122 */ 123 #define CPU_88100 0x00 124 #define CPU_88110 0x01 125 126 #ifdef M88100 127 #ifdef M88110 128 #define CPU_IS88100 (cputyp == CPU_88100) 129 #define CPU_IS88110 (cputyp != CPU_88100) 130 #else 131 #define CPU_IS88100 1 132 #define CPU_IS88110 0 133 #endif 134 #else 135 #define CPU_IS88100 0 136 #define CPU_IS88110 1 137 #endif 138 139 #endif /* _KERNEL */ 140 #endif /* !_M88K_PARAM_H_ */ 141