mbp-2016-linux icon indicating copy to clipboard operation
mbp-2016-linux copied to clipboard

MacBook Pro 15+: Wifi Support

Open aunali1 opened this issue 6 years ago • 127 comments

Discussion and updates regarding Broadcom Wifi related support. Parent thread is #71.

Current Status:

NOTE: Firmware from macOS Catalina is currently known to fail to initialize with brcmfmac. Use firmware from a macOS Mojave or lower installation, otherwise you can find the necessary files in my up-to-date archive here: https://packages.aunali1.com/apple/wifi-fw/18G2022

  • [x] Firmware Loading
    • [x] BCM4355 (MacbookAir8,y)
    • [x] BCM4364 (MacbookPro15,x)
    • [ ] BCM4377 (MacbookPro15,4+ [2019])
  • [x] Frequency Bands
    • [x] 2.4 GHz
    • [x] 5 GHz
  • [x] Security Protocols
    • [x] WPA
    • [x] WPA2

Unfortunately, due to the nature of how tightly linked .clmb files are to each model variant, generic distribution of firmware is currently impractical.

aunali1 avatar Aug 06 '19 16:08 aunali1

Hi everyone! I've been following this thread as I work on getting a USB SSD with linux that works on both of my Macs: MacBookAir8,2 (2019 MacBook Air) and iMac19,1 (2019 iMac). Fortunately the 2019 iMac does not contain a T2 chip, so things work fairly well out of the box.

I'm attempting to get WiFi working on both models. The iMac seems to have the same chipset as the MacBookPro15,x (BCM4364, codename Midway) but the MacBook Air has a BCM4355 chipset (codename Hawaii). I created and applied this patch (based on the work from @MCMrARM): https://github.com/jhohisel/macbookair8-2-linux/blob/master/brcmfmac.patch and copied the firmware from macOS.

However, the firmware fails to load (iMac):

[   20.314189] usbcore: registered new interface driver brcmfmac
[   20.330616] brcmfmac 0000:03:00.0: enabling device (0000 -> 0002)
[   20.439205] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[   23.374627] brcmfmac 0000:03:00.0: brcmf_pcie_download_fw_nvram: FW failed to initialize

MacBook Air fails with a slightly different error:

[   27.958248] brcmfmac 0000:02:00.0: enabling device (0000 -> 0002)
[   28.121706] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4355-pcie for chip BCM4355/12
[   28.126287] brcmfmac 0000:02:00.0: Direct firmware load for brcm/brcmfmac4355-pcie.Apple Inc.-MacBookAir8,2.txt failed with error -2
[   31.030139] brcmfmac 0000:02:00.0: brcmf_pcie_download_fw_nvram: FW failed to initialize

I observe a different error when the NVRAM file (.txt) is missing, so I know that it is correctly detecting the presence of these files and attempting to load them.

Top tip: you can discover the firmware filenames that Apple uses by running: ioreg -l | grep RequestedFiles The output will look something like:

"RequestedFiles" = ({"Firmware"="C-4364__s-B2/midway.trx","TxCap"="C-4364__s-B2/midway-X0.txcb","Regulatory"="C-4364__s-B2/midway-X0.clmb","NVRAM"="C-4364__s-B2/P-midway-X0_M-HRPN_V-u__m-7.5.txt"})

jhohisel avatar Aug 17 '19 16:08 jhohisel

Top tip: you can discover the firmware filenames that Apple uses by running: ioreg -l | grep RequestedFiles

@jhohisel well done and nice tip!

I'm experimenting with the WLAN (WiFi) support on my MacBookAir8,1 since a week or so, I've pushed my version of this patch now as well (see reference above). Can you check if your MacBookAir8,2 platform goes along fine with the provided bcm5974, hid, nvme, and brcmfmac patches in https://github.com/ppaulweber/linux-mba? Thx!

ppaulweber avatar Aug 17 '19 18:08 ppaulweber

I am currently running your bcm5974 and hid patches. Applying them added two-finger scrolling, right-click and function key support.

I'll try the nvme patch now.

jhohisel avatar Aug 17 '19 20:08 jhohisel

bluehax@bluehax:~$ lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 465.8G  0 disk  
├─sda1           8:1    0   448M  0 part  /boot/efi
├─sda2           8:2    0   4.7G  0 part  /media/bluehax/Debian Linux
├─sda3           8:3    0   4.7G  0 part  /boot
└─sda4           8:4    0   456G  0 part  
  └─sdb4_crypt 254:0    0   456G  0 crypt /
nvme0n1        259:0    0   113G  0 disk  
├─nvme0n1p1    259:1    0   300M  0 part  
└─nvme0n1p2    259:2    0 112.7G  0 part 

NVMe Works! I'll have to try installing it to a partition on the laptop now.

One issue I've been unable to fix is getting the keyboard working when I unlock my root partition during boot. It works during the GRUB menu, then stops working when the kernel prompts to unlock the drive for dm-crypt, then functions immediately after when it loads the bce module.

I built-in mbp2018-bridge-drv to the kernel by adding a Kconfig entry and declaring the source to the Makefile in drivers/. Applied the patches for bcm5974 and hid, then set the module load order in /etc/modules-load.d/bce.conf.

jhohisel avatar Aug 17 '19 21:08 jhohisel

One issue I've been unable to fix is getting the keyboard working when I unlock my root partition during boot. It works during the GRUB menu, then stops working when the kernel prompts to unlock the drive for dm-crypt, then functions immediately after when it loads the bce module.

If you really need the keyboard in this case you have to take a look into your current /etc/mkinitcpio.conf setup. You shall include there the bce in the MODULE=... variable in order that the bce module even gets loaded and integrated into the initramfs creation.

ppaulweber avatar Aug 17 '19 21:08 ppaulweber

Please focus on wifi in this issue and discuss other topics (like keyboard or NVMe) in separate issues.

Dunedan avatar Aug 18 '19 05:08 Dunedan

Is WiFi (brcmfmac4364) working for anybody (besides @MCMrARM)?

Whenever i'm trying to load brcmfmac module, i'm getting error mentioned below:

[  990.003990] usbcore: registered new interface driver brcmfmac
[  990.110113] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[  992.693631] brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: FW failed to initialize

mikeeq avatar Aug 19 '19 12:08 mikeeq

@mikeeq What kernel patch are you using for WiFi support?

aunali1 avatar Aug 20 '19 22:08 aunali1

@jhohisel @mikeeq Works perfectly fine for me:

[    8.196831] usbcore: registered new interface driver brcmfmac
[    8.212808] brcmfmac 0000:03:00.0: enabling device (0000 -> 0002)
[    8.319800] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[    9.521164] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[    9.840308] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/3 wl0: Mar 28 2019 19:17:52 version 9.137.9.0.32.6.34 FWID 01-36f56c94
[    9.933835] brcmfmac 0000:03:00.0 wlp3s0: renamed from wlan0

EDIT: I'm using this wifi patch (in my kernel tree) btw.

aunali1 avatar Aug 21 '19 05:08 aunali1

@aunali1 yep, you're right - I've missed one line when I was generating a patch. https://github.com/mikeeq/mbp-fedora-kernel/commit/d8f5578d4fd9c9ee01c2a125dae30237aefcf391

@ppaulweber could you confirm if that fix is not needed for MacBookAir8,2?

mikeeq avatar Aug 21 '19 12:08 mikeeq

@aunali1 thanks for the hint and I've experimented for my MacBookAir8,1 that this brcm driver uses the same RAM base as the brcm driver of the MacBookPro15,x. It now allocates and loads correctly the firmware, and I get the wlan interface.

@jhohisel can you check if this latest patch works for your MacBookAir8,2 as well, thx!

@mikeeq it does need the same fix, which I've already updated in my repo (see commit reference above)

[  702.402953] usbcore: registered new interface driver brcmfmac
[  702.512262] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4355-pcie for chip BCM4355/12
[  702.960842] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4355-pcie for chip BCM4355/12
[  702.981704] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4355/12 wl0: Mar 28 2019 19:57:32 version 9.137.9.0.32.6.33 FWID 01-c5e1774f
[  703.109625] brcmfmac 0000:02:00.0 wlp2s0: renamed from wlan0

ppaulweber avatar Aug 21 '19 14:08 ppaulweber

@ppaulweber The good news is that now the card is correctly recognized and shows as a WIFI device. The bad news is that I can't seem to connect to my network using it. It repeatedly times out and prompts for the password. I tried switching from wpa_supplicant to iwd as suggested in issue 71, but no difference. I also tried using wicd instead of NetworkManager, it fails to connect saying bad password. I have not yet tried an open network, and yes I am entering the correct password.

Has anyone else experienced this?

I am able to connect to my network using a USB WIFI card.

jhohisel avatar Aug 22 '19 03:08 jhohisel

@jhohisel try to reload brcmfmac kernel module. I'm experiencing the same issue and after module reload I'm able to connect to WPA2 network ;)

https://github.com/mikeeq/mbp-fedora#known-issues

mikeeq avatar Aug 22 '19 06:08 mikeeq

@jhohisel I can confirm that for me is wpa_supplicantno longer working as well. With iwdthe WLAN (WiFi) is working as expected. Thx @mikeeq for collecting the known issues in your repo!

ppaulweber avatar Aug 22 '19 07:08 ppaulweber

I was missing:

[device]
wifi.backend=iwd

From /etc/NetworkManager/NetworkManager.conf

Now I can connect!

jhohisel avatar Aug 23 '19 05:08 jhohisel

Sorry for the silly question all - when I locate the files from mojave, where do I copy them on the linux side?

macphotoed avatar Aug 24 '19 20:08 macphotoed

@macphotoed Just copy the *.trx file to /lib/firmware/brcm/brcmfmac4364-pcie.trx, the *.clmb file to /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob and the *.txt file to /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,1.txt

aunali1 avatar Aug 24 '19 20:08 aunali1

Amazing - thank you again @aunali1 - got the files, tjust grappling with the iwd/wpa_supplicant issue! And bluetooth for some reason?

macphotoed avatar Aug 24 '19 21:08 macphotoed

By the way 5Ghz generally works for me, through a full multiband 5ac does not achieve full speeds.

MCMrARM avatar Aug 28 '19 19:08 MCMrARM

Sorry. I'd like to ask if I don't have IDA,how can I get the wifi firmware? Do anybody can share one with me. Mine model is mbp2010 13inch.

MCMrARM [email protected]于2019年8月28日 周三21:55写道:

