xref: /openbsd-src/sys/arch/sh/include/param.h (revision 569905a93af9a15cee7b4700af2b6e98927b2179)
1*569905a9Sclaudio /*	$OpenBSD: param.h,v 1.14 2023/12/14 13:26:49 claudio Exp $	*/
295c7671fSmiod 
395c7671fSmiod /*-
495c7671fSmiod  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
595c7671fSmiod  * Copyright (c) 1990 The Regents of the University of California.
695c7671fSmiod  * All rights reserved.
795c7671fSmiod  *
895c7671fSmiod  * This code is derived from software contributed to Berkeley by
995c7671fSmiod  * William Jolitz.
1095c7671fSmiod  *
1195c7671fSmiod  * Redistribution and use in source and binary forms, with or without
1295c7671fSmiod  * modification, are permitted provided that the following conditions
1395c7671fSmiod  * are met:
1495c7671fSmiod  * 1. Redistributions of source code must retain the above copyright
1595c7671fSmiod  *    notice, this list of conditions and the following disclaimer.
1695c7671fSmiod  * 2. Redistributions in binary form must reproduce the above copyright
1795c7671fSmiod  *    notice, this list of conditions and the following disclaimer in the
1895c7671fSmiod  *    documentation and/or other materials provided with the distribution.
1995c7671fSmiod  * 3. Neither the name of the University nor the names of its contributors
2095c7671fSmiod  *    may be used to endorse or promote products derived from this software
2195c7671fSmiod  *    without specific prior written permission.
2295c7671fSmiod  *
2395c7671fSmiod  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2495c7671fSmiod  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2595c7671fSmiod  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2695c7671fSmiod  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2795c7671fSmiod  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2895c7671fSmiod  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2995c7671fSmiod  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3095c7671fSmiod  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3195c7671fSmiod  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3295c7671fSmiod  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3395c7671fSmiod  * SUCH DAMAGE.
3495c7671fSmiod  */
3595c7671fSmiod 
3695c7671fSmiod #ifndef	_SH_PARAM_H_
3795c7671fSmiod #define	_SH_PARAM_H_
3895c7671fSmiod 
3995c7671fSmiod #define	_MACHINE_ARCH	sh
4095c7671fSmiod #define	MACHINE_ARCH	"sh"
4195c7671fSmiod 
4295c7671fSmiod #ifndef	MID_MACHINE
4395c7671fSmiod #define	MID_MACHINE	MID_SH3
4495c7671fSmiod #endif
4595c7671fSmiod 
4695c7671fSmiod #if defined(_KERNEL) && !defined(_LOCORE)
4795c7671fSmiod #include <sh/cpu.h>
4895c7671fSmiod #endif
4995c7671fSmiod 
5095c7671fSmiod /*
5195c7671fSmiod  * We use 4K pages on the sh3/sh4.  Override the PAGE_* definitions
5295c7671fSmiod  * to be compile-time constants.
5395c7671fSmiod  */
5495c7671fSmiod #define	PAGE_SHIFT		12
5595c7671fSmiod #define	PAGE_SIZE		(1 << PAGE_SHIFT)
5695c7671fSmiod #define	PAGE_MASK		(PAGE_SIZE - 1)
5795c7671fSmiod 
58184e2458Sderaadt #ifdef _KERNEL
5995c7671fSmiod 
60184e2458Sderaadt #define	NBPG			PAGE_SIZE
6112595cf0Sderaadt #define	PGSHIFT			PAGE_SHIFT
6212595cf0Sderaadt #define	PGOFSET			PAGE_MASK
63184e2458Sderaadt 
64184e2458Sderaadt #endif
6595c7671fSmiod 
6695c7671fSmiod /*
6795c7671fSmiod  * u-space.
6895c7671fSmiod  */
69fbb6dccaSdrahn #define	UPAGES		3			/* pages of u-area */
70184e2458Sderaadt #define	USPACE		(UPAGES * PAGE_SIZE)	/* total size of u-area */
7195c7671fSmiod #define	USPACE_ALIGN	(0)
72184e2458Sderaadt 
7395c7671fSmiod #if UPAGES == 1
7495c7671fSmiod #error "too small u-area"
7595c7671fSmiod #elif UPAGES == 2
7695c7671fSmiod #define	P1_STACK	/* kernel stack is P1-area */
7795c7671fSmiod #else
7895c7671fSmiod #undef	P1_STACK	/* kernel stack is P3-area */
7995c7671fSmiod #endif
8095c7671fSmiod 
81184e2458Sderaadt #ifdef _KERNEL
8295c7671fSmiod 
83965127f8Sclaudio #define	NMBCLUSTERS	(8 * 1024)		/* max cluster allocation */
8495c7671fSmiod 
85184e2458Sderaadt #ifndef MSGBUFSIZE
86184e2458Sderaadt #define	MSGBUFSIZE	PAGE_SIZE		/* default message buffer size */
87184e2458Sderaadt #endif
88184e2458Sderaadt 
89184e2458Sderaadt #endif /* _KERNEL */
90184e2458Sderaadt 
91184e2458Sderaadt #endif /* _SH_PARAM_H_ */
92