tylernguyen / x1c6-hackintosh

READMEs, OpenCore configurations, patches, and notes for the Thinkpad X1 Carbon 6th Gen 2018 Hackintosh
https://tylernguyen.github.io/x1c6-hackintosh/
The Unlicense
627 stars 110 forks source link

Laptop won't wake up from sleep if a Thunderbolt dock has been connected earlier #93

Closed notthebee closed 3 years ago

notthebee commented 3 years ago

Describe the bug I use my X1C6 with a Dell TB16 dock. After the latest EFI update I now have issues with suspend/resume functionality.

If the dock has been connected on boot, the laptop won't wake up from sleep – the red led on the lid would blink rapidly, and the laptop won't react to any button presses. After that, I have to force shutdown the laptop and boot it up again.

After experimening a bit I managed to narrow the problem down to the Thunderbolt dock – if it hasn't been connected on boot, the laptop goes to sleep just fine. However, after resuming the laptop seems to lose the Thunderbolt hotplug functionality – the display lights up but none of the USB devices connected to the dock work.

To Reproduce Steps to reproduce the behavior:

  1. Connect a Thunderbolt appliance (not sure if it's related to the TB16 dock or all Thunderbolt hubs)
  2. Disconnect the dock
  3. Close the lid
  4. The led starts to blink, the laptop can't be woken up

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Appropriate boot and/or debug logs pmset log -g:

System-wide power settings:
Currently in use:
 standbydelaylow      10800
 standby              1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 proximitywake        0
 powernap             0
 gpuswitch            2
 disksleep            10
 standbydelayhigh     86400
 sleep                10 (sleep prevented by sharingd)
 autopoweroffdelay    28800
 hibernatemode        3
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         10
 tcpkeepalive         1
 highstandbythreshold 50
 lidwake              1

pmset log -g | grep failure:

2020-11-04 22:31:59 +0100 Failure               Failure during sleep: RP09(AppleThunderboltHAL XHC) : Some drivers failed to handle setPowerState panic
2020-11-06 07:48:12 +0100 Failure               Failure during sleep: RP09(AppleASMedia1042USBXHCI XHC) : Some drivers failed to handle setPowerState
2020-11-06 09:41:53 +0100 Failure               Failure during sleep: RP09(AppleASMedia1042USBXHCI XHC) : Some drivers failed to handle setPowerState
2020-11-06 09:59:34 +0100 Failure               Failure during sleep: RP09(XHC) : Some drivers failed to handle setPowerState

If you do cannot provide boot and/or debug logs, please provide a ZIP of your EFI I'm on the latest EFI from this repo, but just in case, here is the folder: OC.zip

lubixxx96 commented 3 years ago

Same issue like mine. Still reproducible time to time. @notthebee probably found the reason, its the dock what caused the issue.

tylernguyen commented 3 years ago

@notthebee

Some questions:

If you happen to have another tb3 device, can you test it with that as well?

notthebee commented 3 years ago

@tylernguyen

Is your TB3 controller modded?

No, I'm using the unmodded firmware

Does this issue only happens on cold plug or with hot plug as well?

If the Thunderbolt controller has been plugged in during the boot, the laptop crashes on wake up. If I boot up the laptop without the TB dock connected, it sleeps just fine but I can't hotplug the TB dock anymore (external display lights up and charging works, but USB devices don't)

Do you wake the laptop up after TB3 is unplugged or with it plugged in?

After

Which port does this issue happen on? Power or the one near usb? or both

Both ports

I see in your log that it's RP09, which should be the one near usb, can you test it on the power port also?

I've tested it with both ports, neither works

Does this issue always happens or only from time to time?

It happens 100% of the time, but I've only had the EFI for 2 days.

benbender commented 3 years ago

@notthebee please test https://github.com/tylernguyen/x1c6-hackintosh/pull/95/files. If that PR doesn't resolves it, it is most likely rooted in a problem with the ICM of the TB-controller. Please report back.

Are you in bios-assist-mode?

benbender commented 3 years ago

@tylernguyen some corrections:

  • Which port does this issue happen on? Power or the one near usb? or both

this is irrelevant. Problem is the handling of the controller/its ICM and most likely the same for both ports (if you don't screw the properties for those ports and irritate OSX-driver).

  • I see in your log that it's RP09, which should be the one near usb, can you test it on the power port also?

RP09 is the PCIe-port connected to the PCH of the Mainboard which hosts the complete Thunderbolt-controller (in OSX: the NHI). The NHI consists of multiple PCI-sub-devices (the most relevant are the alpine ridge TB-controller (DSB0) + the USB 3.1 gen2-controller (DSB2)). Both TB-ports are connected to DSB0 and both USB3.1gen2-ports to DSB2. Additionally the usbc-pd-controller by TI plays a role in routing the connected device to the specific controller and handling charging.

notthebee commented 3 years ago

So, I did some testing with the newest commit. Unfortunately, it didn't solve the problem. The BIOS Assist mode is off, and the behavior is consistent so far:

benbender commented 3 years ago

@notthebee please do the following:

tylernguyen commented 3 years ago

@notthebee

What BIOS version are you on?

See BIOS 1.40 update changelog:

notthebee commented 3 years ago

@tylernguyen this only applies to Lenovo docks that have the power button on the dock itself.

tylernguyen commented 3 years ago

@notthebee

Please try again with the new EFI and provide appropriate logs if the issue is still present.

notthebee commented 3 years ago

Thank you @tylernguyen and @benbender ! The issue has been resolved after upgrading to the latest EFI. One more thing that I had to do in order to make my TB16 work is to add Thunderbolt3Unblocker kext to OpenCore. I can submit a PR with the kexts, if that's ok.

benbender commented 3 years ago

@notthebee Did you need that Kext before my patches? It patches the NHI-TB-driver to force device-enumeration and I'm trying to get some feedback on device-behaviour with my patches. From what I think the kext shouldn't have been neccessary before as enumeration was done inside the ICM which is now disabled. Does that fit with your experience?

EDIT: Could you attach an IOREG-dump with and without the kext-loaded? Thanks in advance!