This contain mmap_read_lock, mmap_read_unlock and mmap_write_lock_killable
which are abstraction around down_read, up_read and down_write_killable.
Note that in Linux 5.8 mmap_sem was renamed to mmap_lock.
We might want to do the same at some point but some drivers still uses
the old mmap locking API.
Reviewed by: bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34297
(cherry picked from commit 995c3b88d4)
This simply set the brightness of a backlight device.
Needed by drm-kmod v5.8
Reviewed by: bz, emaste
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34285
(cherry picked from commit 2cc3af6e1d)
This returns the wait queue based on the object but in LinuxKPI
we only have one waitqueue for this.
Reviewed by: hselasky, bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34250
(cherry picked from commit cb15ed7da2)
Add new defines, struct members, and (stub) functions needed for an
updated iwlwifi. Most of the defines are for rfkill or HE.
Pull in a case statement from the upcoming iwlwifi update to
not break the build.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit d875aa1587)
(cherry picked from commit 9ad210c159)
DECLARE_FLEX_ARRAY can be used inside a structure. On FreeBSD due to
-Wgnu-variable-sized-type-not-at-end this yields an error. Use [0]
instead of [] to overcome this.
Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34350
(cherry picked from commit fab601c5b7)
Add dummy MODULE_IMPORT_NS() used by an updated iwlwifi.
Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34349
(cherry picked from commit f6fb9b524f)
Implement dma_sync_single_for_{cpu,device} translating the Linux
DMA_ flags to BUS_DMASYNC_ combinations. Make map_single/unmap_single*
functions call the respective sync function. Apply the same logic to
the scatter-gather list map/unmap functions.
Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32255
(cherry picked from commit 95edb10b47)
This update is for more/newer versions of drivers:
- add and properly place more structs, enums, defines needed by drivers.
- correct types of struct fields.
- make various function arguments const.
- move REG_RULE() macro to its own file regulatory.h and
use macros for calculations.
- add linuxkpi_ieee80211_get_channel() implementation.
- change linuxkpi_ieee80211_ifattach() to return int for error checking.
No intended functional changes for iwlwifi.
Sponsored by: The FreeBSD Foundation (partially)
(cherry picked from commit 2e183d999c)
Various updates to skbuff for new/updated drivers and some housekeeping:
- update types and struct members, add new (stub) functions
- improve freeing of frags.
- fix an issue with sleeping during alloc for dev_alloc_skb().
- Adjust a KASSERT for skb_reserve() which apparently can be called
multiple times if no data was put into the skb yet.
- move the sysctl from linux_8022.c (which may be in a different module)
to linux_skbuff.c so in case we turn debugging on we do not run into
unresolved symbols. Rename the sysctl variable to be less conflicting
and update debugging macros along with that; also add IMPROVE().
- add DDB support to show an skbuff.
- adjust comments/whitespace.
No functional changes intended for iwlwifi.
Sponsored by: The FreeBSD Foundation (partially)
(cherry picked from commit 6baea3312d)
Add lockdep_assert_not_held() asserting LA_UNLOCKED as needed by a
driver.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34232
(cherry picked from commit 064c110f4b)
Add an implementation of kstrtoint_from_user() based on the other
implementations and an attempt at DECLARE_FLEX_ARRAY() which works
for the driver needing it.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34231
(cherry picked from commit c840d5cec2)
Add a definition for UUID_STRING_LEN to uuid.h as needed by a driver.
Also add GUID_INIT for drm-kmod [1].
Submitted by: wulf [1]
Reviewed by: hselasky (earlier), wulf
Differential Revision: https://reviews.freebsd.org/D34235
(cherry picked from commit 97009980c4)
Add sizeof_field() to linux/compiler.h needed by a driver.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34226
(cherry picked from commit e5b95b2201)
Add a linux/pm_qos.h with three dummy functions and a struct as needed
by a driver and drm-kmod [1] in main with no intend to support this for
the moment.
Submitted by: wulf (drm-kmod bits) [1]
Sponsored by: The FreeBSD Foundation (drm-kmod requested updates)
Reviewed by: hselasky (earlier version), wulf
Differential Revision: https://reviews.freebsd.org/D34234
(cherry picked from commit fa6d3522b5)
Add NETIF_F_HW_CSUM to netdev_features.h as needed by a driver.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34233
(cherry picked from commit 85d61bd872)
Add eth_random_addr() and a dummy of device_get_mac_address()
pending OF (FDT) support needed by drivers.
While here remove a white space in random_ether_addr().
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34228
(cherry picked from commit 3cd6d6ff52)
Add an initial ethtool.h for a define and a dummy struct for now
needed by drivers.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34229
(cherry picked from commit 0c37ffda79)
Add a beginning of a tracepoint.h implementation to ease porting drivers
making use of this Linux facility.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34236
(cherry picked from commit a4529c46d4)
swap parameter is not supported as it is rarely used in Linux kernel
and its implementation will add some preprocessor spaghetti to qsort.
Required by drm-kmod.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33675
(cherry picked from commit 7356f661e8)
compile time assertion on non-NULL pointers. Tests conducted show that
_Static_assert, negative array size method and current code does not
handle pointers well enough. Bit field method solves this problem.
This change is derrived from Linux implementation of BUILD_BUG_ON_ZERO.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33674
(cherry picked from commit 64dab63f3b)
They are superseded by PAT and mostly useless nowadays but still can be
used on Pentium III/IV era processors. Unlike drm-kmod version, this one
ignores MTRR if PAT is available that fixes confusing "Failed to add WC
MTRR for [0xXXXX-0xYYYY]: 22; performance may suffer" message often
appearing during drm-kmod initialization process.
MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33561
(cherry picked from commit 98b129783c)
efi_enabled(EFI_BOOT) returns true if machine was booted from EFI
Used by drm-kmod and some unported drm drivers like hyperv
MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33300
(cherry picked from commit 89bb7f9bda)
Obsolete it usage but keep for a while for drm-kmod 5.4 compatibility
MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33298
(cherry picked from commit 0b1244bd79)
for x86 and move them to asm/barrier.h
MFC after: 1 week
Reviewed by: bz, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33296
(cherry picked from commit 2fb5be7978)
to prevent name clashing with drm-kmod
MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33294
(cherry picked from commit 7ec6cbf1d2)
to reduce amount of source patching in drm-kmod.
MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33288
(cherry picked from commit 9a79e08ae7)
Add more (dummy in case of HE) defines, structs, functions and another
mac80211 function pointer needed to update and support recent drivers.
(cherry picked from commit 51b461b3db)
Also include netinet/in.h so that in_addr in known for ip.h.
Found by compiling a new piece of code which complained.
(cherry picked from commit 4ddc0079ea)