param.h revision 1.10
1/* $NetBSD: param.h,v 1.10 2007/12/31 13:38:50 ad Exp $ */ 2 3/* $OpenBSD: param.h,v 1.12 2001/07/06 02:07:41 provos Exp $ */ 4 5/* 6 * Copyright (c) 1988-1994, The University of Utah and 7 * the Computer Systems Laboratory at the University of Utah (CSL). 8 * All rights reserved. 9 * 10 * Permission to use, copy, modify and distribute this software is hereby 11 * granted provided that (1) source code retains these copyright, permission, 12 * and disclaimer notices, and (2) redistributions including binaries 13 * reproduce the notices in supporting documentation, and (3) all advertising 14 * materials mentioning features or use of this software display the following 15 * acknowledgement: ``This product includes software developed by the 16 * Computer Systems Laboratory at the University of Utah.'' 17 * 18 * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS 19 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF 20 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 21 * 22 * CSL requests users of this software to return to csl-dist@cs.utah.edu any 23 * improvements that they make and grant CSL redistribution rights. 24 * 25 * Utah $Hdr: param.h 1.18 94/12/16$ 26 */ 27 28#include <sys/featuretest.h> 29 30#if defined(_NETBSD_SOURCE) 31#include <machine/cpu.h> 32#endif 33 34/* 35 * Machine dependent constants for PA-RISC. 36 */ 37 38#define _MACHINE_ARCH hppa 39#define MACHINE_ARCH "hppa" 40#define MID_MACHINE MID_HPUX800 41 42/* 43 * Round p (pointer or byte index) up to a correctly-aligned value for all 44 * data types (int, long, ...). The result is u_int and must be cast to 45 * any desired pointer type. 46 */ 47#define ALIGNBYTES 7 48#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) 49#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0) 50 51#define PGSHIFT 12 /* LOG2(NBPG) */ 52#define NBPG (1 << PGSHIFT) /* bytes/page */ 53#define PGOFSET (NBPG-1) /* byte offset into page */ 54 55#define SEGSHIFT (PGSHIFT + (PGSHIFT-PTESHIFT)) /* LOG2(NBSEG) */ 56#define NBSEG (1 << SEGSHIFT) /* bytes/segment (quadrant) */ 57#define SEGOFSET (NBSEG-1) /* byte offset into segment */ 58 59#define KERNBASE 0x00000000 /* start of kernel virtual */ 60#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 61 62#define DEV_BSIZE 512 63#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 64#define BLKDEV_IOSIZE 2048 65#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 66 67#define SSIZE (1) /* initial stack size/NBPG */ 68#define SINCR (1) /* increment of stack/NBPG */ 69 70#define USHIFT (3) /* log2(UPAGES) */ 71#define UPAGES (1<<USHIFT) /* pages of u-area */ 72#define USPACE (UPAGES * NBPG) /* pages for user struct and kstack */ 73 74#ifndef MSGBUFSIZE 75#define MSGBUFSIZE 2*NBPG /* default message buffer size */ 76#endif 77 78/* 79 * Constants related to network buffer management. 80 * MCLBYTES must be no larger than the software page size, and, 81 * on machines that exchange pages of input or output buffers with mbuf 82 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 83 * of the hardware page size. 84 */ 85#define MSIZE 256 /* size of an mbuf */ 86#define MCLSHIFT 11 87#define MCLBYTES (1 << MCLSHIFT) /* large enough for ether MTU */ 88#define MCLOFSET (MCLBYTES - 1) 89#ifndef NMBCLUSTERS 90#define NMBCLUSTERS (2048) /* cl map size: 1MB */ 91#endif 92 93/* 94 * Size of kernel malloc arena in logical pages 95 */ 96#define NKMEMPAGES_MIN_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT) 97#define NKMEMPAGES_MAX_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT) 98 99/* 100 * Mach derived conversion macros 101 */ 102 103#define btop(x) ((unsigned long)(x) >> PGSHIFT) 104#define ptob(x) ((unsigned long)(x) << PGSHIFT) 105 106#endif 107