xref: /openbsd/sys/arch/sh/include/param.h (revision cca36db2)
1 /*	$OpenBSD: param.h,v 1.8 2011/09/08 03:40:32 guenther Exp $	*/
2 /*	$NetBSD: param.h,v 1.15 2006/08/28 13:43:35 yamt Exp $	*/
3 
4 /*-
5  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
6  * Copyright (c) 1990 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * William Jolitz.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *	@(#)param.h	5.8 (Berkeley) 6/28/91
37  */
38 
39 /*
40  * SuperH dependent constants.
41  */
42 
43 #ifndef _SH_PARAM_H_
44 #define	_SH_PARAM_H_
45 
46 #define	_MACHINE_ARCH	sh
47 #define	MACHINE_ARCH	"sh"
48 
49 #ifndef	MID_MACHINE
50 #define	MID_MACHINE	MID_SH3
51 #endif
52 
53 #if defined(_KERNEL) && !defined(_LOCORE)
54 #include <sh/cpu.h>
55 #endif
56 
57 /*
58  * We use 4K pages on the sh3/sh4.  Override the PAGE_* definitions
59  * to be compile-time constants.
60  */
61 #define	PAGE_SHIFT		12
62 #define	PAGE_SIZE		(1 << PAGE_SHIFT)
63 #define	PAGE_MASK		(PAGE_SIZE - 1)
64 
65 #define	PGSHIFT			PAGE_SHIFT
66 #define	NBPG			PAGE_SIZE
67 #define	PGOFSET			PAGE_MASK
68 
69 #define	ALIGNBYTES		_ALIGNBYTES
70 #define	ALIGN(p)		_ALIGN(p)
71 #define	ALIGNED_POINTER(p,t)	_ALIGNED_POINTER(p,t)
72 
73 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
74 #define	DEV_BSIZE	(1 << DEV_BSHIFT)
75 #define	BLKDEV_IOSIZE	2048
76 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
77 
78 /*
79  * u-space.
80  */
81 #define	UPAGES		3		/* pages of u-area */
82 #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
83 #define	USPACE_ALIGN	(0)
84 #if UPAGES == 1
85 #error "too small u-area"
86 #elif UPAGES == 2
87 #define	P1_STACK	/* kernel stack is P1-area */
88 #else
89 #undef	P1_STACK	/* kernel stack is P3-area */
90 #endif
91 
92 #ifndef MSGBUFSIZE
93 #define	MSGBUFSIZE	NBPG		/* default message buffer size */
94 #endif
95 
96 /* pages to disk blocks */
97 #define	ctod(x)		((x) << (PAGE_SHIFT - DEV_BSHIFT))
98 #define	dtoc(x)		((x) >> (PAGE_SHIFT - DEV_BSHIFT))
99 
100 /* bytes to disk blocks */
101 #define	btodb(x)	((x) >> DEV_BSHIFT)
102 #define	dbtob(x)	((x) << DEV_BSHIFT)
103 
104 /*
105  * Constants related to network buffer management.
106  */
107 #define	NMBCLUSTERS	4096		/* map size, max cluster allocation */
108 
109 /*
110  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
111  * logical pages.
112  */
113 #define	NKMEMPAGES_MIN_DEFAULT	((4 * 1024 * 1024) >> PAGE_SHIFT)
114 #define	NKMEMPAGES_MAX_DEFAULT	((64 * 1024 * 1024) >> PAGE_SHIFT)
115 
116 #endif /* !_SH_PARAM_H_ */
117