summaryrefslogtreecommitdiff
path: root/aports/broadcom-wl/msi_support.patch
diff options
context:
space:
mode:
authorPÁLI Gábor János <pali.gabor@gmail.com>2023-07-27 11:05:17 +0200
committerPÁLI Gábor János <pali.gabor@gmail.com>2023-07-27 11:05:17 +0200
commit084335e136581edc28137b152cc559778224570e (patch)
tree269c2e37b0abd971aeccdc1291bc1c3ca9c96aed /aports/broadcom-wl/msi_support.patch
parent1f7bcc1ae14273fce0b5d3dded52d599aa035433 (diff)
downloadfreebsd-wifibox-alpine-084335e136581edc28137b152cc559778224570e.zip
Make Broadcom wireless cards work
- Import Arch Linux patches for the `broadcom-wl` driver and WPA Supplicant - Implement support for Message Signaled Interrupts (MSI) to allow the card to be used with PCI pass-through References: - https://gitlab.archlinux.org/archlinux/packaging/packages/broadcom-wl-dkms/ - https://gitlab.archlinux.org/archlinux/packaging/packages/wpa_supplicant/ Tested by: venoom27 <venoom27@fromgithub>
Diffstat (limited to 'aports/broadcom-wl/msi_support.patch')
-rw-r--r--aports/broadcom-wl/msi_support.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/aports/broadcom-wl/msi_support.patch b/aports/broadcom-wl/msi_support.patch
new file mode 100644
index 0000000..84634f9
--- /dev/null
+++ b/aports/broadcom-wl/msi_support.patch
@@ -0,0 +1,79 @@
+--- a/src/wl/sys/wl_linux.c
++++ b/src/wl/sys/wl_linux.c
+@@ -504,6 +504,7 @@
+ #if defined(USE_CFG80211)
+ struct device *parentdev;
+ #endif
++ bool msi_supported;
+
+ unit = wl_found + instance_base;
+ err = 0;
+@@ -529,6 +530,7 @@
+ }
+ bzero(wl, sizeof(wl_info_t));
+
++ wl->pdev = (struct pci_dev *) btparam;
+ wl->osh = osh;
+ wl->unit = unit;
+ atomic_set(&wl->callbacks, 0);
+@@ -654,9 +656,28 @@
+
+ tasklet_init(&wl->tx_tasklet, wl_tx_tasklet, (ulong)wl);
+
++ msi_supported = !wl->pdev->no_msi;
++ pci_info(wl->pdev, "MSI supported: %s\n", msi_supported ? "true" : "false");
++
++ if (msi_supported) {
++ int ret;
++
++ ret = pci_alloc_irq_vectors(wl->pdev, 1, 1, PCI_IRQ_MSI);
++ if (ret < 0) {
++ WL_ERROR(("wl%d: pci_alloc_irq_vectors() failed, ret %d\n", unit, ret));
++ goto fail;
++ }
++ pci_info(wl->pdev, "(MSI) allocated %d IRQ vectors", ret);
++ irq = pci_irq_vector(wl->pdev, 0);
++ pci_info(wl->pdev, "(MSI) requesting IRQ: %d\n", irq);
++ }
++
+ {
+- if (request_irq(irq, wl_isr, IRQF_SHARED, dev->name, wl)) {
+- WL_ERROR(("wl%d: request_irq() failed\n", unit));
++ int ret;
++
++ ret = request_irq(irq, wl_isr, IRQF_SHARED, dev->name, wl);
++ if (ret < 0) {
++ WL_ERROR(("wl%d: request_irq() failed, ret %d\n", unit, ret));
+ goto fail;
+ }
+ dev->irq = irq;
+@@ -996,8 +1017,10 @@
+
+ WL_TRACE(("wl: wl_free\n"));
+ {
+- if (wl->dev && wl->dev->irq)
++ if (wl->dev && wl->dev->irq) {
+ free_irq(wl->dev->irq, wl);
++ pci_free_irq_vectors(wl->pdev);
++ }
+ }
+
+ #if defined(WL_CONFIG_RFKILL)
+--- a/src/wl/sys/wl_linux.h
++++ b/src/wl/sys/wl_linux.h
+@@ -21,6 +21,7 @@
+ #ifndef _wl_linux_h_
+ #define _wl_linux_h_
+
++#include <linux/pci.h>
+ #include <wlc_types.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
+ #include <wlc_pub.h>
+@@ -85,6 +86,7 @@
+ void *wlc;
+ osl_t *osh;
+ struct net_device *dev;
++ struct pci_dev *pdev;
+
+ struct semaphore sem;
+ spinlock_t lock;