Jump to content

BCM5722, BCM5754/M, BCM5755/M, BCM5787/M and BCM5906/M NIC driver (32/64-bit)


adlan
 Share

251 posts in this topic

Recommended Posts

Hi,

 

I've decided to scratch an itch and develop a driver for my nic(5787m). Although there has been a working driver for the card, it is a hexedited version which i thought is not a permanent solution :(.

 

This driver is implemented based on the BCM5722 Programmer's Guide provided in Broadcom's open source developer resource. Additional information is gleaned from Linux(tg3) and FreeBSD(if_bge) driver. Since the manual covers more than one model, i decided to include support for some of the models documented.

 

It should support the following models:

 

  • BCM5722
  • BCM5754
  • BCM5754M
  • BCM5755
  • BCM5755M
  • BCM5787
  • BCM5787M #
  • BCM5906 #
  • BCM5906M #

 

# - tested

 

Features not implemented as of this release:

 

  • Wake-on-LAN

 

Installation

 

Install to /System/Library/Extensions

 

  • manually copy the kext to /S/L/E and repair permissions or
  • use KextWizard

 

Issues

 

Please report any issues you found at https://github.com/adlan/BCM5722D/issues

 

Contributing

 

Source code is available at https://github.com/adlan/BCM5722D. See project's wiki for details

 

Credit

 

  • broadcom for releasing the programmer's guide
  • authors of Linux(tg3) and FreeBSD(if_bge) driver
  • early beta testers (acero,Hacktrix2006,quadomatic,queshaolangman,Zprood)

 

Disclaimer

This driver is neither supported nor endorsed by Broadcom. Zombies may invade your house and i take no responsibility for whatever happens. Use at your own risk

 

don't forget to report how it's going

enjoy!

BCM5722D.kext.zip

  • Like 11
Link to comment
Share on other sites

  • 2 weeks later...

thanks a lot, adlan.. wonderful...

 

i think its working...

congratulation

 

BCM5722D (Build date/time: Feb 11 2011 16:21:31)
BCM5722D (setupDriver:920): MSI index on 1
BCM5722D (resetAdapter:144): 4B657654 to B49A89AB in 0 iterations
my_name_adlan_BCM5722D: Model: BCM5906M NetLink (TM) Fast Ethernet
my_name_adlan_BCM5722D: Loaded successfully

Link to comment
Share on other sites

thanks a lot, adlan.. wonderful...

 

i think its working...

congratulation

 

BCM5722D (Build date/time: Feb 11 2011 16:21:31)
BCM5722D (setupDriver:920): MSI index on 1
BCM5722D (resetAdapter:144): 4B657654 to B49A89AB in 0 iterations
my_name_adlan_BCM5722D: Model: BCM5906M NetLink (TM) Fast Ethernet
my_name_adlan_BCM5722D: Loaded successfully

 

 

Thanks men ,it work like a charm :) . I've just installed this kext on my Lenovo y430 w Bcm5906 ethernet card .

 

great! glad to hear it's working for you, thanks! ;)

Link to comment
Share on other sites

hello.. how bout BCM5789..?

 

sorry for the delay, i was away from my computer for the last few days

 

i don't think this driver will work for that card. i've released the source code, so if anybody is interested can try to make it work for this card. since there is manual provided by broadcom in its oss resource page, i'll try to look at it when i have time.

Link to comment
Share on other sites

