Giter Site home page Giter Site logo

Comments (131)

benbender avatar benbender commented on May 26, 2024 6

Working Thunderbolt incl. power management for TB and eGPU-support in my experimental repo now: https://github.com/benbender/x1c6-hackintosh

Needs patched TB-FW for the moment and USB is non functional on the USB-C-ports as a race-condition seems to occur on connect. I can enable USB, but loosing PM if I do. Strange bug to be examined.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024 5

@M82589933 From my actual knowledge, our problem is entirely about power management. Some observations/clearifications:

  1. The original(!) OSX TB-FW/HW has the abillity to independently switch off USB/TB-controllers if they have no connections on their respective ports. That's why port-configuration matters so much. ATM I don't think this is entirely possible to replicate with PC-style HW because we are missing specific GPIO-lines to power on/off the individual parts of the controller. They seem to be hardcoded and aren't even available to @osy86-build on an Intel NUC which is the best hack for TB by far.

  2. Therefore it doesn't seem possible to disable the TB-Controller while retaining USB 3.1 functionallity. Our best chance is to fix PM for the entire controller as best as possible. It could(!) be possible to get rtd3 power state for the TB-controller which should help much. Very few of the SSDT's shown here are even trying to do fix PM on the controller.

  3. TB-Assist takes PM over from the OS to the TB-Controllers FW and therefore helps with PM. The PM in this mode is independant of OSX but also renders the PM of OSX useless (besides basic PCI-PM). The problem is, that OSX expects the complete control in ACPI and wants to disable the TB's ICM mostly. So many functions of the OSX TB-stack will silently fail in TB-Assist mode.

  4. There are at least two modes of operation for TB which should be distinguished.
    a) PCIE-paththrough were the TB-Controller acts as a simple PCIe2PCIe-bridge
    b) Full TB-mode where the TB-Controller manages the connection and does protocol handling. That seems to be neccessary for things like TB to TB-networking on macs and other advanced features. I don't think that this mode is possible/reachable with TB Bios assist.

  5. The TB-controller is an independent device with own FW and state. It isn't necessarily resetted on reboots (espacialy on warm reboots) and thats the reason of those reports about "it first worked and suddenly doesn't anymore"

  6. The states in which we force the TB-Controller with different hacks, patches, efis etc was never intended or tested by intel. So seems to be buggy and unstable at times. Which makes development and verification even more problematic.

One last thing: It is possible to have the tb-drivers load up completely without patched FW, ForcePower or any other hack. I'll post an SSDT if I'm done testing. The following screenshots are done with unpatched firmware and no additional tool/hack/patch besides one rename:

tb1

tb2

from x1c6-hackintosh.

notthebee avatar notthebee commented on May 26, 2024 3

We might be on track for native Thunderbolt 3 connectivity.

I started investigating the osy86 Thunderbolt chip mod shared by @Chivs and I came across a thread with SPI mods for Z390 motherboards. As it turns out, there is a set of hardware patches that can be applied to Alpine Ridge Thunderbolt controller firmware to allow for native Thunderbolt connectivity on our X1C6.

I asked for help and CaseySJ was able to modify the Alpine Ridge firmware I sent him. With this firmware, one SSDT and Thunderbolt3Unlocker.kext I'm now able to use my TB16 dock with full hotplug functionality, and it also shows in the Thunderbolt menu of System Profiler:
Screenshot 2020-08-09 at 21 08 17

Unfortunately, the BIOS Assist mode still leaves the machine without hotplug functionatlity, but that might still be helpful for people with eGPUs and other TB3 devices, since we're talking native Thunderbolt 3 support now. I still have to do some test on the battery life, since I'm not sure if it's affected in any way. I measured the package power draw with Intel Power Gadget and it does seem to dip into 1,67W with the TB3 dock unplugged, not sure if that's any different since I didn't do any measurement before the firmware mod
Screenshot 2020-08-09 at 22 44 29

Here's the message from CaseySJ that includes the Alpine Ridge firmware and the SSDT.
In order to flash the firmware, you'll need an SPI programmer: the process is similar to the modded BIOS, however the Thunderbolt chip is located in the top-right part of the motherboard.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024 1

@tylernguyen additionally interesting: PCI Enumeration and GPIO Interface in ACPI. I've enabled those and have much more methods to play with in ACPI. I think it could/should be possible to use @osy86's work with that options to get a (mostly) native ACPI-interface for TB in OSX.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024 1

@tylernguyen additionally interesting: PCI Enumeration and GPIO Interface in ACPI. I've enabled those and have much more methods to play with in ACPI. I think it could/should be possible to use @osy86's work with that options to get a (mostly) native ACPI-interface for TB in OSX.

Just some notes for others to look at if you're also doing testing on TB3 hotplug:
The hotplug GPE event for the x1c6 is _L6F

I am still researching optimal TB3 options for hotplugging but I feel that it is already better. Right now, I can hotplug on the power port as well, however, there is an issue where TB3 is hotpluggable but will not charge the machine.

Will update further once I figure more things out!

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024 1

@tylernguyen I'm also interested in this and did the first part of porting OSY86's work yesterday. I can load all of his ACPI-hotpatches without error, but initialization needs some more work. I'm not really interested in hotswap atm (no device to test) but in power-management, native port-config + HPM for USB-C PD.

My prelimitary attempts are in the zip-file-attached.
Archiv.zip

Needed patches are:

			<dict>
				<key>Comment</key>
				<string>Rename Method _UPC to XUPC (USB Port Customization)</string>
				<key>Count</key>
				<integer>0</integer>
				<key>Enabled</key>
				<true/>
				<key>Find</key>
				<data>X1VQQw==</data>
				<key>Limit</key>
				<integer>0</integer>
				<key>Mask</key>
				<data></data>
				<key>OemTableId</key>
				<data>UHJvalNzZHQ=</data>
				<key>Replace</key>
				<data>WFVQQw==</data>
				<key>ReplaceMask</key>
				<data></data>
				<key>Skip</key>
				<integer>0</integer>
				<key>TableLength</key>
				<integer>5692</integer>
				<key>TableSignature</key>
				<data>U1NEVA==</data>
			</dict>
			<dict>
				<key>Comment</key>
				<string>change RP09._INI to RP09.XINI for ICM disable</string>
				<key>Count</key>
				<integer>0</integer>
				<key>Enabled</key>
				<true/>
				<key>Find</key>
				<data>FCpfSU5JAHBMVFI5TFRSWg==</data>
				<key>Limit</key>
				<integer>0</integer>
				<key>Mask</key>
				<data></data>
				<key>OemTableId</key>
				<data></data>
				<key>Replace</key>
				<data>FCpYSU5JAHBMVFI5TFRSWg==</data>
				<key>ReplaceMask</key>
				<data></data>
				<key>Skip</key>
				<integer>0</integer>
				<key>TableLength</key>
				<integer>0</integer>
				<key>TableSignature</key>
				<data>RFNEVA==</data>
			</dict>

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024 1

@tylernguyen

I'll take a look at the YTBT and test it later.
As for as debugging, here are the output the last time I tried it.

That was a misunderstanding. This particular SSDT is just for getting PIN and Memory-Adress of the TB-Port. It was more like a hint to the general method. You can adapt it to any ACPI-method and get messages directly in syslog.

Btw. it's also useful for debugging vars. F.e. this way I checked H8DR, which is 1 für the T480 as _Rev (revision) = 2 per default...

Ahh, that makes more sense. Thanks for the hint.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024 1

@tylernguyen
We have a working setup for eGPU (requires controller re-flashed) but works natively. No PM at the moment. Will keep you posted on progress

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

Thunderbolt SSDT does not work with OC. (Only with clover)

On OC is causes an immediate freeze once you plug in the device (even if you boot with the device plugged in)

