1 /* synchronized with conftest.sh from 325.15, 319.32, 313.30, 310.51, 304.108, 295.75, 173.14.37, 96.43.23, 71.86.15 */
3 #ifndef LINUX_VERSION_CODE
4 #include <linux/version.h>
7 #if !defined(IS_ENABLED) && LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
8 #define __ARG_PLACEHOLDER_1 0,
9 #define config_enabled(cfg) _config_enabled(cfg)
10 #define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
11 #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
12 #define ___config_enabled(__ignored, val, ...) val
13 #define IS_ENABLED(option) (config_enabled(option) || config_enabled(option##_MODULE))
16 /* Implement conftest.sh function nvidiafb_sanity_check */
17 #if IS_ENABLED(CONFIG_FB_NVIDIA)
18 #warning "The nvidia module is incompatible with nvidiafb!"
21 /* Implement conftest.sh function xen_sanity_check */
22 #if IS_ENABLED(CONFIG_XEN) && ! IS_ENABLED(CONFIG_PARAVIRT)
23 #warning "Xen kernels are not supported!"
26 /* Implement conftest.sh function preempt_rt_sanity_check */
27 #if IS_ENABLED(CONFIG_PREEMPT_RT) || IS_ENABLED(CONFIG_PREEMPT_RT_FULL)
28 #warning "PREEMPT_RT kernels are not supported!"
31 /* Implement conftest.sh function remap_page_range */
32 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
33 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
34 #define NV_REMAP_PAGE_RANGE_PRESENT
35 #define NV_REMAP_PAGE_RANGE_ARGUMENT_COUNT 4
37 #define NV_REMAP_PAGE_RANGE_PRESENT
38 #define NV_REMAP_PAGE_RANGE_ARGUMENT_COUNT 5
41 #undef NV_REMAP_PAGE_RANGE_PRESENT
44 /* Implement conftest.sh function set_memory_uc */
45 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) && IS_ENABLED(CONFIG_X86)
46 #define NV_SET_MEMORY_UC_PRESENT
48 #undef NV_SET_MEMORY_UC_PRESENT
51 /* Implement conftest.sh function set_memory_array_uc */
52 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) && IS_ENABLED(CONFIG_X86)
53 #define NV_SET_MEMORY_ARRAY_UC_PRESENT
55 #undef NV_SET_MEMORY_ARRAY_UC_PRESENT
58 /* Implement conftest.sh function set_pages_uc */
59 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) && IS_ENABLED(CONFIG_X86)
60 #define NV_SET_PAGES_UC_PRESENT
62 #undef NV_SET_PAGES_UC_PRESENT
65 /* Implement conftest.sh function outer_flush_all */
66 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34) && IS_ENABLED(CONFIG_ARM)
67 #define NV_OUTER_FLUSH_ALL_PRESENT
69 #undef NV_OUTER_FLUSH_ALL_PRESENT
72 /* Implement conftest.sh function change_page_attr */
73 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && \
74 LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
75 #define NV_CHANGE_PAGE_ATTR_PRESENT
77 #undef NV_CHANGE_PAGE_ATTR_PRESENT
80 /* Implement conftest.sh function pci_get_class */
81 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
82 #define NV_PCI_GET_CLASS_PRESENT
84 #undef NV_PCI_GET_CLASS_PRESENT
87 /* Implement conftest.sh function pci_get_domain_bus_and_slot */
88 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
89 #define NV_PCI_GET_DOMAIN_BUS_AND_SLOT_PRESENT
91 #undef NV_PCI_GET_DOMAIN_BUS_AND_SLOT_PRESENT
94 /* Implement conftest.sh function remap_pfn_range */
95 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
96 #define NV_REMAP_PFN_RANGE_PRESENT
98 #undef NV_REMAP_PFN_RANGE_PRESENT
101 /* Implement conftest.sh function agp_backend_acquire */
102 /* Only kernels sometime before 2.4.0 don't have this function, and who */
104 #define NV_AGP_BACKEND_ACQUIRE_PRESENT
105 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
106 #define NV_AGP_BACKEND_ACQUIRE_ARGUMENT_COUNT 1
108 #define NV_AGP_BACKEND_ACQUIRE_ARGUMENT_COUNT 0
111 /* Implement conftest.sh function vmap */
112 /* I can not find any released kernel that uses the 2 argument variant */
114 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)
115 #define NV_VMAP_PRESENT
116 #define NV_VMAP_ARGUMENT_COUNT 4
118 #undef NV_VMAP_PRESENT
121 /* Implement conftest.sh function i2c_adapter */
122 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
123 #define NV_I2C_ADAPTER_HAS_INC_USE
124 #define NV_I2C_ADAPTER_HAS_DEC_USE
125 #define NV_I2C_ADAPTER_HAS_CLIENT_REGISTER
127 #undef NV_I2C_ADAPTER_HAS_INC_USE
128 #undef NV_I2C_ADAPTER_HAS_DEC_USE
129 #undef NV_I2C_ADAPTER_HAS_CLIENT_REGISTER
132 /* Implement conftest.sh function pm_message_t */
133 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
134 #define NV_PM_MESSAGE_T_PRESENT
135 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
136 #define NV_PM_MESSAGE_T_HAS_EVENT
138 #undef NV_PM_MESSAGE_T_HAS_EVENT
141 #undef NV_PM_MESSAGE_T_PRESENT
142 #undef NV_PM_MESSAGE_T_HAS_EVENT
145 /* Implement conftest.sh function pci_choose_state */
146 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
147 #define NV_PCI_CHOOSE_STATE_PRESENT
149 #undef NV_PCI_CHOOSE_STATE_PRESENT
152 /* Implement conftest.sh function vm_insert_page */
153 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
154 #define NV_VM_INSERT_PAGE_PRESENT
156 #undef NV_VM_INSERT_PAGE_PRESENT
159 /* Implement conftest.sh function irq_handler_t */
160 /* I can not find any released kernel that uses the 3 argument variant */
161 /* of irq_handler_t */
162 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
163 #define NV_IRQ_HANDLER_T_PRESENT
164 #define NV_IRQ_HANDLER_T_ARGUMENT_COUNT 2
166 #undef NV_IRQ_HANDLER_T_PRESENT
169 /* Implement conftest.sh function acpi_device_ops */
170 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) && \
171 LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
172 #define NV_ACPI_DEVICE_OPS_HAS_MATCH
174 #undef NV_ACPI_DEVICE_OPS_HAS_MATCH
177 /* Implement conftest.sh function acpi_device_id */
178 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
179 #define NV_ACPI_DEVICE_ID_HAS_DRIVER_DATA
181 #undef NV_ACPI_DEVICE_ID_HAS_DRIVER_DATA
184 /* Implement conftest.sh function acquire_console_sem */
185 // 2.6.38 renamed {acquire,release}_console_sem() to console_{,un}lock()
186 // but NVIDIA neither checks for these new names nor uses them
187 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10) && \
188 LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
189 #define NV_ACQUIRE_CONSOLE_SEM_PRESENT
191 #undef NV_ACQUIRE_CONSOLE_SEM_PRESENT
194 /* Implement conftest.sh function kmem_cache_create */
195 /* Only kernels sometime before 2.4.0 don't have this function, and who */
197 #define NV_KMEM_CACHE_CREATE_PRESENT
198 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
199 #define NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT 5
201 #define NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT 6
204 /* Implement conftest.sh function smp_call_function */
205 /* Only kernels sometime before 2.4.0 don't have this function, and who */
207 #define NV_SMP_CALL_FUNCTION_PRESENT
208 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
209 #define NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT 3
211 #define NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT 4
214 /* Implement conftest.sh function on_each_cpu */
215 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
216 #define NV_ON_EACH_CPU_PRESENT
217 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
218 #define NV_ON_EACH_CPU_ARGUMENT_COUNT 3
220 #define NV_ON_EACH_CPU_ARGUMENT_COUNT 4
223 #undef NV_ON_EACH_CPU_PRESENT
226 /* Implement conftest.sh function vmm_support */
227 /* nv-xen.h does not exist */
230 /* Implement conftest.sh function nvmap_support */
231 /* nv-android.h does not exist */
232 #undef HAVE_NV_ANDROID
234 /* Implement conftest.sh function acpi_evaluate_integer */
235 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
236 #define NV_ACPI_EVALUATE_INTEGER_PRESENT
237 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
238 typedef unsigned long long nv_acpi_integer_t;
240 typedef unsigned long nv_acpi_integer_t;
243 #undef NV_ACPI_EVALUATE_INTEGER_PRESENT
244 typedef unsigned long nv_acpi_integer_t;
247 /* Implement conftest.sh function acpi_walk_namespace */
248 /* Only kernels sometime before 2.4.0 don't have this function, and who */
250 #define NV_ACPI_WALK_NAMESPACE_PRESENT
251 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
252 #define NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT 7
254 #define NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT 6
257 /* Implement conftest.sh function acpi_os_wait_events_complete */
258 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
259 #define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_PRESENT
260 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
261 #define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT 0
263 #define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT 1
266 #undef NV_ACPI_OS_WAIT_EVENTS_COMPLETE_PRESENT
269 /* Implement conftest.sh function ioremap_cache */
270 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) && IS_ENABLED(CONFIG_X86)
271 #define NV_IOREMAP_CACHE_PRESENT
273 #undef NV_IOREMAP_CACHE_PRESENT
276 /* Implement conftest.sh function ioremap_wc */
277 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
278 #define NV_IOREMAP_WC_PRESENT
280 #undef NV_IOREMAP_WC_PRESENT
283 /* Implement conftest.sh function proc_dir_entry */
284 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
285 #define NV_PROC_DIR_ENTRY_HAS_OWNER
287 #undef NV_PROC_DIR_ENTRY_HAS_OWNER
290 /* Implement conftest.sh function INIT_WORK */
291 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
292 #define NV_INIT_WORK_PRESENT
293 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
294 #define NV_INIT_WORK_ARGUMENT_COUNT 2
296 #define NV_INIT_WORK_ARGUMENT_COUNT 3
299 #undef NV_INIT_WORK_PRESENT
302 /* Implement conftest.sh function pci_dma_mapping_error */
303 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5)
304 #define NV_PCI_DMA_MAPPING_ERROR_PRESENT
305 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
306 #define NV_PCI_DMA_MAPPING_ERROR_ARGUMENT_COUNT 2
308 #define NV_PCI_DMA_MAPPING_ERROR_ARGUMENT_COUNT 1
311 #undef NV_PCI_DMA_MAPPING_ERROR_PRESENT
314 /* Implement conftest.sh function agp_memory */
315 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
316 #define NV_AGP_MEMORY_HAS_PAGES
318 #undef NV_AGP_MEMORY_HAS_PAGES
321 /* Implement conftest.sh function scatterlist */
322 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
323 #define NV_SCATTERLIST_HAS_PAGE
325 #undef NV_SCATTERLIST_HAS_PAGE
328 /* Implement conftest.sh function pci_domain_nr */
329 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,71)
330 #define NV_PCI_DOMAIN_NR_PRESENT
332 #undef NV_PCI_DOMAIN_NR_PRESENT
335 /* Implement conftest.sh function file_operations */
336 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
337 #define NV_FILE_OPERATIONS_HAS_IOCTL
339 #undef NV_FILE_OPERATIONS_HAS_IOCTL
341 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
342 #define NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL
343 #define NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL
345 #undef NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL
346 #undef NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL
349 /* Implement conftest.sh function efi_enabled */
350 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,1)
351 #define NV_EFI_ENABLED_PRESENT
353 #undef NV_EFI_ENABLED_PRESENT
356 /* Implement conftest.sh function dom0_kernel_present */
358 #define NV_DOM0_KERNEL_PRESENT
360 #undef NV_DOM0_KERNEL_PRESENT
363 /* Implement conftest.sh function drm_available */
365 #define NV_DRM_AVAILABLE
367 #undef NV_DRM_AVAILABLE
370 /* Implement conftest.sh function proc_create_data */
371 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
372 #define NV_PROC_CREATE_DATA_PRESENT
374 #undef NV_PROC_CREATE_DATA_PRESENT
377 /* Implement conftest.sh function pde_data */
378 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
379 #define NV_PDE_DATA_PRESENT
381 #undef NV_PDE_DATA_PRESENT
384 /* Implement conftest.sh function proc_remove */
385 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
386 #define NV_PROC_REMOVE_PRESENT
388 #undef NV_PROC_REMOVE_PRESENT
391 /* Implement conftest.sh function sg_init_table */
392 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
393 #define NV_SG_INIT_TABLE_PRESENT
395 #undef NV_SG_INIT_TABLE_PRESENT
398 /* Check for linux/semaphore.h */
399 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
400 #define NV_LINUX_SEMAPHORE_H_PRESENT
402 #undef NV_LINUX_SEMAPHORE_H_PRESENT
405 /* Check for linux/cred.h */
406 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
407 #define NV_LINUX_CRED_H_PRESENT
409 #undef NV_LINUX_CRED_H_PRESENT
412 /* Check for drm/drmP.h */
414 #define NV_DRM_DRMP_H_PRESENT
416 #undef NV_DRM_DRMP_H_PRESENT
419 /* Check for generated/autoconf.h */
420 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
421 #define NV_GENERATED_AUTOCONF_H_PRESENT
423 #undef NV_GENERATED_AUTOCONF_H_PRESENT
426 /* Check for generated/compile.h */
427 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
428 #define NV_GENERATED_COMPILE_H_PRESENT
430 #undef NV_GENERATED_COMPILE_H_PRESENT
433 /* Check for generated/utsrelease.h */
434 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
435 #define NV_GENERATED_UTSRELEASE_H_PRESENT
437 #undef NV_GENERATED_UTSRELEASE_H_PRESENT
440 /* Check for asm/system.h */
441 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
442 #define NV_ASM_SYSTEM_H_PRESENT
444 #undef NV_ASM_SYSTEM_H_PRESENT
447 /* Check for linux/efi.h */
448 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,33)
449 #define NV_LINUX_EFI_H_PRESENT
451 #undef NV_LINUX_EFI_H_PRESENT
454 /* Check for linux/kconfig.h */
455 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
456 #define NV_LINUX_KCONFIG_H_PRESENT
458 #undef NV_LINUX_KCONFIG_H_PRESENT
461 /* Check for linux/screen_info.h */
462 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
463 #define NV_LINUX_SCREEN_INFO_H_PRESENT
465 #undef NV_LINUX_SCREEN_INFO_H_PRESENT
468 /* Check for linux/nvmap.h */
469 // does not (yet) exist in kernel source
470 #undef NV_LINUX_NVMAP_H_PRESENT