| 1 |
|
| 2 | |
| 3 | * Header that contains the code (mostly headers) for which Rust bindings
|
| 4 | * will be automatically generated by `bindgen`.
|
| 5 | *
|
| 6 | * Sorted alphabetically.
|
| 7 |
|
| 8 |
|
| 9 | |
| 10 | * First, avoid forward references to `enum` types.
|
| 11 | *
|
| 12 | * This workarounds a `bindgen` issue with them:
|
| 13 | * <https://github.com/rust-lang/rust-bindgen/issues/3179>.
|
| 14 | *
|
| 15 | * Without this, the generated Rust type may be the wrong one (`i32`) or
|
| 16 | * the proper one (typically `c_uint`) depending on how the headers are
|
| 17 | * included, which in turn may depend on the particular kernel configuration
|
| 18 | * or the architecture.
|
| 19 | *
|
| 20 | * The alternative would be to use casts and likely an
|
| 21 | * `#[allow(clippy::unnecessary_cast)]` in the Rust source files. Instead,
|
| 22 | * this approach allows us to keep the correct code in the source files and
|
| 23 | * simply remove this section when the issue is fixed upstream and we bump
|
| 24 | * the minimum `bindgen` version.
|
| 25 | *
|
| 26 | * This workaround may not be possible in some cases, depending on how the C
|
| 27 | * headers are set up.
|
| 28 |
|
| 29 | #include <linux/hrtimer_types.h>
|
| 30 |
|
| 31 | #include <linux/acpi.h>
|
| 32 | #include <linux/gpu_buddy.h>
|
| 33 | #include <drm/drm_device.h>
|
| 34 | #include <drm/drm_drv.h>
|
| 35 | #include <drm/drm_file.h>
|
| 36 | #include <drm/drm_gem.h>
|
| 37 | #include <drm/drm_gem_shmem_helper.h>
|
| 38 | #include <drm/drm_gpuvm.h>
|
| 39 | #include <drm/drm_ioctl.h>
|
| 40 | #include <kunit/test.h>
|
| 41 | #include <linux/auxiliary_bus.h>
|
| 42 | #include <linux/bitmap.h>
|
| 43 | #include <linux/blk-mq.h>
|
| 44 | #include <linux/blk_types.h>
|
| 45 | #include <linux/blkdev.h>
|
| 46 | #include <linux/clk.h>
|
| 47 | #include <linux/completion.h>
|
| 48 | #include <linux/configfs.h>
|
| 49 | #include <linux/cpu.h>
|
| 50 | #include <linux/cpufreq.h>
|
| 51 | #include <linux/cpumask.h>
|
| 52 | #include <linux/cred.h>
|
| 53 | #include <linux/debugfs.h>
|
| 54 | #include <linux/device/faux.h>
|
| 55 | #include <linux/dma-direction.h>
|
| 56 | #include <linux/dma-mapping.h>
|
| 57 | #include <linux/dma-resv.h>
|
| 58 | #include <linux/errname.h>
|
| 59 | #include <linux/ethtool.h>
|
| 60 | #include <linux/fdtable.h>
|
| 61 | #include <linux/file.h>
|
| 62 | #include <linux/firmware.h>
|
| 63 | #include <linux/fwctl.h>
|
| 64 | #include <linux/fs.h>
|
| 65 | #include <linux/i2c.h>
|
| 66 | #include <linux/interrupt.h>
|
| 67 | #include <linux/io-pgtable.h>
|
| 68 | #include <linux/ioport.h>
|
| 69 | #include <linux/iosys-map.h>
|
| 70 | #include <linux/jiffies.h>
|
| 71 | #include <linux/jump_label.h>
|
| 72 | #include <linux/mdio.h>
|
| 73 | #include <linux/mm.h>
|
| 74 | #include <linux/miscdevice.h>
|
| 75 | #include <linux/of_device.h>
|
| 76 | #include <linux/pci.h>
|
| 77 | #include <linux/phy.h>
|
| 78 | #include <linux/pid_namespace.h>
|
| 79 | #include <linux/platform_device.h>
|
| 80 | #include <linux/pm_opp.h>
|
| 81 | #include <linux/poll.h>
|
| 82 | #include <linux/property.h>
|
| 83 | #include <linux/pwm.h>
|
| 84 | #include <linux/random.h>
|
| 85 | #include <linux/refcount.h>
|
| 86 | #include <linux/regulator/consumer.h>
|
| 87 | #include <linux/sched.h>
|
| 88 | #include <linux/security.h>
|
| 89 | #include <linux/serdev.h>
|
| 90 | #include <linux/slab.h>
|
| 91 | #include <linux/sys_soc.h>
|
| 92 | #include <linux/task_work.h>
|
| 93 | #include <linux/tracepoint.h>
|
| 94 | #include <linux/usb.h>
|
| 95 | #include <linux/wait.h>
|
| 96 | #include <linux/workqueue.h>
|
| 97 | #include <linux/xarray.h>
|
| 98 | #include <net/genetlink.h>
|
| 99 | #include <net/netlink.h>
|
| 100 | #include <trace/events/rust_sample.h>
|
| 101 |
|
| 102 | |
| 103 | * The driver-core Rust code needs to know about some C driver-core private
|
| 104 | * structures.
|
| 105 |
|
| 106 | #include <../../drivers/base/base.h>
|
| 107 |
|
| 108 | #if defined(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
|
| 109 | |
| 110 | #include <drm/drm_panic.h>
|
| 111 | #endif
|
| 112 |
|
| 113 |
|
| 114 | const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN;
|
| 115 | const size_t RUST_CONST_HELPER_ARCH_KMALLOC_MINALIGN = ARCH_KMALLOC_MINALIGN;
|
| 116 | const size_t RUST_CONST_HELPER_PAGE_SIZE = PAGE_SIZE;
|
| 117 | const size_t RUST_CONST_HELPER_GENLMSG_DEFAULT_SIZE = GENLMSG_DEFAULT_SIZE;
|
| 118 | const gfp_t RUST_CONST_HELPER_GFP_ATOMIC = GFP_ATOMIC;
|
| 119 | const gfp_t RUST_CONST_HELPER_GFP_KERNEL = GFP_KERNEL;
|
| 120 | const gfp_t RUST_CONST_HELPER_GFP_KERNEL_ACCOUNT = GFP_KERNEL_ACCOUNT;
|
| 121 | const gfp_t RUST_CONST_HELPER_GFP_NOWAIT = GFP_NOWAIT;
|
| 122 | const gfp_t RUST_CONST_HELPER___GFP_ZERO = __GFP_ZERO;
|
| 123 | const gfp_t RUST_CONST_HELPER___GFP_HIGHMEM = ___GFP_HIGHMEM;
|
| 124 | const gfp_t RUST_CONST_HELPER___GFP_NOWARN = ___GFP_NOWARN;
|
| 125 | const blk_features_t RUST_CONST_HELPER_BLK_FEAT_ROTATIONAL = BLK_FEAT_ROTATIONAL;
|
| 126 | const fop_flags_t RUST_CONST_HELPER_FOP_UNSIGNED_OFFSET = FOP_UNSIGNED_OFFSET;
|
| 127 |
|
| 128 | const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
|
| 129 |
|
| 130 | const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
|
| 131 | const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
|
| 132 |
|
| 133 | const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
|
| 134 | const vm_flags_t RUST_CONST_HELPER_VM_READ = VM_READ;
|
| 135 | const vm_flags_t RUST_CONST_HELPER_VM_WRITE = VM_WRITE;
|
| 136 | const vm_flags_t RUST_CONST_HELPER_VM_EXEC = VM_EXEC;
|
| 137 | const vm_flags_t RUST_CONST_HELPER_VM_SHARED = VM_SHARED;
|
| 138 | const vm_flags_t RUST_CONST_HELPER_VM_MAYREAD = VM_MAYREAD;
|
| 139 | const vm_flags_t RUST_CONST_HELPER_VM_MAYWRITE = VM_MAYWRITE;
|
| 140 | const vm_flags_t RUST_CONST_HELPER_VM_MAYEXEC = VM_MAYEXEC;
|
| 141 | const vm_flags_t RUST_CONST_HELPER_VM_MAYSHARE = VM_MAYEXEC;
|
| 142 | const vm_flags_t RUST_CONST_HELPER_VM_PFNMAP = VM_PFNMAP;
|
| 143 | const vm_flags_t RUST_CONST_HELPER_VM_IO = VM_IO;
|
| 144 | const vm_flags_t RUST_CONST_HELPER_VM_DONTCOPY = VM_DONTCOPY;
|
| 145 | const vm_flags_t RUST_CONST_HELPER_VM_DONTEXPAND = VM_DONTEXPAND;
|
| 146 | const vm_flags_t RUST_CONST_HELPER_VM_LOCKONFAULT = VM_LOCKONFAULT;
|
| 147 | const vm_flags_t RUST_CONST_HELPER_VM_ACCOUNT = VM_ACCOUNT;
|
| 148 | const vm_flags_t RUST_CONST_HELPER_VM_NORESERVE = VM_NORESERVE;
|
| 149 | const vm_flags_t RUST_CONST_HELPER_VM_HUGETLB = VM_HUGETLB;
|
| 150 | const vm_flags_t RUST_CONST_HELPER_VM_SYNC = VM_SYNC;
|
| 151 | const vm_flags_t RUST_CONST_HELPER_VM_ARCH_1 = VM_ARCH_1;
|
| 152 | const vm_flags_t RUST_CONST_HELPER_VM_WIPEONFORK = VM_WIPEONFORK;
|
| 153 | const vm_flags_t RUST_CONST_HELPER_VM_DONTDUMP = VM_DONTDUMP;
|
| 154 | const vm_flags_t RUST_CONST_HELPER_VM_SOFTDIRTY = VM_SOFTDIRTY;
|
| 155 | const vm_flags_t RUST_CONST_HELPER_VM_MIXEDMAP = VM_MIXEDMAP;
|
| 156 | const vm_flags_t RUST_CONST_HELPER_VM_HUGEPAGE = VM_HUGEPAGE;
|
| 157 | const vm_flags_t RUST_CONST_HELPER_VM_NOHUGEPAGE = VM_NOHUGEPAGE;
|
| 158 |
|
| 159 | #if IS_ENABLED(CONFIG_GPU_BUDDY)
|
| 160 | const unsigned long RUST_CONST_HELPER_GPU_BUDDY_RANGE_ALLOCATION = GPU_BUDDY_RANGE_ALLOCATION;
|
| 161 | const unsigned long RUST_CONST_HELPER_GPU_BUDDY_TOPDOWN_ALLOCATION = GPU_BUDDY_TOPDOWN_ALLOCATION;
|
| 162 | const unsigned long RUST_CONST_HELPER_GPU_BUDDY_CONTIGUOUS_ALLOCATION =
|
| 163 | GPU_BUDDY_CONTIGUOUS_ALLOCATION;
|
| 164 | const unsigned long RUST_CONST_HELPER_GPU_BUDDY_CLEAR_ALLOCATION = GPU_BUDDY_CLEAR_ALLOCATION;
|
| 165 | const unsigned long RUST_CONST_HELPER_GPU_BUDDY_CLEARED = GPU_BUDDY_CLEARED;
|
| 166 | const unsigned long RUST_CONST_HELPER_GPU_BUDDY_TRIM_DISABLE = GPU_BUDDY_TRIM_DISABLE;
|
| 167 | #endif
|
| 168 |
|
| 169 | #if IS_ENABLED(CONFIG_ANDROID_BINDER_IPC_RUST)
|
| 170 | #include "../../drivers/android/binder/rust_binder.h"
|
| 171 | #include "../../drivers/android/binder/rust_binder_events.h"
|
| 172 | #endif
|