Here is the debug 100 from it (don't see any useful info, just in case) :

panic(cpu 0 caller 0xffffff800526520a): Kernel trap at 0xffffff8005277abf, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x00007fff477ce412, CR3: 0x0000000011a45000, CR4: 0x00000000003626e0
RAX: 0x000000007e008003, RBX: 0xffffff8005a0cec0, RCX: 0x00000000000000e2, RDX: 0x0000000000000000
RSP: 0xffffff81fa6a3ef0, RBP: 0xffffff81fa6a3f20, RSI: 0x000000007e008000, RDI: 0x000000007e008003
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000000000000000, R11: 0x0000000000000000
R12: 0xffffff8005a0cec0, R13: 0x000000000cb37863, R14: 0x00000004852078c6, R15: 0x0000000000000000
RFL: 0x0000000000010046, RIP: 0xffffff8005277abf, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0x00007fff477ce412, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 1, VF: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff8004f51220 : 0xffffff800513bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff8004f51270 : 0xffffff80052733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff8004f512b0 : 0xffffff8005264e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff8004f51300 : 0xffffff80050e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff8004f51320 : 0xffffff800513b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff8004f51420 : 0xffffff800513b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff8004f51470 : 0xffffff80058d24f9 mach_kernel : _panic + 0x61
0xffffff8004f514e0 : 0xffffff800526520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff8004f51660 : 0xffffff8005264f08 mach_kernel : _kernel_trap + 0x598
0xffffff8004f516b0 : 0xffffff80050e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff8004f516d0 : 0xffffff8005277abf mach_kernel : _xcpm_idle + 0x37f
0xffffff81fa6a3f20 : 0xffffff8005266e7a mach_kernel : _machine_idle + 0x1da
0xffffff81fa6a3f40 : 0xffffff80051609b7 mach_kernel : _processor_idle + 0xf7
0xffffff81fa6a3f80 : 0xffffff8005160b78 mach_kernel : _idle_thread + 0x48
0xffffff81fa6a3fa0 : 0xffffff80050e213e mach_kernel : _call_continuation + 0x2e

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x100 

Mac OS version:
19C57

Kernel version:
Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Kernel UUID: C3E7E405-C692-356B-88D3-C30041FD1E72
Kernel slide:     0x0000000004e00000
Kernel text base: 0xffffff8005000000
__HIB  text base: 0xffffff8004f00000
System model name: MacBookPro14,1 (Mac-B4831CEBD52A0C4C)
System shutdown begun: NO
Panic diags file available: YES (0x0)

System uptime in nanoseconds: 19414137417


from x1c6-hackintosh.

Colton-Ko avatar Colton-Ko commented on May 26, 2024

I realized that Thunderbolt 3 controller firmware version could also affect the functionality. @velaar I suggest you may try updating the thunderbolt 3 controller firmware on Windows.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@velaar

@Colton-Ko 's TB3 hotpatch is working for me under OpenCore. Does it work for you after updating the firmware under windows?

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@tylernguyen
This makes me wonder is the issue is not with the TBT but with the device itself. I have NVM41 firmware and I think it's the latest one from Intel.

Did you test it with an eGPU?

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

I haven't tried with an eGPU, but TB3 hotplugging seems to be working for me.
Once I get my wifi card adaptor I'll go through more thorough testing.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@Porco-Rosso @tylernguyen
Thank you for your input. I have done some more testing with different GPUs and GPU firmwares so far on all the GPUs (tested with Nvidia GT 660, RX590, RX580) the crash is the same (see below).

I even flashed a "Mac Edition" firmware onto my RX590 but the crash was the same.

The crash happens after the GPU is detected and the respective kext is loaded.
This is a TB3 issue because:

  • the GPU works without issues if we bypass the TB3.aml
  • On windows all the GPUs work fine
  • The crash happens on framebuffer load after connection (? port reset?)
panic(cpu 0 caller 0xffffff801f66520a): Kernel trap at 0xffffff801f677abf, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x00007ff64aa1e000, CR3: 0x000000002be7c000, CR4: 0x00000000003626e0
RAX: 0x000000007e008003, RBX: 0xffffff801fe0cec0, RCX: 0x00000000000000e2, RDX: 0x0000000000000000
RSP: 0xffffff8206a8bef0, RBP: 0xffffff8206a8bf20, RSI: 0x000000007e008000, RDI: 0x000000007e008003
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000000000000000, R11: 0x0000000000000000
R12: 0xffffff801fe0cec0, R13: 0x0000000002c73eaf, R14: 0x00000050d8ddad3a, R15: 0x0000000000000000
RFL: 0x0000000000010046, RIP: 0xffffff801f677abf, CS:  0x0000000000000008, SS:  0x0000000000000010
Fault CR2: 0x00007ff64aa1e000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 1, VF: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff801f351220 : 0xffffff801f53bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff801f351270 : 0xffffff801f6733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff801f3512b0 : 0xffffff801f664e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff801f351300 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f351320 : 0xffffff801f53b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff801f351420 : 0xffffff801f53b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff801f351470 : 0xffffff801fcd24f9 mach_kernel : _panic + 0x61
0xffffff801f3514e0 : 0xffffff801f66520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff801f351660 : 0xffffff801f664f08 mach_kernel : _kernel_trap + 0x598
0xffffff801f3516b0 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f3516d0 : 0xffffff801f677abf mach_kernel : _xcpm_idle + 0x37f
0xffffff8206a8bf20 : 0xffffff801f666e7a mach_kernel : _machine_idle + 0x1da
0xffffff8206a8bf40 : 0xffffff801f5609b7 mach_kernel : _processor_idle + 0xf7
0xffffff8206a8bf80 : 0xffffff801f560b78 mach_kernel : _idle_thread + 0x48
0xffffff8206a8bfa0 : 0xffffff801f4e213e mach_kernel : _call_continuation + 0x2e

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x100

Mac OS version:
19C57

Kernel version:
Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Kernel UUID: C3E7E405-C692-356B-88D3-C30041FD1E72
Kernel slide:     0x000000001f200000
Kernel text base: 0xffffff801f400000
__HIB  text base: 0xffffff801f300000
System model name: MacBookPro14,1 (Mac-B4831CEBD52A0C4C)
System shutdown begun: NO
Panic diags file available: YES (0x0)

System uptime in nanoseconds: 347236532426
last loaded kext at 347168719535: @kext.AMDFramebuffer	3.0.4 (addr 0xffffff7fa4cbd000, size 249856)
last unloaded kext at 39198095337: com.cisco.kext.acsock	4.7.1 (addr 0xffffff7fa2f6c000, size 278528)
loaded kexts:
<nothing unusual> 

With TB3 v1 I was able to get a bit more verbose crash. I'll keep it here for reference:

panic(cpu 2 caller 0xffffff800106520a): Kernel trap at 0xffffff7f84feffdf, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0xffffff81f9015000, CR3: 0x000000000d87c000, CR4: 0x00000000003626e0
RAX: 0xffffff81f9015000, RBX: 0x0000000000005434, RCX: 0x0000000002000000, RDX: 0x0000000003000000
RSP: 0xffffff81f76abb60, RBP: 0xffffff81f76abb80, RSI: 0xffffff802efe4bf0, RDI: 0x0000000000000000
R8:  0x0000000000000001, R9:  0x000000000000000b, R10: 0x00000000f0000000, R11: 0x0000000000000070
R12: 0xffffff8029c01880, R13: 0xffffff81a7bd0000, R14: 0x0000000000000000, R15: 0xffffff802ee4bc30
RFL: 0x0000000000010246, RIP: 0xffffff7f84feffdf, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0xffffff81f9015000, Error code: 0x0000000000000002, Fault CPU: 0x2, PL: 0, VF: 1

Backtrace (CPU 2), Frame : Return Address
0xffffff81f76ab5c0 : 0xffffff8000f3bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff81f76ab610 : 0xffffff80010733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff81f76ab650 : 0xffffff8001064e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff81f76ab6a0 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76ab6c0 : 0xffffff8000f3b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff81f76ab7c0 : 0xffffff8000f3b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff81f76ab810 : 0xffffff80016d24f9 mach_kernel : _panic + 0x61
0xffffff81f76ab880 : 0xffffff800106520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff81f76aba00 : 0xffffff8001064f08 mach_kernel : _kernel_trap + 0x598
0xffffff81f76aba50 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76aba70 : 0xffffff7f84feffdf com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4readEj + 0x53
0xffffff81f76abb80 : 0xffffff7f85027795 com.apple.kext.AMDRadeonX4000 : __ZN28AMDRadeonX4000_AMDVIHardware19getRegisterAperSizeEv + 0x23
0xffffff81f76abba0 : 0xffffff7f84fefeec com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4initEP11IOPCIDeviceP30AMDRadeonX4000_IAMDHWInterface + 0xfa
0xffffff81f76abbe0 : 0xffffff7f8500f5c1 com.apple.kext.AMDRadeonX4000 : __ZN26AMDRadeonX4000_AMDHardware4initEP11IOPCIDeviceP28AMDRadeonX4000_IAMDHWHandlerRjP16_GART_PARAMETERSP14_FB_PARAMETERS + 0x257
0xffffff81f76abc30 : 0xffffff7f84f95b2b com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator17createHWInterfaceEP11IOPCIDevice + 0x7b
0xffffff81f76abc70 : 0xffffff7f84f9350e com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator15configureDeviceEP11IOPCIDevice + 0x10a
0xffffff81f76abd00 : 0xffffff7f83a0d534 com.apple.iokit.IOAcceleratorFamily2 : __ZN22IOGraphicsAccelerator25startEP9IOService + 0x21e
0xffffff81f76abd80 : 0xffffff7f84f918de com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator5startEP9IOService + 0x82
0xffffff81f76abde0 : 0xffffff800161ae46 mach_kernel : __ZN9IOService14startCandidateEPS_ + 0xf6
0xffffff81f76abe40 : 0xffffff800161a9f1 mach_kernel : __ZN9IOService15probeCandidatesEP12OSOrderedSet + 0xb21
0xffffff81f76abef0 : 0xffffff8001619d3e mach_kernel : __ZN9IOService14doServiceMatchEj + 0x2ce
0xffffff81f76abf50 : 0xffffff800161c4dd mach_kernel : __ZN15_IOConfigThread4mainEPvi + 0x15d
0xffffff81f76abfa0 : 0xffffff8000ee213e mach_kernel : _call_continuation + 0x2e
      Kernel Extensions in backtrace:
         com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000->0xffffff7f83a98fff
            dependency: com.apple.driver.AppleMobileFileIntegrity(1.0.5)[2FAEE793-59BC-3ADF-A5E2-3BC8760AFE0B]@0xffffff7f81bf0000
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOReportFamily(47)[E3C37E96-3AFA-301F-B89C-719FB3D4DA53]@0xffffff7f8189f000
         com.apple.kext.AMDRadeonX4000(3.0.4)[829632A7-3E6E-33D0-BC01-A5598CDB2D04]@0xffffff7f84f90000->0xffffff7f854d4fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x144

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@Porco-Rosso @tylernguyen
Thank you for your input. I have done some more testing with different GPUs and GPU firmwares so far on all the GPUs (tested with Nvidia GT 660, RX590, RX580) the crash is the same (see below).

I even flashed a "Mac Edition" firmware onto my RX590 but the crash was the same.

The crash happens after the GPU is detected and the respective kext is loaded.
This is a TB3 issue because:

  • the GPU works without issues if we bypass the TB3.aml
  • On windows all the GPUs work fine
  • The crash happens on framebuffer load after connection (? port reset?)
panic(cpu 0 caller 0xffffff801f66520a): Kernel trap at 0xffffff801f677abf, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x00007ff64aa1e000, CR3: 0x000000002be7c000, CR4: 0x00000000003626e0
RAX: 0x000000007e008003, RBX: 0xffffff801fe0cec0, RCX: 0x00000000000000e2, RDX: 0x0000000000000000
RSP: 0xffffff8206a8bef0, RBP: 0xffffff8206a8bf20, RSI: 0x000000007e008000, RDI: 0x000000007e008003
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000000000000000, R11: 0x0000000000000000
R12: 0xffffff801fe0cec0, R13: 0x0000000002c73eaf, R14: 0x00000050d8ddad3a, R15: 0x0000000000000000
RFL: 0x0000000000010046, RIP: 0xffffff801f677abf, CS:  0x0000000000000008, SS:  0x0000000000000010
Fault CR2: 0x00007ff64aa1e000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 1, VF: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff801f351220 : 0xffffff801f53bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff801f351270 : 0xffffff801f6733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff801f3512b0 : 0xffffff801f664e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff801f351300 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f351320 : 0xffffff801f53b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff801f351420 : 0xffffff801f53b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff801f351470 : 0xffffff801fcd24f9 mach_kernel : _panic + 0x61
0xffffff801f3514e0 : 0xffffff801f66520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff801f351660 : 0xffffff801f664f08 mach_kernel : _kernel_trap + 0x598
0xffffff801f3516b0 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f3516d0 : 0xffffff801f677abf mach_kernel : _xcpm_idle + 0x37f
0xffffff8206a8bf20 : 0xffffff801f666e7a mach_kernel : _machine_idle + 0x1da
0xffffff8206a8bf40 : 0xffffff801f5609b7 mach_kernel : _processor_idle + 0xf7
0xffffff8206a8bf80 : 0xffffff801f560b78 mach_kernel : _idle_thread + 0x48
0xffffff8206a8bfa0 : 0xffffff801f4e213e mach_kernel : _call_continuation + 0x2e

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x100

Mac OS version:
19C57

Kernel version:
Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Kernel UUID: C3E7E405-C692-356B-88D3-C30041FD1E72
Kernel slide:     0x000000001f200000
Kernel text base: 0xffffff801f400000
__HIB  text base: 0xffffff801f300000
System model name: MacBookPro14,1 (Mac-B4831CEBD52A0C4C)
System shutdown begun: NO
Panic diags file available: YES (0x0)

System uptime in nanoseconds: 347236532426
last loaded kext at 347168719535: @kext.AMDFramebuffer	3.0.4 (addr 0xffffff7fa4cbd000, size 249856)
last unloaded kext at 39198095337: com.cisco.kext.acsock	4.7.1 (addr 0xffffff7fa2f6c000, size 278528)
loaded kexts:
<nothing unusual> 

With TB3 v1 I was able to get a bit more verbose crash. I'll keep it here for reference:

panic(cpu 2 caller 0xffffff800106520a): Kernel trap at 0xffffff7f84feffdf, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0xffffff81f9015000, CR3: 0x000000000d87c000, CR4: 0x00000000003626e0
RAX: 0xffffff81f9015000, RBX: 0x0000000000005434, RCX: 0x0000000002000000, RDX: 0x0000000003000000
RSP: 0xffffff81f76abb60, RBP: 0xffffff81f76abb80, RSI: 0xffffff802efe4bf0, RDI: 0x0000000000000000
R8:  0x0000000000000001, R9:  0x000000000000000b, R10: 0x00000000f0000000, R11: 0x0000000000000070
R12: 0xffffff8029c01880, R13: 0xffffff81a7bd0000, R14: 0x0000000000000000, R15: 0xffffff802ee4bc30
RFL: 0x0000000000010246, RIP: 0xffffff7f84feffdf, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0xffffff81f9015000, Error code: 0x0000000000000002, Fault CPU: 0x2, PL: 0, VF: 1

Backtrace (CPU 2), Frame : Return Address
0xffffff81f76ab5c0 : 0xffffff8000f3bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff81f76ab610 : 0xffffff80010733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff81f76ab650 : 0xffffff8001064e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff81f76ab6a0 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76ab6c0 : 0xffffff8000f3b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff81f76ab7c0 : 0xffffff8000f3b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff81f76ab810 : 0xffffff80016d24f9 mach_kernel : _panic + 0x61
0xffffff81f76ab880 : 0xffffff800106520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff81f76aba00 : 0xffffff8001064f08 mach_kernel : _kernel_trap + 0x598
0xffffff81f76aba50 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76aba70 : 0xffffff7f84feffdf com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4readEj + 0x53
0xffffff81f76abb80 : 0xffffff7f85027795 com.apple.kext.AMDRadeonX4000 : __ZN28AMDRadeonX4000_AMDVIHardware19getRegisterAperSizeEv + 0x23
0xffffff81f76abba0 : 0xffffff7f84fefeec com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4initEP11IOPCIDeviceP30AMDRadeonX4000_IAMDHWInterface + 0xfa
0xffffff81f76abbe0 : 0xffffff7f8500f5c1 com.apple.kext.AMDRadeonX4000 : __ZN26AMDRadeonX4000_AMDHardware4initEP11IOPCIDeviceP28AMDRadeonX4000_IAMDHWHandlerRjP16_GART_PARAMETERSP14_FB_PARAMETERS + 0x257
0xffffff81f76abc30 : 0xffffff7f84f95b2b com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator17createHWInterfaceEP11IOPCIDevice + 0x7b
0xffffff81f76abc70 : 0xffffff7f84f9350e com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator15configureDeviceEP11IOPCIDevice + 0x10a
0xffffff81f76abd00 : 0xffffff7f83a0d534 com.apple.iokit.IOAcceleratorFamily2 : __ZN22IOGraphicsAccelerator25startEP9IOService + 0x21e
0xffffff81f76abd80 : 0xffffff7f84f918de com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator5startEP9IOService + 0x82
0xffffff81f76abde0 : 0xffffff800161ae46 mach_kernel : __ZN9IOService14startCandidateEPS_ + 0xf6
0xffffff81f76abe40 : 0xffffff800161a9f1 mach_kernel : __ZN9IOService15probeCandidatesEP12OSOrderedSet + 0xb21
0xffffff81f76abef0 : 0xffffff8001619d3e mach_kernel : __ZN9IOService14doServiceMatchEj + 0x2ce
0xffffff81f76abf50 : 0xffffff800161c4dd mach_kernel : __ZN15_IOConfigThread4mainEPvi + 0x15d
0xffffff81f76abfa0 : 0xffffff8000ee213e mach_kernel : _call_continuation + 0x2e
      Kernel Extensions in backtrace:
         com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000->0xffffff7f83a98fff
            dependency: com.apple.driver.AppleMobileFileIntegrity(1.0.5)[2FAEE793-59BC-3ADF-A5E2-3BC8760AFE0B]@0xffffff7f81bf0000
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOReportFamily(47)[E3C37E96-3AFA-301F-B89C-719FB3D4DA53]@0xffffff7f8189f000
         com.apple.kext.AMDRadeonX4000(3.0.4)[829632A7-3E6E-33D0-BC01-A5598CDB2D04]@0xffffff7f84f90000->0xffffff7f854d4fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x144

I tested my TB3 hotplug with the CalDigit Plus Dock and it worked. Unfortunately, I do not have an eGPU enclosure nor the proper graphics card to test that.

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

TB3 hotplugging seems to have stopped working for me.
I have tried with the latest version of the EFI files on this repo (5 days ago), and my external USB-C Lenovo dock only seems to work if I boot my computer with it plugged in. If I unplug it and replug it in, it stops working.

This may be tied to the fact that I enabled Filevault, but cannot confirm that is the root cause.
Other changes might be tied to: Enabling the security chip to get Bitlocker in windows working, and Thunderbolt3 BIOS assist mode being enabled.
Has anyone experienced a similar problem? How can I go about debugging it?

The Thunderbolt 3 section of the system profiler is blank even with the device working

Screen Shot 2020-02-09 at 6 11 04 PM

Screen Shot 2020-02-09 at 6 11 30 PM

Screen Shot 2020-02-09 at 6 11 11 PM

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@Porco-Rosso
This is a thunderbolt bios assist issue, it completely changes the way that the ports are allocated.
I use it with TB3v1 to get the hot unplug.
Thunderbolt will work if you plug the device pre-boot.

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

Thanks @velaar, that does seem to fix it.
I should have checked more thoroughly and tried it before posting. Well, at least it might help someone in the future..

As I understand, this will increase power consumption however, correct?
Also still nothing under the Thunderbolt section in the system profiler... I guess that's just because of how the kext works.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@Porco-Rosso
Yes, it will cut the battery life by about 50%. You should see the controller under PCI.

from x1c6-hackintosh.

noclee avatar noclee commented on May 26, 2024

Can someone confirm if the power-assist mode works with Ethernet port on thunderbolt hub standard one that comes with the laptop, tried connecting before and reconnecting after and tried both ports with no luck. HDM and usb ports work ok on the hub.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@noclee I'm not sure what is the question. Maybe I'm missing something but I did not have any thunderbolt hubs coming with the laptop nor heard of the power-assist mode.

from x1c6-hackintosh.

noclee avatar noclee commented on May 26, 2024

@velaar Sorry let me try this way, query is on Ethernet port not working when thunderbolt BIOS power-assist is enabled. Anyone have this working

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

@noclee with my lenovo-brand usb-c dock (like this one but with lenovo branding), the Ethernet jack works, but only if it is connected while booting if BIOS-assist is enabled.

from x1c6-hackintosh.

lubixxx96 avatar lubixxx96 commented on May 26, 2024

Hi guys,
I was able to get fully working usb-c with hotplug support and good battery performance.
Cpu pkg cat get into sub 1W draw, and my usb-c dock is properly initialized even on first usb-c port (near the joint)

If interested, here you have my setup:
SSDT-TYPC.aml.zip

  • activate assisted mode of Thunderbolt3 in bios
  • disable IOElectrify.kext
  • disable all TB3 related .amls and add the one attached here

Let me know if it works.

EDIT:
ok, it doesnt work. I had luck for a few times but it is definitely not stable solution.
I am looking for USB-C hotplug without tb3 and with good battery life.
If anyone has an idea, please share.

thanks

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@lubixxx96 Have you tested it with a thunderbolt device?

from x1c6-hackintosh.

lubixxx96 avatar lubixxx96 commented on May 26, 2024

no, I don't have a thunderbolt device. But I dont see thunderbolt in ioreg so I suppose it wont work.
I am OK with USB-C and good battery life for now.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@velaar @Colton-Ko @Porco-Rosso @noclee Can you guys please try my new EFI folder? I added a new TB3 hotplug patch that is functioning much smoother than before.

For my machine at least, TB3 hotplug now works with both Thunderbolt 3 ports. Fyi, if TB3 hotplug isn't working for you after updating the newest EFI folder, please try editing the SSDT-Z390-TB3HP.aml file with your appropriate TB3 controller path.

After one or two of you guys can verify that it is working, I will mark it as working on the repo.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

Quick update, after some extended testing, it seems that I arrived at the same problem before. Hotplugging on the ethernet-TB3 port works flawlessly. Though hotplugging on the TB3 power port only works if the machine was booted with the TB3 device attached.

It seems that this is as far as we can get without flashing the actual chip on the Thinkpad to use Apple's Thunderbolt firmware. If someone is willing to investigate, try, and document this, please check https://osy.gitbook.io/hac-mini-guide/details/thunderbolt-3-fix-part-3

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@tylernguyen

I still get higher power consumption and crash on AMDFramebuffer.kext on hotplug/coldplug of the GPU without Thunderbolt Bios Assist. So no luck for me here.

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

@tylernguyen your newest set of commits, as of 2f5361d have triggered some problems.
Not sure if I should split them over different issues, or just include them here. Let me know if you want seperate them.

  1. Hotplug of my USB-C dongle was working on both ports. Now only on the bottom one. If I plug in to the top both screens just go black. More worryingly, connecting my HDMI plug directly leads to two black screens as well... I need to force the laptop off, and reboot to get back to normal

  2. The Audio jack had a lot of noise and interference, at least the first time I rebooted with the new EFI. This included a worrying loud pop on my external speakers. Now it seems to be better, but will keep an eye out.

  3. Filevault previously required me to only enter my password once, now it must be entered twice. (Once with the high DPI loginscreen, and once with the scaled screen.)

  4. All function keys seem to be working well apart from F7 and F12, which need to be used in conjunction with the fn key to register any event in Karabiner-EventViewer.

I'd like to stay as closely in-sync with your EFI, so hoping we can resolve some of these.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@Porco-Rosso I cannot replicate these issues. Please reach out to me via Signal at (202)-644-9951. Hopefully, we can get them debugged.

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

Thanks for the help @tylernguyen 👍

For others reading this:

  • Setting AuthRestart to false in config.plist fixed the filevault issue.
  • Hotplug and HDMI issue was fixed by rebooting the laptop several times. It may be tied to the 15.10.4 update.
  • Similarly, audiojack issues were resolved with some reboots.
    It seems I jumped the gun with reporting these issues.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@Porco-Rosso
I investigated the audio a bit further, since it has been reported similarly before. See Issue #36. So I added ALCPlugFix patch to address this issue. Even if you don't have any audio issues, I recommend installing this patch anyway as it enables automatic audio switching between speaker/headphone upon plug/unplug.

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

@velaar I just acquired an external GPU (Core X) and an AMD card. Did you ever manage to get it to work on MacOS, with any configuration (hotplug, non-hotplug, TB-BIOS assist, additional kexts etc..)?
The card and egpu should be natively compatible with OSX, so I imagine this is related the the TB port issue. (Related, I get a ton of interference on the jack with the GPU connected, but I believe this is some grounding issue I need to investigate, regarding my speakers and eGPU)

@tylernguyen thanks for the patch. Automatic switching appears to be working. As I understand this is done in the OS and not EFI?

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@velaar I just acquired an external GPU (Core X) and an AMD card. Did you ever manage to get it to work on MacOS, with any configuration (hotplug, non-hotplug, TB-BIOS assist, additional kexts etc..)?
The card and egpu should be natively compatible with OSX, so I imagine this is related the the TB port issue. (Related, I get a ton of interference on the jack with the GPU connected, but I believe this is some grounding issue I need to investigate, regarding my speakers and eGPU)

OK. I have RX590 and Razer Core X as well. The only configuration that worked for me was to disable all TB3 related amls and Thunderbolt related kexts and enable Thunderbolt BIOS assist and pre-boot init off the thunderbolt devices, then cold-boot.

The result is that BIOS will allocate a PCI address for the video card and MacOS picks it up as internal. With TB3.aml (v1 ONLY) I'm able to force it to show up as external and it even allows me to unplug it without crashing. But no hotplug.

So far every single attempt to hot plug the GPU resulted in crash in AMDFramebuffer (see reports before).

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@tylernguyen
I see two avenues for continuing the research of the thunderbolt issue.

  1. I came across the attached AML (it depends on renaming _INI to XINI under RP09) I think the original credit goes to @osy86 (see legacy ASL's here: https://github.com/osy86/HaC-Mini/tree/master/ACPI). I didn't have a chance to test it, but it seems to be the most advanced TB3 implementation I've seen to date SSDT-TbtLegacy.aml.zip

  2. If me and @Porco-Rosso can get the proper debug log for whatever green/Lilu I think a custom init patch can be created. As MacOSX crashed on GPU init.

The current EFI folder doesn't work for me at all. With TB3 fixes enabled I get the AMD frame buffer crashes (same as above), without TB3 fixes I don't get GPU discovered in PCI even though it is initialized by BIOS.

The last working config:
OC.zip

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@velaar

I have tried that ACPI patch before but it did not seem to work.

My focus now is on trying to flash native macOS thunderbolt firmware onto the machine’s TB3 controller, as that would provide the most native experience.

I suspect that we have already reached the limit of what is possible using software only patches. Though someone may find something in the future?

Edit: I've just looked at the old EFI folder you posted.
IOElectrify is a very old kext that has not been updated for a very long time, and does not play well with Catalina. That's why I switched to a more recent TB3 driver package, ThunderboltReset.kext and TbtForcePower.efi

When I try IOElectrify on Catalina, it would give me random crashes when hotplugging with my Caldigit TB3 dock. And the problem stoppped once I moved to the new TB3 driver package. I'm still not exactly sure as to why IOElectrify worked for your eGPU hotplug and the new driver package doesn't. Both essentially do the same thing by forcing always on power to PNP0C14.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

An update on the issue, I confirmed that there's a BIOS mod working on the x1c6, see Issue #68
The unlocked Intel Advance Menu is giving us loads more options on configuring Thunderbolt behavior. I'm still exploring these options though I hope that this new discovery will improve TB3 hotplug behavior on this machine.

Some interesting options are:

Force power and force power on RP05

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@benbender
What's the correct way to determine TB3 companion ports on our machines? I think it should be a fairly universal implementation but I want to make sure regardless.

Edit: I suppose I could just turn off RTD3 in advance BIOS and then diff the ACPI.

Also, your second patch, _INI to XINI is renaming every instance instead of only the instance in PR09. This is is easier in Clover, but we can just apply @osy86 's method and find:
52503039 084C5452 5A00084F 42465A00 084C4D53 4C00084C 4E534C00 142A5F49 4E49
and replace 52503039 084C5452 5A00084F 42465A00 084C4D53 4C00084C 4E534C00 142A5849 4E49

This way it looks for PR09 and only rename _INI in that instance.

Edit: There's a cleaner option,

I just skipped the first 11 instances and only patched the 12th once, which is the one in PR09, so it only requires find 5F494E49 and replace 58494E49

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@tylernguyen
companion ports are those ports on different controllers who are connected to the same physical ports. Search for "UsbCompanionSS"/"UsbCompanionHS" in https://raw.githubusercontent.com/khronokernel/DarwinDumped/master/MacBookPro/MacBookPro14%2C1/IORegistry/IOReg.txt to see an example of a real macs config.

For the _INI-Rename: it patches �*_INI�pLTR9LTRZ to �*XINI�pLTR9LTRZ and is the method-sig from my ACPI-Dump (generated with "iasl -l ./DSDT.aml"). It shouldn't match every _ini-Method. It should be the same methodology as OSY86's and should be more reliable than counting - espacially with the open bios and dynamic ACPI-generation.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@benbender Hmm.. for some reason, that method isn't working for me. I'll stick for counting for now since it seem to break anything.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

Both methods are not stable at the end. If your binary-method-signature is different, it won't match. If you have different devices activated in BIOS, counting won't work in general. I didn't know that the binary-sig may differ :/

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

Ok, @velaar @Porco-Rosso and everyone else who have a TB3 device, and especially if you have an eGPU:

Could you please test the following advance TB3 settings:
Titan Ridge Workaround for OSUP Enabled
Thunderbolt PCIe Cache-line 128
Both force power options checked

Please try this with the old TB3 patch (Make sure to remove TbtForcePower.efi from config.plist). I can now reliably hotplug on the power port. One quirk it seems is that the EC is now very slow and updating things, so the laptop would be charging but wouldn't update its state for 1 minute or so.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@tylernguyen

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@tylernguyen

* maybe a recursion: https://github.com/the-darkvoid/XPS9360-macOS/blob/master/DSDT/SSDT-YTBT.dsl?

* helpful for debugging: https://github.com/al3xtjames/ThunderboltPkg/blob/master/Docs/SSDT-TDBG.dsl

I'll take a look at the YTBT and test it later.
As for as debugging, here are the output the last time I tried it.

 % log show --last boot --predicate 'process == "kernel" AND senderImagePath CONTAINS "AppleACPIPlatform"' --style compact | awk '/ACPI Debug/{getline; getline; print}'

2019-12-19 04:31:45.766 Df kernel[0:71] (AppleACPIPlatform) "SGOV(0x0000000002020015, 0x00000000FDAE04A8) called"
2019-12-19 04:31:45.767 Df kernel[0:71] (AppleACPIPlatform) "GPIO 0x0000000002020015 has MMIO address 0x00000000FDAE04A8"
2019-12-19 04:31:45.773 Df kernel[0:71] (AppleACPIPlatform) "Calling TBFP"
2019-12-19 04:31:45.773 Df kernel[0:71] (AppleACPIPlatform) "SGOV(0x0000000002020015, 0x00000000FDAE04A8) called"
2019-12-19 04:31:45.774 Df kernel[0:71] (AppleACPIPlatform) "GPIO 0x0000000002020015 has MMIO address 0x00000000FDAE04A8"
2019-12-19 04:31:45.815 Df kernel[0:76] (AppleACPIPlatform) "SGOV(0x0000000002020015, 0x00000000FDAE04A8) called"
2019-12-19 04:31:45.816 Df kernel[0:76] (AppleACPIPlatform) "GPIO 0x0000000002020015 has MMIO address 0x00000000FDAE04A8"

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@tylernguyen

I'll take a look at the YTBT and test it later.
As for as debugging, here are the output the last time I tried it.

That was a misunderstanding. This particular SSDT is just for getting PIN and Memory-Adress of the TB-Port. It was more like a hint to the general method. You can adapt it to any ACPI-method and get messages directly in syslog.

Btw. it's also useful for debugging vars. F.e. this way I checked H8DR, which is 1 für the T480 as _Rev (revision) = 2 per default...

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

For reference - the reference-implementation for kaby lake with helpful comments to decypher what the acpi is doing: https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/KabylakeOpenBoardPkg/Features/Tbt/AcpiTables/Tbt.asl

from x1c6-hackintosh.

Chivs avatar Chivs commented on May 26, 2024

As an FYI I've also been into the dark void that is ACPI patching over the last few days and took a look at this.

Start with the excellent Thunderbolt research on osy86 starting here https://osy.gitbook.io/hac-mini-guide/details/thunderbolt-3-fix

Couple of items stand out. There's a reference to patching the thunderbolt firmware to get native support in OSX. From what I can tell however, the only way to do this is via a TI chip used for additional USB-C ports on this NUC. The X1C6 just doesn't have this from what I can tell. So that would leave using the SPI programmer directly on the TB firmware chip, something I'm not willing to experiment with right now. I also believe this additional controller is what enables the companion ports.

I also noticed there's a F/W update for Thunderbolt on the Lenovo site, so I went ahead and flashed it under Windows as it referenced USB-C connectivity fixes. Here's the link:

https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x1-carbon-6th-gen-type-20kh-20kg/downloads/ds502615

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@notthebee

That's great! One question though, what about TB3 hotplug in Windows/Linux after the flash?

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@notthebee To the best of my knowledge TBT Bios assist uses a different firmware. (A different chip somewhere maybe?)
At some points while updating TBT firmware I even had different NVM versions in Bios and non-bios modes

Update: a full guide here

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

A comment though:

  • Hot-plugging TB3 should already be working on both ports with a custom modded BIOS to force power on PR03.
  • While it's nice that flashing the TB3 chip allows for native interfacing with macOS, it still requires that we disable BIOS Assist so it's not a complete solution just yet. In a perfect world, TB3 should hotplug without BIOS assist. Additionally, I believe that flashing the chip may come at the cost of hotplugging on other OS?

@notthebee
More testing should be done around BIOS assist. I can't really see myself recommending to flash the TB3 chip since it really doesn't provide additional functionalities other than the native macOS interfacing.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@tylernguyen
What about the proper GPU hot plug? Was it resolved with PR03?

from x1c6-hackintosh.

notthebee avatar notthebee commented on May 26, 2024

A comment though:

* Hot-plugging TB3 should already be working on both ports with a custom modded BIOS to force power on `PR03`.

* While it's nice that flashing the TB3 chip allows for native interfacing with macOS, it still requires that we disable BIOS Assist so it's not a complete solution just yet. In a perfect world, TB3 should hotplug without BIOS assist. Additionally, I believe that flashing the chip may come at the cost of hotplugging on other OS?

@notthebee
More testing should be done around BIOS assist. I can't really see myself recommending to flash the TB3 chip since it really doesn't provide additional functionalities other than the native macOS interfacing.

True, I mentioned that in my initial post as well. I will do some more testing, but for now there are some benefits to that method, according to the author:

  • Thunderbolt Ethernet Bridge and Target Disk Mode require this procedure.
  • Most eGPUs require this procedure.
  • QNAP Thunderbolt-based NAS units require this procedure
  • Other Thunderbolt-based storage and NAS systems may require this procedure as well.
  • This procedure may improve overall compatibility with a wider set of Thunderbolt devices.

EDIT:
Just tested the TB3 functionality in Linux, unfortunately by patching the firmware you lose the hotplug in other OSes. With that in mind it probably wouldn't be an option I'd recommend, unless your use case falls under one of the aforementioned categories. I reverted to the method documented in this repo on my machine.

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@tylernguyen
What about the proper GPU hot plug? Was it resolved with PR03?

Unfortunately, I don't have an eGPU so I cannot test it.

@notthebee

Just tested the TB3 functionality in Linux, unfortunately by patching the firmware you lose the hotplug in other OSes

Yeah, that's what I had suspected. I'll include the mod/flash as a niche option in this repo in case macOS is someone's only OS.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

I'm back at playing with my t480 a bit and tried to replicate the setup from this repo (without flashing the chip for now and minimal fixes in the advances bios menu).

From my understanding, reading https://github.com/osy86/HaC-Mini/blob/master/details/thunderbolt-3-fix-part-2.md, I need 4 things:

  1. Some way of ForcePower to the TB-Controller to get OSX to recognize it, because it's gated otherwise
  2. Reset the integrated Controller to allow OS X to handle the low level stuff in ACPI (like power management, whats what I'm most interested in)
  3. A working ACPI-implementation to handle those low-power stuff.
  4. Correct USBCompanionPort-config to get full power-management with RTD3.

1.) Can be achieved in 3 ways: via a) unlocked Advanced Menu in BIOS, b) TbtForcePower.efi by @al3xtjames or c) patched TB-Firmware. I'll go for b) for the moment to have the most unobtrusive way.

