aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include
Commit message (Collapse)AuthorAgeFilesLines
* LinuxKPI: 802.11: add cfg80211 (*change_bss) and related structsBjoern A. Zeeb6 days1-1/+11
| | | | | | | Needed by brcmfmac v6.19. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* brcm80211: add LinuxKPI files and module MakefilesBjoern A. Zeeb6 days5-0/+277
| | | | | | | | | | | | | | sys/compat/linuxkpi/common/include/linux/platform_data/brcmfmac.h is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e5f0a698b34ed76002dc5cff3804a61c80233a7a ( tag: v6.17 ). Currently only PCIe is made to compile. It does load firmware (if needed, e.g., on arm64 with an alignment issue fixed), and starts to come up. To make it work there is a cfg80211 layer and netdevice integration to do, so do not hold your breath just yet.
* LinuxKPI: add scoped_guard(), spinlock guard supportBjoern A. Zeeb7 days2-28/+109
| | | | | | | | | | | | | | | | | | | The "cleanup.h" implementation got a bit more complicated. For one we now use a macro to concatenate a prefix, the name, and a suffix for variable and function declarations. This was triggered by the fact that the "guard_" prefix we used was confusing. We now use a generic "cleanup_" which is only encoded in the single place rather than all over the file. As already indicated by the comment the DEFINE_LOCK_GUARD_0() macro got split up and a _1 version which also takes a type got implemented and is used for a spinlock variant used by rtw89(4) via the new scoped_guard() bits. Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D54808
* LinuxKPI: mod_devicetable, add comment about [future] LinuxKPI USBBjoern A. Zeeb7 days1-0/+6
| | | | | | | | | | USB structures are defined with the native USB implementation. Just leave a comment why they are not here. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D54991
* LinuxKPI: move MODULE_DEVICE_TABLE from pci.h to module.hBjoern A. Zeeb7 days2-18/+18
| | | | | | | | | | | | | | | | Move the MODULE_DEVICE_TABLE macro to module.h where it belongs in preparation for different bus (e.g., USB, SDIO) support. The various struct <bus>_device_id, if not elsewhere, should be defined in mod_devicetable.h. This is the next step after 2f5666c1727c. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste, dumbbell Differential Revision: https://reviews.freebsd.org/D54900
* LinuxKPI: string_choices.h: use ternary operatorBjoern A. Zeeb13 days1-20/+5
| | | | | | | | | | | Switch from using if () else to a direct return (?:) code. No functional changes. Suggested by: kib (D55029) Sponosred by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste (before removing more () as suggested by him) Differential Revision: https://reviews.freebsd.org/D55088
* LinuxKPI: add str_read_write()Bjoern A. Zeeb13 days1-0/+9
| | | | | | | | | Needed by a wireless driver. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D55029
* linuxkpi: Add tag support to radix treeJean-Sébastien Pédron2026-01-281-4/+25
| | | | | | | | | | | | | | | | | | | | | The tag is used to perform lookup in a different way. New functions were introduced: * to set, check and clear a tag * to walk through a radix tree based on a given tag Furthermore, the `radix_tree_delete()` function was modified to clear tags on deletion. The amdgpu DRM driver started to use this in Linux 6.10. While here, the `radix_tree_gang_lookup()` function was added because it is very close to `radix_tree_gang_lookup_tag()`, but it is not used by the DRM drivers as of this commit. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54503
* linuxkpi: Add eventfd_*()Jean-Sébastien Pédron2026-01-251-0/+54
| | | | | | | | | | | | Add <linux/eventfd.h> and expose the `eventfd_*()` API. This is used by DRM drivers for some time, but the code was commented out so far. Note that Linux uses `struct eventfd_ctx`, but FreeBSD defines `struct eventfd`. We define `eventfd_ctx` as a synonym to `eventfd`. Reviewed by: christos, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50853
* LinuxKPI: improve hweight<n> if complie time constantBjoern A. Zeeb2026-01-251-6/+6
| | | | | | | | | | | rtw89(4) uses a static_assert() with hweight<n> calls. In order to avoid compile time errors, deal with the case when the arguments to hweight<n> are complie time constant. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54806
* LinuxKPI: add umin()Bjoern A. Zeeb2026-01-251-0/+3
| | | | | | | | | | Add a version of umin() simply using MIN() assuming that the Linux upstream code properly check that the arguments are unsigned, etc. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54807
* LinuxKPI: implement dmam_free_coherent()Bjoern A. Zeeb2026-01-251-0/+9
| | | | | | | | | | | dmam_free_coherent() is used by an updated mt76 driver at v6.19-rc6. We need to surgically find the devres information and destroy it before calling dma_free_coherent. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54810
* LinuxKPI: PTP add (*settime64) to struct ptp_clock_infoBjoern A. Zeeb2026-01-251-0/+1
| | | | | | | | | | | | While iwlwifi supportes PTP, LinuxKPI does not and we only add the definitons to avoid mangling upstream drivers. iwlwifi(4) does not even support the (*settime64) callback but only returns -EOPNOTSUPP. Sponosred by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54802
* linuxkpi: Implement <linux/seq_buf.h>Jean-Sébastien Pédron2026-01-241-0/+73
| | | | | | | | | | | | It is a wrapper above a `char *` to track the overall available space in the buffer as well as the used space. This wrapper does not manage memory allocation. The DRM generic code started to use this in Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54488
* mt76: update Mediatek's mt76 driverBjoern A. Zeeb2026-01-232-1/+61
| | | | | | | | | | | | | | | This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7 ( tag: v6.19-rc6 ). Notable change: license got switched from ISC to BSD-3-Clause-Clear. util.h is now imported from upstream given it is no longer GPL-only. See the upstream repository 909675fd4344f73aad5f75f123bd271ada2ab9fb and a96fed2825d8dfb068bf640419c619b5f2df4218. For us the new version should also help with page pools and DMA32. Sponsored by: The FreeBSD Foundation
* LinuxKPI: netdevice: add structs net_device_path, net_device_path_ctxBjoern A. Zeeb2026-01-211-0/+24
| | | | | | | | mt76(4) is using this along with a mac80211.h functiontion pointer to resolve a path in an offload case. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPi: 802.11: add more definesBjoern A. Zeeb2026-01-213-0/+4
| | | | | | | | Add more defines and a mac80211 op function pointer used by mt76(4) at Linux v6.19-rc6. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: skbuff: implement skb_queue_splice()Bjoern A. Zeeb2026-01-211-1/+8
| | | | | | | | | Add skb_queue_splice() and use it in skb_queue_splice_init() which already had that functionality (plus the init bit). The new function is used by rtw89(4). Sponosred by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: rename enum ieee80211_tx_rate_flags and move fileBjoern A. Zeeb2026-01-212-14/+13
| | | | | | | | | | What we used to call enum ieee80211_tx_rate_flags is now used as enum mac80211_rate_control_flags for the ieee80211_tx_rate.flags in rtw89(4). Rename the enum and move it to mac80211 as it seems to belong there. Sponsonred by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: add new field to struct cfg80211_bitrate_maskBjoern A. Zeeb2026-01-211-0/+3
| | | | | | | | rtw89(4) accesses eht_mcs[]. Add the field to struct cfg80211_bitrate_mask. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: Management MIC element can have 8 or 16 octets MICBjoern A. Zeeb2026-01-211-3/+11
| | | | | | | | | Management MIC element (MME) can have 8 or 16 octets MIC. Add a second structure used by at least iwlwifi and update reference to latest standard version. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: factor out rate logic for mandatory channelsBjoern A. Zeeb2026-01-202-3/+14
| | | | | | | | | | | | | | | I was looking at rate work for another problem and found more flags in ath9k (which we will likely never need). The documentation then revealed the "mandatory" flags as well and with discussions about cfg80211 going on I decided to use the momentum and split our "supp_rates" setup between lkpi_lsta_alloc() and wiphy_register(). There should be no functional change. While there also initialize max_rc_amsdu_len. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: pci: fix pcie_get_speed_cap()Bjoern A. Zeeb2026-01-141-9/+18
| | | | | | | | | | | | | pcie_get_speed_cap() has a hard coded skip of 3 devices at the beginning. It is either called on a pdev or on a result from pci_upstream_bridge(). In the latter case skipping another three devices might get us to acpi0 or nexus, neither of which is a PCI device still and pci_get_vendor() will panic() on that. Sponsored by: The FreeBSD Foundation (commit) GHI: https://github.com/freebsd/drm-kmod/issues/393 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53862
* LinuxKPI: include acpi headers for RISC-VBjoern A. Zeeb2026-01-141-1/+1
| | | | | | | | | | | | In order to compile iwlwifi(4), which is reported to work on RISC-V, include the ACPI headers to avoid adding further FreeBSD-specific #ifdefs to the driver. With this iwlwifi(4) just compiles on RISC-V (at least if ACPI support is turned off in the module Makefile). Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54692
* linuxkpi: Add `rol32()`Jean-Sébastien Pédron2026-01-071-0/+6
| | | | | | | | | | | `rol64()` and `rol32()` are used by <linux/siphash.h>. The former was added previously, before <linux/siphash.h> was added. However the latter was not, and it broke the build on armv7. Reported by: adrian Reviewed by: adrian, rpokala Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54588
* linuxkpi: Replicate the chain of #include in the `cec*.h` headersJean-Sébastien Pédron2026-01-074-0/+59
| | | | | | | | | | The i915 DRM driver depends on this namespace pollution to access `debugfs_*` functions, after several explicit #include of <linux/debugfs.h> were removed in Linux 6.10. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54494
* linuxkpi: Add WARN_RATELIMIT()Jean-Sébastien Pédron2026-01-071-0/+7
| | | | | | | | The i915 DRM driver started to use it in Linux 6.10. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54493
* linuxkpi: Add <linux/kmsg_dump.h>Jean-Sébastien Pédron2026-01-071-0/+51
| | | | | | | | | | | | | This header declares register/unregister functions to allow a piece of code to tell what function to call in case of a panic. Several panic handlers may be registered. The DRM generic code started to use it in Linux 6.10 as part of the panic handler. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54492
* linuxkpi: Add <linux/font.h>Jean-Sébastien Pédron2026-01-071-0/+33
| | | | | | | | | | | | | | | | The header defines the minimum to allow the DRM generic code to build. The only function used so far is `get_default_font()`, as part of a DRM-specific panic handler. We do not use this panic handler on FreeBSD. For now, it returns a NULL value. It should probably map to a vt(4) font. The DRM generic code started to use it in Linux 6.10 as part of the panic handler. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54491
* linuxkpi: Define `raw_spinlock_t` in <linux/spinlock.h>Jean-Sébastien Pédron2026-01-071-0/+20
| | | | | | | | | | | | | For now, it is synonymous to `spinlock_t`. The DRM generic code uses the `struct raw_spinlock` and not `raw_spinlock_t`, that's why the definition is a struct embedding a `struct mtx`, compared to `spinlock_t` which is a simpler typedef. The DRM generic code started to use it in Linux 6.10. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54489
* linuxkpi: Add `radix_tree_deref_slot()`Jean-Sébastien Pédron2026-01-051-0/+6
| | | | | | | | | | | We don't do reference counting, we only dereference the pointer and retunr the value. The amdgpu DRM driver started to use it in Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54502
* linuxkpi: Add <linux/siphash.h>Jean-Sébastien Pédron2026-01-051-0/+168
| | | | | | | | | | | The file is copied as is from Linux 6.10 as it dual-licensend under the GPLv2 and BSD 3-clause. The amdgpu DRM driver started to use it in Linux 6.10. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54501
* linuxkpi: Add get_unaligned_le64()Jean-Sébastien Pédron2026-01-051-0/+7
| | | | | | | | | | | This function was the only one missing in the `get_unaligned_*()` family. This is going to be used by the imported `linux_siphash.c` in a future commit, which itself is used by DRM drivers starting from Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54500
* linuxkpi: Add `rol64()`Jean-Sébastien Pédron2026-01-051-0/+6
| | | | | | | | This is used by <linux/siphash.h> added in a separate future commit. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54499
* linuxkpi: Add support for statically-allocated kfifoJean-Sébastien Pédron2026-01-051-2/+20
| | | | | | | | | | | | | | | | The main difference with the dynamically allocated version is that the structure is initialized with `DECLARE_KFIFO()` which takes the number of items as an additional argument compared to `DECLARE_KFIFO_PTR()`. The declared structure is then initialized with `INIT_KFIFO()` which sets all fields to 0, except `total` which is computed from the size of the array passed to `DECLARE_KFIFO()`. The amdgpu DRM driver started to used this in Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54497
* linuxkpi: Replicate Linux #includes between headersJean-Sébastien Pédron2026-01-058-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | The DRM drivers (and probably other parts of the Linux kernel) had a significant cleanup w.r.t. which source file includes what in Linux 6.10. Nonetheless, the DRM drivers still depend on implicit namespace pollution because some source files do not include all the headers they should. This cleanup broke the build with FreeBSD because we do not replicate the same `#include` directives everywhere. This commit adds the same `#include` directives in several headers in order to get the same namespace pollution. This fixes the build of the DRM drivers from Linux 6.10. An example is `drm_dp_tunnel.c` which needed `str_yes_no()` defined by <linux/string_helpers.h> (technically <linux/string_choices.h> in Linux). It gets it through: <linux/i2c.h> -> <linux/regulator/consumer.h> -> <linux/suspend.h> -> <linux/swap.h> -> <linux/memcontrol.h> -> <linux/cgroup.h> -> <linux/seq_file.h> -> <linux/string_helpers.h> Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54496
* linuxkpi: Split <linux/compiler.h>Jean-Sébastien Pédron2026-01-053-46/+96
| | | | | | | | | | | | | | | | | | | | | | | | On Linux, they split the content into three headers: 1. <linux/compiler.h> 2. <linux/compiler_types.h> 3. <linux/compiler_attributes.h> The first includes the second, which includes the third. <linux/compiler_types.h> is also included on the compiler command line by default! I added that to the compilation flags of the DRM drivers. This allowed me to drop at least one: #ifdef __FreeBSD #include <linux/compiler.h> #endif Note that our copy of <linux/compiler.h> contains definitions which are not defined by Linux' <linux/compiler.h>. I left them alone. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54495
* linuxkpi: Define `PCI_POSSIBLE_ERROR()` macroJean-Sébastien Pédron2026-01-051-0/+14
| | | | | | | | | | | | | | | | | It comes with `PCI_ERROR_RESPONSE` and `PCI_SET_ERROR_RESPONSE()` but we don't use them so far. Therefore `PCI_POSSIBLE_ERROR()` will always reture false. As written in the comment, this macro is a bit weird given the Linux `pci_read_*() functions can return an error code separately from the read value. The `PCI_POSSIBLE_ERROR()` macro started to be used by the amdgpu DRM driver in Linux 6.10. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54487
* linuxkpi: Add hex_dump_to_buffer()Jean-Sébastien Pédron2026-01-041-0/+6
| | | | | | | | | | This function prints a single line of hex dump to the given line buffer. The implementation relies on `lkpi_hex_dump()` to format the string. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51559
* linuxkpi: Add option to skip trailing newline in `lkpi_hex_dump()`Jean-Sébastien Pédron2026-01-042-3/+3
| | | | | | | | | This will be useful in the upcoming implementation of `hex_dump_to_buffer()` which doesn't add one. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51844
* linuxkpi: Correct kstrtoboolDag-Erling Smørgrav2026-01-031-11/+5
| | | | | | | | | | | | | | | | | | Implement the exact same logic as in Linux: * Accept 'e', 't', 'y', '1', "on" for true. * Accept 'd', 'f', 'n', '0', "of" for false. * Disregard any characters beyond that. * Check that the string is not null, but don't check the result pointer. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D54451
* linuxkpi: Don't clobber result on failureDag-Erling Smørgrav2026-01-021-13/+30
| | | | | | | | | | | | In kstrto*(), don't assign to *res until we know the conversion is successful, and address issues that may result in warnings if code that uses <linux/kstrtox.h> is compiled at high warning levels. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D54440
* LinuxKPI: bitcount fix builds with gcc and older llvmBjoern A. Zeeb2025-12-191-0/+8
| | | | | | | | | | | | | | | | LLVM before 19 and gcc before 14 do not support __builtin_popcountg(). Use __const_bitcount<n> from sys/bitcount.h as a replacement in these cases. This should still allow drm-kmod to build where the size needs to be known at compile-time. Remove the conditional for gcc around the iwlwifi modules build, which was collateral damage in all this. Sponsored by: The FreeBSD Foundation Fixes: 7cbc4d875971, 5e0a4859f28a MFC after: 3 days Reviewed by: brooks, emaste (without the sys/modules/Makefile change) Differential Revision: https://reviews.freebsd.org/D54297
* LinuxKPI: Implement vmap_pfnVladimir Kondratyev2025-12-171-0/+3
| | | | | | | | Required by i915kms to support recent discrete graphics cards. MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D54225
* linuxkpi: Take const root in read-only radix tree functionsJean-Sébastien Pédron2025-12-091-2/+2
| | | | | | | | This is a preparation step for a future addition to this file. This is also closer to what Linux does. Reviewed by: emaste Sponsored by: The FreeBSD Foundation
* LinuxKPI: ath10k: adjust for led changes to keep ath10k compilingBjoern A. Zeeb2025-12-061-1/+4
| | | | | | | | | Add the conditional compile time option defaulting to off as we do not support leds in LinuxKPI to ath10k for the new file. Add empty struct gpio_led to LinuxKPI. MFC after: 3 days
* LinuxKPI: mt76: depend on CONFIG_NET_MEDIATEK_SOC_WEDBjoern A. Zeeb2025-12-031-1/+27
| | | | | | | | | If CONFIG_NET_MEDIATEK_SOC_WED is not set then be silent; if CONFIG_NET_MEDIATEK_SOC_WED is set we will enable logic or rather te pr_debug("TODO") calls for now. Spsonsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: move ieee80211_offload_flagsBjoern A. Zeeb2025-12-031-7/+7
| | | | | | | | | | Move the enum and leave a comment on the struct member for the vif about the type. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fill in more skeleton functionsBjoern A. Zeeb2025-12-032-31/+141
| | | | | | | | | | | | Some of these are used by mt76 and while I was here and it only was a handfull I figured I should just clean this all up. There is one problem in that between 802.11az and 802.11-2024 action frame formats have changed; I got compile errors from iwlwifi(4) given I updated them to -2024 so we remain on older versions for the moment. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: device: add a pr_debug("TODO") call to device_release_driver()Bjoern A. Zeeb2025-12-031-0/+1
| | | | | | | | | The logic in device_release_driver() got disabled in 93b14194acaf2 and since left alone. Add a pr_debug() call so we have a chance to notice if that code is actually still in need to be fixed and re-enabled. Sponsored by: The FreeBSD Foundation MFC after: 3 days