git: cafb77e9e0d4 - releng/15.0 - pci: add quirk to disable Function-Level Reset (FLR)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 Oct 2025 05:47:47 UTC
The branch releng/15.0 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=cafb77e9e0d495408666cd99d9d2f5eb8e768735
commit cafb77e9e0d495408666cd99d9d2f5eb8e768735
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-09-25 12:49:07 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-21 05:45:11 +0000
pci: add quirk to disable Function-Level Reset (FLR)
MediaTek mt76 WiFi cards are advertising FLR support but after issuing
a FLR the chipset is gone. Add a quirk so we can disable FLR. The
current reset code will automatically fall back to a power reset.
This makes the card show up under bhyve where before it would just not
be discovered at all. That should make wifibox work for it and will help
development for a LinuxKPI based mt76 driver as found in framework laptops
as no dedicated machine and constant reboots are needed anymore.
We will likely need to add more PCI vendor/device IDs once we can test
the other device IDs.
Approved by: re (cperciva)
After a lot of help from: jhb
Really implemented by: jhb (I just typed and tested)
GH issue: github.com/pgj/freebsd-wifibox/issues/73
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D52728
(cherry picked from commit 4c0e53aced2251eb5ac7eca44e13a6b947be8582)
(cherry picked from commit 3bd015a1a918d060dbef556ddfa6e236f5212330)
---
sys/dev/pci/pci.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 9e43a4c1909f..cde98cb62cef 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -240,6 +240,7 @@ struct pci_quirk {
#define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */
#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */
#define PCI_QUIRK_REALLOC_BAR 7 /* Can't allocate memory at the default address */
+#define PCI_QUIRK_DISABLE_FLR 8 /* Function-Level Reset (FLR) not working. */
int arg1;
int arg2;
};
@@ -319,6 +320,13 @@ static const struct pci_quirk pci_quirks[] = {
* expected place.
*/
{ 0x98741002, PCI_QUIRK_REALLOC_BAR, 0, 0 },
+
+ /*
+ * With some MediaTek mt76 WiFi FLR does not work despite advertised.
+ */
+ { 0x061614c3, PCI_QUIRK_DISABLE_FLR, 0, 0 }, /* mt76 7922 */
+
+ /* end of table */
{ 0 }
};
@@ -6740,6 +6748,8 @@ pcie_flr(device_t dev, u_int max_delay, bool force)
if (!(pci_read_config(dev, cap + PCIER_DEVICE_CAP, 4) & PCIEM_CAP_FLR))
return (false);
+ if (pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_DISABLE_FLR))
+ return (false);
/*
* Disable busmastering to prevent generation of new