2.) Needs https://github.com/osy86/ThunderboltReset and at first, it didn't worked. Then I realized, that the Info.plist in the release-package is broken (osy/ThunderboltReset#7) and in this repo (ping @tylernguyen) and rebuild it from source and it worked.

3.) I used the ACPI for Z390-board from the ThunderboltReset-repo and a few patches and it seems to be workin. At least it says it gets further and talks in the logs :)

4.) I'm on it and try to figure it out.

While not having tb-equipment to really test, I have two questions/requests:

  1. How is the setup from this repo working, when the ICM isn't resetted because ThunderbotltReset is broken? Is it unnecessary to reset the ICM?
  2. Would someone with a working setup be kind and post some syslogs + screenshots of IOReg for a boot with and without a TB-device attached?

And, at last, a note for those with the unlocked bios:
For me I realized that the TB-Firmware is really an extra thing and won't get necessarily resetted when you reset the bios options to defaults. For me I had the case where the bios stated I was in "BIOS Assist"-mode and in fact were not. To be sure, reset the TB-settings double and with extra reboots (with those messages about not turning of the PC while reconfiguring Thunderbolt) to be sure

from x1c6-hackintosh.

Chivs avatar Chivs commented on May 26, 2024

4.) I'm on it and try to figure it out.

I've attached a couple of relevant ssdt's I'm using to map the companion ports and also have some edits on the TB ssdt. May help you.
As I'm using reflashed TB f/w, not sure if any logs would be useful, but lmk if you need any.

