I decided to mod the latest IOUSBFamily sources.
I modified AppleUSBEHCI for sleep and legacy support.
I modifiied AppleUSBOHCI and AppleUSBUHCI for sleep support.
I modified AppleUSBXHCI for all XHCI controllers supported and now also for sleep support.
I added the Slice errata fix list for IOUSBFamily.
Please test and report back, I'm sure you'll like it.
Source is included in diff form.
I also built USB prober my own way to debug the USB3 parts.
EDIT: One more fix applied: Sleep fix for USB3... V2...
EDIT2: Little change, it didn't work right so I used the original IOUSBFamily with only AppleUSBXHCI, AppleUSBEHCI, AppleUSBOHCI and AppleUSBUHCI kext plugins replaced.
This one works right, just tested...
EDIT3: I implemented controller reset and USB bus restart on wake.
I also changed it to 1 primary interrupter (can be set to 2 interrupters in the Info.plist).
You can set the interrupter type to MSI or legacy (can be set in the Info.plist).
All options are toggeable in the Info.plist of AppleUSBXHCI.
If somebody could test this with the controllers, especially sleep...
EDIT4: I changed the sleep code so it uses the reset option not to save the state of the USB3 registers.
In this case it will not restore them but just reinitialize the USB3 on wake.
I also changed the sleep code to not save and restore the second interrupter in case UseSingleInt is set (little fix).
EDIT5: New version with new PM support.
I modified some of the power management code from GenericUSBXHCI in order to work with AppleUSBXHCI.
The result is SRE support and fixed sleep for all USB3 cards.
There is still the option to use the standard sleep code by setting ResetControllerFix to false (/ NO)...
Thus now we have several Info.plist options for AppleUSBXHCI:
ResetControllerFix = Use new sleep code (default: YES)
SleepFix = Set PM card always builtin and allow sleep (default: YES)
UseSingleInt = Use single interrupter instead of 2 (default: YES)
UseLegacyInt = Use legacy interrupts for cards that aren't by default in the errata list (default: NO)
EDIT6: Some more modifications.
Improved PM code some more, now sets the property for controller reset in case of the new NoSleepForced is set to YES, otherwise value for controller reset will be NO.
Added Info.plist option for forcing sleep to unsupported (for controller unload).
The NoSleepForced key in the Info.plist controls this... (default: NO)
Added USB3 legacy support (and BIOS ownership taking).
EDIT7: More mods but this time to AppleUSBEHCI, AppleUSBOHCI and AppleUSBUHCI.
Sleep fix made and applied for AppleUSBUHCI.kext
Sleep support improved for AppleUSBOHCI and AppleUSBEHCI
Now deep sleep with PCI power management works for the OHCI and EHCI controllers.
EDIT8: More fixes to errata and option to always force legacy interrupts (even on Intel / etc...)
UseLegacyInt in the Info.plist controls this.
Some minor bug fixes...
EDIT9: New diff. (V10 patch)
This version can build a mostly working IOUSBFamily.
2 issues remain.
- HandleLinkState only crudely implemented (but seems to work)
- IsPortMuxed is implemented but the underlying ACPI method doesn't work yet (don't know for which ACPI method to check, etc)
EDIT10: Add AppleUSBXHCI from Slice and update the diff with the one made by Slice
A lot of thanks go to Slice for improving the driver (e.g. better check for multiplexed controller, etc...)
I did some more compile fixes as needed on my machine.
The IOUSBFamily is now also built with clang 4.1 (Apple LLVM compiler 4.1)
Again, big thx to Slice for the new fixes.
It's full custom IOUSBFamily so it should work optimized...
EDIT11: V12: Removed errata for Intel Panther Point from IOUSBController's errata and upped the current to Intel Panther Point standards in AppleUSBXHCI...
EDIT12: V12 for Intel... mostly works still power issues with USB2 devices on USB3...