By the way 5Ghz generally works for me, through a full multiband 5ac does not achieve full speeds.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Dunedan/mbp-2016-linux/issues/112?email_source=notifications&email_token=AB7YLWSIKQQMJHPGUGE7ELTQG3J3NA5CNFSM4IJYB3TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5MJBLQ#issuecomment-525897902, or mute the thread https://github.com/notifications/unsubscribe-auth/AB7YLWVD7Z2O5KIWNKGTKKDQG3J3NANCNFSM4IJYB3TA .

-- Best Regards, Liu, Min INI, UZH/ETHZ

wzygzlm avatar Aug 30 '19 17:08 wzygzlm

It seems that with 5.2.11, 5 Ghz works without any problems, and in some cases faster than macOS!

aunali1 avatar Aug 31 '19 20:08 aunali1

@wzygzlm I mean, this no longer requires IDA, the firmware is in /usr/share/firmware on OS X.

MCMrARM avatar Sep 01 '19 09:09 MCMrARM

can anyone tell me where the trx and clmb files are? On Arch if it makes any difference.

TRPB avatar Sep 16 '19 18:09 TRPB

TL;Dr with the wifi is to first find your firmware files using ioreg -l | grep C-4364, then copy them from /usr/share/firmware/wifi from OS X. On Linux, the .trx file for your model goes to /lib/firmware/brcm/brcmfmac4364-pcie.bin, the .clmb goes to /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob and the .txt to something like /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,2.txt All of this requires a kernel patch: https://mrarm.io/u/Paste%202019-07-26%2012-30-16.txt

MCMrARM avatar Sep 17 '19 19:09 MCMrARM

Anyone else not have this working on MBA 8,1(air 2018) it shows up as a ethernet device, thanks :)

0xEmma avatar Sep 21 '19 02:09 0xEmma

@EmmaDSamms sorry, what? Show the output of lspci?

MCMrARM avatar Sep 21 '19 09:09 MCMrARM

Hi people, for me I have the files in /lib/firmware/brcm/ exactly as @MCMrARM mentioned but when I run modprobe brcm80211 either in boot time or after, my arch-linux just freeze completely. How can I investigate it? because it just hangs and I need to reboot... If I remove the files, it just starts normally but without wifi working (as expected)

caioquirino avatar Sep 23 '19 23:09 caioquirino

So I've completely uninstalled MacOS and think I copied over the wrong firmware files before wiping it out. Would anyone happen to have firmware files for MacBookPro15,x T2 touchbar model?
Need...

"Firmware"="C-4364__s-B2/kauai.trx"
"imagename"="C-4364__s-B2/kauai-X0.clmb"
"NVRAM"="C-4364__s-B2/P-kauai-X0_M-HRPN_V-u__m-7.5.txt"

loafbox avatar Oct 01 '19 16:10 loafbox

I'd suggest against uninstalling MacOS completely because of MacOS being your best firmware update source, so you should keep it if you want to say, update bridgeOS.

MCMrARM avatar Oct 03 '19 17:10 MCMrARM

Is it possible to apply this procedure to MBP 13,3? Taking the .trx, .clmb and .txt from osx and putting them in linux?

mkexc avatar Oct 29 '19 16:10 mkexc

~~I can't get it working on my MBP 2019 15,1. I installed iwd, NetworkManager, enabled the services iwd and NetworkManager, set iwd as default wifi backend in /etc/NetworkManager/NetworkManager.conf, copied the three files from OSX to proper names in /lib/firmware/brcm/. I have aunali1's linux mbp kernel which contains the wifi patches. What am I missing? dmesg says this after boot:~~

[    4.446767] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[    4.479882] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/3 wl0: Mar 28 2019 19:17:52 version 9.137.9.0.32.6.34 FWID 01-36f56c94
[    4.498323] ieee80211 phy0: brcmf_cfg80211_add_iface: iface validation failed: err=-16

~~When I run sudo modprobe -r brcmfmac; sudo modprobe brcmfmac, I see~~

[ 1137.569122] ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
[ 1137.569355] ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
[ 1137.569359] ieee80211 phy0: brcmf_cfg80211_get_channel: chanspec failed (-5)

~~And a bit later~~

[ 1138.193219] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[ 1139.068592] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[ 1139.098725] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/3 wl0: Mar 28 2019 19:17:52 version 9.137.9.0.32.6.34 FWID 01-36f56c94

~~But I stilll can't use it. So am I too stupid to use the wifi device or idk. ip addr shows this:~~

4: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether ${macaddress} ff:ff:ff:ff:ff:ff

Edit: I guess I was missing the bridge/bce module, not 100% sure though

cubimon avatar Dec 08 '19 20:12 cubimon

After following @MCMrARM's guide to copy the WIFI firmware files I get the following error when the firmware files are loaded (dmesg | grep brcm output):

usbcore: registered new interface driver brcmfmac  
brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)  
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3  
bluetooth hci0: Direct firmware load for brcm/BCM.hcd failed with error -2  
Bluetooth: hci0: BCM: Patch brcm/BCM.hcd not found  
brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: FW failed to initialize  

More information here: https://github.com/mikeeq/mbp-fedora-kernel/issues/1 Has anyone an idea why it's failing to initialize?

TIA

geovie avatar Dec 21 '19 20:12 geovie

I am having the same issue @geovie. This is the dmesg with brcmfmac.debug=2097150. (Some omitted).

Kernel: https://github.com/aunali1/linux-mbp-arch @ 5.4.6

