param.h revision 224232
1130561Sobrien/*-
2130561Sobrien * Copyright (c) 1990 The Regents of the University of California.
3130561Sobrien * All rights reserved.
4130561Sobrien *
5130561Sobrien * This code is derived from software contributed to Berkeley by
6130561Sobrien * William Jolitz.
7130561Sobrien *
8130561Sobrien * Redistribution and use in source and binary forms, with or without
9130561Sobrien * modification, are permitted provided that the following conditions
10130561Sobrien * are met:
11130561Sobrien * 1. Redistributions of source code must retain the above copyright
12130561Sobrien *    notice, this list of conditions and the following disclaimer.
13130561Sobrien * 2. Redistributions in binary form must reproduce the above copyright
14130561Sobrien *    notice, this list of conditions and the following disclaimer in the
15130561Sobrien *    documentation and/or other materials provided with the distribution.
16130561Sobrien *
17130561Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18130561Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19130561Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20130561Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21130561Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22130561Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23130561Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24130561Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25130561Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26130561Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27130561Sobrien * SUCH DAMAGE.
28218822Sdim *
29130561Sobrien *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
30130561Sobrien * $FreeBSD: head/sys/sparc64/include/param.h 224232 2011-07-20 18:51:18Z marius $
31130561Sobrien */
32130561Sobrien
33130561Sobrien#ifndef _SPARC64_INCLUDE_PARAM_H_
34130561Sobrien#define	_SPARC64_INCLUDE_PARAM_H_
35130561Sobrien
36130561Sobrien/*
37130561Sobrien * Machine dependent constants for sparc64.
38130561Sobrien */
39130561Sobrien
40130561Sobrien#include <machine/_align.h>
41130561Sobrien
42130561Sobrien#define __PCI_BAR_ZERO_VALID
43130561Sobrien
44130561Sobrien#ifndef MACHINE
45130561Sobrien#define MACHINE		"sparc64"
46130561Sobrien#endif
47130561Sobrien#ifndef MACHINE_ARCH
48130561Sobrien#define	MACHINE_ARCH	"sparc64"
49130561Sobrien#endif
50130561Sobrien#define MID_MACHINE	MID_SPARC64
51130561Sobrien
52130561Sobrien#if defined(SMP) || defined(KLD_MODULE)
53130561Sobrien#ifndef MAXCPU
54130561Sobrien#define MAXCPU		64
55130561Sobrien#endif
56130561Sobrien#else
57130561Sobrien#define MAXCPU		1
58130561Sobrien#endif /* SMP || KLD_MODULE */
59218822Sdim
60218822Sdim#define	INT_SHIFT	2
61218822Sdim#define	PTR_SHIFT	3
62218822Sdim
63130561Sobrien#define ALIGNBYTES	_ALIGNBYTES
64130561Sobrien#define ALIGN(p)	_ALIGN(p)
65130561Sobrien/*
66130561Sobrien * ALIGNED_POINTER is a boolean macro that checks whether an address
67130561Sobrien * is valid to fetch data elements of type t from on this architecture.
68130561Sobrien * This does not reflect the optimal alignment, just the possibility
69130561Sobrien * (within reasonable limits).
70130561Sobrien */
71130561Sobrien#define	ALIGNED_POINTER(p, t)	((((u_long)(p)) & (sizeof (t) - 1)) == 0)
72130561Sobrien
73130561Sobrien/*
74130561Sobrien * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
75130561Sobrien * architecture.  It should be used with appropriate caution.
76130561Sobrien */
77130561Sobrien#define	CACHE_LINE_SHIFT	7
78130561Sobrien#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
79130561Sobrien
80130561Sobrien#define	PAGE_SHIFT_8K	13
81130561Sobrien#define	PAGE_SIZE_8K	(1L<<PAGE_SHIFT_8K)
82130561Sobrien#define	PAGE_MASK_8K	(PAGE_SIZE_8K-1)
83130561Sobrien
84130561Sobrien#define	PAGE_SHIFT_64K	16
85130561Sobrien#define	PAGE_SIZE_64K	(1L<<PAGE_SHIFT_64K)
86130561Sobrien#define	PAGE_MASK_64K	(PAGE_SIZE_64K-1)
87130561Sobrien
88130561Sobrien#define	PAGE_SHIFT_512K	19
89130561Sobrien#define	PAGE_SIZE_512K	(1L<<PAGE_SHIFT_512K)
90130561Sobrien#define	PAGE_MASK_512K	(PAGE_SIZE_512K-1)
91130561Sobrien
92130561Sobrien#define	PAGE_SHIFT_4M	22
93130561Sobrien#define	PAGE_SIZE_4M	(1L<<PAGE_SHIFT_4M)
94130561Sobrien#define	PAGE_MASK_4M	(PAGE_SIZE_4M-1)
95130561Sobrien
96130561Sobrien#define	PAGE_SHIFT_32M	25
97130561Sobrien#define	PAGE_SIZE_32M	(1L<<PAGE_SHIFT_32M)
98130561Sobrien#define	PAGE_MASK_32M	(PAGE_SIZE_32M-1)
99130561Sobrien
100130561Sobrien#define	PAGE_SHIFT_256M	28
101130561Sobrien#define	PAGE_SIZE_256M	(1L<<PAGE_SHIFT_256M)
102130561Sobrien#define	PAGE_MASK_256M	(PAGE_SIZE_256M-1)
103130561Sobrien
104130561Sobrien#define PAGE_SHIFT_MIN	PAGE_SHIFT_8K
105130561Sobrien#define PAGE_SIZE_MIN	PAGE_SIZE_8K
106130561Sobrien#define PAGE_MASK_MIN	PAGE_MASK_8K
107130561Sobrien#define PAGE_SHIFT	PAGE_SHIFT_8K	/* LOG2(PAGE_SIZE) */
108130561Sobrien#define PAGE_SIZE	PAGE_SIZE_8K	/* bytes/page */
109130561Sobrien#define PAGE_MASK	PAGE_MASK_8K
110130561Sobrien#define PAGE_SHIFT_MAX	PAGE_SHIFT_4M
111130561Sobrien#define PAGE_SIZE_MAX	PAGE_SIZE_4M
112130561Sobrien#define PAGE_MASK_MAX	PAGE_MASK_4M
113130561Sobrien
114130561Sobrien#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
115130561Sobrien
116130561Sobrien#ifndef KSTACK_PAGES
117130561Sobrien#define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
118130561Sobrien#endif
119130561Sobrien#define KSTACK_GUARD_PAGES	1	/* pages of kstack guard; 0 disables */
120130561Sobrien#define PCPU_PAGES		1
121130561Sobrien
122130561Sobrien/*
123130561Sobrien * Ceiling on size of buffer cache (really only effects write queueing,
124130561Sobrien * the VM page cache is not effected), can be changed via
125130561Sobrien * the kern.maxbcache /boot/loader.conf variable.
126130561Sobrien */
127130561Sobrien#ifndef VM_BCACHE_SIZE_MAX
128130561Sobrien#define VM_BCACHE_SIZE_MAX      (400 * 1024 * 1024)
129130561Sobrien#endif
130130561Sobrien
131130561Sobrien/*
132218822Sdim * Mach derived conversion macros
133218822Sdim */
134130561Sobrien#define round_page(x)		(((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK)
135130561Sobrien#define trunc_page(x)		((unsigned long)(x) & ~PAGE_MASK)
136130561Sobrien
137130561Sobrien#define atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
138218822Sdim#define ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
139130561Sobrien
140218822Sdim#define sparc64_btop(x)		((unsigned long)(x) >> PAGE_SHIFT)
141130561Sobrien#define sparc64_ptob(x)		((unsigned long)(x) << PAGE_SHIFT)
142130561Sobrien
143130561Sobrien#define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024))
144218822Sdim
145130561Sobrien#endif /* !_SPARC64_INCLUDE_PARAM_H_ */
146130561Sobrien