param.h revision 197316
11553Srgrimes/*-
21553Srgrimes * Copyright (c) 1990 The Regents of the University of California.
31553Srgrimes * All rights reserved.
41553Srgrimes *
51553Srgrimes * This code is derived from software contributed to Berkeley by
61553Srgrimes * William Jolitz.
71553Srgrimes *
81553Srgrimes * Redistribution and use in source and binary forms, with or without
91553Srgrimes * modification, are permitted provided that the following conditions
101553Srgrimes * are met:
111553Srgrimes * 1. Redistributions of source code must retain the above copyright
121553Srgrimes *    notice, this list of conditions and the following disclaimer.
131553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
141553Srgrimes *    notice, this list of conditions and the following disclaimer in the
151553Srgrimes *    documentation and/or other materials provided with the distribution.
161553Srgrimes *
171553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201553Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271553Srgrimes * SUCH DAMAGE.
281553Srgrimes *
291553Srgrimes *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
301553Srgrimes * $FreeBSD: head/sys/sparc64/include/param.h 197316 2009-09-18 17:04:57Z alc $
311553Srgrimes */
321553Srgrimes
331553Srgrimes#ifndef _SPARC64_INCLUDE_PARAM_H_
341553Srgrimes#define	_SPARC64_INCLUDE_PARAM_H_
3530027Scharnier
361553Srgrimes/*
3730027Scharnier * Machine dependent constants for sparc64.
3830027Scharnier */
3950479Speter
401553Srgrimes#include <machine/_align.h>
411553Srgrimes
421553Srgrimes#define __PCI_BAR_ZERO_VALID
431553Srgrimes
441553Srgrimes#ifndef MACHINE
4530027Scharnier#define MACHINE		"sparc64"
4630027Scharnier#endif
471553Srgrimes#ifndef MACHINE_ARCH
481553Srgrimes#define	MACHINE_ARCH	"sparc64"
4930027Scharnier#endif
501553Srgrimes#define MID_MACHINE	MID_SPARC64
511553Srgrimes
521553Srgrimes#if defined(SMP) || defined(KLD_MODULE)
531553Srgrimes#define MAXCPU		16
542860Srgrimes#else
5563853Simp#define MAXCPU		1
561553Srgrimes#endif /* SMP || KLD_MODULE */
5730027Scharnier
581553Srgrimes#define	INT_SHIFT	2
591553Srgrimes#define	PTR_SHIFT	3
601553Srgrimes
611553Srgrimes#define ALIGNBYTES	_ALIGNBYTES
6299800Salfred#define ALIGN(p)	_ALIGN(p)
6399800Salfred/*
641553Srgrimes * ALIGNED_POINTER is a boolean macro that checks whether an address
651553Srgrimes * is valid to fetch data elements of type t from on this architecture.
661553Srgrimes * This does not reflect the optimal alignment, just the possibility
671553Srgrimes * (within reasonable limits).
681553Srgrimes */
691553Srgrimes#define	ALIGNED_POINTER(p, t)	((((u_long)(p)) & (sizeof (t) - 1)) == 0)
701553Srgrimes
711553Srgrimes/*
721553Srgrimes * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
731553Srgrimes * architecture.  It should be used with appropriate caution.
741553Srgrimes */
751553Srgrimes#define	CACHE_LINE_SHIFT	7
761553Srgrimes#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
771553Srgrimes
781553Srgrimes#define	PAGE_SHIFT_8K	13
791553Srgrimes#define	PAGE_SIZE_8K	(1L<<PAGE_SHIFT_8K)
801553Srgrimes#define	PAGE_MASK_8K	(PAGE_SIZE_8K-1)
811553Srgrimes
829675Sbde#define	PAGE_SHIFT_64K	16
831553Srgrimes#define	PAGE_SIZE_64K	(1L<<PAGE_SHIFT_64K)
8499802Salfred#define	PAGE_MASK_64K	(PAGE_SIZE_64K-1)
851553Srgrimes
8699802Salfred#define	PAGE_SHIFT_512K	19
871553Srgrimes#define	PAGE_SIZE_512K	(1L<<PAGE_SHIFT_512K)
881553Srgrimes#define	PAGE_MASK_512K	(PAGE_SIZE_512K-1)
8930027Scharnier
901553Srgrimes#define	PAGE_SHIFT_4M	22
919675Sbde#define	PAGE_SIZE_4M	(1L<<PAGE_SHIFT_4M)
922860Srgrimes#define	PAGE_MASK_4M	(PAGE_SIZE_4M-1)
9360418Swollman
9460418Swollman#define	PAGE_SHIFT_32M	25
9560418Swollman#define	PAGE_SIZE_32M	(1L<<PAGE_SHIFT_32M)
9660418Swollman#define	PAGE_MASK_32M	(PAGE_SIZE_32M-1)
971553Srgrimes
981553Srgrimes#define	PAGE_SHIFT_256M	28
9963086Sjoe#define	PAGE_SIZE_256M	(1L<<PAGE_SHIFT_256M)
1001553Srgrimes#define	PAGE_MASK_256M	(PAGE_SIZE_256M-1)
1011553Srgrimes
1029675Sbde#define PAGE_SHIFT_MIN	PAGE_SHIFT_8K
1031553Srgrimes#define PAGE_SIZE_MIN	PAGE_SIZE_8K
1048857Srgrimes#define PAGE_MASK_MIN	PAGE_MASK_8K
1051553Srgrimes#define PAGE_SHIFT	PAGE_SHIFT_8K	/* LOG2(PAGE_SIZE) */
1061553Srgrimes#define PAGE_SIZE	PAGE_SIZE_8K	/* bytes/page */
1071553Srgrimes#define PAGE_MASK	PAGE_MASK_8K
1081553Srgrimes#define PAGE_SHIFT_MAX	PAGE_SHIFT_4M
1091553Srgrimes#define PAGE_SIZE_MAX	PAGE_SIZE_4M
1101553Srgrimes#define PAGE_MASK_MAX	PAGE_MASK_4M
11130027Scharnier
1121553Srgrimes#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
1131553Srgrimes
1141553Srgrimes#ifndef KSTACK_PAGES
1151553Srgrimes#define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
1161553Srgrimes#endif
1171553Srgrimes#define KSTACK_GUARD_PAGES	1	/* pages of kstack guard; 0 disables */
1189675Sbde#define PCPU_PAGES		1
1199675Sbde
1201553Srgrimes/*
1212860Srgrimes * Ceiling on size of buffer cache (really only effects write queueing,
1222860Srgrimes * the VM page cache is not effected), can be changed via
1231553Srgrimes * the kern.maxbcache /boot/loader.conf variable.
1241553Srgrimes */
12536670Speter#ifndef VM_BCACHE_SIZE_MAX
12636670Speter#define VM_BCACHE_SIZE_MAX      (400 * 1024 * 1024)
1271553Srgrimes#endif
12836841Speter
1291553Srgrimes/*
1301553Srgrimes * Mach derived conversion macros
1311553Srgrimes */
1321553Srgrimes#define round_page(x)		(((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK)
1331553Srgrimes#define trunc_page(x)		((unsigned long)(x) & ~PAGE_MASK)
1341553Srgrimes
1351553Srgrimes#define atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
1361553Srgrimes#define ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
1371553Srgrimes
1381553Srgrimes#define sparc64_btop(x)		((unsigned long)(x) >> PAGE_SHIFT)
1391553Srgrimes#define sparc64_ptob(x)		((unsigned long)(x) << PAGE_SHIFT)
1409675Sbde
1411553Srgrimes#define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024))
14266584Sphk
1431553Srgrimes#endif /* !_SPARC64_INCLUDE_PARAM_H_ */
1449675Sbde