├── README.md ├── allwinner ├── aw_de2.c ├── aw_de2_drm.c ├── aw_de2_hdmi_phy.c ├── aw_de2_mixer.c ├── aw_de2_mixer.h ├── aw_de2_mixer_if.m ├── aw_de2_tcon.c ├── aw_de2_tcon.h ├── aw_de2_tcon_if.m ├── aw_de2_ui_plane.c ├── aw_de2_ui_plane.h ├── aw_de2_vi_plane.c └── aw_de2_vi_plane.h ├── bridges ├── anx6345 │ ├── anx6345.c │ └── anx6345reg.h ├── drm_bridge_if.m ├── drm_encoder_if.m ├── dw_hdmi │ ├── aw_de2_dw_hdmi.c │ ├── dw_hdmi.c │ ├── dw_hdmi.h │ ├── dw_hdmi_if.m │ ├── dw_hdmi_phy_if.m │ ├── dw_hdmireg.h │ └── rk_dw_hdmi.c └── tda19988 │ └── tda19988.c ├── core ├── drm_atomic.c ├── drm_atomic_helper.c ├── drm_atomic_state_helper.c ├── drm_atomic_uapi.c ├── drm_auth.c ├── drm_blend.c ├── drm_bridge.c ├── drm_bridge_connector.c ├── drm_cache.c ├── drm_client.c ├── drm_client_modeset.c ├── drm_color_mgmt.c ├── drm_connector.c ├── drm_crtc.c ├── drm_crtc_helper.c ├── drm_crtc_helper_internal.h ├── drm_crtc_internal.h ├── drm_damage_helper.c ├── drm_dp_aux_dev.c ├── drm_dp_dual_mode_helper.c ├── drm_dp_helper.c ├── drm_dp_mst_topology.c ├── drm_dp_mst_topology_internal.h ├── drm_drv.c ├── drm_dumb_buffers.c ├── drm_edid.c ├── drm_encoder.c ├── drm_encoder_slave.c ├── drm_fb_helper.c ├── drm_file.c ├── drm_flip_work.c ├── drm_fourcc.c ├── drm_framebuffer.c ├── drm_gem.c ├── drm_gem_ttm_helper.c ├── drm_hashtab.c ├── drm_internal.h ├── drm_ioc32.c ├── drm_ioctl.c ├── drm_irq.c ├── drm_kms_helper_common.c ├── drm_legacy.h ├── drm_memory.c ├── drm_mm.c ├── drm_mode_config.c ├── drm_mode_object.c ├── drm_modes.c ├── drm_modeset_helper.c ├── drm_modeset_lock.c ├── drm_panel.c ├── drm_panel_orientation_quirks.c ├── drm_pci.c ├── drm_plane.c ├── drm_plane_helper.c ├── drm_prime.c ├── drm_print.c ├── drm_probe_helper.c ├── drm_property.c ├── drm_rect.c ├── drm_scdc_helper.c ├── drm_self_refresh_helper.c ├── drm_syncobj.c ├── drm_trace.h ├── drm_trace_points.c ├── drm_vblank.c ├── drm_vm.c ├── drm_vma_manager.c ├── include │ ├── drm │ │ ├── ati_pcigart.h │ │ ├── drmP.h │ │ ├── drm_agpsupport.h │ │ ├── drm_atomic.h │ │ ├── drm_atomic_helper.h │ │ ├── drm_atomic_state_helper.h │ │ ├── drm_atomic_uapi.h │ │ ├── drm_audio_component.h │ │ ├── drm_auth.h │ │ ├── drm_blend.h │ │ ├── drm_bridge.h │ │ ├── drm_bridge_connector.h │ │ ├── drm_cache.h │ │ ├── drm_client.h │ │ ├── drm_color_mgmt.h │ │ ├── drm_connector.h │ │ ├── drm_crtc.h │ │ ├── drm_crtc_helper.h │ │ ├── drm_damage_helper.h │ │ ├── drm_debugfs.h │ │ ├── drm_debugfs_crc.h │ │ ├── drm_device.h │ │ ├── drm_displayid.h │ │ ├── drm_dp_dual_mode_helper.h │ │ ├── drm_dp_helper.h │ │ ├── drm_dp_mst_helper.h │ │ ├── drm_drv.h │ │ ├── drm_edid.h │ │ ├── drm_encoder.h │ │ ├── drm_encoder_slave.h │ │ ├── drm_fb_helper.h │ │ ├── drm_file.h │ │ ├── drm_fixed.h │ │ ├── drm_flip_work.h │ │ ├── drm_fourcc.h │ │ ├── drm_framebuffer.h │ │ ├── drm_gem.h │ │ ├── drm_gem_ttm_helper.h │ │ ├── drm_global.h │ │ ├── drm_hashtab.h │ │ ├── drm_hdcp.h │ │ ├── drm_ioctl.h │ │ ├── drm_irq.h │ │ ├── drm_lease.h │ │ ├── drm_legacy.h │ │ ├── drm_mm.h │ │ ├── drm_mode_config.h │ │ ├── drm_mode_object.h │ │ ├── drm_modes.h │ │ ├── drm_modeset_helper.h │ │ ├── drm_modeset_helper_vtables.h │ │ ├── drm_modeset_lock.h │ │ ├── drm_panel.h │ │ ├── drm_pciids.h │ │ ├── drm_plane.h │ │ ├── drm_plane_helper.h │ │ ├── drm_prime.h │ │ ├── drm_print.h │ │ ├── drm_probe_helper.h │ │ ├── drm_property.h │ │ ├── drm_rect.h │ │ ├── drm_scdc_helper.h │ │ ├── drm_self_refresh_helper.h │ │ ├── drm_syncobj.h │ │ ├── drm_sysfs.h │ │ ├── drm_util.h │ │ ├── drm_utils.h │ │ ├── drm_vblank.h │ │ ├── drm_vma_manager.h │ │ ├── drm_writeback.h │ │ ├── gpu_scheduler.h │ │ ├── spsc_queue.h │ │ └── task_barrier.h │ └── uapi │ │ └── drm │ │ ├── drm.h │ │ ├── drm_fourcc.h │ │ ├── drm_mode.h │ │ ├── drm_sarea.h │ │ ├── msm_drm.h │ │ ├── nouveau_drm.h │ │ ├── tegra_drm.h │ │ ├── v3d_drm.h │ │ └── vc4_drm.h └── scheduler │ ├── sched_entity.c │ ├── sched_fence.c │ └── sched_main.c ├── drmkpi ├── drmcompat_compat.c ├── drmcompat_completion.c ├── drmcompat_dma_buf.c ├── drmcompat_dma_fence.c ├── drmcompat_dma_fence_chain.c ├── drmcompat_dma_resv.c ├── drmcompat_idr.c ├── drmcompat_kthread.c ├── drmcompat_list_sort.c ├── drmcompat_lock.c ├── drmcompat_page.c ├── drmcompat_page1.c ├── drmcompat_rcu.c ├── drmcompat_schedule.c ├── drmcompat_slab.c ├── drmcompat_sort.c ├── drmcompat_sync_file.c ├── drmcompat_timer.c ├── drmcompat_work.c ├── hdmi.c └── include │ ├── asm │ ├── atomic-long.h │ ├── atomic.h │ ├── atomic64.h │ ├── barrier.h │ ├── byteorder.h │ ├── ioctl.h │ ├── mman.h │ ├── mtrr.h │ ├── pgalloc.h │ ├── pgtable.h │ ├── processor.h │ ├── required-features.h │ ├── shmparam.h │ ├── types.h │ └── uaccess.h │ ├── cec.h │ ├── drm │ ├── drm_fb_cma_helper.h │ ├── drm_gem_cma_helper.h │ ├── drm_gem_framebuffer_helper.h │ ├── drm_os_config.h │ ├── drm_os_freebsd.h │ ├── drm_os_linux.h │ └── drm_trace_freebsd.h │ ├── drmcompat │ ├── completion.h │ ├── fs.h │ ├── idr.h │ ├── list_sort.h │ ├── mutex.h │ ├── rcupdate.h │ ├── sched.h │ ├── sort.h │ ├── srcu.h │ ├── timer.h │ ├── uaccess.h │ ├── wait.h │ ├── workqueue.h │ └── ww_mutex.h │ ├── linux │ ├── agp_backend.h │ ├── anon_inodefs.h │ ├── anon_inodes.h │ ├── atomic.h │ ├── average.h │ ├── backlight.h │ ├── bitmap.h │ ├── bitops.h │ ├── bottom_half.h │ ├── bug.h │ ├── capability.h │ ├── cdev.h │ ├── compiler.h │ ├── completion.h │ ├── console.h │ ├── ctype.h │ ├── debugfs.h │ ├── delay.h │ ├── device.h │ ├── dma-attrs.h │ ├── dma-buf.h │ ├── dma-fence-array.h │ ├── dma-fence-chain.h │ ├── dma-fence.h │ ├── dma-mapping.h │ ├── dma-resv.h │ ├── dmapool.h │ ├── dmi.h │ ├── err.h │ ├── errno.h │ ├── export.h │ ├── fb.h │ ├── file.h │ ├── fs.h │ ├── gfp.h │ ├── hardirq.h │ ├── hash.h │ ├── hdmi.h │ ├── highmem.h │ ├── i2c.h │ ├── idr.h │ ├── init.h │ ├── interrupt.h │ ├── interval_tree_generic.h │ ├── io.h │ ├── ioctl.h │ ├── irqflags.h │ ├── irqreturn.h │ ├── jiffies.h │ ├── kconfig.h │ ├── kdev_t.h │ ├── kernel.h │ ├── kfifo.h │ ├── kgdb.h │ ├── kmod.h │ ├── kobject.h │ ├── kref.h │ ├── kthread.h │ ├── ktime.h │ ├── list.h │ ├── list_sort.h │ ├── llist.h │ ├── lockdep.h │ ├── log2.h │ ├── math64.h │ ├── media-bus-format.h │ ├── mem_encrypt.h │ ├── miscdevice.h │ ├── mm.h │ ├── mm_types.h │ ├── mman.h │ ├── mod_devicetable.h │ ├── module.h │ ├── moduleparam.h │ ├── mount.h │ ├── mutex.h │ ├── net.h │ ├── nospec.h │ ├── notifier.h │ ├── overflow.h │ ├── page.h │ ├── pagemap.h │ ├── pagevec.h │ ├── pci.h │ ├── pfn.h │ ├── pfn_t.h │ ├── pid.h │ ├── platform_device.h │ ├── pm.h │ ├── pm_runtime.h │ ├── poll.h │ ├── preempt.h │ ├── printk.h │ ├── property.h │ ├── pseudo_fs.h │ ├── radix-tree.h │ ├── ratelimit.h │ ├── rbtree.h │ ├── rculist.h │ ├── rcupdate.h │ ├── refcount.h │ ├── resource_ext.h │ ├── rwlock.h │ ├── rwsem.h │ ├── scatterlist.h │ ├── sched.h │ ├── sched │ │ └── signal.h │ ├── semaphore.h │ ├── seq_file.h │ ├── seqlock.h │ ├── shmem_fs.h │ ├── shrinker.h │ ├── sizes.h │ ├── slab.h │ ├── smp.h │ ├── sort.h │ ├── spinlock.h │ ├── srcu.h │ ├── stacktrace.h │ ├── stddef.h │ ├── string.h │ ├── stringify.h │ ├── swap.h │ ├── sync_file.h │ ├── sysfs.h │ ├── sysrq.h │ ├── time.h │ ├── timer.h │ ├── tracepoint.h │ ├── types.h │ ├── uaccess.h │ ├── uio.h │ ├── vga_switcheroo.h │ ├── vgaarb.h │ ├── vmalloc.h │ ├── wait.h │ ├── workqueue.h │ └── ww_mutex.h │ ├── stdarg.h │ ├── uapi │ └── linux │ │ └── dma-buf.h │ ├── video │ ├── of_videomode.h │ ├── vga.h │ └── videomode.h │ └── xen │ └── xen.h ├── extra_patches ├── 0001-Hook-DRM-to-the-build.patch ├── 0002-Add-GENERIC-DRM-for-armv7.patch ├── 0003-drm-Add-rockchip-and-bridges-into-GENERIC-DRM.patch ├── 0004-arm-drm-Add-bridges-to-GENERIC-DRM.patch ├── 0005-We-are-at-drm-5.7-minor-some-fbdev-related-commits.patch ├── 0006-We-are-at-drm-5.8-minor-some-fbdev-related-commits.patch ├── 0007-Add-a-new-DRMCOMPAT-option-to-replace-DRMKPI.patch ├── 0008-arm-arm64-Use-DRMCOMPAT-option-too.patch ├── 0009-Remove-reference-to-drmkpi.patch ├── 0010-Add-panfrost-to-GENERIC-DRM.patch ├── files ├── files.arm64 ├── files.aw ├── files.bridges ├── files.komeda ├── files.nvidia └── files.rk ├── freebsd ├── drm_fb_cma_helper.c ├── drm_fbdev.c ├── drm_gem_cma_helper.c ├── drm_gem_framebuffer_helper.c ├── drm_os_freebsd.c ├── drm_sysctl.c └── drm_sysfs.c ├── komeda ├── komeda_drv.c ├── komeda_drv.h ├── komeda_gem.c ├── komeda_gem.h ├── komeda_pipeline.c ├── komeda_pipeline.h ├── komeda_plane.c ├── komeda_plane.h └── komeda_regs.h ├── nvidia ├── tegra_bo.c ├── tegra_dc.c ├── tegra_dc_if.m ├── tegra_dc_reg.h ├── tegra_drm.h ├── tegra_drm_if.m ├── tegra_drm_subr.c ├── tegra_fb.c ├── tegra_hdmi.c ├── tegra_hdmi_reg.h └── tegra_host1x.c ├── panfrost ├── panfrost_device.c ├── panfrost_device.h ├── panfrost_drm.h ├── panfrost_drv.c ├── panfrost_drv.h ├── panfrost_features.h ├── panfrost_gem.c ├── panfrost_gem.h ├── panfrost_issues.h ├── panfrost_job.c ├── panfrost_job.h ├── panfrost_mmu.c ├── panfrost_mmu.h └── panfrost_regs.h └── rockchip ├── rk_drm.c ├── rk_gem.c ├── rk_gem.h ├── rk_plane.c ├── rk_plane.h ├── rk_vop.c ├── rk_vop.h └── rk_vop_if.m /README.md: -------------------------------------------------------------------------------- 1 | How to use : 2 | 3 | From a checkout freebsd git repo : 4 | - git checkout -b drm-base-subtree 5 | - git remote add drm-subtree https://github.com/evadot/drm-subtree.git 6 | - git subtree add --prefix sys/dev/drm/ drm-subtree master 7 | - git am sys/dev/drm/extra_patches/*.patch 8 | 9 | To update: 10 | - git fetch drm-subtree 11 | - git subtree pull --prefix sys/dev/drm/ drm-subtree master 12 | - Check if there is any new patches in extra_patches and git am them 13 | 14 | When working on the main freebsd branch every commit will be in the main freebsd 15 | repository, this is how subtree works. 16 | After doing a commit, to update the drm-subtree submodule do : 17 | - git subtree push --prefix sys/dev/drm/ drm-subtree master 18 | And update again to have the latest changes : 19 | - git subtree pull --prefix sys/dev/drm/ drm-subtree master 20 | Commit will appear twice in git log which is a bit weird so it might be better to commit 21 | directly to this repository. 22 | 23 | DRMKPI todos: 24 | - Remove struct task_struct and usage of td->td_lkpi_task 25 | - Finish checking that it doesn't conflict with linuxkpi 26 | -------------------------------------------------------------------------------- /allwinner/aw_de2_mixer_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2019 Emmanuel Vadot 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | # SUCH DAMAGE. 24 | # 25 | # $FreeBSD$ 26 | # 27 | 28 | INTERFACE aw_de2_mixer; 29 | 30 | HEADER { 31 | struct drm_device; 32 | struct drm_plane; 33 | } 34 | 35 | # 36 | # Create and register the pipeline in the drm subsystem 37 | # 38 | METHOD int create_pipeline { 39 | device_t dev; 40 | struct drm_device *drm_dev; 41 | }; 42 | 43 | # 44 | # Commit changes to the mixer 45 | # 46 | METHOD int commit { 47 | device_t dev; 48 | }; 49 | -------------------------------------------------------------------------------- /allwinner/aw_de2_tcon_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2019 Emmanuel Vadot 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | # SUCH DAMAGE. 24 | # 25 | # $FreeBSD$ 26 | # 27 | 28 | INTERFACE aw_de2_tcon; 29 | 30 | HEADER { 31 | struct drm_device; 32 | struct drm_plane; 33 | } 34 | 35 | # 36 | # Set the corresponding mixer for this tcon 37 | # 38 | METHOD int set_mixer { 39 | device_t dev; 40 | device_t mixer_dev; 41 | }; 42 | 43 | # 44 | # Create and register the pipeline in the drm subsystem 45 | # 46 | METHOD int create_crtc { 47 | device_t dev; 48 | struct drm_device *drm_dev; 49 | struct drm_plane *main_plane; 50 | struct drm_plane *cursor_plane; 51 | }; 52 | -------------------------------------------------------------------------------- /bridges/anx6345/anx6345reg.h: -------------------------------------------------------------------------------- 1 | #ifndef _ANX6345REG_H_ 2 | #define _ANX6345REG_H_ 3 | 4 | /* Registers at addr */ 5 | #define ANX6345_DP_AUX_CH_1 0xe5 6 | 7 | /* Registers at addr + 1 */ 8 | 9 | #define ANX6345_CHIPID 0x3 10 | #define ANX6345_POWER 0x5 11 | #define ANX6345_RST 0x6 12 | 13 | #endif /* _ANX6345_H_ */ 14 | -------------------------------------------------------------------------------- /bridges/drm_bridge_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2019 Emmanuel Vadot 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | # SUCH DAMAGE. 24 | # 25 | # $FreeBSD$ 26 | # 27 | 28 | INTERFACE drm_bridge; 29 | 30 | HEADER { 31 | struct drm_encoder; 32 | struct drm_device; 33 | }; 34 | 35 | # 36 | # Add the bridge to the drm pipeline 37 | # 38 | METHOD int add_bridge { 39 | device_t dev; 40 | struct drm_encoder *encoder; 41 | struct drm_device *drm; 42 | }; 43 | -------------------------------------------------------------------------------- /bridges/drm_encoder_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2022 Ruslan Bukin 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | # SUCH DAMAGE. 24 | # 25 | # $FreeBSD$ 26 | # 27 | 28 | INTERFACE drm_encoder; 29 | 30 | HEADER { 31 | struct drm_crtc; 32 | struct drm_encoder; 33 | struct drm_device; 34 | }; 35 | 36 | # 37 | # Add the encoder to the drm pipeline 38 | # 39 | METHOD int add_encoder { 40 | device_t dev; 41 | struct drm_crtc *crtc; 42 | struct drm_device *drm; 43 | }; 44 | -------------------------------------------------------------------------------- /bridges/dw_hdmi/dw_hdmi.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Emmanuel Vadot 5 | * 6 | * Portions of this work were supported by Innovate UK project 105694, 7 | * "Digital Security by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef __DW_HDMI_H__ 34 | #define __DW_HDMI_H__ 35 | 36 | struct dw_hdmi_softc { 37 | device_t dev; 38 | device_t phydev; /* Optional */ 39 | struct resource *res[2]; 40 | void * intrhand; 41 | struct mtx mtx; 42 | 43 | clk_t clk_iahb; 44 | clk_t clk_isfr; 45 | clk_t clk_cec; 46 | 47 | device_t iicbus; 48 | struct i2c_adapter *ddc; 49 | uint8_t i2cm_stat; 50 | uint8_t i2cm_addr; 51 | 52 | uint32_t reg_width; 53 | 54 | struct drm_encoder encoder; 55 | struct drm_connector connector; 56 | struct drm_bridge bridge; 57 | struct drm_display_mode mode; 58 | }; 59 | 60 | int dw_hdmi_attach(device_t dev); 61 | int dw_hdmi_detach(device_t dev); 62 | void dw_hdmi_add_bridge(struct dw_hdmi_softc *sc); 63 | 64 | DECLARE_CLASS(dw_hdmi_driver); 65 | 66 | #endif /* __DW_HDMI_H__ */ 67 | -------------------------------------------------------------------------------- /bridges/dw_hdmi/dw_hdmi_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2019 Emmanuel Vadot 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | # SUCH DAMAGE. 24 | # 25 | # $FreeBSD$ 26 | # 27 | 28 | INTERFACE dw_hdmi; 29 | 30 | HEADER { 31 | struct drm_crtc; 32 | struct drm_device; 33 | }; 34 | 35 | # 36 | # Add the encoder to the drm pipeline 37 | # 38 | METHOD int add_encoder { 39 | device_t dev; 40 | struct drm_crtc *crtc; 41 | struct drm_device *drm; 42 | }; 43 | -------------------------------------------------------------------------------- /bridges/dw_hdmi/dw_hdmi_phy_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2019 Emmanuel Vadot 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | # SUCH DAMAGE. 24 | # 25 | # $FreeBSD$ 26 | # 27 | 28 | INTERFACE dw_hdmi_phy; 29 | 30 | HEADER { 31 | struct drm_display_mode; 32 | }; 33 | 34 | # 35 | # Init the phy 36 | # 37 | METHOD int init { 38 | device_t dev; 39 | }; 40 | 41 | # 42 | # Configure the phy for the given mode 43 | # 44 | METHOD int config { 45 | device_t dev; 46 | struct drm_display_mode *mode; 47 | }; 48 | 49 | # 50 | # Detect hotplug cable 51 | # 52 | METHOD bool detect_hpd { 53 | device_t dev; 54 | }; 55 | -------------------------------------------------------------------------------- /core/drm_dp_mst_topology_internal.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0-only 2 | * 3 | * Declarations for DP MST related functions which are only used in selftests 4 | * 5 | * Copyright © 2018 Red Hat 6 | * Authors: 7 | * Lyude Paul 8 | */ 9 | 10 | #ifndef _DRM_DP_MST_HELPER_INTERNAL_H_ 11 | #define _DRM_DP_MST_HELPER_INTERNAL_H_ 12 | 13 | #include 14 | 15 | void 16 | drm_dp_encode_sideband_req(const struct drm_dp_sideband_msg_req_body *req, 17 | struct drm_dp_sideband_msg_tx *raw); 18 | int drm_dp_decode_sideband_req(const struct drm_dp_sideband_msg_tx *raw, 19 | struct drm_dp_sideband_msg_req_body *req); 20 | void 21 | drm_dp_dump_sideband_msg_req_body(const struct drm_dp_sideband_msg_req_body *req, 22 | int indent, struct drm_printer *printer); 23 | 24 | #endif /* !_DRM_DP_MST_HELPER_INTERNAL_H_ */ 25 | -------------------------------------------------------------------------------- /core/drm_gem_ttm_helper.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | #include 4 | 5 | #include 6 | 7 | /** 8 | * DOC: overview 9 | * 10 | * This library provides helper functions for gem objects backed by 11 | * ttm. 12 | */ 13 | 14 | /** 15 | * drm_gem_ttm_print_info() - Print &ttm_buffer_object info for debugfs 16 | * @p: DRM printer 17 | * @indent: Tab indentation level 18 | * @gem: GEM object 19 | * 20 | * This function can be used as &drm_gem_object_funcs.print_info 21 | * callback. 22 | */ 23 | void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent, 24 | const struct drm_gem_object *gem) 25 | { 26 | static const char * const plname[] = { 27 | [ TTM_PL_SYSTEM ] = "system", 28 | [ TTM_PL_TT ] = "tt", 29 | [ TTM_PL_VRAM ] = "vram", 30 | [ TTM_PL_PRIV ] = "priv", 31 | 32 | [ 16 ] = "cached", 33 | [ 17 ] = "uncached", 34 | [ 18 ] = "wc", 35 | [ 19 ] = "contig", 36 | 37 | [ 21 ] = "pinned", /* NO_EVICT */ 38 | [ 22 ] = "topdown", 39 | }; 40 | const struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem); 41 | 42 | drm_printf_indent(p, indent, "placement="); 43 | drm_print_bits(p, bo->mem.placement, plname, ARRAY_SIZE(plname)); 44 | drm_printf(p, "\n"); 45 | 46 | if (bo->mem.bus.is_iomem) { 47 | drm_printf_indent(p, indent, "bus.base=%lx\n", 48 | (unsigned long)bo->mem.bus.base); 49 | drm_printf_indent(p, indent, "bus.offset=%lx\n", 50 | (unsigned long)bo->mem.bus.offset); 51 | } 52 | } 53 | EXPORT_SYMBOL(drm_gem_ttm_print_info); 54 | 55 | /** 56 | * drm_gem_ttm_mmap() - mmap &ttm_buffer_object 57 | * @gem: GEM object. 58 | * @vma: vm area. 59 | * 60 | * This function can be used as &drm_gem_object_funcs.mmap 61 | * callback. 62 | */ 63 | int drm_gem_ttm_mmap(struct drm_gem_object *gem, 64 | struct vm_area_struct *vma) 65 | { 66 | struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem); 67 | int ret; 68 | 69 | ret = ttm_bo_mmap_obj(vma, bo); 70 | if (ret < 0) 71 | return ret; 72 | 73 | /* 74 | * ttm has its own object refcounting, so drop gem reference 75 | * to avoid double accounting counting. 76 | */ 77 | drm_gem_object_put_unlocked(gem); 78 | 79 | return 0; 80 | } 81 | EXPORT_SYMBOL(drm_gem_ttm_mmap); 82 | 83 | MODULE_DESCRIPTION("DRM gem ttm helpers"); 84 | MODULE_LICENSE("GPL"); 85 | -------------------------------------------------------------------------------- /core/drm_trace.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | #ifndef DRM_TRACE_H 3 | #define DRM_TRACE_H 4 | 5 | #define trace_drm_vblank_event(a, b) 6 | #define trace_drm_vblank_event_queued(a, b, c) 7 | #define trace_drm_vblank_event_delivered(a, b, c) 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /core/drm_trace_points.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #define CREATE_TRACE_POINTS 5 | #include "drm_trace.h" 6 | -------------------------------------------------------------------------------- /core/include/drm/ati_pcigart.h: -------------------------------------------------------------------------------- 1 | /* Dummy include */ 2 | -------------------------------------------------------------------------------- /core/include/drm/drm_agpsupport.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef _DRM_AGP_SUPPORT_ 4 | #define _DRM_AGP_SUPPORT_ 5 | 6 | #include 7 | 8 | struct drm_agp_head { 9 | struct list_head memory; 10 | struct agp_info agp_info; 11 | unsigned long base; 12 | int cant_use_aperture; 13 | int agp_mtrr; 14 | }; 15 | 16 | static inline void 17 | drm_legacy_agp_clear(struct drm_device *dev) 18 | { 19 | 20 | return; 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /core/include/drm/drm_atomic_uapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Red Hat 3 | * Copyright (C) 2014 Intel Corp. 4 | * Copyright (C) 2018 Intel Corp. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * Authors: 25 | * Rob Clark 26 | * Daniel Vetter 27 | */ 28 | 29 | #ifndef DRM_ATOMIC_UAPI_H_ 30 | #define DRM_ATOMIC_UAPI_H_ 31 | 32 | /* FBSD: Needed for __must_check */ 33 | #include 34 | 35 | struct drm_crtc_state; 36 | struct drm_display_mode; 37 | struct drm_property_blob; 38 | struct drm_plane_state; 39 | struct drm_crtc; 40 | struct drm_connector_state; 41 | struct dma_fence; 42 | struct drm_framebuffer; 43 | 44 | int __must_check 45 | drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, 46 | const struct drm_display_mode *mode); 47 | int __must_check 48 | drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, 49 | struct drm_property_blob *blob); 50 | int __must_check 51 | drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, 52 | struct drm_crtc *crtc); 53 | void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, 54 | struct drm_framebuffer *fb); 55 | void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state, 56 | struct dma_fence *fence); 57 | int __must_check 58 | drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, 59 | struct drm_crtc *crtc); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /core/include/drm/drm_blend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that copyright 7 | * notice and this permission notice appear in supporting documentation, and 8 | * that the name of the copyright holders not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. The copyright holders make no representations 11 | * about the suitability of this software for any purpose. It is provided "as 12 | * is" without express or implied warranty. 13 | * 14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20 | * OF THIS SOFTWARE. 21 | */ 22 | 23 | #ifndef __DRM_BLEND_H__ 24 | #define __DRM_BLEND_H__ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #define DRM_MODE_BLEND_PREMULTI 0 31 | #define DRM_MODE_BLEND_COVERAGE 1 32 | #define DRM_MODE_BLEND_PIXEL_NONE 2 33 | 34 | struct drm_device; 35 | struct drm_atomic_state; 36 | struct drm_plane; 37 | 38 | static inline bool drm_rotation_90_or_270(unsigned int rotation) 39 | { 40 | return rotation & (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270); 41 | } 42 | 43 | #define DRM_BLEND_ALPHA_OPAQUE 0xffff 44 | 45 | int drm_plane_create_alpha_property(struct drm_plane *plane); 46 | int drm_plane_create_rotation_property(struct drm_plane *plane, 47 | unsigned int rotation, 48 | unsigned int supported_rotations); 49 | unsigned int drm_rotation_simplify(unsigned int rotation, 50 | unsigned int supported_rotations); 51 | 52 | int drm_plane_create_zpos_property(struct drm_plane *plane, 53 | unsigned int zpos, 54 | unsigned int min, unsigned int max); 55 | int drm_plane_create_zpos_immutable_property(struct drm_plane *plane, 56 | unsigned int zpos); 57 | int drm_atomic_normalize_zpos(struct drm_device *dev, 58 | struct drm_atomic_state *state); 59 | int drm_plane_create_blend_mode_property(struct drm_plane *plane, 60 | unsigned int supported_modes); 61 | #endif 62 | -------------------------------------------------------------------------------- /core/include/drm/drm_bridge_connector.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0+ */ 2 | /* 3 | * Copyright (C) 2019 Laurent Pinchart 4 | */ 5 | 6 | #ifndef __DRM_BRIDGE_CONNECTOR_H__ 7 | #define __DRM_BRIDGE_CONNECTOR_H__ 8 | 9 | struct drm_connector; 10 | struct drm_device; 11 | struct drm_encoder; 12 | 13 | void drm_bridge_connector_enable_hpd(struct drm_connector *connector); 14 | void drm_bridge_connector_disable_hpd(struct drm_connector *connector); 15 | struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, 16 | struct drm_encoder *encoder); 17 | 18 | #endif /* __DRM_BRIDGE_CONNECTOR_H__ */ 19 | -------------------------------------------------------------------------------- /core/include/drm/drm_crtc_helper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2006 Keith Packard 3 | * Copyright © 2007-2008 Dave Airlie 4 | * Copyright © 2007-2008 Intel Corporation 5 | * Jesse Barnes 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | /* 27 | * The DRM mode setting helper functions are common code for drivers to use if 28 | * they wish. Drivers are not forced to use this code in their 29 | * implementations but it would be useful if they code they do use at least 30 | * provides a consistent interface and operation to userspace 31 | */ 32 | 33 | #ifndef __DRM_CRTC_HELPER_H__ 34 | #define __DRM_CRTC_HELPER_H__ 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | void drm_helper_disable_unused_functions(struct drm_device *dev); 47 | int drm_crtc_helper_set_config(struct drm_mode_set *set, 48 | struct drm_modeset_acquire_ctx *ctx); 49 | bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, 50 | struct drm_display_mode *mode, 51 | int x, int y, 52 | struct drm_framebuffer *old_fb); 53 | bool drm_helper_crtc_in_use(struct drm_crtc *crtc); 54 | bool drm_helper_encoder_in_use(struct drm_encoder *encoder); 55 | 56 | int drm_helper_connector_dpms(struct drm_connector *connector, int mode); 57 | 58 | void drm_helper_resume_force_mode(struct drm_device *dev); 59 | int drm_helper_force_disable_all(struct drm_device *dev); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /core/include/drm/drm_gem_ttm_helper.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 | 3 | #ifndef DRM_GEM_TTM_HELPER_H 4 | #define DRM_GEM_TTM_HELPER_H 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define drm_gem_ttm_of_gem(gem_obj) \ 14 | container_of(gem_obj, struct ttm_buffer_object, base) 15 | 16 | void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent, 17 | const struct drm_gem_object *gem); 18 | int drm_gem_ttm_mmap(struct drm_gem_object *gem, 19 | struct vm_area_struct *vma); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /core/include/drm/drm_global.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | /* 28 | * Authors: Thomas Hellstrom 29 | */ 30 | 31 | #ifndef _DRM_GLOBAL_H_ 32 | #define _DRM_GLOBAL_H_ 33 | enum drm_global_types { 34 | DRM_GLOBAL_TTM_MEM = 0, 35 | DRM_GLOBAL_TTM_BO, 36 | DRM_GLOBAL_TTM_OBJECT, 37 | DRM_GLOBAL_NUM 38 | }; 39 | 40 | struct drm_global_reference { 41 | enum drm_global_types global_type; 42 | size_t size; 43 | void *object; 44 | int (*init) (struct drm_global_reference *); 45 | void (*release) (struct drm_global_reference *); 46 | }; 47 | 48 | void drm_global_init(void); 49 | void drm_global_release(void); 50 | int drm_global_item_ref(struct drm_global_reference *ref); 51 | void drm_global_item_unref(struct drm_global_reference *ref); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /core/include/drm/drm_irq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Intel Corp. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef _DRM_IRQ_H_ 25 | #define _DRM_IRQ_H_ 26 | 27 | struct drm_device; 28 | 29 | int drm_irq_install(struct drm_device *dev, int irq); 30 | int drm_irq_uninstall(struct drm_device *dev); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /core/include/drm/drm_lease.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef DRM_LEASE_H 4 | #define DRM_LEASE_H 5 | 6 | #define drm_lease_held(f, id) (true) 7 | #define _drm_lease_held(f, id) (true) 8 | #define drm_lease_filter_crtcs(f, in) (in) 9 | #define drm_lease_revoke(m) 10 | #define drm_lease_destroy(m) 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /core/include/drm/drm_modeset_helper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that copyright 7 | * notice and this permission notice appear in supporting documentation, and 8 | * that the name of the copyright holders not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. The copyright holders make no representations 11 | * about the suitability of this software for any purpose. It is provided "as 12 | * is" without express or implied warranty. 13 | * 14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20 | * OF THIS SOFTWARE. 21 | */ 22 | 23 | #ifndef __DRM_KMS_HELPER_H__ 24 | #define __DRM_KMS_HELPER_H__ 25 | 26 | struct drm_crtc; 27 | struct drm_crtc_funcs; 28 | struct drm_device; 29 | struct drm_framebuffer; 30 | struct drm_mode_fb_cmd2; 31 | 32 | void drm_helper_move_panel_connectors_to_head(struct drm_device *); 33 | 34 | void drm_helper_mode_fill_fb_struct(struct drm_device *dev, 35 | struct drm_framebuffer *fb, 36 | const struct drm_mode_fb_cmd2 *mode_cmd); 37 | 38 | int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, 39 | const struct drm_crtc_funcs *funcs); 40 | 41 | int drm_mode_config_helper_suspend(struct drm_device *dev); 42 | int drm_mode_config_helper_resume(struct drm_device *dev); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /core/include/drm/drm_plane_helper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2013 Intel Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef DRM_PLANE_HELPER_H 25 | #define DRM_PLANE_HELPER_H 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* 33 | * Drivers that don't allow primary plane scaling may pass this macro in place 34 | * of the min/max scale parameters of the update checker function. 35 | * 36 | * Due to src being in 16.16 fixed point and dest being in integer pixels, 37 | * 1<<16 represents no scaling. 38 | */ 39 | #define DRM_PLANE_HELPER_NO_SCALING (1<<16) 40 | 41 | void drm_primary_helper_destroy(struct drm_plane *plane); 42 | extern const struct drm_plane_funcs drm_primary_helper_funcs; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /core/include/drm/drm_probe_helper.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0 OR MIT 2 | 3 | #ifndef __DRM_PROBE_HELPER_H__ 4 | #define __DRM_PROBE_HELPER_H__ 5 | 6 | #include 7 | 8 | struct drm_connector; 9 | struct drm_device; 10 | struct drm_modeset_acquire_ctx; 11 | 12 | int drm_helper_probe_single_connector_modes(struct drm_connector 13 | *connector, uint32_t maxX, 14 | uint32_t maxY); 15 | int drm_helper_probe_detect(struct drm_connector *connector, 16 | struct drm_modeset_acquire_ctx *ctx, 17 | bool force); 18 | void drm_kms_helper_poll_init(struct drm_device *dev); 19 | void drm_kms_helper_poll_fini(struct drm_device *dev); 20 | bool drm_helper_hpd_irq_event(struct drm_device *dev); 21 | void drm_kms_helper_hotplug_event(struct drm_device *dev); 22 | 23 | void drm_kms_helper_poll_disable(struct drm_device *dev); 24 | void drm_kms_helper_poll_enable(struct drm_device *dev); 25 | bool drm_kms_helper_is_poll_worker(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /core/include/drm/drm_self_refresh_helper.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | /* 3 | * Copyright (C) 2019 Google, Inc. 4 | * 5 | * Authors: 6 | * Sean Paul 7 | */ 8 | #ifndef DRM_SELF_REFRESH_HELPER_H_ 9 | #define DRM_SELF_REFRESH_HELPER_H_ 10 | 11 | struct drm_atomic_state; 12 | struct drm_crtc; 13 | 14 | void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state); 15 | void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state, 16 | unsigned int commit_time_ms, 17 | unsigned int new_self_refresh_mask); 18 | 19 | int drm_self_refresh_helper_init(struct drm_crtc *crtc); 20 | void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc); 21 | #endif 22 | -------------------------------------------------------------------------------- /core/include/drm/drm_sysfs.h: -------------------------------------------------------------------------------- 1 | /* Public Domain */ 2 | 3 | void drm_sysfs_hotplug_event(struct drm_device *dev __unused); 4 | -------------------------------------------------------------------------------- /core/include/drm/drm_utils.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Function prototypes for misc. drm utility functions. 4 | * Specifically this file is for function prototypes for functions which 5 | * may also be used outside of drm code (e.g. in fbdev drivers). 6 | * 7 | * Copyright (C) 2017 Hans de Goede 8 | */ 9 | 10 | #ifndef __DRM_UTILS_H__ 11 | #define __DRM_UTILS_H__ 12 | 13 | #include 14 | 15 | int drm_get_panel_orientation_quirk(int width, int height); 16 | 17 | signed long drm_timeout_abs_to_jiffies(int64_t timeout_nsec); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /core/include/drm/drm_writeback.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | struct drm_writeback_job { 4 | struct dma_fence *out_fence; 5 | struct drm_framebuffer *fb; 6 | }; 7 | 8 | struct drm_writeback_connector; 9 | 10 | static inline struct drm_writeback_connector * 11 | drm_connector_to_writeback(struct drm_connector *conn) 12 | { 13 | 14 | return (NULL); 15 | } 16 | 17 | static inline struct dma_fence * 18 | drm_writeback_get_out_fence(struct drm_writeback_connector *wb_connector) 19 | { 20 | 21 | return (NULL); 22 | } 23 | 24 | #define drm_writeback_prepare_job(wb) 0 25 | #define drm_writeback_cleanup_job(wb) 26 | #define drm_writeback_set_fb(conn, fb) 0 27 | -------------------------------------------------------------------------------- /drmkpi/include/asm/barrier.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRM_ASM_BARRIER_H__ 2 | #define __DRM_ASM_BARRIER_H__ 3 | 4 | #include 5 | 6 | #define smp_mb() mb() 7 | #define smp_rmb() rmb() 8 | #define smp_wmb() wmb() 9 | 10 | #define smp_store_release(p, v) \ 11 | do { \ 12 | smp_mb(); \ 13 | WRITE_ONCE(*p, v); \ 14 | } while (0) 15 | 16 | 17 | #define smp_load_acquire(p) \ 18 | ({ \ 19 | typeof(*p) ___p1 = READ_ONCE(*p); \ 20 | smp_mb(); \ 21 | ___p1; \ 22 | }) 23 | 24 | 25 | #endif /* __DRM_ASM_BARRIER_H__ */ 26 | -------------------------------------------------------------------------------- /drmkpi/include/asm/ioctl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/asm/ioctl.h -------------------------------------------------------------------------------- /drmkpi/include/asm/mman.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/asm/mman.h -------------------------------------------------------------------------------- /drmkpi/include/asm/mtrr.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_ASM_X86_MTRR_H 2 | #define _LINUX_ASM_X86_MTRR_H 3 | 4 | 5 | #define MTRR_TYPE_UNCACHABLE 0 6 | #define MTRR_TYPE_WRCOMB 1 7 | 8 | #define MTRR_TYPE_WRTHROUGH 4 9 | #define MTRR_TYPE_WRPROT 5 10 | #define MTRR_TYPE_WRBACK 6 11 | #define MTRR_NUM_TYPES 7 12 | 13 | 14 | int arch_phys_wc_add(unsigned long base, unsigned long size); 15 | void arch_phys_wc_del(int handle); 16 | 17 | #define arch_phys_wc_index(x) (x) 18 | 19 | #endif /*_LINUX_ASM_X86_MTRR_H */ 20 | -------------------------------------------------------------------------------- /drmkpi/include/asm/pgalloc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/asm/pgalloc.h -------------------------------------------------------------------------------- /drmkpi/include/asm/pgtable.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | #ifndef _ASM_PGTABLE_H_ 32 | #define _ASM_PGTABLE_H_ 33 | 34 | #include 35 | 36 | #define pgprot_val(x) ((x)) 37 | 38 | typedef unsigned long pteval_t; 39 | typedef unsigned long pmdval_t; 40 | typedef unsigned long pudval_t; 41 | typedef unsigned long pgdval_t; 42 | typedef unsigned long pgprotval_t; 43 | typedef struct page *pgtable_t; 44 | 45 | #endif /* _ASM_PGTABLE_H_ */ 46 | -------------------------------------------------------------------------------- /drmkpi/include/asm/processor.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRM_ASM_PROCESSOR_H__ 2 | #define __DRM_ASM_PROCESSOR_H__ 3 | 4 | #include 5 | #include 6 | 7 | #define smp_mb() mb() 8 | #define smp_rmb() rmb() 9 | #define smp_wmb() wmb() 10 | 11 | static __always_inline void cpu_relax(void) 12 | { 13 | cpu_spinwait(); 14 | } 15 | 16 | #endif /* __DRM_ASM_PROCESSOR_H__ */ 17 | -------------------------------------------------------------------------------- /drmkpi/include/asm/required-features.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/asm/required-features.h -------------------------------------------------------------------------------- /drmkpi/include/asm/shmparam.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRM_ASM_SHMPARAM_H__ 2 | #define __DRM_ASM_SHMPARAM_H__ 3 | 4 | #define SHMLBA PAGE_SIZE 5 | 6 | #endif /* __DRM_ASM_SHMPARAM_H__ */ 7 | -------------------------------------------------------------------------------- /drmkpi/include/asm/types.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | #ifndef _ASM_TYPES_H_ 32 | #define _ASM_TYPES_H_ 33 | 34 | #ifdef _KERNEL 35 | 36 | #include 37 | 38 | typedef uint8_t u8; 39 | typedef uint8_t __u8; 40 | typedef uint16_t u16; 41 | typedef uint16_t __u16; 42 | typedef uint32_t u32; 43 | typedef uint32_t __u32; 44 | typedef uint64_t u64; 45 | typedef uint64_t __u64; 46 | 47 | typedef int8_t s8; 48 | typedef int8_t __s8; 49 | typedef int16_t s16; 50 | typedef int16_t __s16; 51 | typedef int32_t s32; 52 | typedef int32_t __s32; 53 | typedef int64_t s64; 54 | typedef int64_t __s64; 55 | 56 | /* DMA addresses come in generic and 64-bit flavours. */ 57 | typedef vm_paddr_t dma_addr_t; 58 | typedef vm_paddr_t dma64_addr_t; 59 | 60 | typedef unsigned short umode_t; 61 | 62 | #endif /* _KERNEL */ 63 | 64 | #endif /* _ASM_TYPES_H_ */ 65 | -------------------------------------------------------------------------------- /drmkpi/include/asm/uaccess.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | #ifndef _ASM_UACCESS_H_ 32 | #define _ASM_UACCESS_H_ 33 | 34 | #include 35 | 36 | static inline long 37 | copy_to_user(void *to, const void *from, unsigned long n) 38 | { 39 | if (drmcompat_copyout(from, to, n) != 0) 40 | return n; 41 | return 0; 42 | } 43 | #define __copy_to_user(...) copy_to_user(__VA_ARGS__) 44 | 45 | static inline long 46 | copy_from_user(void *to, const void *from, unsigned long n) 47 | { 48 | if (drmcompat_copyin(from, to, n) != 0) 49 | return n; 50 | return 0; 51 | } 52 | #define __copy_from_user(...) copy_from_user(__VA_ARGS__) 53 | #define __copy_in_user(...) copy_from_user(__VA_ARGS__) 54 | 55 | #define user_access_begin() do { } while (0) 56 | #define user_access_end() do { } while (0) 57 | 58 | #define unsafe_get_user(x, ptr, err) do { \ 59 | if (unlikely(__get_user(x, ptr))) \ 60 | goto err; \ 61 | } while (0) 62 | 63 | #define unsafe_put_user(x, ptr, err) do { \ 64 | if (unlikely(__put_user(x, ptr))) \ 65 | goto err; \ 66 | } while (0) 67 | 68 | #endif /* _ASM_UACCESS_H_ */ 69 | -------------------------------------------------------------------------------- /drmkpi/include/cec.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/cec.h -------------------------------------------------------------------------------- /drmkpi/include/drm/drm_fb_cma_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef _DRM_FB_CMA_HELPER_H_ 2 | #define _DRM_FB_CMA_HELPER_H_ 3 | 4 | #include 5 | 6 | struct drm_fb_cma { 7 | struct drm_framebuffer drm_fb; 8 | struct drm_fb_helper fb_helper; 9 | 10 | struct drm_gem_cma_object **planes; /* Attached planes */ 11 | vm_offset_t *planes_vbase; 12 | int nplanes; 13 | }; 14 | 15 | struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_fb_cma *fb, int idx); 16 | int drm_fb_cma_probe(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes); 17 | 18 | #endif /* _DRM_FB_CMA_HELPER_H_ */ 19 | -------------------------------------------------------------------------------- /drmkpi/include/drm/drm_gem_cma_helper.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2019 Emmanuel Vadot 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 18 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 20 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | * SUCH DAMAGE. 24 | * 25 | * $FreeBSD$ 26 | */ 27 | 28 | #ifndef _DRM_GEM_CMA_H_ 29 | #define _DRM_GEM_CMA_H_ 30 | 31 | #include 32 | #include 33 | 34 | struct drm_gem_cma_object { 35 | struct drm_gem_object gem_obj; 36 | struct sg_table *sgt; 37 | 38 | /* mapped memory buffer */ 39 | vm_paddr_t pbase; 40 | vm_offset_t vbase; 41 | size_t npages; 42 | size_t size; /* Rounded to page */ 43 | vm_page_t *m; 44 | }; 45 | 46 | int drm_gem_cma_create(struct drm_device *drm, size_t size, 47 | struct drm_gem_cma_object **res_bo); 48 | int drm_gem_cma_create_nobufs(struct drm_device *drm, size_t size, 49 | bool private, struct drm_gem_cma_object **res_bo); 50 | void drm_gem_cma_free_object(struct drm_gem_object *gem_obj); 51 | int drm_gem_cma_dumb_create(struct drm_file *file, struct drm_device *drm_dev, 52 | struct drm_mode_create_dumb *args); 53 | int drm_gem_cma_mmap(struct file *file, struct vm_area_struct *vma); 54 | vm_page_t * drm_gem_cma_get_pages(struct drm_gem_object *gem_obj, 55 | int *npages); 56 | 57 | extern const struct vm_operations_struct drm_gem_cma_vm_ops; 58 | 59 | #endif /* _DRM_GEM_CMA_H_ */ 60 | -------------------------------------------------------------------------------- /drmkpi/include/drm/drm_gem_framebuffer_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRM_GEM_FB_HELPER_H__ 2 | #define __DRM_GEM_FB_HELPER_H__ 3 | 4 | struct drm_framebuffer * 5 | drm_gem_fb_create(struct drm_device *drm, struct drm_file *file, 6 | const struct drm_mode_fb_cmd2 *cmd); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /drmkpi/include/drm/drm_os_config.h: -------------------------------------------------------------------------------- 1 | #ifndef DRM_OS_CONFIG_H_ 2 | #define DRM_OS_CONFIG_H_ 3 | 4 | #ifdef _KERNEL 5 | #define __KERNEL__ 6 | #endif 7 | 8 | #define COMPAT_FREEBSD32 1 9 | #define CONFIG_COMPAT 1 10 | 11 | #define CONFIG_FB 1 12 | #define CONFIG_DRM_FBDEV_EMULATION 1 13 | 14 | // Overallocation of the fbdev buffer 15 | // Defines the fbdev buffer overallocation in percent. Default is 100. 16 | // Typical values for double buffering will be 200, triple buffering 300. 17 | #define CONFIG_DRM_FBDEV_OVERALLOC 100 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /drmkpi/include/drm/drm_os_freebsd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file drm_os_freebsd.h 3 | * OS abstraction macros. 4 | */ 5 | 6 | #include 7 | __FBSDID("$FreeBSD$"); 8 | 9 | #ifndef _DRM_OS_FREEBSD_H_ 10 | #define _DRM_OS_FREEBSD_H_ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "drm_os_config.h" 18 | 19 | #define PICOS2KHZ(a) (1000000000UL/(a)) 20 | #define KHZ2PICOS(a) (1000000000UL/(a)) 21 | 22 | #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) 23 | #define DRM_DEV_UID UID_ROOT 24 | #define DRM_DEV_GID GID_VIDEO 25 | 26 | #define KTR_DRM KTR_DEV 27 | #define KTR_DRM_REG KTR_SPARE3 28 | 29 | MALLOC_DECLARE(DRM_MEM_DRIVER); 30 | MALLOC_DECLARE(DRM_MEM_KMS); 31 | 32 | struct drm_minor; 33 | struct drm_device; 34 | int drm_fbsd_cdev_create(struct drm_minor *minor); 35 | void drm_fbsd_cdev_delete(struct drm_minor *minor); 36 | int drm_fbsd_sysctl_cleanup(struct drm_device *dev); 37 | int drm_fbsd_sysctl_init(struct drm_device *dev); 38 | 39 | #endif /* _DRM_OS_FREEBSD_H_ */ 40 | -------------------------------------------------------------------------------- /drmkpi/include/drm/drm_os_linux.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/drm/drm_os_linux.h -------------------------------------------------------------------------------- /drmkpi/include/drm/drm_trace_freebsd.h: -------------------------------------------------------------------------------- 1 | #ifndef _DRM_TRACE_FREEBSD_H_ 2 | #define _DRM_TRACE_FREEBSD_H_ 3 | 4 | #include 5 | 6 | 7 | /* TRACE_EVENT(drm_vblank_event, */ 8 | /* TP_PROTO(int crtc, unsigned int seq), */ 9 | static inline void 10 | trace_drm_vblank_event(int crtc, unsigned int seq) 11 | { 12 | CTR2(KTR_DRM, "drm_vblank_event crtc %d, seq %u", crtc, seq); 13 | } 14 | 15 | /* TRACE_EVENT(drm_vblank_event_queued, */ 16 | /* TP_PROTO(struct drm_file *file, int crtc, unsigned int seq), */ 17 | static inline void 18 | trace_drm_vblank_event_queued(struct drm_file *file, int crtc, unsigned int seq) 19 | { 20 | CTR3(KTR_DRM, "drm_vblank_event_queued crtc %d, seq %u", file, crtc, seq); 21 | } 22 | 23 | /* TRACE_EVENT(drm_vblank_event_delivered, */ 24 | /* TP_PROTO(struct drm_file *file, int crtc, unsigned int seq), */ 25 | static inline void 26 | trace_drm_vblank_event_delivered(struct drm_file *file, int crtc, unsigned int seq) 27 | { 28 | CTR3(KTR_DRM, "drm_vblank_event_delivered drm_file %p, crtc %d, seq %u", file, crtc, seq); 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/completion.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_COMPLETION_H__ 33 | #define __DRMCOMPAT_COMPLETION_H__ 34 | 35 | struct completion { 36 | unsigned int done; 37 | }; 38 | 39 | void drmcompat_complete_common(struct completion *, int); 40 | int drmcompat_wait_for_common(struct completion *, int); 41 | int drmcompat_wait_for_timeout_common(struct completion *, int, int); 42 | int drmcompat_try_wait_for_completion(struct completion *); 43 | int drmcompat_completion_done(struct completion *); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/list_sort.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Emmanuel Vadot 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 18 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 20 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | * SUCH DAMAGE. 24 | * 25 | * $FreeBSD$ 26 | */ 27 | 28 | #ifndef __DRMCOMPAT_LIST_SORT_H__ 29 | #define __DRMCOMPAT_LIST_SORT_H__ 30 | 31 | void drmcompat_list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, 32 | struct list_head *a, struct list_head *b)); 33 | 34 | #endif /* __DRMCOMPAT_LIST_SORT_H__ */ 35 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/mutex.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_MUTEX_H__ 33 | #define __DRMCOMPAT_MUTEX_H__ 34 | 35 | typedef struct mutex { 36 | struct sx sx; 37 | } mutex_t; 38 | 39 | int drmcompat_mutex_lock_interruptible(mutex_t *m); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/sched.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_SCHED_H__ 33 | #define __DRMCOMPAT_SCHED_H__ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | #define MAX_SCHEDULE_TIMEOUT INT_MAX 40 | 41 | #define TASK_RUNNING 0x0000 42 | #define TASK_INTERRUPTIBLE 0x0001 43 | #define TASK_UNINTERRUPTIBLE 0x0002 44 | #define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) 45 | #define TASK_WAKING 0x0100 46 | #define TASK_PARKED 0x0200 47 | 48 | #define TASK_COMM_LEN (MAXCOMLEN + 1) 49 | 50 | #define current curthread 51 | 52 | bool drmcompat_signal_pending(struct thread *task); 53 | 54 | int drmcompat_schedule_timeout(int timeout); 55 | int drmcompat_schedule_timeout_interruptible(int timeout); 56 | 57 | #endif /* __DRMCOMPAT_SCHED_H__ */ 58 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/sort.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Emmanuel Vadot 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 18 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 20 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | * SUCH DAMAGE. 24 | * 25 | * $FreeBSD$ 26 | */ 27 | 28 | #ifndef __DRMCOMPAT_SORT_H__ 29 | #define __DRMCOMPAT_SORT_H__ 30 | 31 | void drmcompat_sort(void *base, size_t num, size_t size, 32 | int (*cmp)(const void *, const void *), 33 | void (*swap)(void *, void *, int)); 34 | 35 | #endif /* __DRMCOMPAT_SORT_H__ */ 36 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/srcu.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2015-2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_SRCU_H__ 30 | #define __DRMCOMPAT_SRCU_H__ 31 | 32 | struct srcu_struct { 33 | }; 34 | 35 | int drmcompat_srcu_read_lock(struct srcu_struct *); 36 | void drmcompat_srcu_read_unlock(struct srcu_struct *, int index); 37 | void drmcompat_synchronize_srcu(struct srcu_struct *); 38 | void drmcompat_srcu_barrier(struct srcu_struct *); 39 | int drmcompat_init_srcu_struct(struct srcu_struct *); 40 | void drmcompat_cleanup_srcu_struct(struct srcu_struct *); 41 | 42 | #endif /* __DRMCOMPAT_SRCU_H__ */ 43 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/timer.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_TIMER_H__ 33 | #define __DRMCOMPAT_TIMER_H__ 34 | 35 | struct timer_list { 36 | struct callout callout; 37 | union { 38 | void (*function) (unsigned long); /* < v4.15 */ 39 | void (*function_415) (struct timer_list *); 40 | }; 41 | unsigned long data; 42 | int expires; 43 | }; 44 | 45 | int drmcompat_mod_timer(struct timer_list *timer, int expires); 46 | void drmcompat_add_timer(struct timer_list *timer); 47 | void drmcompat_add_timer_on(struct timer_list *timer, int cpu); 48 | int drmcompat_del_timer(struct timer_list *timer); 49 | int drmcompat_del_timer_sync(struct timer_list *timer); 50 | 51 | #endif /* __DRMCOMPAT_TIMER_H__ */ 52 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/uaccess.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 | * Copyright (c) 2015 François Tigeot 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice unmodified, this list of conditions, and the following 14 | * disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef __DRMCOMPAT_UACCESS_H__ 34 | #define __DRMCOMPAT_UACCESS_H__ 35 | 36 | int drmcompat_copyin(const void *uaddr, void *kaddr, size_t len); 37 | int drmcompat_copyout(const void *kaddr, void *uaddr, size_t len); 38 | size_t drmcompat_clear_user(void *uaddr, size_t len); 39 | int drmcompat_access_ok(const void *uaddr, size_t len); 40 | 41 | #endif /* __DRMCOMPAT_UACCESS_H__ */ 42 | -------------------------------------------------------------------------------- /drmkpi/include/drmcompat/ww_mutex.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_WW_MUTEX_H__ 30 | #define __DRMCOMPAT_WW_MUTEX_H__ 31 | 32 | #include 33 | 34 | struct ww_mutex { 35 | struct mutex base; 36 | struct cv condvar; 37 | struct ww_acquire_ctx *ctx; 38 | }; 39 | 40 | int drmcompat_ww_mutex_lock_sub(struct ww_mutex *, 41 | struct ww_acquire_ctx *, int catch_signal); 42 | void drmcompat_ww_mutex_unlock_sub(struct ww_mutex *); 43 | 44 | #endif /* __DRMCOMPAT_WW_MUTEX_H__ */ 45 | -------------------------------------------------------------------------------- /drmkpi/include/linux/agp_backend.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_AGP_BACKEND_H__ 2 | #define __DRMCOMPAT_LINUX_AGP_BACKEND_H__ 3 | 4 | struct agp_kern_info 5 | { 6 | int aper_size; 7 | }; 8 | 9 | struct agp_memory 10 | { 11 | }; 12 | 13 | #endif /* __DRMCOMPAT_LINUX_AGP_BACKEND_H__ */ 14 | -------------------------------------------------------------------------------- /drmkpi/include/linux/anon_inodefs.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_ANON_INODEFS_H_ 2 | #define __DRMCOMPAT_LINUX_ANON_INODEFS_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #endif /* __DRMCOMPAT_LINUX_ANON_INODEFS_H_ */ 9 | -------------------------------------------------------------------------------- /drmkpi/include/linux/anon_inodes.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_ANON_INODES_H_ 2 | #define __DRMCOMPAT_LINUX_ANON_INODES_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #endif /* __DRMCOMPAT_LINUX_ANON_INODES_H_ */ 9 | -------------------------------------------------------------------------------- /drmkpi/include/linux/atomic.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Mark Johnston 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in 11 | * the documentation and/or other materials provided with the 12 | * distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_ATOMIC_H__ 30 | #define __DRMCOMPAT_LINUX_ATOMIC_H__ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #endif /* __DRMCOMPAT_LINUX_ATOMIC_H__ */ 37 | -------------------------------------------------------------------------------- /drmkpi/include/linux/backlight.h: -------------------------------------------------------------------------------- 1 | /* Public domain */ 2 | 3 | struct backlight_device; 4 | 5 | #define backlight_disable(x) 0 6 | #define backlight_enable(x) 0 7 | -------------------------------------------------------------------------------- /drmkpi/include/linux/bottom_half.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Hans Petter Selasky 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_BOTTOM_HALF_H__ 30 | #define __DRMCOMPAT_LINUX_BOTTOM_HALF_H__ 31 | 32 | void drmcompat_local_bh_enable(void); 33 | void drmcompat_local_bh_disable(void); 34 | 35 | #endif /* __DRMCOMPAT_LINUX_BOTTOM_HALF_H__ */ 36 | -------------------------------------------------------------------------------- /drmkpi/include/linux/bug.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/capability.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef __DRMCOMPAT_LINUX_CAPABILITY_H__ 4 | #define __DRMCOMPAT_LINUX_CAPABILITY_H__ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | enum linux_capabilities { 11 | CAP_SYS_ADMIN = 1, 12 | }; 13 | 14 | static inline bool 15 | capable(enum linux_capabilities cap) 16 | { 17 | 18 | KASSERT(cap == CAP_SYS_ADMIN, ("cap isn't CAP_SYS_ADMIN")); 19 | return (priv_check(curthread, PRIV_DRIVER) == 0); 20 | } 21 | 22 | #endif /* __DRMCOMPAT_LINUX_CAPABILITY_H__ */ 23 | -------------------------------------------------------------------------------- /drmkpi/include/linux/cdev.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/console.h: -------------------------------------------------------------------------------- 1 | /* Public domain */ 2 | 3 | #ifndef __DRMCOMPAT_LINUX_LINUX_CONSOLE_H__ 4 | #define __DRMCOMPAT_LINUX_LINUX_CONSOLE_H__ 5 | 6 | #define console_lock() 7 | #define console_unlock() 8 | #define console_trylock() true 9 | 10 | #endif /* __DRMCOMPAT_LINUX_LINUX_CONSOLE_H__ */ 11 | -------------------------------------------------------------------------------- /drmkpi/include/linux/ctype.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | 3 | -------------------------------------------------------------------------------- /drmkpi/include/linux/debugfs.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/delay.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. 6 | * Copyright (c) 2014 François Tigeot 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice unmodified, this list of conditions, and the following 14 | * disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef __DRMCOMPAT_LINUX_DELAY_H__ 34 | #define __DRMCOMPAT_LINUX_DELAY_H__ 35 | 36 | #include 37 | #include 38 | 39 | static inline void 40 | linux_msleep(unsigned int ms) 41 | { 42 | /* guard against invalid values */ 43 | if (ms == 0) 44 | ms = 1; 45 | pause_sbt("drmsleep", mstosbt(ms), 0, C_HARDCLOCK); 46 | } 47 | 48 | #undef msleep 49 | #define msleep(ms) linux_msleep(ms) 50 | 51 | #define udelay(t) DELAY(t) 52 | 53 | static inline void 54 | usleep_range(unsigned long min, unsigned long max) 55 | { 56 | DELAY(min); 57 | } 58 | 59 | #endif /* __DRMCOMPAT_LINUX_DELAY_H__ */ 60 | -------------------------------------------------------------------------------- /drmkpi/include/linux/device.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_DEVICE_H__ 33 | #define __DRMCOMPAT_LINUX_DEVICE_H__ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | 41 | struct device_type { 42 | const char *name; 43 | }; 44 | #define device _device 45 | 46 | char *kvasprintf(gfp_t, const char *, va_list); 47 | char *kasprintf(gfp_t, const char *, ...); 48 | 49 | #define dev_name(dev, ...) device_get_name(dev) 50 | #define dev_driver_string(dev, ...) device_get_name(dev) 51 | #define dev_dbg(dev, ...) device_printf(dev, ##__VA_ARGS__) 52 | #define dev_err(dev, ...) device_printf(dev, ##__VA_ARGS__) 53 | #define dev_warn(dev, ...) device_printf(dev, ##__VA_ARGS__) 54 | #define dev_info(dev, ...) device_printf(dev, ##__VA_ARGS__) 55 | #define dev_printk(level, dev, ...) device_printf(dev, ##__VA_ARGS__) 56 | 57 | #define device_is_registered(dev) 0 58 | #define put_device(dev) 59 | #define get_device(dev) dev 60 | 61 | #define devm_add_action(parent, func, dev) 0 62 | 63 | #endif /* __DRMCOMPAT_LINUX__DEVICE_H__ */ 64 | -------------------------------------------------------------------------------- /drmkpi/include/linux/dma-attrs.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_DMA_ATTR_H__ 33 | #define __DRMCOMPAT_LINUX_DMA_ATTR_H__ 34 | 35 | #define DMA_ATTR_WRITE_BARRIER (1 << 0) 36 | #define DMA_ATTR_WEAK_ORDERING (1 << 1) 37 | #define DMA_ATTR_WRITE_COMBINE (1 << 2) 38 | #define DMA_ATTR_NON_CONSISTENT (1 << 3) 39 | #define DMA_ATTR_NO_KERNEL_MAPPING (1 << 4) 40 | #define DMA_ATTR_SKIP_CPU_SYNC (1 << 5) 41 | #define DMA_ATTR_FORCE_CONTIGUOUS (1 << 6) 42 | #define DMA_ATTR_ALLOC_SINGLE_PAGES (1 << 7) 43 | #define DMA_ATTR_NO_WARN (1 << 8) 44 | #define DMA_ATTR_PRIVILEGED (1 << 9) 45 | 46 | struct dma_attrs { 47 | unsigned long flags; 48 | }; 49 | #define DEFINE_DMA_ATTRS(x) struct dma_attrs x = { } 50 | 51 | static inline void 52 | init_dma_attrs(struct dma_attrs *attrs) 53 | { 54 | attrs->flags = 0; 55 | } 56 | 57 | #endif /* __DRMCOMPAT_LINUX_DMA_ATTR_H__ */ 58 | -------------------------------------------------------------------------------- /drmkpi/include/linux/dma-fence-array.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: fence.h,v 1.15 2018/08/27 14:20:41 riastradh Exp $ */ 2 | 3 | /*- 4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. 5 | * All rights reserved. 6 | * 7 | * This code is derived from software contributed to The NetBSD Foundation 8 | * by Taylor R. Campbell. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_DMA_FENCE_ARRAY_H__ 33 | #define __DRMCOMPAT_LINUX_DMA_FENCE_ARRAY_H__ 34 | 35 | #include 36 | 37 | #define dma_fence_is_array linux_dma_fence_is_array 38 | #define to_dma_fence_array linux_to_dma_fence_array 39 | 40 | struct dma_fence_array { 41 | struct dma_fence **fences; 42 | unsigned num_fences; 43 | }; 44 | 45 | bool dma_fence_is_array(struct dma_fence *); 46 | struct dma_fence_array * 47 | to_dma_fence_array(struct dma_fence *); 48 | 49 | #endif /* __DRMCOMPAT_LINUX_DMA_FENCE_ARRAY_H__ */ 50 | -------------------------------------------------------------------------------- /drmkpi/include/linux/dma-fence-chain.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | struct dma_fence_chain { 4 | struct dma_fence base; 5 | spinlock_t lock; 6 | struct dma_fence __rcu *prev; 7 | u64 prev_seqno; 8 | struct dma_fence *fence; 9 | struct dma_fence_cb cb; 10 | #ifdef __linux__ 11 | struct irq_work work; 12 | #endif 13 | }; 14 | 15 | extern const struct dma_fence_ops dma_fence_chain_ops; 16 | 17 | static inline struct dma_fence_chain * 18 | to_dma_fence_chain(struct dma_fence *fence) 19 | { 20 | if (!fence || fence->ops != &dma_fence_chain_ops) 21 | return NULL; 22 | 23 | return container_of(fence, struct dma_fence_chain, base); 24 | } 25 | 26 | #define dma_fence_chain_for_each(iter, head) \ 27 | for (iter = dma_fence_get(head); iter; \ 28 | iter = dma_fence_chain_walk(iter)) 29 | struct dma_fence *dma_fence_chain_walk(struct dma_fence *fence); 30 | int dma_fence_chain_find_seqno(struct dma_fence **pfence, uint64_t seqno); 31 | 32 | void dma_fence_chain_init(struct dma_fence_chain *chain, 33 | struct dma_fence *prev, 34 | struct dma_fence *fence, 35 | uint64_t seqno); 36 | -------------------------------------------------------------------------------- /drmkpi/include/linux/dmapool.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/dmi.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 The FreeBSD Foundation 3 | * 4 | * This software was developed by Emmanuel Vadot under sponsorship 5 | * from the FreeBSD Foundation. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | * 28 | * $FreeBSD$ 29 | */ 30 | 31 | #ifndef __DRMCOMPAT_LINUX_DMI_H__ 32 | #define __DRMCOMPAT_LINUX_DMI_H__ 33 | 34 | #include 35 | 36 | int linux_dmi_check_system(const struct dmi_system_id *); 37 | bool linux_dmi_match(enum dmi_field, const char *); 38 | const struct dmi_system_id *linux_dmi_first_match(const struct dmi_system_id *); 39 | const char *linux_dmi_get_system_info(int); 40 | 41 | #define dmi_check_system(sysid) linux_dmi_check_system(sysid) 42 | #define dmi_match(f, str) linux_dmi_match(f, str) 43 | #define dmi_first_match(sysid) linux_dmi_first_match(sysid) 44 | #define dmi_get_system_info(sysid) linux_dmi_get_system_info(sysid) 45 | 46 | #endif /* __DRMCOMPAT_LINUX_DMI_H__ */ 47 | -------------------------------------------------------------------------------- /drmkpi/include/linux/err.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_ERR_H__ 33 | #define __DRMCOMPAT_LINUX_ERR_H__ 34 | 35 | #include 36 | 37 | #include 38 | 39 | #define MAX_ERRNO 4095 40 | 41 | #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) 42 | 43 | static inline void * 44 | ERR_PTR(long error) 45 | { 46 | return (void *)error; 47 | } 48 | 49 | static inline long 50 | PTR_ERR(const void *ptr) 51 | { 52 | return (long)ptr; 53 | } 54 | 55 | static inline long 56 | IS_ERR(const void *ptr) 57 | { 58 | return IS_ERR_VALUE((unsigned long)ptr); 59 | } 60 | 61 | static inline long 62 | IS_ERR_OR_NULL(const void *ptr) 63 | { 64 | return !ptr || IS_ERR_VALUE((unsigned long)ptr); 65 | } 66 | 67 | static inline void * 68 | ERR_CAST(const void *ptr) 69 | { 70 | return __DECONST(void *, ptr); 71 | } 72 | 73 | static inline int 74 | PTR_ERR_OR_ZERO(const void *ptr) 75 | { 76 | if (IS_ERR(ptr)) 77 | return PTR_ERR(ptr); 78 | else 79 | return 0; 80 | } 81 | 82 | #define PTR_RET(p) PTR_ERR_OR_ZERO(p) 83 | 84 | #endif /* __DRMCOMPAT_LINUX_ERR_H__ */ 85 | -------------------------------------------------------------------------------- /drmkpi/include/linux/errno.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_ERRNO_H__ 33 | #define __DRMCOMPAT_LINUX_ERRNO_H__ 34 | 35 | #include 36 | 37 | #define EBADRQC 56 /* Bad request code */ 38 | 39 | #define ECHRNG EDOM 40 | #define ETIME ETIMEDOUT 41 | #define ECOMM ESTALE 42 | #define ENODATA ECONNREFUSED 43 | #define ENOIOCTLCMD ENOIOCTL 44 | /* Use same value as Linux, because BSD's ERESTART is negative */ 45 | #define ERESTARTSYS 512 46 | #define ENOTSUPP EOPNOTSUPP 47 | #define ENONET EHOSTDOWN 48 | 49 | #define ERESTARTNOINTR 513 50 | #define ERESTARTNOHAND 514 51 | #define ERESTART_RESTARTBLOCK 516 52 | #define EPROBE_DEFER 517 53 | #define EOPENSTALE 518 54 | #define EBADHANDLE 521 55 | #define ENOTSYNC 522 56 | #define EBADCOOKIE 523 57 | #define ETOOSMALL 525 58 | #define ESERVERFAULT 526 59 | #define EBADTYPE 527 60 | #define EJUKEBOX 528 61 | #define EIOCBQUEUED 529 62 | 63 | #endif /* __DRMCOMPAT_LINUX_ERRNO_H__ */ 64 | -------------------------------------------------------------------------------- /drmkpi/include/linux/export.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2018 Johannes Lundberg 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice unmodified, this list of conditions, and the following 9 | * disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | * $FreeBSD$ 26 | */ 27 | 28 | #ifndef __DRMCOMPAT_LINUX_EXPORT_H__ 29 | #define __DRMCOMPAT_LINUX_EXPORT_H__ 30 | 31 | #define EXPORT_SYMBOL(name) 32 | #define EXPORT_SYMBOL_GPL(name) 33 | 34 | #endif /* __DRMCOMPAT_LINUX_EXPORT_H__ */ 35 | -------------------------------------------------------------------------------- /drmkpi/include/linux/fb.h: -------------------------------------------------------------------------------- 1 | /* Public domain */ 2 | 3 | #ifndef __DRMCOMPAT_LINUX_FB_H_ 4 | #define __DRMCOMPAT_LINUX_FB_H_ 5 | #include 6 | 7 | #ifdef __FreeBSD__ 8 | #include 9 | #endif 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | /* screen: unblanked, hsync: on, vsync: on */ 17 | #define FB_BLANK_UNBLANK 0 18 | 19 | /* screen: blanked, hsync: on, vsync: on */ 20 | #define FB_BLANK_NORMAL 1 21 | 22 | /* screen: blanked, hsync: on, vsync: off */ 23 | #define FB_BLANK_VSYNC_SUSPEND 2 24 | 25 | /* screen: blanked, hsync: off, vsync: on */ 26 | #define FB_BLANK_HSYNC_SUSPEND 3 27 | 28 | /* screen: blanked, hsync: off, vsync: off */ 29 | #define FB_BLANK_POWERDOWN 4 30 | 31 | struct fb_cmap; 32 | struct fb_var_screeninfo; 33 | 34 | /* FBSD implementation in drm_fb_helper.c */ 35 | int fb_get_options(const char *name, char **option); 36 | struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 37 | void framebuffer_release(struct fb_info *info); 38 | 39 | struct fb_fillrect; 40 | struct fb_copyarea; 41 | struct fb_image; 42 | 43 | struct vt_kms_softc { 44 | struct drm_fb_helper *fb_helper; 45 | struct task fb_mode_task; 46 | }; 47 | 48 | #endif /* __DRMCOMPAT_LINUX_FB_H_ */ 49 | -------------------------------------------------------------------------------- /drmkpi/include/linux/fs.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_FS_H__ 33 | #define __DRMCOMPAT_LINUX_FS_H__ 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | #define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH) 41 | #define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH) 42 | 43 | /* 44 | * This is ugly way how reduce number of #ifdef __linux__ 45 | * changes due to struct file FBSD <-> Linux file->private_data field naming 46 | * difference. Alternatively, we may usee unnamed union in definition of 47 | * struct file. 48 | */ 49 | #define private_data f_data 50 | #define f_flags f_flag 51 | #define EPOLLIN POLLIN 52 | #define EPOLLRDNORM POLLRDNORM 53 | 54 | #define shmem_file_setup(...) \ 55 | drmcompat_shmem_file_setup(__VA_ARGS__) 56 | 57 | #define iminor(inode) drmcompat_iminor(inode) 58 | 59 | #endif /* __DRMCOMPAT_LINUX_FS_H__ */ 60 | -------------------------------------------------------------------------------- /drmkpi/include/linux/hardirq.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_HARDIRQ_H__ 33 | #define __DRMCOMPAT_LINUX_HARDIRQ_H__ 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #define synchronize_irq(irq) _intr_drain((irq)) 43 | 44 | #endif /* __DRMCOMPAT_LINUX_HARDIRQ_H__ */ 45 | -------------------------------------------------------------------------------- /drmkpi/include/linux/hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 François Tigeot 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef __DRMCOMPAT_LINUX_HASH_H__ 28 | #define __DRMCOMPAT_LINUX_HASH_H__ 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | static inline u64 hash_64(u64 val, unsigned int bits) 35 | { 36 | u64 ret; 37 | 38 | ret = (uint64_t)hash32_buf(&val, sizeof(val), bits); 39 | 40 | return ret >> (64 - bits); 41 | } 42 | 43 | static inline u32 hash_32(u32 val, unsigned int bits) 44 | { 45 | u32 ret; 46 | 47 | ret = hash32_buf(&val, sizeof(val), bits); 48 | 49 | return ret >> (32 - bits); 50 | } 51 | 52 | #if BITS_PER_LONG == 64 /* amd64 */ 53 | #define hash_long(val, bits) hash_64(val, bits) 54 | #else /* i386 */ 55 | #define hash_long(val, bits) hash_32(val, bits) 56 | #endif 57 | 58 | #endif /* __DRMCOMPAT_LINUX_HASH_H__ */ 59 | -------------------------------------------------------------------------------- /drmkpi/include/linux/highmem.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/init.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/interrupt.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_INTERRUPT_H__ 33 | #define __DRMCOMPAT_LINUX_INTERRUPT_H__ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | typedef irqreturn_t (*irq_handler_t)(int, void *); 40 | 41 | #define IRQF_SHARED RF_SHAREABLE 42 | 43 | #endif /* __DRMCOMPAT_LINUX_INTERRUPT_H__ */ 44 | -------------------------------------------------------------------------------- /drmkpi/include/linux/interval_tree_generic.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/ioctl.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_IOCTL_H__ 33 | #define __DRMCOMPAT_LINUX_IOCTL_H__ 34 | 35 | #include 36 | 37 | #define _IOC_SIZE(cmd) IOCPARM_LEN(cmd) 38 | #define _IOC_TYPE(cmd) IOCGROUP(cmd) 39 | #define _IOC_NR(cmd) ((cmd) & 0xff) 40 | 41 | #endif /* __DRMCOMPAT_LINUX_IOCTL_H__ */ 42 | -------------------------------------------------------------------------------- /drmkpi/include/linux/irqflags.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_IRQFLAGS_H__ 2 | #define __DRMCOMPAT_LINUX_IRQFLAGS_H__ 3 | 4 | #define local_irq_restore(flags) do { } while (0) 5 | #define local_irq_save(flags) do { (flags) = 0; } while (0) 6 | #define irqs_disabled() \ 7 | (curthread->td_critnest != 0 || curthread->td_intr_nesting_level != 0) 8 | 9 | #endif /* __DRMCOMPAT_LINUX_IRQFLAGS_H__ */ 10 | -------------------------------------------------------------------------------- /drmkpi/include/linux/irqreturn.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Limelight Networks, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_IRQRETURN_H__ 30 | #define __DRMCOMPAT_LINUX_IRQRETURN_H__ 31 | 32 | typedef enum irqreturn { 33 | IRQ_NONE = 0, 34 | IRQ_HANDLED = 1, 35 | IRQ_WAKE_THREAD = 2 36 | } irqreturn_t; 37 | 38 | #define IRQ_RETVAL(x) ((x) ? IRQ_HANDLED : IRQ_NONE) 39 | 40 | #endif /* __DRMCOMPAT_LINUX_IRQRETURN_H__ */ 41 | -------------------------------------------------------------------------------- /drmkpi/include/linux/kconfig.h: -------------------------------------------------------------------------------- 1 | /* Public Domain */ 2 | 3 | #ifndef __DRMCOMPAT_LINUX_KCONFIG_H__ 4 | #define __DRMCOMPAT_LINUX_KCONFIG_H__ 5 | 6 | /* 7 | * Checking if an option is defined would be easy if we could do CPP inside CPP. 8 | * The defined case whether -Dxxx or -Dxxx=1 are easy to deal with. In either 9 | * case the defined value is "1". A more general -Dxxx= case will require 10 | * more effort to deal with all possible "true" values. Hope we do not have 11 | * to do this as well. 12 | * The real problem is the undefined case. To avoid this problem we do the 13 | * concat/varargs trick: "yyy" ## xxx can make two arguments if xxx is "1" 14 | * by having a #define for yyy_1 which is "ignore,". 15 | * Otherwise we will just get "yyy". 16 | * Need to be careful about variable substitutions in macros though. 17 | * This way we make a (true, false) problem a (don't care, true, false) or a 18 | * (don't care true, false). Then we can use a variadic macro to only select 19 | * the always well known and defined argument #2. And that seems to be 20 | * exactly what we need. Use 1 for true and 0 for false to also allow 21 | * #if IS_*() checks pre-compiler checks which do not like #if true. 22 | */ 23 | #define ___XAB_1 dontcare, 24 | #define ___IS_XAB(_ignore, _x, ...) (_x) 25 | #define __IS_XAB(_x) ___IS_XAB(_x 1, 0) 26 | #define _IS_XAB(_x) __IS_XAB(__CONCAT(___XAB_, _x)) 27 | 28 | /* This is if CONFIG_ccc=y. */ 29 | #define IS_BUILTIN(_x) _IS_XAB(_x) 30 | /* This is if CONFIG_ccc=m. */ 31 | #define IS_MODULE(_x) _IS_XAB(_x ## _MODULE) 32 | /* This is if CONFIG_ccc is compiled in(=y) or a module(=m). */ 33 | #define IS_ENABLED(_x) (IS_BUILTIN(_x) || IS_MODULE(_x)) 34 | /* 35 | * This is weird case. If the CONFIG_ccc is builtin (=y) this returns true; 36 | * or if the CONFIG_ccc is a module (=m) and the caller is built as a module 37 | * (-DMODULE defined) this returns true, but if the callers is not a module 38 | * (-DMODULE not defined, which means caller is BUILTIN) then it returns 39 | * false. In other words, a module can reach the kernel, a module can reach 40 | * a module, but the kernel cannot reach a module, and code never compiled 41 | * cannot be reached either. 42 | * XXX -- I'd hope the module-to-module case would be handled by a proper 43 | * module dependency definition (MODULE_DEPEND() in FreeBSD). 44 | */ 45 | #define IS_REACHABLE(_x) (IS_BUILTIN(_x) || \ 46 | (IS_MODULE(_x) && IS_BUILTIN(MODULE))) 47 | 48 | #endif /* __DRMCOMPAT_LINUX_KCONFIG_H__ */ 49 | -------------------------------------------------------------------------------- /drmkpi/include/linux/kdev_t.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_KDEV_T_H__ 33 | #define __DRMCOMPAT_LINUX_KDEV_T_H__ 34 | 35 | #include 36 | 37 | #define MAJOR(dev) major(dev) 38 | #define MINOR(dev) minor(dev) 39 | #define MKDEV(ma, mi) makedev(ma, mi) 40 | 41 | static inline uint16_t 42 | old_encode_dev(dev_t dev) 43 | { 44 | return ((MAJOR(dev) << 8) | MINOR(dev)); 45 | } 46 | 47 | #endif /* __DRMCOMPAT_LINUX_KDEV_T_H__ */ 48 | -------------------------------------------------------------------------------- /drmkpi/include/linux/kfifo.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/kgdb.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_KGDB_H__ 2 | #define __DRMCOMPAT_LINUX_KGDB_H__ 3 | 4 | #define in_dbg_master() (kdb_active) 5 | 6 | #endif /* __DRMCOMPAT_LINUX_KGDB_H__ */ 7 | -------------------------------------------------------------------------------- /drmkpi/include/linux/kmod.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_KMOD_H__ 33 | #define __DRMCOMPAT_LINUX_KMOD_H__ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #define request_module(...) \ 43 | ({\ 44 | char modname[128]; \ 45 | int fileid; \ 46 | snprintf(modname, sizeof(modname), __VA_ARGS__); \ 47 | kern_kldload(curthread, modname, &fileid); \ 48 | }) 49 | 50 | #define request_module_nowait request_module 51 | 52 | #endif /* __DRMCOMPAT_LINUX_KMOD_H__ */ 53 | -------------------------------------------------------------------------------- /drmkpi/include/linux/kobject.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/list_sort.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Emmanuel Vadot 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 18 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 20 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | * SUCH DAMAGE. 24 | * 25 | * $FreeBSD$ 26 | */ 27 | 28 | #ifndef __DRMCOMPAT_LINUX_LIST_SORT_H__ 29 | #define __DRMCOMPAT_LINUX_LIST_SORT_H__ 30 | 31 | #include 32 | 33 | #define list_sort(priv, head, cmp) drmcompat_list_sort(priv, head, cmp) 34 | 35 | #endif /* __DRMCOMPAT_LINUX_LIST_SORT_H__ */ 36 | -------------------------------------------------------------------------------- /drmkpi/include/linux/llist.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef __DRMCOMPAT_LINUX_LLIST_H__ 4 | #define __DRMCOMPAT_LINUX_LLIST_H__ 5 | 6 | #include 7 | 8 | struct llist_node { 9 | struct llist_node *next; 10 | }; 11 | 12 | struct llist_head { 13 | struct llist_node *first; 14 | }; 15 | 16 | #define llist_entry(ptr, type, member) \ 17 | ((ptr) ? container_of(ptr, type, member) : NULL) 18 | 19 | static inline struct llist_node * 20 | llist_del_all(struct llist_head *head) 21 | { 22 | return (struct llist_node *)atomic_swap_ptr((uintptr_t *)&head->first, (uint64_t)NULL); 23 | } 24 | 25 | static inline struct llist_node * 26 | llist_del_first(struct llist_head *head) 27 | { 28 | struct llist_node *first, *next; 29 | 30 | do { 31 | first = head->first; 32 | if (first == NULL) 33 | return NULL; 34 | next = first->next; 35 | } while (atomic_fcmpset_ptr((uintptr_t *)&head->first, (uintptr_t *)first, (uint64_t)next) != 0); 36 | 37 | return first; 38 | } 39 | 40 | static inline bool 41 | llist_add(struct llist_node *new, struct llist_head *head) 42 | { 43 | struct llist_node *first; 44 | 45 | do { 46 | new->next = first = head->first; 47 | } while (atomic_fcmpset_ptr((uintptr_t *)&head->first, (uintptr_t *)first, (uint64_t)new) != 0); 48 | 49 | return (first == NULL); 50 | } 51 | 52 | static inline void 53 | init_llist_head(struct llist_head *head) 54 | { 55 | head->first = NULL; 56 | } 57 | 58 | static inline bool 59 | llist_empty(struct llist_head *head) 60 | { 61 | return (head->first == NULL); 62 | } 63 | 64 | #define llist_for_each_entry_safe(pos, n, node, member) \ 65 | for (pos = llist_entry((node), __typeof(*pos), member); \ 66 | pos != NULL && \ 67 | (n = llist_entry(pos->member.next, __typeof(*pos), member), pos); \ 68 | pos = n) 69 | 70 | #endif /* __DRMCOMPAT_LINUX_LLIST_H__ */ 71 | -------------------------------------------------------------------------------- /drmkpi/include/linux/lockdep.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_LOCKDEP_H__ 33 | #define __DRMCOMPAT_LINUX_LOCKDEP_H__ 34 | 35 | #include 36 | 37 | struct lock_class_key { 38 | }; 39 | 40 | #define lockdep_set_class(lock, key) 41 | #define lockdep_set_subclass(lock, sub) 42 | #define lockdep_set_class_and_name(lock, key, name) 43 | #define lockdep_set_current_reclaim_state(g) do { } while (0) 44 | #define lockdep_clear_current_reclaim_state() do { } while (0) 45 | 46 | #define lockdep_assert_held(m) \ 47 | sx_assert(&(m)->sx, SA_XLOCKED) 48 | 49 | #define lockdep_assert_held_once(m) \ 50 | sx_assert(&(m)->sx, SA_XLOCKED | SA_NOTRECURSED) 51 | 52 | #define lockdep_is_held(m) (sx_xholder(&(m)->sx) == curthread) 53 | 54 | #define might_lock(m) do { } while (0) 55 | #define might_lock_read(m) do { } while (0) 56 | 57 | #define lock_acquire(...) do { } while (0) 58 | #define lock_release(...) do { } while (0) 59 | #define lock_acquire_shared_recursive(...) do { } while (0) 60 | 61 | #define mutex_acquire(...) do { } while (0) 62 | #define mutex_release(...) do { } while (0) 63 | 64 | #endif /* __DRMCOMPAT_LINUX_LOCKDEP_H__ */ 65 | -------------------------------------------------------------------------------- /drmkpi/include/linux/media-bus-format.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef _LINUX_MEDIA_BUS_FORMAT_H 4 | #define _LINUX_MEDIA_BUS_FORMAT_H 5 | 6 | #define MEDIA_BUS_FMT_FIXED 1 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /drmkpi/include/linux/mem_encrypt.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_MEM_ENCRYPT_H__ 2 | #define __DRMCOMPAT_LINUX_MEM_ENCRYPT_H__ 3 | 4 | #define pgprot_encrypted(prot) (prot) 5 | #define pgprot_decrypted(prot) (prot) 6 | 7 | #endif /* __DRMCOMPAT_LINUX_MEM_ENCRYPT_H__ */ 8 | -------------------------------------------------------------------------------- /drmkpi/include/linux/miscdevice.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_MISCDEVICE_H__ 33 | #define __DRMCOMPAT_LINUX_MISCDEVICE_H__ 34 | 35 | #define MISC_DYNAMIC_MINOR -1 36 | 37 | #include 38 | #include 39 | 40 | #endif /* __DRMCOMPAT_LINUX_MISCDEVICE_H__ */ 41 | -------------------------------------------------------------------------------- /drmkpi/include/linux/mm_types.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_MM_TYPES_H__ 30 | #define __DRMCOMPAT_LINUX_MM_TYPES_H__ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | typedef int vm_fault_t; 39 | 40 | struct vm_area_struct; 41 | struct task_struct; 42 | 43 | struct mm_struct { 44 | struct vm_area_struct *mmap; 45 | atomic_t mm_count; 46 | atomic_t mm_users; 47 | size_t pinned_vm; 48 | }; 49 | 50 | #endif /* __DRMCOMPAT_LINUX_MM_TYPES_H__ */ 51 | -------------------------------------------------------------------------------- /drmkpi/include/linux/mman.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/mod_devicetable.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 The FreeBSD Foundation 3 | * 4 | * This software was developed by Emmanuel Vadot under sponsorship 5 | * from the FreeBSD Foundation. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | * 28 | * $FreeBSD$ 29 | */ 30 | 31 | #ifndef __DRMCOMPAT_LINUX_MOD_DEVICETABLE_H__ 32 | #define __DRMCOMPAT_LINUX_MOD_DEVICETABLE_H__ 33 | 34 | enum dmi_field { 35 | DMI_NONE, 36 | DMI_BIOS_VENDOR, 37 | DMI_BIOS_VERSION, 38 | DMI_BIOS_DATE, 39 | DMI_SYS_VENDOR, 40 | DMI_PRODUCT_NAME, 41 | DMI_PRODUCT_VERSION, 42 | DMI_PRODUCT_SERIAL, 43 | DMI_PRODUCT_UUID, 44 | DMI_BOARD_VENDOR, 45 | DMI_BOARD_NAME, 46 | DMI_BOARD_VERSION, 47 | DMI_BOARD_SERIAL, 48 | DMI_BOARD_ASSET_TAG, 49 | DMI_CHASSIS_VENDOR, 50 | DMI_CHASSIS_TYPE, 51 | DMI_CHASSIS_VERSION, 52 | DMI_CHASSIS_SERIAL, 53 | DMI_CHASSIS_ASSET_TAG, 54 | DMI_STRING_MAX, 55 | }; 56 | 57 | struct dmi_strmatch { 58 | unsigned char slot; 59 | char substr[79]; 60 | }; 61 | 62 | struct dmi_system_id { 63 | int (*callback)(const struct dmi_system_id *); 64 | const char *ident; 65 | struct dmi_strmatch matches[4]; 66 | void *driver_data; 67 | }; 68 | 69 | #define DMI_MATCH(a, b) { .slot = a, .substr = b } 70 | #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, } 71 | 72 | #endif /* __DRMCOMPAT_LINUX_MOD_DEVICETABLE_H__ */ 73 | -------------------------------------------------------------------------------- /drmkpi/include/linux/module.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_MODULE_H__ 33 | #define __DRMCOMPAT_LINUX_MODULE_H__ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #define MODULE_AUTHOR(name) 46 | #define MODULE_DESCRIPTION(name) 47 | #define MODULE_LICENSE(name) 48 | #define MODULE_INFO(tag, info) 49 | #define MODULE_FIRMWARE(firmware) 50 | 51 | #define THIS_MODULE ((struct module *)0) 52 | 53 | #define __MODULE_STRING(x) __stringify(x) 54 | 55 | #define module_init(fn) \ 56 | SYSINIT(fn, SI_SUB_DRIVERS, SI_ORDER_THIRD, (fn), NULL) 57 | 58 | #define module_exit(fn) \ 59 | SYSUNINIT(fn, SI_SUB_DRIVERS, SI_ORDER_THIRD, (fn), NULL) 60 | #define module_get(module) 61 | #define module_put(module) 62 | #define try_module_get(module) 1 63 | 64 | #endif /* __DRMCOMPAT_LINUX_MODULE_H__ */ 65 | -------------------------------------------------------------------------------- /drmkpi/include/linux/mount.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/nospec.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef __DRMCOMPAT_LINUX_NOSPEC_H__ 4 | #define __DRMCOMPAT_LINUX_NOSPEC_H__ 5 | 6 | #define array_index_nospec(a, b) (a) 7 | 8 | #endif /* __DRMCOMPAT_LINUX_NOSPEC_H__ */ 9 | -------------------------------------------------------------------------------- /drmkpi/include/linux/notifier.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_NOTIFIER_H__ 33 | #define __DRMCOMPAT_LINUX_NOTIFIER_H__ 34 | 35 | #include 36 | #include 37 | 38 | #define NOTIFY_DONE 0 39 | 40 | enum { 41 | NETDEV_CHANGE, 42 | NETDEV_UP, 43 | NETDEV_DOWN, 44 | NETDEV_REGISTER, 45 | NETDEV_UNREGISTER, 46 | NETDEV_CHANGEADDR, 47 | NETDEV_CHANGEIFADDR, 48 | LINUX_NOTIFY_TAGS /* must be last */ 49 | }; 50 | 51 | struct notifier_block { 52 | int (*notifier_call) (struct notifier_block *, unsigned long, void *); 53 | struct notifier_block *next; 54 | int priority; 55 | eventhandler_tag tags[LINUX_NOTIFY_TAGS]; 56 | }; 57 | 58 | #endif /* __DRMCOMPAT_LINUX_NOTIFIER_H__ */ 59 | -------------------------------------------------------------------------------- /drmkpi/include/linux/overflow.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 The FreeBSD Foundation 3 | * 4 | * This software was developed by Emmanuel Vadot under sponsorship 5 | * from the FreeBSD Foundation. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | * 28 | * $FreeBSD$ 29 | */ 30 | 31 | #ifndef __DRMCOMPAT_LINUX_OVERFLOW_H__ 32 | #define __DRMCOMPAT_LINUX_OVERFLOW_H__ 33 | 34 | #include 35 | #include 36 | 37 | #ifndef __has_builtin 38 | #define __has_builtin(x) 0 39 | #endif 40 | 41 | #if __has_builtin(__builtin_add_overflow) 42 | #define check_add_overflow(a, b, c) \ 43 | __builtin_add_overflow(a, b, c) 44 | #else 45 | #error "Compiler does not support __builtin_add_overflow" 46 | #endif 47 | 48 | #if __has_builtin(__builtin_mul_overflow) 49 | #define check_mul_overflow(a, b, c) \ 50 | __builtin_mul_overflow(a, b, c) 51 | 52 | static inline size_t 53 | array_size(size_t x, size_t y) 54 | { 55 | size_t retval; 56 | 57 | if (__builtin_mul_overflow(x, y, &retval)) 58 | retval = SIZE_MAX; 59 | return (retval); 60 | } 61 | #else 62 | #error "Compiler does not support __builtin_mul_overflow" 63 | #endif 64 | 65 | #endif /* __DRMCOMPAT_LINUX_OVERFLOW_H__ */ 66 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pagemap.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 The FreeBSD Foundation 3 | * 4 | * This software was developed by Emmanuel Vadot under sponsorship 5 | * from the FreeBSD Foundation. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | * 28 | * $FreeBSD$ 29 | */ 30 | 31 | #ifndef __DRMCOMPAT_LINUX_PAGEMAP_H__ 32 | #define __DRMCOMPAT_LINUX_PAGEMAP_H__ 33 | 34 | #include 35 | 36 | #define mapping_gfp_mask(x) 0 37 | 38 | static inline void 39 | release_pages(struct page **pages, int nr) 40 | { 41 | int i; 42 | 43 | for (i = 0; i < nr; i++) 44 | put_page(pages[i]); 45 | } 46 | 47 | #endif /* __DRMCOMPAT_LINUX_PAGEMAP_H__ */ 48 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pagevec.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pci.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef _LINUX_PCI_H_ 4 | #define _LINUX_PCI_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | struct pci_dev; 19 | struct pci_driver; 20 | struct pci_device_id; 21 | 22 | #endif /* _LINUX_PCI_H_ */ 23 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pfn.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_PFN_H__ 30 | #define __DRMCOMPAT_LINUX_PFN_H__ 31 | 32 | #include 33 | 34 | typedef struct { 35 | u64 val; 36 | } pfn_t; 37 | 38 | #define PFN_ALIGN(x) (((unsigned long)(x) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) 39 | #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) 40 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) 41 | #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) 42 | #define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT)) 43 | 44 | #endif /* __DRMCOMPAT_LINUX_PFN_H__ */ 45 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pfn_t.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_PFN_T_H__ 30 | #define __DRMCOMPAT_LINUX_PFN_T_H__ 31 | 32 | #include 33 | 34 | CTASSERT(PAGE_SHIFT > 4); 35 | 36 | #define PFN_FLAGS_MASK (((u64)(PAGE_SIZE - 1)) << (64 - PAGE_SHIFT)) 37 | #define PFN_SG_CHAIN (1ULL << (64 - 1)) 38 | #define PFN_SG_LAST (1ULL << (64 - 2)) 39 | #define PFN_DEV (1ULL << (64 - 3)) 40 | #define PFN_MAP (1ULL << (64 - 4)) 41 | 42 | static inline pfn_t 43 | __pfn_to_pfn_t(unsigned long pfn, u64 flags) 44 | { 45 | pfn_t pfn_t = { pfn | (flags & PFN_FLAGS_MASK) }; 46 | 47 | return (pfn_t); 48 | } 49 | 50 | static inline pfn_t 51 | pfn_to_pfn_t(unsigned long pfn) 52 | { 53 | return (__pfn_to_pfn_t (pfn, 0)); 54 | } 55 | 56 | #endif /* __DRMCOMPAT_LINUX_PFN_T_H__ */ 57 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pid.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_PID_H__ 30 | #define __DRMCOMPAT_LINUX_PID_H__ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | enum pid_type { 37 | PIDTYPE_PID, 38 | PIDTYPE_PGID, 39 | PIDTYPE_SID, 40 | PIDTYPE_MAX 41 | }; 42 | 43 | #define kuid_t uid_t 44 | 45 | #define pid_nr(n) (n) 46 | #define pid_vnr(n) (n) 47 | #define from_kuid_munged(a, uid) (uid) 48 | 49 | #define pid_task(pid, type) ({ \ 50 | struct task_struct *__ts; \ 51 | CTASSERT((type) == PIDTYPE_PID); \ 52 | __ts = linux_pid_task(pid); \ 53 | __ts; \ 54 | }) 55 | 56 | #define get_pid_task(pid, type) ({ \ 57 | struct task_struct *__ts; \ 58 | CTASSERT((type) == PIDTYPE_PID); \ 59 | __ts = drmcompat_get_pid_task(pid); \ 60 | __ts; \ 61 | }) 62 | 63 | #define get_task_pid(task, type) ({ \ 64 | CTASSERT((type) == PIDTYPE_PID); \ 65 | (task)->task_thread->td_tid; \ 66 | }) 67 | 68 | struct task_struct; 69 | extern struct task_struct *drmcompat_pid_task(pid_t); 70 | extern struct task_struct *drmcompat_get_pid_task(pid_t); 71 | 72 | #endif /* __DRMCOMPAT_LINUX_PID_H__ */ 73 | -------------------------------------------------------------------------------- /drmkpi/include/linux/platform_device.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_PLATFORM_DEVICE_H__ 2 | #define __DRMCOMPAT_LINUX_PLATFORM_DEVICE_H__ 3 | 4 | #include 5 | 6 | struct platform_device; 7 | 8 | static inline void 9 | platform_device_unregister(struct platform_device *pdev) 10 | { 11 | 12 | panic("%s: unimplemented", __func__); 13 | } 14 | 15 | static inline struct platform_device * 16 | platform_device_register_simple(const char *name, int id, 17 | void *res, unsigned int num) 18 | { 19 | 20 | panic("%s: unimplemented", __func__); 21 | } 22 | 23 | #endif /* __DRMCOMPAT_LINUX_PLATFORM_DEVICE_H__ */ 24 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pm_runtime.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/poll.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_POLL_H__ 33 | #define __DRMCOMPAT_LINUX_POLL_H__ 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | #endif /* __DRMCOMPAT_LINUX_POLL_H__ */ 42 | -------------------------------------------------------------------------------- /drmkpi/include/linux/preempt.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_PREEMPT_H__ 30 | #define __DRMCOMPAT_LINUX_PREEMPT_H__ 31 | 32 | #include 33 | #include 34 | 35 | #define in_interrupt() \ 36 | (curthread->td_intr_nesting_level || curthread->td_critnest) 37 | 38 | #define in_task() (curthread->td_priority >= PI_SOFT) 39 | 40 | #define in_atomic() ((curthread->td_pflags & TDP_NOFAULTING) != 0) 41 | 42 | #define preempt_disable() critical_enter() 43 | #define preempt_enable() critical_exit() 44 | 45 | #endif /* __DRMCOMPAT_LINUX_PREEMPT_H__ */ 46 | -------------------------------------------------------------------------------- /drmkpi/include/linux/property.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/pseudo_fs.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/ratelimit.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/resource_ext.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/rwsem.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/sched/signal.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/linux/sched/signal.h -------------------------------------------------------------------------------- /drmkpi/include/linux/shmem_fs.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/shrinker.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/sizes.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 The FreeBSD Foundation 3 | * 4 | * This software was developed by Emmanuel Vadot under sponsorship 5 | * from the FreeBSD Foundation. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | * 28 | * $FreeBSD$ 29 | */ 30 | 31 | #ifndef __DRMCOMPAT_LINUX_SIZES_H__ 32 | #define __DRMCOMPAT_LINUX_SIZES_H__ 33 | 34 | #define SZ_1K (1024 * 1) 35 | #define SZ_4K (1024 * 4) 36 | #define SZ_8K (1024 * 8) 37 | #define SZ_16K (1024 * 16) 38 | #define SZ_32K (1024 * 32) 39 | #define SZ_64K (1024 * 64) 40 | #define SZ_128K (1024 * 128) 41 | #define SZ_256K (1024 * 256) 42 | #define SZ_512K (1024 * 512) 43 | 44 | #define SZ_1M (1024 * 1024 * 1) 45 | #define SZ_2M (1024 * 1024 * 2) 46 | #define SZ_8M (1024 * 1024 * 8) 47 | #define SZ_16M (1024 * 1024 * 16) 48 | #define SZ_32M (1024 * 1024 * 32) 49 | #define SZ_64M (1024 * 1024 * 64) 50 | 51 | #endif /* __DRMCOMPAT_LINUX_SIZES_H__ */ 52 | -------------------------------------------------------------------------------- /drmkpi/include/linux/smp.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/sort.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Emmanuel Vadot 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 18 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 20 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | * SUCH DAMAGE. 24 | * 25 | * $FreeBSD$ 26 | */ 27 | 28 | #ifndef __LINUX_SORT_H__ 29 | #define __LINUX_SORT_H__ 30 | 31 | #include 32 | #include 33 | 34 | #define sort(b, n, s, cmp, swap) drmcompat_sort(b, n, s, cmp, swap) 35 | 36 | #endif /* __LINUX_SORT_H__ */ 37 | -------------------------------------------------------------------------------- /drmkpi/include/linux/srcu.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2015-2017 Mellanox Technologies, Ltd. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice unmodified, this list of conditions, and the following 10 | * disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_SRCU_H__ 30 | #define __DRMCOMPAT_LINUX_SRCU_H__ 31 | 32 | #include 33 | 34 | #define __DEFINE_SRCU(name, is_static) \ 35 | is_static struct srcu_struct name; 36 | #define DEFINE_SRCU(name) __DEFINE_SRCU(name, ) 37 | #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static) 38 | 39 | #define srcu_dereference(ptr,srcu) ((__typeof(*(ptr)) *)(ptr)) 40 | 41 | /* prototypes */ 42 | 43 | #define srcu_read_lock(s) drmcompat_srcu_read_lock(s) 44 | #define srcu_read_unlock(s, i) drmcompat_srcu_read_unlock(s, i) 45 | #define synchronize_srcu(s) drmcompat_synchronize_srcu(s) 46 | #define scru_barrier(s) drmcompat_srcu_barrier(s) 47 | #define cleanup_srcu_struct(s) drmcompat_cleanup_srcu_struct(s) 48 | #define init_srcu_struct(s) drmcompat_init_srcu_struct(s) 49 | 50 | #endif /* __DRMCOMPAT_LINUX_SRCU_H__ */ 51 | -------------------------------------------------------------------------------- /drmkpi/include/linux/stacktrace.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/stddef.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/stringify.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_STRINGIFY_H__ 2 | #define __DRMCOMPAT_LINUX_STRINGIFY_H__ 3 | 4 | #include 5 | 6 | #endif /* __DRMCOMPAT_LINUX_STRINGIFY_H__ */ 7 | -------------------------------------------------------------------------------- /drmkpi/include/linux/swap.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2018 Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in 11 | * the documentation and/or other materials provided with the 12 | * distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | * $FreeBSD$ 27 | */ 28 | 29 | #ifndef __DRMCOMPAT_LINUX_SWAP_H__ 30 | #define __DRMCOMPAT_LINUX_SWAP_H__ 31 | 32 | #include 33 | #include 34 | 35 | static inline long 36 | get_nr_swap_pages(void) 37 | { 38 | int i, j; 39 | 40 | /* NB: This could be done cheaply by obtaining swap_total directly */ 41 | swap_pager_status(&i, &j); 42 | return i - j; 43 | } 44 | 45 | static inline int 46 | current_is_kswapd(void) 47 | { 48 | 49 | return (curproc == pageproc); 50 | } 51 | 52 | #endif /* __DRMCOMPAT_LINUX_SWAP_H__ */ 53 | -------------------------------------------------------------------------------- /drmkpi/include/linux/sync_file.h: -------------------------------------------------------------------------------- 1 | #ifndef __DRMCOMPAT_LINUX_SYNC_FILE_H__ 2 | #define __DRMCOMPAT_LINUX_SYNC_FILE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | struct sync_file { 10 | char user_name[32]; 11 | // wait_queue_head_t wq; 12 | unsigned long flags; 13 | struct dma_fence *fence; 14 | struct dma_fence_cb cb; 15 | 16 | struct file *sf_file; 17 | }; 18 | 19 | #define POLL_ENABLED 0 20 | 21 | struct sync_file *sync_file_create(struct dma_fence *fence); 22 | struct dma_fence *sync_file_get_fence(int fd); 23 | char *sync_file_get_name(struct sync_file *sync_file, char *buf, int len); 24 | 25 | #endif /* __DRMCOMPAT_LINUX_SYNC_H__ */ 26 | -------------------------------------------------------------------------------- /drmkpi/include/linux/sysfs.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/sysrq.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/tracepoint.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/uaccess.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 | * Copyright (c) 2015 François Tigeot 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice unmodified, this list of conditions, and the following 14 | * disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef __DRMCOMPAT_LINUX_UACCESS_H__ 34 | #define __DRMCOMPAT_LINUX_UACCESS_H__ 35 | 36 | #include 37 | 38 | #define __get_user(_x, _p) ({ \ 39 | int __err; \ 40 | __typeof(*(_p)) __x; \ 41 | __err = drmcompat_copyin((_p), &(__x), sizeof(*(_p))); \ 42 | (_x) = __x; \ 43 | __err; \ 44 | }) 45 | 46 | #define __put_user(_x, _p) ({ \ 47 | __typeof(*(_p)) __x = (_x); \ 48 | drmcompat_copyout(&(__x), (_p), sizeof(*(_p))); \ 49 | }) 50 | 51 | #define get_user(_x, _p) drmcompat_copyin((_p), &(_x), sizeof(*(_p))) 52 | #define put_user(_x, _p) __put_user(_x, _p) 53 | #define clear_user(...) drmcompat_clear_user(__VA_ARGS__) 54 | #define access_ok(...) drmcompat_access_ok(__VA_ARGS__) 55 | 56 | #endif /* __DRMCOMPAT_LINUX_UACCESS_H__ */ 57 | -------------------------------------------------------------------------------- /drmkpi/include/linux/uio.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/vga_switcheroo.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /drmkpi/include/linux/vgaarb.h: -------------------------------------------------------------------------------- 1 | /* Public domain. */ 2 | 3 | #ifndef _LINUX_VGAARB_H 4 | #define _LINUX_VGAARB_H 5 | 6 | #include 7 | 8 | #define VGA_RSRC_LEGACY_IO 0x01 9 | 10 | struct pci_dev; 11 | 12 | void vga_get_uninterruptible(struct pci_dev *, int); 13 | void vga_put(struct pci_dev *, int); 14 | 15 | static inline int 16 | vga_client_register(struct pci_dev *a, void *b, void *c, void *d) 17 | { 18 | return -ENODEV; 19 | } 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /drmkpi/include/linux/vmalloc.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2010 Isilon Systems, Inc. 3 | * Copyright (c) 2010 iX Systems, Inc. 4 | * Copyright (c) 2010 Panasas, Inc. 5 | * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. 6 | * All rights reserved. 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 unmodified, this list of conditions, and the following 13 | * disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * $FreeBSD$ 30 | */ 31 | 32 | #ifndef __DRMCOMPAT_LINUX_VMALLOC_H__ 33 | #define __DRMCOMPAT_LINUX_VMALLOC_H__ 34 | 35 | #include 36 | #include 37 | 38 | #define VM_MAP 0x0000 39 | #define PAGE_KERNEL 0x0000 40 | 41 | void *vmap(struct page **pages, unsigned int count, unsigned long flags, 42 | int prot); 43 | void vunmap(void *addr); 44 | 45 | #endif /* __DRMCOMPAT_LINUX_LINUX_VMALLOC_H__ */ 46 | -------------------------------------------------------------------------------- /drmkpi/include/stdarg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/stdarg.h -------------------------------------------------------------------------------- /drmkpi/include/uapi/linux/dma-buf.h: -------------------------------------------------------------------------------- 1 | #ifndef _DMA_BUF_UAPI_H_ 2 | #define _DMA_BUF_UAPI_H_ 3 | 4 | #include 5 | 6 | struct dma_buf_sync { 7 | __u64 flags; 8 | }; 9 | 10 | #define DMA_BUF_SYNC_READ (1 << 0) 11 | #define DMA_BUF_SYNC_WRITE (2 << 0) 12 | #define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE) 13 | #define DMA_BUF_SYNC_START (0 << 2) 14 | #define DMA_BUF_SYNC_END (1 << 2) 15 | #define DMA_BUF_SYNC_VALID_FLAGS_MASK \ 16 | (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END) 17 | 18 | #define DMA_BUF_BASE 'b' 19 | #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /drmkpi/include/video/of_videomode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/video/of_videomode.h -------------------------------------------------------------------------------- /drmkpi/include/video/vga.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/video/vga.h -------------------------------------------------------------------------------- /drmkpi/include/video/videomode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evadot/drm-subtree/793d5cc585a4039aaf065d077667a42654af309f/drmkpi/include/video/videomode.h -------------------------------------------------------------------------------- /drmkpi/include/xen/xen.h: -------------------------------------------------------------------------------- 1 | /* Dummy file */ 2 | -------------------------------------------------------------------------------- /extra_patches/0002-Add-GENERIC-DRM-for-armv7.patch: -------------------------------------------------------------------------------- 1 | From dd658f2aacc7b4bf7673b0945ccdc7ccbc5df20a Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Sat, 10 Apr 2021 21:56:31 +0200 4 | Subject: [PATCH 2/4] Add GENERIC-DRM for armv7 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/arm/conf/GENERIC-DRM | 21 +++++++++++++++++++++ 9 | 1 file changed, 21 insertions(+) 10 | create mode 100644 sys/arm/conf/GENERIC-DRM 11 | 12 | diff --git a/sys/arm/conf/GENERIC-DRM b/sys/arm/conf/GENERIC-DRM 13 | new file mode 100644 14 | index 000000000000..df1fe081f26b 15 | --- /dev/null 16 | +++ b/sys/arm/conf/GENERIC-DRM 17 | @@ -0,0 +1,21 @@ 18 | +# 19 | +# GENERIC-DRM 20 | +# 21 | +# Custom kernel for armv7 plus DRM 22 | +# 23 | +# $FreeBSD$ 24 | + 25 | +#NO_UNIVERSE 26 | + 27 | +include GENERIC 28 | +ident GENERIC-DRM 29 | + 30 | +# DRM Support 31 | +options COMPAT_DRMKPI 32 | +options COMPAT_LINUXKPI 33 | + 34 | +device drm 35 | +device aw_de2_drm 36 | +device dw_hdmi 37 | +files "../../dev/drm/extra_patches/files" 38 | +files "../../dev/drm/extra_patches/files.aw" 39 | -- 40 | 2.35.1 41 | 42 | -------------------------------------------------------------------------------- /extra_patches/0003-drm-Add-rockchip-and-bridges-into-GENERIC-DRM.patch: -------------------------------------------------------------------------------- 1 | From 64dd90a479dd4e965620494efefbc5ef6a25be04 Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 26 May 2021 19:07:35 +0200 4 | Subject: [PATCH 3/4] drm: Add rockchip and bridges into GENERIC-DRM 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/arm64/conf/GENERIC-DRM | 4 ++++ 9 | 1 file changed, 4 insertions(+) 10 | 11 | diff --git a/sys/arm64/conf/GENERIC-DRM b/sys/arm64/conf/GENERIC-DRM 12 | index db1fffb1729e..1b7f9b0a5d7b 100644 13 | --- a/sys/arm64/conf/GENERIC-DRM 14 | +++ b/sys/arm64/conf/GENERIC-DRM 15 | @@ -16,6 +16,10 @@ options COMPAT_LINUXKPI 16 | 17 | device drm 18 | device aw_de2_drm 19 | +device rk_drm 20 | device dw_hdmi 21 | + 22 | files "../../dev/drm/extra_patches/files" 23 | files "../../dev/drm/extra_patches/files.aw" 24 | +files "../../dev/drm/extra_patches/files.bridges" 25 | +files "../../dev/drm/extra_patches/files.rk" 26 | -- 27 | 2.35.1 28 | 29 | -------------------------------------------------------------------------------- /extra_patches/0004-arm-drm-Add-bridges-to-GENERIC-DRM.patch: -------------------------------------------------------------------------------- 1 | From ffafe87253f6d262cd477fc45f1cad91b76f6109 Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 2 Jun 2021 10:12:57 +0200 4 | Subject: [PATCH 4/4] arm: drm: Add bridges to GENERIC-DRM 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/arm/conf/GENERIC-DRM | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/sys/arm/conf/GENERIC-DRM b/sys/arm/conf/GENERIC-DRM 12 | index df1fe081f26b..658d5180facb 100644 13 | --- a/sys/arm/conf/GENERIC-DRM 14 | +++ b/sys/arm/conf/GENERIC-DRM 15 | @@ -19,3 +19,4 @@ device aw_de2_drm 16 | device dw_hdmi 17 | files "../../dev/drm/extra_patches/files" 18 | files "../../dev/drm/extra_patches/files.aw" 19 | +files "../../dev/drm/extra_patches/files.bridges" 20 | -- 21 | 2.35.1 22 | 23 | -------------------------------------------------------------------------------- /extra_patches/0005-We-are-at-drm-5.7-minor-some-fbdev-related-commits.patch: -------------------------------------------------------------------------------- 1 | From 648b167222676a14154ca76c70e82bfac1b1f358 Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 23 Feb 2022 14:59:28 +0100 4 | Subject: [PATCH] We are at drm 5.7 (minor some fbdev related commits 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/conf/kern.pre.mk | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk 12 | index d7b041148e0e..d52f1d4da077 100644 13 | --- a/sys/conf/kern.pre.mk 14 | +++ b/sys/conf/kern.pre.mk 15 | @@ -316,7 +316,7 @@ DRM_INCLUDES+= -I${S}/dev/drm/drmkpi/include/ 16 | 17 | DRM_CFLAGS= ${CFLAGS} ${DRM_INCLUDES} 18 | DRM_CFLAGS+= -include ${S}/dev/drm/drmkpi/include/drm/drm_os_freebsd.h 19 | -DRM_CFLAGS+= '-DKBUILD_MODNAME="DRMv5.6"' 20 | +DRM_CFLAGS+= '-DKBUILD_MODNAME="DRMv5.7"' 21 | DRM_CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -Wno-missing-prototypes 22 | # Complain about unsigned long long versus uint64_t, remove -Wformat for now 23 | .if ${MACHINE_CPUARCH} == "aarch64" 24 | -- 25 | 2.35.1 26 | 27 | -------------------------------------------------------------------------------- /extra_patches/0006-We-are-at-drm-5.8-minor-some-fbdev-related-commits.patch: -------------------------------------------------------------------------------- 1 | From c86f54ddb3870dfa12db80c14c189981e2375d29 Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 23 Feb 2022 16:07:02 +0100 4 | Subject: [PATCH] We are at drm 5.8 (minor some fbdev related commits 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/conf/kern.pre.mk | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk 12 | index d52f1d4da077..af6bd4293212 100644 13 | --- a/sys/conf/kern.pre.mk 14 | +++ b/sys/conf/kern.pre.mk 15 | @@ -316,7 +316,7 @@ DRM_INCLUDES+= -I${S}/dev/drm/drmkpi/include/ 16 | 17 | DRM_CFLAGS= ${CFLAGS} ${DRM_INCLUDES} 18 | DRM_CFLAGS+= -include ${S}/dev/drm/drmkpi/include/drm/drm_os_freebsd.h 19 | -DRM_CFLAGS+= '-DKBUILD_MODNAME="DRMv5.7"' 20 | +DRM_CFLAGS+= '-DKBUILD_MODNAME="DRMv5.8"' 21 | DRM_CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -Wno-missing-prototypes 22 | # Complain about unsigned long long versus uint64_t, remove -Wformat for now 23 | .if ${MACHINE_CPUARCH} == "aarch64" 24 | -- 25 | 2.35.1 26 | 27 | -------------------------------------------------------------------------------- /extra_patches/0007-Add-a-new-DRMCOMPAT-option-to-replace-DRMKPI.patch: -------------------------------------------------------------------------------- 1 | From 9c70f85d857adb3ce5bfffc1c3b0752102e3d09f Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 2 Mar 2022 10:15:58 +0100 4 | Subject: [PATCH] Add a new DRMCOMPAT option, to replace DRMKPI 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/conf/options | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/sys/conf/options b/sys/conf/options 12 | index aea8083927cc..8e91d4166f0f 100644 13 | --- a/sys/conf/options 14 | +++ b/sys/conf/options 15 | @@ -102,6 +102,7 @@ COMPAT_FREEBSD13 opt_global.h 16 | COMPAT_LINUXKPI opt_dontuse.h 17 | _COMPAT_LINUX32 opt_compat.h # XXX: make sure opt_compat.h exists 18 | COMPAT_DRMKPI opt_global.h 19 | +COMPAT_DRMCOMPAT opt_global.h 20 | COMPILING_LINT opt_global.h 21 | CY_PCI_FASTINTR 22 | DEADLKRES opt_watchdog.h 23 | -- 24 | 2.35.1 25 | 26 | -------------------------------------------------------------------------------- /extra_patches/0008-arm-arm64-Use-DRMCOMPAT-option-too.patch: -------------------------------------------------------------------------------- 1 | From 8311db9d61b4f2688c0903bfe549a0799f7e7b39 Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 2 Mar 2022 10:17:27 +0100 4 | Subject: [PATCH] arm: arm64: Use DRMCOMPAT option too 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/arm/conf/GENERIC-DRM | 1 + 9 | sys/arm64/conf/GENERIC-DRM | 1 + 10 | 2 files changed, 2 insertions(+) 11 | 12 | diff --git a/sys/arm/conf/GENERIC-DRM b/sys/arm/conf/GENERIC-DRM 13 | index 658d5180facb..97720c7ff5ac 100644 14 | --- a/sys/arm/conf/GENERIC-DRM 15 | +++ b/sys/arm/conf/GENERIC-DRM 16 | @@ -12,6 +12,7 @@ ident GENERIC-DRM 17 | 18 | # DRM Support 19 | options COMPAT_DRMKPI 20 | +options COMPAT_DRMCOMPAT 21 | options COMPAT_LINUXKPI 22 | 23 | device drm 24 | diff --git a/sys/arm64/conf/GENERIC-DRM b/sys/arm64/conf/GENERIC-DRM 25 | index 1b7f9b0a5d7b..387cd2da1df8 100644 26 | --- a/sys/arm64/conf/GENERIC-DRM 27 | +++ b/sys/arm64/conf/GENERIC-DRM 28 | @@ -12,6 +12,7 @@ ident GENERIC-DRM 29 | 30 | # DRM Support 31 | options COMPAT_DRMKPI 32 | +options COMPAT_DRMCOMPAT 33 | options COMPAT_LINUXKPI 34 | 35 | device drm 36 | -- 37 | 2.35.1 38 | 39 | -------------------------------------------------------------------------------- /extra_patches/0009-Remove-reference-to-drmkpi.patch: -------------------------------------------------------------------------------- 1 | From 552935f34f6e351345858c242970a7f6c2c335bb Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 2 Mar 2022 10:29:55 +0100 4 | Subject: [PATCH] Remove reference to drmkpi 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/arm/conf/GENERIC-DRM | 1 - 9 | sys/arm64/conf/GENERIC-DRM | 1 - 10 | sys/conf/options | 1 - 11 | 3 files changed, 3 deletions(-) 12 | 13 | diff --git a/sys/arm/conf/GENERIC-DRM b/sys/arm/conf/GENERIC-DRM 14 | index 97720c7ff5ac..1f86f3630a6f 100644 15 | --- a/sys/arm/conf/GENERIC-DRM 16 | +++ b/sys/arm/conf/GENERIC-DRM 17 | @@ -11,7 +11,6 @@ include GENERIC 18 | ident GENERIC-DRM 19 | 20 | # DRM Support 21 | -options COMPAT_DRMKPI 22 | options COMPAT_DRMCOMPAT 23 | options COMPAT_LINUXKPI 24 | 25 | diff --git a/sys/arm64/conf/GENERIC-DRM b/sys/arm64/conf/GENERIC-DRM 26 | index 387cd2da1df8..7243a4f35b94 100644 27 | --- a/sys/arm64/conf/GENERIC-DRM 28 | +++ b/sys/arm64/conf/GENERIC-DRM 29 | @@ -11,7 +11,6 @@ include GENERIC 30 | ident GENERIC-DRM 31 | 32 | # DRM Support 33 | -options COMPAT_DRMKPI 34 | options COMPAT_DRMCOMPAT 35 | options COMPAT_LINUXKPI 36 | 37 | diff --git a/sys/conf/options b/sys/conf/options 38 | index 8e91d4166f0f..a95869336548 100644 39 | --- a/sys/conf/options 40 | +++ b/sys/conf/options 41 | @@ -101,7 +101,6 @@ COMPAT_FREEBSD12 opt_global.h 42 | COMPAT_FREEBSD13 opt_global.h 43 | COMPAT_LINUXKPI opt_dontuse.h 44 | _COMPAT_LINUX32 opt_compat.h # XXX: make sure opt_compat.h exists 45 | -COMPAT_DRMKPI opt_global.h 46 | COMPAT_DRMCOMPAT opt_global.h 47 | COMPILING_LINT opt_global.h 48 | CY_PCI_FASTINTR 49 | -- 50 | 2.35.1 51 | 52 | -------------------------------------------------------------------------------- /extra_patches/0010-Add-panfrost-to-GENERIC-DRM.patch: -------------------------------------------------------------------------------- 1 | From e9f7744f11573cb1c87d35ccac88d2c53c8a3b6e Mon Sep 17 00:00:00 2001 2 | From: Emmanuel Vadot 3 | Date: Wed, 2 Mar 2022 15:52:53 +0100 4 | Subject: [PATCH] Add panfrost to GENERIC-DRM 5 | Content-Type: text/plain; charset=UTF-8 6 | 7 | --- 8 | sys/arm64/conf/GENERIC-DRM | 2 ++ 9 | sys/conf/files.arm64 | 2 +- 10 | 2 files changed, 3 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/sys/arm64/conf/GENERIC-DRM b/sys/arm64/conf/GENERIC-DRM 13 | index 7243a4f35b94..2ca1b117bd50 100644 14 | --- a/sys/arm64/conf/GENERIC-DRM 15 | +++ b/sys/arm64/conf/GENERIC-DRM 16 | @@ -18,8 +18,10 @@ device drm 17 | device aw_de2_drm 18 | device rk_drm 19 | device dw_hdmi 20 | +device panfrost 21 | 22 | files "../../dev/drm/extra_patches/files" 23 | +files "../../dev/drm/extra_patches/files.arm64" 24 | files "../../dev/drm/extra_patches/files.aw" 25 | files "../../dev/drm/extra_patches/files.bridges" 26 | files "../../dev/drm/extra_patches/files.rk" 27 | diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 28 | index ab7b5eb3a2d6..6d3baa41b6dd 100644 29 | --- a/sys/conf/files.arm64 30 | +++ b/sys/conf/files.arm64 31 | @@ -104,7 +104,7 @@ arm64/coresight/coresight_tmc_fdt.c optional fdt 32 | 33 | arm64/iommu/iommu.c optional iommu 34 | arm64/iommu/iommu_if.m optional iommu 35 | -arm64/iommu/iommu_pmap.c optional iommu 36 | +arm64/iommu/iommu_pmap.c optional iommu | panfrost 37 | arm64/iommu/smmu.c optional iommu 38 | arm64/iommu/smmu_acpi.c optional acpi iommu 39 | arm64/iommu/smmu_quirks.c optional iommu 40 | -- 41 | 2.35.1 42 | 43 | -------------------------------------------------------------------------------- /extra_patches/files.arm64: -------------------------------------------------------------------------------- 1 | dev/drm/panfrost/panfrost_drv.c optional drm fdt panfrost compile-with "${DRM_C}" 2 | dev/drm/panfrost/panfrost_device.c optional drm fdt panfrost compile-with "${DRM_C}" 3 | dev/drm/panfrost/panfrost_gem.c optional drm fdt panfrost compile-with "${DRM_C}" 4 | dev/drm/panfrost/panfrost_mmu.c optional drm fdt panfrost compile-with "${DRM_C}" 5 | dev/drm/panfrost/panfrost_job.c optional drm fdt panfrost compile-with "${DRM_C}" 6 | -------------------------------------------------------------------------------- /extra_patches/files.aw: -------------------------------------------------------------------------------- 1 | # Allwinner Video Controller 2 | dev/drm/allwinner/aw_de2.c optional drm fdt aw_de2_drm 3 | dev/drm/allwinner/aw_de2_drm.c optional drm fdt aw_de2_drm compile-with "${DRM_C}" 4 | dev/drm/allwinner/aw_de2_ui_plane.c optional drm fdt aw_de2_drm compile-with "${DRM_C}" 5 | dev/drm/allwinner/aw_de2_vi_plane.c optional drm fdt aw_de2_drm compile-with "${DRM_C}" 6 | dev/drm/allwinner/aw_de2_mixer.c optional drm fdt aw_de2_drm compile-with "${DRM_C}" 7 | dev/drm/allwinner/aw_de2_tcon.c optional drm fdt aw_de2_drm compile-with "${DRM_C}" 8 | dev/drm/allwinner/aw_de2_hdmi_phy.c optional drm fdt aw_de2_drm compile-with "${DRM_C}" 9 | dev/drm/allwinner/aw_de2_mixer_if.m optional drm fdt aw_de2_drm 10 | dev/drm/allwinner/aw_de2_tcon_if.m optional drm fdt aw_de2_drm 11 | -------------------------------------------------------------------------------- /extra_patches/files.bridges: -------------------------------------------------------------------------------- 1 | # Synopsis DesignWare HDMI Controller 2 | dev/drm/bridges/dw_hdmi/aw_de2_dw_hdmi.c optional drm fdt dw_hdmi aw_de2_drm compile-with "${DRM_C}" 3 | dev/drm/bridges/dw_hdmi/rk_dw_hdmi.c optional drm fdt dw_hdmi rk_drm compile-with "${DRM_C}" 4 | dev/drm/bridges/dw_hdmi/dw_hdmi.c optional drm fdt dw_hdmi compile-with "${DRM_C}" 5 | dev/drm/bridges/dw_hdmi/dw_hdmi_if.m optional drm fdt dw_hdmi 6 | dev/drm/bridges/dw_hdmi/dw_hdmi_phy_if.m optional drm fdt dw_hdmi 7 | 8 | # ANX6345 RGB to eDP bridge 9 | dev/drm/bridges/anx6345/anx6345.c optional fdt anx6345 compile-with "${DRM_C}" 10 | -------------------------------------------------------------------------------- /extra_patches/files.komeda: -------------------------------------------------------------------------------- 1 | # ARM Komeda Display Subsystem 2 | dev/drm/komeda/komeda_drv.c optional drm fdt komeda_drm compile-with "${DRM_C}" 3 | dev/drm/komeda/komeda_gem.c optional drm fdt komeda_drm compile-with "${DRM_C}" 4 | dev/drm/komeda/komeda_pipeline.c optional drm fdt komeda_drm compile-with "${DRM_C}" 5 | dev/drm/komeda/komeda_plane.c optional drm fdt komeda_drm compile-with "${DRM_C}" 6 | -------------------------------------------------------------------------------- /extra_patches/files.nvidia: -------------------------------------------------------------------------------- 1 | dev/drm/nvidia/tegra_drm_if.m optional drm 2 | dev/drm/nvidia/tegra_drm_subr.c optional drm compile-with "${DRM_C}" 3 | dev/drm/nvidia/tegra_host1x.c optional drm compile-with "${DRM_C}" 4 | dev/drm/nvidia/tegra_hdmi.c optional drm compile-with "${DRM_C}" 5 | dev/drm/nvidia/tegra_dc_if.m optional drm 6 | dev/drm/nvidia/tegra_dc.c optional drm compile-with "${DRM_C}" 7 | dev/drm/nvidia/tegra_fb.c optional drm compile-with "${DRM_C}" 8 | dev/drm/nvidia/tegra_bo.c optional drm compile-with "${DRM_C}" 9 | -------------------------------------------------------------------------------- /extra_patches/files.rk: -------------------------------------------------------------------------------- 1 | # Rockchip Display Subsystem 2 | dev/drm/rockchip/rk_drm.c optional drm fdt rk_drm compile-with "${DRM_C}" 3 | dev/drm/rockchip/rk_gem.c optional drm fdt rk_drm compile-with "${DRM_C}" 4 | dev/drm/rockchip/rk_plane.c optional drm fdt rk_drm compile-with "${DRM_C}" 5 | dev/drm/rockchip/rk_vop.c optional drm fdt rk_drm compile-with "${DRM_C}" 6 | dev/drm/rockchip/rk_vop_if.m optional drm fdt rk_drm 7 | -------------------------------------------------------------------------------- /freebsd/drm_fb_cma_helper.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Michal Meloun 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | #include 28 | __FBSDID("$FreeBSD$"); 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | static int drm_format_num_planes(uint32_t format) 49 | { 50 | const struct drm_format_info *info; 51 | 52 | info = drm_format_info(format); 53 | return info ? info->num_planes : 1; 54 | } 55 | 56 | /* 57 | * Exported functions 58 | */ 59 | 60 | struct drm_gem_cma_object * 61 | drm_fb_cma_get_gem_obj(struct drm_fb_cma *fb, int idx) 62 | { 63 | 64 | if (idx >= drm_format_num_planes(fb->drm_fb.format->format)) 65 | return (NULL); 66 | if (idx > 4) 67 | return (NULL); 68 | return (fb->planes[idx]); 69 | } 70 | -------------------------------------------------------------------------------- /freebsd/drm_sysfs.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2019 Michal Meloun 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | * SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | __FBSDID("$FreeBSD$"); 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | struct cdev * 34 | drm_sysfs_minor_alloc(struct drm_minor *minor) 35 | { 36 | return (void *)0xDEADBEAF; 37 | } 38 | 39 | int 40 | drm_sysfs_connector_add(struct drm_connector *connector __unused) 41 | { 42 | return 0; 43 | } 44 | 45 | void 46 | drm_sysfs_connector_remove(struct drm_connector *connector __unused) 47 | { 48 | } 49 | 50 | void 51 | drm_sysfs_hotplug_event(struct drm_device *dev __unused) 52 | { 53 | } 54 | -------------------------------------------------------------------------------- /komeda/komeda_gem.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2022 Ruslan Bukin 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef _DRM_KOMEDA_KOMEDA_GEM_H_ 34 | #define _DRM_KOMEDA_KOMEDA_GEM_H_ 35 | 36 | struct sg_table * komeda_gem_prime_get_sg_table(struct drm_gem_object *obj); 37 | struct drm_gem_object * 38 | komeda_gem_prime_import_sg_table(struct drm_device *dev, 39 | struct dma_buf_attachment *attach, struct sg_table *sg); 40 | int komeda_gem_mmap_buf(struct drm_gem_object *obj, 41 | struct vm_area_struct *vma); 42 | 43 | #endif /* !_DRM_KOMEDA_KOMEDA_GEM_H_ */ 44 | -------------------------------------------------------------------------------- /komeda/komeda_pipeline.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2022 Ruslan Bukin 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef _DEV_DRM_KOMEDA_KOMEDA_PIPELINE_H_ 34 | #define _DEV_DRM_KOMEDA_KOMEDA_PIPELINE_H_ 35 | 36 | struct komeda_drm_softc; 37 | 38 | struct komeda_pipeline { 39 | struct komeda_drm_softc *sc; 40 | struct komeda_plane planes[2]; 41 | struct drm_pending_vblank_event *event; 42 | struct drm_device *drm; 43 | struct drm_crtc crtc; 44 | struct drm_encoder encoder; 45 | uint32_t vbl_counter; 46 | phandle_t node; 47 | }; 48 | 49 | int 50 | komeda_pipeline_create_pipeline(struct komeda_drm_softc *sc, phandle_t node, 51 | struct komeda_pipeline *pipeline); 52 | 53 | #endif /* !_DEV_DRM_KOMEDA_KOMEDA_PIPELINE_H_ */ 54 | -------------------------------------------------------------------------------- /komeda/komeda_plane.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2022 Ruslan Bukin 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef _DEV_DRM_KOMEDA_KOMEDA_PLANE_H_ 34 | #define _DEV_DRM_KOMEDA_KOMEDA_PLANE_H_ 35 | 36 | struct komeda_drm_softc; 37 | struct komeda_pipeline; 38 | 39 | struct komeda_plane { 40 | struct drm_plane plane; 41 | struct komeda_drm_softc *sc; 42 | int id; 43 | }; 44 | 45 | int komeda_plane_create(struct komeda_pipeline *pipeline, 46 | struct drm_device *drm); 47 | 48 | void gcu_intr(struct komeda_drm_softc *sc); 49 | void dou_intr(struct komeda_drm_softc *sc); 50 | void lpu_intr(struct komeda_drm_softc *sc); 51 | void cu_intr(struct komeda_drm_softc *sc); 52 | void dou_configure(struct komeda_drm_softc *sc, struct drm_display_mode *m); 53 | void dou_ds_timing_setup(struct komeda_drm_softc *sc, struct drm_display_mode *m); 54 | 55 | void cu_configure(struct komeda_drm_softc *sc, struct drm_display_mode *m, 56 | struct drm_plane_state *state, int id); 57 | 58 | #endif /* !_DEV_DRM_KOMEDA_KOMEDA_PLANE_H_ */ 59 | -------------------------------------------------------------------------------- /nvidia/tegra_dc_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2015 Michal Meloun 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | # SUCH DAMAGE. 25 | # 26 | # $FreeBSD$ 27 | # 28 | 29 | #include 30 | 31 | INTERFACE tegra_dc; 32 | 33 | 34 | METHOD void write_4{ 35 | device_t dev; 36 | bus_size_t offset; 37 | uint32_t val; 38 | }; 39 | METHOD uint32_t read_4{ 40 | device_t dev; 41 | bus_size_t offset; 42 | }; 43 | 44 | METHOD void display_enable{ 45 | device_t dev; 46 | bool enable; 47 | }; 48 | 49 | METHOD void hdmi_enable{ 50 | device_t dev; 51 | bool enable; 52 | }; 53 | 54 | METHOD void setup_timing{ 55 | device_t dev; 56 | int h_pulse_start; 57 | }; 58 | -------------------------------------------------------------------------------- /nvidia/tegra_drm_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2015 Michal Meloun 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | # SUCH DAMAGE. 25 | # 26 | # $FreeBSD$ 27 | # 28 | 29 | 30 | INTERFACE tegra_drm; 31 | HEADER { 32 | struct tegra_drm; 33 | }; 34 | 35 | 36 | /** 37 | * Register client to host1x 38 | */ 39 | METHOD int register_client{ 40 | device_t host1x; 41 | device_t client; 42 | }; 43 | 44 | /** 45 | * Deregister client to host1x 46 | */ 47 | METHOD int deregister_client{ 48 | device_t host1x; 49 | device_t client; 50 | }; 51 | 52 | /** 53 | * Call client init method 54 | */ 55 | METHOD int init_client{ 56 | device_t client; 57 | device_t host1x; 58 | struct tegra_drm *drm; 59 | }; 60 | 61 | /** 62 | * Call client exit method 63 | */ 64 | METHOD int exit_client{ 65 | device_t client; 66 | device_t host1x; 67 | struct tegra_drm *drm; 68 | }; 69 | -------------------------------------------------------------------------------- /panfrost/panfrost_device.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2020-2021 Ruslan Bukin 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef _DEV_DRM_PANFROST_PANFROST_DEVICE_H_ 34 | #define _DEV_DRM_PANFROST_PANFROST_DEVICE_H_ 35 | 36 | #define NUM_JOB_SLOTS 3 37 | 38 | struct panfrost_mmu { 39 | struct pmap p; 40 | int as; /* asid set */ 41 | int as_count; /* usage count */ 42 | TAILQ_ENTRY(panfrost_mmu) next; /* entry in mmu_in_use list */ 43 | }; 44 | 45 | struct panfrost_file { 46 | struct panfrost_softc *sc; 47 | struct panfrost_mmu mmu; 48 | struct drm_sched_entity sched_entity[NUM_JOB_SLOTS]; 49 | struct drm_mm mm; 50 | struct mtx mm_lock; 51 | }; 52 | 53 | int panfrost_device_init(struct panfrost_softc *); 54 | int panfrost_device_reset(struct panfrost_softc *sc); 55 | uint32_t panfrost_device_get_latest_flush_id(struct panfrost_softc *sc); 56 | int panfrost_device_power_on(struct panfrost_softc *sc); 57 | 58 | #endif /* !_DEV_DRM_PANFROST_PANFROST_DEVICE_H_ */ 59 | -------------------------------------------------------------------------------- /panfrost/panfrost_mmu.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2020-2021 Ruslan Bukin 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef _DEV_DRM_PANFROST_PANFROST_MMU_H_ 34 | #define _DEV_DRM_PANFROST_PANFROST_MMU_H_ 35 | 36 | int panfrost_mmu_pgtable_alloc(struct panfrost_file *pfile); 37 | int panfrost_mmu_map(struct panfrost_softc *sc, 38 | struct panfrost_gem_mapping *mapping); 39 | int panfrost_mmu_enable(struct panfrost_softc *sc, struct panfrost_mmu *mmu); 40 | void panfrost_mmu_as_put(struct panfrost_softc *sc, struct panfrost_mmu *mmu); 41 | uint32_t panfrost_mmu_as_get(struct panfrost_softc *sc, 42 | struct panfrost_mmu *mmu); 43 | void panfrost_mmu_intr(void *arg); 44 | int panfrost_mmu_init(struct panfrost_softc *sc); 45 | void panfrost_mmu_pgtable_free(struct panfrost_file *pfile); 46 | void panfrost_mmu_unmap(struct panfrost_softc *sc, 47 | struct panfrost_gem_mapping *mapping); 48 | void panfrost_mmu_reset(struct panfrost_softc *sc); 49 | 50 | #endif /* !_DEV_DRM_PANFROST_PANFROST_MMU_H_ */ 51 | -------------------------------------------------------------------------------- /rockchip/rk_gem.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Ruslan Bukin 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef _DRM_ROCKCHIP_RK3399_GEM_H_ 34 | #define _DRM_ROCKCHIP_RK3399_GEM_H_ 35 | 36 | struct sg_table * rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj); 37 | struct drm_gem_object * 38 | rockchip_gem_prime_import_sg_table(struct drm_device *dev, 39 | struct dma_buf_attachment *attach, struct sg_table *sg); 40 | int rockchip_gem_mmap_buf(struct drm_gem_object *obj, 41 | struct vm_area_struct *vma); 42 | 43 | #endif /* !_DRM_ROCKCHIP_RK3399_GEM_H_ */ 44 | -------------------------------------------------------------------------------- /rockchip/rk_plane.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Ruslan Bukin 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * $FreeBSD$ 31 | */ 32 | 33 | #ifndef _DEV_DRM_ROCKCHIP_RK_PLANE_H_ 34 | #define _DEV_DRM_ROCKCHIP_RK_PLANE_H_ 35 | 36 | struct rk_vop_softc; 37 | 38 | struct rk_vop_plane { 39 | struct drm_plane plane; 40 | struct rk_vop_softc *sc; 41 | int id; 42 | }; 43 | 44 | int rk_plane_create(struct rk_vop_softc *sc, struct drm_device *drm); 45 | 46 | #endif /* !_DEV_DRM_ROCKCHIP_RK_PLANE_H_ */ 47 | -------------------------------------------------------------------------------- /rockchip/rk_vop_if.m: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2019 Emmanuel Vadot 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | # SUCH DAMAGE. 24 | # 25 | # $FreeBSD$ 26 | # 27 | 28 | INTERFACE rk_vop; 29 | 30 | HEADER { 31 | struct drm_device; 32 | struct drm_plane; 33 | } 34 | 35 | # 36 | # Create and register the pipeline in the drm subsystem 37 | # 38 | METHOD int create_pipeline { 39 | device_t dev; 40 | struct drm_device *drm_dev; 41 | }; 42 | --------------------------------------------------------------------------------