SSDT.zip

.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@Chivs At least on my T480 the hs03-port on the usb3-controller is the internal smartcard-reader. HS04/SS04 is clear to me, but the second port not so much.

If you have some time now and are interested, you could join https://gitter.im/YogaSMC/community and send me a private msg. I've ported the native TB-ACPI from a macbookpro14,1 and it seems to be working and I've now way to really test it :)

from x1c6-hackintosh.

EigenTom avatar EigenTom commented on May 26, 2024

Hi guys,
I was able to get fully working usb-c with hotplug support and good battery performance.
Cpu pkg cat get into sub 1W draw, and my usb-c dock is properly initialized even on first usb-c port (near the joint)

If interested, here you have my setup:
SSDT-TYPC.aml.zip

  • activate assisted mode of Thunderbolt3 in bios
  • disable IOElectrify.kext
  • disable all TB3 related .amls and add the one attached here

Let me know if it works.

EDIT:
ok, it doesnt work. I had luck for a few times but it is definitely not stable solution.
I am looking for USB-C hotplug without tb3 and with good battery life.
If anyone has an idea, please share.

thanks

Hi, I'm also seeking a method to enable full USB-C support while keep the TB3 controller from affecting battery life. I use X1 Yoga 3rd, which is quite identical to X1 Carbon 6th. I successfully adapted your patch, although it did not work at all. It doesn't work after sleep. before plugging in the USB-C device, min{CPU PKG} is about 0.8w, and it raise to 1.2w after one hotplug. What's more interesting is that before plugging the USB-C device, the USB-C controller cannot be seen either through System Information.app, or Hackintool.app, that fooled me into thinking it doesn't work at the beginning. What's the origin of this ACPI patch, and what exactly it had done when booting the laptop? Is it possible to modify it to make it work properly?

