al3xtjames / ThunderboltPkg

Apache License 2.0
46 stars 13 forks source link

Add support for Coffee Lake/Comet Lake #4

Open wu-hongjun opened 4 years ago

wu-hongjun commented 4 years ago

Hi,

I tried to use this with Opencore, but it is giving me this error:

download

I am using Opencore 0.5.9 (Newest), and I added TbtForcePower.efi in Drivers, and added it into my config.plist.

My CPU is i7-9750H (Razer Blade).

I am not sure if this EFI is compatible with Open core, or is there additional procedure needed to get this driver to work in open core? Thanks.

zhen-zen commented 4 years ago

I suppose some dependencies are missing info about your PCH. Have you tried the debug version this efi?And since you mentioned OpenCore compatibility, what's the output in Clover? You can manually load it in UEFI shell.

al3xtjames commented 4 years ago

TbtForcePower should work fine with OC. The actual issue is that the Kaby Lake GPIO library (from edk2-platforms doesn't support your HM370 (Coffee Lake) PCH. It looks like CoffeelakeSiliconPkg supports HM370. I wonder if it's possible to use multiple versions of the same type of library in EDK2 - it doesn't help that KabylakeOpenBoardPkg/KabylakeSiliconPkg probably aren't meant to be used the way I'm using them...

zavrazhny commented 4 years ago

Hello,

It doesn't work with OpenCore 6.0 on Intel NUC 10 (i7-10710U) - halting on critical error.

zhen-zen commented 4 years ago

@zavrazhny Since related borad package is not available from EDK2, the only way is to follow the guide and use that SSDT for values to be hardcoded in the efi. Someone I know managed to compiled his on a whiskey lake board, so the method should still be good. However, you need to adapt similar structure for your DSDT/SSDT.

al3xtjames commented 4 years ago

Here's a debug build that uses libraries from CoffeeLakeSiliconPkg, please try it on CFL/CML. TbtForcePower.efi.zip

wu-hongjun commented 4 years ago

Here's a debug build that uses libraries from CoffeeLakeSiliconPkg, please try it on CFL/CML. TbtForcePower.efi.zip

I tried it on i7-9750H and it gives this error and freeze before open core lets me select boot option: IMG_3108 I correctly put it in /Drivers folder and properly referenced it in config.plist. The config will boot fine without TbtForcePower.efi. I tried to use it with/without ThunderboltReset.kext but that did not help.

al3xtjames commented 4 years ago

Here's another debug version for testing, this will dump the Thunderbolt info HOB. 0x1FFFFFF doesn't look like a valid GPIO pad (chipset ID = 1 which is for SKL-H/KBL-H, not CFL) - maybe the HOB structure changed?

TbtForcePower.efi.zip

wu-hongjun commented 4 years ago

Here's another debug version for testing, this will dump the Thunderbolt info HOB. 0x1FFFFFF doesn't look like a valid GPIO pad (chipset ID = 1 which is for SKL-H/KBL-H, not CFL) - maybe the HOB structure changed?

TbtForcePower.efi.zip

Thanks for your reply, This is what is shows, still freezes without getting into choosing boot. image

al3xtjames commented 4 years ago

Freezes are normal on assertion failure. Yup, this matches this HOB structure: https://github.com/tianocore/edk2-platforms/blob/f86c932ba5b3944ba3cab3b199796ae7cb4d203b/Platform/Intel/WhiskeylakeOpenBoardPkg/Features/Tbt/Include/TbtPolicyCommonDefinition.h

Try this version: TbtForcePower.efi.zip

wu-hongjun commented 4 years ago

Freezes are normal on assertion failure. Yup, this matches this HOB structure: https://github.com/tianocore/edk2-platforms/blob/f86c932ba5b3944ba3cab3b199796ae7cb4d203b/Platform/Intel/WhiskeylakeOpenBoardPkg/Features/Tbt/Include/TbtPolicyCommonDefinition.h

Try this version: TbtForcePower.efi.zip

Good news: Now it successfully boots, I didn't see anything notable.

Bad news: Still, when I plugged in my eGPU, it says "No Removable GPU". A more detailed explanation of what is actually going on can be found here: https://www.tonymacx86.com/threads/coffeelake-laptop-thunderbolt-3-egpu-not-working.302541/

Thanks for your help!

al3xtjames commented 4 years ago

Good to hear, it looks like TbtForcePower did its job. I'll keep this open until someone confirms that it also works on CML.

Bad news: Still, when I plugged in my eGPU, it says "No Removable GPU". A more detailed explanation of what is actually going on can be found here: https://www.tonymacx86.com/threads/coffeelake-laptop-thunderbolt-3-egpu-not-working.302541/

Thunderbolt is a fairly complex standard, and unfortunately TbtForcePower itself isn't enough for proper functionality in macOS. At a minimum, you'll probably need additional ACPI edits (and maybe even firmware modifications): some info is available in osy's NUC guide and CaseySJ's Z490 Vision D guide. I don't really have any advice of my own, since I still haven't looked extensively into fixing TB3 on my system (XPS 9560, KBL with Alpine Ridge).

wu-hongjun commented 4 years ago

Good to hear, it looks like TbtForcePower did its job. I'll keep this open until someone confirms that it also works on CML.

Bad news: Still, when I plugged in my eGPU, it says "No Removable GPU". A more detailed explanation of what is actually going on can be found here: https://www.tonymacx86.com/threads/coffeelake-laptop-thunderbolt-3-egpu-not-working.302541/

Thunderbolt is a fairly complex standard, and unfortunately TbtForcePower itself isn't enough for proper functionality in macOS. At a minimum, you'll probably need additional ACPI edits (and maybe even firmware modifications): some info is available in osy's NUC guide and CaseySJ's Z490 Vision D guide. I don't really have any advice of my own, since I still haven't looked extensively into fixing TB3 on my system (XPS 9560, KBL with Alpine Ridge).

Awesome. Thanks for your help! At least we got one more piece of the puzzle somewhat working. And btw this is Big Sur.

jqqqqqqqqqq commented 4 years ago

Can also confirm this works on my HP Z2 Mini G4 w/ thunderbolt flex io. (my initial attempt following the guide to track \_SB.SGOV doesn't work somehow, it even makes my GPE events disappear )

I tried osy's NUC guide as well as the ssdts in thunderboltnative, they do make disconnection immediate (previously IOReg does not refresh and I cannot see GPU disconnected notification), so I can get this:

telegram-cloud-photo-size-5-6183901017112947177-x

However, hot plug doesn't work so far, I can see the logs

2020-08-17 03:49:52.371110-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: Version 0.1.4 starting on OS X Darwin 19.6.
2020-08-17 03:49:52.372425-0400  localhost kernel[0]: PMRD: PMTrace found PCI host bridge PCI0->AppleACPIPCI
2020-08-17 03:49:52.421032-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO", 0xffffffffffffffff, 0xffffffffffffffff, }
2020-08-17 03:49:52.423071-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO finish", 0x0, 0x0, }
2020-08-17 03:49:52.445502-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "CRMW", 0x13e, 0x0, }
2020-08-17 03:49:52.455930-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "CRMW", 0x23e, 0x0, }
2020-08-17 03:49:52.541572-0400  localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AppleACPIPlatformExpert::getUTCTimeOfDay(unsigned long*, unsigned int*)>  found RTC service
2020-08-17 03:49:52.553855-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO", 0xffffffffffffffff, 0xffffffffffffffff, }
2020-08-17 03:49:52.554001-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO finish", 0x0, 0x0, }
2020-08-17 03:49:52.555443-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO", 0xffffffffffffffff, 0xffffffffffffffff, }
2020-08-17 03:49:52.555809-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO finish", 0x0, 0x0, }
2020-08-17 03:49:52.555981-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "CRMW", 0x3c, 0x0, }
2020-08-17 03:50:09.646210-0400  localhost kernel[0]: (AppleGraphicsDeviceControl) <AppleGraphicsDeviceControl`AppleGraphicsDeviceControlClient::authorizeTask(AppleGraphicsDeviceControl*, task*, unsigned int)> AGDCC: Unauthorized client 'PerfPowerService' (IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/IGPU@2/AppleIntelFramebufferController/IntelFBClientControl)
2020-08-17 03:50:12.925029-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO", 0x0, 0xffffffffffffffff, }
2020-08-17 03:50:12.925093-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO finish", 0x0, 0x0, }
2020-08-17 03:50:54.258867-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "Hot plug event"
2020-08-17 03:50:54.258980-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "End hotplug handler"
2020-08-17 03:50:54.260653-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO", 0xffffffffffffffff, 0xffffffffffffffff, }
2020-08-17 03:50:54.260778-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "UGIO finish", 0x0, 0x0, }
2020-08-17 03:50:54.279414-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "Hot plug event"
2020-08-17 03:50:54.279533-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "End hotplug handler"
2020-08-17 03:50:54.412887-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: { "CRMW", 0x3c, 0x0, }
2020-08-17 03:50:54.710814-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "Hot plug event"
2020-08-17 03:50:54.710888-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "End hotplug handler"
2020-08-17 03:50:54.890019-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "Hot plug event"
2020-08-17 03:50:54.890114-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "End hotplug handler"
2020-08-17 03:50:54.905819-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "Hot plug event"
2020-08-17 03:50:54.906080-0400  localhost kernel[0]: (ACPIDebug) ACPIDebug: "End hotplug handler"

But the device doesn't show up anywhere. Using methods from osy's guide has the same effect (immediate disconnection, no hot plug).

Here is the log:

2020-08-17 03:49:51.992010-0400  localhost kernel[0]: (Lilu) ThunderboltReset      init: @ (DBG) ThunderboltReset bootstrap DBG-100-2020-08-12
2020-08-17 03:49:51.993738-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) start
2020-08-17 03:49:52.538216-0400  localhost kernel[0]: (ThunderboltReset) ThunderboltWait: patch not ready yet, delaying thread
2020-08-17 03:49:59.273760-0400  localhost kernel[0]: (ThunderboltReset) ThunderboltWait: patch not ready yet, delaying thread
2020-08-17 03:49:59.449396-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) found AppleThunderboltNHI
2020-08-17 03:50:00.290401-0400  localhost kernel[0]: (ThunderboltReset) ThunderboltWait: patch completed, returning
2020-08-17 03:50:00.305713-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltGenericHAL::probe(IOService*, int*)> AppleThunderboltGenericHAL::probe
2020-08-17 03:50:00.306131-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltGenericHAL::probe(IOService*, int*)> 10847826us AppleThunderboltGenericHAL::probe
2020-08-17 03:50:00.306154-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltGenericHAL::start(IOService*)> AppleThunderboltGenericHAL::start
2020-08-17 03:50:00.306489-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltGenericHAL::start(IOService*)> 10848184us AppleThunderboltGenericHAL::start
2020-08-17 03:50:01.653338-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltNHIType3::setupPowerSavings()> AppleThunderboltNHIType3::setupPowerSavings - notification based runtime power management
2020-08-17 03:50:01.653471-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI called
2020-08-17 03:50:01.653585-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI: REG_FW_STS = 0xFFFFFFFF
2020-08-17 03:50:01.730880-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI: ARC already disabled, bypassing
2020-08-17 03:50:01.731152-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltNHIType3::publishPCILinkData()> Thunderbolt 255 PCI - LS=0x7043 LC=0x0040 SS=0x0148 SC=0x0008 PMCSR=0x0000 RT=0xffffffff NLRT=0xffffffff LWRT=0xffffffff PRRT=0xffffffff TRT=0x0000 TNLRT=0x0000 TLWRT=0x0000 TPRRT=0x0000 TLUP=0x0001
2020-08-17 03:50:01.731583-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltNHIType3::publishPCILinkData()> Thunderbolt 255 PCI - LS=0x7043 LC=0x0040 SS=0x0148 SC=0x0008 PMCSR=0x0000 RT=0xffffffff NLRT=0xffffffff LWRT=0xffffffff PRRT=0xffffffff TRT=0x0000 TNLRT=0x0000 TLWRT=0x0000 TPRRT=0x0000 TLUP=0x0001
2020-08-17 03:50:01.731601-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI called
2020-08-17 03:50:01.860768-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI: REG_FW_STS = 0xFFFFFFFF
2020-08-17 03:50:01.860771-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI: ARC already disabled, bypassing
2020-08-17 03:50:54.412727-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltGenericHAL::earlyWake()> 64718605us AppleThunderboltGenericHAL::earlyWake - complete - took 0 milliseconds
2020-08-17 03:50:54.412729-0400  localhost kernel[0]: (AppleThunderboltNHI) <AppleThunderboltNHI`AppleThunderboltGenericHAL::earlyWake()> AppleThunderboltGenericHAL::earlyWake - complete - took 0 milliseconds
2020-08-17 03:50:54.413052-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI called
2020-08-17 03:50:54.413059-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI: REG_FW_STS = 0xFFFFFFFF
2020-08-17 03:50:54.413064-0400  localhost kernel[0]: (Lilu) ThunderboltReset       tbr: @ (DBG) AppleThunderboltNHI::resetNHI: ARC already disabled, bypassing
jqqqqqqqqqq commented 4 years ago

Good news, it seems on HP Z2 Mini G4, I can get TB hot plug working (without sleep wake, sometimes it works after wake, sometimes not). XHC2 disappears if boot up with TB plugged, otherwise both HotPlug works before sleep wake

Thanks to this version of Tbtforcepower.efi

radianttap commented 3 years ago

Try this version: TbtForcePower.efi.zip

I can confirm this version works on ASRock Z490 ITX/TB3. Without it, TB3 external disk is ignored. With it, hot plug works really well.

Lorys89 commented 11 months ago

Freezes are normal on assertion failure. Yup, this matches this HOB structure: https://github.com/tianocore/edk2-platforms/blob/f86c932ba5b3944ba3cab3b199796ae7cb4d203b/Platform/Intel/WhiskeylakeOpenBoardPkg/Features/Tbt/Include/TbtPolicyCommonDefinition.h

Try this version: TbtForcePower.efi.zip

work good in my nuc8i3beh cfl