xref: /openbsd-src/sys/arch/riscv64/include/param.h (revision e740fa6e19a2405c05417ad73018f07c75ef8029)
1*e740fa6eSjsg /*	$OpenBSD: param.h,v 1.6 2024/10/21 22:55:52 jsg Exp $	*/
2380aa7b9Sjsg 
3baed8f06Sdrahn /*-
4baed8f06Sdrahn  * Copyright (c) 1990 The Regents of the University of California.
5baed8f06Sdrahn  * All rights reserved.
6baed8f06Sdrahn  *
7baed8f06Sdrahn  * This code is derived from software contributed to Berkeley by
8baed8f06Sdrahn  * William Jolitz.
9baed8f06Sdrahn  *
10baed8f06Sdrahn  * Redistribution and use in source and binary forms, with or without
11baed8f06Sdrahn  * modification, are permitted provided that the following conditions
12baed8f06Sdrahn  * are met:
13baed8f06Sdrahn  * 1. Redistributions of source code must retain the above copyright
14baed8f06Sdrahn  *    notice, this list of conditions and the following disclaimer.
15baed8f06Sdrahn  * 2. Redistributions in binary form must reproduce the above copyright
16baed8f06Sdrahn  *    notice, this list of conditions and the following disclaimer in the
17baed8f06Sdrahn  *    documentation and/or other materials provided with the distribution.
18baed8f06Sdrahn  * 3. Neither the name of the University nor the names of its contributors
19baed8f06Sdrahn  *    may be used to endorse or promote products derived from this software
20baed8f06Sdrahn  *    without specific prior written permission.
21baed8f06Sdrahn  *
22baed8f06Sdrahn  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23baed8f06Sdrahn  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24baed8f06Sdrahn  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25baed8f06Sdrahn  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26baed8f06Sdrahn  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27baed8f06Sdrahn  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28baed8f06Sdrahn  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29baed8f06Sdrahn  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30baed8f06Sdrahn  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31baed8f06Sdrahn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32baed8f06Sdrahn  * SUCH DAMAGE.
33baed8f06Sdrahn  */
34baed8f06Sdrahn 
35baed8f06Sdrahn #ifndef	_MACHINE_PARAM_H_
36baed8f06Sdrahn #define	_MACHINE_PARAM_H_
37baed8f06Sdrahn 
38baed8f06Sdrahn #ifdef _KERNEL
39baed8f06Sdrahn #ifndef _LOCORE
40baed8f06Sdrahn #include <machine/cpu.h>
41baed8f06Sdrahn #endif
42baed8f06Sdrahn #endif
43baed8f06Sdrahn 
44baed8f06Sdrahn #define	_MACHINE	riscv64
45baed8f06Sdrahn #define	MACHINE		"riscv64"
46*e740fa6eSjsg #define	_MACHINE_ARCH	riscv64
47baed8f06Sdrahn #define	MACHINE_ARCH	"riscv64"
48baed8f06Sdrahn #define	MID_MACHINE	MID_RISCV64
49baed8f06Sdrahn 
50baed8f06Sdrahn #define	PAGE_SHIFT	12
51baed8f06Sdrahn #define	PAGE_SIZE	(1 << PAGE_SHIFT)
52baed8f06Sdrahn #define	PAGE_MASK	(PAGE_SIZE - 1)
53baed8f06Sdrahn 
54baed8f06Sdrahn #ifdef _KERNEL
55baed8f06Sdrahn 
56baed8f06Sdrahn #define	NBPG		PAGE_SIZE		/* bytes/page */
57baed8f06Sdrahn #define	PGSHIFT		PAGE_SHIFT		/* LOG2(PAGE_SIZE) */
58baed8f06Sdrahn #define	PGOFSET		PAGE_MASK		/* byte offset into page */
59baed8f06Sdrahn 
6072024cb9Sderaadt #define	UPAGES		5			/* pages of u-area */
6172024cb9Sderaadt #define	USPACE		(UPAGES * PAGE_SIZE)	/* total size of u-area */
6272024cb9Sderaadt #define	USPACE_ALIGN	0			/* u-area alignment 0-none */
63baed8f06Sdrahn 
6472024cb9Sderaadt #define	NMBCLUSTERS	(64 * 1024)		/* max cluster allocation */
65baed8f06Sdrahn 
66baed8f06Sdrahn #ifndef	MSGBUFSIZE
6772024cb9Sderaadt #define	MSGBUFSIZE	(16 * PAGE_SIZE)	/* default message buffer size */
68baed8f06Sdrahn #endif
69baed8f06Sdrahn 
70baed8f06Sdrahn #define	STACKALIGNBYTES		(16 - 1)
71baed8f06Sdrahn #define	STACKALIGN(p)		((u_long)(p) &~ STACKALIGNBYTES)
72baed8f06Sdrahn 
73baed8f06Sdrahn #define __HAVE_FDT
74baed8f06Sdrahn 
75baed8f06Sdrahn #endif /* _KERNEL */
76baed8f06Sdrahn 
77baed8f06Sdrahn #endif /* _MACHINE_PARAM_H_ */
78