param.h revision 88624
157257Sdufault/*-
257257Sdufault * Copyright (c) 1990 The Regents of the University of California.
311494Sphk * All rights reserved.
411494Sphk *
523458Smpp * This code is derived from software contributed to Berkeley by
611494Sphk * William Jolitz.
711494Sphk *
8137587Snik * Redistribution and use in source and binary forms, with or without
9137587Snik * modification, are permitted provided that the following conditions
10137587Snik * are met:
11137587Snik * 1. Redistributions of source code must retain the above copyright
12137587Snik *    notice, this list of conditions and the following disclaimer.
13137587Snik * 2. Redistributions in binary form must reproduce the above copyright
14137587Snik *    notice, this list of conditions and the following disclaimer in the
15137587Snik *    documentation and/or other materials provided with the distribution.
16137587Snik *
17137587Snik * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18137587Snik * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19137587Snik * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20137587Snik * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21137587Snik * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22137587Snik * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23137587Snik * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24137587Snik * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25137587Snik * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26137587Snik * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27137587Snik * SUCH DAMAGE.
28137587Snik *
29137587Snik *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
30137587Snik * $FreeBSD: head/sys/sparc64/include/param.h 88624 2001-12-29 07:00:04Z jake $
31137587Snik */
32137587Snik
33137587Snik/*
34137587Snik * Machine dependent constants for sparc64.
35137587Snik */
36137587Snik
37137587Snik#define	TODO							\
38137587Snik	panic("implement %s", __func__)
39137587Snik
40137587Snik/*
41137587Snik * Round p (pointer or byte index) up to a correctly-aligned value
42137587Snik * for all data types (int, long, ...).   The result is unsigned int
43137587Snik * and must be cast to any desired pointer type.
44137587Snik */
45137587Snik#ifndef _ALIGNBYTES
46137587Snik#define _ALIGNBYTES	0xf
47137587Snik#endif
48137587Snik#ifndef _ALIGN
49137587Snik#define _ALIGN(p)	(((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
50137587Snik#endif
51137587Snik
52137587Snik#ifndef _MACHINE
53137587Snik#define	_MACHINE	sparc64
54137587Snik#endif
55137587Snik#ifndef _MACHINE_ARCH
56137587Snik#define	_MACHINE_ARCH	sparc64
57137587Snik#endif
58137587Snik
59137587Snik#ifndef _NO_NAMESPACE_POLLUTION
6095138Sjmallett
6195138Sjmallett#ifndef _MACHINE_PARAM_H_
6295138Sjmallett#define	_MACHINE_PARAM_H_
6395138Sjmallett
6425889Sdfr#ifndef MACHINE
6595138Sjmallett#define MACHINE		"sparc64"
6695138Sjmallett#endif
6795138Sjmallett#ifndef MACHINE_ARCH
6897996Sjmallett#define	MACHINE_ARCH	"sparc64"
69139596Smarcel#endif
7025889Sdfr#define MID_MACHINE	MID_SPARC64
7157257Sdufault
72118262Spb/*
7388242Sjkh * OBJFORMAT_NAMES is a comma-separated list of the object formats
74101902Salfred * that are supported on the architecture.
75101902Salfred */
76101902Salfred#define OBJFORMAT_NAMES		"elf"
77126049Sgreen#define OBJFORMAT_DEFAULT	"elf"
78
79#ifdef SMP
80#define MAXCPU		16
81#else
82#define MAXCPU		1
83#endif /* SMP */
84
85#define ALIGNBYTES	_ALIGNBYTES
86#define ALIGN(p)	_ALIGN(p)
87
88#define	PAGE_SHIFT_8K	13
89#define	PAGE_SIZE_8K	(1UL<<PAGE_SHIFT_8K)
90#define	PAGE_MASK_8K	(PAGE_SIZE_8K-1)
91
92#define	PAGE_SHIFT_64K	16
93#define	PAGE_SIZE_64K	(1UL<<PAGE_SHIFT_64K)
94#define	PAGE_MASK_64K	(PAGE_SIZE_64K-1)
95
96#define	PAGE_SHIFT_512K	19
97#define	PAGE_SIZE_512K	(1UL<<PAGE_SHIFT_512K)
98#define	PAGE_MASK_512K	(PAGE_SIZE_512K-1)
99
100#define	PAGE_SHIFT_4M	22
101#define	PAGE_SIZE_4M	(1UL<<PAGE_SHIFT_4M)
102#define	PAGE_MASK_4M	(PAGE_SIZE_4M-1)
103
104#define PAGE_SHIFT_MIN	PAGE_SHIFT_8K
105#define PAGE_SIZE_MIN	PAGE_SIZE_8K
106#define PAGE_MASK_MIN	PAGE_MASK_8K
107#define PAGE_SHIFT	PAGE_SHIFT_8K	/* LOG2(PAGE_SIZE) */
108#define PAGE_SIZE	PAGE_SIZE_8K	/* bytes/page */
109#define PAGE_MASK	PAGE_MASK_8K
110#define PAGE_SHIFT_MAX	PAGE_SHIFT_4M
111#define PAGE_SIZE_MAX	PAGE_SIZE_4M
112#define PAGE_MASK_MAX	PAGE_MASK_4M
113
114#define DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
115#define DEV_BSIZE	(1<<DEV_BSHIFT)
116
117#ifndef BLKDEV_IOSIZE
118#define BLKDEV_IOSIZE	PAGE_SIZE	/* default block device I/O size */
119#endif
120#define DFLTPHYS	(64 * 1024)	/* default max raw I/O transfer size */
121#define MAXPHYS		(128 * 1024)	/* max raw I/O transfer size */
122#define MAXDUMPPGS	(DFLTPHYS/PAGE_SIZE)
123
124#define KSTACK_PAGES	4	/* pages of kernel stack (with pcb) */
125#define UAREA_PAGES	1	/* pages of user area */
126
127#define KSTACK_GUARD 		/* compile in kstack guard page */
128#define KSTACK_GUARD_PAGES	1
129
130/*
131 * Constants related to network buffer management.
132 * MCLBYTES must be no larger than PAGE_SIZE.
133 */
134#ifndef	MSIZE
135#define MSIZE		256		/* size of an mbuf */
136#endif	/* MSIZE */
137
138#ifndef	MCLSHIFT
139#define MCLSHIFT	11		/* convert bytes to mbuf clusters */
140#endif	/* MCLSHIFT */
141#define MCLBYTES	(1 << MCLSHIFT)	/* size of an mbuf cluster */
142
143/*
144 * Some macros for units conversion
145 */
146
147/* clicks to bytes */
148#define ctob(x)	((unsigned long)(x)<<PAGE_SHIFT)
149
150/* bytes to clicks */
151#define btoc(x)	(((unsigned long)(x)+PAGE_MASK)>>PAGE_SHIFT)
152
153/* bytes to disk blocks */
154#define btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
155	(daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)
156
157/* disk blocks to bytes */
158#define dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
159	(off_t)((unsigned long)(db) << DEV_BSHIFT)
160
161/*
162 * Mach derived conversion macros
163 */
164#define round_page(x)		(((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK)
165#define trunc_page(x)		((unsigned long)(x) & ~PAGE_MASK)
166
167#define atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
168#define ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
169
170#define sparc64_btop(x)		((unsigned long)(x) >> PAGE_SHIFT)
171#define sparc64_ptob(x)		((unsigned long)(x) << PAGE_SHIFT)
172
173#define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024))
174
175#define	ASSERT_EQUAL(x, y)	_ASSERT_EQUAL(x, y, __LINE__)
176#define	_ASSERT_EQUAL(x, y, z)	__ASSERT_EQUAL(x, y, z)
177#define	__ASSERT_EQUAL(x, y, z)	typedef char __assert ## z[(x) == (y) ? 1 : -1]
178
179#endif /* !_MACHINE_PARAM_H_ */
180#endif /* !_NO_NAMESPACE_POLLUTION */
181