1 /* $OpenBSD: param.h,v 1.35 2011/09/08 03:40:32 guenther 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 #include <machine/alpha_cpu.h> 52 #include <machine/cpu.h> 53 54 #define ALIGNBYTES _ALIGNBYTES 55 #define ALIGN(p) _ALIGN(p) 56 #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) 57 58 #define NBPG (1 << ALPHA_PGSHIFT) /* bytes/page */ 59 #define PGOFSET (NBPG-1) /* byte off. into pg */ 60 #define PGSHIFT ALPHA_PGSHIFT /* LOG2(NBPG) */ 61 62 #define PAGE_SHIFT 13 63 #define PAGE_SIZE (1 << PAGE_SHIFT) 64 #define PAGE_MASK (PAGE_SIZE - 1) 65 66 #define KERNBASE 0xfffffc0000580000 /* start of kernel virtual */ 67 68 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 69 #define DEV_BSIZE (1 << DEV_BSHIFT) 70 #define BLKDEV_IOSIZE 2048 71 #ifndef MAXPHYS 72 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 73 #endif 74 75 #define UPAGES 2 /* pages of u-area */ 76 #define USPACE (UPAGES * NBPG) /* total size of u-area */ 77 #define USPACE_ALIGN (0) /* u-area alignment 0-none */ 78 79 #ifndef MSGBUFSIZE 80 #define MSGBUFSIZE NBPG /* default message buffer size */ 81 #endif 82 83 /* 84 * Constants related to network buffer management. 85 */ 86 #define NMBCLUSTERS 4096 /* map size, max cluster allocation */ 87 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 ((8 * 1024 * 1024) >> PAGE_SHIFT) 94 #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) 95 96 /* pages ("clicks") to disk blocks */ 97 #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) 98 #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) 99 100 /* bytes to disk blocks */ 101 #define btodb(x) ((x) >> DEV_BSHIFT) 102 #define dbtob(x) ((x) << DEV_BSHIFT) 103 104 #ifdef _KERNEL 105 #ifndef _LOCORE 106 107 #include <machine/intr.h> 108 109 void delay(unsigned long); 110 #define DELAY(n) delay(n) 111 112 /* XXX THE FOLLOWING PROTOTYPE BELONGS IN INTR.H */ 113 int spl0(void); /* drop ipl to zero */ 114 /* XXX END INTR.H */ 115 116 /* XXX THE FOLLOWING PROTOTYPE SHOULD BE A BUS.H INTERFACE */ 117 paddr_t alpha_XXX_dmamap(vaddr_t); 118 /* XXX END BUS.H */ 119 120 #endif 121 #endif /* !_KERNEL */ 122