[    4.055976] brcmfmac: brcmfmac_module_init No platform data available.
[    4.055988] brcmfmac: brcmf_usb_register Enter
[    4.056000] usbcore: registered new interface driver brcmfmac
[    4.056000] brcmfmac: brcmf_pcie_register Enter
[    4.056024] brcmfmac: brcmf_pcie_probe Enter 14e4:4464
[    4.056135] brcmfmac 0000:05:00.0: enabling device (0000 -> 0002)
[    4.056320] brcmfmac: brcmf_pcie_get_resource Phys addr : reg space = 000000009656594a base addr 0x00000081400000
[    4.056321] brcmfmac: brcmf_pcie_get_resource Phys addr : mem space = 000000001afaff3b base addr 0x00000081000000 size 0x400000
[    4.056440] brcmfmac: brcmf_chip_recognition found AXI chip: BCM4364/3
[    4.062520] brcmfmac: brcmf_chip_cores_check  [1 ] core 0x800:59 base 0x18000000 wrap 0x18100000
[    4.062522] brcmfmac: brcmf_chip_cores_check  [2 ] core 0x812:58 base 0x18001000 wrap 0x18101000
[    4.062522] brcmfmac: brcmf_chip_cores_check  [3 ] core 0x83e:12 base 0x18002000 wrap 0x18102000
[    4.062523] brcmfmac: brcmf_chip_cores_check  [4 ] core 0x83c:16 base 0x18003000 wrap 0x18103000
[    4.062523] brcmfmac: brcmf_chip_cores_check  [5 ] core 0x812:58 base 0x18004000 wrap 0x18104000
[    4.062524] brcmfmac: brcmf_chip_cores_check  [6 ] core 0x829:22 base 0x18005000 wrap 0x18105000
[    4.062525] brcmfmac: brcmf_chip_cores_check  [7 ] core 0x840:7  base 0x1800a000 wrap 0x00000000
[    4.062525] brcmfmac: brcmf_chip_cores_check  [8 ] core 0x135:0  base 0x00000000 wrap 0x18108000
[    4.062526] brcmfmac: brcmf_chip_cores_check  [9 ] core 0x240:0  base 0x00000000 wrap 0x00000000
[    4.062526] brcmfmac: brcmf_chip_set_passive Enter
[    4.169825] brcmfmac: brcmf_chip_set_passive Enter
[    4.170427] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x160000 size=1310720 (0x140000) sr=0 (0x0)
[    4.170439] brcmfmac: brcmf_chip_setup ccrev=59, pmurev=29, pmucaps=0x3c8c3f1d
[    4.170440] brcmfmac: brcmf_get_module_param Enter, bus=2, chip=17252, rev=3
[    4.170444] brcmfmac: brcmf_alloc Enter
[    4.170451] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[    4.173974] brcmfmac: brcmf_fw_get_firmwares enter: dev=0000:05:00.0
[    4.175877] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4364-pcie.bin found
[    4.176362] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4364-pcie.txt found
[    4.176364] brcmfmac: brcmf_fw_request_nvram_done enter: dev=0000:05:00.0
[    4.176490] brcmfmac: brcmf_fw_request_nvram_done nvram 000000009a836282 len 12896
[    4.176812] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x160000 size=1310720 (0x140000) sr=0 (0x0)
[    4.176813] brcmfmac: brcmf_pcie_download_fw_nvram Halt ARM.
[    4.176814] brcmfmac: brcmf_pcie_download_fw_nvram Download FW brcm/brcmfmac4364-pcie.bin
[    4.466551] brcmfmac: brcmf_pcie_download_fw_nvram Download NVRAM brcm/brcmfmac4364-pcie.txt
[    4.468466] brcmfmac: brcmf_pcie_download_fw_nvram Bring ARM in running state
[    4.468467] brcmfmac: brcmf_chip_set_active Enter
[    4.468810] brcmfmac: brcmf_pcie_download_fw_nvram Wait for FW init
[    6.740083] brcmfmac 0000:05:00.0: brcmf_pcie_download_fw_nvram: FW failed to initialize
[    6.747010] brcmfmac: brcmf_pcie_remove Enter
[    6.747011] brcmfmac: brcmf_detach Enter
[    6.760007] brcmfmac: brcmf_bus_change_state 0 -> 0
[    6.760013] ------------[ cut here ]------------
[    6.760018] WARNING: CPU: 8 PID: 241 at kernel/workqueue.c:3037 __flush_work+0x1c8/0x1e0
[    6.760019] Modules linked in: input_leds hid_apple apple_ib_als(OE) industrialio_triggered_buffer kfifo_buf industrialio apple_ib_tb(OE) apple_ibridge(OE) uvcvideo videobuf2_vmalloc videobuf2_memops joydev videobuf2_v4l2 hid_generic cdc_mbim mousedev videobuf2_common cdc_wdm videodev cdc_ncm usbnet usbhid hid mc mii cmac algif_hash algif_skcipher af_alg intel_rapl_msr intel_rapl_common bnep x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul msr ghash_clmulni_intel brcmfmac brcmutil nls_iso8859_1 nls_cp437 snd_hda_codec_hdmi aesni_intel vfat fat snd_hda_intel crypto_simd cfg80211 mei_hdcp hci_uart snd_intel_nhlt 8250_dw cryptd glue_helper intel_cstate btqca intel_uncore btrtl iTCO_wdt btbcm iTCO_vendor_support btintel mei_me bluetooth intel_lpss_pci mmc_core snd_hda_codec intel_rapl_perf mei i2c_i801 pcspkr intel_lpss idma64 snd_hda_core intel_pch_thermal snd_hwdep ecdh_generic sbs rfkill apple_gmux ecc sbshc acpi_tad apple_bl evdev mac_hid
[    6.760049]  ac pkcs8_key_parser crypto_user apple_bce(OE) snd_pcm snd_timer snd soundcore ip_tables x_tables btrfs libcrc32c crc32c_generic xor raid6_pq xhci_pci crc32c_intel xhci_hcd amdgpu gpu_sched i2c_algo_bit ttm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm agpgart
[    6.760062] CPU: 8 PID: 241 Comm: kworker/8:1 Tainted: G           OE     5.4.6-1-mbp #1
[    6.760063] Hardware name: Apple Inc. MacBookPro15,3/Mac-1E7E29AD0135F9BC, BIOS 1037.60.58.0.0 (iBridge: 17.16.12551.0.0,0) 11/14/2019
[    6.760065] Workqueue: events request_firmware_work_func
[    6.760067] RIP: 0010:__flush_work+0x1c8/0x1e0
[    6.760069] Code: 8a 88 00 e8 fa 40 06 00 45 31 f6 eb 85 8b 0b 48 8b 53 08 83 e1 08 48 0f ba 2b 03 80 c9 f0 e9 4d ff ff ff 0f 0b e9 68 ff ff ff <0f> 0b 45 31 f6 e9 5e ff ff ff e8 e9 03 fe ff 66 0f 1f 84 00 00 00
[    6.760070] RSP: 0018:ffffad64c05cbbe0 EFLAGS: 00010246
[    6.760071] RAX: 0000000000000000 RBX: ffff8c6e41f0e948 RCX: 0000000000000000
[    6.760072] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffffad64c05cbc28
[    6.760072] RBP: 0000000000000000 R08: 0000000000000648 R09: 0000000000000004
[    6.760073] R10: 0000000000000000 R11: 0000000000000001 R12: ffff8c6e41f0e948
[    6.760073] R13: ffffad64c05cbbe0 R14: 0000000000000001 R15: 0000000000000000
[    6.760074] FS:  0000000000000000(0000) GS:ffff8c6e5ea00000(0000) knlGS:0000000000000000
[    6.760075] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    6.760076] CR2: 0000556b3658bae8 CR3: 00000004fac0a001 CR4: 00000000003606e0
[    6.760077] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    6.760078] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    6.760078] Call Trace:
[    6.760083]  __cancel_work_timer+0x123/0x1b0
[    6.760094]  brcmf_fweh_detach+0x15/0x60 [brcmfmac]
[    6.760103]  brcmf_detach+0x80/0xd0 [brcmfmac]
[    6.760113]  brcmf_pcie_remove+0x70/0x110 [brcmfmac]
[    6.760115]  pci_device_remove+0x3b/0xa0
[    6.760118]  device_release_driver_internal+0xe4/0x1c0
[    6.760128]  brcmf_pcie_setup+0x38/0xd90 [brcmfmac]
[    6.760137]  brcmf_fw_request_done+0x65/0xe0 [brcmfmac]
[    6.760139]  request_firmware_work_func+0x4f/0x8d
[    6.760141]  process_one_work+0x1e2/0x3b0
[    6.760143]  worker_thread+0x4a/0x3d0
[    6.760145]  kthread+0xfb/0x130
[    6.760147]  ? process_one_work+0x3b0/0x3b0
[    6.760148]  ? kthread_park+0x90/0x90
[    6.760150]  ret_from_fork+0x1f/0x40
[    6.760153] ---[ end trace 83d738c81ce04d69 ]---
[    6.760165] ------------[ cut here ]------------
[    6.760173] WARNING: CPU: 8 PID: 241 at drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c:309 brcmf_fweh_detach+0x5b/0x60 [brcmfmac]
[    6.760173] Modules linked in: input_leds hid_apple apple_ib_als(OE) industrialio_triggered_buffer kfifo_buf industrialio apple_ib_tb(OE) apple_ibridge(OE) uvcvideo videobuf2_vmalloc videobuf2_memops joydev videobuf2_v4l2 hid_generic cdc_mbim mousedev videobuf2_common cdc_wdm videodev cdc_ncm usbnet usbhid hid mc mii cmac algif_hash algif_skcipher af_alg intel_rapl_msr intel_rapl_common bnep x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul msr ghash_clmulni_intel brcmfmac brcmutil nls_iso8859_1 nls_cp437 snd_hda_codec_hdmi aesni_intel vfat fat snd_hda_intel crypto_simd cfg80211 mei_hdcp hci_uart snd_intel_nhlt 8250_dw cryptd glue_helper intel_cstate btqca intel_uncore btrtl iTCO_wdt btbcm iTCO_vendor_support btintel mei_me bluetooth intel_lpss_pci mmc_core snd_hda_codec intel_rapl_perf mei i2c_i801 pcspkr intel_lpss idma64 snd_hda_core intel_pch_thermal snd_hwdep ecdh_generic sbs rfkill apple_gmux ecc sbshc acpi_tad apple_bl evdev mac_hid
[    6.760191]  ac pkcs8_key_parser crypto_user apple_bce(OE) snd_pcm snd_timer snd soundcore ip_tables x_tables btrfs libcrc32c crc32c_generic xor raid6_pq xhci_pci crc32c_intel xhci_hcd amdgpu gpu_sched i2c_algo_bit ttm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm agpgart
[    6.760198] CPU: 8 PID: 241 Comm: kworker/8:1 Tainted: G        W  OE     5.4.6-1-mbp #1
[    6.760198] Hardware name: Apple Inc. MacBookPro15,3/Mac-1E7E29AD0135F9BC, BIOS 1037.60.58.0.0 (iBridge: 17.16.12551.0.0,0) 11/14/2019
[    6.760200] Workqueue: events request_firmware_work_func
[    6.760208] RIP: 0010:brcmf_fweh_detach+0x5b/0x60 [brcmfmac]
[    6.760209] Code: 48 c7 83 e0 21 00 00 00 00 00 00 48 c7 83 30 26 00 00 00 00 00 00 48 83 e7 f8 29 fb 8d 8b 38 26 00 00 c1 e9 03 f3 48 ab 5b c3 <0f> 0b eb c9 90 0f 1f 44 00 00 89 f0 48 8d 04 c7 48 83 b8 e0 21 00
[    6.760210] RSP: 0018:ffffad64c05cbcd8 EFLAGS: 00010282
[    6.760211] RAX: 0000000000000000 RBX: ffff8c6e41f0c7a0 RCX: 0000000000000000
[    6.760211] RDX: ffff8c6e41f0e970 RSI: 0000000000000001 RDI: ffffad64c05cbc28
[    6.760212] RBP: ffff8c6e41f0c7a0 R08: 0000000000000648 R09: 0000000000000004
[    6.760212] R10: 0000000000000000 R11: 0000000000000001 R12: ffff8c6e41f0c850
[    6.760213] R13: ffff8c6e598310b0 R14: 00000000f3680c97 R15: 0000000000000000
[    6.760214] FS:  0000000000000000(0000) GS:ffff8c6e5ea00000(0000) knlGS:0000000000000000
[    6.760215] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    6.760216] CR2: 0000556b3658bae8 CR3: 00000004fac0a001 CR4: 00000000003606e0
[    6.760216] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    6.760217] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    6.760217] Call Trace:
[    6.760225]  brcmf_detach+0x80/0xd0 [brcmfmac]
[    6.760234]  brcmf_pcie_remove+0x70/0x110 [brcmfmac]
[    6.760236]  pci_device_remove+0x3b/0xa0
[    6.760238]  device_release_driver_internal+0xe4/0x1c0
[    6.760246]  brcmf_pcie_setup+0x38/0xd90 [brcmfmac]
[    6.760255]  brcmf_fw_request_done+0x65/0xe0 [brcmfmac]
[    6.760257]  request_firmware_work_func+0x4f/0x8d
[    6.760259]  process_one_work+0x1e2/0x3b0
[    6.760261]  worker_thread+0x4a/0x3d0
[    6.760263]  kthread+0xfb/0x130
[    6.760264]  ? process_one_work+0x3b0/0x3b0
[    6.760265]  ? kthread_park+0x90/0x90
[    6.760267]  ret_from_fork+0x1f/0x40
[    6.760269] ---[ end trace 83d738c81ce04d6a ]---
[    6.760271] brcmfmac: brcmf_proto_detach Enter

Xinkai avatar Dec 24 '19 07:12 Xinkai

From what I understand, the firmware is executed not on the CPU but on the Wifi device. Is there a way to make the Broadcom chip talk back so we can know what's going on? I noticed that there's a fwsignal.c file in the kernel tree that suggests it kinda does that, but I don't know how to use it.

Let me know if any more information is needed.

Xinkai avatar Dec 24 '19 08:12 Xinkai

similar issue with mbp 15,4 it uses a BCM4377 with a device id: 4488 coultn't find anything about it. attempted to implement it like in https://mrarm.io/u/Paste%202019-07-26%2012-30-16.txt but with 4488 instead of 4464 & 4377 instead of 4364, copied the trx, clmb, and txt, from macOS but when i load the brcmfmac module this happens:

on macOS:

$ ioreg -l | grep RequestedFiles
"RequestedFiles" = ({"Firmware"="C-4377__s-B3/formosa.trx","TxCap"="C-4377__s-B3/formosa-X3.txcb","Regulatory"="C-4377__s-B3/formosa-X3.clmb","NVRAM"="C-4377__s-B3/P-formosa-X3_M-SPPR_V-u__m-3.1.txt"})

on linux 5.4.6:

# modprobe brcmfmac
[24.xxxxx] brcmfmac: brcmf_fw_alloc_request: using brcmfmac4377-pcie for chip 4377/4
[26.xxxxx] brcmfmac: 0000:01:00.0 brcmf_pcie_download_nvram: Invalid shared RAM address 0xfffffff

then my mac freezes and after a few seconds it restarts. this only happens when i have the brcmfmac4377-pcie* files in /lib/firmware/brcm otherwise it obviously just exits with cant find the files.

