xref: /netbsd-src/sys/arch/or1k/include/param.h (revision c13b49a3c52b7b8f42d27b12daffb0b0f1cd59c8)
1*c13b49a3Sskrll /* $NetBSD: param.h,v 1.3 2022/10/14 07:13:58 skrll Exp $ */
227620987Smatt 
327620987Smatt /*-
427620987Smatt  * Copyright (c) 2014 The NetBSD Foundation, Inc.
527620987Smatt  * All rights reserved.
627620987Smatt  *
727620987Smatt  * This code is derived from software contributed to The NetBSD Foundation
827620987Smatt  * by Matt Thomas of 3am Software Foundry.
927620987Smatt  *
1027620987Smatt  * Redistribution and use in source and binary forms, with or without
1127620987Smatt  * modification, are permitted provided that the following conditions
1227620987Smatt  * are met:
1327620987Smatt  * 1. Redistributions of source code must retain the above copyright
1427620987Smatt  *    notice, this list of conditions and the following disclaimer.
1527620987Smatt  * 2. Redistributions in binary form must reproduce the above copyright
1627620987Smatt  *    notice, this list of conditions and the following disclaimer in the
1727620987Smatt  *    documentation and/or other materials provided with the distribution.
1827620987Smatt  *
1927620987Smatt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2027620987Smatt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2127620987Smatt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2227620987Smatt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2327620987Smatt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2427620987Smatt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2527620987Smatt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2627620987Smatt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2727620987Smatt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2827620987Smatt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2927620987Smatt  * POSSIBILITY OF SUCH DAMAGE.
3027620987Smatt  */
3127620987Smatt 
3227620987Smatt #ifndef	_OR1K_PARAM_H_
3327620987Smatt #define	_OR1K_PARAM_H_
3427620987Smatt 
3527620987Smatt /*
3627620987Smatt  * Machine dependent constants for all OpenRISC processors
3727620987Smatt  */
3827620987Smatt 
3927620987Smatt /*
4027620987Smatt  * For KERNEL code:
4127620987Smatt  *	MACHINE must be defined by the individual port.  This is so that
4227620987Smatt  *	uname returns the correct thing, etc.
4327620987Smatt  *
4427620987Smatt  * For non-KERNEL code:
4527620987Smatt  *	If ELF, MACHINE and MACHINE_ARCH are forced to "or1k/or1k".
4627620987Smatt  */
4727620987Smatt 
4827620987Smatt #define	_MACHINE_ARCH	or1k
4927620987Smatt #define	MACHINE_ARCH	"or1k"
5027620987Smatt #define	_MACHINE	or1k
5127620987Smatt #define	MACHINE		"or1k"
5227620987Smatt 
5327620987Smatt #define	MID_MACHINE	MID_OR1K
5427620987Smatt 
5527620987Smatt /* OR1K-specific macro to align a stack pointer (downwards). */
5627620987Smatt #define STACK_ALIGNBYTES	(__BIGGEST_ALIGNMENT__ - 1)
5727620987Smatt #define	ALIGNBYTES32	__BIGGEST_ALIGNMENT__
5827620987Smatt 
59*c13b49a3Sskrll #define NKMEMPAGES_MAX_DEFAULT	((2048UL * 1024 * 1024) >> PAGE_SHIFT)
60*c13b49a3Sskrll #define NKMEMPAGES_MIN_DEFAULT	((128UL * 1024 * 1024) >> PAGE_SHIFT)
6127620987Smatt 
6227620987Smatt #define PGSHIFT		13
6327620987Smatt #define	NBPG		(1 << PGSHIFT)
6427620987Smatt #define PGOFSET		(NBPG - 1)
6527620987Smatt 
6627620987Smatt /*
6727620987Smatt  * Constants related to network buffer management.
6827620987Smatt  * MCLBYTES must be no larger than NBPG (the software page size), and
6927620987Smatt  * NBPG % MCLBYTES must be zero.
7027620987Smatt  */
7127620987Smatt #define	MSIZE		512		/* size of an mbuf */
7227620987Smatt 
7327620987Smatt #ifndef MCLSHIFT
7427620987Smatt #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
7527620987Smatt 					/* 2K cluster can hold Ether frame */
7627620987Smatt #endif	/* MCLSHIFT */
7727620987Smatt 
7827620987Smatt #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
7927620987Smatt 
8027620987Smatt #ifdef _KERNEL
8127620987Smatt void delay(unsigned long);
8227620987Smatt #define	DELAY(x)	delay(x)
8327620987Smatt #endif
8427620987Smatt 
8527620987Smatt #endif /* _OR1K_PARAM_H_ */
86