git: b91dd79ba321 - main - LinuxKPI: allow a driver to override the default pci probe result
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Mar 2022 23:17:37 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b91dd79ba32122e6adb28073c534224bc78a7b58 commit b91dd79ba32122e6adb28073c534224bc78a7b58 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-03 23:16:39 +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 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 --- 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 ff3fbba9102a..7dc969e677de 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -211,6 +211,7 @@ struct pci_driver { struct device_driver driver; const struct pci_error_handlers *err_handler; bool isdrm; + int bsd_probe_return; int (*bsd_iov_init)(device_t dev, uint16_t num_vfs, const nvlist_t *pf_config); void (*bsd_iov_uninit)(device_t dev); diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 0f8e7cc82631..5f0ec07d3841 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