output of lspci shows 2 Broadcom network controllers:

00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation Device 3ea6 (rev 01)
00:12.0 Signal processing controller: Intel Corporation Cannon Point-LP Thermal Controller (rev 30)
00:14.0 USB controller: Intel Corporation Cannon Point-LP USB 3.1 xHCI Controller (rev 30)
00:14.2 RAM memory: Intel Corporation Cannon Point-LP Shared SRAM (rev 30)
00:16.0 Communication controller: Intel Corporation Cannon Point-LP MEI Controller #1 (rev 30)
00:1c.0 PCI bridge: Intel Corporation Device 9dba (rev f0)
00:1c.4 PCI bridge: Intel Corporation Cannon Point-LP PCI Express Root Port #5 (rev f0)
00:1d.0 PCI bridge: Intel Corporation Cannon Point-LP PCI Express Root Port #13 (rev f0)
00:1e.0 Communication controller: Intel Corporation Device 9da8 (rev 30)
00:1f.0 ISA bridge: Intel Corporation Cannon Point-LP LPC Controller (rev 30)
00:1f.3 Audio device: Intel Corporation Cannon Point-LP High Definition Audio Controller (rev 30)
00:1f.4 SMBus: Intel Corporation Cannon Point-LP SMBus Controller (rev 30)
00:1f.5 Serial bus controller [0c80]: Intel Corporation Cannon Point-LP SPI Controller (rev 30)
01:00.0 Network controller: Broadcom Inc. and subsidiaries Device 4488 (rev 04)
01:00.1 Network controller: Broadcom Inc. and subsidiaries Device 5fa0 (rev 04)
02:00.0 Mass storage controller: Apple Inc. ANS2 NVMe Controller (rev 01)
02:00.1 Non-VGA unclassified device: Apple Inc. T2 Bridge Controller (rev 01)
02:00.2 Non-VGA unclassified device: Apple Inc. T2 Secure Enclave Processor (rev 01)
02:00.3 Multimedia audio controller: Apple Inc. Apple Audio Device (rev 01)
03:00.0 PCI bridge: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] (rev 06)
04:00.0 PCI bridge: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] (rev 06)
04:01.0 PCI bridge: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] (rev 06)
04:02.0 PCI bridge: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] (rev 06)
04:04.0 PCI bridge: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] (rev 06)
05:00.0 System peripheral: Intel Corporation JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] (rev 06)
06:00.0 USB controller: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] (rev 06)

would be nice if anyone could help me :)

yurnam avatar Dec 30 '19 20:12 yurnam

@yurnam The patch that you are basing your changes on is incomplete as it does not include the rambase address diff.

Since this a new chip variant, we can potentially determine the rambase by enabling some more debug info. Please post the dmesg output with the additional kernel argument brcmfmac.debug=2097150. I'm particularly interested in the line containing brcmf_chip_get_raminfo.

Can you also clone this repo and runget-info.sh and PR the results. the 15,4 variant seems to differ quite a bit AFAI can tell.

aunali1 avatar Dec 31 '19 00:12 aunali1

oh sorry, I was using the patch which includes the rambase address 0x160000 i used this address also for the 4377 chip, which was probably a bad idea. if i change or remove it, the mac doesnt freeze anymore.

anyway i made a PR to your repo with the mbp15,4 dumps thank you!

EDIT:

# dmesg | grep brcmf
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.5.0-rc4 root=UUID=967cef72-c47e-4565-9c41-92ef1ac054da ro quiet splash brcmfmac.debug=2097150
[    0.115316] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.5.0-rc4 root=UUID=967cef72-c47e-4565-9c41-92ef1ac054da ro quiet splash brcmfmac.debug=2097150
[   34.604791] brcmfmac: brcmfmac_module_init No platform data available.
[   34.604797] brcmfmac: brcmf_pcie_register Enter
[   34.604817] brcmfmac: brcmf_pcie_probe Enter 14e4:4488
[   34.619461] brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
[   34.619646] brcmfmac: brcmf_pcie_get_resource Phys addr : reg space = 00000000f51725ac base addr 0x00000091800000
[   34.619647] brcmfmac: brcmf_pcie_get_resource Phys addr : mem space = 0000000046ec6721 base addr 0x00000091000000 size 0x400000
[   34.619755] brcmfmac: brcmf_chip_recognition found AXI chip: BCM4377/4
[   34.620125] brcmfmac: brcmf_chip_cores_check  [1 ] core 0x800:64 base 0x18000000 wrap 0x18100000
[   34.620126] brcmfmac: brcmf_chip_cores_check  [2 ] core 0x812:82 base 0x18001000 wrap 0x18101000
[   34.620127] brcmfmac: brcmf_chip_cores_check  [3 ] core 0x83e:15 base 0x18002000 wrap 0x18102000
[   34.620127] brcmfmac: brcmf_chip_cores_check  [4 ] core 0x83c:64 base 0x18003000 wrap 0x18103000
[   34.620128] brcmfmac: brcmf_chip_cores_check  [5 ] core 0x812:82 base 0x18004000 wrap 0x18104000
[   34.620128] brcmfmac: brcmf_chip_cores_check  [6 ] core 0x844:2  base 0x18005000 wrap 0x18105000
[   34.620129] brcmfmac: brcmf_chip_cores_check  [7 ] core 0x840:15 base 0x18010000 wrap 0x00000000
[   34.620130] brcmfmac: brcmf_chip_cores_check  [8 ] core 0x827:35 base 0x18012000 wrap 0x00000000
[   34.620130] brcmfmac: brcmf_chip_cores_check  [9 ] core 0x240:0  base 0x00000000 wrap 0x1810c000
[   34.620131] brcmfmac: brcmf_chip_cores_check  [10] core 0x135:0  base 0x00000000 wrap 0x18112000
[   34.620131] brcmfmac: brcmf_chip_cores_check  [11] core 0x135:0  base 0x00000000 wrap 0x18113000
[   34.620132] brcmfmac: brcmf_chip_set_passive Enter
[   34.725973] brcmfmac: brcmf_chip_set_passive Enter
[   34.726751] brcmfmac: brcmf_chip_tcm_rambase: unknown chip: BCM4377/4
[   34.726870] brcmfmac: brcmf_chip_get_raminfo: RAM base not provided with ARM CR4 core
[   34.726996] brcmfmac: brcmf_pcie_probe: failed 14e4:4488
[   34.727401] brcmfmac: probe of 0000:01:00.0 failed with error -22

yurnam avatar Dec 31 '19 01:12 yurnam

@yurnam Hmm, it seems that the rambase address needs to be found through trial and error. Can you please test through the rambase addresses in this switch case (0x160000 is already known not to work).

aunali1 avatar Jan 01 '20 00:01 aunali1

dmesg.txt tried all of them output looks always like this:

$ dmesg | grep brcmf

