# Broadcom 4331 Wifi, ndis crashes the kernel



## wardbones (Aug 13, 2019)

Hello, friends.

I followed the directions in the FreeBSD Handbook and everything went really well.  I made a mistake the first time and made a 32 bit module but I loaded it and unloaded, no problem, didn't show ndis0 under ifconfig but when I made the 64-Bit module, as soon as I kldload the module, the kernel crashes and locks.  I've tried several packages' inf and sys files but all the 64 bit ones lock the machine.

I am a little confused about firmware.  There is a question in the Ndis script that asks if you want to input any firmware.  I probably have that file, too, in all the driver packages but don't know which file might be firmware or I it's a whole different piece of data.

uname -a


```
FreeBSD hoth 12.0-RELEASE FreeBSD 12.0-RELEASE GENERIC  amd64
```

I'm on a MacBook Pro 8,1 (Early 2009).  I have everything else working but the wifi and firewire (ieee1394) port.  I read that firewire would never be supported.  Not sure if that's so but right now, I would just like to get off the dongle wifi.

Thanks for reading, I'm not sure what else to post to help people help me on this, please let me know.

Ward


----------



## tingo (Aug 18, 2019)

IMHO, you are much better off if you spend the necessary time and money on getting a supported WiFi adapter for your machine. ndis is just asking for a world of pain.


----------



## wardbones (Aug 19, 2019)

Well said, Sir.


----------



## badbrain (Aug 21, 2019)

Don't waste time with such a job. It's for hackers not us. Buy another device. Make sure it's supported. Done.


----------



## wardbones (Aug 22, 2019)

Thanks, everybody.  I had a fantasy about creating a distro of BSD for old Macs with Gnome 3.  I wanted to see how difficult it would be and it certainly is!  I got most of everything working and had a lot of fun but went to Fedora.  I have another machine (PC) for FreeBSD.  I used to work volunteer for GhostBSD and maybe could one day start a community Gnome 3 version (like we were in the beginning).  Thank you.


----------



## wardbones (Aug 23, 2019)

If anybody reads this and is willing to help.  I'd still like to do it.  Apple stopped supporting my Macbook Pro 8,1 and I'm trying again.


----------



## wardbones (Aug 24, 2019)

Well, I have the bcm ndis module loaded but can't figure out how to activate it through ifconfig.  Here is the link to the page that got it installed, apparently, the kernel crash is not unique and this guide resolved my firmware question as well:

Broadcom Ndis Howto

Still could use some help.

Thank you.


----------



## T-Daemon (Aug 25, 2019)

wardbones said:


> Well, I have the bcm ndis module loaded but can't figure out how to activate it through ifconfig.


If you mean by activating configuring the created interface, check `dmesg` for ndis0 and proceed to step #5 in the thread you linked, or have a look at chapter 31.3. Wireless Networking


----------



## moridin (Aug 25, 2019)

What is the exact reason you are using ndis instead of bwn(4)?  If you are following that post, there were a lot of changes to the driver since 2012, and it's worth giving it a try?


----------



## Phishfry (Aug 25, 2019)

I agree with everyone here. NDIS is last possible option to consider. Have you tried our driver?
Do notice that there are two possible firmwares to use for these cards.
They must be compiled from ports
See the note here net/bwn-firmware-kmod


> No package is available: this is a modified version of a restricted firmware



Grab a ports tree - `portsnap auto` and move to the correct directory `cd /usr/ports/net/bwm-firmware-kmod`.
Then run `make install clean`.


Once complete you can load the module
`kldload bwn_v4_lp_ucode`
_OR_
`kldload bwn_v4_ucode`
Notice there are two modules. You only need one.
If you look at `pciconf -lv | grep network -B 3` it will show the name of the wireless card.
If it has >*LP*< in the name of the card then use the LP firmware module.


Now you can add your firmware to /boot/loader.conf. You don't want to load both.
bwn_v4_lp_ucode_load="YES"
_OR_
bwn_v4_ucode_load="YES"


