xref: /netbsd-src/sys/arch/sparc/include/param.h (revision cb40c69b164a69aec47d70a50d23979d0f1752cb)
1*cb40c69bSandvar /*	$NetBSD: param.h,v 1.75 2023/06/02 08:51:46 andvar Exp $ */
2274a9076Sderaadt 
34588caefSderaadt /*
44588caefSderaadt  * Copyright (c) 1992, 1993
54588caefSderaadt  *	The Regents of the University of California.  All rights reserved.
64588caefSderaadt  *
74588caefSderaadt  * This software was developed by the Computer Systems Engineering group
84588caefSderaadt  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
94588caefSderaadt  * contributed to Berkeley.
104588caefSderaadt  *
114588caefSderaadt  * All advertising materials mentioning features or use of this software
124588caefSderaadt  * must display the following acknowledgement:
134588caefSderaadt  *	This product includes software developed by the University of
144588caefSderaadt  *	California, Lawrence Berkeley Laboratory.
154588caefSderaadt  *
164588caefSderaadt  * Redistribution and use in source and binary forms, with or without
174588caefSderaadt  * modification, are permitted provided that the following conditions
184588caefSderaadt  * are met:
194588caefSderaadt  * 1. Redistributions of source code must retain the above copyright
204588caefSderaadt  *    notice, this list of conditions and the following disclaimer.
214588caefSderaadt  * 2. Redistributions in binary form must reproduce the above copyright
224588caefSderaadt  *    notice, this list of conditions and the following disclaimer in the
234588caefSderaadt  *    documentation and/or other materials provided with the distribution.
24aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
254588caefSderaadt  *    may be used to endorse or promote products derived from this software
264588caefSderaadt  *    without specific prior written permission.
274588caefSderaadt  *
284588caefSderaadt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
294588caefSderaadt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
304588caefSderaadt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
314588caefSderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
324588caefSderaadt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
334588caefSderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
344588caefSderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
354588caefSderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
364588caefSderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
374588caefSderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
384588caefSderaadt  * SUCH DAMAGE.
394588caefSderaadt  *
404588caefSderaadt  *	@(#)param.h	8.1 (Berkeley) 6/11/93
414588caefSderaadt  */
424588caefSderaadt /*
4376404b0bSpk  * Sun4M support by Aaron Brown, Harvard University.
4476404b0bSpk  * Changes Copyright (c) 1995 The President and Fellows of Harvard College.
4576404b0bSpk  * All rights reserved.
464588caefSderaadt  */
4718ec26aaScgd #define	_MACHINE	sparc
484588caefSderaadt #define	MACHINE		"sparc"
4918ec26aaScgd #define	_MACHINE_ARCH	sparc
50edcba29bScgd #define	MACHINE_ARCH	"sparc"
517ee2311bSderaadt #define	MID_MACHINE	MID_SPARC
524588caefSderaadt 
53efdd83f4Sthorpej #include <machine/cpuconf.h>		/* XXX */
547a2abff3Sjdc #ifdef _KERNEL				/* XXX */
552f3ad94fSpk #ifndef _LOCORE				/* XXX */
564588caefSderaadt #include <machine/cpu.h>		/* XXX */
574588caefSderaadt #endif					/* XXX */
582f3ad94fSpk #endif					/* XXX */
592f3ad94fSpk 
6082241bcfSderaadt #define SUN4_PGSHIFT	13	/* for a sun4 machine */
6182241bcfSderaadt #define SUN4CM_PGSHIFT	12	/* for a sun4c or sun4m machine */
6282241bcfSderaadt 
6382241bcfSderaadt /*
6452acac05Spk  * The following variables are always defined and initialized (in locore)
6552acac05Spk  * so independently compiled modules (e.g. LKMs) can be used irrespective
6652acac05Spk  * of the `options SUN4?' combination a particular kernel was configured with.
6752acac05Spk  * See also the definitions of NBPG, PGOFSET and PGSHIFT below.
6882241bcfSderaadt  */
691e5bf777Spk #if (defined(_KERNEL) || defined(_STANDALONE)) && !defined(_LOCORE)
70358f853fSmrg extern int nbpg, pgofset, pgshift;
71358f853fSmrg #endif
724588caefSderaadt 
73119a9182Smartin #if !(defined(PROM_AT_F0) || defined(MSIIEP))
74f5bb941fSpk #define	KERNBASE	0xf0000000	/* start of kernel virtual space */
75119a9182Smartin #else
76119a9182Smartin /*
77119a9182Smartin  * JS1/OF has prom sitting in f000.0000..f007.ffff, modify kernel VA
78*cb40c69bSandvar  * layout to work around that. XXX - kernel should live beyond prom on
79119a9182Smartin  * those machines.
80119a9182Smartin  */
81119a9182Smartin #define	KERNBASE	0xe8000000
82119a9182Smartin #endif
83cfc246f9Scjs #define KERNEND		0xfe000000	/* end of kernel virtual space */
84b0c181d2Schristos #define PROM_LOADADDR	0x00004000	/* where the prom loads us */
85b0c181d2Schristos #define	KERNTEXTOFF	(KERNBASE+PROM_LOADADDR)/* start of kernel text */
864588caefSderaadt 
87b71f248bSderaadt #define	SSIZE		1		/* initial stack size in pages */
8882241bcfSderaadt #define	USPACE		8192
894588caefSderaadt 
904588caefSderaadt /*
914588caefSderaadt  * Constants related to network buffer management.
9205132683Sragge  * MCLBYTES must be no larger than NBPG (the software page size), and,
934588caefSderaadt  * on machines that exchange pages of input or output buffers with mbuf
944588caefSderaadt  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
954588caefSderaadt  * of the hardware page size.
964588caefSderaadt  */
97d738f90fSitojun #define	MSIZE		256		/* size of an mbuf */
984588caefSderaadt 
99d9ab16baSsimonb #ifndef MCLSHIFT
100d9ab16baSsimonb #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
101d9ab16baSsimonb 					/* 2K cluster can hold Ether frame */
102d9ab16baSsimonb #endif	/* MCLSHIFT */
103d9ab16baSsimonb 
104d9ab16baSsimonb #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
105d9ab16baSsimonb 
1064588caefSderaadt /*
107dded044fSthorpej  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
108dded044fSthorpej  * logical pages.
1094588caefSderaadt  */
1104c23b30cSpara #define	NKMEMPAGES_MIN_DEFAULT	((16 * 1024 * 1024) >> PAGE_SHIFT)
1114c23b30cSpara #define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
1124588caefSderaadt 
1138001e23cSpk #if defined(_KERNEL) || defined(_STANDALONE)
1148001e23cSpk #ifndef _LOCORE
11558c984f9Schristos 
11658c984f9Schristos #ifndef __HIDE_DELAY
1178ea3cb44Suwe extern void	delay(unsigned int);
1188001e23cSpk #define	DELAY(n)	delay(n)
11958c984f9Schristos #endif /* __HIDE_DELAY */
12058c984f9Schristos 
1218001e23cSpk #endif /* _LOCORE */
1228001e23cSpk 
123ee71ea68Suwe /*
124ee71ea68Suwe  * microSPARC-IIep is a sun4m but with an integrated PCI controller.
125ee71ea68Suwe  * In a lot of places (like pmap &c) we want it to be treated as SUN4M.
126ee71ea68Suwe  * But since various low-level things are done very differently from
127ee71ea68Suwe  * normal sparcs (and since for now it requires a relocated kernel
128ee71ea68Suwe  * anyway), the MSIIEP kernels are not supposed to support any other
129ee71ea68Suwe  * system.  So insist on SUN4M defined and SUN4 and SUN4C not defined.
130ee71ea68Suwe  */
131ee71ea68Suwe #if defined(MSIIEP)
132477ba79eSthorpej #if defined(SUN4) || defined(SUN4C) || defined(SUN4D)
133477ba79eSthorpej #error "microSPARC-IIep kernels cannot support sun4, sun4c, or sun4d"
134ee71ea68Suwe #endif
135ee71ea68Suwe #if !defined(SUN4M)
136ee71ea68Suwe #error "microSPARC-IIep kernel must have 'options SUN4M'"
137ee71ea68Suwe #endif
138ee71ea68Suwe #endif /* MSIIEP */
139ee71ea68Suwe 
1402f3ad94fSpk /*
141efdd83f4Sthorpej  * Sun4 machines have a page size of 8192.  All other machines have a page
142efdd83f4Sthorpej  * size of 4096.  Short cut page size variables if we can.
143be0b3b8bSthorpej  */
1447d6525e9Sthorpej #if CPU_NTYPES != 0 && !defined(SUN4)
145be0b3b8bSthorpej #	define NBPG		4096
146be0b3b8bSthorpej #	define PGOFSET		(NBPG-1)
147be0b3b8bSthorpej #	define PGSHIFT		SUN4CM_PGSHIFT
1487d6525e9Sthorpej #elif CPU_NTYPES == 1 && defined(SUN4)
14952acac05Spk #	define NBPG		8192
15052acac05Spk #	define PGOFSET		(NBPG-1)
15152acac05Spk #	define PGSHIFT		SUN4_PGSHIFT
1527d6525e9Sthorpej #else
153fd8ac8b2Spk #	define NBPG		nbpg
154fd8ac8b2Spk #	define PGOFSET		pgofset
155fd8ac8b2Spk #	define PGSHIFT		pgshift
1562f3ad94fSpk #endif
157be0b3b8bSthorpej 
15823a77a73Sisaki /* Default audio blocksize in msec.  See sys/dev/audio/audio.c */
15923a77a73Sisaki #define	__AUDIO_BLK_MS (40)
16023a77a73Sisaki 
1618001e23cSpk #endif /* _KERNEL || _STANDALONE */
162