aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2022-02-18 21:58:01 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2022-03-30 15:45:45 +0000
commitc325d9edeff568d3d38891b2916bd5bd0e9bf8e3 (patch)
tree404db39fd14fddab4f6dc4fc093f007d663d1fee
parent1717f1606b6e94a3096796e95867da5f5f769f01 (diff)
downloadsrc-c325d9edeff568d3d38891b2916bd5bd0e9bf8e3.tar.gz
src-c325d9edeff568d3d38891b2916bd5bd0e9bf8e3.zip
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. Approved by: re (gjb) Suggested by: jhb Reviewed by: jhb Reviewed by: hselasky, imp (earlier versions) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33915 (cherry picked from commit b91dd79ba32122e6adb28073c534224bc78a7b58) (cherry picked from commit 3166cea632449ce6c6dad699a812b9813a9531ef)
-rw-r--r--sys/compat/linuxkpi/common/include/linux/pci.h1
-rw-r--r--sys/compat/linuxkpi/common/src/linux_pci.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index f463f697b5f7..df18c98a6278 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -215,6 +215,7 @@ struct pci_driver {
void (*bsd_iov_uninit)(device_t dev);
int (*bsd_iov_add_vf)(device_t dev, uint16_t vfnum,
const nvlist_t *vf_config);
+ int bsd_probe_return;
};
struct pci_bus {
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index 06feb5107ea5..ccb52732391e 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -361,7 +361,12 @@ linux_pci_probe(device_t dev)
if (device_get_driver(dev) != &pdrv->bsddriver)
return (ENXIO);
device_set_desc(dev, pdrv->name);
- return (BUS_PROBE_DEFAULT);
+
+ /* Assume BSS initialized (should never return BUS_PROBE_SPECIFIC). */
+ if (pdrv->bsd_probe_return == 0)
+ return (BUS_PROBE_DEFAULT);
+ else
+ return (pdrv->bsd_probe_return);
}
static int