Contribute
Register

BrcmPatchRam BCM94352Z on Lenovo T470

Status
Not open for further replies.
Joined
May 8, 2013
Messages
13
Motherboard
Lenovo T470
CPU
i5-6300U
Graphics
HD 520
Mac
  1. MacBook Pro
Mobile Phone
  1. Android
I could not get bluetooth to survive the sleep/wake cycle using the tunable sleep parameters in @RehabMan version. I did quite a bit of experimentation. @tluck version worked fine. I studied the TLUCK/Rehabman diffs and patched @RehabMan branch with 1 additional delay.

I boot with: bpr_probedelay=100 bpr_upgradedelay=200 bpr_initialdelay=300 bpr_postresetdelay=300

and have gone through hundreds of sleep wake cycles. This is with the following card from NewEgg.

Broadcom BCM94352Z NGFF M.2 WiFi WLAN Bluetooth 4.0 802.11ac up to 867 Mbps card 22*30mm

My diffs are:

t470-mbp:rehabman sjk$ git diff
diff --git a/BrcmPatchRAM/BrcmPatchRAM.cpp b/BrcmPatchRAM/BrcmPatchRAM.cpp
index e42d021..ac62db1 100644
--- a/BrcmPatchRAM/BrcmPatchRAM.cpp
+++ b/BrcmPatchRAM/BrcmPatchRAM.cpp
@@ -161,6 +161,9 @@ IOService* BrcmPatchRAM::probe(IOService *provider, SInt32 *probeScore)
}
#endif

+// tjl (sjk) port forward.
+ IOSleep(mUpgradeDelay);
+
clock_get_uptime(&start_time);

#ifndef NON_RESIDENT
@@ -220,6 +223,12 @@ IOService* BrcmPatchRAM::probe(IOService *provider, SInt32 *probeScore)
if (PE_parse_boot_argn("bpr_preresetdelay", &delay, sizeof delay))
mPreResetDelay = delay;

  • mUpgradeDelay = 0;
  • if (OSNumber* upgradeDelay = OSDynamicCast(OSNumber, getProperty("UpgradeDelay")))
  • mUpgradeDelay = upgradeDelay->unsigned32BitValue();
  • if (PE_parse_boot_argn("bpr_upgradedelay", &delay, sizeof delay))
  • mUpgradeDelay = delay;
+
if (OSString* displayName = OSDynamicCast(OSString, getProperty(kDisplayName)))
provider->setProperty(kUSBProductString, displayName);

@@ -1208,7 +1217,8 @@ bool BrcmPatchRAM::performUpgrade()
#ifdef DEBUG
DeviceState previousState = kUnknown;
#endif
-
  • // tjl (sjk) port forward.
  • IOSleep(mUpgradeDelay);
IOLockLock(mCompletionLock);
mDeviceState = kInitialize;

diff --git a/BrcmPatchRAM/BrcmPatchRAM.h b/BrcmPatchRAM/BrcmPatchRAM.h
index ba901d8..d5b7b1a 100644
--- a/BrcmPatchRAM/BrcmPatchRAM.h
+++ b/BrcmPatchRAM/BrcmPatchRAM.h
@@ -81,6 +81,7 @@ private:
UInt32 mPreResetDelay;
UInt32 mPostResetDelay;
UInt32 mInitialDelay;
+ UInt32 mUpgradeDelay;

USBDeviceShim mDevice;
USBInterfaceShim mInterface;
 
I could not get bluetooth to survive the sleep/wake cycle using the tunable sleep parameters in @RehabMan version. I did quite a bit of experimentation. @tluck version worked fine. I studied the TLUCK/Rehabman diffs and patched @RehabMan branch with 1 additional delay.

I boot with: bpr_probedelay=100 bpr_upgradedelay=200 bpr_initialdelay=300 bpr_postresetdelay=300

and have gone through hundreds of sleep wake cycles. This is with the following card from NewEgg.

Broadcom BCM94352Z NGFF M.2 WiFi WLAN Bluetooth 4.0 802.11ac up to 867 Mbps card 22*30mm

My diffs are:

t470-mbp:rehabman sjk$ git diff
diff --git a/BrcmPatchRAM/BrcmPatchRAM.cpp b/BrcmPatchRAM/BrcmPatchRAM.cpp
index e42d021..ac62db1 100644
--- a/BrcmPatchRAM/BrcmPatchRAM.cpp
+++ b/BrcmPatchRAM/BrcmPatchRAM.cpp
@@ -161,6 +161,9 @@ IOService* BrcmPatchRAM::probe(IOService *provider, SInt32 *probeScore)
}
#endif

+// tjl (sjk) port forward.
+ IOSleep(mUpgradeDelay);
+
clock_get_uptime(&start_time);

#ifndef NON_RESIDENT
@@ -220,6 +223,12 @@ IOService* BrcmPatchRAM::probe(IOService *provider, SInt32 *probeScore)
if (PE_parse_boot_argn("bpr_preresetdelay", &delay, sizeof delay))
mPreResetDelay = delay;

  • mUpgradeDelay = 0;
  • if (OSNumber* upgradeDelay = OSDynamicCast(OSNumber, getProperty("UpgradeDelay")))
  • mUpgradeDelay = upgradeDelay->unsigned32BitValue();
  • if (PE_parse_boot_argn("bpr_upgradedelay", &delay, sizeof delay))
  • mUpgradeDelay = delay;
+
if (OSString* displayName = OSDynamicCast(OSString, getProperty(kDisplayName)))
provider->setProperty(kUSBProductString, displayName);

@@ -1208,7 +1217,8 @@ bool BrcmPatchRAM::performUpgrade()
#ifdef DEBUG
DeviceState previousState = kUnknown;
#endif
-
  • // tjl (sjk) port forward.
  • IOSleep(mUpgradeDelay);
IOLockLock(mCompletionLock);
mDeviceState = kInitialize;

diff --git a/BrcmPatchRAM/BrcmPatchRAM.h b/BrcmPatchRAM/BrcmPatchRAM.h
index ba901d8..d5b7b1a 100644
--- a/BrcmPatchRAM/BrcmPatchRAM.h
+++ b/BrcmPatchRAM/BrcmPatchRAM.h
@@ -81,6 +81,7 @@ private:
UInt32 mPreResetDelay;
UInt32 mPostResetDelay;
UInt32 mInitialDelay;
+ UInt32 mUpgradeDelay;

USBDeviceShim mDevice;
USBInterfaceShim mInterface;

Submit PR on github and I'll review.
 
Done. Thanks.
 
check the latest changes on the github fork. I boot with:

<string>kext-dev-mode=1 bpr_probedelay=100 bpr_upgradedelay=200 bpr_initialdelay=300 bpr_postresetdelay=300</string>

And have gone through dozens of sleep/wake cycles over the past 4 days with no issues.
 
I have just obtained a T470S, and I was curious: are you going to do a guide here on Tonymac? Did you post your config, etc on Github? It sounds like you did, but I don't see it up there, perhaps I missed it?

Or, Maybe share your efi? I can understand you not wanting to share the whole thing, but a copy of your config.plist (take out the SMBIOS stuff), and screenshots of your ACPI/patched folder and your EFI/Clover/Kexts/Other would be great, and that would respect your privacy.

What version of macOS are you on?

With the Broadcom wireless card you got from Newegg, have you loaded Windows 10? Some others have reported issues with that card on Windows, and I was wondering if you had experienced any issues like that?
 
Status
Not open for further replies.
Back
Top