[    0.115781] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.5.0-rc4 root=UUID=967cef72-c47e-4565-9c41-92ef1ac054da ro net.ifnames=0 biosdevname=0 quiet splash brcmfmac.debug=2097150
[  229.970017] brcmfmac: brcmfmac_module_init No platform data available.
[  229.970022] brcmfmac: brcmf_pcie_register Enter
[  229.970038] brcmfmac: brcmf_pcie_probe Enter 14e4:4488
[  229.986615] brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
[  229.986852] brcmfmac: brcmf_pcie_get_resource Phys addr : reg space = 00000000fbeb7416 base addr 0x00000091800000
[  229.986853] brcmfmac: brcmf_pcie_get_resource Phys addr : mem space = 000000004919b7a6 base addr 0x00000091000000 size 0x400000
[  229.986962] brcmfmac: brcmf_chip_recognition found AXI chip: BCM4377/4
[  229.987331] brcmfmac: brcmf_chip_cores_check  [1 ] core 0x800:64 base 0x18000000 wrap 0x18100000
[  229.987332] brcmfmac: brcmf_chip_cores_check  [2 ] core 0x812:82 base 0x18001000 wrap 0x18101000
[  229.987333] brcmfmac: brcmf_chip_cores_check  [3 ] core 0x83e:15 base 0x18002000 wrap 0x18102000
[  229.987334] brcmfmac: brcmf_chip_cores_check  [4 ] core 0x83c:64 base 0x18003000 wrap 0x18103000
[  229.987334] brcmfmac: brcmf_chip_cores_check  [5 ] core 0x812:82 base 0x18004000 wrap 0x18104000
[  229.987335] brcmfmac: brcmf_chip_cores_check  [6 ] core 0x844:2  base 0x18005000 wrap 0x18105000
[  229.987336] brcmfmac: brcmf_chip_cores_check  [7 ] core 0x840:15 base 0x18010000 wrap 0x00000000
[  229.987336] brcmfmac: brcmf_chip_cores_check  [8 ] core 0x827:35 base 0x18012000 wrap 0x00000000
[  229.987337] brcmfmac: brcmf_chip_cores_check  [9 ] core 0x240:0  base 0x00000000 wrap 0x1810c000
[  229.987338] brcmfmac: brcmf_chip_cores_check  [10] core 0x135:0  base 0x00000000 wrap 0x18112000
[  229.987338] brcmfmac: brcmf_chip_cores_check  [11] core 0x135:0  base 0x00000000 wrap 0x18113000
[  229.987339] brcmfmac: brcmf_chip_set_passive Enter
[  230.093188] brcmfmac: brcmf_chip_set_passive Enter
[  230.093773] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x198000 size=1638400 (0x190000) sr=0 (0x0)
[  230.093784] brcmfmac: brcmf_chip_setup ccrev=64, pmurev=35, pmucaps=0x84565f23
[  230.093786] brcmfmac: brcmf_get_module_param Enter, bus=2, chip=17271, rev=4
[  230.093790] brcmfmac: brcmf_alloc Enter
[  230.093802] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4377-pcie for chip BCM4377/4
[  230.093807] brcmfmac: brcmf_fw_get_firmwares enter: dev=0000:01:00.0
[  230.096520] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4377-pcie.bin found
[  230.097082] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4377-pcie.txt found
[  230.097084] brcmfmac: brcmf_fw_request_nvram_done enter: dev=0000:01:00.0
[  230.097298] brcmfmac: brcmf_fw_request_nvram_done nvram 0000000021820ad9 len 4924
[  230.097457] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x198000 size=1638400 (0x190000) sr=0 (0x0)
[  230.097458] brcmfmac: brcmf_pcie_download_fw_nvram Halt ARM.
[  230.097459] brcmfmac: brcmf_pcie_download_fw_nvram Download FW brcm/brcmfmac4377-pcie.bin
[  230.259368] brcmfmac: brcmf_pcie_download_fw_nvram Download NVRAM brcm/brcmfmac4377-pcie.txt
[  230.260366] brcmfmac: brcmf_pcie_download_fw_nvram Bring ARM in running state
[  230.260367] brcmfmac: brcmf_chip_set_active Enter
[  230.260566] brcmfmac: brcmf_pcie_download_fw_nvram Wait for FW init
[  232.533371] brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: FW failed to initialize
[  232.533394] brcmfmac: brcmf_pcie_remove Enter
[  232.533397] brcmfmac: brcmf_detach Enter
[  232.560082] brcmfmac: brcmf_bus_change_state 0 -> 0
[  232.560111] Modules linked in: brcmfmac brcmutil sd_mod sg uas usb_storage scsi_mod r8188eu(C) lib80211 cfg80211 fuse hid_apple input_leds apple_ib_als(OE) industrialio_triggered_buffer kfifo_buf industrialio apple_ib_tb(OE) apple_ibridge(OE) joydev cdc_mbim cdc_wdm mousedev hid_generic uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev cdc_ncm usbhid usbnet mc hid mii snd_hda_codec_hdmi squashfs rfkill loop intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_sof_pci kvm_intel snd_sof_intel_byt i915 snd_sof_intel_ipc kvm snd_sof_xtensa_dsp snd_sof_intel_hda_common snd_soc_hdac_hda irqbypass snd_sof_intel_hda snd_sof snd_hda_ext_core snd_soc_acpi_intel_match i2c_algo_bit crct10dif_pclmul snd_soc_acpi crc32_pclmul ledtrig_audio drm_kms_helper ghash_clmulni_intel snd_soc_core nls_iso8859_1 snd_compress aesni_intel nls_cp437 drm ac97_bus crypto_simd vfat snd_pcm_dmaengine fat cryptd glue_helper mei_hdcp intel_gtt intel_cstate
[  232.560329]  ? __brcmf_dbg+0x8b/0x110 [brcmfmac]
[  232.560362]  brcmf_fweh_detach+0x15/0x60 [brcmfmac]
[  232.560378]  brcmf_detach+0x72/0xf0 [brcmfmac]
[  232.560395]  brcmf_pcie_remove+0x70/0x110 [brcmfmac]
[  232.560426]  brcmf_pcie_setup+0x38/0xd70 [brcmfmac]
[  232.560446]  brcmf_fw_request_done+0x65/0xe0 [brcmfmac]
[  232.560555] WARNING: CPU: 7 PID: 182 at drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c:309 brcmf_fweh_detach+0x5b/0x60 [brcmfmac]
[  232.560556] Modules linked in: brcmfmac brcmutil sd_mod sg uas usb_storage scsi_mod r8188eu(C) lib80211 cfg80211 fuse hid_apple input_leds apple_ib_als(OE) industrialio_triggered_buffer kfifo_buf industrialio apple_ib_tb(OE) apple_ibridge(OE) joydev cdc_mbim cdc_wdm mousedev hid_generic uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev cdc_ncm usbhid usbnet mc hid mii snd_hda_codec_hdmi squashfs rfkill loop intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_sof_pci kvm_intel snd_sof_intel_byt i915 snd_sof_intel_ipc kvm snd_sof_xtensa_dsp snd_sof_intel_hda_common snd_soc_hdac_hda irqbypass snd_sof_intel_hda snd_sof snd_hda_ext_core snd_soc_acpi_intel_match i2c_algo_bit crct10dif_pclmul snd_soc_acpi crc32_pclmul ledtrig_audio drm_kms_helper ghash_clmulni_intel snd_soc_core nls_iso8859_1 snd_compress aesni_intel nls_cp437 drm ac97_bus crypto_simd vfat snd_pcm_dmaengine fat cryptd glue_helper mei_hdcp intel_gtt intel_cstate
[  232.560678] RIP: 0010:brcmf_fweh_detach+0x5b/0x60 [brcmfmac]
[  232.560730]  brcmf_detach+0x72/0xf0 [brcmfmac]
[  232.560747]  brcmf_pcie_remove+0x70/0x110 [brcmfmac]
[  232.560784]  brcmf_pcie_setup+0x38/0xd70 [brcmfmac]
[  232.560812]  brcmf_fw_request_done+0x65/0xe0 [brcmfmac]
[  232.560879] brcmfmac: brcmf_proto_detach Enter

full dmesg output is in attached file.

yurnam avatar Jan 01 '20 00:01 yurnam

is there any other way finding out what to do;

just trying to bruteforce the rambase address doesn't seem to help

yurnam avatar Jan 06 '20 20:01 yurnam

I am having trouble getting my Macbook Air 8,2 to get wifi. Here is what I did:

From MacOS: ioreg -l | grep RequestedFiles C-4355__s-C1/hawaii.trx, C-4355__s-C1/hawaii-X0.clmb, C-4355__s-C1/P-hawaii-X0_M-YSBC_V-u__m-4.3.txt

... So I copied these files and I installed fedora.

From Fedora:

I pasted these files as such:

C-4355__s-C1/hawaii.trx -> /lib/firmware/brcm/brcmfmac4355-pcie.bin C-4355__s-C1/hawaii-X0.clmb -> /lib/firmware/brcm/brcmfmac4355-pcie.clm_blob C-4355__s-C1/P-hawaii-X0_M-YSBC_V-u__m-4.3.txt -> "/lib/firmware/brcm/brcmfmac4355-pcie.Apple Inc.-MacBookAir8,2.txt"

I definitely did not make any typos when I plugged this in. The wifi does not come online. Did I miss any steps? Any help would be greatly appreciated

ktb92677 avatar Jan 07 '20 19:01 ktb92677

Hey @jhohisel you seemed to have success getting the wifi drivers working on a MacBookAir8,2. Any chance you can see anything I am doing wrong with my configuration?

ktb92677 avatar Jan 07 '20 23:01 ktb92677

Quick follow up, wanted to also include @ppaulweber into this conversation as you also seemed to have success at loading brcmfmac4355 successfully. Any chance you can think of what I am doing wrong? Also take a look at this thread: https://github.com/mikeeq/mbp-fedora-kernel/issues/3#issuecomment-572193109

ktb92677 avatar Jan 09 '20 15:01 ktb92677

Hey @aunali1 I think it might be time to remove the check mark from MacBookAir8,y... I don't think it is loading properly at this point and the only person who claims to have gotten it to work properly has seemingly disappeared. @jhohisel

ktb92677 avatar Jan 11 '20 18:01 ktb92677

@ktb92677 Can you try using my kernel patches to see if that makes a difference? I also have lingering suspicions that certain revised models have entirely different FW (Ex. 15,1 2018 uses kauai whereas 15,1 2019 uses midway). Not exactly sure how to proceed, we might have to add functionality found in Apple's BCMWLAN driver that is not present in brcmfmac.

aunali1 avatar Jan 11 '20 19:01 aunali1

@aunali1 Is this the patch you are referring to? https://github.com/aunali1/linux-mbp-arch/blob/master/wifi.patch Because if so it is nearly identical to the patch I am already using: https://github.com/mikeeq/mbp-fedora-kernel/blob/v5.4-f31/patches/wifi.patch

ktb92677 avatar Jan 11 '20 20:01 ktb92677

@yurnam Others have had success using the firmware archive from macOS Mojave I have hosted here: https://packages.aunali1.com/apple/wifi-fw/18G2022

aunali1 avatar Jan 12 '20 17:01 aunali1

Cool, thanks, I'll try this now :)

yurnam avatar Jan 12 '20 17:01 yurnam

Sadly, no luck with the FW from Mojave. but with rambase 0x160000 i don't get a system freeze anymore, just a FW failed to initalize like before.

same with all the rambase addresses (0x160000, 0x180000, 0x198000, 0x200000)

yurnam avatar Jan 12 '20 18:01 yurnam

