Add ability to scrub from last scrubbed txg
[zfs.git] / include / os / linux / spl / sys / isa_defs.h
blob7c95c94c1cf1d3b9fb51d79ba0abc4aaaf7509d3
1 /*
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
6 * UCRL-CODE-235197
8 * This file is part of the SPL, Solaris Porting Layer.
10 * The SPL is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
15 * The SPL is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef _SPL_ISA_DEFS_H
25 #define _SPL_ISA_DEFS_H
27 /* x86_64 arch specific defines */
28 #if defined(__x86_64) || defined(__x86_64__)
30 #if !defined(__x86_64)
31 #define __x86_64
32 #endif
34 #if !defined(__amd64)
35 #define __amd64
36 #endif
38 #if !defined(__x86)
39 #define __x86
40 #endif
42 #if defined(_ILP32)
43 /* x32-specific defines; careful to *not* define _LP64 here */
44 #else
45 #if !defined(_LP64)
46 #define _LP64
47 #endif
48 #endif
50 /* i386 arch specific defines */
51 #elif defined(__i386) || defined(__i386__)
53 #if !defined(__i386)
54 #define __i386
55 #endif
57 #if !defined(__x86)
58 #define __x86
59 #endif
61 #if !defined(_ILP32)
62 #define _ILP32
63 #endif
65 /* powerpc (ppc64) arch specific defines */
66 #elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
68 #if !defined(__powerpc)
69 #define __powerpc
70 #endif
72 #if !defined(__powerpc__)
73 #define __powerpc__
74 #endif
76 #if defined(__powerpc64__)
77 #if !defined(_LP64)
78 #define _LP64
79 #endif
80 #else
81 #if !defined(_ILP32)
82 #define _ILP32
83 #endif
84 #endif
86 /* arm arch specific defines */
87 #elif defined(__arm) || defined(__arm__)
89 #if !defined(__arm)
90 #define __arm
91 #endif
93 #if !defined(__arm__)
94 #define __arm__
95 #endif
97 #if !defined(_ILP32)
98 #define _ILP32
99 #endif
101 #if defined(__ARMEL__)
102 #define _ZFS_LITTLE_ENDIAN
103 #else
104 #define _ZFS_BIG_ENDIAN
105 #endif
107 /* aarch64 arch specific defines */
108 #elif defined(__aarch64__)
110 #if !defined(_LP64)
111 #define _LP64
112 #endif
114 #if defined(__AARCH64EL__)
115 #define _ZFS_LITTLE_ENDIAN
116 #else
117 #define _ZFS_BIG_ENDIAN
118 #endif
120 /* sparc arch specific defines */
121 #elif defined(__sparc) || defined(__sparc__)
123 #if !defined(__sparc)
124 #define __sparc
125 #endif
127 #if !defined(__sparc__)
128 #define __sparc__
129 #endif
131 #if defined(__arch64__)
132 #if !defined(_LP64)
133 #define _LP64
134 #endif
135 #else
136 #if !defined(_ILP32)
137 #define _ILP32
138 #endif
139 #endif
141 #define _ZFS_BIG_ENDIAN
142 #define _SUNOS_VTOC_16
144 /* s390 arch specific defines */
145 #elif defined(__s390__)
146 #if defined(__s390x__)
147 #if !defined(_LP64)
148 #define _LP64
149 #endif
150 #else
151 #if !defined(_ILP32)
152 #define _ILP32
153 #endif
154 #endif
156 #define _ZFS_BIG_ENDIAN
158 /* MIPS arch specific defines */
159 #elif defined(__mips__)
161 #if defined(__MIPSEB__)
162 #define _ZFS_BIG_ENDIAN
163 #elif defined(__MIPSEL__)
164 #define _ZFS_LITTLE_ENDIAN
165 #else
166 #error MIPS no endian specified
167 #endif
169 #ifndef _LP64
170 #define _ILP32
171 #endif
173 #define _SUNOS_VTOC_16
176 * RISC-V arch specific defines
177 * only RV64G (including atomic) LP64 is supported yet
179 #elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 && \
180 defined(__riscv_atomic) && __riscv_atomic
182 #if !defined(_LP64)
183 #define _LP64 1
184 #endif
186 #ifndef __riscv__
187 #define __riscv__
188 #endif
190 #ifndef __rv64g__
191 #define __rv64g__
192 #endif
194 #define _ZFS_LITTLE_ENDIAN
196 #define _SUNOS_VTOC_16
199 * LoongArch arch specific defines
200 * only LoongArch64 is supported yet
202 #elif defined(__loongarch__) && defined(__loongarch_lp64)
204 #if !defined(_LP64)
205 #define _LP64
206 #endif
208 #define _ZFS_LITTLE_ENDIAN
209 #define _SUNOS_VTOC_16
211 /* not all LoongArch cores support unaligned accesses in hardware */
212 #define _ALIGNMENT_REQUIRED 1
214 #else
216 * Currently supported:
217 * x86_64, x32, i386, arm, powerpc, s390, sparc, mips, RV64G, and LoongArch64
219 #error "Unsupported ISA type"
220 #endif
222 #if defined(_ILP32) && defined(_LP64)
223 #error "Both _ILP32 and _LP64 are defined"
224 #endif
226 #if !defined(_ILP32) && !defined(_LP64)
227 #error "Neither _ILP32 or _LP64 are defined"
228 #endif
230 #include <sys/byteorder.h>
233 * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS will be defined by the Linux
234 * kernel for architectures which support efficient unaligned access.
236 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
237 #define HAVE_EFFICIENT_UNALIGNED_ACCESS
238 #endif
240 #if defined(_ZFS_LITTLE_ENDIAN) && defined(_ZFS_BIG_ENDIAN)
241 #error "Both _ZFS_LITTLE_ENDIAN and _ZFS_BIG_ENDIAN are defined"
242 #endif
244 #if !defined(_ZFS_LITTLE_ENDIAN) && !defined(_ZFS_BIG_ENDIAN)
245 #error "Neither _ZFS_LITTLE_ENDIAN or _ZFS_BIG_ENDIAN are defined"
246 #endif
248 #endif /* _SPL_ISA_DEFS_H */