Wi-Fi Support in Apple Hardware

I have been able to get the Broadcom Wi-Fi cards in the following Apple machines working, and am putting it here in case it will help anyone:

  • MacBook Pro A1278
  • MacBook Air A1369
    (I would do more, but I don’t have easy access to any other models at the moment)

The crux of it, from what I can tell, is that the Apple EFI that boots the machine initialises the Wi-Fi card (I’m assuming so it can download their “Recovery Mode” partition from their servers and boot from that, if you ever want to reinstall MacOS), but doesn’t ever seem to let go of it fully. So when pciback tries to give it to sys-net, it yanks it back, causing the entire machine to freeze (no cursor moving, no TTY, etc.).

What I found that seems to work (and I apologise if there is a more elegant way to do this) is this:

  1. You have to have a dom0 kernel that will list the following file:
    /sys/bus/pci/drivers/pciback/allow_interrupt_control
    Most 5.x.x kernels will do this.

  2. Create a file /etc/systemd/system/fix-wifi.service and put the following into it with your favourite text editor:
    [Unit]
    Description=Reset Broadcom Wifi Card to Allow PCI Passthrough
    [Service]
    ExecStart=/usr/local/bin/working-wifi.sh
    [Install]
    WantedBy=multi-user.target

  3. Put the following in an executable shell script in /usr/local/bin/working-wifi.sh, where <PCI_DEVICE> is replaced with the address of your Wi-Fi card (on the A1278 it’s 03:00.0, on the A1369 it’s 02:00.0):
    #!/bin/sh
    # Allow dom0 to initiate PCI passthrough
    echo <PCI_DEVICE> > /sys/bus/pci/drivers/pciback/permissive
    echo <PCI_DEVICE> > /sys/bus/pci/drivers/pciback/allow_interrupt_control
    # Make sure it won't crash the system if you sleep your computer
    echo 1 > /sys/bus/pci/drivers/pciback/<PCI_DEVICE>/d3cold_allowed
    # Make sure it doesn't use any other drivers (in case you've got the Wi-Fi drivers in dom0 like the R4.1 Alpha)
    echo 1 > /sys/bus/pci/drivers/pciback/<PCI_DEVICE>/driver_override
    # Step 4: Reset it, taking it away from the Apple EFI's reach
    echo 1 > /sys/bus/pci/drivers/pciback/<PCI_DEVICE>/reset

Obviously, you’d then do this (just for completeness):
# chmod +x /usr/local/bin/working-wifi.sh
# systemctl enable fix-wifi.service

I know it’s a little ugly, but it gets the job done. Hope this helps someone!

3 Likes