Excellent work :( I thought there would never be a driver for these old Broadcom 100MBit network cards. I've been using the Apple USB Lan dongle until now, and I've noticed a huge drop in CPU usage during Lan activity using the built in network port with your kext. Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

This is good news to hear in general. Question as I don't know these other cards, just that numericall they aren't far off. I have a Broadcom BCM5751. I assume this won't work with it? I tried the kext but no joy. Wasn't sure if I just needed to add my pci string into the kext to recognize or or if it's to different of a card.

 

 

 

Thanks.

 

 

 

JR

 

Edit: By the way, with this driver should the MAC address be automatically detected or is a bunch of zeros normal? Do I need to set them each boot with ifconfig? Unfortunately where I am now I do not have access to a wired connection but did make the change and added my device's pci value in there and is showing that the new interface was detected and has a self assigned DHCP IP but in terminal ifconfig shows a bunch of zeros still for the MAC address.

Link to comment
Share on other sites

Thank you very much adlan!

I already started to implement a bcm5906 driver on my own but didn't find the time lately. Now I don't have to to it anymore because your driver works perfectly on my Lenovo G550! Great work, will have a look at the source code soon.

  • Like 1
Link to comment
Share on other sites

hi,

 

i've decided to scratch an itch and develop a driver for my nic(5787m). Although there has been a working driver for the card, it is a hexedited version which i thought is not a permanent solution plus no source code is accessible. well, if it did, this project wouldn't exist :) .

 

This driver is implemented based on the BCM5722 Programmer's Guide provided in Broadcom's open source developer resource. Additional information is gleaned from Linux(tg3) and FreeBSD(if_bge) driver. Since the manual covers more than one model, i decided to include support for some of the models documented.

 

It should support the following models:

 

  • BCM5754
  • BCM5754M
  • BCM5755
  • BCM5755M
  • BCM5787
  • BCM5787M #
  • BCM5906 #
  • BCM5906M #

 

# - tested

 

Features not implemented as of this release:

 

  • Wake-on-LAN
  • BCM5906/M
    • Isochronous Send Ring

    [*] BCM5755/M

    • Receive Side Scaling

 

Installation

 

Install to /System/Library/Extensions or simply use Kext Helper

 

please report any issues you found at https://github.com/adlan/BCM5722D/issues

 

source code is available at https://github.com/adlan/BCM5722D

 

credit to

  • broadcom for releasing the programmer's guide
  • authors of Linux(tg3) and FreeBSD(if_bge) driver
  • early beta testers (acero,Hacktrix2006,quadomatic,queshaolangman,Zprood)

 

Disclaimer

This driver is neither supported nor endorsed by Broadcom. Zombies may invade your house and i take no responsibility for whatever happens. Use at your own risk

 

don't forget to report how it's going

enjoy!

 

thanks good job men

 

14e4 : 1692

 

works well snow 64 and lion 10.7 (Build 11A459e) 64

Link to comment
Share on other sites

sorry I totally forgot this thread. I thought it's deeply buried in the new user lounge and today I just noticed that this has moved to the appropriate section, thanks mod! now the driver has 2 homes B)

 

Edit: By the way, with this driver should the MAC address be automatically detected or is a bunch of zeros normal? Do I need to set them each boot with ifconfig? Unfortunately where I am now I do not have access to a wired connection but did make the change and added my device's pci value in there and is showing that the new interface was detected and has a self assigned DHCP IP but in terminal ifconfig shows a bunch of zeros still for the MAC address.

 

I thought BCM5751 has a working driver? Does this driver works for you? MAC address will be automatically populated by the driver. I checked the programmer's guide for the model and it seems it has the same register address for MAC address value, so it should have no problem. tg3(linux) and bge(freebsd) driver checks a number of places for MAC address value whereas this driver depends only on the MAC address register for the address and I think that causes a bunch of zeros. However, I didn't check for initialization steps for this model, maybe it has something to do with that.

Link to comment
Share on other sites

  • 1 month later...

In trying out the driver, I noticed that, no matter what I did, I could not get a 1000FD connection. Even if I forced it and my switch is advertising it, the PHY would only set to half-duplex. I would see this in the output of ifconfig:

 

media: autoselect (1000baseT <half-duplex>)

 

When forcing:

 

media: 1000baseT <full-duplex> (1000baseT <half-duplex>)

 