from x1c6-hackintosh.

EigenTom avatar EigenTom commented on May 26, 2024

@M82589933 From my actual knowledge, our problem is entirely about power management. Some observations/clearifications:

  1. The original(!) OSX TB-FW/HW has the abillity to independently switch off USB/TB-controllers if they have no connections on their respective ports. That's why port-configuration matters so much. ATM I don't think this is entirely possible to replicate with PC-style HW because we are missing specific GPIO-lines to power on/off the individual parts of the controller. They seem to be hardcoded and aren't even available to @osy86-build on an Intel NUC which is the best hack for TB by far.
  2. Therefore it doesn't seem possible to disable the TB-Controller while retaining USB 3.1 functionallity. Our best chance is to fix PM for the entire controller as best as possible. It could(!) be possible to get rtd3 power state for the TB-controller which should help much. Very few of the SSDT's shown here are even trying to do fix PM on the controller.
  3. TB-Assist takes PM over from the OS to the TB-Controllers FW and therefore helps with PM. The PM in this mode is independant of OSX but also renders the PM of OSX useless (besides basic PCI-PM). The problem is, that OSX expects the complete control in ACPI and disables the TB's ICM mostly. So many functions of OSX TB-stack will silently fail in this mode.
  4. There are at least two modes of operation for TB which should be distinguished.
    a) PCIE-paththrough were the TB-Controller acts as a simple PCIe2PCIe-bridge
    b) Full TB-mode where the TB-Controller manages the connection and does protocol handling. That seems to be neccessary for things like TB to TB-networking on macs and other advanced features. I don't think that this mode is possible/reachable with TB Bios assist.
  5. The TB-controller is an independent device with own FW and state. It isn't necessarily resetted on reboots (espacialy on warm reboots) and thats the reason of those reports about "it first worked and suddenly doesn't anymore"
  6. The states in which we force the TB-Controller with different hacks, patches, efis etc was never intended or tested by intel. So seems to be buggy and unstable at times. Which makes development and verification even more problematic.

One last thing: It is possible to have the tb-drivers load up completely without patched FW, ForcePower or any other hack. I'll post an SSDT if I'm done testing. The following screenshots are done with unpatched firmware and no additional tool/hack/patch besides one rename:

tb1 tb2

Further observations:

If I attach my iPad Pro through USB-C cable, The controller which will be powered on is displayed as "JHL6540 Thunderbolt 3 USB Controller" like the image below:

image

and I get about 1.2w CPU-Package when idle.

If I set "Thunderbolt 3 BIOS Assist Mode = Enable" in BIOS setting, and apply the USB mapping and TB3 hotpatch made by @CrazyPegasus , I will get the following result:

Screenshot 2020-08-22 at 09 42 19

and I get about 2.2w CPU-Package when idle.

It seems that the patch only power on the USB-C controller. However, in Hackintool-PCIe, it is clear that both TB3 controller and USB-C controller can be seen:
image

In conclusion, the power consumption and system info display of two states have notable differences. It seems that the TB3 controller either can be really "turned off" only to preserve the USB-C part, or the TB3 controller can be tuned into booting as a USB-C controller.

the kexts made by @CrazyPegasus is attached below. In theory, X1C6 can apply it with no error since there are so many similarities between X1Y3 and X1C6.
TB3Patch-Crazy.zip

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

a) Hackintool doesn't tell you anything about the power-state of the pci-devices. It's only highlighting the port which the usb-device is connected to (According to the USB-Mapping which OSX has - and could be wrong *g).

b) Because it's not clear to me: With which config do get those 1.2W and is it stable and reproduceable accross warm/cold-reboots?

from x1c6-hackintosh.

EigenTom avatar EigenTom commented on May 26, 2024

a) Hackintool doesn't tell you anything about the power-state of the pci-devices. It's only highlighting the port which the usb-device is connected to (According to the USB-Mapping which OSX has - and could be wrong *g).

b) Because it's not clear to me: With which config do get those 1.2W and is it stable and reproduceable accross warm/cold-reboots?

Apply all three kexts made by @CrazyPagesus, apply SSDT-TYPC.aml but set
“Thunderbolt 3 BIOS assist mode” to Disable ENABLE, then boot macOS.

image

The TB3 USB-C controller will not present until you plug in one USB-C
device.

Plug in one USB-C device then plug off. The minimum CPU Package Power consumption will be around 1.2W.

BTW: My laptop is BIOS Modded, which may affect the value. but you will see notable power consumption drop for around 1w comparing to the circumstance that you enable TB3 hotplug.

It seems that:

  1. CPU-PKG Power consumption with no TB3 controller or USB-C
    controller: 0.7w

  2. CPU + USB-C: 0.7+0.5 = 1.2w

  3. CPU + USB-C + TB3 = 0.7 + 0.5 + 1.0 = 2.2w

Preety interesting.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@M82589933 I think it's because of the following two lines:

                        "PCIHotplugCapable", 
                        One

I think it puts the TB-OSX-driver in the PCI2PCI-bridge-mode and disables them.

Would you be so kind changing both of the occurences of "One" to "Zero", cold-reboot (power off, wait ~10secs, power on) and report?

from x1c6-hackintosh.

EigenTom avatar EigenTom commented on May 26, 2024

@M82589933 I think it's because of the following two lines:

                        "PCIHotplugCapable", 
                        One

I think it puts the TB-OSX-driver in the PCI2PCI-bridge-mode and disables them.

Would you be so kind changing both of the occurences of "One" to "Zero", cold-reboot (power off, wait ~10secs, power on) and report?

The values you asked me to apply are located in X1 YOGA 3TH-thunderbolt 6540_crazy.aml .

To achieve 7h+ battery life, I turned “Thunderbolt 3 BIOS Assist Mode” ON at the very begining of my entire OC setup. In this setting, that ACPI patch simply don’t work. I think that patch is irrelevant to the cause of my findings. My only wish is achieving full USB-C support, while keep TB3 hotplug remain unable, since enabling the hotplug will cause continuous CPU C-Storm and cut battery life half, which is unacceptable for me.

In my machine, changing the status of “Thunderbolt 3 BIOS Assist Mode” sometimes can corrupt NvRam, and led both of the systems (macOS, Windows 10) unable to boot until reset BIOS settings to default and set the modded BIOS all over again, which is quite annoying. even if I change the BIOS setting, I do not have TB3 devices to test whether the hotpatch feature is functional or not.

Currently I can not find any difference between applying the new TB3.aml and the old one. I will continue to observe the difference in power consumption.

I have another question: Is it possible to enable ASPM on most of the PCI-e devices to reduce power consumption? if possible, do you know how to modify them?

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

Sorry, but no I'm confused. Here:

Apply all three kexts made by @CrazyPagesus, apply SSDT-TYPC.aml but set
“Thunderbolt 3 BIOS assist mode” to Disable, then boot macOS.

you stated that you achieved 0,7W with Bios assist disabled and now you need it to be turned on? Please clearify. My only point was to clearify how you achieved such a low power-usage without proper ACPI-PM for TB and TB Bios assist off. If you have it enabled, the answer is simple: because the controller does the PM.

ASPM isn't the topic here, but in short: no. ASPM needs support on the client-device and there is no point in forcing it when there is no support.

from x1c6-hackintosh.

EigenTom avatar EigenTom commented on May 26, 2024

Sorry, but no I'm confused. Here:

Apply all three kexts made by @CrazyPagesus, apply SSDT-TYPC.aml but set
“Thunderbolt 3 BIOS assist mode” to Disable, then boot macOS.

you stated that you achieved 0,7W with Bios assist disabled and now you need it to be turned on? Please clearify. My only point was to clearify how you achieved such a low power-usage without proper ACPI-PM for TB and TB Bios assist off. If you have it enabled, the answer is simple: because the controller does the PM.

ASPM isn't the topic here, but in short: no. ASPM needs support on the client-device and there is no point in forcing it when there is no support.

Sorry, I made a mistake. BIOS Assist Mode must be enabled to get 0.7w when idle. Already corrected the comment.

This time:

  • All 3 amls made by @CrazyPegasus loaded
    *SSDT-TYPC.aml loaded
  • Rename “One ==>Zero” in TB3.aml
  • BIOS ASSIST MODE OFF

The CPU PKG Power consumption when idle ranges between 1.83-2.30w.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

Okay. As expected and normal. Btw, you don't need those three SSDT's. A proper USB-Inject generated with Hackintool will do the job just fine.

from x1c6-hackintosh.

EigenTom avatar EigenTom commented on May 26, 2024

Okay. As expected and normal. Btw, you don't need those three SSDT's. A proper USB-Inject generated with Hackintool will do the job just fine.

You mean enabling USB-C hotplug with proper power consumption?

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

Yes. It shouldn't do anything besides port-mapping anyway. Just check by leaving the TB-SSDT out. Shouldn't make any difference (besides the renames in IOReg).

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@benbender I noticed the ThunderboltReset.kext issue. Thanks for letting me know. I'll update it on the next repo.

from x1c6-hackintosh.

CrazyPegasus avatar CrazyPegasus commented on May 26, 2024

In fact, if we don’t use lightning equipment and just want to use type-c, we can add ssdt-thbt to start, then use hackintool to customize type-c into ssdt-uiac, and then remove ssdt-thbt。

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@CrazyPegasus what does ssdt-thbt for you that would be needed for the hackintool-port-customization?

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

Back in my home town and started experimenting with TBT. It seems that I can't initialize the GPU as it is not shown as Tunnel Capable (when hot plug). TBT Bios Assist ON (with disabled SSDT/Kext/Efi) obviously works but she some unknown reason I now get freezes every 45-50 minutes or so. Looks like a frame buffer crash as the system is still reachable remotely.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@benbender @tylernguyen Can you confirm that you have no thunderbolt freezes on your devices? Also will it be possible to share the screenshots/camera shots of your thunderbolt settings in the advanced menu?

from x1c6-hackintosh.

tylernguyen avatar tylernguyen commented on May 26, 2024

@velaar I do not have my x1c6 on me at the moment. Hence why there hasn't been much update. I can take a look into the issue in about 1-2 weeks once I return.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@tylernguyen thank you!

Just wanted to document where I am at the moment with hot-plug:

Reflashed bios again, to make sure, that there are no 'stuck' settings.
All advanced settings set as per repo instructions.

image

image

in kernel log:


