1139749Simp/*	$NetBSD: param.h,v 1.24 2021/07/19 10:28:58 christos Exp $	*/
265176Sdfr
365176Sdfr/*
465176Sdfr * Copyright (c) 1994,1995 Mark Brinicombe.
565176Sdfr * All rights reserved.
665176Sdfr *
765176Sdfr * Redistribution and use in source and binary forms, with or without
865176Sdfr * modification, are permitted provided that the following conditions
965176Sdfr * are met:
1065176Sdfr * 1. Redistributions of source code must retain the above copyright
1165176Sdfr *    notice, this list of conditions and the following disclaimer.
1265176Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1365176Sdfr *    notice, this list of conditions and the following disclaimer in the
1465176Sdfr *    documentation and/or other materials provided with the distribution.
1565176Sdfr * 3. All advertising materials mentioning features or use of this software
1665176Sdfr *    must display the following acknowledgement:
1765176Sdfr *	This product includes software developed by the RiscBSD team.
1865176Sdfr * 4. The name "RiscBSD" nor the name of the author may be used to
1965176Sdfr *    endorse or promote products derived from this software without specific
2065176Sdfr *    prior written permission.
2165176Sdfr *
2265176Sdfr * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
2365176Sdfr * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2465176Sdfr * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2565176Sdfr * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
2665176Sdfr * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2765176Sdfr * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2865176Sdfr * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2965176Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30145026Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3165176Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3265176Sdfr * SUCH DAMAGE.
3365176Sdfr */
34145019Simp
35145019Simp#ifndef	_ARM_PARAM_H_
36145019Simp#define	_ARM_PARAM_H_
37145019Simp
38145019Simp/*
39145019Simp * Machine dependent constants for all ARM processors
40145019Simp */
41145019Simp
4265176Sdfr/*
4365176Sdfr * For KERNEL code:
4465176Sdfr *	MACHINE must be defined by the individual port.  This is so that
4565176Sdfr *	uname returns the correct thing, etc.
4665176Sdfr *
4765176Sdfr *	MACHINE_ARCH may be defined by individual ports as a temporary
4865176Sdfr *	measure while we're finishing the conversion to ELF.
4965176Sdfr *
5065176Sdfr * For non-KERNEL code:
5165176Sdfr *	If ELF, MACHINE and MACHINE_ARCH are forced to "arm/armeb".
5265176Sdfr */
5365176Sdfr
5465176Sdfr#if defined(_KERNEL)
5565176Sdfr# ifndef MACHINE_ARCH			/* XXX For now */
5665176Sdfr#  ifndef __ARMEB__
5765176Sdfr#   ifdef __ARM_EABI__
5869480Sgallatin#    define	_MACHINE_ARCH	earm
5969480Sgallatin#    define	MACHINE_ARCH	"earm"
6069480Sgallatin#   else
6169480Sgallatin#    define	_MACHINE_ARCH	arm
6265176Sdfr#    define	MACHINE_ARCH	"arm"
6365176Sdfr#   endif
6465176Sdfr#  else
6565176Sdfr#   ifdef __ARM_EABI__
6665176Sdfr#    define	_MACHINE_ARCH	earmeb
6765176Sdfr#    define	MACHINE_ARCH	"earmeb"
6865176Sdfr#   else
6965176Sdfr#    define	_MACHINE_ARCH	armeb
7065176Sdfr#    define	MACHINE_ARCH	"armeb"
7165176Sdfr#   endif
7265176Sdfr#  endif /* __ARMEB__ */
7365176Sdfr# endif /* MACHINE_ARCH */
7469480Sgallatin#else
7569480Sgallatin# undef _MACHINE
7669480Sgallatin# undef MACHINE
7769480Sgallatin# undef _MACHINE_ARCH
7865176Sdfr# undef MACHINE_ARCH
7965176Sdfr# define	_MACHINE	arm
8065176Sdfr# define	MACHINE		"arm"
8167222Simp# ifndef __ARMEB__
8267222Simp#  ifdef __ARM_EABI__
8367222Simp#   ifdef __ARM_PCS_VFP
8467222Simp#    ifdef _ARM_ARCH_7
8567222Simp#     define	_MACHINE_ARCH	earmv7hf
8667222Simp#     define	MACHINE_ARCH	"earmv7hf"
87164067Sjhb#    elif defined(_ARM_ARCH_6)
88164067Sjhb#     define	_MACHINE_ARCH	earmv6hf
89164067Sjhb#     define	MACHINE_ARCH	"earmv6hf"
90145026Simp#    else
91164264Sjhb#     define	_MACHINE_ARCH	earmhf
92164264Sjhb#     define	MACHINE_ARCH	"earmhf"
93164264Sjhb#    endif
94164264Sjhb#   else
95164264Sjhb#    ifdef _ARM_ARCH_7
96164264Sjhb#     define	_MACHINE_ARCH	earmv7
97164264Sjhb#     define	MACHINE_ARCH	"earmv7"
98164264Sjhb#    elif defined(_ARM_ARCH_6)
99164264Sjhb#     define	_MACHINE_ARCH	earmv6
100164264Sjhb#     define	MACHINE_ARCH	"earmv6"
101164264Sjhb#    elif !defined(_ARM_ARCH_5T)
102164264Sjhb#     define	_MACHINE_ARCH	earmv4
103164264Sjhb#     define	MACHINE_ARCH	"earmv4"
104164264Sjhb#    else
105164264Sjhb#     define	_MACHINE_ARCH	earm
106164264Sjhb#     define	MACHINE_ARCH	"earm"
107164264Sjhb#    endif
108169221Sjhb#   endif
109169221Sjhb#  else
110164264Sjhb#   define	_MACHINE_ARCH	arm
111164264Sjhb#   define	MACHINE_ARCH	"arm"
112164264Sjhb#  endif
113164264Sjhb# else
114164264Sjhb#  ifdef __ARM_EABI__
115164264Sjhb#   ifdef __ARM_PCS_VFP
116164264Sjhb#    ifdef _ARM_ARCH_7
117164264Sjhb#     define	_MACHINE_ARCH	earmv7hfeb
118164264Sjhb#     define	MACHINE_ARCH	"earmv7hfeb"
119164264Sjhb#    elif defined(_ARM_ARCH_6)
120164264Sjhb#     define	_MACHINE_ARCH	earmv6hfeb
121164264Sjhb#     define	MACHINE_ARCH	"earmv6hfeb"
122164264Sjhb#    else
123164264Sjhb#     define	_MACHINE_ARCH	earmhfeb
124164264Sjhb#     define	MACHINE_ARCH	"earmhfeb"
125164264Sjhb#    endif
126164264Sjhb#  else
127164264Sjhb#    ifdef _ARM_ARCH_7
128169221Sjhb#     define	_MACHINE_ARCH	earmv7eb
129166176Sjhb#     define	MACHINE_ARCH	"earmv7eb"
130169221Sjhb#    elif defined(_ARM_ARCH_6)
131166176Sjhb#     define	_MACHINE_ARCH	earmv6eb
132166176Sjhb#     define	MACHINE_ARCH	"earmv6eb"
133166176Sjhb#    elif !defined(_ARM_ARCH_5T)
134166176Sjhb#     define	_MACHINE_ARCH	earmv4eb
135166176Sjhb#     define	MACHINE_ARCH	"earmv4eb"
136166176Sjhb#    else
137169221Sjhb#     define	_MACHINE_ARCH	earmeb
138169221Sjhb#     define	MACHINE_ARCH	"earmeb"
139164264Sjhb#    endif
140169221Sjhb#   endif
141164264Sjhb#  else
142164264Sjhb#   define	_MACHINE_ARCH	armeb
143164264Sjhb#   define	MACHINE_ARCH	"armeb"
144169221Sjhb#  endif
145169221Sjhb# endif /* __ARMEB__ */
146164264Sjhb#endif /* !_KERNEL */
147211430Sjhb
148211430Sjhb#define MAXCPUS		8
149211430Sjhb
150211430Sjhb#define	MID_MACHINE	MID_ARM6
151211430Sjhb
152211430Sjhb/* ARM-specific macro to align a stack pointer (downwards). */
153211430Sjhb#define STACK_ALIGNBYTES	(8 - 1)
154211430Sjhb#ifdef __ARM_EABI__
155211430Sjhb#define	ALIGNBYTES32	3
156211430Sjhb#else
157#define	ALIGNBYTES32	7
158#endif
159
160/*
161 * Constants related to network buffer management.
162 * MCLBYTES must be no larger than NBPG (the software page size), and,
163 * on machines that exchange pages of input or output buffers with mbuf
164 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
165 * of the hardware page size.
166 */
167#define	MSIZE		256		/* size of an mbuf */
168
169#ifndef MCLSHIFT
170#define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
171					/* 2K cluster can hold Ether frame */
172#endif	/* MCLSHIFT */
173
174#define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
175
176#ifndef NMBCLUSTERS_MAX
177#define	NMBCLUSTERS_MAX	(0x4000000 / MCLBYTES)	/* Limit to 64MB for clusters */
178#endif
179
180/*
181 * Compatibility /dev/zero mapping.
182 */
183#ifdef _KERNEL
184#ifdef COMPAT_16
185#define	COMPAT_ZERODEV(x)	(x == makedev(0, _DEV_ZERO_oARM))
186#endif
187#endif /* _KERNEL */
188
189#endif /* _ARM_PARAM_H_ */
190