I took at look at the code and found spots in Register.h that look to have accidentally had HD and FD bits swapped according to the BCM5722 Programmer's Guide (I found some in 10, 100, and 1000 modes for advertisement and negotiation, as well as mode set), and the section of PHY.cpp that sets the PHY mode was setting 1000HD register bits for both 1000HD and 1000FD mode. I fixed those and added my network controller to the model list (0x1691). Upon testing the modifications, the card is recognized and model name is output in the system logs, and 1000FD appears to be set correctly.

 

media: autoselect (1000baseT <full-duplex>)

 

My switch also reports 1000baseT FDX operation.

 

I attached the modified files below in a zip.

 

Please feel free to double check any changes I made. I'm not really a programmer, but I know enough to be able to follow what's happening in source code, so hopefully I didn't break anything. But it appears to work correctly. Thanks so much for creating this driver! I was ripping my hair out trying to get my card to work in Lion with AppleBCM5701Ethernet to no avail, as the previously hex edited driver that worked in SL had unresolved symbol linking errors in Lion.

Archive.zip

Link to comment
Share on other sites

Just for the record here are the diffs that came out of github:mac:

 

BCM5722D.cpp:

@@ -36,6 +36,7 @@ static const struct SupportedDevice
  { DEVICEID_BCM5787M, "BCM5787M NetLink (tm) Gigabit Ethernet" },
  { DEVICEID_BCM5906,  "BCM5906 NetLink (tm) Fast Ethernet" },
  { DEVICEID_BCM5906M, "BCM5906M NetLink (tm) Fast Ethernet" },
+  { DEVICEID_BCM57788, "BCM57788 NetLink (tm) Gigabit Ethernet" },
  { 0, NULL }
};

 

Info.plist:

@@ -39,6 +39,7 @@
                <string>pci14e4,1672</string>
                <string>pci14e4,167b</string>
                <string>pci14e4,1673</string>
+                <string>pci14e4,1691</string>
                <string>pci14e4,169b</string>
                <string>pci14e4,1693</string>
                <string>pci14e4,1712</string>

 

PHY.cpp:

@@ -687,7 +687,7 @@ void BCM5722D::resolveOperatingSpeedAndLinkDuplex(UInt16 status)

      media.speed = kLinkSpeed1000;
      media.duplex = kLinkDuplexFull;
-      currentMediumIndex = kMediumTypeIndex1000HD;
+      currentMediumIndex = kMediumTypeIndex1000FD;

      break;

 

Register.h:

@@ -30,6 +30,7 @@
#define DEVICEID_BCM5787M                 0x1693
#define DEVICEID_BCM5906                  0x1712
#define DEVICEID_BCM5906M                 0x1713
+#define DEVICEID_BCM57788                 0x1691