2020-09-19 12:12:43.581505-0400 0xd11a     Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) void IOAccelFenceMachine::fence_timeout(IOTimerEventSource *): AMDRadeonAccelerator prodding blockFenceInterrupt
(repeated)
2020-09-19 12:12:48.987315-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDRadeonX4000HWLibs) AMD Cail: [10:0:0] GPU HangState 0x000001f0, HangFlags 0x00000007: IndividualEngineHang 1, NonEngineBlockHang 1, FenceNotRetired 1, PerEngineReset 0, FullAsicReset 1
2020-09-19 12:12:48.987317-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDRadeonX4000HWLibs) [10:0:0] GPU HangState 0x000001f0, HangFlags 0x00000007: IndividualEngineHang 1, NonEngineBlockHang 1, FenceNotRetired 1, PerEngineReset 0, FullAsicReset 1
2020-09-19 12:12:48.988156-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.988244-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.988340-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.988547-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.988649-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.988744-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.988836-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.988944-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.989031-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.989118-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.989227-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.989420-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.989510-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.989599-0400 0x9b8      Fault       0x0                  0      0    kernel: (IOAcceleratorFamily2) virtual sIOAccelEvent *IOAccelFIFOChannel2::getFirstPendingEvent(): All are finished
2020-09-19 12:12:48.993425-0400 0x9b8      Default     0x0                  0      0    kernel: (IOAcceleratorFamily2) Trying to restart GPU (Radeon RX 590)...
2020-09-19 12:12:48.993706-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) AMD Recovery Display. enabled:1
2020-09-19 12:12:48.994879-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x490..
2020-09-19 12:12:48.994880-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:48.996021-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x6e70..
2020-09-19 12:12:48.996023-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:48.997095-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x7670..
2020-09-19 12:12:48.997097-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:48.998234-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x7e70..
2020-09-19 12:12:48.998235-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:48.999338-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x10670..
2020-09-19 12:12:48.999340-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:49.000404-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x10e70..
2020-09-19 12:12:49.000406-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:49.001505-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x6cc8..
2020-09-19 12:12:49.001507-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:49.002650-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x6cd4..
2020-09-19 12:12:49.002652-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:49.003718-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x6cc8..
2020-09-19 12:12:49.003720-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:49.004857-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x6ccc..
2020-09-19 12:12:49.004858-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:49.005994-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x6cc8..
2020-09-19 12:12:49.005995-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!
2020-09-19 12:12:49.007130-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) --> [10:0:0] !!! Failed to read register 0x6cd4..
2020-09-19 12:12:49.007132-0400 0x9b8      Default     0x0                  0      0    kernel: (AMDSupport) FATAL ERROR : ATIController failed to access PCI device [10:0:0]!

@benbender any idea why it would hang the GPU in the early init?

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@velaar I'm on vacation right now and don't have my gear here, but I would guess that you have problems with the PCI-enumeration. On OSX the enumeration is done in ACPI and not in the ICM/firmware of the TB-controller. Try the config from here: https://hackindrom.zapto.org/. It's also missing most of the hot-plug/enumeration stuff from OSX but has a working DROM for your Notebook and the working structure. If you report back, please include a dump/screenshot from IOReg of the TB-Controller and a log of "log show --last boot|grep -i Thunderbolt"

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@benbender
So the result is actually identical to the previous attempts. No errors in the log. The GPU and sound detected properly but GPU driver is not installed, nor attempted

Thunderbolt section of the log:

> sudo log show --last boot|grep -i Thunderbolt
2020-09-23 11:00:01.586714-0400 0x2db      Default     0x0                  137    0    fud: (MobileAccessoryUpdater) No need to create item for plugin:com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService filter:com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch - (storage already exists.  Not an error)
2020-09-23 11:00:01.590584-0400 0x2db      Default     0x0                  137    0    fud: (MobileAccessoryUpdater) No need to create item for plugin:com.apple.MobileAccessoryUpdater.USBCAccessoryUpdaterService filter:com.apple.mau.plugin.usbcupdater.ThunderboltType1Switch - (storage already exists.  Not an error)
2020-09-23 11:00:01.590607-0400 0x2db      Default     0x0                  137    0    fud: (MobileAccessoryUpdater) No need to create item for plugin:com.apple.MobileAccessoryUpdater.USBCAccessoryUpdaterService filter:com.apple.mau.plugin.usbcupdater.ThunderboltType2Switch - (storage already exists.  Not an error)

Somewhere around boot time I found:

2020-09-23 10:59:28.946352-0400 0x472      Default     0x0                  0      0    kernel: (AppleIntelKBLGraphicsFramebuffer) [IGFB][INFO   ] [AGDC] Get link config
2020-09-23 10:59:28.946393-0400 0x472      Error       0x0                  254    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Attempting to get capabilities from capabilities with no devices
2020-09-23 10:59:28.946435-0400 0x472      Default     0x0                  254    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [WARN] - Created FB 3 of 3
2020-09-23 10:59:28.951017-0400 0x472      Default     0x0                  254    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [WARN] - GPU: FB: 3 of 3 opened
AppleIntelFramebuffer = 3
Can't get value for key 'AMDFramebuffer'
IOFramebufferUserClient = 3

This is ioreg:
IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP09@1D
image

So it looks like it 'sees' the GPU but won't attach a kext to it for some reason.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@velaar For "native" OSX-Thunderbolt, the ICM (integrated connection manager) must be disabled on boot, the PCI-enumeration must be initiated by the apple-Kexts (to do so, "forcepower" is used) and, you need the proper ACPI-Devicetree + Methods and a proper DROM-config with valid checksums and your cardconfig in it. That would be native and (afaik) the only way to get proper, native eGPU-Support.

You seem to be failing on ICM or PCIe-enumeration because the controller is clearly not correctly initialized in OSX. You are missing the TBSwitch and everything below. See the shot by me posted earlier:
https://user-images.githubusercontent.com/462455/90976769-1323c380-e540-11ea-8b22-1627f231bcdd.png

Problem though is, that the pc-firmware isn't designed to disable the ICM like apple's FW does and the cards may become quite instable while poking around. So be sure to do cold(!)-boot between tests and see if there are changes on boot in the log.

The other ways described here mostly are leaving the ICM enabled and let the controller handle the PCIe-enumeration and init. Thats basically just an external, PCIe-hotplug-port and OSX knows nothing about TB in this config (that's basically what bios-assist does).

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

I wish I could run it with Bios Assist ON, I don't really need hot-plug that much. But on current repo even with ICM enabled I get a random frame buffer freeze (~30-40min in)

Can I ask you to have a look at config? Maybe I enabled conflicting options. Or can you post your config + relevant AML's/Kexts?

I did 7-8 cold boots (even some with disconnecting the battery) and IOREG did not change.
Here are logs with debug=0x100

2020-09-23 14:05:31.913748-0400 0x10a      Default     0x0                  0      0    kernel: (ThunderboltReset) ThunderboltWait: patch not ready yet, delaying thread
2020-09-23 14:05:32.915208-0400 0x10a      Default     0x0                  0      0    kernel: (ThunderboltReset) ThunderboltWait: patch completed, returning
2020-09-23 14:05:32.915307-0400 0x10a      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) AppleThunderboltGenericHAL::probe
2020-09-23 14:05:32.915315-0400 0x10a      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) 20875555us AppleThunderboltGenericHAL::probe
2020-09-23 14:05:32.915393-0400 0x10a      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) AppleThunderboltGenericHAL::start
2020-09-23 14:05:32.915400-0400 0x10a      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) 20875642us AppleThunderboltGenericHAL::start
2020-09-23 14:05:32.916163-0400 0x1a9      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) Thunderbolt runtime power conservation disabled.
2020-09-23 14:05:32.916168-0400 0x1a9      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) Thunderbolt runtime power conservation disabled.
2020-09-23 14:05:32.916368-0400 0x1a9      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) Thunderbolt 255 PCI - LS=0x7043 LC=0x0040 SS=0x0040 SC=0x0008 PMCSR=0x0000 RT=0xffffffff NLRT=0xffffffff LWRT=0xffffffff PRRT=0xffffffff TRT=0x0000 TNLRT=0x0000 TLWRT=0x0000 TPRRT=0x0000 TLUP=0x0001
2020-09-23 14:05:32.916381-0400 0x1a9      Default     0x0                  0      0    kernel: (AppleThunderboltNHI) Thunderbolt 255 PCI - LS=0x7043 LC=0x0040 SS=0x0040 SC=0x0008 PMCSR=0x0000 RT=0xffffffff NLRT=0xffffffff LWRT=0xffffffff PRRT=0xffffffff TRT=0x0000 TNLRT=0x0000 TLWRT=0x0000 TPRRT=0x0000 TLUP=0x0001
2020-09-23 14:06:04.865031-0400 0x2f1      Default     0x0                  137    0    fud: (MobileAccessoryUpdater) No need to create item for plugin:com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService filter:com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch - (storage already exists.  Not an error)
2020-09-23 14:06:04.869927-0400 0x2f1      Default     0x0                  137    0    fud: (MobileAccessoryUpdater) No need to create item for plugin:com.apple.MobileAccessoryUpdater.USBCAccessoryUpdaterService filter:com.apple.mau.plugin.usbcupdater.ThunderboltType1Switch - (storage already exists.  Not an error)
2020-09-23 14:06:04.869959-0400 0x2f1      Default     0x0                  137    0    fud: (MobileAccessoryUpdater) No need to create item for plugin:com.apple.MobileAccessoryUpdater.USBCAccessoryUpdaterService filter:com.apple.mau.plugin.usbcupdater.ThunderboltType2Switch - (storage already exists.  Not an error)

also here is a log from the moment of plugging in the gpu (|grep -I AMD -B 100 -A 100)


