| #
1f4fbcf3
|
| 26-Jan-2026 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: move MODULE_DEVICE_TABLE from pci.h to module.h
Move the MODULE_DEVICE_TABLE macro to module.h where it belongs in preparation for different bus (e.g., USB, SDIO) support. The various stru
LinuxKPI: move MODULE_DEVICE_TABLE from pci.h to module.h
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
show more ...
|
| #
fa24602c
|
| 17-Sep-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: fix pcie_get_speed_cap()
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 la
LinuxKPI: pci: fix pcie_get_speed_cap()
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
show more ...
|
| #
ace666bd
|
| 09-Aug-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `PCI_POSSIBLE_ERROR()` macro
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 fals
linuxkpi: Define `PCI_POSSIBLE_ERROR()` macro
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
show more ...
|
| #
885e8f27
|
| 17-Oct-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add skeleton pci_enable_wake()
Given we do not yet support "wake" bits in device there is little need doing it in PCI if we cannot check if we are supposed to do the operation in first pla
LinuxKPI: add skeleton pci_enable_wake()
Given we do not yet support "wake" bits in device there is little need doing it in PCI if we cannot check if we are supposed to do the operation in first place. Once we would implement this, we would need to also do the appropriate PCI (pme) checks before enabling (disabling) it.
MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D53208
show more ...
|
| #
4179e6b7
|
| 04-Sep-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: implementation of [lkpi_]pci_get_slot()
Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot() using pci_find_bsf() instead of pci_find_dbsf() (no domain). This is need
LinuxKPI: pci: implementation of [lkpi_]pci_get_slot()
Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot() using pci_find_bsf() instead of pci_find_dbsf() (no domain). This is needed for a wireless driver.
Unfortunately the name [pci_get_slot()] collides with the native PCI function. Add a guard around it and disable the use when the native version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the latter gets fixed we can probably also fix work around it in the former; further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved).
Sponsored by: The FreeBSD Foundation (initially) MFC aftre: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52065
show more ...
|
| #
7e21158d
|
| 31-Jul-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: implement [linuxkpi_]pcim_request_all_regions()
Factor out the pci_request_region() implementation into an internal function and make pci_request_region() a simple wrapperaround it. L
LinuxKPI: pci: implement [linuxkpi_]pcim_request_all_regions()
Factor out the pci_request_region() implementation into an internal function and make pci_request_region() a simple wrapperaround it. Likewise implement pcim_request_all_regions() as a loop calling pci_request_region() for each entry.
In two cases which we returned an error before (bar index is valid but bar is not (no len), and neither IO nor MEM) we now reutrn success (nothing to do for us). Otherwise callers, especially pcim_request_all_regions() would error out for the wrong reasons. This seems to also match the expected behaviour of pci_request_region().
Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52068
show more ...
|
| #
2f9064a5
|
| 31-Jul-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: implement pcim_iomap()
Like pci_iomap() add the devres version pcim_iomap() using the former to get the resource.
Add a helper function to validate that the bar is within a valid ran
LinuxKPI: pci: implement pcim_iomap()
Like pci_iomap() add the devres version pcim_iomap() using the former to get the resource.
Add a helper function to validate that the bar is within a valid range and sprinkle that check also to other related functions.
Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52067
show more ...
|
| #
910cf345
|
| 04-Sep-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: implement for_each_pci_dev() and improve pci_get_device()
Implement for_each_pci_dev() needed by a wireless driver update. For that also improve pci_get_device() and add the functiona
LinuxKPI: pci: implement for_each_pci_dev() and improve pci_get_device()
Implement for_each_pci_dev() needed by a wireless driver update. For that also improve pci_get_device() and add the functionality to support the odev argument to start searching from that.
Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52066
show more ...
|
| #
84bbfc32
|
| 14-Jun-2025 |
Aymeric Wibo <obiwac@FreeBSD.org> |
acpi_powerres: D3cold support
Cherry-pick commit 0b76c0a from ACPICA (actypes: Distinguish between D3hot/cold, and default `ACPI_STATE_D3` to D3cold).
The same distinction is made between `PCI_POWE
acpi_powerres: D3cold support
Cherry-pick commit 0b76c0a from ACPICA (actypes: Distinguish between D3hot/cold, and default `ACPI_STATE_D3` to D3cold).
The same distinction is made between `PCI_POWERSTATE_D3_HOT` and `PCI_POWERSTATE_D3_COLD`, as they're defined by ACPI (and are asserted to be the same).
D3cold is essentially the same as D3hot except the power resources are turned off. Add support for D3cold to `acpi_pwr_switch_consumer`.
`acpi_d_state_to_str` replaces the `printf("D%d", d_state)` pattern, allowing for "D3hot" and "D3cold" strings to be printed instead of just "D3".
Reviewed by: markj, ziaee, mckusick (mentor) Approved by: markj, mckusick (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48384
show more ...
|
| #
a9648653
|
| 31-Jul-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: use unsigned int for vendor/device arguments
Linux drivers may pass a typed PCI_ANY_ID (-1U) in which then leads to a warning that the value gets truncated. Switch argument types to
LinuxKPI: pci: use unsigned int for vendor/device arguments
Linux drivers may pass a typed PCI_ANY_ID (-1U) in which then leads to a warning that the value gets truncated. Switch argument types to unsigned int (or uint32_t as we use in struct pci_device_id) to avoid the problem.
Sponsored by: The FreeBSD Foundation Discussed in: D50008 MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51652
show more ...
|
| #
421bf3a9
|
| 31-Jul-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: fix argument type to linuxkpi_pci_iomap[_range]
The last argument (maxlen) to linuxkpi_pci_iomap_range and linuxkpi_pci_iomap is an unsigned long not an int. LinuxKPI is not using th
LinuxKPI: pci: fix argument type to linuxkpi_pci_iomap[_range]
The last argument (maxlen) to linuxkpi_pci_iomap_range and linuxkpi_pci_iomap is an unsigned long not an int. LinuxKPI is not using that argument in the end but fix it where needed. While here adjust the name to 'maxlen' and remove the "mmio_" to bar and off.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51651
show more ...
|
| #
69ed0f76
|
| 31-Jul-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: harmonize #defines
In some blocks of #defines spacing, trailing \ and indentation of a second line differed. Some of them are currently fine on a single line but future additions may
LinuxKPI: pci: harmonize #defines
In some blocks of #defines spacing, trailing \ and indentation of a second line differed. Some of them are currently fine on a single line but future additions may not fit in that scheme. Harmonize them into a #define X\t\t\t...\\n<4 spaces>Y scheme.
No functional changes.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51650
show more ...
|
| #
2f5666c1
|
| 22-Jun-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO()
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus attachments, factor out the bus-specfic MODULE_PNP_IN
LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO()
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus attachments, factor out the bus-specfic MODULE_PNP_INFO() and place it next to the structure defining the table.
As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with PCI attachments for the "auxillary" bus so far. That makes little sense. Define the MODULE_PNP_INFO() to nothing for that. We may consider pulling these LinucKPI bits in semi-native drivers into LinuxKPI one day as that route is not really sustainabke.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: imp, dumbbell Differential Revision: https://reviews.freebsd.org/D51049
show more ...
|
| #
f58e0324
|
| 22-Jun-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: MODULE_DEVICE_TABLE() remove hard coded pci
While we currently only use MODULE_DEVICE_TABLE() for pci (or so I thought [*]), this may soon change. Remove a hard coded "pci" for the bus an
LinuxKPI: MODULE_DEVICE_TABLE() remove hard coded pci
While we currently only use MODULE_DEVICE_TABLE() for pci (or so I thought [*]), this may soon change. Remove a hard coded "pci" for the bus and use the bus name passed in as _bus.
[*] see follow-up change
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: imp, dumbbell Differential Revision: https://reviews.freebsd.org/D51048
show more ...
|
| #
e29d72ac
|
| 24-Apr-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: add pci_info()
Add pci_info() needed for a driver update. While here prefix __VA_ARGS__ with ## for pci_err and pci_info in case we are only passed a string without format arguments.
LinuxKPI: pci: add pci_info()
Add pci_info() needed for a driver update. While here prefix __VA_ARGS__ with ## for pci_err and pci_info in case we are only passed a string without format arguments.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50009
show more ...
|
| #
21b55655
|
| 03-Mar-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Fix `pci_upstream_bridge()` with DRM devices
In the case of DRM drivers, the passed device is a child of `vgapci`. We want to start the lookup from `vgapci`, so the parent of the passed `d
linuxkpi: Fix `pci_upstream_bridge()` with DRM devices
In the case of DRM drivers, the passed device is a child of `vgapci`. We want to start the lookup from `vgapci`, so the parent of the passed `drmn`. We use the `isdrm` flag to determine if we are in this situation.
This fixes an infinite loop with the amdgpu DRM driver that started to use this function in Linux 6.8: `pci_upstream_bridge()` was returning itself and the code in amdgpu was calling it again, hoping to get a device with a vendor that is not "ATI".
Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49388
show more ...
|
| #
3f847ccf
|
| 25-Feb-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define a few more `PCI_*` constants
They are synonymous to existing FreeBSD constants.
Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.fr
linuxkpi: Define a few more `PCI_*` constants
They are synonymous to existing FreeBSD constants.
Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49379
show more ...
|
| #
1396a731
|
| 05-Feb-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Print "TODO" if a driver call `pci_wake_from_d3()`
This helps developers working with linuxkpi find out a function is already defined but is just a stub.
Reported by: bz Reviewed by: bz,
linuxkpi: Print "TODO" if a driver call `pci_wake_from_d3()`
This helps developers working with linuxkpi find out a function is already defined but is just a stub.
Reported by: bz Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48862
show more ...
|
| #
dec2806f
|
| 05-Feb-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `PCI_IRQ_LEGACY` for Linux < 6.10
Commit 03e39d3d42e70482cd6f65ecaa5cf8ff9674d27c decreased the Linux version that exposes this constant to be Linux 6.7. It happens that the constan
linuxkpi: Define `PCI_IRQ_LEGACY` for Linux < 6.10
Commit 03e39d3d42e70482cd6f65ecaa5cf8ff9674d27c decreased the Linux version that exposes this constant to be Linux 6.7. It happens that the constant is older.
However, it is removed in Linux 6.10. Let's change the version condition to say that it is defined for any version before 6.10.
Reported by: bz Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48861
show more ...
|
| #
73281513
|
| 01-Jan-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add `pci_wake_from_d3()`
[Why] This is used by the amdgpu DRM driver starting with Linux 6.7.
[How] The function just returns 0 for now.
Reviewed by: manu Sponsored by: The FreeBSD Found
linuxkpi: Add `pci_wake_from_d3()`
[Why] This is used by the amdgpu DRM driver starting with Linux 6.7.
[How] The function just returns 0 for now.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48759
show more ...
|
| #
479c61bd
|
| 22-Dec-2024 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add `pci_get_base_class()`
[Why] This new API is used by the amdgpu DRM driver is Linux 6.7.
[How] This is the same as `pci_get_class()` except that it searches a PCI device matching the
linuxkpi: Add `pci_get_base_class()`
[Why] This new API is used by the amdgpu DRM driver is Linux 6.7.
[How] This is the same as `pci_get_class()` except that it searches a PCI device matching the base class only; the subclass is ignored.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48746
show more ...
|
| #
03e39d3d
|
| 21-Dec-2024 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Declare `PCI_IRQ_LEGACY` even for linuxkpi 6.7
[Why] DRM drivers in Linux 6.7 already use this constant.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: http
linuxkpi: Declare `PCI_IRQ_LEGACY` even for linuxkpi 6.7
[Why] DRM drivers in Linux 6.7 already use this constant.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48742
show more ...
|
| #
157e93e0
|
| 26-Sep-2024 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: pci: rename PCI_IRQ_LEGACY to PCI_IRQ_INTX
PCI_IRQ_LEGACY was added in 366d68f28379 (likely) for rtw88 only. The define now got renamed and I cannot find any other use but rtw88 and rtw89.
LinuxKPI: pci: rename PCI_IRQ_LEGACY to PCI_IRQ_INTX
PCI_IRQ_LEGACY was added in 366d68f28379 (likely) for rtw88 only. The define now got renamed and I cannot find any other use but rtw88 and rtw89. We keep the old name as comapt while driver updates are in progress enabling it defining LINUXKPI_VERSION for the two drivers.
Sponsored by; The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D46822
show more ...
|
| #
01e1131e
|
| 12-Sep-2024 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add pci_err()
Add pci_err() as a wrapper to dev_err() as needed by an updated driver.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: htt
LinuxKPI: add pci_err()
Add pci_err() as a wrapper to dev_err() as needed by an updated driver.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D46660
show more ...
|
| #
f5c7feee
|
| 28-Aug-2024 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add general module_driver(), use it for module_pci_driver()
Factor out module_pci_driver() from 366d68f283793 into a general module_driver() so other bus attachments can also use the same
LinuxKPI: add general module_driver(), use it for module_pci_driver()
Factor out module_pci_driver() from 366d68f283793 into a general module_driver() so other bus attachments can also use the same kind of macro without duplicating all the lines.
Redefine module_pci_driver() using the new general macro.
No functional changes intended.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D46467
show more ...
|