Finally you should add settings for this interface to /etc/rc.conf
wlans_bwm0="wlan0"
ifconfig_wlan0="WPA DHCP"

Reboot and see what you get.


----------



## wardbones (Jan 21, 2020)

Hello, everybody.  I'm at it again.

Thank you, Phishfry.  That seemed like the best answer but bcn0 doesn't show up in ifconfig as wlan0.

Pretty sure I followed everything.

Anyway, if anybody's up for another crack at this it would be great.  I use a dongle but with only two usb ports and since firewire isn't supported I need that port!

Thanks again.  Sorry to be away so long, I gave up.

-w


----------



## T-Daemon (Jan 21, 2020)

Have you ever tried the bwn(4) driver? When that driver is loaded the bhnd(4) driver is also loaded. The bhnd pci device id's mentions the following 4331 models:

#define    PCI_DEVID_*BCM4331_D11N*        0x4331    /* 4331 802.11n dualband id */
#define    PCI_DEVID_*BCM4331_D11N2G*        0x4332    /* 4331 802.11n 2.4Ghz band id */
#define    PCI_DEVID_*BCM4331_D11N5G*        0x4333    /* 4331 802.11n 5Ghz band id */

(You can check with the `pciconf -lv | grep network -B 3` command the device id of the installed wifi card.)

Also in the Broadcom ChipCommon core, here and here.



wardbones said:


> firewire (ieee1394) port. I read that firewire would never be supported.





wardbones said:


> firewire isn't supported



What kind of firewire device do you want to attach? Search result for "firewire 1394":








						Search · firewire 1394 · freebsd/freebsd-src
					

FreeBSD src tree (read-only mirror). Contribute to freebsd/freebsd-src development by creating an account on GitHub.




					github.com


----------



## wardbones (Jan 21, 2020)

Hi, T-Daemon,


```
80N35@HAL-9000 ~> pciconf -lv | grep network -B 3
bge0@pci0:2:0:0:    class=0x020000 card=0x16b414e4 chip=0x16b414e4 rev=0x10 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'NetXtreme BCM57765 Gigabit Ethernet PCIe'
    class      = network
--
bwn_pci0@pci0:3:0:0:    class=0x028000 card=0x433114e4 chip=0x433114e4 rev=0x02 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'BCM4331 802.11a/b/g/n'
    class      = network
```

I did everything that Phishfry said and still no luck with bwn4331.  Do I need to load something or attach bhnd instead of bwn to wlan0?

As for as firewire 1394, I want to connect an external drive.  It's ntfs which is no problem with fuse but I can't seem to find it in /dev anywhere and tail `/var/log/messages` doesn't show a thing when I plug it in to firewire port.  Here's the pciconf on that:


```
80N35@HAL-9000 ~> pciconf -lv | grep 1394 -B 3
    class      = network
none2@pci0:4:0:0:    class=0x0c0010 card=0x590011c1 chip=0x590111c1 rev=0x08 hdr=0x00
    vendor     = 'LSI Corporation'
    device     = 'FW643 [TrueFire] PCIe 1394b Controller'
```

Thanks so much.  Any suggestions would be fantastic.


----------



## T-Daemon (Jan 22, 2020)

Try this for wifi:
`kldload if_bwn`

Check if the driver has attached to the wifi adapter:
`sysctl net.wlan.devices`

If it's not listed, then it's not supported by that driver. If it's listed proceed the setup as described in the handbook.

For firewire try:
`kldload firewire sbp`, plug in the external drive, check first console (tty0) or `dmesg` or /var/log/messages if the device is detected. If it's detected make the settings permanent in /boot/loader.conf:

```
firewire_load="YES"
sbp_load="YES"
```


----------



## wardbones (Jan 22, 2020)

Thank you, *T-Daemon,*

`80N35@HAL-9000 ~> sudo kldload if_bwn
Password:
kldload: can't load if_bwn: module already loaded or in kernel
80N35@HAL-9000 ~> sudo sysctl net.wlan.devices
net.wlan.devices: rtwn0`