2020-09-23 14:14:37.477676-0400 0x5dba     Default     0x0                  0      0    kernel: (AppleGraphicsPowerManagement) [AGPM][INFO ][CONTROLLER  ][createAGPMClass         ] machines_dict->getObject(modelName MacBookPro14,1)
2020-09-23 14:14:37.477683-0400 0x5dba     Default     0x0                  0      0    kernel: (AppleGraphicsPowerManagement) [AGPM][INFO ][CONTROLLER  ][createAGPMClass         ] gpuDict display
2020-09-23 14:14:37.477685-0400 0x5dba     Default     0x0                  0      0    kernel: (AppleGraphicsPowerManagement) [AGPM][INFO ][CONTROLLER  ][createAGPMClass         ] build gpuDict by GPU display.
2020-09-23 14:14:37.477687-0400 0x5dba     Default     0x0                  0      0    kernel: (AppleGraphicsPowerManagement) [AGPM][WARN ][CONTROLLER  ][createAGPMClass         ] GPU = display unknownPlatform (no matching vendor_id+device_id or GPU name); don't create AGPM class
2020-09-23 14:14:37.477698-0400 0x5dba     Default     0x0                  0      0    kernel: (AppleGraphicsPowerManagement) [AGPM][INFO ][CONTROLLER  ][start                   ] fIsExternalGPU 1
2020-09-23 14:14:37.477738-0400 0x5dba     Default     0x0                  0      0    kernel: (AppleGraphicsPowerManagement) [AGPM][INFO ][CONTROLLER  ][start                   ] GPU = display Initialized, Control ID 17
2020-09-23 14:14:37.478592-0400 0x5dba     Default     0x0                  0      0    kernel: PMRD: setSleepSupported(1)
2020-09-23 14:14:37.478596-0400 0x5dba     Default     0x0                  0      0    kernel: (IOGraphicsFamily) GTrace synchronization point c6
2020-09-23 14:14:37.478658-0400 0x74       Default     0x0                  0      0    kernel: PMRD: Avoiding delayChildNotification on object 0x100000866. flags: 0x200
2020-09-23 14:14:37.479482-0400 0x5dba     Default     0x0                  0      0    kernel: PMRD: setSleepSupported(1)
2020-09-23 14:14:37.479485-0400 0x5dba     Default     0x0                  0      0    kernel: (IOGraphicsFamily) GTrace synchronization point c7
2020-09-23 14:14:37.479512-0400 0x74       Default     0x0                  0      0    kernel: PMRD: Avoiding delayChildNotification on object 0x10000086c. flags: 0x200
2020-09-23 14:14:37.480386-0400 0x5dba     Default     0x0                  0      0    kernel: PMRD: setSleepSupported(1)
2020-09-23 14:14:37.480392-0400 0x5dba     Default     0x0                  0      0    kernel: (IOGraphicsFamily) GTrace synchronization point c8
2020-09-23 14:14:37.480451-0400 0x74       Default     0x0                  0      0    kernel: PMRD: Avoiding delayChildNotification on object 0x100000872. flags: 0x200
2020-09-23 14:14:37.481978-0400 0x5dba     Default     0x0                  0      0    kernel: PMRD: setSleepSupported(1)
2020-09-23 14:14:37.481991-0400 0x5dba     Default     0x0                  0      0    kernel: (IOGraphicsFamily) GTrace synchronization point c9
2020-09-23 14:14:37.482091-0400 0x74       Default     0x0                  0      0    kernel: PMRD: Avoiding delayChildNotification on object 0x100000878. flags: 0x200
2020-09-23 14:14:37.483478-0400 0x5dba     Default     0x0                  0      0    kernel: PMRD: setSleepSupported(1)
2020-09-23 14:14:37.483488-0400 0x5dba     Default     0x0                  0      0    kernel: (IOGraphicsFamily) GTrace synchronization point ca
2020-09-23 14:14:37.483579-0400 0x74       Default     0x0                  0      0    kernel: PMRD: Avoiding delayChildNotification on object 0x10000087e. flags: 0x200
2020-09-23 14:14:37.485932-0400 0x5dc9     Default     0x0                  0      0    kernel: (AppleGraphicsDevicePolicy) Adding AGDP mode validate property
2020-09-23 14:14:37.544799-0400 0x74       Default     0x0                  0      0    kernel: PMRD: clamshell closed 0, disabled 0, desktopMode 0, ac 1 sleepDisabled 1
2020-09-23 14:14:37.545011-0400 0x341      Default     0x0                  192    0    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=0
2020-09-23 14:14:37.544812-0400 0x74       Default     0x0                  0      0    kernel: PMRD: clamshell closed 0, disabled 0, desktopMode 0, ac 1 sleepDisabled 1
2020-09-23 14:14:37.550971-0400 0x5dba     Default     0x0                  0      0    kernel: (AMDSupport) Accelerator successfully registered with controller.
2020-09-23 14:14:37.553701-0400 0x5c80     Default     0x0                  0      0    kernel: (Sandbox) Sandbox: 1 duplicate report for bluetoothd deny(1) mach-lookup com.apple.server.bluetooth
2020-09-23 14:14:37.553714-0400 0x5c80     Error       0x0                  0      0    kernel: (Sandbox) Sandbox: com.apple.WebKit(702) deny(1) iokit-get-properties Thunderbolt Path
2020-09-23 14:14:37.554465-0400 0x2dc      Default     0x0                  165    0    displaypolicyd: (GPUWrangler) [com.apple.GPUWrangler:default] event type=unknown (0x10000003) gpuId=0x7037 (ku)
2020-09-23 14:14:37.555604-0400 0x2dc      Default     0x0                  165    0    displaypolicyd: (GPUWrangler) [com.apple.GPUWrangler:default] gpu 0x7037 flags 0x1f800002 (XG,unsupported,driversStarted,hasGPUC,pubSched,pubArmed,bit23) vid.did=1002.67df b:d:f=69:0:0 (tunneled)
gpu 0x7037        pci 0x100000841 IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP09@1D/IOPP/UPSB@0/IOPP/DSB1@1/IOPP/UPS0@0/IOPP/pci-bridge@1/IOPP/display@0
gpu 0x7037       agdc 0x100000884
gpu 0x7037       gpuc 0x10000084e
gpu 0x7037 agdpclient 0x100000886
gpu 0x7037      accel 0x000000000
2020-09-23 14:14:37.555930-0400 0x6f       Default     0x0                  0      0    kernel: IOResources: bad busy count (0,-1)

Backtrace 0xffffff80009fffa6 0xffffff8000a2bcde 0xffffff8000a02f94 0xffffff8000a0d487 0xffffff80002c013e 0x0 0x0
2020-09-23 14:14:37.555990-0400 0x6f       Default     0x0                  0      0    kernel: IOResources: bad busy count (0,-1)

Backtrace 0xffffff80009fffa6 0xffffff8000a2bcde 0xffffff8000a02f94 0xffffff8000a0d487 0xffffff80002c013e 0x0 0x0
2020-09-23 14:14:37.556004-0400 0x6f       Default     0x0                  0      0    kernel: MacBookPro14,1: bad busy count (0,-1)

Backtrace 0xffffff80009fffa6 0xffffff8000a2bcde 0xffffff8000a02f94 0xffffff8000a0d487 0xffffff80002c013e 0x0 0x0
2020-09-23 14:14:37.556028-0400 0x6f       Default     0x0                  0      0    kernel: (AMDSupport) Accelerator successfully unregist ered with controller.
2020-09-23 14:14:37.558713-0400 0x4d65     Default     0x0                  540    0    SafeEjectGPUService: (SafeEjectGPU) Device Added [0000000100000853] AMD Radeon RX 590
2020-09-23 14:14:37.559304-0400 0x4d65     Default     0x0                  540    0    SafeEjectGPUService: (SafeEjectGPU) Device Removed [0000000100000853] AMD Radeon RX 590
2020-09-23 14:14:37.562449-0400 0x6f       Default     0x0                  0      0    kernel: MacBookPro14,1: bad busy count (0,-1)

Backtrace 0xffffff80009fffa6 0xffffff8000a2bcde 0xffffff8000a02f94 0xffffff8000a0d487 0xffffff80002c013e 0x0 0x0

config copy.plist.zip

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

Please upload the SSDT you are currently using. And I'll try to have a brief look. I'm not at home atm and don't have my system here. (But wouldn't have a stable working config anyway - I was quite sure to have the parts together, but the instabilities are not quite fun and I put it aside for the moment because of a work-project which needed my attention)

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

The logs were taken with:
SSDT-TB-HackinDROM.aml.zip

Also tested (the one from this repo):
SSDT-Z390-TB3HP.aml.zip

No worries! We are all on working on it together. Please take your time, I'm way less knowledgable in SSDT/BIOS programming so not sure if I can push it much further. But can definitely do all sorts of testing and reporting.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

You are on X1C6, unflashed TB-Controller and unflashed BIOS? If yes, try the first SSDT + thunderboltreset.kext + tbforcepwr.efi from here https://github.com/al3xtjames/ThunderboltPkg and post your logs. The SSDT isn't complete (missing at least hotplugging-stuff), but I think the controller's pcie-enum is the actual problem atm.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

Flashed BIOS and unfalshed controller. so efi should'n be necessary. Cant flash the controller as need windows cold or hot support.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

For full osx-compatible thunderbolt, the ACPI is mandatory. The acpi-methods are what the OSX-drivers are using. So if you want to achive full, native eGPU support in OSX, there is no way around a (nearly) full ACPI implementation of the ACPI-parts from OSX. For those have a look at the implementation here: https://github.com/osy86/HaC-Mini

PS: if you flash your TB-controller, the ICM is disabled on boot. That's the reason why windows fails. That should be fixable via ACPI, but may also lead to instabilities. Its kinda tricky... :/

For OSX, you need:

  • ICM disabled (Done by apples FW)
  • Controller got OSUP-command to be visible to the OS
  • PCIe-enumeration on boot to enable the driver hierachy
  • ACPI-implementation to interface with the drivers

For Windows, you need:

  • ICM enabled (Reenabled on OSX-Boot in ACPI on OSX via GPIO)
  • Controller got OSUP
  • WMI-Interface in ACPI to interface with the drivers

You see, the conditions are quite different. Additionally TB can operate in different modes like as a simple PCIe-bridge or full TB-interface. On top of that, external hardware interfaces on different levels with the driver/controller. F.e. some apple-specific hw seems to interface directly with the ACPI-interface bypassing the drivers. And for it to work in full extend you need complete working enumeration, power-management, sleep and wake on the whole tree of devices & drivers. So its a quite complex and cluttered topic because of the "special" way of apples implementation.

from x1c6-hackintosh.

EigenTom avatar EigenTom commented on May 26, 2024

@CrazyPegasus what does ssdt-thbt for you that would be needed for the hackintool-port-customization?

Any SSDT which define and expose TB3 controller to the OS, like SSDT-Z390-TB3HP.aml is fine.

However, I encountered a problem. After using Hackintool to map the USB port, only one port can achieve USB3.1 SuperSpeed, while the other stuck at 480Mbps (USB2.0) no matter which kind of cable I use. (I use TB3 20Gbps 1m cable + iPad Pro 2018 for testing), even if activating SSDT-USBC.aml, the problem remain the same.

Another strange observation is, after mapping the USB port + SSDT-USBC.aml, the CPU Pkg Power Consumption can never drop back to 0.7-0.8W idle after a proper sleep. I've been confused by this symptom for a month, still have no clue though.

For PCI-e ASPM: By adding key: "pci-aspm-default" with value 1/2/3 to the PCI-E device in config.plist, we can achieve L0/L1/L0s+L1 ASPM state for the corresponding PCI-E device. This significantly improved battery life. Now my X1 Yoga 3rd can achieve 9h of battery usage. (reported by iStat Menus).

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

EDIT: Just to clearify because it seems to be confusing to some - USB-C refers only to the shape of the plug. It's like USB-A or USB-B. It doesn't say anything about speed or protocol used over that connection.

USB-C is not Thunderbolt or vice versa. Thunderbolt 3 only uses USB-C-plugs. So please be specific to avoid misunderstandings.


I've gone further with my dissection of the topic and can explain some bits:

Any SSDT which define and expose TB3 controller to the OS, like SSDT-Z390-TB3HP.aml is fine.

That's false. As stated above, there are many bits and peaces involved and in fact to get perfect tb, they have to match exactly (firmware, bios, initialization, ssdt, drom...). Btw, what do you mean by "expose" in this context?

However, I encountered a problem. After using Hackintool to map the USB port, only one port can achieve USB3.1 SuperSpeed, while the other stuck at 480Mbps (USB2.0) no matter which kind of cable I use. (I use TB3 20Gbps 1m cable + iPad Pro 2018 for testing), even if activating SSDT-USBC.aml, the problem remain the same.

More info needed to debug this. But in Fact there are 4 "virtual ports" on one usb-c-port with thunderbolt (Usb 2.0 aka low speed / Usb 3.0 aka high speed / Usb 3.1 aka super speed and Thunderbolt). Only 3 of them (the usb ones) can be mapped with Hackintool/USBMap. Would need to see IOReg, SSDTs, usb mappings and know the Bios settings to get a clou about the problem.

Another strange observation is, after mapping the USB port + SSDT-USBC.aml, the CPU Pkg Power Consumption can never drop back to 0.7-0.8W idle after a proper sleep. I've been confused by this symptom for a month, still have no clue though.

Thats because you powered the controller up but don't have the necessary pieces to let OSX do power management for the controller. The TB-controller uses at least ~0.8W alone powered on.

For PCI-e ASPM: By adding key: "pci-aspm-default" with value 1/2/3 to the PCI-E device in config.plist, we can achieve L0/L1/L0s+L1 ASPM state for the corresponding PCI-E device. This significantly improved battery life. Now my X1 Yoga 3rd can achieve 9h of battery usage. (reported by iStat Menus).

Thats also not true. Putting deviceprops somewhere makes only a difference in hackintool because it reads those. Real ASPM needs device/bios support. You are seeing a placebo here :)

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@velaar can you confirm a much longer time to get to the lenovo-logo right after powering up the machine with patched TB-FW?

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@benbender I never patched the TB. I still need windows functionality. I can try it if needed, but until we have some solution like this:

