#
a1cdddcf |
|
31-Mar-2024 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add further constants to pci.h Updated wireless drivers require more knowledge about PCI (BAR) bits. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D44573
|
#
f1206503 |
|
08-Apr-2024 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Add pci_dev_id to linux/pci.h It returns bus/device/function number for given PCI device. Also add intermediate PCI_DEVID macro used in some drivers. Sponsored by: Serenity Cyber Security, LLC Reviewed by: emaste MFC after: 1 week
|
#
808ae4e2 |
|
24-Dec-2023 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Add pcie_capability_clear_and_set_word() function It does a Read-Modify-Write operation using clear and set bitmasks on PCI Express Capability Register at pos. As certain PCI Express Capability Registers are accessed concurrently in RMW fashion, hence require locking which is handled transparently to the caller. Sponsored by: Serenity CyberSecurity, LLC Reviewed by: manu, bz MFC after: 1 week MFC TODO: Move pcie_cap_lock to bottom to preserve KBI compatibility Differential Revision: https://reviews.freebsd.org/D42821
|
#
96ab16eb |
|
24-Dec-2023 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Remove sys/rman.h include from LKPI headers. sys/rman.h defines `resource` structure which conflicts with the Linux structure of the same name. To fix that remove reference to sys/rman.h from linux/pci.h and move resource management code to linux_pci.c. Update consumers which were depending on linux/pci.h pollution. No functional changes intended. Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42792
|
#
95ee2897 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
f74c09f3 |
|
25-Jul-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h add more constants Add two more PCI_EXP_LNKSTA_CLS constants to the compat defines needed by wireless drivers. Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: manu, emaste Differential Revision: https://reviews.freebsd.org/D41258
|
#
17bde9cb |
|
19-May-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: update struct msi_desc It seems struct msi_desc is setup differently (or was changed) compared to how we added it a while ago. Catch up in order to keep drivers directly accessing fields compiling. Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40175
|
#
7d7d12ba |
|
23-May-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: add PCI_COMMAND_MEMORY Add another PCI alias to our native defines for a wireless driver. MFC after: 10 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40247
|
#
525dd4ac |
|
16-May-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: implement pci_rescan_bus() Try to implement pci_rescan_bus(). pci_rescan_method() is already doing most of the job. We only have to do the count for the return value again ourselves. Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D40122
|
#
0e8953b9 |
|
20-Apr-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h: always initialize return value In pcie_capability_read_*() always initialize the return value to avoid warnings of uninitialized values in callers. Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D39721
|
#
83df72e5 |
|
20-Feb-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `pat_enabled()` This new <asm/memtype.h> header is included from <linux/pci.h> because that's how it is included in Linux too. DRM drivers depend on this. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39052
|
#
af19988f |
|
20-Feb-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `pcie_aspm_enabled()` This is not the same as querying the PCIE ASPM capability. The function should return if the feature is actually enabled or not. It always return false on FreeBSD. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39053
|
#
393b0ba2 |
|
06-Feb-2023 |
Val Packett <val@packett.cool> |
LinuxKPI: return an address string in pci_name() amdgpu's virtual display feature uses pci_name() to match a module parameter string, and the documentation shows an example of `0000:26:00.0` for the name. In our case the name was just `drmn`, which is not actually unique across devices. The other consumers are wireless drivers, which will benefit from this change. Generate the expected string for pci_name() to return. Related to: https://github.com/freebsd/drm-kmod/issues/134 Sponsored by: https://www.patreon.com/valpackett Reviewed by: bz, hselasky, manu (earlier) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D34248
|
#
b15491b4 |
|
27-Jan-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: PCI: implement support for more than 1 MSI vector Following e9715b1c4474333ff119aba3a9a74bff91f72372 and 4b56afaf7bf4fa37bae5b26fd93ee1ff5969c1bb, implement support for up-to 32 MSI vectors. This is used by wireless drivers. This also switches msi_desc to an array in order to store per-vector information. Sponsored by: The FreeBSD Foundation Discussed with: grehan (in Dec) MFC after: 3 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38222
|
#
fd1a2f3d |
|
28-Jan-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: add more functions Add a dummy pci_assign_resource() and an implementation of pci_irq_vector() returning the irq for MSI-X, MSI, and legacy interrupt. Both are needed by wirless drivers. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38237
|
#
0d0ca120 |
|
26-Jan-2023 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h move function declaration to top of file. No functional changes. X-MFC-with: 49b6d5ed142d6c59b7a517ff5660165d8647bd01 Sponsored by: The FreeBSD Foundation
|
#
66cc55a0 |
|
22-Jan-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `PCI_STD_NUM_BARS` in <linux/pci.h> Reviewed by: emaste, manu Approved by: emaste, manu Differential Revision: https://reviews.freebsd.org/D38162
|
#
4152ce21 |
|
20-Jan-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add `msix_cap` to `struct pci_dev` At the same time, define `PCI_MSIX_FLAGS`and `PCI_MSIX_FLAGS_ENABLE`. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38160
|
#
49b6d5ed |
|
19-Jan-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add `pci_device_is_present()` This calls bus_child_present(9) internally. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38148
|
#
4b56afaf |
|
28-Nov-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: implement irq_get_msi_desc() Add irq_get_msi_desc() as a wrapper around a PCI function which will allocate a single cached value (see comment on struct) for the msi_desc requested if it doesn't exist yet and handle freeing it when the PCI device goes away. We take the values from the ivars of the native (FreeBSD) device. While changing struct pci_dev also add the msi_cap field requested by a wireless driver. Bump __FreeBSD_version so these changes can be detected. MFC after: 3 days X-MFC: move fields to end of struct (alloc happens in linux_pci.c) Reviewed by: hselasky (earlier version) Differential Revision: https://reviews.freebsd.org/D37523
|
#
8f61992d |
|
02-Dec-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: add [linuxkpi_]pci_get_device() Add a version of pci_get_device() as linuxkpi_pci_get_device() not (yet) supporting the last argument. Due to conflicts we cannot redefine it as we would normally do in LinuxKPI so drivers have to be adjusted. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D37593
|
#
0adc02a9 |
|
01-Dec-2022 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add `PCIE_SPEED_{32,64}_0GT` PCI-E bus speed constants This change is a requirement to update our DRM drivers to Linux 5.12. Differential Revision: https://reviews.freebsd.org/D37363
|
#
5f2f582c |
|
31-Oct-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h add more MSI related constanst and pci_is_enabled() Add more MSI related constansts defined to our native defines and pci_is_enabled(). All are needed for another wireless driver. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D37225
|
#
86a1c5d1 |
|
11-Nov-2022 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `pci_reset_function()` in <linux/pci.h> Currently, it always returns an error on FreeBSD. Reviewed by: bz manu Approved by: bz manu Differential Revision: https://reviews.freebsd.org/D37366
|
#
4cb3cb2d |
|
06-Oct-2022 |
Jake Freeland <jfree@FreeBSD.org> |
LinuxKPI: Add pci_power querying for drm-kmod Adds a few struct members and a function to get i915_runtime_pm_status() to compile in drm-kmod. Differential Revision: https://reviews.freebsd.org/D36749 Sponsored by: Google, Inc. (GSoC 2022)
|
#
30048f61 |
|
21-Sep-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h split up pcim_iomap_regions_request_all() Factor out parts of pcim_iomap_regions_request_all() into pcim_iomap_regions() now needed for a driver. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36654
|
#
c41d8354 |
|
21-Sep-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h add more defines and functions Add #defines for PCI_DEVICE_ID and repoint the PCI_VENDOR_ID one. Add dev_is_pci(). Add pcie_capability_clear_word() according to similar implementations. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36653
|
#
6890e327 |
|
26-Jul-2022 |
Emmanuel Vadot <manu@FreeBSD.org> |
linuxkpi: pci: Add more functions needed by drm Mostly stubs to satisfy building Reviewed by: hselasky Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D35938
|
#
0e981d79 |
|
20-May-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: move pm_message_t from kernel.h to pm.h Move pm_message_t from kernel.h to pm.h and remove a private define in usb.h as well as adjust the implementation in linux_usb.c. This cleans up what I believe to be a historic shortcut and is needed for future wireless driver updates. Leave a note in UPDATING that drm-kmod users need to update to the latest version before re-compiling a new kernel to avoid errors (see PR). Sponsored by: The FreeBSD Foundation MFC after: 3 days PR: 264449 (drm-kmod port update, thanks wulf) Obtained from: bz_git_iwlwifi (Dec 2020) (partly) Reviewed by: hselasky, imp Differential Revision: https://reviews.freebsd.org/D35276
|
#
85eb99f9 |
|
18-May-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: implement pcie_capability_set_word() Implement pcie_capability_set_word() using the already available read/write functions. Also define the completion timeout disable value to our PCI one. Both needed by a driver update. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: manu, hselasky Differential Revision: https://reviews.freebsd.org/D35250
|
#
a65d0774 |
|
06-May-2022 |
John Baldwin <jhb@FreeBSD.org> |
linuxkpi: Remove unused devclass arguments to DRIVER_MODULE.
|
#
2bf3361d |
|
04-Apr-2022 |
Warner Losh <imp@FreeBSD.org> |
linuxkpi: Move lkpi_pcim_iomap_devres_find to .c file lkpi_pcim_iomap_devres_find encodes the size of struct pcim_iomap_devres in the code, so move from .h to .c to move from client driver to linuxkpi module. Sponsored by: Netflix Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34775
|
#
36b5c440 |
|
04-Apr-2022 |
Warner Losh <imp@FreeBSD.org> |
linuxkpi: Move pci_alloc_irq_vectors to .c file pci_alloc_irq_vectors encodes the size of struct msix_entry into its code. Move from .h to .c to move this knowledge from client modules to linuxkpi module. Sponsored by: Netflix Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34774
|
#
1cdb2534 |
|
04-Apr-2022 |
Warner Losh <imp@FreeBSD.org> |
linuxkpi: Move pci_request_region and _lkpi_pci_iomap into .c Both pci_request_region and _lkpi_pci_iomap encode the size of struct pci_mmio_region into their code. Move from .h to .c files to move that knowledge from the client drivers into the linuxkpi module. Sponsored by: Netflix Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34773
|
#
3ea682e2 |
|
04-Apr-2022 |
Warner Losh <imp@FreeBSD.org> |
linuxkpi: Move lkpi_pci_devres_get_alloc into .c file lkpi_pci_devres_get_alloc encodes the struct pci_devres into its code. Move from .h file to .c file to move this knowledge into linuxkpi module. Sponsored by: Netflix Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D34772
|
#
b3b83625 |
|
16-Feb-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: implement pci_upstream_bridge() Allow drivers to query the "upstream PCI bridge". Currently we point back to ourselves on pdev->bus->self rather than to the parent PCI bridge. We keep this as status-quo with an extra comment and only on-demand allocate a pci_dev for the parent bridge if we are asked for in pci_upstream_bridge(). When releasing the pci_dev we check if pdev->bus->self has changed and call pci_dev_put() to release the reference count on the parent bridge as well. This code moves pci_is_root_bus() higher up in pci.h but no functional change there. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: hselasky, (jhb some earlier) Thanks to: wulf for handling drm-kmod Differential Revision: https://reviews.freebsd.org/D34305
|
#
5493c627 |
|
03-Mar-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h MODULE_DEVICE_TABLE to MODULE_PNP_INFO Implement MODULE_PNP_INFO() support in LinuxKPI for the Linux MODULE_DEVICE_TABLE. This will allow us to auto-load LinuxKPI PCI drivers (drm-kmod do not currently as they attach to vgapci0 which in turn grabs the PCI to my understanding) and make any loading from loader or kld_list in rc.conf unnecessary; see devmatch(8) for more information. We need to ensure there is a DRIVER_MODULE() (or probably just a DECLARE_MODULE but that makes not much difference) before the MODULE_PNP_INFO (which we otherwise would not need). Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: imp, hselasky, manu Differential Revision: https://reviews.freebsd.org/D26651
|
#
fbedd9d7 |
|
03-Mar-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: remove duplicate include Remove a duplicate bus.h include from pci.h. Sponsored by: The FreeBSD Foundation MFC after: 3 days
|
#
b91dd79b |
|
18-Feb-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: allow a driver to override the default pci probe result Add bsd_probe_return which a driver can set in their 'struct pci_driver' definition to set a driver-sepcific LinuxKPI pci return value. This is helpful in case of multiple drivers with overlapping IDs, such as iwlwifi(4) and iwm(4). Contrary to an earlier version we now assume 0 is not BUS_PROBE_SPECIFIC (which no driver should really return these days) but the bss initialized value (bsd_probe_return unset) and we will return BUS_PROBE_DEFAULT. Suggested by: jhb Reviewed by: jhb Reviewed by: hselasky, imp (earlier versions) Sponsored by: The FreeBSD Foundation MFC after: 3 days X-MFC: new struct members need to go to the end for stable/13 Differential Revision: https://reviews.freebsd.org/D33915
|
#
c4f52f71 |
|
15-Feb-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h add more defines Add and sort in more defines needed by newer drivers. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34293
|
#
307f78f3 |
|
19-Dec-2021 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Constantly use _LINUXKPI_ prefix in include guards MFC after: 1 week Reviewed by: bz, emaste, hselasky, manu Differential Revision: https://reviews.freebsd.org/D33562
|
#
cf899348 |
|
25-Oct-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h / linux_pci.c rename pci_driver field Rename the struct pci_driver {} field got the list_head from links to node as a driver is actually initialsing this to {} which seems questionable but it will at least make us match the Linux structure field name. MFC after: 3 days Reviewed by: manu, hselasky Differential Revision: https://reviews.freebsd.org/D32645
|
#
ed5600f5 |
|
25-Oct-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci.h make pci_dev argument const for pci_{read,write}_config*() Make the struct pci_dev argument to the pci_{read,write}_config*() functions "const" to match the Linux definition as some drivers try to pass in a const argument which we currently fail to honor. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32644
|
#
82098c8b |
|
17-Oct-2021 |
Jessica Clarke <jrtc27@FreeBSD.org> |
LinuxKPI: Support lazy BAR allocation Linux KPIs like pci_resource_start/len assume that BARs have been allocated, but FreeBSD lazily allocates BARs if it cannot allocate the firmware-allocated BARs. Thus using the Linux KPIs must force allocation of the BARs rather than returning 0 for the start and length, which can crash drm-kmod drivers that assume the BARs are valid. This is needed for the AMDGPU driver to be able to attach on SiFive's HiFive Unmatched. Reviewed by: hselasky, jhb, mav MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32447
|
#
366d68f2 |
|
01-Jul-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add module_pci_driver() and pci_alloc_irq_vectors() Add the two new functions needed by rtw88 to register the driver and handle the module bits as well as a version of pci_alloc_irq_vectors() for what is needed. Reviewed by: hselasky MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D30981
|
#
78a02d8b |
|
04-Jul-2021 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Add #defines required by drm-kmod v5.5 Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30767
|
#
539228d3 |
|
27-Jun-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci re-add pci_free_irq_vectors() Re-add pci_free_irq_vectors() accidentally removed in d4a4960c6559caa890af0901a21296e75b961210 and now needed by drm-kmod v5.5. Reported by: wulf Sponsored by: The FreeBSD Foundation MFC after: 3 days X-MFC with: d4a4960c6559caa890af0901a21296e75b961210
|
#
d4a4960c |
|
30-May-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: cleanup some code and add support for "pcim" (managed) Restructure some code and add support for various "managed" versions for PCI resource management. This is beyond of what iwlwifi needs but some was found with other wireless drivers and it mostly all goes together. Add one FreeBSD sepcific feature returning the resource rather than the handle to allow us to use bus_*() functions in drivers directly. Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30558
|
#
8e106c52 |
|
28-May-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: extend pci.h by various functions for wireless driver Add dummy functions for dealing with "HotPlug" events which we currently do not support. Add pci_dev_get(), pci_find_ext_capability() and pci_pme_capable(). The added pcie_find_root_port() is a bit special as we need to create another linux pci device; for that make lkpinew_pci_dev() public which is also helpful for other cases when we want to use the Linux routines to check for device identifiers only and need a container for the "bsddev" to use natively. This has proven to avoid basic checking code for the sake of rewriting it to native field names elsewhere. Given we cache the newly created "root" we also need to make sure we clean it up. Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30521
|
#
096104e7 |
|
07-Jun-2021 |
Neel Chauhan <nc@FreeBSD.org> |
linuxkpi: Add rom and romlen to struct pci_dev Approved by: bz (src), hselasky (src) Differential Reivison: https://reviews.freebsd.org/D30686
|
#
fc1d8409 |
|
24-May-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add more #defines to pci.h Add more definitions for various PCI uses to linux/pci.h. Almost all are defined to their FreeBSD counterparts which are described there. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30434
|
#
3f322b22 |
|
12-Apr-2021 |
Mark Johnston <markj@FreeBSD.org> |
linuxkpi: Fix pcie_set_readrq() We were passing a LinuxKPI struct device * to a pci(4) function that expects a device_t. Reviewed by: manu, hselasky, bz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29675
|
#
5a402a3a |
|
23-Mar-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add pci_ids.h brcm80211 include pci_ids.h directly while historically we were tracking IDs in pci.h. Move the current set of IDs from pci.h to pci_ids.h and while here add IDs for Realtek and Broadcom as well as a network class as needed by their wireless drivers. We still include pci_ids.h from pci.h so this should not change anything. MFC-after: 2 weeks Reviewed-by: hselasky Differential Revision: https://reviews.freebsd.org/D29400
|
#
1fac2cb4 |
|
28-Jan-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: enhance PCI bits for DRM In pci_domain_nr() directly return the domain which got set in lkpifill_pci_dev() in all cases. This was missed between D27550 and 105a37cac76b971f7a94409fbdc4f508a7e97fa0 . In order to implement pci_dev_put() harmonize further code (which was started in the aforementioned commit) and add kobj related bits (through the now common lkpifill_pci_dev() code) to the DRM specific calls without adding the DRM allocated pci devices to the pci_devices list. Add a release for the lkpinew_pci_dev() (DRM) case so freeing will work. This allows the DRM created devices to use the normal kobj/refcount logic and work with, e.g., pci_dev_put(). (For a slightly more detailed code walk see the review). Sponsored-by: The FreeBSD Foundation Obtained-from: bz_iwlwifi (partially) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28188
|
#
105a37ca |
|
10-Dec-2020 |
Emmanuel Vadot <manu@FreeBSD.org> |
linuxkpi: Add more pci functions needed by DRM -pci_get_class : This function search for a matching pci device based on the class/subclass and returns a newly created pci_dev. - pci_{save,restore}_state : This is analogous to ours with the same name - pci_is_root_bus : Return true if this is the root bus - pci_get_domain_bus_and_slot : This function search for a matching pci device based on domain, bus and slot/function concat into a single unsigned int (devfn) and returns a newly created pci_dev - pci_bus_{read,write}_config* : Read/Write to the config space. While here add some helper function to alloc and fill the pci_dev struct. Reviewed by: hselasky, bz (older version) Differential Revision: https://reviews.freebsd.org/D27550
|
#
1a180032 |
|
01-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
compat: clean up empty lines in .c and .h files
|
#
c5161386 |
|
05-Jun-2020 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Ensure pci_channel_offline() actually queries the PCI register space, and not only the software cache of that register. Else pci_channel_offline() won't detect that the PCI device is gone when using the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
5e30a739 |
|
19-May-2020 |
Emmanuel Vadot <manu@FreeBSD.org> |
linuxkpi: add pci_dev_present pci_dev_present shows if a set of pci ids are present in the system. It just wraps pci_find_device. Needed by DRMv5.2 Submitted by: Austing Shafer (ashafer@badland.io) Differential Revision: https://reviews.freebsd.org/D24796
|
#
4c274849 |
|
07-May-2020 |
Emmanuel Vadot <manu@FreeBSD.org> |
linuxkpi: Add pci_iomap and pci_iounmap Those function are use to map/unmap io region of a pci device. Different resource can be mapped depending on the bar so use a tailq to store them all. Sponsored-by: The FreeBSD Foundation Reviewed by: emaste, hselasky Differential Revision: https://reviews.freebsd.org/D24696
|
#
b4edb17c |
|
01-May-2020 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Implement more PCI-express bandwidth functions in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
253dbe74 |
|
22-Apr-2020 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Factor code in LinuxKPI to allow attach and detach using any BSD device. This allows non-LinuxKPI based infiniband device drivers to attach correctly to ibcore. No functional change intended. Reviewed by: np @ Differential Revision: https://reviews.freebsd.org/D24514 MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
9275cd0d |
|
20-Mar-2020 |
Warner Losh <imp@FreeBSD.org> |
Implement a workaround for kms-drm modules pci_iov_if.h was added to pci.h, but none of the kms-drm branches have that. Rather than play whack a mole with the branches, move its inclusion to linux_pci.c which is the only part of the code that needs it now. Longer term, other solutions will be needed, but this gives us time to get those deployed on all the supported versions.
|
#
2928e60e |
|
18-Mar-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
linuxkpi: Add infrastructure to pass FreeBSD IOV method calls into pci_driver methods. Reviewed by: hselasky Sponsored by: Mellanox Technologies MFC after: 2 weeks
|
#
4f109faa |
|
14-Aug-2019 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Implement pci_enable_msi() and pci_disable_msi() in the LinuxKPI. This patch makes the DRM graphics driver in ports usable on aarch64. Submitted by: Greg V <greg@unrelenting.technology> Differential Revision: https://reviews.freebsd.org/D21008 MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
937a05ba |
|
04-Aug-2019 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Add necessary bits for Linux KPI to work correctly on powerpc PowerPC, and possibly other architectures, use different address ranges for PCI space vs physical address space, which is only mapped at resource activation time, when the BAR gets written. The DRM kernel modules do not activate the rman resources, soas not to waste KVA, instead only mapping parts of the PCI memory at a time. This introduces a BUS_TRANSLATE_RESOURCE() method, implemented in the Open Firmware/FDT PCI driver, to perform this necessary translation without activating the resource. In addition to system KPI changes, LinuxKPI is updated to handle a big-endian host, by adding proper endian swaps to the I/O functions. Submitted by: mmacy Reported by: hselasky Differential Revision: https://reviews.freebsd.org/D21096
|
#
5098ed5f |
|
10-May-2019 |
Johannes Lundberg <johalun@FreeBSD.org> |
Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers can be unloaded. This patch is a part of D19565. Reviewed by: hps Approved by: imp (mentor), hps MFC after: 1 week
|
#
46068e86 |
|
06-May-2019 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Use PCIV_INVALID in pci_channel_offline() in the LinuxKPI. Build tested drm-current-kmod prior to commit. MFC after: 1 week Submitted by: slavash@ Sponsored by: Mellanox Technologies
|
#
fa233979 |
|
06-May-2019 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Disabling a PCI device should only disable busmaster in the LinuxKPI. As Linux comment for this function point: Signal to the system that the PCI device is not in use by the system anymore. This only involves disabling PCI bus-mastering, if active. Build tested drm-current-kmod prior to commit. MFC after: 1 week Submitted by: slavash@ Sponsored by: Mellanox Technologies
|
#
f211d536 |
|
24-Apr-2019 |
Tycho Nightingale <tychon@FreeBSD.org> |
LinuxKPI should use bus_dma(9) to be compatible with an IOMMU Reviewed by: hselasky, kib Tested by: greg@unrelenting.technology Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D19845
|
#
ab62989a |
|
13-Mar-2019 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Implement more PCI speed related functions and macros in the LinuxKPI. Submitted by: Johannes Lundberg <johalun0@gmail.com> MFC after: 1 week Sponsored by: Limelight Networks Sponsored by: Mellanox Technologies
|
#
232028b3 |
|
25-Jan-2019 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
452d59e1 |
|
05-Dec-2018 |
Slava Shwartsman <slavash@FreeBSD.org> |
linuxkpi: Really check if PCI is offline Currently we always return false if for PCI offline query. Try to read PCI config, if the return value if 0xffff probably the PCI is offline. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
13a5c70b |
|
31-May-2018 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Implement support for the PCI_BUS_NUM() function macro in the LinuxKPI. Submitted by: Johannes Lundberg <johalun0@gmail.com> MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
fa0d4f31 |
|
28-Mar-2018 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Swap two instances of regular macros with function macros in the LinuxKPI, to narrow down the substitution scope. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
83630517 |
|
23-Mar-2018 |
Ed Maste <emaste@FreeBSD.org> |
linuxkpi whitespace cleanup Reviewed by: hselasky, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14807
|
#
555deb3c |
|
22-Mar-2018 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
The pci_disable_device() function is also expected to clear the PCI busmaster. This fixes LinuxKPI compliancy with Linux. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
e1992aa1 |
|
21-Mar-2018 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Clear old MSIX IRQ numbers in the LinuxKPI. When disabling the MSIX IRQ vectors for a PCI device through the LinuxKPI, make sure any old MSIX IRQ numbers are no longer visible to the linux_pci_find_irq_dev() function else IRQs can be requested from the wrong PCI device. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
0b7bd01a |
|
10-Aug-2017 |
Mark Johnston <markj@FreeBSD.org> |
Add a specialized function for DRM drivers to register themselves. Such drivers attach to a vgapci bus rather than directly to a pci bus. For the rest of the LinuxKPI to work correctly in this case, we override the vgapci bus' ivars with those of the grandparent. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11932
|
#
f2ec04a3 |
|
03-Aug-2017 |
Mark Johnston <markj@FreeBSD.org> |
Add subsystem vendor and device ID fields to struct pci_dev. MFC after: 1 week
|
#
88156ba5 |
|
03-Jul-2017 |
Mark Johnston <markj@FreeBSD.org> |
Add some auxiliary types for device driver support. MFC after: 1 week
|
#
6373e95e |
|
03-Jul-2017 |
Mark Johnston <markj@FreeBSD.org> |
Add a field for the class code to struct pci_driver. Fill out some previously uninitialized fields as well. MFC after: 1 week
|
#
ecf29cf1 |
|
03-Jul-2017 |
Mark Johnston <markj@FreeBSD.org> |
Add some PCI class definitions. MFC after: 1 week
|
#
b38dc0a1 |
|
03-Jul-2017 |
Mark Johnston <markj@FreeBSD.org> |
Rename the "driver" field to "bsddriver" to avoid a name collision. MFC after: 1 week
|
#
f67b5de7 |
|
09-Jun-2017 |
Mark Johnston <markj@FreeBSD.org> |
Implement pci_disable_device() in the LinuxKPI. Submitted by: kmacy MFC after: 2 weeks
|
#
cb564d24 |
|
30-May-2017 |
Mark Johnston <markj@FreeBSD.org> |
Add some miscellaneous definitions to support DRM drivers. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D10985
|
#
2f02a9e1 |
|
13-Dec-2016 |
Conrad Meyer <cem@FreeBSD.org> |
linuxkpi: Fix not-found case of linux_pci_find_irq_dev Linux list_for_each_entry() does not neccessarily end with the iterator NULL (it may be an offset from NULL if the list member is not the first element of the member struct). Reported by: Coverity CID: 1366940 Reviewed by: hselasky@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8780
|
#
12af734d |
|
09-Dec-2016 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add more LinuxKPI PCI definitions. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC after: 1 week
|
#
1724ded4 |
|
09-Dec-2016 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Prefer function macros over regular macros in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
e996b07c |
|
09-Dec-2016 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Prefix some _pci_xxx() functions in the Linux KPI with linux_ and make sure the IRQ number used by these functions is unsigned. Sponsored by: Mellanox Technologies MFC after: 1 week
|
#
6faefea0 |
|
29-Sep-2016 |
Sepherosa Ziehau <sephe@FreeBSD.org> |
linuxkpi: Fix PCI BAR lazy allocation support. FreeBSD supports lazy allocation of PCI BAR, that is, when a device driver's attach method is invoked, even if the device's PCI BAR address wasn't initialized, the invocation of bus_alloc_resource_any() (the call chain: pci_alloc_resource() -> pci_alloc_multi_resource() -> pci_reserve_map() -> pci_write_bar()) would allocate a proper address for the PCI BAR and write this 'lazy allocated' address into the PCI BAR. This model works fine for native FreeBSD device drivers, but _not_ for device drivers shared with Linux (e.g. dev/mlx5/mlx5_core/mlx5_main.c and ofed/drivers/net/mlx4/main.c. Both of them use pci_request_regions(), which doesn't work properly with the PCI BAR lazy allocation, because pci_resource_type() -> _pci_get_rle() always returns NULL, so pci_request_regions() doesn't have the opportunity to invoke bus_alloc_resource_any(). We now use pci_find_bar() in pci_resource_type(), which is able to locate all available PCI BARs even if some of them will be lazy allocated. Submitted by: Dexuan Cui <decui microsoft com> Reviewed by: hps MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8071
|
#
bdff61f8 |
|
29-Sep-2016 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
The IORESOURCE_XXX defines should resemble a bitmask while SYS_RES_XXX are not bitmasks. Fix return value of pci_resource_flags() to reflect this change. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
a65ef215 |
|
26-Jan-2016 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add more LinuxKPI PCI related functions and defines. Removed comments deriving from Linux. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
7d133393 |
|
15-Jan-2016 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Implement support for PCI suspend, resume and shutdown events in the LinuxKPI. Fix a few spaces to tabs. Bump the FreeBSD version to force recompilation of existing KMODs. MFC after: 1 week Sponsored by: Mellanox Technologies
|
#
8d59ecb2 |
|
29-Oct-2015 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Finish process of moving the LinuxKPI module into the default kernel build. - Move all files related to the LinuxKPI into sys/compat/linuxkpi and its subfolders. - Update sys/conf/files and some Makefiles to use new file locations. - Added description of COMPAT_LINUXKPI to sys/conf/NOTES which in turn adds the LinuxKPI to all LINT builds. - The LinuxKPI can be added to the kernel by setting the COMPAT_LINUXKPI option. The OFED kernel option no longer builds the LinuxKPI into the kernel. This was done to keep the build rules for the LinuxKPI in sys/conf/files simple. - Extend the LinuxKPI module to include support for USB by moving the Linux USB compat from usb.ko to linuxkpi.ko. - Bump the FreeBSD_version. - A universe kernel build has been done. Reviewed by: np @ (cxgb and cxgbe related changes only) Sponsored by: Mellanox Technologies
|