xref: /openbsd-src/sys/arch/alpha/include/param.h (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1 /* $OpenBSD: param.h,v 1.33 2007/09/15 10:10:37 martin 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 /*
55  * Round p (pointer or byte index) up to a correctly-aligned value for all
56  * data types (int, long, ...).   The result is u_long and must be cast to
57  * any desired pointer type.
58  *
59  * ALIGNED_POINTER is a boolean macro that checks whether an address
60  * is valid to fetch data elements of type t from on this architecture.
61  * This does not reflect the optimal alignment, just the possibility
62  * (within reasonable limits).
63  *
64  */
65 #define	ALIGNBYTES		7
66 #define	ALIGN(p)		(((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
67 #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
68 
69 #define	NBPG		(1 << ALPHA_PGSHIFT)		/* bytes/page */
70 #define	PGOFSET		(NBPG-1)			/* byte off. into pg */
71 #define	PGSHIFT		ALPHA_PGSHIFT			/* LOG2(NBPG) */
72 
73 #define PAGE_SHIFT	13
74 #define PAGE_SIZE	(1 << PAGE_SHIFT)
75 #define PAGE_MASK	(PAGE_SIZE - 1)
76 
77 #define	KERNBASE	0xfffffc0000230000	/* start of kernel virtual */
78 
79 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
80 #define	DEV_BSIZE	(1 << DEV_BSHIFT)
81 #define	BLKDEV_IOSIZE	2048
82 #ifndef	MAXPHYS
83 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
84 #endif
85 
86 #define	UPAGES		2			/* pages of u-area */
87 #define	USPACE		(UPAGES * NBPG)		/* total size of u-area */
88 #define	USPACE_ALIGN	(0)			/* u-area alignment 0-none */
89 
90 #ifndef MSGBUFSIZE
91 #define MSGBUFSIZE	NBPG		/* default message buffer size */
92 #endif
93 
94 /*
95  * Constants related to network buffer management.
96  */
97 #define	NMBCLUSTERS	4096		/* map size, max cluster allocation */
98 
99 
100 /*
101  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
102  * logical pages.
103  */
104 #define	NKMEMPAGES_MIN_DEFAULT	((8 * 1024 * 1024) >> PAGE_SHIFT)
105 #define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
106 
107 /* pages ("clicks") to disk blocks */
108 #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
109 #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
110 
111 /* bytes to disk blocks */
112 #define	btodb(x)	((x) >> DEV_BSHIFT)
113 #define	dbtob(x)	((x) << DEV_BSHIFT)
114 
115 #ifdef _KERNEL
116 #ifndef _LOCORE
117 
118 #include <machine/intr.h>
119 
120 void	delay(unsigned long);
121 #define	DELAY(n)	delay(n)
122 
123 /* XXX THE FOLLOWING PROTOTYPE BELONGS IN INTR.H */
124 int spl0(void);			/* drop ipl to zero */
125 /* XXX END INTR.H */
126 
127 /* XXX THE FOLLOWING PROTOTYPE SHOULD BE A BUS.H INTERFACE */
128 paddr_t alpha_XXX_dmamap(vaddr_t);
129 /* XXX END BUS.H */
130 
131 #endif
132 #endif /* !_KERNEL */
133