ICM enabled (Reenabled on OSX-Boot in ACPI on OSX via GPIO)

I can't commit.

Also, do you have an idea how DGPU options in advanced menu work? there are specific options for AMD and/or Nvidia DGPUs under thunderbolt (can make screenshots if needed)

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@velaar I might need to reflash the TB-controller, but wanted to confirm my issue beforehand. If you could try, it would be appreciated. Developing ACPI-patches with that delay is a PITA...

about the DGPU-Options in BIOS: I'm not quite sure what you are referring to.

But for complete eGPU-support via TB you are missing the TB-switch and the actual ports with their drivers under. I would guess that your Thunderbolt-pane in Systeminfo is empty, right? You are running in PCIe-bridge-mode I guess which doesn't support eGPUs completely afaik. If I'm guessing correct: You are basically running PCIe-hotplug and not Thunderbolt.

I'm working on porting the acpi-patches from Osy86 over and it seems promising so far. Having PM on OSX with TB-initialization working. But my problem is the boot delay, absence of test hardware ATM and time...

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

IMG_3195D
IMG_3196D
IMG_3197D
Those options seem interesting and I found little to no documentation about them. Can play and try to see what is happening but not sure how to trace changes.

. I would guess that your Thunderbolt-pane in Systeminfo is empty, right?

That is correct.

I'm working on porting the acpi-patches from Osy86 over and it seems promising so far. Having PM on OSX with TB-initialization working. But my problem is the boot delay, absence of test hardware ATM and time...

That's impressive! I wonder if there is a way to get you some TB hardware, I might contribute a bit for it. Is boot delay associated with TB BIOS flashing?

Time is an issue for both of us, unfortunately. I wonder if @notthebee experienced the delay. I can try refreshing mine over the weekend.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

For the screenshots: No, I don't think so. You could set "Force Pwr" to on and the "PCIe cache lines to 128" but I don't really know if that helps. As I said, your TB-drivers in OS X are not correctly loaded because the card is not visible and in a state that OS X expects.

For the delay: it might be a problem with checksums or the reinitialization which is done when you change between "bios assist" on/off runs on every boot. @Chivs also has this problem but we both aren't sure in which state the bios was before the flash.

For the help: Very much appreciated. The problem is that you would need several devices to test properly. At least a eGPU (or similar PCIe-device), some TB-Apple-HW (as they are doing some fancy stuff on TB-level as far as I know) and TB-Monitor etc. I think I'll get at least the Lenovo TB-dock as it has many ports to test with.

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@benbender
Planning to refresh it this weekend. Would you suggest to refresh it with TBT bios assist On or Off?

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

CaseyJ, the creator of the patch, states clearly "off". Please report back afterwards! :)

from x1c6-hackintosh.

velaar avatar velaar commented on May 26, 2024

@benbender I can confirm the delay is present. I have ensured that assist was off before the procedure (and multiple reboots too)

So this is with a plugged in eGPU on a reflashed controller:

image

This is what we lose when GPU is unplugged:
image

The GPU is not visible by the system and with a plugged in eGPU this is what I see in thunderbolt:

image

However is I un[plug the GPU and refresh:

image

Let me know if there is anything else I can test.
I'm using SSDT from here

This is the log of GPU plug-in (grep Thunderbolt)

2020-10-09 20:02:32.735116-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltSwitch<0x0>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 1 unplug = 0
2020-10-09 20:02:32.735583-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltSwitch<0x0>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 2 unplug = 0
2020-10-09 20:02:32.849393-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltSwitch<0x0>(0x1)::listenerCallback - Thunderbolt HPD packet for route = 0x1 port = 9 unplug = 0
2020-10-09 20:02:32.860871-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltSwitch<0x0>(0x1)::listenerCallback - Thunderbolt HPD packet for route = 0x1 port = 2 unplug = 0
2020-10-09 20:02:32.872446-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltSwitch<0x0>(0x1)::listenerCallback - Thunderbolt HPD packet for route = 0x1 port = 10 unplug = 0
2020-10-09 20:02:33.328880-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltController::configReadDWord - ERROR: synchronous call on workloop thread.
2020-10-09 20:02:33.328884-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltController::configReadDWord - ERROR: synchronous call on workloop thread.
2020-10-09 20:02:33.328889-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltSwitch<0x0>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 2 unplug = 1
2020-10-09 20:02:33.332684-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltController::configReadDWord - ERROR: synchronous call on workloop thread.
2020-10-09 20:02:33.332696-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltController::configReadDWord - ERROR: synchronous call on workloop thread.
2020-10-09 20:02:33.332713-0400 0x116      Default     0x0                  0      0    kernel: (IOThunderboltFamily) IOThunderboltSwitch<0x0>(0x1)::listenerCallback - Thunderbolt HPD packet for route = 0x1 port = 2 unplug = 1
2020-10-09 20:02:33.412082-0400 0x4b22     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) Stream event happened for filter: com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch
2020-10-09 20:02:33.413521-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) -[FudStateMachine isActive]: state=1 nextState=-1 filter=com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch
2020-10-09 20:02:33.413547-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) -[FudIpcDispatch dispatchStateMachineEvent:] - filter name: com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch - exclusion group - com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch
2020-10-09 20:02:33.413583-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) ExclusionGroupFilter: com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch (com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch)
2020-10-09 20:02:33.416297-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) Creating new state machine for event: FudEvent - Client:(null) Type:114 Filter:com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch Data:<dictionary: 0x7fa19a6112f0> { count = 4, transaction: 1, voucher = 0x7fa19a611270, contents =
	"PluginIdentifier" => <string: 0x7fa19a4304d0> { length = 67, contents = "com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService" }
	"XPCEventName" => <string: 0x7fa19a7511e0> { length = 66, contents = "com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch" }
2020-10-09 20:02:33.417707-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) StateMachine Dealloc pluginName=com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService filterName=com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch
2020-10-09 20:02:33.417855-0400 0x4b24     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) Disabiling stream events for device class: com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService
2020-10-09 20:02:33.437126-0400 0x4b28     Default     0x0                  1226   0    ThunderboltAccessoryUpdaterService: (MobileAccessoryUpdater) Initializing Plugin ThunderboltAccessoryFirmwareUpdater for DeviceClass com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch
2020-10-09 20:02:33.439159-0400 0x4b28     Default     0x0                  1226   0    ThunderboltAccessoryUpdaterService: (MobileAccessoryUpdater) -[ThunderboltAccessoryFirmwareUpdater initWithDeviceClass:delegate:info:options:]:
 deviceClass=com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch
2020-10-09 20:02:33.441031-0400 0x4b28     Default     0x0                  1226   0    ThunderboltAccessoryUpdaterService: (MobileAccessoryUpdater) -[ThunderboltAccessoryFirmwareUpdater bootstrapWithOptions:] - success = 1
2020-10-09 20:02:33.441094-0400 0x4b28     Default     0x0                  1226   0    ThunderboltAccessoryUpdaterService: (MobileAccessoryUpdater) com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch bootstrap was successful
2020-10-09 20:02:33.441517-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) FudIPCDispatch: stepComplete():  plugin:com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService status:1 info={
2020-10-09 20:02:33.442670-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) Enabling stream events for suspended device class: com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch
2020-10-09 20:02:33.442833-0400 0x4b24     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) ExclusionGroupFilter: com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch (com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch)
2020-10-09 20:02:33.442986-0400 0x4b24     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) Modal Default Client - Got device attach event for com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch updateInProgress=0 queue[0]=(
2020-10-09 20:02:33.446600-0400 0x4b28     Default     0x0                  1226   0    ThunderboltAccessoryUpdaterService: (MobileAccessoryUpdater) Error reading plist: No file(s) to support platform: (null)
2020-10-09 20:02:33.446836-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) -[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: find was not successful: Error Domain=com.apple.MobileAccessoryUpdater.StateMachine Code=7 "-[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: Unspecified error from plugin" UserInfo={PluginName=com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService, NSLocalizedDescription=-[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: Unspecified error from plugin, DeviceClassName=com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch}
2020-10-09 20:02:33.447163-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) <com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch[20995] 0x7fa19a714070>: XPC connection invalidated
2020-10-09 20:02:33.447181-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) <com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch[20995] 0x7fa19a714070>: XPC disconnected during unknown state: -1
2020-10-09 20:02:33.447227-0400 0x4b24     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) FudIPCDispatch: stepComplete():  plugin:com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService status:0 info={
2020-10-09 20:02:33.447263-0400 0x4b28     Default     0x0                  1226   0    ThunderboltAccessoryUpdaterService: (MobileAccessoryUpdater) XPC connection invalidated
2020-10-09 20:02:33.448267-0400 0x4b24     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) -[FudStateMachine performNextStepWithOptions:]: uncleared exception (Error Domain=com.apple.MobileAccessoryUpdater.StateMachine Code=7 "-[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: Unspecified error from plugin" UserInfo={PluginName=com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService, NSLocalizedDescription=-[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: Unspecified error from plugin, DeviceClassName=com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch})
2020-10-09 20:02:33.448400-0400 0x4b23     Default     0x0                  1225   0    fud: (MobileAccessoryUpdater) Modal Default Client - completed step:Find device:com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch successful:NO next-step:End silentUpdate=0 error:Error Domain=com.apple.MobileAccessoryUpdater.StateMachine Code=7 "-[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: Unspecified error from plugin" UserInfo={PluginName=com.apple.MobileAccessoryUpdater.ThunderboltAccessoryUpdaterService, NSLocalizedDescription=-[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: Unspecified error from plugin, DeviceClassName=com.apple.MobileAsset.MobileAccessoryUpdate.ThunderboltType3Switch}

The eGPU is not operational (should be obvious from IOREG)

Update: playing with kexts didn't really help. Adding Thunderbolt Unblocker didn't do anything either
Update2: tried SSDTs from @benbender repo (experimental branch). Same results.

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@velaar interesting. Could you join https://gitter.im/YogaSMC/community and give me a ping in a PM. Would love to do some testing with you if you are interested :)

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@velaar we have pm - but it crashes on wake (probably on the pcie-enumeration in ACPI and needs more debugging) ;)

from x1c6-hackintosh.

lubixxx96 avatar lubixxx96 commented on May 26, 2024

The progress with TB hot plug you guys made is awesome.
But I was wandering. I do not need TB, I do not own any TB devices, but I use USB-C dock.
Is there any way how to disable the TB but keep the USB-C alive with hotplug and good battery?

Thanks!

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

@lubixxx96 thats the last missing piece atm. I can get usb 3.2 10Gbit/s to work while loosing PM and the other way around. So the answer is: not yet. Sorry!

from x1c6-hackintosh.

Porco-Rosso avatar Porco-Rosso commented on May 26, 2024

I'm curious what are you using to flash the TB firmware? Do I just need an adaptor for the BIOS dumper?
Also does the flash kill functionality under windows?

from x1c6-hackintosh.

benbender avatar benbender commented on May 26, 2024

Hey @Porco-Rosso,

I'm curious what are you using to flash the TB firmware? Do I just need an adaptor for the BIOS dumper?

I'm not quite sure what you are referencing, but you need a CH431a-programmer like this: https://www.win-raid.com/t4287f16-GUIDE-The-Beginners-Guide-to-Using-a-CH-A-SPI-Programmer-Flasher-With-Pictures.html

It works for the BIOS and TB-chip.

Also does the flash kill functionality under windows?

This question isn't simple to be answered. You need the right combination of FW, settings & state in the TB-controller to make the TB-controller work perfectly in either OS. So if you simply flash it, you will loose functionality in Windows, yes. It may be doable to regain windows-functionality with a flashed TB-BIOS but I didn't looked into it yet.

from x1c6-hackintosh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.