1 /* $OpenBSD: param.h,v 1.36 2012/06/26 01:59:47 deraadt Exp $ */ 2 /* $NetBSD: param.h,v 1.30 2000/06/09 16:03:04 thorpej Exp $ */ 3 4 /* 5 * Copyright (c) 1988 University of Utah. 6 * Copyright (c) 1992, 1993 7 * The Regents of the University of California. All rights reserved. 8 * 9 * This code is derived from software contributed to Berkeley by 10 * the Systems Programming Group of the University of Utah Computer 11 * Science Department and Ralph Campbell. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * from: Utah $Hdr: machparam.h 1.11 89/08/14$ 38 * 39 * @(#)param.h 8.1 (Berkeley) 6/10/93 40 */ 41 42 /* 43 * Machine dependent constants for the Alpha. 44 */ 45 #define _MACHINE alpha 46 #define MACHINE "alpha" 47 #define _MACHINE_ARCH alpha 48 #define MACHINE_ARCH "alpha" 49 #define MID_MACHINE MID_ALPHA 50 51 #ifdef _KERNEL 52 #include <machine/cpu.h> 53 #endif 54 55 #define ALIGNBYTES _ALIGNBYTES 56 #define ALIGN(p) _ALIGN(p) 57 #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) 58 59 #define NBPG (1 << 13) /* bytes/page */ 60 #define PGOFSET (NBPG-1) /* byte off. into pg */ 61 #define PGSHIFT 13 /* LOG2(NBPG) */ 62 63 #define PAGE_SHIFT 13 64 #define PAGE_SIZE (1 << PAGE_SHIFT) 65 #define PAGE_MASK (PAGE_SIZE - 1) 66 67 #define KERNBASE 0xfffffc0000580000 /* start of kernel virtual */ 68 69 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 70 #define DEV_BSIZE (1 << DEV_BSHIFT) 71 #define BLKDEV_IOSIZE 2048 72 #ifndef MAXPHYS 73 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 74 #endif 75 76 #define UPAGES 2 /* pages of u-area */ 77 #define USPACE (UPAGES * NBPG) /* total size of u-area */ 78 #define USPACE_ALIGN (0) /* u-area alignment 0-none */ 79 80 #ifndef MSGBUFSIZE 81 #define MSGBUFSIZE NBPG /* default message buffer size */ 82 #endif 83 84 /* 85 * Constants related to network buffer management. 86 */ 87 #define NMBCLUSTERS 4096 /* map size, max cluster allocation */ 88 89 90 /* 91 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 92 * logical pages. 93 */ 94 #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) 95 #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) 96 97 /* pages ("clicks") to disk blocks */ 98 #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) 99 #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) 100 101 /* bytes to disk blocks */ 102 #define btodb(x) ((x) >> DEV_BSHIFT) 103 #define dbtob(x) ((x) << DEV_BSHIFT) 104 105 #ifdef _KERNEL 106 #ifndef _LOCORE 107 108 #include <machine/intr.h> 109 110 void delay(unsigned long); 111 #define DELAY(n) delay(n) 112 113 /* XXX THE FOLLOWING PROTOTYPE BELONGS IN INTR.H */ 114 int spl0(void); /* drop ipl to zero */ 115 /* XXX END INTR.H */ 116 117 /* XXX THE FOLLOWING PROTOTYPE SHOULD BE A BUS.H INTERFACE */ 118 paddr_t alpha_XXX_dmamap(vaddr_t); 119 /* XXX END BUS.H */ 120 121 #endif 122 #endif /* !_KERNEL */ 123