git: 3166cea63244 - stable/13 - LinuxKPI: allow a driver to override the default pci probe result
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 27 Mar 2022 20:13:57 UTC
The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3166cea632449ce6c6dad699a812b9813a9531ef commit 3166cea632449ce6c6dad699a812b9813a9531ef Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-02-18 21:58:01 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-03-27 18:06:33 +0000 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 Differential Revision: https://reviews.freebsd.org/D33915 (cherry picked from commit b91dd79ba32122e6adb28073c534224bc78a7b58) --- sys/compat/linuxkpi/common/include/linux/pci.h | 1 + sys/compat/linuxkpi/common/src/linux_pci.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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