]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/sparc64/include/param.h
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / sys / sparc64 / include / param.h
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * William Jolitz.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *      from: @(#)param.h       5.8 (Berkeley) 6/28/91
30  * $FreeBSD$
31  */
32
33 /*
34  * Machine dependent constants for sparc64.
35  */
36
37 /*
38  * Round p (pointer or byte index) up to a correctly-aligned value
39  * for all data types (int, long, ...).   The result is unsigned int
40  * and must be cast to any desired pointer type.
41  */
42 #ifndef _ALIGNBYTES
43 #define _ALIGNBYTES     0xf
44 #endif
45 #ifndef _ALIGN
46 #define _ALIGN(p)       (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
47 #endif
48
49 #ifndef _NO_NAMESPACE_POLLUTION
50
51 #define __PCI_BAR_ZERO_VALID
52
53 #ifndef _MACHINE_PARAM_H_
54 #define _MACHINE_PARAM_H_
55
56 #ifndef MACHINE
57 #define MACHINE         "sparc64"
58 #endif
59 #ifndef MACHINE_ARCH
60 #define MACHINE_ARCH    "sparc64"
61 #endif
62 #define MID_MACHINE     MID_SPARC64
63
64 #if defined(SMP) || defined(KLD_MODULE)
65 #define MAXCPU          16
66 #else
67 #define MAXCPU          1
68 #endif /* SMP || KLD_MODULE */
69
70 #define INT_SHIFT       2
71 #define PTR_SHIFT       3
72
73 #define ALIGNBYTES      _ALIGNBYTES
74 #define ALIGN(p)        _ALIGN(p)
75 /*
76  * ALIGNED_POINTER is a boolean macro that checks whether an address
77  * is valid to fetch data elements of type t from on this architecture.
78  * This does not reflect the optimal alignment, just the possibility
79  * (within reasonable limits). 
80  */
81 #define ALIGNED_POINTER(p, t)   ((((u_long)(p)) & (sizeof (t) - 1)) == 0)
82
83 /*
84  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
85  * architecture.  It should be used with appropriate caution.
86  */
87 #define CACHE_LINE_SHIFT        7
88 #define CACHE_LINE_SIZE         (1 << CACHE_LINE_SHIFT)
89
90 #define PAGE_SHIFT_8K   13
91 #define PAGE_SIZE_8K    (1L<<PAGE_SHIFT_8K)
92 #define PAGE_MASK_8K    (PAGE_SIZE_8K-1)
93
94 #define PAGE_SHIFT_64K  16
95 #define PAGE_SIZE_64K   (1L<<PAGE_SHIFT_64K)
96 #define PAGE_MASK_64K   (PAGE_SIZE_64K-1)
97
98 #define PAGE_SHIFT_512K 19
99 #define PAGE_SIZE_512K  (1L<<PAGE_SHIFT_512K)
100 #define PAGE_MASK_512K  (PAGE_SIZE_512K-1)
101
102 #define PAGE_SHIFT_4M   22
103 #define PAGE_SIZE_4M    (1L<<PAGE_SHIFT_4M)
104 #define PAGE_MASK_4M    (PAGE_SIZE_4M-1)
105
106 #define PAGE_SHIFT_32M  25
107 #define PAGE_SIZE_32M   (1L<<PAGE_SHIFT_32M)
108 #define PAGE_MASK_32M   (PAGE_SIZE_32M-1)
109
110 #define PAGE_SHIFT_256M 28
111 #define PAGE_SIZE_256M  (1L<<PAGE_SHIFT_256M)
112 #define PAGE_MASK_256M  (PAGE_SIZE_256M-1)
113
114 #define PAGE_SHIFT_MIN  PAGE_SHIFT_8K
115 #define PAGE_SIZE_MIN   PAGE_SIZE_8K
116 #define PAGE_MASK_MIN   PAGE_MASK_8K
117 #define PAGE_SHIFT      PAGE_SHIFT_8K   /* LOG2(PAGE_SIZE) */
118 #define PAGE_SIZE       PAGE_SIZE_8K    /* bytes/page */
119 #define PAGE_MASK       PAGE_MASK_8K
120 #define PAGE_SHIFT_MAX  PAGE_SHIFT_4M
121 #define PAGE_SIZE_MAX   PAGE_SIZE_4M
122 #define PAGE_MASK_MAX   PAGE_MASK_4M
123
124 #define MAXPAGESIZES    1               /* maximum number of supported page sizes */
125
126 #ifndef KSTACK_PAGES
127 #define KSTACK_PAGES            4       /* pages of kernel stack (with pcb) */
128 #endif
129 #define KSTACK_GUARD_PAGES      1       /* pages of kstack guard; 0 disables */
130 #define PCPU_PAGES              1
131
132 /*
133  * Ceiling on size of buffer cache (really only effects write queueing,
134  * the VM page cache is not effected), can be changed via
135  * the kern.maxbcache /boot/loader.conf variable.
136  */
137 #ifndef VM_BCACHE_SIZE_MAX
138 #define VM_BCACHE_SIZE_MAX      (400 * 1024 * 1024)
139 #endif
140
141 /*
142  * Mach derived conversion macros
143  */
144 #define round_page(x)           (((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK)
145 #define trunc_page(x)           ((unsigned long)(x) & ~PAGE_MASK)
146
147 #define atop(x)                 ((unsigned long)(x) >> PAGE_SHIFT)
148 #define ptoa(x)                 ((unsigned long)(x) << PAGE_SHIFT)
149
150 #define sparc64_btop(x)         ((unsigned long)(x) >> PAGE_SHIFT)
151 #define sparc64_ptob(x)         ((unsigned long)(x) << PAGE_SHIFT)
152
153 #define pgtok(x)                ((unsigned long)(x) * (PAGE_SIZE / 1024))
154
155 #endif /* !_MACHINE_PARAM_H_ */
156 #endif /* !_NO_NAMESPACE_POLLUTION */