interplane.Get Omega
Read in your language

physics-mv

FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence.

Brought by drakestapleton

branch main Branches Tags History

physics-mv / third_party / nvidia-open-580.173.02 / src / common / sdk / nvidia / inc / cpuopsys.h

422 lines · 11619 bytes Raw Blame History
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2018-2018 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: MIT
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24/*! \brief
25 * Define compile time symbols for CPU type and operating system type.
26 * This file should only contain preprocessor commands so that
27 * there are no dependencies on other files.
28 *
29 * cpuopsys.h
30 *
31 * Copyright (c) 2001, Nvidia Corporation. All rights reserved.
32 */
33
34/*!
35 * Uniform names are defined for compile time options to distinguish
36 * CPU types and Operating systems.
37 * Distinctions between CPU and OpSys should be orthogonal.
38 *
39 * These uniform names have initially been defined by keying off the
40 * makefile/build names defined for builds in the OpenGL group.
41 * Getting the uniform names defined for other builds may require
42 * different qualifications.
43 *
44 * The file is placed here to allow for the possibility of all driver
45 * components using the same naming convention for conditional compilation.
46 */
47
48#ifndef CPUOPSYS_H
49#define CPUOPSYS_H
50
51/*****************************************************************************/
52/* Define all OS/CPU-Chip related symbols */
53
54/* ***** WINDOWS variations */
55#if defined(_WIN32) || defined(_WIN16)
56# define NV_WINDOWS
57
58# if defined(_WIN32_WINNT)
59# define NV_WINDOWS_NT
60# elif defined(_WIN32_WCE)
61# define NV_WINDOWS_CE
62# else
63# define NV_WINDOWS_9X
64# endif
65#endif /* _WIN32 || defined(_WIN16) */
66
67/* ***** Unix variations */
68#if defined(__linux__) && !defined(NV_LINUX) && !defined(NV_VMWARE)
69# define NV_LINUX
70#endif /* defined(__linux__) */
71
72#if defined(__VMWARE__) && !defined(NV_VMWARE)
73# define NV_VMWARE
74#endif /* defined(__VMWARE__) */
75
76/* SunOS + gcc */
77#if defined(__sun__) && defined(__svr4__) && !defined(NV_SUNOS)
78# define NV_SUNOS
79#endif /* defined(__sun__) && defined(__svr4__) */
80
81/* SunOS + Sun Compiler (named SunPro, Studio or Forte) */
82#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
83# define NV_SUNPRO_C
84# define NV_SUNOS
85#endif /* defined(_SUNPRO_C) || defined(__SUNPRO_CC) */
86
87#if defined(__FreeBSD__) && !defined(NV_BSD)
88# define NV_BSD
89#endif /* defined(__FreeBSD__) */
90
91/* XXXar don't define NV_UNIX on MacOSX or vxworks or QNX */
92#if (defined(__unix__) || defined(__unix) || defined(__INTEGRITY) ) && !defined(nvmacosx) && !defined(vxworks) && !defined(NV_UNIX) && !defined(__QNX__) && !defined(__QNXNTO__)/* XXX until removed from Makefiles */
93# define NV_UNIX
94#endif /* defined(__unix__) */
95
96#if (defined(__QNX__) || defined(__QNXNTO__)) && !defined(NV_QNX)
97# define NV_QNX
98#endif
99
100#if (defined(__ANDROID__) || defined(ANDROID)) && !defined(NV_ANDROID)
101# define NV_ANDROID
102#endif
103
104#if defined(DceCore) && !defined(NV_DCECORE)
105# define NV_DCECORE
106#endif
107
108/* ***** Apple variations */
109#if defined(macintosh) || defined(__APPLE__)
110# define NV_MACINTOSH
111# if defined(__MACH__)
112# define NV_MACINTOSH_OSX
113# else
114# define NV_MACINTOSH_OS9
115# endif
116# if defined(__LP64__)
117# define NV_MACINTOSH_64
118# endif
119#endif /* defined(macintosh) */
120
121/* ***** VxWorks */
122/* Tornado 2.21 is gcc 2.96 and #defines __vxworks. */
123/* Tornado 2.02 is gcc 2.7.2 and doesn't define any OS symbol, so we rely on */
124/* the build system #defining vxworks. */
125#if defined(__vxworks) || defined(vxworks)
126# define NV_VXWORKS
127#endif
128
129/* ***** Integrity OS */
130#if defined(__INTEGRITY)
131# if !defined(NV_INTEGRITY)
132# define NV_INTEGRITY
133# endif
134#endif
135
136/* ***** Processor type variations */
137/* Note: The prefix NV_CPU_* is taken by Nvcm.h */
138
139#if ((defined(_M_IX86) || defined(__i386__) || defined(__i386)) && !defined(NVCPU_X86)) /* XXX until removed from Makefiles */
140/* _M_IX86 for windows, __i386__ for Linux (or any x86 using gcc) */
141/* __i386 for Studio compiler on Solaris x86 */
142# define NVCPU_X86 /* any IA32 machine (not x86-64) */
143# define NVCPU_MIN_PAGE_SHIFT 12
144#endif
145
146#if defined(NV_LINUX) && defined(__ia64__)
147# define NVCPU_IA64_LINUX /* any IA64 for Linux opsys */
148#endif
149#if defined(NVCPU_IA64_WINDOWS) || defined(NVCPU_IA64_LINUX) || defined(IA64)
150# define NVCPU_IA64 /* any IA64 for any opsys */
151#endif
152
153#if (defined(NV_MACINTOSH) && !(defined(__i386__) || defined(__x86_64__))) || defined(__PPC__) || defined(__ppc)
154# if defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
155# ifndef NVCPU_PPC64LE
156# define NVCPU_PPC64LE /* PPC 64-bit little endian */
157# endif
158# else
159# ifndef NVCPU_PPC
160# define NVCPU_PPC /* any non-PPC64LE PowerPC architecture */
161# endif
162# ifndef NV_BIG_ENDIAN
163# define NV_BIG_ENDIAN
164# endif
165# endif
166# define NVCPU_FAMILY_PPC
167#endif
168
169#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
170# define NVCPU_X86_64 /* any x86-64 for any opsys */
171#endif
172
173#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
174# define NVCPU_FAMILY_X86
175#endif
176
177#if defined(__riscv) && (__riscv_xlen==64)
178# define NVCPU_RISCV64
179# if defined(__nvriscv)
180# define NVCPU_NVRISCV64
181# endif
182#endif
183
184#if defined(__arm__) || defined(_M_ARM)
185/*
186 * 32-bit instruction set on, e.g., ARMv7 or AArch32 execution state
187 * on ARMv8
188 */
189# define NVCPU_ARM
190# define NVCPU_MIN_PAGE_SHIFT 12
191#endif
192
193#if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
194# define NVCPU_AARCH64 /* 64-bit A64 instruction set on ARMv8 */
195# define NVCPU_MIN_PAGE_SHIFT 12
196#endif
197
198#if defined(NVCPU_ARM) || defined(NVCPU_AARCH64)
199# define NVCPU_FAMILY_ARM
200#endif
201
202#if defined(__SH4__)
203# ifndef NVCPU_SH4
204# define NVCPU_SH4 /* Renesas (formerly Hitachi) SH4 */
205# endif
206# if defined NV_WINDOWS_CE
207# define NVCPU_MIN_PAGE_SHIFT 12
208# endif
209#endif
210
211/* For Xtensa processors */
212#if defined(__XTENSA__)
213# define NVCPU_XTENSA
214# if defined(__XTENSA_EB__)
215# define NV_BIG_ENDIAN
216# endif
217#endif
218
219
220/*
221 * Other flavors of CPU type should be determined at run-time.
222 * For example, an x86 architecture with/without SSE.
223 * If it can compile, then there's no need for a compile time option.
224 * For some current GCC limitations, these may be fixed by using the Intel
225 * compiler for certain files in a Linux build.
226 */
227
228/* The minimum page size can be determined from the minimum page shift */
229#if defined(NVCPU_MIN_PAGE_SHIFT)
230#define NVCPU_MIN_PAGE_SIZE (1 << NVCPU_MIN_PAGE_SHIFT)
231#endif
232
233#if defined(NVCPU_IA64) || defined(NVCPU_X86_64) || \
234 defined(NV_MACINTOSH_64) || defined(NVCPU_AARCH64) || \
235 defined(NVCPU_PPC64LE) || defined(NVCPU_RISCV64)
236# define NV_64_BITS /* all architectures where pointers are 64 bits */
237#else
238/* we assume 32 bits. I don't see a need for NV_16_BITS. */
239#endif
240
241/* For verification-only features not intended to be included in normal drivers */
242#if defined(ENABLE_VERIF_FEATURES)
243#define NV_VERIF_FEATURES
244#endif
245
246/*
247 * New, safer family of #define's -- these ones use 0 vs. 1 rather than
248 * defined/!defined. This is advantageous because if you make a typo,
249 * say misspelled ENDIAN:
250 *
251 * #if NVCPU_IS_BIG_ENDAIN
252 *
253 * ...some compilers can give you a warning telling you that you screwed up.
254 * The compiler can also give you a warning if you forget to #include
255 * "cpuopsys.h" in your code before the point where you try to use these
256 * conditionals.
257 *
258 * Also, the names have been prefixed in more cases with "CPU" or "OS" for
259 * increased clarity. You can tell the names apart from the old ones because
260 * they all use "_IS_" in the name.
261 *
262 * Finally, these can be used in "if" statements and not just in #if's. For
263 * example:
264 *
265 * if (NVCPU_IS_BIG_ENDIAN) x = Swap32(x);
266 *
267 * Maybe some day in the far-off future these can replace the old #define's.
268 */
269
270#define NV_IS_MODS 0
271
272#define NVOS_IS_WINDOWS 0
273#if defined(NV_WINDOWS_CE)
274#define NVOS_IS_WINDOWS_CE 1
275#else
276#define NVOS_IS_WINDOWS_CE 0
277#endif
278#if defined(NV_LINUX)
279#define NVOS_IS_LINUX 1
280#else
281#define NVOS_IS_LINUX 0
282#endif
283#if defined(NV_UNIX)
284#define NVOS_IS_UNIX 1
285#else
286#define NVOS_IS_UNIX 0
287#endif
288#if defined(NV_BSD)
289#define NVOS_IS_FREEBSD 1
290#else
291#define NVOS_IS_FREEBSD 0
292#endif
293#if defined(NV_SUNOS)
294#define NVOS_IS_SOLARIS 1
295#else
296#define NVOS_IS_SOLARIS 0
297#endif
298#define NVOS_IS_VMWARE 0
299#if defined(NV_QNX)
300#define NVOS_IS_QNX 1
301#else
302#define NVOS_IS_QNX 0
303#endif
304#if defined(NV_ANDROID)
305#define NVOS_IS_ANDROID 1
306#else
307#define NVOS_IS_ANDROID 0
308#endif
309#if defined(NV_MACINTOSH)
310#define NVOS_IS_MACINTOSH 1
311#else
312#define NVOS_IS_MACINTOSH 0
313#endif
314#if defined(NV_VXWORKS)
315#define NVOS_IS_VXWORKS 1
316#else
317#define NVOS_IS_VXWORKS 0
318#endif
319#if defined(NV_LIBOS)
320#define NVOS_IS_LIBOS 1
321#else
322#define NVOS_IS_LIBOS 0
323#endif
324#if defined(NV_INTEGRITY)
325#define NVOS_IS_INTEGRITY 1
326#else
327#define NVOS_IS_INTEGRITY 0
328#endif
329
330#if defined(NVCPU_X86)
331#define NVCPU_IS_X86 1
332#else
333#define NVCPU_IS_X86 0
334#endif
335#if defined(NVCPU_RISCV64)
336#define NVCPU_IS_RISCV64 1
337#else
338#define NVCPU_IS_RISCV64 0
339#endif
340#if defined(NVCPU_NVRISCV64)
341#define NVCPU_IS_NVRISCV64 1
342#else
343#define NVCPU_IS_NVRISCV64 0
344#endif
345#if defined(NVCPU_IA64)
346#define NVCPU_IS_IA64 1
347#else
348#define NVCPU_IS_IA64 0
349#endif
350#if defined(NVCPU_X86_64)
351#define NVCPU_IS_X86_64 1
352#else
353#define NVCPU_IS_X86_64 0
354#endif
355#if defined(NVCPU_FAMILY_X86)
356#define NVCPU_IS_FAMILY_X86 1
357#else
358#define NVCPU_IS_FAMILY_X86 0
359#endif
360#if defined(NVCPU_PPC)
361#define NVCPU_IS_PPC 1
362#else
363#define NVCPU_IS_PPC 0
364#endif
365#if defined(NVCPU_PPC64LE)
366#define NVCPU_IS_PPC64LE 1
367#else
368#define NVCPU_IS_PPC64LE 0
369#endif
370#if defined(NVCPU_FAMILY_PPC)
371#define NVCPU_IS_FAMILY_PPC 1
372#else
373#define NVCPU_IS_FAMILY_PPC 0
374#endif
375#if defined(NVCPU_ARM)
376#define NVCPU_IS_ARM 1
377#else
378#define NVCPU_IS_ARM 0
379#endif
380#if defined(NVCPU_AARCH64)
381#define NVCPU_IS_AARCH64 1
382#else
383#define NVCPU_IS_AARCH64 0
384#endif
385#if defined(NVCPU_FAMILY_ARM)
386#define NVCPU_IS_FAMILY_ARM 1
387#else
388#define NVCPU_IS_FAMILY_ARM 0
389#endif
390#if defined(NVCPU_SH4)
391#define NVCPU_IS_SH4 1
392#else
393#define NVCPU_IS_SH4 0
394#endif
395#if defined(NVCPU_XTENSA)
396#define NVCPU_IS_XTENSA 1
397#else
398#define NVCPU_IS_XTENSA 0
399#endif
400#if defined(NV_BIG_ENDIAN)
401#define NVCPU_IS_BIG_ENDIAN 1
402#else
403#define NVCPU_IS_BIG_ENDIAN 0
404#endif
405#if defined(NV_64_BITS)
406#define NVCPU_IS_64_BITS 1
407#else
408#define NVCPU_IS_64_BITS 0
409#endif
410#if defined(NVCPU_FAMILY_ARM)
411#define NVCPU_IS_PCIE_CACHE_COHERENT 0
412#else
413#define NVCPU_IS_PCIE_CACHE_COHERENT 1
414#endif
415#if defined(NV_DCECORE)
416#define NVOS_IS_DCECORE 1
417#else
418#define NVOS_IS_DCECORE 0
419#endif
420/*****************************************************************************/
421
422#endif /* CPUOPSYS_H */