#define PHYID_MODEL_5754_5787             0x0E
#define PHYID_MODEL_5755                  0x0C
@@ -729,17 +730,17 @@ enum {
#define PHY_AUTONEGADVERT_802_3           BIT(0)
#define PHY_AUTONEGADVERT_10HD            BIT(5)
#define PHY_AUTONEGADVERT_10FD            BIT(6)
-#define PHY_AUTONEGADVERT_100FD           BIT(7)
-#define PHY_AUTONEGADVERT_100HD           BIT(8)
+#define PHY_AUTONEGADVERT_100HD           BIT(7)
+#define PHY_AUTONEGADVERT_100FD           BIT(8)
#define PHY_AUTONEGADVERT_PAUSECAP        BIT(10)
#define PHY_AUTONEGADVERT_ASYMPAUSE       BIT(11)

// Auto-Negotiation Link Partner Ability Register
#define PHY_AUTONEGPARTNER                0x05
-#define PHY_AUTONEGPARTNER_10FD           BIT(5)
-#define PHY_AUTONEGPARTNER_10HD           BIT(6)
-#define PHY_AUTONEGPARTNER_100FD          BIT(7)
-#define PHY_AUTONEGPARTNER_100HD          BIT(8)
+#define PHY_AUTONEGPARTNER_10HD           BIT(5)
+#define PHY_AUTONEGPARTNER_10FD           BIT(6)
+#define PHY_AUTONEGPARTNER_100HD          BIT(7)
+#define PHY_AUTONEGPARTNER_100FD          BIT(8)
#define PHY_AUTONEGPARTNER_PAUSECAP       BIT(10)
#define PHY_AUTONEGPARTNER_ASYMPAUSE      BIT(11)

@@ -750,8 +751,8 @@ enum {

// 1000BASE-T Status Register
#define PHY_1000BASETSTS                  0x0A
-#define PHY_1000BASETSTS_PARTNERFD        BIT(10)
-#define PHY_1000BASETSTS_PARTNERHD        BIT(11)
+#define PHY_1000BASETSTS_PARTNERHD        BIT(10)
+#define PHY_1000BASETSTS_PARTNERFD        BIT(11)

#define PHY_DSPRWPORT                     0x15

Link to comment
Share on other sites

In trying out the driver, I noticed that, no matter what I did, I could not get a 1000FD connection. Even if I forced it and my switch is advertising it, the PHY would only set to half-duplex. I would see this in the output of ifconfig:

 

media: autoselect (1000baseT <half-duplex>)

 

When forcing:

 

media: 1000baseT <full-duplex> (1000baseT <half-duplex>)

 

I took at look at the code and found spots in Register.h that look to have accidentally had HD and FD bits swapped according to the BCM5722 Programmer's Guide (I found some in 10, 100, and 1000 modes for advertisement and negotiation, as well as mode set), and the section of PHY.cpp that sets the PHY mode was setting 1000HD register bits for both 1000HD and 1000FD mode. I fixed those and added my network controller to the model list (0x1691). Upon testing the modifications, the card is recognized and model name is output in the system logs, and 1000FD appears to be set correctly.

 

media: autoselect (1000baseT <full-duplex>)

 

My switch also reports 1000baseT FDX operation.

 

I attached the modified files below in a zip.

 

Please feel free to double check any changes I made. I'm not really a programmer, but I know enough to be able to follow what's happening in source code, so hopefully I didn't break anything. But it appears to work correctly. Thanks so much for creating this driver! I was ripping my hair out trying to get my card to work in Lion with AppleBCM5701Ethernet to no avail, as the previously hex edited driver that worked in SL had unresolved symbol linking errors in Lion.

 

oh thanks! I've confirmed with the programmer's guide on those registers.

damn, silly mistakes, how could I get those things mixed,

 

I'll review the changes, and bring it in after testing it.

again, thanks for your time and effort on this :D

 

* p/s: I have less time for this right now and actually didn't boot osx for over 2 months now, sorry if it takes a long time for my reply, I do check the forum regularly though

  • Like 1
Link to comment
Share on other sites

The driver works great for me in Lion GM with a 5754 [14e4:167a], except it disconnects after waking from sleep (says cable disconnected). Kextunload and then kextload allows me to regain network functionality.

 

I've also posted about the issue on the github.

 

Thanks!

Link to comment
Share on other sites

oh thanks! I've confirmed with the programmer's guide on those registers.

damn, silly mistakes, how could I get those things mixed,

 

I'll review the changes, and bring it in after testing it.

again, thanks for your time and effort on this :angel:

 

* p/s: I have less time for this right now and actually didn't boot osx for over 2 months now, sorry if it takes a long time for my reply, I do check the forum regularly though

 

The only other thing I noticed was a couple of register definitions that were using reserved bits, and one for powering down the device was using a bit that would require a PCI bus reset and not just a software command to power back up (PHY IDDQ, if my memory serves, it was off by only one bit, 20 vs 21 i think). If I was wrong in changing those, of course revert those changes :blink:

 

I also notice someone posted an issue in your repo re: ifconfig en0 down and ifconfig en0 up. When I do the first command, my machine actually KPs for some reason. I'll add the note to that issue.

Link to comment
Share on other sites

 Share

×
×
  • Create New...