summaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux
Commit message (Collapse)AuthorAgeFilesLines
* Cleanups to *ERR* compat shims.John Baldwin2020-12-171-7/+7
| | | | | | | | | | | | | | - Use [u]intptr_t casts to convert pointers to integers. - Change IS_ERR* to return bool instead of long. Reviewed by: manu Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27577 Notes: svn path=/head/; revision=368738
* Use the 't' modifier to print a ptrdiff_t.John Baldwin2020-12-161-1/+1
| | | | | | | | | | Reviewed by: imp Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27576 Notes: svn path=/head/; revision=368685
* Prefer using the MIN() function macro over the min() inline functionHans Petter Selasky2020-12-072-2/+2
| | | | | | | | | | | | in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD min() is a static inline function clamping its arguments to "unsigned int". MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=368406
* Allow the rbtree header file in the LinuxKPI to be used in standalone code.Hans Petter Selasky2020-12-041-0/+3
| | | | | | | | MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=368336
* Allow the list header file in the LinuxKPI to be used in standalone code.Hans Petter Selasky2020-12-041-1/+4
| | | | | | | | | | Some style and spelling nits while at it. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=368335
* Use function macro for sema_init() in the LinuxKPI to limit macro expansion ↵Hans Petter Selasky2020-11-301-1/+1
| | | | | | | | | | scope. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=368182
* Allow LinuxKPI types to be used in bootloaders, by checking for theHans Petter Selasky2020-11-181-1/+3
| | | | | | | | | | | | _STANDALONE definition. No functional change intended. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=367789
* LinuxKPI: Exclude linux/acpi.h content on non-ACPI archs.Vladimir Kondratyev2020-11-141-0/+4
| | | | | | | | | | | | | LinuxKPI ACPI support is based on FreeBSD import of ACPICA which can be compiled only on aarch64, amd64 and i386. Ifdef-out broken parts on our side to avoid patching of vendor code. This fixes drm-devel-kmod build on powerpc64(le). Reported by: pkubaj Notes: svn path=/head/; revision=367673
* LinuxKPI: Implement ACPI bits required by drm-kmod in base systemEmmanuel Vadot2020-11-091-0/+42
| | | | | | | | | | | | | | | It includes: ACPI_HANDLE() implementation. AC and VIDEO ACPI events notification support. Replacement of hand-rolled GPLed _DSM method evaluation helpers with in-base ones. Submitted by: wulf Differential Revision: https://reviews.freebsd.org/D26603 Notes: svn path=/head/; revision=367521
* Implement xa_init() in the LinuxKPI as a wrapper for xa_init_flags().Hans Petter Selasky2020-10-241-0/+6
| | | | | | | | MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=366996
* Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI.Hans Petter Selasky2020-10-161-3/+0
| | | | | | | | | Discussed with: manu@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=366751
* Implement more RCU list functions in the LinuxKPI.Hans Petter Selasky2020-10-131-4/+37
| | | | | | | | | | | | This also fixes a bug in the existing list_add_rcu() where the prev->prev pointer was updated to the new element instead of next->prev. Currently this function is not widely used. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=366669
* LinuxKPI: add a bitfield.h implementation.Bjoern A. Zeeb2020-10-071-0/+105
| | | | | | | | | | | | | | | | | | | This code was iteratively implemented during the work on various WiFi drivers -- from individual functions to a macro-created implementations for the various bit sized needed (and then extended to more for comepleteness). Some of the bit combinations do not seem to make sense so are left out. The __bf_shf(x) was obtained from D26681 [1]. Requested by: manu [1] Reviewed by: hselasky, manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26708 Notes: svn path=/head/; revision=366523
* linuxkpi: Add pagemap.hEmmanuel Vadot2020-10-061-0/+45
| | | | | | | | | | | | Add release_pages needed by drm which simply calls put_page for all the pages provided Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26680 Notes: svn path=/head/; revision=366479
* linuxkpi: Add power_supply.hEmmanuel Vadot2020-10-061-0/+44
| | | | | | | | | | | Add power_supply_is_system_supplied which is needed by drm. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26679 Notes: svn path=/head/; revision=366478
* linuxkpi: Add prefetch.hEmmanuel Vadot2020-10-061-0/+36
| | | | | | | | | | | | | Only add prefetchw as it is the only function used by drm. Simply use the __builtin_prefetch which is available in all compiler for a long time. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26677 Notes: svn path=/head/; revision=366477
* linuxkpi: Add numa.hEmmanuel Vadot2020-10-061-0/+36
| | | | | | | | | | | Only contain NUMA_NO_NODE needed by drm Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26676 Notes: svn path=/head/; revision=366476
* linuxkpi: Add gcd functionEmmanuel Vadot2020-10-061-0/+50
| | | | | | | | | | | | This compute the common greater divider Taken from OpenBSD Reviewed by: bz, imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26674 Notes: svn path=/head/; revision=366475
* Populate the acquire context field of a ww_mutex in the LinuxKPI.Hans Petter Selasky2020-10-041-3/+4
| | | | | | | | | | | | Bump the FreeBSD version to force recompilation of external kernel modules. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26657 Submitted by: greg_unrelenting.technology (Greg V) Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=366432
* linuxkpi: Add dmi_* functionEmmanuel Vadot2020-10-023-1/+119
| | | | | | | | | | | | dmi function are used to get smbios values. The DRM subsystem and drivers use it to enabled (or not) quirks. Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26046 Notes: svn path=/head/; revision=366373
* linuxkpi: Add backlight supportEmmanuel Vadot2020-10-022-0/+98
| | | | | | | | | | | | | Add backlight function to linuxkpi. Graphics drivers expose the backlight of the panel directly so allow them to use the backlight subsystem so user can use backlight(8) to configure them. Reviewed by: hselasky Relnotes: yes Differential Revision: The FreeBSD Foundation Notes: svn path=/head/; revision=366372
* compat: clean up empty lines in .c and .h filesMateusz Guzik2020-09-0113-18/+0
| | | | Notes: svn path=/head/; revision=365080
* LinuxKPI: Implement ksize() function.Vladimir Kondratyev2020-08-291-0/+6
| | | | | | | | | | | | | | | In Linux, ksize() gets the actual amount of memory allocated for a given object. This commit adds malloc_usable_size() to FreeBSD KPI which does the same. It also maps LinuxKPI ksize() to newly created function. ksize() function is used by drm-kmod. Reviewed by: hselasky, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26215 Notes: svn path=/head/; revision=364964
* Implement extensible arrays API using the existing radix tree implementationHans Petter Selasky2020-08-271-0/+94
| | | | | | | | | | | | in the LinuxKPI. Differential Revision: https://reviews.freebsd.org/D25101 Reviewed by: kib @ MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=364860
* vfs: remove the thread argument from vgetMateusz Guzik2020-08-161-1/+1
| | | | | | | | | | | | | | | | | | It was already asserted to be curthread. Semantic patch: @@ expression arg1, arg2, arg3; @@ - vget(arg1, arg2, arg3) + vget(arg1, arg2) Notes: svn path=/head/; revision=364271
* linuxkpi: Add a few wait_bit functionsEmmanuel Vadot2020-08-142-0/+65
| | | | | | | | | | | | | | | | The linux function does a lot more than that as multiple waitqueue could be fetch from a static table based on the hash of the argument but since in DRM it's only used in one place just add a single variable. We will probably need to change that in the futur but it's ok with DRM even with current linux. Reviewed by: hselasky MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26054 Notes: svn path=/head/; revision=364232
* Use atomic_clear_rel_long() to implement clear_bit_unlock() in the LinuxKPIHans Petter Selasky2020-08-111-7/+3
| | | | | | | | | | | after r363842. Suggested by: alc@ MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=364110
* Need to clone the task struct fields related to RCU aswell in theHans Petter Selasky2020-08-111-2/+3
| | | | | | | | | | | | | | | | LinuxKPI after r359727. This fixes a minor regression issue. Else the priority tracking won't work properly when both sleepable and non-sleepable RCU is in use on the same thread. Bump the __FreeBSD_version to force recompilation of external kernel modules. PR: 242272 MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=364109
* Implement radix_tree_store() in the LinuxKPI for use with the comingHans Petter Selasky2020-08-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | extensible arrays implementation. While at it add some more comments explaining the current radix_tree_insert() function and make sure to clean the root node when the radix tree reaches the maximum height. This can happen if the index passed is too big when the tree is empty. The radix_tree_store() function is basically a copy of the radix_tree_insert() function with some added functionality. The radix_tree_store() function is local to FreeBSD and does not yet exist in Linux. Reviewed by: kib MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=364028
* linuxkpi: Add time_after32 and time_before32Emmanuel Vadot2020-08-041-0/+2
| | | | | | | | | | | | This compare two 32 bits times Sponsored by: The FreeBSD Foundation Reviewed by: kib, hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25700 Notes: svn path=/head/; revision=363843
* linuxkpi: Add clear_bit_unlockEmmanuel Vadot2020-08-041-0/+7
| | | | | | | | | | | | | This calls clear_bit and adds a memory barrier. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25943 Notes: svn path=/head/; revision=363842
* Re-apply r363564.Emmanuel Vadot2020-08-041-0/+1
| | | | | | | We now have linux/sizes.h in the tree. Notes: svn path=/head/; revision=363839
* linuxkpi: Add nested variant of mutex_lock_interruptibleEmmanuel Vadot2020-08-041-0/+2
| | | | | | | | | | | | We don't do anything with the _nesteds variant so just call mutex_lock_interruptible Sponsoredby: The FreeBSD Foundation Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25944 Notes: svn path=/head/; revision=363837
* linuxkpi: Add kref_put_lockEmmanuel Vadot2020-08-041-0/+15
| | | | | | | | | | | | Same as kref_put but in addition to calling the rel function it will acquire the lock first. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D25942 Notes: svn path=/head/; revision=363836
* linuxkpi: Add linux/sizes.hEmmanuel Vadot2020-08-041-0/+51
| | | | | | | | | | | | This file contain some defines for common sizes. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25941 Notes: svn path=/head/; revision=363835
* Fix r363565Emmanuel Vadot2020-07-261-0/+2
| | | | | | | lockdep.h needs sys/lock.h for LOCK_CLASS Notes: svn path=/head/; revision=363575
* Revert r363564Emmanuel Vadot2020-07-261-1/+0
| | | | | | | linux/sizes.h doesn't exists in base ... sorry. Notes: svn path=/head/; revision=363567
* linuxkpi: Add taint* definesEmmanuel Vadot2020-07-261-0/+3
| | | | | | | | | | | This isn't used for us but allow us to port drivers more easily. Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25703 Notes: svn path=/head/; revision=363566
* linuxkpi: Include hardirq.h in preempt.h and lockdep.h in hardirq.hEmmanuel Vadot2020-07-262-0/+2
| | | | | | | | | | | Linux does the same, this avoids ifdef or extra includes in ported drivers. Reviewed by: emaste, hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25702 Notes: svn path=/head/; revision=363565
* linuxkpi: Include linux/sizes.h in dma-mapping.hEmmanuel Vadot2020-07-261-0/+1
| | | | | | | | | | | Linux does the same, this avoids ifdef or extra includes in ported drivers. Reviewed by: emaste, hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25701 Notes: svn path=/head/; revision=363564
* linuxkpi: Ignore NULL pointers passed to string parameter of kstr(n)dupVladimir Kondratyev2020-07-141-0/+4
| | | | | | | | | | | That follows Linux and fixes related drm-kmod-5.3 panic. Reviewed by: imp, hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25657 Notes: svn path=/head/; revision=363205
* Implement the bitmap_subset() function in the LinuxKPI. This functionHans Petter Selasky2020-07-101-0/+22
| | | | | | | | | | | | checks if the bitmap pointed to by the first argument is a subset of the bitmap pointed to by the second argument. The function returns one on success and zero on failure. MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=363078
* Implement the array_size() function in the LinuxKPI. This functionHans Petter Selasky2020-07-101-0/+13
| | | | | | | | | | | | | | | | basically multiplies its two arguments and returns SIZE_MAX if the result overflows the size_t type. Else the product of the two arguments is returned. Bump the FreeBSD_version to mitigate issues with existing implementation of array_size() in drm-devel-kmod. Discussed with: manu@ MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=363077
* Fix include file order in io.h in the LinuxKPI.Hans Petter Selasky2020-07-051-1/+2
| | | | | | | | | | | | Make sure sys/types.h is included before machine/vm.h. PR: 247775 Submitted by: pkubaj@ MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=362946
* Document the is_signed(), type_max() and type_min() function macros in theHans Petter Selasky2020-06-301-11/+24
| | | | | | | | | | | LinuxKPI. Try to make the function argument more readable. Suggested by: several MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=362794
* Implement is_signed(), type_max() and type_min() function macros in theHans Petter Selasky2020-06-291-0/+16
| | | | | | | | | | LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=362781
* In r362552, RB_SET_PARENT is defined, and use in parens inDoug Moore2020-06-231-1/+1
| | | | | | | | | | | RB_CLEAR_NODE. But it is not an expression, and ought not to be enclosed in parens. Remove them. Approved by: markj Differential Revision: https://reviews.freebsd.org/D25421 Notes: svn path=/head/; revision=362562
* Define RB_SET_PARENT to do all assignments to rb parentDoug Moore2020-06-231-22/+6
| | | | | | | | | | | | | | | | | | pointers. Define RB_SWAP_CHILD to replace the child of a parent with its twin, and use it in 4 places. Use RB_SET in rb_link_node to remove the only linuxkpi reference to color, and then drop color- and parent-related definitions that are defined and used only in rbtree.h. This is intended to be entirely cosmetic, with no impact on program behavior, and leave RB_PARENT and RB_SET_PARENT as the only ways to read and write rb parent pointers. Reviewed by: markj, kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D25264 Notes: svn path=/head/; revision=362552
* Linuxkpi uses the rb-tree structures without using their interfaces,Doug Moore2020-06-131-0/+5
| | | | | | | | | | | | making them break when the representation changes. Revert changes that eliminated the color field from rb-trees, leaving everything as it was before. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25250 Notes: svn path=/head/; revision=362139
* Revert r362108, as it breaks compilation.Doug Moore2020-06-121-2/+2
| | | | Notes: svn path=/head/; revision=362110