xxxzc / xps15-9570-macos

macOS Monterey/Ventura on XPS15-9570 with OpenCore
193 stars 27 forks source link

Potential TB3 hot plug? #40

Open adityahota opened 4 years ago

adityahota commented 4 years ago

https://www.elitemacx86.com/threads/guide-how-to-enable-thunderbolt-3-hotplug.462/

Is this something that could possibly be implemented in our system @xxxzc ?

I'll try to give it a shot next week.

xxxzc commented 4 years ago

Replace SSDT-TYPC.aml with SSDT-TB3.aml.zip (don't forget to update config.plist).

Some people reported that this can make thunderbolt dock hot-pluggable but not eGPU.

adityahota commented 4 years ago

@xxxzc thank you for that! Could I ask why you switched to SSDT-TYPC.aml in the main config? I remember in an older version, you used SSDT-TB3.

Also, does this enable USB 3.0 over USB C port?

meisekiyou commented 4 years ago

在删除 SSDT-TYPC.aml 和 rp17 重命名并在 grub shell 修改了gpio3 force pwr 和gpio filter 的偏量值后雷电3设备(除egpu)可实现冷启动。

tofuliang commented 4 years ago

在删除 SSDT-TYPC.aml 和 rp17 重命名并在 grub shell 修改了gpio3 force pwr 和gpio filter 的偏量值后雷电3设备(除egpu)可实现冷启动。

可以热插拔麽?

meisekiyou commented 4 years ago

在删除 SSDT-TYPC.aml 和 rp17 重命名并在 grub shell 修改了gpio3 force pwr 和gpio filter 的偏量值后雷电3设备(除egpu)可实现冷启动。

可以热插拔麽?

雷电不行,DP可以

andresandiah commented 3 years ago

Quick update. So I've been trying to get TB3 Hot plug-ability for a long time now. After testing a few of different combinations it seems like I got fully working TB3 and USB-C hot plug.

Even tho xxxzc mentioned to not use both .aml simultaneously for USBC and TB3 I tried anyways. I also added one other thunderbolt related .aml I had laying around from a previous EFI based on clover and proceeded to use IOElectrify.kext to force-power the Thunderbolt controller on boot.

I have tested it with an Apollo X4 TB3 interface and can hot-plug with no problems. Also tried a USB-C SSD (sands extreme 1gb) and its working perfectly.

So far it is very stable and it even shows in PCI's Tab in System report.

Screen Shot 2020-12-23 at 23 52 20

Will do some more testing during the coming weeks. I'll also share my EFI so maybe someone with more knowledge about this can do some cleanup or optimizations of the AML/Kext in there to push it to the main release with TB3 hot plug enabled.

EFI.zip

adityahota commented 3 years ago

That's very interesting! I tried using the TB3 aml in the past and it would cause the laptop to crash upon wakeup--does the same happen for you? Also, does the thunderbolt port get hot even when nothing is plugged in?

andresandiah commented 3 years ago

That's very interesting! I tried using the TB3 aml in the past and it would cause the laptop to crash upon wakeup--does the same happen for you? Also, does the thunderbolt port get hot even when nothing is plugged in?

It's just a little warm, will report back tomorrow if it gets hot or warm even without use.

Literally just tested putting it to sleep and the interface reconnected without a problem; no crashes.

I have to note that disabled Thunderbolt Auto Switch on Bios and it is set to Native.

adityahota commented 3 years ago

That’s great to hear. Do you think eGPUs would work as well?

andresandiah commented 3 years ago

My XPS is more music production oriented so I do not own any kind of eGPU. I currently tested it with an Universal Audio Apollo X4 audio interface and it is working flawlessly. Since the thunderbolt controller seems to be fully loaded on boot I suppose it will work normally with any EGPU. It is worth a try if you have one to test with; just make sure to make a backup of your current working EFI.

adityahota commented 3 years ago

@xxxzc is this something you could potentially take a look at?

andresandiah commented 3 years ago

After further testing it seems that the system still shows the thunderbolt card as active after a long sleep BUT will lose its ability to hot-plug until the next reboot. At least there is no panic or sudden shut down of the device.

Also, seems like the SSDT-Thunderbolt.aml in my EFI is not necessary. Only the USB-C, TB3 and IOElectrify.kext.

Wish there is some kind of workaround to this. Hope @xxxzc can take a look at this and work it out. 💪🏾

adityahota commented 3 years ago

I was taking a look at this EFI: https://github.com/tylernguyen/x1c6-hackintosh

There are lots of files related to TB3 there, and no IOElectrify kext is used. I wonder if it's possible to achieve the hotplugging completely through ACPI patching on this device.

andresandiah commented 3 years ago

Ok, so it seems IOElectrify kext was not necessary. I removed it from my EFI, and also removed the SSDT-THUNDERBOLT that i added.

Hot Plug seems to be working normally until now. Even after a long sleep (while plugged) the thunderbolt device was still functioning after wake up; i even turned off and turned on my interface to see if it would still function and it did.

I cannot say that this hot plug is 100% functional as I need to keep testing in other scenarios, but it seems like it is functioning way beyond what i initially expected from it. Thanks for the work @xxxzc . Hope you can make some final refinements on the thunderbolt side of this EFI anytime soon. So far great job!

adityahota commented 3 years ago

@andresandiah very interesting! so you are only using SSDT-TB3.aml ~TbtForcePower.efi~? Or are there still other modifications to the EFI folder?

andresandiah commented 3 years ago

@adityahota Currently the only modification to the EFI is the SSDT-TB3.aml in conjuction with the one for USB type C. That's it. Seems to be working fine.

adityahota commented 3 years ago

What is your TB3 mode set to in the BIOS settings? Could you let me know if it's set to Native or BIOS Assist? Thank you!

andresandiah commented 3 years ago

It is set to Native. Make sure to select "No Authorization" if you are not dual-booting MacOS and Windows 10

adityahota commented 3 years ago

Okay. I tried adding just the SSDT-TB3 file to the EFI and now whenever I wake the laptop up from sleep (on battery), the laptop KPs and reboots. Here's the log I am getting.

Screen Shot 2021-01-12 at 2 15 56 PM
andresandiah commented 3 years ago

Mmmm, that's weird. I'll upload my current EFI. Feel free to check it out 👌🏾 EFI.zip

adityahota commented 3 years ago

Hmm, weirdly even with your EFI I am still getting the KP. Have you tried sleeping without the laptop plugged in? I wonder if that's part of the cause. I originally tried adding SSDT-TB3 to my EFI a few months ago and was getting the same issue. I'll try playing with my settings and see if I can get it to work.

andresandiah commented 3 years ago

I'm on Big Sur for the record.

adityahota commented 3 years ago

Likewise. Which BIOS version are you on? Also do you have the i7 or the i9 model?

andresandiah commented 3 years ago

I found that the one that gave me the least amount of problems was 1.11.2 (the one recommended on LuletterSoul's MacOS EFI). I have the i7 Model, 8750H

adityahota commented 3 years ago

Gotcha, it seems that apart from the BIOS version, our configs are the same. I'll try downgrading to 1.11.2 and see if that fixes the sleep wake issue. Did you have a chance to test TB3 hotplug after sleeping on battery? If so, could you let us know how that went?

adityahota commented 3 years ago

Okay even after downgrading, the reboot issue persists. I guess we’ll have to do some more testing across devices.

On Wed, Jan 13, 2021 at 12:55 andresandiah notifications@github.com wrote:

I found that the one that gave me the least amount of problems was 1.11.2 (the one recommended on LuletterSoul's MacOS EFI). I have the i7 Model, 8750H

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xxxzc/xps15-9570-macos/issues/40#issuecomment-759616441, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7PXAKB3F5UGFIZVOLTH53SZXNBVANCNFSM4M26732A .

andresandiah commented 3 years ago

Man, thats weird. Try resetting BIOS default configuration and also resetting the NVRAM in OpenCore. I dont know if the kextcache command works normally in BigSur but I periodically run it anyways haha

xxxzc commented 3 years ago

Thanks for the work @xxxzc . Hope you can make some final refinements on the thunderbolt side of this EFI anytime soon. So far great job!

That TB3.aml wasn't wrote by me, I have no other TB device except a nvidia eGPU. I can't be of more help, sorry.

andresandiah commented 3 years ago

Ok. So I kept testing the thunderbolt connection while sleeping.

Situation A: XPS Not Plugged to AC -> Entered sleep status while thunderbolt device on. (15 min idle ) Wake XPS while thunderbolt device still turned on. Hot plug capability still remains and thunderbolt device works correctly

Situation B: XPS Not Plugged to AC -> Entered sleep status while thunderbolt device on. (15 min idle ) UNPLUGGED TB Device then proceeded to wake up XPS. To my surprise this causes a kernel panic and the XPS automatically shut downs.

I'll have to try one more situation where the XPS goes to sleep without battery and without any TB device connected to see if after wakeup it can still hot plug any thunderbolt device.

adityahota commented 3 years ago

Interesting... I wonder if using TbtForcePower.efi can help here. I believe that driver is used to prevent macOS from crashing if it doesn’t see the TB device powered on when waking from sleep.

andresandiah commented 3 years ago

I will try using TbtForcePower.efi as soon as i get home.

adityahota commented 3 years ago

I tried adding TbtForcePower to the drivers folder and added it to config.plist but it didn't help with the wake issue. I'm not sure if I did that completely right but I think that should have been sufficient.

I'm not really sure where to go from here. I can take a look at the Thinkpad Carbon X1 since I think they have everything working properly with regards to TB3.

andresandiah commented 3 years ago

I would love to help, but honestly i'm completely lost on this issues regarding hackintoshing.

Can help you testing different configurations if you wish 🙌🏾

Drowningfish223 commented 3 years ago

I have an xps 7590, so I might be able to help. I didn't have usb-c or thunderbolt working before. Like @adityahota, I was getting kernel panics on wake, but I got a new monitor with a dock so I really wanted to be able to use them. I did have to patch XHC_ to XHC2, like @xxxzc mentioned in another issue, but I might have gotten thunderbolt working. I started by enabling thunderbolt with no restrictions in the BIOS. I switched the thunderbolt mode from Bios assist to Native. I reset NVRAM, then I added IOElectrify.kext, ssdt-typec, and ssdt-tb3 to my EFI. Notably, I don't have any expresscard icon in my menu bar. System information also says no thunderbolt driver is loaded. However, everything seems to work. I haven't noticed if power draw is higher because the thunderbolt controller is powered on. My wattage stays around 10-13 watts with a 4k display and halfway brightness.

![Uploading Screen Shot 2021-03-19 at 3.00.10 PM.png…]()

Screen Shot 2021-03-19 at 2 58 13 PM Screen Shot 2021-03-19 at 2 58 27 PM Screen Shot 2021-03-19 at 2 59 54 PM
adityahota commented 3 years ago

Glad you were able to get it to work @Drowningfish223! So you are no longer getting crashes upon wake when you don't have a TB3 device connected? Also, does hotplug work fully for you?

One thing I am wondering is if the XHC_ to XHC2 caused some changes. Could you link me to where you found information about that? Thanks!

Drowningfish223 commented 3 years ago

Hot plug seems to work.

I got the rename info from here: https://github.com/xxxzc/xps15-9570-macos/issues/69. It seems to be xps 7590 specific.

I wasn't having any problems on wake, but after a reboot, I'm now getting macos errors. I'll play around to see if I can fix the issue.

Here's what the errors look like:

Sleep Wake failure in EFI

Failure code:: 0x00000000 0x0000001f

Please IGNORE the below stackshot

================================================================ Date/Time: 2021-03-19 15:13:25.931 -0400 OS Version: ??? ??? (Build ???) Architecture: x86_64 Report Version: 32

Data Source: Stackshots Shared Cache: 52762DF1-0E55-3F8B-9588-8169E6D0EB95 slid base address 0x7fff201b6000, slide 0x1b6000

Event: Sleep Wake Failure Duration: 0.00s Steps: 1

Boot args: -v darkwake=1 igfxfw=2

Time Awake Since Boot: 34s

Process: swd [305] Architecture: x86_64 Footprint: 468 KB Time Since Fork: 1s Num samples: 1 (1)

Thread 0x8f9 1 sample (1) priority 4 (base 4) <thread QoS background (requested background), thread darwinbg, process darwinbg, IO tier 2> 1 start + 1 (libdyld.dylib + 87585) [0x7fff204e2621] 1 1 ??? [0x10ea88454] 1 1 ??? [0x10ea881e8] 1 1 __stack_snapshot_with_config + 10 (libsystem_kernel.dylib + 143386) [0x7fff204b501a] 1 1 ??? [0xffffff80002601f6] 1 1 ??? [0xffffff80009698cb] 1 1 ??? [0xffffff80008733c1] 1 1 ??? [0xffffff80002831c9] 1 *1 ??? [0xffffff80002ba3ed] (running) 1

Binary Images: 0x7fff20492000 - 0x7fff204c0fff libsystem_kernel.dylib (7195.81.3) /usr/lib/system/libsystem_kernel.dylib 0x7fff204cd000 - 0x7fff20507fff libdyld.dylib (832.7.3) <4641E48F-75B5-3CC7-8263-47BF79F15394> /usr/lib/system/libdyld.dylib Model: MacBookPro16,1, BootROM 1554.60.15.0.0, 6 processors, 6-Core Intel Core i7, 2.6 GHz, 16 GB, SMC Graphics: kHW_IntelUHDGraphics630Item, Intel UHD Graphics 630, spdisplays_builtin Memory Module: DIMM A, 8 GB, DDR4, 2667 MHz, 802C0000802C, 8ATF1G64HZ-2G6J1 Memory Module: DIMM B, 8 GB, DDR4, 2667 MHz, 802C0000802C, 8ATF1G64HZ-2G6J1 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x117), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1675.1) Bluetooth: Version 8.0.3d9, 3 services, 27 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en0 PCI Card: Intel Alpine Ridge DSL6540 Thunderbolt 3 NHI, Thunderbolt 3 Controller, Built-In USB Device: USB 3.1 Bus USB Device: Integrated_Webcam_HD USB Device: Goodix Fingerprint Device USB Device: BRCM20702 Hub USB Device: Bluetooth USB Host Controller USB Device: USB 3.1 Bus Thunderbolt Bus:

adityahota commented 3 years ago

@Drowningfish223 are you still getting errors upon wake?

Drowningfish223 commented 3 years ago

I only got the errors after a long sleep, usually overnight, but I’ve disabled sleep on power adapter so I can use my laptop in clamshell mode when I’m at home-the laptop won’t wake up from sleep unless the lid is open. As a result, I haven’t gotten any errors recently. I have done more testing for thunderbolt power draw; it seems that enabling thunderbolt draws 1-2 more watts. That made me change my bios setting to usb-c and DisplayPort only because battery life is important to me and my dock works with usb-c only. Let me know if I can help your testing in any way!

xxxzc commented 3 years ago

There are some differences between the 7590's OEM Thunderbolt SSDTs and the 9570's

gemini444 commented 3 years ago

Hi all, I have TB3 dock https://www.caldigit.com/usb-c-pro-dock/ and two tb3 enclosures https://www.newegg.com/orico-tcm2t3-g40-enclosure/p/0VN-0003-001H2 and https://www.amazon.com/WAVLINK-Certified-Thunderbolt-Enclosure-External/dp/B07YB4DDRB. I tried to test three of them. 1- Caldigit TB3 dock have 2 DP and when i connected to external monitor, xps display turns black and freeze (i have to force reboot). All USB ports, type-c port, audio out, microphone and ethernet works oob. 2- Ugreen type-c adapter with hdmi works but xps's display turns black. 3- When i connected xps's hdmi port and ugreen type-c adapter with hdmi to 2 external monitor, xps's display turns black again (2 ext. monitor works). I removed type-c adapter but display always black :(. 4- Orico and wavlink TB3 enclosures hotplug works oob. I just removed SSDT-TYPC.aml from @xxxzc configuration and added SSDT-TB3.aml instead. It would be nice if TB3 DPs also worked. I attached my EFI folder. Thank you @xxxzc and all. EFI.zip