xref: /openbsd-src/sys/arch/hppa/include/param.h (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1 /*	$OpenBSD: param.h,v 1.37 2007/09/22 09:57:40 martin Exp $	*/
2 
3 /*
4  * Copyright (c) 1988-1994, The University of Utah and
5  * the Computer Systems Laboratory at the University of Utah (CSL).
6  * All rights reserved.
7  *
8  * Permission to use, copy, modify and distribute this software is hereby
9  * granted provided that (1) source code retains these copyright, permission,
10  * and disclaimer notices, and (2) redistributions including binaries
11  * reproduce the notices in supporting documentation, and (3) all advertising
12  * materials mentioning features or use of this software display the following
13  * acknowledgement: ``This product includes software developed by the
14  * Computer Systems Laboratory at the University of Utah.''
15  *
16  * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
17  * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
18  * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * CSL requests users of this software to return to csl-dist@cs.utah.edu any
21  * improvements that they make and grant CSL redistribution rights.
22  *
23  * 	Utah $Hdr: param.h 1.18 94/12/16$
24  */
25 
26 #include <machine/cpu.h>
27 #include <machine/intr.h>
28 
29 /*
30  * Machine dependent constants for PA-RISC.
31  */
32 
33 #define	_MACHINE	hppa
34 #define	MACHINE		"hppa"
35 #define	_MACHINE_ARCH	hppa
36 #define	MACHINE_ARCH	"hppa"
37 #define	MID_MACHINE	MID_HPUX800
38 
39 /*
40  * Round p (pointer or byte index) up to a correctly-aligned value for all
41  * data types (int, long, ...).   The result is u_int and must be cast to
42  * any desired pointer type.
43  */
44 #define	ALIGNBYTES	7
45 #define	ALIGN(p)	(((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
46 #define	ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
47 
48 #define	PAGE_SIZE	4096
49 #define	PAGE_MASK	(PAGE_SIZE-1)
50 #define	PAGE_SHIFT	12
51 
52 #define	NBPG		4096		/* bytes/page */
53 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
54 #define	PGSHIFT		12		/* LOG2(NBPG) */
55 
56 #define	KERNBASE	0x00000000	/* start of kernel virtual */
57 
58 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
59 #define	DEV_BSIZE	(1 << DEV_BSHIFT)
60 #define BLKDEV_IOSIZE	2048
61 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
62 
63 #define	MACHINE_STACK_GROWS_UP	1	/* stack grows to higher addresses */
64 
65 #define	USPACE		(4 * NBPG)	/* pages for user struct and kstack */
66 #define	USPACE_ALIGN	(0)		/* u-area alignment 0-none */
67 
68 #ifndef	MSGBUFSIZE
69 #define	MSGBUFSIZE	2*NBPG		/* default message buffer size */
70 #endif
71 
72 /*
73  * Constants related to network buffer management.
74  * MCLBYTES must be no larger than the software page size, and,
75  * on machines that exchange pages of input or output buffers with mbuf
76  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
77  * of the hardware page size.
78  */
79 #define	MSIZE		256		/* size of an mbuf */
80 #define	MCLSHIFT	11
81 #define	MCLBYTES	(1 << MCLSHIFT)	/* large enough for ether MTU */
82 #define	MCLOFSET	(MCLBYTES - 1)
83 #define	NMBCLUSTERS	4096		/* map size, max cluster allocation */
84 
85 /*
86  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
87  * logical pages.
88  */
89 #define	NKMEMPAGES_MIN_DEFAULT	((4 * 1024 * 1024) >> PAGE_SHIFT)
90 #define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
91 
92 /* pages ("clicks") (4096 bytes) to disk blocks */
93 #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
94 #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
95 
96 #define	btodb(x)	((x) >> DEV_BSHIFT)
97 #define	dbtob(x)	((x) << DEV_BSHIFT)
98 
99 #ifdef _KERNEL
100 #ifdef COMPAT_HPUX
101 /*
102  * Constants/macros for HPUX multiple mapping of user address space.
103  * Pages in the first 256Mb are mapped in at every 256Mb segment.
104  */
105 #define HPMMMASK	0xF0000000
106 #define ISHPMMADDR(v)	0		/* XXX ...jef */
107 #define HPMMBASEADDR(v)	((unsigned)(v) & ~HPMMMASK)
108 #endif
109 #endif
110 
111 #define	__SWAP_BROKEN
112