Update: With Rambase address 0x170000 I get: `# modprobe brcmfmac $ dmesg -w

[ 237.522523] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 237.522689] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 237.545236] brcmfmac: brcmfmac_module_init No platform data available. [ 237.545247] brcmfmac: brcmf_usb_register Enter [ 237.545265] usbcore: registered new interface driver brcmfmac [ 237.545265] brcmfmac: brcmf_pcie_register Enter [ 237.545283] brcmfmac: brcmf_pcie_probe Enter 14e4:4488 [ 237.545580] brcmfmac: brcmf_pcie_get_resource Phys addr : reg space = 000000003b8600be base addr 0x00000091800000 [ 237.545581] brcmfmac: brcmf_pcie_get_resource Phys addr : mem space = 00000000d6c2949d base addr 0x00000091000000 size 0x400000 [ 237.545696] brcmfmac: brcmf_chip_recognition found AXI chip: BCM4377/4 [ 237.546156] brcmfmac: brcmf_chip_cores_check [1 ] core 0x800:64 base 0x18000000 wrap 0x18100000 [ 237.546157] brcmfmac: brcmf_chip_cores_check [2 ] core 0x812:82 base 0x18001000 wrap 0x18101000 [ 237.546158] brcmfmac: brcmf_chip_cores_check [3 ] core 0x83e:15 base 0x18002000 wrap 0x18102000 [ 237.546158] brcmfmac: brcmf_chip_cores_check [4 ] core 0x83c:64 base 0x18003000 wrap 0x18103000 [ 237.546159] brcmfmac: brcmf_chip_cores_check [5 ] core 0x812:82 base 0x18004000 wrap 0x18104000 [ 237.546160] brcmfmac: brcmf_chip_cores_check [6 ] core 0x844:2 base 0x18005000 wrap 0x18105000 [ 237.546161] brcmfmac: brcmf_chip_cores_check [7 ] core 0x840:15 base 0x18010000 wrap 0x00000000 [ 237.546161] brcmfmac: brcmf_chip_cores_check [8 ] core 0x827:35 base 0x18012000 wrap 0x00000000 [ 237.546162] brcmfmac: brcmf_chip_cores_check [9 ] core 0x240:0 base 0x00000000 wrap 0x1810c000 [ 237.546164] brcmfmac: brcmf_chip_cores_check [10] core 0x135:0 base 0x00000000 wrap 0x18112000 [ 237.546164] brcmfmac: brcmf_chip_cores_check [11] core 0x135:0 base 0x00000000 wrap 0x18113000 [ 237.546165] brcmfmac: brcmf_chip_set_passive Enter [ 237.653024] brcmfmac: brcmf_chip_set_passive Enter [ 237.653801] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x170000 size=1638400 (0x190000) sr=0 (0x0) [ 237.653815] brcmfmac: brcmf_chip_setup ccrev=64, pmurev=35, pmucaps=0x84565f23 [ 237.653820] brcmfmac: brcmf_get_module_param Enter, bus=2, chip=17271, rev=4 [ 237.653828] brcmfmac: brcmf_alloc Enter [ 237.653851] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4377-pcie for chip BCM4377/4 [ 237.653859] brcmfmac: brcmf_fw_get_firmwares enter: dev=0000:01:00.0 [ 237.654720] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4377-pcie.bin found [ 237.654757] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4377-pcie.txt found [ 237.654759] brcmfmac: brcmf_fw_request_nvram_done enter: dev=0000:01:00.0 [ 237.655106] brcmfmac: brcmf_fw_request_nvram_done nvram 000000003dcb3447 len 4940 [ 237.655541] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x170000 size=1638400 (0x190000) sr=0 (0x0) [ 237.655544] brcmfmac: brcmf_pcie_download_fw_nvram Halt ARM. [ 237.655546] brcmfmac: brcmf_pcie_download_fw_nvram Download FW brcm/brcmfmac4377-pcie.bin [ 237.799783] brcmfmac: brcmf_pcie_download_fw_nvram Download NVRAM brcm/brcmfmac4377-pcie.txt [ 237.801348] brcmfmac: brcmf_pcie_download_fw_nvram Bring ARM in running state [ 237.801348] brcmfmac: brcmf_chip_set_active Enter [ 237.801828] brcmfmac: brcmf_pcie_download_fw_nvram Wait for FW init [ 238.196474] brcmfmac: brcmf_pcie_download_fw_nvram Shared RAM addr: 0x001f5de0 [ 238.196591] brcmfmac: brcmf_pcie_init_share_ram_info PCIe protocol version 7 [ 238.196603] brcmfmac: brcmf_pcie_init_share_ram_info max rx buf post 511, rx dataoffset 0 [ 238.196612] brcmfmac: brcmf_pcie_bus_console_init Console: base 2bb850, buf 268650, size 8192 [ 238.196658] brcmfmac: brcmf_pcie_init_ringbuffers Using host memory indices [ 238.196706] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 40 [ 238.196782] brcmfmac: brcmf_pcie_request_irq Enter [ 238.197454] brcmfmac: brcmf_attach Enter [ 238.197460] brcmfmac: brcmf_proto_attach Enter [ 238.197816] brcmfmac: brcmf_proto_msgbuf_attach Feeding buffers, rx data 511, rx event 8, rx ioctl resp 8 [ 238.199065] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 511 (0), ring 1 [ 238.199069] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING ! [ 238.199101] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 8 (0), ring 0 [ 238.199103] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING ! [ 238.199130] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 16 (0), ring 0 [ 238.199132] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING ! [ 238.199138] brcmfmac: brcmf_fweh_register event handler registered for PSM_WATCHDOG [ 238.199141] brcmfmac: brcmf_bus_started [ 238.199145] brcmfmac: brcmf_add_if Enter, bsscfgidx=0, ifidx=0 [ 238.199148] brcmfmac: brcmf_add_if allocate netdev interface [ 238.199167] brcmfmac: brcmf_add_if ==== pid:340, if:wlan%d (00:00:00:00:00:00) created === [ 238.199171] brcmfmac: brcmf_bus_change_state 0 -> 1 [ 238.199177] brcmfmac: brcmf_msgbuf_query_dcmd ifidx=0, cmd=262, len=20 [ 238.199181] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 17 (0), ring 0 [ 238.199184] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING ! [ 240.409699] ieee80211 phy0: brcmf_msgbuf_query_dcmd: Timeout on response for query command [ 240.409718] brcmfmac: brcmf_fil_cmd_data Failed: error=-5 [ 240.409725] brcmfmac: brcmf_fil_iovar_data_get ifidx=0, name=cur_etheraddr, len=6 [ 240.409728] brcmutil: data [ 240.409733] 00000000: 00 00 00 00 00 00 ...... [ 240.409738] ieee80211 phy0: brcmf_c_preinit_dcmds: Retrieving cur_etheraddr failed, -5 [ 240.409745] ieee80211 phy0: brcmf_bus_started: failed: -5 [ 240.409762] ieee80211 phy0: brcmf_attach: dongle is not responding: err=-5 [ 240.409767] brcmfmac: brcmf_detach Enter [ 240.437471] brcmfmac: brcmf_bus_change_state 1 -> 0 [ 240.437485] brcmfmac: brcmf_proto_detach Enter [ 240.437491] brcmfmac: brcmf_proto_msgbuf_detach Enter [ 240.439910] brcmfmac: brcmf_pcie_remove Enter [ 240.439919] brcmfmac: brcmf_detach Enter [ 240.466308] brcmfmac: brcmf_bus_change_state 0 -> 0 [ 240.466313] brcmfmac: brcmf_proto_detach Enter`

yurnam avatar Jan 13 '20 11:01 yurnam

On my 15,2 wifi spins forever looking for networks unless I boot with wifi off in network-manager, connect to my phone for internet using bluetooth, then enable wifi. Once I've connected once to the phone the list of wifi networks to connect to is populated normally and connecting is no problem.

thomasjenkins avatar Mar 05 '20 20:03 thomasjenkins

Hello,

I have the MacBook Pro (Retina, 15-inch, Late 2013) 03:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4360 802.11ac Wireless Network Adapter [14e4:43a0] (rev 03)

What are the exact macOS instructions to extract firmware and make it a bin file?

I run ioreg -l | grep RequestedFiles and i get no results but wifi works on macOS

joker5bb avatar Apr 21 '20 22:04 joker5bb

ioreg -l | grep BCM43                 
    | |   |       |   "IOFirmwareVersion" = "Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1600.4)"
    | |   |       | |   "IO80211DriverVersion" = "Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1600.4)"
user@cpe-67-243-215-191 ra2 % ls /System/Library/Extensions | grep -i BCM
AppleBCMWLANBusInterfacePCIe.kext
AppleBCMWLANCore.kext
BCMWLANFirmware4355_Hashstore.kext
BCMWLANFirmware4364_Hashstore.kext
BCMWLANFirmware4377_Hashstore.kext

joker5bb avatar Apr 23 '20 22:04 joker5bb

about bcm4377 - looking "inside" apple driver.. is almost identical as bcm4357 if something has to be patched/modded should be around linux driver for 4357 i.e "brcmsmac"

npx001 avatar Apr 26 '20 08:04 npx001

@yurnam I have a MacBookPro15,4 too, and I am trying to get the WiFi to work, did you manage to make it work?

MoonPadUSer avatar May 12 '20 13:05 MoonPadUSer

@MoonPadUSer Which kernel/distro are you testing?

aunali1 avatar May 12 '20 13:05 aunali1

@aunali1 I'm running your linux-mbp-arch kernel on Manjaro KDE 20.0

Edit: I ran sudo modprobe brcmfmac debug=xxx (whatever you told yurnam a while ago) and this is what came out after running sudo dmsg | grep -i brcmfmac

[11373.284509] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x170000 size=1638400 (0x190000) sr=0 (0x0)
[11373.285474] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x170000 size=1638400 (0x190000) sr=0 (0x0)

MoonPadUSer avatar May 12 '20 13:05 MoonPadUSer

@MoonPadUSer Unfortunately not. never got past this in dmesg:

[ 238.199167] brcmfmac: brcmf_add_if ==== pid:340, if:wlan%d (00:00:00:00:00:00) created === [ 238.199171] brcmfmac: brcmf_bus_change_state 0 -> 1 [ 238.199177] brcmfmac: brcmf_msgbuf_query_dcmd ifidx=0, cmd=262, len=20 [ 238.199181] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 17 (0), ring 0 [ 238.199184] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING ! [ 240.409699] ieee80211 phy0: brcmf_msgbuf_query_dcmd: Timeout on response for query command [ 240.409718] brcmfmac: brcmf_fil_cmd_data Failed: error=-5 [ 240.409725] brcmfmac: brcmf_fil_iovar_data_get ifidx=0, name=cur_etheraddr, len=6 [ 240.409728] brcmutil: data [ 240.409733] 00000000: 00 00 00 00 00 00 ...... [ 240.409738] ieee80211 phy0: brcmf_c_preinit_dcmds: Retrieving cur_etheraddr failed, -5 [ 240.409745] ieee80211 phy0: brcmf_bus_started: failed: -5 [ 240.409762] ieee80211 phy0: brcmf_attach: dongle is not responding: err=-5 [ 240.409767] brcmfmac: brcmf_detach Enter [ 240.437471] brcmfmac: brcmf_bus_change_state 1 -> 0

yurnam avatar May 12 '20 13:05 yurnam

@MoonPadUSer Can you pastebin/gist the full dmesg output?

aunali1 avatar May 12 '20 13:05 aunali1

@aunali1 https://pastebin.com/bqWZAk77

MoonPadUSer avatar May 12 '20 13:05 MoonPadUSer

@MoonPadUSer Unfortunately the kernel message ring buffer filled up and cut off the important bits. Please pastebin/gist one after a recent reboot.

aunali1 avatar May 12 '20 13:05 aunali1

@aunali1 https://pastebin.com/js3tefDX This one should have all the brcmf stuff in it

MoonPadUSer avatar May 12 '20 14:05 MoonPadUSer

@yurnam Yeah looks like the rambase is correct, but there is functionality missing in brcmfmac that is causing iee80211's etheraddr query request to fail. I'm assuming there's more to this chip's init process than what is done by brcmfmac.

aunali1 avatar May 12 '20 14:05 aunali1

@npx001 Care to elaborate on what you have found "looking inside" the apple driver?

aunali1 avatar May 12 '20 14:05 aunali1

@yurnam @MoonPadUSer Does an interface showup at all?

aunali1 avatar May 12 '20 14:05 aunali1

@aunali1 if I run 'ip link show' it only shows lo and an ethernet one

MoonPadUSer avatar May 12 '20 14:05 MoonPadUSer

as dmesg shows brcmf_detach there can't be an interface for the wifi adapter only lo and eth0 show up

yurnam avatar May 12 '20 14:05 yurnam

@yurnam have you tried the catalina files already?

