wifi: brcmfmac: Add BCM4388 support
cover wifi: brcmfmac: Add BCM4388 support
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handling
These changes include work by Hector Martin and Daniel Berlin from Asahi Linux, refactored where needed for upstream inclusion.
The series provides basic station support only. 6 GHz support is planned for a follow-up patchset after this lands. The driver retains legacy interfaces for older firmware.
Tested on an Apple M3 MacBook Air (J613):
- Device boot and network scanning
- 5 GHz WPA2-PSK association and DHCP
- Bidirectional TCP traffic
Testing required separate Apple PCIe and devicetree patches, as well as Janne Grunau's port-authorization fix [1].
---
Daniel Berlin (1):
wifi: brcmfmac: Support versioned scan parameter layouts
Hector Martin (6):
wifi: brcmfmac: Support newer PCIe core startup and interrupts
wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
wifi: brcmfmac: Load signed PCIe firmware images
wifi: brcmfmac: Accept newer BSS information versions
wifi: brcmfmac: Support versioned join requests
wifi: brcmfmac: Add BCM4388 support
Michael Reeves (6):
wifi: brcmfmac: pcie: Report the detected chip ID to the bus
wifi: brcmfmac: Match complete firmware capability names
wifi: brcmfmac: Fall back to RSSI-only default join preferences
wifi: brcmfmac: Use event_msgs_ext for event masks
wifi: brcmfmac: Handle larger firmware band lists
wifi: brcmfmac: Handle extended PMK command payloads
.../wireless/broadcom/brcm80211/brcmfmac/Makefile | 1 + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 9 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 368 +++++++------- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 36 +- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 27 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 18 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 124 ++++- .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 2 + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 130 ++++- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 1 + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 141 +++++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 9 +- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 560 +++++++++++++++++---- .../broadcom/brcm80211/brcmfmac/scan_param.c | 416 +++++++++++++++ .../broadcom/brcm80211/brcmfmac/scan_param.h | 13 + .../broadcom/brcm80211/include/brcm_hw_ids.h | 2 + .../broadcom/brcm80211/include/chipcommon.h | 5 + 19 files changed, 1593 insertions(+), 339 deletions(-)
---
base-commit: 42a9fb3382fc2573e92f41d203b095d9a372cfc9
change-id: 20260925-brcm4388-submit-5cb8d3e6d6a5
Best regards,
Signature · 1 line
Michael Reeves <[email protected]>
PATCH 1/13 wifi: brcmfmac: pcie: Report the detected chip ID to the bus
The devinfo->coreid field is never assigned, so bus->chip remains zero and chip-specific feature checks cannot match. Assign bus->chip from devinfo->ci->chip, which contains the detected chip ID.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +1 -2
@@ -342,7 +342,6 @@ struct brcmf_pciedev_info {u32 ram_base;u32 ram_size;struct brcmf_chip *ci; -u32 coreid;struct brcmf_pcie_shared_info shared;wait_queue_head_t mbdata_resp_wait;bool mbdata_completed;
@@ -2518,7 +2517,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) bus->bus_priv.pcie = pcie_bus_dev; bus->ops = &brcmf_pcie_bus_ops; bus->proto_type =BRCMF_PROTO_MSGBUF ; - bus->chip = devinfo->coreid; + bus->chip = devinfo->ci->chip; bus->wowl_supported =pci_pme_capable (pdev, PCI_D3hot); bus->fwvid = drvdata[id->driver_data].vendor; devinfo->fwseed = drvdata[id->driver_data].fw_seed;
Signature · 1 line
2.55.0
Re: [PATCH 01/13] wifi: brcmfmac: pcie: Report the detected chip ID to the bus
Quoted 6 lines · Michael Reeves
From: Michael Reeves <[email protected]>
The
devinfo->coreidfield is never assigned, sobus->chipremains zero and chip-specific feature checks cannot match. Assignbus->chipfromdevinfo->ci->chip, which contains the detected chip ID.
Regards,
Arend
Quoted 4 lines
Signed-off-by Michael Reeves <[email protected]>--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
PATCH 2/13 wifi: brcmfmac: Match complete firmware capability names
In reply to Michael ReevesBCM4388 firmware advertises "hp2p" without advertising "p2p". Substring matching incorrectly treats "hp2p" as P2P support, causing userspace to attempt Wi-Fi Direct interface creation that the firmware rejects.
Match complete whitespace-separated capability names instead. Remove the trailing-space workarounds for SAE and FBT and reserve a terminating byte outside the firmware response buffer.
--- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +13 -7
@@ -42,10 +42,10 @@ static const struct brcmf_feat_fwcap brcmf_fwcap_map[] = { { BRCMF_FEAT_MONITOR_FLAG, "rtap" }, { BRCMF_FEAT_MONITOR_FMT_RADIOTAP, "rtap" }, { BRCMF_FEAT_DOT11H, "802.11h" }, - { BRCMF_FEAT_SAE, "sae " }, + { BRCMF_FEAT_SAE, "sae" }, { BRCMF_FEAT_FWAUTH, "idauth" }, { BRCMF_FEAT_SAE_EXT, "sae_ext" }, - { BRCMF_FEAT_FBT, "fbt " }, + { BRCMF_FEAT_FBT, "fbt" }, { BRCMF_FEAT_OKC, "okc" }, };
@@ -230,11 +230,12 @@ static void brcmf_feat_iovar_data_set(struct brcmf_if *ifp,static void brcmf_feat_firmware_capabilities (struct brcmf_if *ifp) {struct brcmf_pub *drvr = ifp->drvr; -char caps[MAX_CAPS_BUFFER_SIZE ]; +char caps[MAX_CAPS_BUFFER_SIZE +1 ] = {}; +char *cap, *next = caps;enum brcmf_feat_id id;int i, err; - err =brcmf_fil_iovar_data_get (ifp,"cap" , caps,sizeof (caps)); + err =brcmf_fil_iovar_data_get (ifp,"cap" , caps,sizeof (caps) -1 );if (err) {bphy_err (drvr,"could not get firmware cap (%d)\n" , err);return ;
@@ -242,12 +243,17 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)brcmf_dbg (INFO ,"[ %s]\n" , caps); -for (i =0 ; i <ARRAY_SIZE (brcmf_fwcap_map); i++) { -if (strnstr (caps, brcmf_fwcap_map[i].fwcap_id,sizeof (caps))) { +while ((cap =strsep (&next," \t\r\n" )) !=NULL ) { +if (!*cap) +continue ; + +for (i =0 ; i <ARRAY_SIZE (brcmf_fwcap_map); i++) { +if (strcmp (cap, brcmf_fwcap_map[i].fwcap_id)) +continue ; id = brcmf_fwcap_map[i].feature;brcmf_dbg (INFO ,"enabling feature: %s\n" , brcmf_feat_names[id]); - ifp->drvr->feat_flags |=BIT (id); + drvr->feat_flags |=BIT (id); } } }
Signature · 1 line
2.55.0
Re: [PATCH 02/13] wifi: brcmfmac: Match complete firmware capability names
Quoted 11 lines · Michael Reeves
From: Michael Reeves <[email protected]>
BCM4388 firmware advertises "hp2p" without advertising "p2p". Substring matching incorrectly treats "hp2p" as P2P support, causing userspace to attempt Wi-Fi Direct interface creation that the firmware rejects.
Match complete whitespace-separated capability names instead. Remove the trailing-space workarounds for SAE and FBT and reserve a terminating byte outside the firmware response buffer.
Fixes ec64241c9fd2 ("brcmfmac: obtain feature info using 'cap' firmware command")
Regards,
Arend
Quoted 4 lines
Signed-off-by Michael Reeves <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
PATCH 3/13 wifi: brcmfmac: Fall back to RSSI-only default join preferences
In reply to Michael ReevesFrom: Michael Reeves <[email protected]>
BCM4388 firmware rejects the default join preference containing a 5 GHz RSSI boost with -EBADE, but accepts an RSSI-only preference.
Retry with RSSI-only selection only after -EBADE. Log other errors without retrying.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +4 -0
@@ -95,6 +95,10 @@ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp) join_pref_params[1 ].band =0 ; err =brcmf_fil_iovar_data_set (ifp,"join_pref" , join_pref_params,sizeof (join_pref_params)); +if (err == -EBADE ) + err =brcmf_fil_iovar_data_set (ifp,"join_pref" , + &join_pref_params[1 ], +sizeof (join_pref_params[1 ]));if (err)bphy_err (drvr,"Set join_pref error (%d)\n" , err); }
Signature · 1 line
2.55.0
Re: [PATCH 03/13] wifi: brcmfmac: Fall back to RSSI-only default join preferences
Quoted 8 lines · Michael Reeves
From: Michael Reeves <[email protected]>
BCM4388 firmware rejects the default join preference containing a 5 GHz RSSI boost with
-EBADE, but accepts an RSSI-only preference.Retry with RSSI-only selection only after
-EBADE. Log other errors without retrying.
Regards,
Arend
Quoted 4 lines
Signed-off-by Michael Reeves <[email protected]>--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 4 ++++ 1 file changed, 4 insertions(+)
PATCH 4/13 wifi: brcmfmac: Support newer PCIe core startup and interrupts
In reply to Michael ReevesFrom: Hector Martin <[email protected]>
Newer Broadcom chips, such as BCM4388, require changes to PCIe register access, watchdog reset, and RAM size detection. PCIe core revision 64 and higher uses a different BAR0 register window. ChipCommon revision 65 and higher requires a different watchdog reset sequence.
Update register access and reset for these revisions. Decode the SYSMEM bank counts according to the core revision and exclude ROM banks from RAM size calculation. Disable all detected D11 cores during CA7 setup and select H2D doorbells based on the firmware DAR flag.
In MSI mode, firmware can clear the mailbox interrupt status before the host reads it. Requiring a nonzero status can therefore discard valid interrupts. Process ring events without that requirement when MSI is enabled. Use release/acquire ordering on irq_ready to publish the initialized rings before the interrupt thread accesses them.
--- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 35 +++- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 197 ++++++++++++++++----- .../broadcom/brcm80211/include/chipcommon.h | 5 + 3 files changed, 183 insertions(+), 54 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +28 -7
@@ -162,6 +162,15 @@ struct sbconfig {#define SRCI_SRBSZ_SHIFT 0#define SR_BSZ_BASE 14 +#define SYSMEM_SRCI_ROMNB_MASK 0x3e0 +#define SYSMEM_SRCI_ROMNB_SHIFT 5 +#define SYSMEM_SRCI_SRNB_MASK 0x1f +#define SYSMEM_SRCI_SRNB_SHIFT 0 +#define SYSMEM_SRCI_NEW_ROMNB_MASK 0xff000000 +#define SYSMEM_SRCI_NEW_ROMNB_SHIFT 24 +#define SYSMEM_SRCI_NEW_SRNB_MASK 0x00ff0000 +#define SYSMEM_SRCI_NEW_SRNB_SHIFT 16 +struct sbsocramregs {u32 coreinfo;u32 bwalloc;
@@ -659,6 +668,7 @@ static u32 brcmf_chip_sysmem_ramsize(struct brcmf_core_priv *sysmem)u32 memsize =0 ;u32 coreinfo;u32 idx; +u32 nrb;u32 nb;u32 banksize;
@@ -666,10 +676,20 @@ static u32 brcmf_chip_sysmem_ramsize(struct brcmf_core_priv *sysmem)brcmf_chip_resetcore (&sysmem->pub,0 ,0 ,0 ); coreinfo =brcmf_chip_core_read32 (sysmem,SYSMEMREGOFFS (coreinfo)); - nb = (coreinfo &SRCI_SRNB_MASK ) >>SRCI_SRNB_SHIFT ; +if (sysmem->pub.rev >=12 ) { + nrb = (coreinfo &SYSMEM_SRCI_NEW_ROMNB_MASK ) >> +SYSMEM_SRCI_NEW_ROMNB_SHIFT ; + nb = (coreinfo &SYSMEM_SRCI_NEW_SRNB_MASK ) >> +SYSMEM_SRCI_NEW_SRNB_SHIFT ; + }else { + nrb = (coreinfo &SYSMEM_SRCI_ROMNB_MASK ) >> +SYSMEM_SRCI_ROMNB_SHIFT ; + nb = (coreinfo &SYSMEM_SRCI_SRNB_MASK ) >> +SYSMEM_SRCI_SRNB_SHIFT ; + }for (idx =0 ; idx < nb; idx++) { -brcmf_chip_socram_banksize (sysmem, idx, &banksize); +brcmf_chip_socram_banksize (sysmem, idx + nrb, &banksize); memsize += banksize; }
@@ -1353,14 +1373,15 @@ static inline void brcmf_chip_ca7_set_passive(struct brcmf_chip_priv *chip) {struct brcmf_core *core; +int i;brcmf_chip_disable_arm (chip,BCMA_CORE_ARM_CA7 ); - core =brcmf_chip_get_core (&chip->pub,BCMA_CORE_80211 ); -brcmf_chip_resetcore (core,D11_BCMA_IOCTL_PHYRESET | -D11_BCMA_IOCTL_PHYCLOCKEN , -D11_BCMA_IOCTL_PHYCLOCKEN , -D11_BCMA_IOCTL_PHYCLOCKEN ); +/* Leave all D11 cores disabled for the firmware to enable. */ +for (i =0 ; (core =brcmf_chip_get_d11core (&chip->pub, i)); i++) +brcmf_chip_coredisable (core,D11_BCMA_IOCTL_PHYRESET | +D11_BCMA_IOCTL_PHYCLOCKEN , +D11_BCMA_IOCTL_PHYCLOCKEN ); }static bool brcmf_chip_ca7_set_active (struct brcmf_chip_priv *chip,u32 rstvec)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +150 -47
348 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h +5 -0
@@ -302,6 +302,11 @@ struct chipcregs {#define PMU_RCTL_LOGIC_DISABLE_MASK (1 << 27) +#define CC_WD_SSRESET_PCIE_F0_EN 0x10000000 +#define CC_WD_SSRESET_PCIE_ALL_FN_EN 0x80000000 +#define CC_WD_COUNTER_MASK 0x0fffffff +#define CC_WD_ENABLE_MASK 0xf0000000 +/* * Maximum delay for the PMU state transition in us. * This is an upper bound intended for spinwaits etc.
Signature · 1 line
2.55.0
Re: [PATCH 04/13] wifi: brcmfmac: Support newer PCIe core startup and interrupts
Quoted 12 lines · Michael Reeves
From: Hector Martin <[email protected]>
Newer Broadcom chips, such as BCM4388, require changes to PCIe register access, watchdog reset, and RAM size detection. PCIe core revision 64 and higher uses a different BAR0 register window. ChipCommon revision 65 and higher requires a different watchdog reset sequence.
Update register access and reset for these revisions. Decode the SYSMEM bank counts according to the core revision and exclude ROM banks from RAM size calculation. Disable all detected D11 cores during CA7 setup and select H2D doorbells based on the firmware DAR flag.
Quoted 6 lines
In MSI mode, firmware can clear the mailbox interrupt status before the host reads it. Requiring a nonzero status can therefore discard valid interrupts. Process ring events without that requirement when MSI is enabled. Use release/acquire ordering on
irq_readyto publish the initialized rings before the interrupt thread accesses them.
Regards,
Arend
Quoted 8 lines
Signed-off-by Hector Martin <[email protected]>Co-developed-by Michael Reeves <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 35 +++- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 197 ++++++++++++++++----- .../broadcom/brcm80211/include/chipcommon.h | 5 + 3 files changed, 183 insertions(+), 54 deletions(-)
PATCH 5/13 wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
In reply to Michael ReevesFrom: Hector Martin <[email protected]>
Shared protocol version 6 and later allows mailbox messages over the control ring as an alternative to the shared-memory mailbox.
Advertise host capabilities using the negotiated shared protocol version. Select the control-ring transport when firmware does not set BRCMF_PCIE_SHARED_USE_MAILBOX, and dispatch received mailbox data through bus operations.
--- .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 9 +++ .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 57 +++++++++++++++ .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 5 ++ .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 83 ++++++++++++++++++---- 4 files changed, 139 insertions(+), 15 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +9 -0
@@ -86,6 +86,8 @@ struct brcmf_bus_dcmd {* @get_ramsize: obtain size of device memory. * @get_memdump: obtain device memory dump in provided buffer. * @get_blob: obtain a firmware blob. +* @d2h_mb_rx: handle device-to-host mailbox data received through a transport +* specific side channel. * @remove: initiate unbind of the device. * * This structure provides an abstract interface towards the
@@ -108,6 +110,7 @@ struct brcmf_bus_ops {void (*debugfs_create)(struct device *dev);int (*reset)(struct device *dev);void (*remove)(struct device *dev); +void (*d2h_mb_rx)(struct device *dev,u32 data); };
@@ -292,6 +295,12 @@ static inline void brcmf_bus_remove(struct brcmf_bus *bus) bus->ops->remove (bus->dev); } +static inline void brcmf_bus_d2h_mb_rx (struct brcmf_bus *bus,u32 data) +{ +if (bus->ops->d2h_mb_rx) + bus->ops->d2h_mb_rx (bus->dev, data); +} +/* * interface functions from common layer */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +57 -0
87 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h +5 -0
@@ -32,12 +32,17 @@ int brcmf_proto_msgbuf_rx_trigger(struct device *dev);void brcmf_msgbuf_delete_flowring (struct brcmf_pub *drvr,u16 flowid);int brcmf_proto_msgbuf_attach (struct brcmf_pub *drvr);void brcmf_proto_msgbuf_detach (struct brcmf_pub *drvr); +int brcmf_msgbuf_h2d_mb_write (struct brcmf_pub *drvr,u32 data);#else static inline int brcmf_proto_msgbuf_attach (struct brcmf_pub *drvr) {return 0 ; }static inline void brcmf_proto_msgbuf_detach (struct brcmf_pub *drvr) {} +static inline int brcmf_msgbuf_h2d_mb_write (struct brcmf_pub *drvr,u32 data) +{ +return -EOPNOTSUPP ; +}#endif #endif /* BRCMFMAC_MSGBUF_H */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +68 -15
147 lines not on this page · raw message
Signature · 1 line
2.55.0
Re: [PATCH 05/13] wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
Quoted 10 lines · Michael Reeves
From: Hector Martin <[email protected]>
Shared protocol version 6 and later allows mailbox messages over the control ring as an alternative to the shared-memory mailbox.
Advertise host capabilities using the negotiated shared protocol version. Select the control-ring transport when firmware does not set
BRCMF_PCIE_SHARED_USE_MAILBOX, and dispatch received mailbox data through bus operations.
Regards,
Arend
Quoted 9 lines
Signed-off-by Hector Martin <[email protected]>Co-developed-by Michael Reeves <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 9 +++ .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 57 +++++++++++++++ .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 5 ++ .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 83 ++++++++++++++++++---- 4 files changed, 139 insertions(+), 15 deletions(-)
Re: [PATCH 05/13] wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
Hi Michael,
I tested 01, 04 and 05 on a T2 Macbook Air 9,1 (BCM4377/4). IIRC should be the same chip as on T2 Macbook 15,4.
Arend, with the patch we get D3 ACK on s2idle and s3. So this basically renders the D3 ACK WoWL workaround patch obsolete, you recently acked. So it will suspend now without refusing d3cold transition, but BT is still dead on resume, which is a separate issue. Just mentioning...
Anyways Michael, the patch as acked now will fail on resume with
brcmf_pcie_send_mb_data: Failed to send H2D mailbox data (-5)
brcmf_pcie_pm_leave_D3() sends D0_INFORM while devinfo->state is still DOWN, hence we get an -EIO, so the driver falls back to remove and re-probe. The Asahi tree sets the state before D0_INFORM. With that change my 4377 resumes without reset.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +2 -1
@@ -2838,10 +2838,10 @@ static int brcmf_pcie_pm_leave_D3(struct device *dev)/* Check if device is still up and running, if so we are ready */ if (brcmf_pcie_read_pcie32 (devinfo, devinfo->reginfo->intmask) !=0 ) {brcmf_dbg (PCIE ,"Try to wakeup device....\n" ); + devinfo->state =BRCMFMAC_PCIE_STATE_UP ;if (brcmf_pcie_send_mb_data (devinfo,BRCMF_H2D_HOST_D0_INFORM )) goto cleanup;brcmf_dbg (PCIE ,"Hot resume, continue....\n" ); - devinfo->state =BRCMFMAC_PCIE_STATE_UP ;brcmf_pcie_select_core (devinfo,BCMA_CORE_PCIE2 );brcmf_bus_change_state (bus,BRCMF_BUS_UP );brcmf_pcie_intr_enable (devinfo);
@@ -2851,6 +2851,7 @@ static int brcmf_pcie_pm_leave_D3(struct device *dev) } cleanup: + devinfo->state =BRCMFMAC_PCIE_STATE_DOWN ;brcmf_chip_detach (devinfo->ci); devinfo->ci =NULL ; pdev = devinfo->pdev;
Feel free to fold it into v2, or I can send it as a follow-up if the series is already applied.
Andre
Arend van Spriel
maintainerRe: [PATCH 05/13] wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
Op 6 november 2026 15:36:19 schreef André Eikmeyer <[email protected]>:
Quoted 9 lines
Hi Michael,
I tested 01, 04 and 05 on a T2 Macbook Air 9,1 (BCM4377/4). IIRC should be the same chip as on T2 Macbook 15,4.
Arend, with the patch we get D3 ACK on s2idle and s3. So this basically renders the D3 ACK WoWL workaround patch obsolete, you recently acked. So it will suspend now without refusing d3cold transition, but BT is still dead on resume, which is a separate issue. Just mentioning...
Sorry, you lost me there. What is the relation between the patch in this subject and D3 ack.
Regards,
Arend
Re: [PATCH 05/13] wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
Quoted 2 lines · On Fri, 06 Nov 2026 18:36:52 +0100 Arend van Spriel…
Sorry, you lost me there. What is the relation between the patch in this subject and D3 ack.
Hi Arend,
D3_INFORM and D3_ACK are mailbox messages, and 05 changes how they are exchanged. Without 05 brcmfmac writes D3_INFORM to the TCM mailbox and our cursed Apple 4377 firmware on the 9,1 doesn't read it.
That is why I mentioned the D3 ACK timeout handling patch. I submitted that because I was sure the firmware wouldn't send it. But actually the transport was broken.
https://lore.kernel.org/all/[email protected]/
which was superseded by Sebastian's patch here:
So probably for addressing Sebastian's issue this needs to stay anyways. My memory served me wrong. I just read that his device is not an Apple product, but his patch incidentally worked around the same problem. Sorry if i was causing unneccessary noise.
Andre
Arend van Spriel
maintainerRe: [PATCH 05/13] wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
Op 6 november 2026 19:18:32 schreef André Eikmeyer <[email protected]>:
Quoted 18 lines
Quoted 2 lines · On Fri, 06 Nov 2026 18:36:52 +0100 Arend van Spriel…
Sorry, you lost me there. What is the relation between the patch in this subject and D3 ack.
Hi Arend,
D3_INFORMandD3_ACKare mailbox messages, and 05 changes how they are exchanged. Without 05 brcmfmac writesD3_INFORMto the TCM mailbox and our cursed Apple 4377 firmware on the 9,1 doesn't read it.That is why I mentioned the D3 ACK timeout handling patch. I submitted that because I was sure the firmware wouldn't send it. But actually the transport was broken.
Quoted 8 lines
which was superseded by Sebastian's patch here:
So probably for addressing Sebastian's issue this needs to stay anyways. My memory served me wrong. I just read that his device is not an Apple product, but his patch incidentally worked around the same problem. Sorry if i was causing unneccessary noise.
No problem. Thanks for helping me unclutter my head.
Regards,
Arend
Quoted 1 line
PATCH 6/13 wifi: brcmfmac: Load signed PCIe firmware images
In reply to Michael ReevesFrom: Hector Martin <[email protected]>
Signed PCIe firmware needs a signature and a memory map describing the image, signature, verification status, and bootloader heap.
Request an optional .sig file and write the signature and reverse-TLV metadata to device memory. Describe an aligned heap after the firmware image, keeping the metadata and end footer outside it. Require NVRAM for signed images and preserve their reset vector.
Request the IRQ before starting firmware on chips that use signatures, while keeping ring processing disabled until initialization completes.
--- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 267 ++++++++++++++++++--- 1 file changed, 233 insertions(+), 34 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +233 -34
@@ -80,6 +80,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.txt");/* per-board firmware binaries */ MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.bin" );MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.clm_blob" ); +MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.sig" );MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.txcap_blob" );static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
@@ -369,6 +370,9 @@ struct brcmf_pciedev_info {struct brcmf_mp_device *settings;struct brcmf_otp_params otp;bool fwseed; +char sig_name[BRCMF_FW_NAME_LEN ]; +u32 fw_size; +bool skip_reset_vector;#ifdef DEBUG u32 console_interval;bool console_active;
@@ -468,6 +472,7 @@ static void brcmf_pcie_setup(struct device *dev, int ret, struct brcmf_fw_request *fwreq);static struct brcmf_fw_request *brcmf_pcie_prepare_fw_request (struct brcmf_pciedev_info *devinfo); +static bool brcmf_pcie_request_fw_signature (struct brcmf_pciedev_info *devinfo);static void brcmf_pcie_fwcon_timer (struct brcmf_pciedev_info *devinfo,bool active);static void brcmf_pcie_debugfs_create (struct device *dev);
@@ -1828,26 +1833,174 @@ brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,return 0 ; } -struct brcmf_random_seed_footer { +struct brcmf_rtlv_footer {__le32 length;__le32 magic; }; +struct brcmf_fw_memmap_region { +__le32 start; +__le32 end; +}; + +struct brcmf_fw_memmap { +struct brcmf_fw_memmap_region reset_vec; +struct brcmf_fw_memmap_region int_vec; +struct brcmf_fw_memmap_region rom; +struct brcmf_fw_memmap_region mmap; +struct brcmf_fw_memmap_region vstatus; +struct brcmf_fw_memmap_region fw; +struct brcmf_fw_memmap_region sig; +struct brcmf_fw_memmap_region heap; +struct brcmf_fw_memmap_region stack; +struct brcmf_fw_memmap_region prng; +struct brcmf_fw_memmap_region nvram; +}; + +#define BRCMF_BL_HEAP_START_GAP 0x1000 +#define BRCMF_BL_HEAP_SIZE 0x10000#define BRCMF_RANDOM_SEED_MAGIC 0xfeedc0de#define BRCMF_RANDOM_SEED_LENGTH 0x100 +#define BRCMF_FW_SIG_MAGIC 0xfeedfe51 +#define BRCMF_MEMMAP_MAGIC 0xfeedfe53 +#define BRCMF_VSTATUS_MAGIC 0xfeedfe54 +#define BRCMF_VSTATUS_SIZE 0x28 +#define BRCMF_END_MAGIC 0xfeed0e2d + +static int brcmf_pcie_alloc_rtlv (struct brcmf_pciedev_info *devinfo, +u32 *address,u32 type,size_t length) +{ +struct brcmf_bus *bus =dev_get_drvdata (&devinfo->pdev->dev); +u32 fw_top = devinfo->ci->rambase + devinfo->fw_size; +u32 start_addr; +u32 length_field; +struct brcmf_rtlv_footer footer = { + .magic =cpu_to_le32 (type), + }; + +if (length >0xfffc ) +return -E2BIG ; + + length =ALIGN (length,4 ); +if (*address < length +sizeof (footer)) +return -ENOMEM ; + + start_addr = *address - length -sizeof (footer); +if (start_addr < fw_top) { +brcmf_err (bus,"failed to allocate rTLV type 0x%x len 0x%zx\n" , + type, length); +return -ENOMEM ; + } + +if (type ==BRCMF_RANDOM_SEED_MAGIC ) + length_field = length; +else + length_field = length | ((length ^0xffff ) <<16 ); + + footer.length =cpu_to_le32 (length_field); +memcpy_toio (devinfo->tcm + *address -sizeof (footer), &footer, +sizeof (footer)); + *address = start_addr; + +return 0 ; +} -static noinline_for_stack void -brcmf_pcie_provide_random_bytes (struct brcmf_pciedev_info *devinfo,u32 address) +static noinline_for_stack int +brcmf_pcie_add_random_seed (struct brcmf_pciedev_info *devinfo,u32 *address) {u8 randbuf[BRCMF_RANDOM_SEED_LENGTH ]; +int err; + + err =brcmf_pcie_alloc_rtlv (devinfo, address, +BRCMF_RANDOM_SEED_MAGIC , +BRCMF_RANDOM_SEED_LENGTH ); +if (err) +return err; +brcmf_dbg (PCIE ,"Download random seed\n" );get_random_bytes (randbuf,BRCMF_RANDOM_SEED_LENGTH ); -memcpy_toio (devinfo->tcm + address, randbuf,BRCMF_RANDOM_SEED_LENGTH ); +memcpy_toio (devinfo->tcm + *address, randbuf,BRCMF_RANDOM_SEED_LENGTH ); + +return 0 ; +} + +static int brcmf_pcie_add_signature (struct brcmf_pciedev_info *devinfo, +u32 *address, +const struct firmware *fwsig) +{ +struct brcmf_fw_memmap memmap = {}; +u32 sig_start, vstatus_start, fw_end, heap_start, heap_end; +int err; + +brcmf_dbg (PCIE ,"Download firmware signature\n" ); + + memmap.sig.end =cpu_to_le32 (*address); + err =brcmf_pcie_alloc_rtlv (devinfo, address,BRCMF_FW_SIG_MAGIC , + fwsig->size); +if (err) +return err; + sig_start = *address; + memmap.sig.start =cpu_to_le32 (sig_start); + + memmap.vstatus.end =cpu_to_le32 (*address); + err =brcmf_pcie_alloc_rtlv (devinfo, address,BRCMF_VSTATUS_MAGIC , +BRCMF_VSTATUS_SIZE ); +if (err) +return err; + vstatus_start = *address; + memmap.vstatus.start =cpu_to_le32 (vstatus_start); + + err =brcmf_pcie_alloc_rtlv (devinfo, address,BRCMF_MEMMAP_MAGIC , +sizeof (memmap)); +if (err) +return err; + + fw_end = devinfo->ci->rambase + devinfo->fw_size; + heap_start =ALIGN (fw_end +BRCMF_BL_HEAP_START_GAP ,4 ); + heap_end = heap_start +BRCMF_BL_HEAP_SIZE ; +if (heap_end > *address || + *address - heap_end <sizeof (struct brcmf_rtlv_footer )) +return -ENOMEM ; + + memmap.fw.start =cpu_to_le32 (devinfo->ci->rambase); + memmap.fw.end =cpu_to_le32 (fw_end); + memmap.heap.start =cpu_to_le32 (heap_start); + memmap.heap.end =cpu_to_le32 (heap_end); + +memcpy_toio (devinfo->tcm + sig_start, fwsig->data, fwsig->size); +memset_io (devinfo->tcm + vstatus_start,0 ,BRCMF_VSTATUS_SIZE ); +memcpy_toio (devinfo->tcm + *address, &memmap,sizeof (memmap)); + + err =brcmf_pcie_alloc_rtlv (devinfo, address,BRCMF_END_MAGIC ,0 ); +if (err) +return err; + + devinfo->skip_reset_vector = true; +return 0 ; +} + +static int brcmf_pcie_populate_footers (struct brcmf_pciedev_info *devinfo, +u32 *address, +const struct firmware *fwsig) +{ +int err; + +if (devinfo->fwseed) { + err =brcmf_pcie_add_random_seed (devinfo, address); +if (err) +return err; + } + +if (fwsig) +return brcmf_pcie_add_signature (devinfo, address, fwsig); + +return 0 ; }static int brcmf_pcie_download_fw_nvram (struct brcmf_pciedev_info *devinfo, -const struct firmware *fw,void *nvram, -u32 nvram_len) +const struct firmware *fw, +const struct firmware *fwsig, +void *nvram,u32 nvram_len) {struct brcmf_bus *bus =dev_get_drvdata (&devinfo->pdev->dev);u32 sharedram_addr;
@@ -1855,19 +2008,30 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,u32 loop_counter;int err;u32 address; +u32 free_start;u32 resetintr; + devinfo->skip_reset_vector = false; + +if (fwsig && !nvram) { +brcmf_err (bus,"NVRAM required for signed firmware\n" ); + err = -ENOENT ; + goto fail; + } +brcmf_dbg (PCIE ,"Halt ARM.\n" ); err =brcmf_pcie_enter_download_state (devinfo);if (err) -return err; + goto fail;brcmf_dbg (PCIE ,"Download FW %s\n" , devinfo->fw_name);memcpy_toio (devinfo->tcm + devinfo->ci->rambase, (void *)fw->data, fw->size); resetintr =get_unaligned_le32 (fw->data); + devinfo->fw_size = fw->size;release_firmware (fw); + fw =NULL ;/* reset last 4 bytes of RAM address. to be used for shared * area. This identifies when FW is running
@@ -1880,30 +2044,22 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, nvram_len;memcpy_toio (devinfo->tcm + address, nvram, nvram_len);brcmf_fw_nvram_free (nvram); + nvram =NULL ; -if (devinfo->fwseed) { -size_t rand_len =BRCMF_RANDOM_SEED_LENGTH ; -struct brcmf_random_seed_footer footer = { - .length =cpu_to_le32 (rand_len), - .magic =cpu_to_le32 (BRCMF_RANDOM_SEED_MAGIC ), - }; - -/* Some chips/firmwares expect a buffer of random -* data to be present before NVRAM -*/ -brcmf_dbg (PCIE ,"Download random seed\n" ); - - address -=sizeof (footer); -memcpy_toio (devinfo->tcm + address, &footer, -sizeof (footer)); + err =brcmf_pcie_populate_footers (devinfo, &address, fwsig); +if (err) + goto fail; - address -= rand_len; -brcmf_pcie_provide_random_bytes (devinfo, address); - } + free_start = devinfo->ci->rambase + devinfo->fw_size; +if ((devinfo->fwseed || fwsig) && address > free_start) +memset_io (devinfo->tcm + free_start,0 , + address - free_start); }else {brcmf_dbg (PCIE ,"No matching NVRAM file found %s\n" , devinfo->nvram_name); } +release_firmware (fwsig); + fwsig =NULL ; sharedram_addr_written = brcmf_pcie_read_ram32(devinfo, devinfo->ci->ramsize -
@@ -1911,7 +2067,7 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,brcmf_dbg (PCIE ,"Bring ARM in running state\n" ); err =brcmf_pcie_exit_download_state (devinfo, resetintr);if (err) -return err; + goto fail;brcmf_dbg (PCIE ,"Wait for FW init\n" ); sharedram_addr = sharedram_addr_written;
@@ -1925,17 +2081,25 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, }if (sharedram_addr == sharedram_addr_written) {brcmf_err (bus,"FW failed to initialize\n" ); -return -ENODEV ; + err = -ENODEV ; + goto fail; }if (sharedram_addr < devinfo->ci->rambase || sharedram_addr >= devinfo->ci->rambase + devinfo->ci->ramsize) {brcmf_err (bus,"Invalid shared RAM address 0x%08x\n" , sharedram_addr); -return -ENODEV ; + err = -ENODEV ; + goto fail; }brcmf_dbg (PCIE ,"Shared RAM addr: 0x%08x\n" , sharedram_addr);return (brcmf_pcie_init_share_ram_info (devinfo, sharedram_addr)); + +fail: +release_firmware (fw); +release_firmware (fwsig); +brcmf_fw_nvram_free (nvram); +return err; }
@@ -2061,7 +2225,8 @@ static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip, {struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx; -brcmf_pcie_write_tcm32 (devinfo,0 , rstvec); +if (!devinfo->skip_reset_vector) +brcmf_pcie_write_tcm32 (devinfo,0 , rstvec); }
@@ -2290,11 +2455,18 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)#define BRCMF_PCIE_FW_NVRAM 1#define BRCMF_PCIE_FW_CLM 2#define BRCMF_PCIE_FW_TXCAP 3 +#define BRCMF_PCIE_FW_SIG 4 + +static bool brcmf_pcie_request_fw_signature (struct brcmf_pciedev_info *devinfo) +{ +return false; +}static void brcmf_pcie_setup (struct device *dev,int ret,struct brcmf_fw_request *fwreq) {const struct firmware *fw; +const struct firmware *fwsig =NULL ;void *nvram;struct brcmf_bus *bus;struct brcmf_pciedev *pcie_bus_dev;
@@ -2313,6 +2485,8 @@ static void brcmf_pcie_setup(struct device *dev, int ret,brcmf_pcie_attach (devinfo); fw = fwreq->items[BRCMF_PCIE_FW_CODE ].binary; +if (fwreq->n_items >BRCMF_PCIE_FW_SIG ) + fwsig = fwreq->items[BRCMF_PCIE_FW_SIG ].binary; nvram = fwreq->items[BRCMF_PCIE_FW_NVRAM ].nv_data.data; nvram_len = fwreq->items[BRCMF_PCIE_FW_NVRAM ].nv_data.len; devinfo->clm_fw = fwreq->items[BRCMF_PCIE_FW_CLM ].binary;
@@ -2323,6 +2497,7 @@ static void brcmf_pcie_setup(struct device *dev, int ret,if (ret) {brcmf_err (bus,"Failed to get RAM info\n" );release_firmware (fw); +release_firmware (fwsig);brcmf_fw_nvram_free (nvram); goto fail; }
@@ -2334,7 +2509,19 @@ static void brcmf_pcie_setup(struct device *dev, int ret,*/ brcmf_pcie_adjust_ramsize (devinfo, (u8 *)fw->data, fw->size); - ret =brcmf_pcie_download_fw_nvram (devinfo, fw, nvram, nvram_len); +if (brcmf_pcie_request_fw_signature (devinfo)) { +brcmf_pcie_select_core (devinfo,BCMA_CORE_PCIE2 ); + ret =brcmf_pcie_request_irq (devinfo); +if (ret) { +release_firmware (fw); +release_firmware (fwsig); +brcmf_fw_nvram_free (nvram); + goto fail; + } + } + + ret =brcmf_pcie_download_fw_nvram (devinfo, fw, fwsig, nvram, + nvram_len);if (ret) goto fail;
@@ -2349,9 +2536,11 @@ static void brcmf_pcie_setup(struct device *dev, int ret, goto fail;brcmf_pcie_select_core (devinfo,BCMA_CORE_PCIE2 ); - ret =brcmf_pcie_request_irq (devinfo); -if (ret) - goto fail; +if (!devinfo->irq_allocated) { + ret =brcmf_pcie_request_irq (devinfo); +if (ret) + goto fail; + }/* hook the commonrings in the bus structure. */ for (i =0 ; i <BRCMF_NROF_COMMON_MSGRINGS ; i++)
@@ -2393,17 +2582,23 @@ static struct brcmf_fw_request * brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) {struct brcmf_fw_request *fwreq; +u32 n_fwnames;struct brcmf_fw_name fwnames[] = { {".bin" , devinfo->fw_name }, {".txt" , devinfo->nvram_name }, {".clm_blob" , devinfo->clm_name }, {".txcap_blob" , devinfo->txcap_name }, + {".sig" , devinfo->sig_name }, }; + n_fwnames =ARRAY_SIZE (fwnames); +if (!brcmf_pcie_request_fw_signature (devinfo)) + n_fwnames--; + fwreq =brcmf_fw_alloc_request (devinfo->ci->chip, devinfo->ci->chiprev, brcmf_pcie_fwnames,ARRAY_SIZE (brcmf_pcie_fwnames), - fwnames,ARRAY_SIZE (fwnames)); + fwnames, n_fwnames);if (!fwreq)return NULL ;
@@ -2414,6 +2609,10 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) fwreq->items[BRCMF_PCIE_FW_CLM ].flags =BRCMF_FW_REQF_OPTIONAL ; fwreq->items[BRCMF_PCIE_FW_TXCAP ].type =BRCMF_FW_TYPE_BINARY ; fwreq->items[BRCMF_PCIE_FW_TXCAP ].flags =BRCMF_FW_REQF_OPTIONAL ; +if (fwreq->n_items >BRCMF_PCIE_FW_SIG ) { + fwreq->items[BRCMF_PCIE_FW_SIG ].type =BRCMF_FW_TYPE_BINARY ; + fwreq->items[BRCMF_PCIE_FW_SIG ].flags =BRCMF_FW_REQF_OPTIONAL ; + }/* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ fwreq->domain_nr =pci_domain_nr (devinfo->pdev->bus) +1 ; fwreq->bus_nr = devinfo->pdev->bus->number;
Signature · 1 line
2.55.0
Re: [PATCH 06/13] wifi: brcmfmac: Load signed PCIe firmware images
Quoted 5 lines · Michael Reeves
From: Hector Martin <[email protected]>
Signed PCIe firmware needs a signature and a memory map describing the image, signature, verification status, and bootloader heap.
Quoted 8 lines
Request an optional .sig file and write the signature and reverse-TLV metadata to device memory. Describe an aligned heap after the firmware image, keeping the metadata and end footer outside it. Require NVRAM for signed images and preserve their reset vector.
Request the IRQ before starting firmware on chips that use signatures, while keeping ring processing disabled until initialization completes.
Regards,
Arend
Quoted 8 lines
Signed-off-by Hector Martin <[email protected]>Co-developed-by Daniel Berlin <[email protected]>Signed-off-by Daniel Berlin <[email protected]>Co-developed-by Michael Reeves <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 267 ++++++++++++++++++--- 1 file changed, 233 insertions(+), 34 deletions(-)
PATCH 7/13 wifi: brcmfmac: Use event_msgs_ext for event masks
In reply to Michael ReevesFrom: Michael Reeves <[email protected]>
BCM4388 firmware rejects the legacy event_msgs query during preinit but supports the structured event_msgs_ext command.
Probe event_msgs_ext during feature detection and initialize the event mask after feature flags are set. Use the extended command when supported and retain the legacy path otherwise.
--- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 23 ---- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 39 +++++++ .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 2 + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 130 ++++++++++++++++++++- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 1 + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 26 +++++ 7 files changed, 199 insertions(+), 27 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +0 -23
@@ -269,7 +269,6 @@ static int brcmf_c_process_cal_blob(struct brcmf_if *ifp)int brcmf_c_preinit_dcmds (struct brcmf_if *ifp) {struct brcmf_pub *drvr = ifp->drvr; -struct brcmf_fweh_info *fweh = drvr->fweh;u8 buf[BRCMF_DCMD_SMLEN ];struct brcmf_bus *bus;struct brcmf_rev_info_le revinfo;
@@ -415,27 +414,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)brcmf_c_set_joinpref_default (ifp); -/* Setup event_msgs, enable E_IF */ - err =brcmf_fil_iovar_data_get (ifp,"event_msgs" , fweh->event_mask, - fweh->event_mask_len); -if (err) { -bphy_err (drvr,"Get event_msgs error (%d)\n" , err); - goto done; - } -/* -* BRCMF_E_IF can safely be used to set the appropriate bit -* in the event_mask as the firmware event code is guaranteed -* to match the value of BRCMF_E_IF because it is old cruft -* that all vendors have. -*/ -setbit (fweh->event_mask,BRCMF_E_IF ); - err =brcmf_fil_iovar_data_set (ifp,"event_msgs" , fweh->event_mask, - fweh->event_mask_len); -if (err) { -bphy_err (drvr,"Set event_msgs error (%d)\n" , err); - goto done; - } -/* Setup default scan channel time */ err =brcmf_fil_cmd_int_set (ifp,BRCMF_C_SET_SCAN_CHANNEL_TIME ,BRCMF_DEFAULT_SCAN_CHANNEL_TIME );
@@ -637,4 +615,3 @@ static void __exit brcmfmac_module_exit(void)module_init (brcmfmac_module_init);module_exit (brcmfmac_module_exit); -
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +4 -1
@@ -1260,6 +1260,10 @@ static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)brcmf_feat_attach (drvr); + ret =brcmf_fweh_init_events (ifp); +if (ret <0 ) + goto fail; + ret =brcmf_proto_init_done (drvr);if (ret <0 ) goto fail;
@@ -1613,4 +1617,3 @@ void __exit brcmf_core_exit(void)brcmf_usb_exit ();brcmf_pcie_exit (); } -
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +39 -0
@@ -5,6 +5,7 @@#include <linux/netdevice.h> #include <linux/module.h> +#include <linux/slab.h> #include <brcm_hw_ids.h> #include <brcmu_wifi.h>
@@ -226,6 +227,43 @@ static void brcmf_feat_iovar_data_set(struct brcmf_if *ifp, ifp->fwil_fwerr = false; } +static void brcmf_feat_event_msgs_ext (struct brcmf_if *ifp) +{ +struct brcmf_pub *drvr = ifp->drvr; +struct brcmf_fweh_info *fweh = drvr->fweh; +struct brcmf_eventmsgs_ext_le *eventmsgs; +size_t size; +int err; + +if (!fweh || fweh->event_mask_len >0xff ) +return ; + + size =struct_size (eventmsgs, mask, fweh->event_mask_len); + eventmsgs =kzalloc (size,GFP_KERNEL ); +if (!eventmsgs) +return ; + + eventmsgs->version =EVENTMSGS_VER ; + eventmsgs->command =EVENTMSGS_NONE ; + eventmsgs->len = fweh->event_mask_len; + eventmsgs->maxgetsize = fweh->event_mask_len; + + ifp->fwil_fwerr = true; + err =brcmf_fil_iovar_data_get (ifp,"event_msgs_ext" , eventmsgs, size); + ifp->fwil_fwerr = false; + +if (!err) { +brcmf_dbg (INFO ,"enabling feature: %s\n" , + brcmf_feat_names[BRCMF_FEAT_EVENT_MSGS_EXT ]); + drvr->feat_flags |=BIT (BRCMF_FEAT_EVENT_MSGS_EXT ); + }else { +brcmf_dbg (TRACE ,"%s feature check failed: %d\n" , + brcmf_feat_names[BRCMF_FEAT_EVENT_MSGS_EXT ], err); + } + +kfree (eventmsgs); +} +#define MAX_CAPS_BUFFER_SIZE 768static void brcmf_feat_firmware_capabilities (struct brcmf_if *ifp) {
@@ -348,6 +386,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_FWSUP ,"sup_wpa" );brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_SCAN_V2 ,"scan_ver" ); +brcmf_feat_event_msgs_ext (ifp);brcmf_feat_wlc_version_overrides (drvr);brcmf_feat_firmware_overrides (drvr);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +2 -0
@@ -31,6 +31,7 @@* FWAUTH: Firmware authenticator * DUMP_OBSS: Firmware has capable to dump obss info to support ACS * SCAN_V2: Version 2 scan params +* EVENT_MSGS_EXT: Firmware supports event_msgs_ext for event masks * SAE_EXT: SAE authentication handled by user-space supplicant */ #define BRCMF_FEAT_LIST \
@@ -59,6 +60,7 @@ BRCMF_FEAT_DEF(SCAN_V2) \ BRCMF_FEAT_DEF(PMKID_V2) \ BRCMF_FEAT_DEF(PMKID_V3) \ + BRCMF_FEAT_DEF(EVENT_MSGS_EXT) \ BRCMF_FEAT_DEF(SAE_EXT) \ BRCMF_FEAT_DEF(FBT) \ BRCMF_FEAT_DEF(OKC)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +127 -3
156 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +1 -0
@@ -356,6 +356,7 @@ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, void *data));void brcmf_fweh_unregister (struct brcmf_pub *drvr,enum brcmf_fweh_event_code code); +int brcmf_fweh_init_events (struct brcmf_if *ifp);int brcmf_fweh_activate_events (struct brcmf_if *ifp); void brcmf_fweh_process_event(struct brcmf_pub *drvr, struct brcmf_event *event_packet,
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +26 -0
@@ -1236,4 +1236,30 @@ struct brcmf_mkeep_alive_pkt_le {u8 data[]; } __packed; +enum event_msgs_ext_command { +EVENTMSGS_NONE =0 , +EVENTMSGS_SET_BIT =1 , +EVENTMSGS_RESET_BIT =2 , +EVENTMSGS_SET_MASK =3 , +}; + +#define EVENTMSGS_VER 1 + +/** +* struct brcmf_eventmsgs_ext_le - event_msgs_ext iovar data +* +* @version: structure version. +* @command: requested operation. +* @len: mask size for set, actual firmware mask size for get. +* @maxgetsize: maximum mask size that may be returned by firmware. +* @mask: event mask. +*/ +struct brcmf_eventmsgs_ext_le { +u8 version; +u8 command; +u8 len; +u8 maxgetsize; + u8 mask[] __counted_by(len); +}; +#endif /* FWIL_TYPES_H_ */
Signature · 1 line
2.55.0
Re: [PATCH 07/13] wifi: brcmfmac: Use event_msgs_ext for event masks
Quoted 9 lines · Michael Reeves
From: Michael Reeves <[email protected]>
BCM4388 firmware rejects the legacy
event_msgsquery during preinit but supports the structuredevent_msgs_extcommand.Probe
event_msgs_extduring feature detection and initialize the event mask after feature flags are set. Use the extended command when supported and retain the legacy path otherwise.
Regards,
Arend
Quoted 12 lines
Co-developed-by Hector Martin <[email protected]>Signed-off-by Hector Martin <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 23 ---- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 39 +++++++ .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 2 + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 130 ++++++++++++++++++++- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 1 + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 26 +++++ 7 files changed, 199 insertions(+), 27 deletions(-)
PATCH 8/13 wifi: brcmfmac: Handle larger firmware band lists
In reply to Michael ReevesFrom: Michael Reeves <[email protected]>
Some firmware returns more than two entries from BRCMF_C_GET_BANDLIST. The fixed two-band response buffer cannot accommodate these lists.
Use a larger bounded buffer and register only the 2.4 GHz and 5 GHz bands handled by this driver path. Ignore duplicate or unknown entries so they do not prevent wiphy setup. Skip unsupported bands in chanspec lists and scan results before decoding channels.
--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 48 +++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +43 -5
@@ -105,6 +105,8 @@#define BRCMF_MAX_CHANSPEC_LIST \ (BRCMF_DCMD_MEDLEN / sizeof(__le32) - 1) +#define BRCMF_MAX_BANDLIST_ENTRIES 16 +struct brcmf_dump_survey {u32 obss;u32 ibss;
@@ -3385,6 +3387,17 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,return err; } +static bool brcmf_chanspec_supported (struct brcmf_cfg80211_info *cfg,u16 chanspec) +{ +u16 band = chanspec &BRCMU_CHSPEC_D11AC_BND_MASK ; + +if (cfg->d11inf.io_type !=BRCMU_D11AC_IOTYPE ) +return true; + +return band ==BRCMU_CHSPEC_D11AC_BND_2G || + band ==BRCMU_CHSPEC_D11AC_BND_5G ; +} +static s32 brcmf_inform_single_bss (struct brcmf_cfg80211_info *cfg,struct brcmf_bss_info_le *bi) {
@@ -3406,6 +3419,9 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,return -EINVAL ; } +if (!brcmf_chanspec_supported (cfg,le16_to_cpu (bi->chanspec))) +return 0 ; +if (!bi->ctl_ch) { ch.chspec =le16_to_cpu (bi->chanspec); cfg->d11inf.decchspec (&ch);
@@ -7163,6 +7179,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,for (i =0 ; i < total; i++) { ch.chspec = (u16 )le32_to_cpu (list->element[i]); +if (!brcmf_chanspec_supported (cfg, ch.chspec)) +continue ; cfg->d11inf.decchspec (&ch);if (ch.band ==BRCMU_CHAN_BAND_2G ) {
@@ -7764,7 +7782,7 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)struct ieee80211_supported_band *band;u16 max_interfaces =0 ;bool gscan; -__le32 bandlist[3 ]; +__le32 bandlist[BRCMF_MAX_BANDLIST_ENTRIES ];u32 n_bands;int err, i;
@@ -7856,8 +7874,20 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp) }/* first entry in bandlist is number of bands */ n_bands =le32_to_cpu (bandlist[0 ]); -for (i =1 ; i <= n_bands && i <ARRAY_SIZE (bandlist); i++) { -if (bandlist[i] ==cpu_to_le32 (WLC_BAND_2G )) { +if (n_bands >=ARRAY_SIZE (bandlist)) { +brcmf_dbg (INFO ,"bandlist count %u exceeds buffer entries %zu\n" , + n_bands,ARRAY_SIZE (bandlist) -1 ); + n_bands =ARRAY_SIZE (bandlist) -1 ; + } + +for (i =1 ; i <= n_bands; i++) { +u32 band_id =le32_to_cpu (bandlist[i]); + +switch (band_id) { +case WLC_BAND_2G : +if (wiphy->bands[NL80211_BAND_2GHZ ]) +break ; + band =kmemdup (&__wl_band_2ghz,sizeof (__wl_band_2ghz),GFP_KERNEL );if (!band)
@@ -7873,8 +7903,11 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp) band->n_channels =ARRAY_SIZE (__wl_2ghz_channels); wiphy->bands[NL80211_BAND_2GHZ ] = band; - } -if (bandlist[i] ==cpu_to_le32 (WLC_BAND_5G )) { +break ; +case WLC_BAND_5G : +if (wiphy->bands[NL80211_BAND_5GHZ ]) +break ; + band =kmemdup (&__wl_band_5ghz,sizeof (__wl_band_5ghz),GFP_KERNEL );if (!band)
@@ -7890,6 +7923,11 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp) band->n_channels =ARRAY_SIZE (__wl_5ghz_channels); wiphy->bands[NL80211_BAND_5GHZ ] = band; +break ; +default : +brcmf_dbg (INFO ,"ignoring unsupported band %u\n" , + band_id); +break ; } }
Signature · 1 line
2.55.0
Re: [PATCH 08/13] wifi: brcmfmac: Handle larger firmware band lists
Quoted 10 lines · Michael Reeves
From: Michael Reeves <[email protected]>
Some firmware returns more than two entries from
BRCMF_C_GET_BANDLIST. The fixed two-band response buffer cannot accommodate these lists.Use a larger bounded buffer and register only the 2.4 GHz and 5 GHz bands handled by this driver path. Ignore duplicate or unknown entries so they do not prevent wiphy setup. Skip unsupported bands in chanspec lists and scan results before decoding channels.
Regards,
Arend
Quoted 6 lines
Co-developed-by Hector Martin <[email protected]>Signed-off-by Hector Martin <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 48 +++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-)
PATCH 9/13 wifi: brcmfmac: Accept newer BSS information versions
In reply to Michael ReevesFrom: Hector Martin <[email protected]>
The driver accepts only BSS information version 109, rejecting scan results with newer versions even though the common fields used for reporting remain compatible.
Accept versions 109 through 112 when reporting scan results.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +3 -2
@@ -3484,8 +3484,9 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg) bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;if (bss_list->count !=0 && - bss_list->version !=BRCMF_BSS_INFO_VERSION ) { -bphy_err (drvr,"Version %d != WL_BSS_INFO_VERSION\n" , + (bss_list->version <BRCMF_BSS_INFO_MIN_VERSION || + bss_list->version >BRCMF_BSS_INFO_MAX_VERSION )) { +bphy_err (drvr,"BSS info version %d unsupported\n" , bss_list->version);return -EOPNOTSUPP ; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +2 -1
@@ -18,7 +18,8 @@#define BRCMF_ARP_OL_HOST_AUTO_REPLY 0x00000004#define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 -#define BRCMF_BSS_INFO_VERSION 109/* curr ver of brcmf_bss_info_le struct */ +#define BRCMF_BSS_INFO_MIN_VERSION 109 +#define BRCMF_BSS_INFO_MAX_VERSION 112#define BRCMF_BSS_RSSI_ON_CHANNEL 0x0004#define BRCMF_STA_BRCM 0x00000001/* Running a Broadcom driver */
Signature · 1 line
2.55.0
Re: [PATCH 09/13] wifi: brcmfmac: Accept newer BSS information versions
Quoted 8 lines · Michael Reeves
From: Hector Martin <[email protected]>
The driver accepts only BSS information version 109, rejecting scan results with newer versions even though the common fields used for reporting remain compatible.
Accept versions 109 through 112 when reporting scan results.
Regards,
Arend
Quoted 6 lines
Signed-off-by Hector Martin <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
PATCH 10/13 wifi: brcmfmac: Support versioned scan parameter layouts
In reply to Michael ReevesFrom: Daniel Berlin <[email protected]>
Newer firmware uses scan parameter layouts with version headers, wider scan flags, and additional fields. Requests must match the layout expected by firmware.
Select builders for versions 1 through 4 from the scan_ver response and use the selected layout for both scan requests and aborts. Fall back to version 1 when version discovery is unavailable.
--- .../wireless/broadcom/brcm80211/brcmfmac/Makefile | 1 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 203 ++-------- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 17 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 46 ++- .../broadcom/brcm80211/brcmfmac/fwil_types.h | 65 ++++ .../broadcom/brcm80211/brcmfmac/scan_param.c | 416 +++++++++++++++++++++ .../broadcom/brcm80211/brcmfmac/scan_param.h | 13 + 7 files changed, 594 insertions(+), 167 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile +1 -0
@@ -25,6 +25,7 @@ brcmfmac-objs += \ btcoex.o \ vendor.o \ pno.o \ + scan_param.o \ xtlv.o brcmfmac-$(CONFIG_BRCMFMAC_PROTO_BCDC) += \ bcdc.o \
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +37 -166
254 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +17 -0
@@ -97,6 +97,22 @@ struct brcmf_rev_info {u32 nvramrev; }; +struct brcmf_cfg80211_info ; +struct cfg80211_scan_request ; + +/** +* struct scan_param_struct_handler - firmware scan parameter operations. +* +* @version: scan parameter version used by firmware. +* @get_struct_for_request: build a scan parameter structure for @request. +*/ +struct scan_param_struct_handler { +u8 version; +void *(*get_struct_for_request)(struct brcmf_cfg80211_info *cfg, +u32 *struct_size, +struct cfg80211_scan_request *request); +}; +/* Common structure for module and instance linkage */ struct brcmf_pub {/* Linkage ponters */
@@ -145,6 +161,7 @@ struct brcmf_pub {u8 sta_mac_idx;const struct brcmf_fwvid_ops *vops;void *vdata; +struct scan_param_struct_handler scan_param_handler; };/* forward declarations */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +45 -1
70 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +65 -0
95 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/scan_param.c new file +416 -0
416 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/scan_param.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: ISC */ +/* +* Copyright (c) 2023 Daniel Berlin +*/ + +#ifndef _BRCMF_SCAN_PARAM_H +#define _BRCMF_SCAN_PARAM_H + +struct brcmf_pub ; + +int brcmf_scan_param_setup_for_version (struct brcmf_pub *drvr,u32 version); + +#endif /* _BRCMF_SCAN_PARAM_H */
Signature · 1 line
2.55.0
Re: [PATCH 10/13] wifi: brcmfmac: Support versioned scan parameter layouts
Quoted 10 lines · Michael Reeves
From: Daniel Berlin <[email protected]>
Newer firmware uses scan parameter layouts with version headers, wider scan flags, and additional fields. Requests must match the layout expected by firmware.
Select builders for versions 1 through 4 from the
scan_verresponse and use the selected layout for both scan requests and aborts. Fall back to version 1 when version discovery is unavailable.
Regards,
Arend
Quoted 14 lines
Signed-off-by Daniel Berlin <[email protected]>Co-developed-by Hector Martin <[email protected]>Signed-off-by Hector Martin <[email protected]>Co-developed-by Michael Reeves <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/Makefile | 1 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 203 ++-------- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 17 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 46 ++- .../broadcom/brcm80211/brcmfmac/fwil_types.h | 65 ++++ .../broadcom/brcm80211/brcmfmac/scan_param.c | 416 +++++++++++++++++++++ .../broadcom/brcm80211/brcmfmac/scan_param.h | 13 + 7 files changed, 594 insertions(+), 167 deletions(-)
PATCH 11/13 wifi: brcmfmac: Support versioned join requests
In reply to Michael ReevesFrom: Hector Martin <[email protected]>
Newer firmware uses version 1 join and association structures with explicit version headers.
Query join_ver and build version 1 requests when required. Retain legacy layouts for older firmware and fall back to BRCMF_C_SET_SSID when the join iovar returns -EBADE. Use the selected association layout for IBSS joins too. Report unsupported join versions rather than guessing their request layout.
--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 73 +++++++++++++++++++--- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 19 ++++++ .../broadcom/brcm80211/brcmfmac/fwil_types.h | 29 +++++++++ 4 files changed, 113 insertions(+), 9 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +64 -9
@@ -1653,6 +1653,36 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason,brcmf_dbg (TRACE ,"Exit\n" ); } +static int brcmf_set_ssid (struct brcmf_if *ifp, +const struct brcmf_join_params *legacy,size_t legacy_size) +{ +struct brcmf_join_params_v1_le *params; +u32 count =le32_to_cpu (legacy->params_le.chanspec_num); +size_t size; +int err; + +if (!ifp->drvr->join_version) +return brcmf_fil_cmd_data_set (ifp,BRCMF_C_SET_SSID , + (void *)legacy, legacy_size); +if (ifp->drvr->join_version !=1 ) +return -EOPNOTSUPP ; + + size =struct_size (params, assoc_le.chanspec_list, count); + params =kzalloc (size,GFP_KERNEL ); +if (!params) +return -ENOMEM ; + + params->ssid_le = legacy->ssid_le; + params->assoc_le.version =cpu_to_le16 (1 ); +ether_addr_copy (params->assoc_le.bssid, legacy->params_le.bssid); + params->assoc_le.chanspec_num = legacy->params_le.chanspec_num; +memcpy (params->assoc_le.chanspec_list, legacy->params_le.chanspec_list, + count *sizeof (__le16)); + err =brcmf_fil_cmd_data_set (ifp,BRCMF_C_SET_SSID , params, size); +kfree (params); +return err; +} +static s32 brcmf_cfg80211_join_ibss (struct wiphy *wiphy,struct net_device *ndev,struct cfg80211_ibss_params *params)
@@ -1791,8 +1821,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, cfg->ibss_starter = false; - err =brcmf_fil_cmd_data_set (ifp,BRCMF_C_SET_SSID , - &join_params, join_params_size); + err =brcmf_set_ssid (ifp, &join_params, join_params_size);if (err) {bphy_err (drvr,"WLC_SET_SSID failed (%d)\n" , err); goto done;
@@ -2281,6 +2310,30 @@ static void brcmf_set_join_pref(struct brcmf_if *ifp,bphy_err (drvr,"Set join_pref error (%d)\n" , err); } +static int brcmf_join_v1 (struct brcmf_if *ifp, +const struct brcmf_ext_join_params_le *legacy) +{ +struct brcmf_ext_join_params_v1_le *params; +u32 count =le32_to_cpu (legacy->assoc_le.chanspec_num); +size_t size =struct_size (params, assoc_le.chanspec_list, count); +int err; + + params =kzalloc (size,GFP_KERNEL ); +if (!params) +return -ENOMEM ; + params->version =cpu_to_le16 (1 ); + params->ssid_le = legacy->ssid_le; + params->scan_le = legacy->scan_le; + params->assoc_le.version =cpu_to_le16 (1 ); +ether_addr_copy (params->assoc_le.bssid, legacy->assoc_le.bssid); + params->assoc_le.chanspec_num = legacy->assoc_le.chanspec_num; +memcpy (params->assoc_le.chanspec_list, legacy->assoc_le.chanspec_list, + count *sizeof (__le16)); + err =brcmf_fil_bsscfg_data_set (ifp,"join" , params, size); +kfree (params); +return err; +} +static s32 brcmf_cfg80211_connect (struct wiphy *wiphy,struct net_device *ndev,struct cfg80211_connect_params *sme)
@@ -2302,6 +2355,8 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,u32 ssid_len;brcmf_dbg (TRACE ,"Enter\n" ); +if (drvr->join_version >1 ) +return -EOPNOTSUPP ;if (!check_vif_up (ifp->vif))return -EIO ;
@@ -2492,14 +2547,15 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,brcmf_set_join_pref (ifp, &sme->bss_select); - err =brcmf_fil_bsscfg_data_set (ifp,"join" , ext_join_params, - join_params_size); +if (ifp->drvr->join_version ==1 ) + err =brcmf_join_v1 (ifp, ext_join_params); +else + err =brcmf_fil_bsscfg_data_set (ifp,"join" , ext_join_params, + join_params_size);kfree (ext_join_params); -if (!err) -/* This is it. join command worked, we are done */ +if (err != -EBADE ) goto done; -/* join command failed, fallback to set ssid */ memset (&join_params,0 ,sizeof (join_params)); join_params_size =sizeof (join_params.ssid_le);
@@ -2516,8 +2572,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, join_params.params_le.chanspec_num =cpu_to_le32 (1 ); join_params_size +=sizeof (join_params.params_le); } - err =brcmf_fil_cmd_data_set (ifp,BRCMF_C_SET_SSID , - &join_params, join_params_size); + err =brcmf_set_ssid (ifp, &join_params, join_params_size);if (err)bphy_err (drvr,"BRCMF_C_SET_SSID failed (%d)\n" , err);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +1 -0
@@ -162,6 +162,7 @@ struct brcmf_pub {const struct brcmf_fwvid_ops *vops;void *vdata;struct scan_param_struct_handler scan_param_handler; +u16 join_version; };/* forward declarations */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +19 -0
@@ -160,6 +160,10 @@ static void brcmf_feat_wlc_version_overrides(struct brcmf_pub *drv)brcmf_dbg (INFO ,"WLC version: %d.%d\n" , major, minor); +if (major >=17 || (major ==16 && minor >=1 ) || + (major ==14 && (minor ==2 || minor ==4 ))) + drv->join_version =1 ; +for (i =0 ; i <ARRAY_SIZE (brcmf_feat_wlcfeat_map); i++) { e = &brcmf_feat_wlcfeat_map[i]; if (major > e->min_ver_major ||
@@ -297,6 +301,20 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) } } +static void brcmf_feat_join_params (struct brcmf_if *ifp) +{ +struct brcmf_join_version_le version = {}; +int err; + + err =brcmf_fil_iovar_data_get (ifp,"join_ver" , &version, +sizeof (version)); +if (!err) + ifp->drvr->join_version =le16_to_cpu (version.major); +if (ifp->drvr->join_version >1 ) +bphy_err (ifp->drvr,"unsupported join params v%u\n" , + ifp->drvr->join_version); +} +static void brcmf_feat_scan_params (struct brcmf_if *ifp) {struct brcmf_pub *drvr = ifp->drvr;
@@ -430,6 +448,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)brcmf_feat_event_msgs_ext (ifp);brcmf_feat_wlc_version_overrides (drvr); +brcmf_feat_join_params (ifp);brcmf_feat_firmware_overrides (drvr);brcmf_fwvid_feat_attach (ifp);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +29 -0
@@ -584,6 +584,35 @@ struct brcmf_ext_join_params_le {struct brcmf_assoc_params_le assoc_le; }; +struct brcmf_assoc_params_v1_le { +__le16 version; +__le16 flags; +u8 bssid[ETH_ALEN ]; +__le16 bssid_cnt; +__le32 chanspec_num; +__le16 chanspec_list[]; +}; + +struct brcmf_join_params_v1_le { +struct brcmf_ssid_le ssid_le; +struct brcmf_assoc_params_v1_le assoc_le; +}; + +struct brcmf_join_version_le { +__le16 version; +__le16 length; +__le16 major; +u8 pad[2 ]; +}; + +struct brcmf_ext_join_params_v1_le { +__le16 version; +__le16 pad; +struct brcmf_ssid_le ssid_le; +struct brcmf_join_scan_params_le scan_le; +struct brcmf_assoc_params_v1_le assoc_le; +}; +struct brcmf_wsec_key {u32 index;/* key index */ u32 len;/* key length */
Signature · 1 line
2.55.0
Re: [PATCH 11/13] wifi: brcmfmac: Support versioned join requests
Quoted 11 lines · Michael Reeves
From: Hector Martin <[email protected]>
Newer firmware uses version 1 join and association structures with explicit version headers.
Query
join_verand build version 1 requests when required. Retain legacy layouts for older firmware and fall back toBRCMF_C_SET_SSIDwhen the join iovar returns-EBADE. Use the selected association layout for IBSS joins too. Report unsupported join versions rather than guessing their request layout.
Regards,
Arend
Quoted 10 lines
Signed-off-by Hector Martin <[email protected]>Signed-off-by Daniel Berlin <[email protected]>Co-developed-by Michael Reeves <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 73 +++++++++++++++++++--- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 19 ++++++ .../broadcom/brcm80211/brcmfmac/fwil_types.h | 29 +++++++++ 4 files changed, 113 insertions(+), 9 deletions(-)
PATCH 12/13 wifi: brcmfmac: Handle extended PMK command payloads
In reply to Michael ReevesSome firmware rejects the legacy BRCMF_C_SET_WSEC_PMK payload despite advertising firmware supplicant support.
Add the extended PMK layout. Try the legacy payload first when the key fits, and retry with the extended layout only after -EBADE. Use the extended layout directly for larger keys and reject keys that exceed its capacity.
--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 39 ++++++++++++++++------ .../broadcom/brcm80211/brcmfmac/fwil_types.h | 18 ++++++++++ 2 files changed, 46 insertions(+), 11 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +28 -11
@@ -1584,28 +1584,45 @@ int brcmf_set_wsec(struct brcmf_if *ifp, const u8 *key, u16 key_len, u16 flags) {struct brcmf_pub *drvr = ifp->drvr;struct brcmf_wsec_pmk_le pmk; +struct brcmf_wsec_pmk_ext_le pmk_ext;int err; -if (key_len >sizeof (pmk.key)) { +if (key_len >sizeof (pmk_ext.key)) {bphy_err (drvr,"key must be less than %zu bytes\n" , -sizeof (pmk.key)); +sizeof (pmk_ext.key));return -EINVAL ; } -memset (&pmk,0 ,sizeof (pmk)); +if (key_len <=sizeof (pmk.key)) { +memset (&pmk,0 ,sizeof (pmk)); -/* pass key material directly */ - pmk.key_len =cpu_to_le16 (key_len); - pmk.flags =cpu_to_le16 (flags); -memcpy (pmk.key, key, key_len); + pmk.key_len =cpu_to_le16 (key_len); + pmk.flags =cpu_to_le16 (flags); +memcpy (pmk.key, key, key_len); + + err =brcmf_fil_cmd_data_set (ifp,BRCMF_C_SET_WSEC_PMK , + &pmk,sizeof (pmk)); +if (!err) +return 0 ; +if (err != -EBADE ) + goto fail; + } + +memset (&pmk_ext,0 ,sizeof (pmk_ext)); + pmk_ext.key_len =cpu_to_le16 (key_len); + pmk_ext.flags =cpu_to_le16 (flags); +memcpy (pmk_ext.key, key, key_len); -/* store key material in firmware */ err =brcmf_fil_cmd_data_set (ifp,BRCMF_C_SET_WSEC_PMK , - &pmk,sizeof (pmk)); + &pmk_ext,sizeof (pmk_ext));if (err <0 ) -bphy_err (drvr,"failed to change PSK in firmware (len=%u)\n" , - key_len); + goto fail; + +return 0 ; +fail: +bphy_err (drvr,"failed to change PSK in firmware (len=%u, err=%d)\n" , + key_len, err);return err; }BRCMF_EXPORT_SYMBOL_GPL (brcmf_set_wsec);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +18 -0
@@ -75,6 +75,7 @@#define BRCMF_WSEC_MAX_PSK_LEN 32#define BRCMF_WSEC_PASSPHRASE BIT(0) +#define BRCMF_WSEC_MAX_PMK_LEN 256#define BRCMF_WSEC_MAX_SAE_PASSWORD_LEN 128/* primary (ie tx) key */
@@ -667,6 +668,23 @@ struct brcmf_wsec_pmk_le {u8 key[BRCMF_WSEC_MAX_SAE_PASSWORD_LEN ]; }; +/** +* struct brcmf_wsec_pmk_ext_le - extended firmware pmk material. +* +* @key_len: number of octets in key material. +* @flags: key handling qualifiers. +* @key: PMK key material. +* @opt_len: optional field length. +* @opt_tlvs: optional fields in TLV format. +*/ +struct brcmf_wsec_pmk_ext_le { +__le16 key_len; +__le16 flags; +u8 key[BRCMF_WSEC_MAX_PMK_LEN ]; +__le16 opt_len; +u8 opt_tlvs[]; +}; +/** * struct brcmf_wsec_sae_pwd_le - firmware SAE password material. *
Signature · 1 line
2.55.0
Re: [PATCH 12/13] wifi: brcmfmac: Handle extended PMK command payloads
Quoted 10 lines · Michael Reeves
From: Michael Reeves <[email protected]>
Some firmware rejects the legacy
BRCMF_C_SET_WSEC_PMKpayload despite advertising firmware supplicant support.Add the extended PMK layout. Try the legacy payload first when the key fits, and retry with the extended layout only after
-EBADE. Use the extended layout directly for larger keys and reject keys that exceed its capacity.
Regards,
Arend
Quoted 7 lines
Co-developed-by Hector Martin <[email protected]>Signed-off-by Hector Martin <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 39 ++++++++++++++++------ .../broadcom/brcm80211/brcmfmac/fwil_types.h | 18 ++++++++++ 2 files changed, 46 insertions(+), 11 deletions(-)
PATCH 13/13 wifi: brcmfmac: Add BCM4388 support
In reply to Michael ReevesFrom: Hector Martin <[email protected]>
Add BCM4388 firmware mappings, RAM base and OTP handling, and increase the RX posting and completion ring capacities to 2048 items.
On BCM4388, DMA_FROM_DEVICE mappings for posted receive buffers cause DART read-permission faults followed by firmware DMA failure. Map these buffers with DMA_BIDIRECTIONAL to allow device reads as well as writes. Keep the existing mapping direction for other chips.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 8 +++++--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 4 ++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 12 +++++++++++- .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++ 5 files changed, 21 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +1 -0
@@ -751,6 +751,7 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)case BRCM_CC_4366_CHIP_ID :case BRCM_CC_43664_CHIP_ID :case BRCM_CC_43666_CHIP_ID : +case BRCM_CC_4388_CHIP_ID :return 0x200000 ;case BRCM_CC_4355_CHIP_ID :case BRCM_CC_4359_CHIP_ID :
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +5 -3
@@ -12,6 +12,7 @@#include <linux/netdevice.h> #include <linux/etherdevice.h> +#include <brcm_hw_ids.h> #include <brcmu_utils.h> #include <brcmu_wifi.h>
@@ -51,7 +52,7 @@#define MSGBUF_TYPE_D2H_MAILBOX_DATA 0x24#define NR_TX_PKTIDS 2048 -#define NR_RX_PKTIDS 1024 +#define NR_RX_PKTIDS 2048#define BRCMF_IOCTL_REQ_PKTID 0xFFFE
@@ -330,7 +331,6 @@ brcmf_msgbuf_init_pktids(u32 nr_array_entries,return pktids; } - static int brcmf_msgbuf_alloc_pktid(struct device *dev, struct brcmf_msgbuf_pktids *pktids,
@@ -1695,8 +1695,10 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) DMA_TO_DEVICE);if (!msgbuf->tx_pktids) goto fail; +/* BCM4388 firmware also reads from posted RX buffers. */ msgbuf->rx_pktids =brcmf_msgbuf_init_pktids (NR_RX_PKTIDS , -DMA_FROM_DEVICE ); + drvr->bus_if->chip ==BRCM_CC_4388_CHIP_ID ? +DMA_BIDIRECTIONAL :DMA_FROM_DEVICE );if (!msgbuf->rx_pktids) goto fail;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h +2 -2
@@ -8,10 +8,10 @@#ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 64 -#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 1024 +#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 2048#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 64#define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM 1024 -#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 1024 +#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 2048#define BRCMF_H2D_TXFLOWRING_MAX_ITEM 512#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +11 -1
@@ -71,6 +71,8 @@ BRCMF_FW_CLM_DEF(4377B3, "brcmfmac4377b3-pcie"); BRCMF_FW_CLM_DEF(4378B1, "brcmfmac4378b1-pcie"); BRCMF_FW_CLM_DEF(4378B3, "brcmfmac4378b3-pcie"); BRCMF_FW_CLM_DEF(4387C2, "brcmfmac4387c2-pcie"); +BRCMF_FW_CLM_DEF(4388B0, "brcmfmac4388b0-pcie"); +BRCMF_FW_CLM_DEF(4388C0, "brcmfmac4388c0-pcie");BRCMF_FW_CLM_DEF (54591 ,"brcmfmac54591-pcie" );/* firmware config files */
@@ -113,6 +115,8 @@ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0x0000000F, 4378B1), /* revision ID 3 */ BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0xFFFFFFE0, 4378B3), /* revision ID 5 */ BRCMF_FW_ENTRY(BRCM_CC_4387_CHIP_ID, 0xFFFFFFFF, 4387C2), /* revision ID 7 */ + BRCMF_FW_ENTRY(BRCM_CC_4388_CHIP_ID, 0x0000000F, 4388B0), + BRCMF_FW_ENTRY(BRCM_CC_4388_CHIP_ID, 0xFFFFFFF0, 4388C0), /* revision ID 4 */ };#define BRCMF_PCIE_FW_UP_TIMEOUT 5000/* msec */
@@ -2397,6 +2401,11 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo) base =0x113c ; words =0x170 ;break ; +case BRCM_CC_4388_CHIP_ID : + coreid =BCMA_CORE_GCI ; + base =0x115c ; + words =0x150 ; +break ;default :/* OTP not supported on this chip */ return 0 ;
@@ -2459,7 +2468,7 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)static bool brcmf_pcie_request_fw_signature (struct brcmf_pciedev_info *devinfo) { -return false; +return devinfo->ci->chip ==BRCM_CC_4388_CHIP_ID ; } static void brcmf_pcie_setup(struct device *dev, int ret,
@@ -3114,6 +3123,7 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = {BRCMF_PCIE_DEVICE (BRCM_PCIE_4377_DEVICE_ID ,WCC_SEED ),BRCMF_PCIE_DEVICE (BRCM_PCIE_4378_DEVICE_ID ,WCC_SEED ),BRCMF_PCIE_DEVICE (BRCM_PCIE_4387_DEVICE_ID ,WCC_SEED ), +BRCMF_PCIE_DEVICE (BRCM_PCIE_4388_DEVICE_ID ,WCC_SEED ),BRCMF_PCIE_DEVICE (BRCM_PCIE_43752_DEVICE_ID ,WCC_SEED ), BRCMF_PCIE_DEVICE(CY_PCIE_54591_DEVICE_ID, CYW), { /* end: all zeroes */ }
drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +2 -0
@@ -57,6 +57,7 @@#define BRCM_CC_4377_CHIP_ID 0x4377#define BRCM_CC_4378_CHIP_ID 0x4378#define BRCM_CC_4387_CHIP_ID 0x4387 +#define BRCM_CC_4388_CHIP_ID 0x4388#define CY_CC_4373_CHIP_ID 0x4373#define CY_CC_43012_CHIP_ID 43012#define CY_CC_43439_CHIP_ID 43439
@@ -99,6 +100,7 @@#define BRCM_PCIE_4377_DEVICE_ID 0x4488#define BRCM_PCIE_4378_DEVICE_ID 0x4425#define BRCM_PCIE_4387_DEVICE_ID 0x4433 +#define BRCM_PCIE_4388_DEVICE_ID 0x4434#define CY_PCIE_54591_DEVICE_ID 0x4417/* brcmsmac IDs */
Signature · 1 line
2.55.0
Quoted 8 lines · On Fri, Sep 25, 2026 at 11:43:48PM +1000, Michael Reeves via B4 Relay wrote:
From: Hector Martin <[email protected]>
Add BCM4388 firmware mappings, RAM base and OTP handling, and increase the RX posting and completion ring capacities to 2048 items.
On BCM4388,
DMA_FROM_DEVICEmappings for posted receive buffers cause DART read-permission faults followed by firmware DMA failure. Map these buffers withDMA_BIDIRECTIONALto allow device reads as well as writes.
Not only on BCM4388. See commit 7ed5dce55fa8 ("wifi: brcmfmac: map msgbuf RX packet IDs bidirectional") [1] only in wireless/main, doesn't seem to made it into next yet. BCM4378 and BCM4387 do need the RX msgbufs mapped as bidirectional as well.
Quoted 47 lines
Keep the existing mapping direction for other chips.
Signed-off-by Hector Martin <[email protected]>Co-developed-by Michael Reeves <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 8 +++++--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 4 ++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 12 +++++++++++- .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++ 5 files changed, 21 insertions(+), 6 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +1
-0@@ -751,6 +751,7 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)case BRCM_CC_4366_CHIP_ID :case BRCM_CC_43664_CHIP_ID :case BRCM_CC_43666_CHIP_ID : +case BRCM_CC_4388_CHIP_ID :return 0x200000 ;case BRCM_CC_4355_CHIP_ID :case BRCM_CC_4359_CHIP_ID :drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +2
-1@@ -12,6 +12,7 @@#include <linux/netdevice.h> #include <linux/etherdevice.h> +#include <brcm_hw_ids.h> #include <brcmu_utils.h> #include <brcmu_wifi.h> @@ -51,7 +52,7 @@#define MSGBUF_TYPE_D2H_MAILBOX_DATA 0x24#define NR_TX_PKTIDS 2048 -#define NR_RX_PKTIDS 1024 +#define NR_RX_PKTIDS 2048#define BRCMF_IOCTL_REQ_PKTID 0xFFFE
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c brcmf_msgbuf_init_pktids(u32 nr_array_entries, · line 333
Quoted 4 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +0
-1@@ -330,7 +331,6 @@ brcmf_msgbuf_init_pktids(u32 nr_array_entries,return pktids; } -
nit: cosmetic change
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) · line 1701
Quoted 12 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +3
-1static int brcmf_msgbuf_alloc_pktid(struct device *dev, struct brcmf_msgbuf_pktids *pktids,@@ -1695,8 +1695,10 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) DMA_TO_DEVICE);if (!msgbuf->tx_pktids) goto fail; +/* BCM4388 firmware also reads from posted RX buffers. */ msgbuf->rx_pktids =brcmf_msgbuf_init_pktids (NR_RX_PKTIDS , -DMA_FROM_DEVICE ); + drvr->bus_if->chip ==BRCM_CC_4388_CHIP_ID ? +DMA_BIDIRECTIONAL :DMA_FROM_DEVICE );
This conflicts with the linked change. Best to drop this hunk and rely on the linked change.
[...]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo) · line 2472
Quoted 9 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +1
-1@@ -2459,7 +2468,7 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)static bool brcmf_pcie_request_fw_signature (struct brcmf_pciedev_info *devinfo) { -return false; +return devinfo->ci->chip ==BRCM_CC_4388_CHIP_ID ; }
nit: this is hard to extend.
```
switch (devinfo->ci->chip) {
case BRCM_CC_4388_CHIP_ID:
return true;
default:
return false;
}
```would be easier to extend and is in my opinion easier to read
Janne
Quoted 10 lines · Michael Reeves
From: Hector Martin <[email protected]>
Add BCM4388 firmware mappings, RAM base and OTP handling, and increase the RX posting and completion ring capacities to 2048 items.
On BCM4388,
DMA_FROM_DEVICEmappings for posted receive buffers cause DART read-permission faults followed by firmware DMA failure. Map these buffers withDMA_BIDIRECTIONALto allow device reads as well as writes. Keep the existing mapping direction for other chips.
Regards,
Arend
Quoted 10 lines
Signed-off-by Hector Martin <[email protected]>Co-developed-by Michael Reeves <[email protected]>Signed-off-by Michael Reeves <[email protected]>--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 8 +++++--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 4 ++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 12 +++++++++++- .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++ 5 files changed, 21 insertions(+), 6 deletions(-)
Arend van Spriel
maintainerQuoted 9 lines · On 25/09/2026 15:43, Michael Reeves via B4 Relay wrote:
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handling
Thanks for this series. It is taking me longer to review the full series, but wanted to let you know I am looking at it.
Regards,
Arend
Arend van Spriel
maintainer+ Peter, Izabela
Quoted 13 lines · On 25/09/2026 15:43, Michael Reeves via B4 Relay wrote:
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handlingThese changes include work by Hector Martin and Daniel Berlin from Asahi Linux, refactored where needed for upstream inclusion.
Quoted 8 lines
The series provides basic station support only. 6 GHz support is planned for a follow-up patchset after this lands. The driver retains legacy interfaces for older firmware.
Tested on an Apple M3 MacBook Air (J613):
- Device boot and network scanning
- 5 GHz WPA2-PSK association and DHCP
- Bidirectional TCP traffic
Finally got some time to get this series tested on my setup. The patches generally look good. So far no regressions observed. It would be good if some more people could test this series on their equipment. I will do some more testing and wait some days.
Regards,
Arend
Janne Grunau
Tested-byQuoted 25 lines · Arend van Spriel
+ Peter, Izabela
Quoted 13 lines · On 25/09/2026 15:43, Michael Reeves via B4 Relay wrote:
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handlingThese changes include work by Hector Martin and Daniel Berlin from Asahi Linux, refactored where needed for upstream inclusion.
Quoted 8 lines
The series provides basic station support only. 6 GHz support is planned for a follow-up patchset after this lands. The driver retains legacy interfaces for older firmware.
Tested on an Apple M3 MacBook Air (J613):
- Device boot and network scanning
- 5 GHz WPA2-PSK association and DHCP
- Bidirectional TCP traffic
Quoted 4 lines
Finally got some time to get this series tested on my setup. The patches generally look good. So far no regressions observed. It would be good if some more people could test this series on their equipment. I will do some more testing and wait some days.
Tested series on top of v7.3 + commit 7ed5dce55fa8 ("wifi: brcmfmac: map msgbuf RX packet IDs bidirectional") in wireless/main with resolving the conflict by dropping the conflicting hunk of this series.
Tested on Mac mini (M1, BCM4378) and Macbook Pro 14-inch (M1 Max, BCM4387) without regressions (except for the resolved RX msgbuf mapping).
thanks,
Janne
Arend van Spriel
maintainerQuoted 35 lines · Janne Grunau
Quoted 25 lines · Arend van Spriel
+ Peter, Izabela
Quoted 13 lines · On 25/09/2026 15:43, Michael Reeves via B4 Relay wrote:
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handlingThese changes include work by Hector Martin and Daniel Berlin from Asahi Linux, refactored where needed for upstream inclusion.
Quoted 8 lines
The series provides basic station support only. 6 GHz support is planned for a follow-up patchset after this lands. The driver retains legacy interfaces for older firmware.
Tested on an Apple M3 MacBook Air (J613):
- Device boot and network scanning
- 5 GHz WPA2-PSK association and DHCP
- Bidirectional TCP trafficQuoted 4 lines
Finally got some time to get this series tested on my setup. The patches generally look good. So far no regressions observed. It would be good if some more people could test this series on their equipment. I will do some more testing and wait some days.
Tested series on top of v7.3 + commit
7ed5dce55fa8("wifi: brcmfmac: map msgbuf RX packet IDs bidirectional") in wireless/main with resolving the conflict by dropping the conflicting hunk of this series.
Quoted 5 lines
Tested on Mac mini (M1, BCM4378) and Macbook Pro 14-inch (M1 Max, BCM4387) without regressions (except for the resolved RX msgbuf mapping).
Tested-by Janne Grunau <[email protected]>
No regressions seen on my 43664 and 43455 devices. So will process the patches now.
Regards,
Arend
Quoted 68 lines · On Fri, Sep 25, 2026 at 9:49 AM Michael Reeves via B4 Relay…
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handlingThese changes include work by Hector Martin and Daniel Berlin from Asahi Linux, refactored where needed for upstream inclusion.
The series provides basic station support only. 6 GHz support is planned for a follow-up patchset after this lands. The driver retains legacy interfaces for older firmware.
Tested on an Apple M3 MacBook Air (J613):
- Device boot and network scanning
- 5 GHz WPA2-PSK association and DHCP
- Bidirectional TCP trafficTesting required separate Apple PCIe and devicetree patches, as well as Janne Grunau's port-authorization fix [1].
---
Daniel Berlin (1):
wifi: brcmfmac: Support versioned scan parameter layoutsHector Martin (6):
wifi: brcmfmac: Support newer PCIe core startup and interrupts
wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
wifi: brcmfmac: Load signed PCIe firmware images
wifi: brcmfmac: Accept newer BSS information versions
wifi: brcmfmac: Support versioned join requests
wifi: brcmfmac: Add BCM4388 supportMichael Reeves (6):
wifi: brcmfmac: pcie: Report the detected chip ID to the bus
wifi: brcmfmac: Match complete firmware capability names
wifi: brcmfmac: Fall back to RSSI-only default join preferences
wifi: brcmfmac: Useevent_msgs_extfor event masks
wifi: brcmfmac: Handle larger firmware band lists
wifi: brcmfmac: Handle extended PMK command payloads.../wireless/broadcom/brcm80211/brcmfmac/Makefile | 1 + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 9 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 368 +++++++------- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 36 +- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 27 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 18 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 124 ++++- .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 2 + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 130 ++++- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 1 + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 141 +++++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 9 +- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 560 +++++++++++++++++---- .../broadcom/brcm80211/brcmfmac/scan_param.c | 416 +++++++++++++++ .../broadcom/brcm80211/brcmfmac/scan_param.h | 13 + .../broadcom/brcm80211/include/brcm_hw_ids.h | 2 + .../broadcom/brcm80211/include/chipcommon.h | 5 + 19 files changed, 1593 insertions(+), 339 deletions(-)
Quoted 4 lines
---
base-commit:42a9fb3382fc2573e92f41d203b095d9a372cfc9
change-id: 20260925-brcm4388-submit-5cb8d3e6d6a5
Works for me and looks good.
Signature · 1 line
真実はいつも一つ!/ Always, there's only one truth!
Arend van Spriel
maintainerOp 2 november 2026 01:43:07 schreef Neal Gompa <[email protected]>:
Quoted 74 lines
Quoted 68 lines · On Fri, Sep 25, 2026 at 9:49 AM Michael Reeves via B4 Relay…
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handlingThese changes include work by Hector Martin and Daniel Berlin from Asahi Linux, refactored where needed for upstream inclusion.
The series provides basic station support only. 6 GHz support is planned for a follow-up patchset after this lands. The driver retains legacy interfaces for older firmware.
Tested on an Apple M3 MacBook Air (J613):
- Device boot and network scanning
- 5 GHz WPA2-PSK association and DHCP
- Bidirectional TCP trafficTesting required separate Apple PCIe and devicetree patches, as well as Janne Grunau's port-authorization fix [1].
---
Daniel Berlin (1):
wifi: brcmfmac: Support versioned scan parameter layoutsHector Martin (6):
wifi: brcmfmac: Support newer PCIe core startup and interrupts
wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
wifi: brcmfmac: Load signed PCIe firmware images
wifi: brcmfmac: Accept newer BSS information versions
wifi: brcmfmac: Support versioned join requests
wifi: brcmfmac: Add BCM4388 supportMichael Reeves (6):
wifi: brcmfmac: pcie: Report the detected chip ID to the bus
wifi: brcmfmac: Match complete firmware capability names
wifi: brcmfmac: Fall back to RSSI-only default join preferences
wifi: brcmfmac: Useevent_msgs_extfor event masks
wifi: brcmfmac: Handle larger firmware band lists
wifi: brcmfmac: Handle extended PMK command payloads.../wireless/broadcom/brcm80211/brcmfmac/Makefile | 1 + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 9 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 368 +++++++------- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 36 +- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 27 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 18 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 124 ++++- .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 2 + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 130 ++++- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 1 + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 141 +++++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 9 +- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 560 +++++++++++++++++---- .../broadcom/brcm80211/brcmfmac/scan_param.c | 416 +++++++++++++++ .../broadcom/brcm80211/brcmfmac/scan_param.h | 13 + .../broadcom/brcm80211/include/brcm_hw_ids.h | 2 + .../broadcom/brcm80211/include/chipcommon.h | 5 + 19 files changed, 1593 insertions(+), 339 deletions(-)Quoted 3 lines
---
base-commit:42a9fb3382fc2573e92f41d203b095d9a372cfc9
change-id: 20260925-brcm4388-submit-5cb8d3e6d6a5
Quoted 1 line
Works for me and looks good.
So what does "Works for me" mean here. Did you verify it is working on some hardware you have? If so, please share the info.
Regards,
Arend
Quoted 78 lines · Arend van Spriel
Op 2 november 2026 01:43:07 schreef Neal Gompa <[email protected]>:
Quoted 75 lines
Quoted 72 lines · On Fri, Sep 25, 2026 at 9:49 AM Michael Reeves via B4 Relay…
The Broadcom BCM4388 chipset requires new PCIe initialization and firmware interfaces. Add support for these interfaces to brcmfmac to enable basic station operation.
This series adds:
- Signed firmware loading and mailbox transport
- Fixes for chip identification and firmware capability matching
- Versioned scan and join requests, and extended PMK payloads
- Updated event mask handlingThese changes include work by Hector Martin and Daniel Berlin from Asahi Linux, refactored where needed for upstream inclusion.
The series provides basic station support only. 6 GHz support is planned for a follow-up patchset after this lands. The driver retains legacy interfaces for older firmware.
Tested on an Apple M3 MacBook Air (J613):
- Device boot and network scanning
- 5 GHz WPA2-PSK association and DHCP
- Bidirectional TCP trafficTesting required separate Apple PCIe and devicetree patches, as well as Janne Grunau's port-authorization fix [1].
---
Daniel Berlin (1):
wifi: brcmfmac: Support versioned scan parameter layoutsHector Martin (6):
wifi: brcmfmac: Support newer PCIe core startup and interrupts
wifi: brcmfmac: Negotiate PCIe mailbox transport with firmware
wifi: brcmfmac: Load signed PCIe firmware images
wifi: brcmfmac: Accept newer BSS information versions
wifi: brcmfmac: Support versioned join requests
wifi: brcmfmac: Add BCM4388 supportMichael Reeves (6):
wifi: brcmfmac: pcie: Report the detected chip ID to the bus
wifi: brcmfmac: Match complete firmware capability names
wifi: brcmfmac: Fall back to RSSI-only default join preferences
wifi: brcmfmac: Useevent_msgs_extfor event masks
wifi: brcmfmac: Handle larger firmware band lists
wifi: brcmfmac: Handle extended PMK command payloads.../wireless/broadcom/brcm80211/brcmfmac/Makefile | 1 + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 9 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 368 +++++++------- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 36 +- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 27 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 18 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 124 ++++- .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 2 + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 130 ++++- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 1 + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 141 +++++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 9 +- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 560 +++++++++++++++++---- .../broadcom/brcm80211/brcmfmac/scan_param.c | 416 +++++++++++++++ .../broadcom/brcm80211/brcmfmac/scan_param.h | 13 + .../broadcom/brcm80211/include/brcm_hw_ids.h | 2 + .../broadcom/brcm80211/include/chipcommon.h | 5 + 19 files changed, 1593 insertions(+), 339 deletions(-)---
base-commit:42a9fb3382fc2573e92f41d203b095d9a372cfc9
change-id: 20260925-brcm4388-submit-5cb8d3e6d6a5
Quoted 5 lines
Quoted 1 line
Works for me and looks good.
So what does "Works for me" mean here. Did you verify it is working on some hardware you have? If so, please share the info.
Sorry, I have tested on a 14" M1 Pro MacBook Pro and a 14" M2 Max MacBook Pro.
--
真実はいつも一つ!/ Always, there's only one truth!