That's my usb dongle...

`firewire0: 2 nodes, maxhop <= 1 cable IRM irm(1)  (me) 
firewire0: bus manager 1 
sbp0: sbp_show_sdev_info: sbp0:0:0: ordered:1 type:14 EUI:001c0d0200400493 node:0 speed:3 maxrec:8
sbp0: sbp_show_sdev_info: sbp0:0:0 'HGST' 'G-Drive Mobile' '000102'
sbp0: sbp_mgm_timeout:sbp0:0:0 request timeout(mgm orb:0x4b76b028)
sbp0: sbp_mgm_timeout:sbp0:0:0 reset start`

Okay, gonna reboot and try the firewire.  Thanks again...


----------



## wardbones (Jan 22, 2020)

Here's `dmesg`


```
fwohci0: fwohci_intr_core: BUS reset
fwohci0: fwohci_intr_core: node_id=0x00000000, SelfID Count=4, CYCLEMASTER mode
firewire0: 1 nodes, maxhop <= 0 cable IRM irm(0)  (me)
firewire0: bus manager 0
fwohci0: fwohci_intr_core: BUS reset
fwohci0: fwohci_intr_core: node_id=0x00000000, SelfID Count=5, non CYCLEMASTER mode
firewire0: 2 nodes, maxhop <= 1 cable IRM irm(0)  (me)
firewire0: root node is not cycle master capable
firewire0: bus manager 0
fwohci0: too many cycles lost, no cycle master present?
fwohci0: fwohci_intr_core: BUS reset
fwohci0: fwohci_intr_core: node_id=0x00000001, SelfID Count=6, CYCLEMASTER mode
firewire0: 2 nodes, maxhop <= 1 cable IRM irm(1)  (me)
firewire0: bus manager 1
sbp0: sbp_show_sdev_info: sbp0:0:0: ordered:1 type:14 EUI:001c0d0200400493 node:0 speed:3 maxrec:8
sbp0: sbp_show_sdev_info: sbp0:0:0 'HGST' 'G-Drive Mobile' '000102'
sbp0: sbp_mgm_timeout:sbp0:0:0 request timeout(mgm orb:0x029e0028)
sbp0: sbp_mgm_timeout:sbp0:0:0 reset start
```

What's next?  I can't mount sbp0 with fuse,

`80N35@HAL-9000 ~> sudo ntfs-3g /dev/sbp0s1 /mnt
ntfs-3g: Failed to access volume '/dev/sbp0s1': No such file or directory`


----------



## T-Daemon (Jan 22, 2020)

Don't thank me yet. Writing from a phone and copy & pasting from external editor I overlooked the firmware, sorry.

After `kldload if_bwn` execute also
`kldload bwn_v4_lp_ucode`
_OR_
`kldload bwn_v4_ucode`, as suggested by *Phishfry*

After run `sysctl net.wlan.devices` again.


----------



## wardbones (Jan 22, 2020)

Just glad for the effort.


```
80N35@HAL-9000 ~> sudo kldload if_bwn
kldload: can't load if_bwn: module already loaded or in kernel
80N35@HAL-9000 ~> sudo kldload bwn_v4_ucode
kldload: can't load bwn_v4_ucode: module already loaded or in kernel
80N35@HAL-9000 ~> sysctl net.wlan.devices
net.wlan.devices: rtwn0
```

Yep.  I saw this on here "#Wireless Wireless is bcm4331, neither bwi or bwn drivers work, needs version 5 drivers"

Seems like a lot of people want the 4331 drivers for MBP.  If we could get the firewire running that would save me a usb port for the dongle (of a lousy Mac 2 ports...).


----------



## wardbones (Jan 24, 2020)

*T-Daemon,*

Here is the bug report on firewire.  Looks like I have two pieces of hardware that are not going to be working any time soon.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235983


----------