MoonPadUSer avatar May 12 '20 15:05 MoonPadUSer

Just as a side note: I hosted a repository at https://github.com/stefanpartheym/mbp15-wifi-driver which contains the wifi driver files from a MacBookPro15,2 (Mojave), maybe that helps.

stefanpartheym avatar May 12 '20 17:05 stefanpartheym

@MoonPadUSer yes i tried both catalina and mojave files catalina files caused the OS to freeze when loading brcmfmac

yurnam avatar May 13 '20 05:05 yurnam

@aunal1 I'm not sure if this is like everything we had before but this log looks better to me as far as I can remember the other ones:

[   80.597836] brcmfmac: brcmfmac_module_init No platform data available.
[   80.597845] brcmfmac: brcmf_usb_register Enter
[   80.597868] usbcore: registered new interface driver brcmfmac
[   80.597869] brcmfmac: brcmf_pcie_register Enter
[   80.597884] brcmfmac: brcmf_pcie_probe Enter 14e4:4488
[   80.612411] brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
[   80.612865] brcmfmac: brcmf_pcie_get_resource Phys addr : reg space = 000000008a56960e base addr 0x00000091800000
[   80.612866] brcmfmac: brcmf_pcie_get_resource Phys addr : mem space = 00000000ef9f0f04 base addr 0x00000091000000 size 0x400000
[   80.612979] brcmfmac: brcmf_chip_recognition found AXI chip: BCM4377/4
[   80.613348] brcmfmac: brcmf_chip_cores_check  [1 ] core 0x800:64 base 0x18000000 wrap 0x18100000
[   80.613349] brcmfmac: brcmf_chip_cores_check  [2 ] core 0x812:82 base 0x18001000 wrap 0x18101000
[   80.613349] brcmfmac: brcmf_chip_cores_check  [3 ] core 0x83e:15 base 0x18002000 wrap 0x18102000
[   80.613350] brcmfmac: brcmf_chip_cores_check  [4 ] core 0x83c:64 base 0x18003000 wrap 0x18103000
[   80.613351] brcmfmac: brcmf_chip_cores_check  [5 ] core 0x812:82 base 0x18004000 wrap 0x18104000
[   80.613351] brcmfmac: brcmf_chip_cores_check  [6 ] core 0x844:2  base 0x18005000 wrap 0x18105000
[   80.613352] brcmfmac: brcmf_chip_cores_check  [7 ] core 0x840:15 base 0x18010000 wrap 0x00000000
[   80.613352] brcmfmac: brcmf_chip_cores_check  [8 ] core 0x827:35 base 0x18012000 wrap 0x00000000
[   80.613353] brcmfmac: brcmf_chip_cores_check  [9 ] core 0x240:0  base 0x00000000 wrap 0x1810c000
[   80.613354] brcmfmac: brcmf_chip_cores_check  [10] core 0x135:0  base 0x00000000 wrap 0x18112000
[   80.613354] brcmfmac: brcmf_chip_cores_check  [11] core 0x135:0  base 0x00000000 wrap 0x18113000
[   80.613355] brcmfmac: brcmf_chip_set_passive Enter
[   80.613904] brcmfmac: brcmf_chip_ai_resetcore found two d11 cores, reset both
[   80.718913] brcmfmac: brcmf_chip_set_passive Enter
[   80.719298] brcmfmac: brcmf_chip_ai_resetcore found two d11 cores, reset both
[   80.719854] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x170000 size=1638400 (0x190000) sr=0 (0x0)
[   80.719888] brcmfmac: brcmf_chip_setup ccrev=64, pmurev=35, pmucaps=0x84565f23
[   80.719894] brcmfmac: brcmf_get_module_param Enter, bus=2, chip=17271, rev=4
[   80.719904] brcmfmac: brcmf_alloc Enter
[   80.719931] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4377-pcie for chip BCM4377/4
[   80.719941] brcmfmac: brcmf_fw_get_firmwares enter: dev=0000:01:00.0
[   80.722904] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4377-pcie.bin found
[   80.723436] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac4377-pcie.txt found
[   80.723441] brcmfmac: brcmf_fw_request_nvram_done enter: dev=0000:01:00.0
[   80.723914] brcmfmac: brcmf_fw_request_nvram_done nvram 000000002dba9f83 len 4940
[   80.724155] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x170000 size=1638400 (0x190000) sr=0 (0x0)
[   80.724159] brcmfmac: brcmf_pcie_download_fw_nvram Halt ARM.
[   80.724162] brcmfmac: brcmf_pcie_download_fw_nvram Download FW brcm/brcmfmac4377-pcie.bin
[   80.868942] brcmfmac: brcmf_pcie_download_fw_nvram Download NVRAM brcm/brcmfmac4377-pcie.txt
[   80.870519] brcmfmac: brcmf_pcie_download_fw_nvram Bring ARM in running state
[   80.870520] brcmfmac: brcmf_chip_set_active Enter
[   80.870674] brcmfmac: brcmf_pcie_download_fw_nvram Wait for FW init
[   81.265684] brcmfmac: brcmf_pcie_download_fw_nvram Shared RAM addr: 0x001f5de0
[   81.265804] brcmfmac: brcmf_pcie_init_share_ram_info PCIe protocol version 7
[   81.265816] brcmfmac: brcmf_pcie_init_share_ram_info max rx buf post 511, rx dataoffset 0
[   81.265825] brcmfmac: brcmf_pcie_bus_console_init Console: base 2d04e0, buf 291f54, size 8192
[   81.265869] brcmfmac: brcmf_pcie_init_ringbuffers Using host memory indices
[   81.265916] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 40
[   81.265996] brcmfmac: brcmf_pcie_request_irq Enter
[   81.266623] brcmfmac: brcmf_attach Enter
[   81.266628] brcmfmac: brcmf_proto_attach Enter
[   81.266974] brcmfmac: brcmf_proto_msgbuf_attach Feeding buffers, rx data 511, rx event 8, rx ioctl resp 8
[   81.268139] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 511 (0), ring 1
[   81.268143] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING !
[   81.268172] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 8 (0), ring 0
[   81.268175] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING !
[   81.268199] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 16 (0), ring 0
[   81.268201] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING !
[   81.268206] brcmfmac: brcmf_fweh_register event handler registered for PSM_WATCHDOG
[   81.268209] brcmfmac: brcmf_bus_started 
[   81.268213] brcmfmac: brcmf_add_if Enter, bsscfgidx=0, ifidx=0
[   81.268216] brcmfmac: brcmf_add_if allocate netdev interface
[   81.268232] brcmfmac: brcmf_add_if  ==== pid:b6, if:wlan%d (00:00:00:00:00:00) created ===
[   81.268235] brcmfmac: brcmf_bus_change_state 0 -> 1
[   81.268241] brcmfmac: brcmf_msgbuf_query_dcmd ifidx=0, cmd=262, len=20
[   81.268245] brcmfmac: brcmf_pcie_ring_mb_write_wptr W w_ptr 17 (0), ring 0
[   81.268247] brcmfmac: brcmf_pcie_ring_mb_ring_bell RING !
[   83.332230] ieee80211 phy0: brcmf_msgbuf_query_dcmd: Timeout on response for query command
[   83.332245] brcmfmac: brcmf_fil_cmd_data Failed: error=-5
[   83.332251] brcmfmac: brcmf_fil_iovar_data_get ifidx=0, name=cur_etheraddr, len=6
[   83.332266] ieee80211 phy0: brcmf_c_preinit_dcmds: Retrieving cur_etheraddr failed, -5
[   83.332274] ieee80211 phy0: brcmf_bus_started: failed: -5
[   83.332293] ieee80211 phy0: brcmf_attach: dongle is not responding: err=-5
[   83.332299] brcmfmac: brcmf_detach Enter
[   83.355574] brcmfmac: brcmf_bus_change_state 1 -> 0
[   83.355583] brcmfmac: brcmf_proto_detach Enter
[   83.355586] brcmfmac: brcmf_proto_msgbuf_detach Enter
[   83.356941] brcmfmac: brcmf_pcie_remove Enter
[   83.356948] brcmfmac: brcmf_detach Enter
[   83.385562] brcmfmac: brcmf_bus_change_state 0 -> 0
[   83.385569] brcmfmac: brcmf_proto_detach Enter

MoonPadUSer avatar May 13 '20 14:05 MoonPadUSer

so ... I'm gonna take a look at the brcmfmac driver rn, and look what causes these errors to appear:

[   83.332245] brcmfmac: brcmf_fil_cmd_data Failed: error=-5
[   83.332266] ieee80211 phy0: brcmf_c_preinit_dcmds: Retrieving cur_etheraddr failed, -5
[   83.332274] ieee80211 phy0: brcmf_bus_started: failed: -5
[ 1407.918630] brcmfmac: brcmf_fil_cmd_data Failed: error=-5
[ 1407.918649] ieee80211 phy1: brcmf_c_preinit_dcmds: Retrieving cur_etheraddr failed, -5
[ 1407.918656] ieee80211 phy1: brcmf_bus_started: failed: -5

the error is always the same, but I don't know what it means, so if anyone know what error -5 is, please tell me

MoonPadUSer avatar May 13 '20 14:05 MoonPadUSer

@yurnam don't you think it's kinda weird that ip link show shows an ethernet device, but the MacBook itself, doesn't have a physical ethernet port.

MoonPadUSer avatar May 13 '20 17:05 MoonPadUSer

@MoonPadUSer Thats an NCM interface exposed by T2 for all userspace communication between macOS and itself.

aunali1 avatar May 13 '20 17:05 aunali1

@aunali1 oh, ok, thanks :) btw, if you have access to a MacBookPro15,2 (or whatever the model is with the BCM43602) it could be great if you could send the output of sudo dmesg | grep "brcm" and ip link show

MoonPadUSer avatar May 13 '20 17:05 MoonPadUSer

@MoonPadUSer BCM43602 is a chipset used on pre-T2 MBPs. Any specific reason you are looking into it?

aunali1 avatar May 13 '20 17:05 aunali1

@aunali1 oh, I thought that would be the one from the other MacBookPro15,x but if it isn't I'd like to see those outputs from a mac with an BCM4364

MoonPadUSer avatar May 13 '20 17:05 MoonPadUSer

@MoonPadUSer i know, but the eth0 interface doesn't have to be a Physical Port, it is most likely some internal device that is seen as ethernet device by linux

yurnam avatar May 13 '20 17:05 yurnam

@yurnam yeah, aunali1 already told me 'bout that :)

