1331722Seadler/*	$NetBSD: param.h,v 1.75 2023/06/02 08:51:46 andvar Exp $ */
212891Swpaul
312891Swpaul/*
412891Swpaul * Copyright (c) 1992, 1993
512891Swpaul *	The Regents of the University of California.  All rights reserved.
612891Swpaul *
712891Swpaul * This software was developed by the Computer Systems Engineering group
812891Swpaul * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
912891Swpaul * contributed to Berkeley.
1012891Swpaul *
1112891Swpaul * All advertising materials mentioning features or use of this software
1212891Swpaul * must display the following acknowledgement:
1312891Swpaul *	This product includes software developed by the University of
1412891Swpaul *	California, Lawrence Berkeley Laboratory.
1512891Swpaul *
1612891Swpaul * Redistribution and use in source and binary forms, with or without
1712891Swpaul * modification, are permitted provided that the following conditions
1812891Swpaul * are met:
1912891Swpaul * 1. Redistributions of source code must retain the above copyright
2012891Swpaul *    notice, this list of conditions and the following disclaimer.
2112891Swpaul * 2. Redistributions in binary form must reproduce the above copyright
2212891Swpaul *    notice, this list of conditions and the following disclaimer in the
2312891Swpaul *    documentation and/or other materials provided with the distribution.
2412891Swpaul * 3. Neither the name of the University nor the names of its contributors
2512891Swpaul *    may be used to endorse or promote products derived from this software
2612891Swpaul *    without specific prior written permission.
2712891Swpaul *
2812891Swpaul * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2912891Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3012891Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3112891Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3230827Scharnier * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33114601Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34114601Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3530827Scharnier * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3630827Scharnier * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3730827Scharnier * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3830827Scharnier * SUCH DAMAGE.
3930827Scharnier *
4030827Scharnier *	@(#)param.h	8.1 (Berkeley) 6/11/93
4112891Swpaul */
4212891Swpaul/*
4312891Swpaul * Sun4M support by Aaron Brown, Harvard University.
4412891Swpaul * Changes Copyright (c) 1995 The President and Fellows of Harvard College.
4512891Swpaul * All rights reserved.
4615426Swpaul */
4715426Swpaul#define	_MACHINE	sparc
4812891Swpaul#define	MACHINE		"sparc"
4912891Swpaul#define	_MACHINE_ARCH	sparc
5012997Swpaul#define	MACHINE_ARCH	"sparc"
5120818Swpaul#define	MID_MACHINE	MID_SPARC
5212891Swpaul
5312891Swpaul#include <machine/cpuconf.h>		/* XXX */
5412891Swpaul#ifdef _KERNEL				/* XXX */
5512891Swpaul#ifndef _LOCORE				/* XXX */
5612891Swpaul#include <machine/cpu.h>		/* XXX */
5716118Swpaul#endif					/* XXX */
5815426Swpaul#endif					/* XXX */
5912891Swpaul
6012891Swpaul#define SUN4_PGSHIFT	13	/* for a sun4 machine */
6112891Swpaul#define SUN4CM_PGSHIFT	12	/* for a sun4c or sun4m machine */
6212891Swpaul
6315426Swpaul/*
6416999Swpaul * The following variables are always defined and initialized (in locore)
6516999Swpaul * so independently compiled modules (e.g. LKMs) can be used irrespective
6616999Swpaul * of the `options SUN4?' combination a particular kernel was configured with.
6715426Swpaul * See also the definitions of NBPG, PGOFSET and PGSHIFT below.
6816999Swpaul */
6915426Swpaul#if (defined(_KERNEL) || defined(_STANDALONE)) && !defined(_LOCORE)
7016999Swpaulextern int nbpg, pgofset, pgshift;
7116999Swpaul#endif
7215426Swpaul
7315426Swpaul#if !(defined(PROM_AT_F0) || defined(MSIIEP))
7415426Swpaul#define	KERNBASE	0xf0000000	/* start of kernel virtual space */
7515426Swpaul#else
7615426Swpaul/*
7719161Swpaul * JS1/OF has prom sitting in f000.0000..f007.ffff, modify kernel VA
7815426Swpaul * layout to work around that. XXX - kernel should live beyond prom on
7915426Swpaul * those machines.
8070493Sphk */
8115426Swpaul#define	KERNBASE	0xe8000000
8216999Swpaul#endif
8316999Swpaul#define KERNEND		0xfe000000	/* end of kernel virtual space */
8470493Sphk#define PROM_LOADADDR	0x00004000	/* where the prom loads us */
8516999Swpaul#define	KERNTEXTOFF	(KERNBASE+PROM_LOADADDR)/* start of kernel text */
8616999Swpaul
8712891Swpaul#define	SSIZE		1		/* initial stack size in pages */
8816999Swpaul#define	USPACE		8192
8912891Swpaul
9090298Sdes/*
9190298Sdes * Constants related to network buffer management.
9215426Swpaul * MCLBYTES must be no larger than NBPG (the software page size), and,
9370493Sphk * on machines that exchange pages of input or output buffers with mbuf
9416999Swpaul * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
9516999Swpaul * of the hardware page size.
9615426Swpaul */
9716999Swpaul#define	MSIZE		256		/* size of an mbuf */
9816999Swpaul
9916999Swpaul#ifndef MCLSHIFT
10016999Swpaul#define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
10190298Sdes					/* 2K cluster can hold Ether frame */
10290298Sdes#endif	/* MCLSHIFT */
10316999Swpaul
10416999Swpaul#define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
10516999Swpaul
106290919Saraujo/*
10716999Swpaul * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
10830827Scharnier * logical pages.
10916999Swpaul */
11016999Swpaul#define	NKMEMPAGES_MIN_DEFAULT	((16 * 1024 * 1024) >> PAGE_SHIFT)
11116999Swpaul#define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
112290919Saraujo
11316999Swpaul#if defined(_KERNEL) || defined(_STANDALONE)
11430827Scharnier#ifndef _LOCORE
11516999Swpaul
11616999Swpaul#ifndef __HIDE_DELAY
11716999Swpaulextern void	delay(unsigned int);
11816999Swpaul#define	DELAY(n)	delay(n)
11916999Swpaul#endif /* __HIDE_DELAY */
12016999Swpaul
12116999Swpaul#endif /* _LOCORE */
12216999Swpaul
12316999Swpaul/*
12416999Swpaul * microSPARC-IIep is a sun4m but with an integrated PCI controller.
12516999Swpaul * In a lot of places (like pmap &c) we want it to be treated as SUN4M.
12616999Swpaul * But since various low-level things are done very differently from
12790298Sdes * normal sparcs (and since for now it requires a relocated kernel
12890298Sdes * anyway), the MSIIEP kernels are not supposed to support any other
12916999Swpaul * system.  So insist on SUN4M defined and SUN4 and SUN4C not defined.
13016999Swpaul */
13116999Swpaul#if defined(MSIIEP)
13216999Swpaul#if defined(SUN4) || defined(SUN4C) || defined(SUN4D)
13316999Swpaul#error "microSPARC-IIep kernels cannot support sun4, sun4c, or sun4d"
13416999Swpaul#endif
13516999Swpaul#if !defined(SUN4M)
13616999Swpaul#error "microSPARC-IIep kernel must have 'options SUN4M'"
13716999Swpaul#endif
13816999Swpaul#endif /* MSIIEP */
13916999Swpaul
14016999Swpaul/*
14116999Swpaul * Sun4 machines have a page size of 8192.  All other machines have a page
14216999Swpaul * size of 4096.  Short cut page size variables if we can.
14316999Swpaul */
14416999Swpaul#if CPU_NTYPES != 0 && !defined(SUN4)
14516999Swpaul#	define NBPG		4096
14616999Swpaul#	define PGOFSET		(NBPG-1)
14716999Swpaul#	define PGSHIFT		SUN4CM_PGSHIFT
14816999Swpaul#elif CPU_NTYPES == 1 && defined(SUN4)
14916999Swpaul#	define NBPG		8192
15016999Swpaul#	define PGOFSET		(NBPG-1)
15116999Swpaul#	define PGSHIFT		SUN4_PGSHIFT
15216999Swpaul#else
15316999Swpaul#	define NBPG		nbpg
15416999Swpaul#	define PGOFSET		pgofset
15516999Swpaul#	define PGSHIFT		pgshift
15616999Swpaul#endif
15715426Swpaul
15815426Swpaul/* Default audio blocksize in msec.  See sys/dev/audio/audio.c */
15915426Swpaul#define	__AUDIO_BLK_MS (40)
16016044Swpaul
16116999Swpaul#endif /* _KERNEL || _STANDALONE */
16216999Swpaul