MoonPadUSer avatar May 13 '20 17:05 MoonPadUSer

@MoonPadUSer I'm on a MacBookPro15,2

ip link show:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
    link/ether 02:42:86:ea:90:31 brd ff:ff:ff:ff:ff:ff
3: enp2s0f1u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether ac:de:48:00:11:22 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DORMANT group default qlen 1000
    link/ether 88:e9:fe:7d:01:8f brd ff:ff:ff:ff:ff:ff

dmesg | grep "brcm":

[    2.329046] usbcore: registered new interface driver brcmfmac
[    2.329256] brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
[    2.434757] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[    3.005184] bluetooth hci0: Direct firmware load for brcm/BCM.hcd failed with error -2
[    3.005185] Bluetooth: hci0: BCM: Patch brcm/BCM.hcd not found
[    3.461813] Modules linked in: mc usbnet hid_apple(+) mii xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c br_netfilter mousedev bridge overlay joydev input_leds hid_generic snd_sof_pci snd_sof_intel_byt ccm snd_sof_intel_ipc algif_aead snd_sof_intel_hda_common snd_soc_hdac_hda snd_sof_xtensa_dsp snd_sof_intel_hda snd_sof usbhid intel_rapl_msr intel_rapl_common des_generic bnep hid libdes ledtrig_audio snd_soc_skl arc4 libarc4 snd_soc_sst_ipc snd_soc_sst_dsp algif_skcipher snd_hda_ext_core x86_pkg_temp_thermal snd_soc_acpi_intel_match intel_powerclamp coretemp snd_soc_acpi 8021q cmac garp mrp i915 md4 stp llc kvm_intel snd_soc_core algif_hash snd_compress af_alg iTCO_wdt ac97_bus mei_hdcp iTCO_vendor_support snd_pcm_dmaengine kvm brcmfmac nls_iso8859_1 snd_hda_intel nls_cp437 hci_uart vfat i2c_algo_bit irqbypass brcmutil snd_intel_dspcfg btqca crct10dif_pclmul fat
[    3.552176] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
[    3.587833] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/3 wl0: Mar 28 2019 19:17:52 version 9.137.9.0.32.6.34 FWID 01-36f56c94

stefanpartheym avatar May 13 '20 18:05 stefanpartheym

@stefanpartheym vielen dank! @yurnam does suspend work for you? because for me I have to restart it after I closed the lid

MoonPadUSer avatar May 13 '20 22:05 MoonPadUSer

@MoonPadUSer no suspend doesn't work either.

yurnam avatar May 14 '20 04:05 yurnam

Just a reminder: Please keep this issue focused on wifi support and discuss other topics in separate issues.

Dunedan avatar May 14 '20 04:05 Dunedan

about bcm4377 - looking "inside" apple driver.. is almost identical as bcm4357 if something has to be patched/modded should be around linux driver for 4357 i.e "brcmsmac"

@npx001 there is afaik no BCM4357 only a BCM43570

MoonPadUSer avatar May 14 '20 13:05 MoonPadUSer

@MoonPadUSer BCM4357 is AFAIK used in iphones only

yurnam avatar May 14 '20 13:05 yurnam

about bcm4377 - looking "inside" apple driver.. is almost identical as bcm4357 if something has to be patched/modded should be around linux driver for 4357 i.e "brcmsmac"

@npx001 there is afaik no BCM4357 only a BCM43570

sorry, my mistake, there is 0x4357 but is deviceID not chipID

npx001 avatar May 15 '20 08:05 npx001

@npx001 oh, ok so do you know the chipID?

MoonPadUSer avatar May 15 '20 08:05 MoonPadUSer

@npx001 oh, ok so do you know the chipID?

if ida decom is correct, bcm 4377 -> chipID is dec: 4377 hex: 0x1119

npx001 avatar May 15 '20 09:05 npx001

Currently on a Macbook Pro 15,3. Having some issues with the wifi not accepting firmware. Attempting this on gentoo. Currently got my patched kernel to boot with a couple other issues I'm figuring out. Anyone with the same model able to tell me which firmware they're using? I downloaded the kauai (X3) files from aunali1's repo

"RequestedFiles" = ({"Firmware"="C-4364__s-B2/kauai.trx","TxCap"="C-4364__s-B2/kauai-X3.txcb","Regulatory"="C-4364__s-B2/kauai-X3.clmb","NVRAM"="C-4364__s-B2/P-kauai-X3_M-HRPN_V-m__m-7.7.txt"})

LowLeeWolf avatar May 24 '20 20:05 LowLeeWolf

I have MacBookPro15,4 (hw info in this repo) with

    | |   | |   "RequestedFiles" = ({"Firmware"="C-4377__s-B3/formosa.trx","TxCap"="C-4377__s-B3/formosa-X3.txcb","Regulatory"="C-4377__s-B3/formosa-X3.clmb","NVRAM"="C-4377__s-B3/P-formosa-X3_M-SPPR_V-u__m-3.1.txt"})

If I use modprobe brcmfmac rambase_addr=0x170000 with the Catalina firmware I get nowhere.

The same command with the Mojave firmware, posted previously by @aunali1 gives

[ 2553.430567] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4377-pcie for chip BCM4377/4
[ 2556.021512] ieee80211 phy0: brcmf_msgbuf_query_dcmd: Timeout on response for query command
[ 2556.021516] ieee80211 phy0: brcmf_c_preinit_dcmds: Retrieving cur_etheraddr failed, -5
[ 2556.021518] ieee80211 phy0: brcmf_bus_started: failed: -5
[ 2556.021526] ieee80211 phy0: brcmf_attach: dongle is not responding: err=-5

like @yurnam and @MoonPadUSer have already shown in https://github.com/Dunedan/mbp-2016-linux/issues/112#issuecomment-573615174 and https://github.com/Dunedan/mbp-2016-linux/issues/112#issuecomment-628034019

Any more ideas how to debug, or maybe somebody who's got newer firwmare which we can try?

atodorov avatar May 24 '20 21:05 atodorov

Checking in here with a MacBook Pro Late 2015 - 13" Retina (MacBook 12.1)

I have combined a lot of solutions into a Buildroot / Skiff package here:

  • https://github.com/paralin/SkiffOS/tree/master/configs/apple/macbook

WiFi on 2.4Ghz networks works fine, with the firmware .txt file, 5.8Ghz networks also work fine.

However on one of my older MacBooks from the same model, the 5.8Ghz doesn't work at all even with this configuration, and 2.4ghz is sometimes glitchy / spotty. It has the same broadcom card. Could be something to do with the newer MacBook being exposed to an updated MacOS recently, which may have updated the firmware to the MacOS version?

paralin avatar May 24 '20 22:05 paralin

@paralin This issue is for MacBookPro models with a 15 and onward model designation corresponding to a 2018 and onward mfg date.

aunali1 avatar Jun 03 '20 04:06 aunali1

@aunali1 the laptop I'm talking about uses BCM43602 I guess, so I suppose it's a different issue, some others in this thread had the same chipset as me with the ~2015 macbooks.

So yeah you're right that should be moved to a separate issue probably. And/or tracked in the bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=193121

paralin avatar Jun 03 '20 04:06 paralin

I was able to make it work for Macbook Pro 15,3 (2018). BCM4364 using the files from @aunali1 . Currently works with 2.4GHz and stable (can connect from far and close the AP).

joax avatar Jun 15 '20 19:06 joax

I was able to make it work for Macbook Pro 15,3 (2018). BCM4364 using the files from @aunali1 . Currently works with 2.4GHz and stable (can connect from far and close the AP).

Can you list what firmware files you used?

LowLeeWolf avatar Jun 15 '20 19:06 LowLeeWolf

I was able to make it work for Macbook Pro 15,3 (2018). BCM4364 using the files from @aunali1 . Currently works with 2.4GHz and stable (can connect from far and close the AP).

Can you list what firmware files you used?

The Macbook Pro Model is A1990, so correction, its model 15,1 (2018) with the Core i9 and 16BG RAM. The files I used for this:

/apple/wifi-fw/18G2022/C-4364__s-B2/P-kauai_M-HRPN_V-m__m-7.7.txt
/apple/wifi-fw/18G2022/C-4364__s-B2/kauai-X0.trx
/apple/wifi-fw/18G2022/C-4364__s-B2/kauai-X0.clmb

My setup is:

$ uname -a 
Linux joax-ubuntu 5.7.0+ #5 SMP PREEMPT Mon Jun 15 08:59:18 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux

The kernel patches I applied were from here: https://github.com/aunali1/linux-mbp-arch

joax avatar Jun 15 '20 21:06 joax

@yurnam did you find a solution for mac pro 15,4 wifi (BCM4377) on linux os? as im currently in the situation where you were i really hope you share the solution with us

mushoku-ningen avatar Jul 10 '20 06:07 mushoku-ningen

@mushoku-ningen unfortunately not. if i find something i will share it here for sure.

yurnam avatar Jul 13 '20 10:07 yurnam

Hi,

I have a iMac19,2 with Ubuntu (and MacOS). Kernel Ubuntu is 5.8.1. Wifi card is BCM4364.

In MacOs, return of ioreg -l | grep RequestedFiles is : | | | | | "RequestedFiles" = ({"Firmware"="C-4364__s-B2/nihau.trx","TxCap"="C-4364__s-B2/nihau-X3.txcb","Regulatory"="C-4364__s-B2/nihauX3.clmb","NVRAM"="C-4364__s-B2/P-nihau-X3_M-HRPN_V-m__m-7.7.txt »})

So : "Firmware"="C-4364__s-B2/nihau.trx" "TxCap"="C-4364__s-B2/nihau-X3.txcb" "Regulatory"="C-4364__s-B2/nihauX3.clmb" "NVRAM"="C-4364__s-B2/P-nihau-X3_M-HRPN_V-m__m-7.7.txt"

I copied .trx, .clmb and .txt files to Linux. But what I need to do with .txcb ?

Now, wifi card is available but No wifi network is detected. I didn't patch anything. Should I patch something ? And how to do this please ? I understand patch but I don't understand what files to aplly patch and where are they !

Thank you !

jbf1983 avatar Aug 15 '20 12:08 jbf1983

@jbf1983 I think you need to rename the .trx .clmb and .txt files. I made a repository containing a script which does that for you: https://github.com/stefanpartheym/mbp15-wifi-driver This will work as long as you are using BCM4364.

stefanpartheym avatar Aug 19 '20 14:08 stefanpartheym