Jump to content

IOUSBFamily 10.8.4 Slice+AnV with full AppleUSBXHCI support for any USB3 chip (V12)

USB USB3 USB2 SleepFixed AppleUSBXHCI AppleUSBEHCI AppleUSBOHCI IOUSBFamily

  • Please log in to reply
95 replies to this topic

#41
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,630 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Sorry but apianti is not finished the revolution. Don't use 2010. Last working revision is 1999.

I think I am able to do this in driver.
I don't know about some keys in Info.plist introduced by AnV. May be they help?

Yes it should be possible to unload the UIM, and reinitialize the UIM.
On some USB controllers this doesn't work however and I did put in a Force... key in AppleUSBXHCI's Info.plist.
When this key is set, it won't do regular sleep, it unloads the controller when sleeping and loads the controller back after sleep.
One problem: when a disk is mounted it will say it was badly unmounted.
So for these controllers it needs more work.

#42
Mirone

Mirone

    InsanelyMac Deity

  • Local Moderators
  • 1,825 posts
  • Gender:Male
  • Location:Brazil

@Andy

Some progress towards
chips Asmedia 1042?
 
All the best!!


#43
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,021 posts
  • Gender:Male
  • Location:Moscow

Yes it should be possible to unload the UIM, and reinitialize the UIM.
On some USB controllers this doesn't work however and I did put in a Force... key in AppleUSBXHCI's Info.plist.
When this key is set, it won't do regular sleep, it unloads the controller when sleeping and loads the controller back after sleep.
One problem: when a disk is mounted it will say it was badly unmounted.
So for these controllers it needs more work.

Yes, Andy. As my controller is PCIe it probably can't sleep so I correct my Info.plist to have

SleepFix=NO

NoSleepForce=Yes

 

Additionally I made many declarations into my SSDT for XHCI according to the guide. This is the result  

 

And I made new correction to HCSelect and Muxed support to be non-acpi method, I used Pci methods configRead...

 

Victory!!!

The driver works at full speed after sleep/wake.

 

For those who doesn't know yet:

I have 4-ports USB3.0 PCIe controller "Orient VA-3U4PE" with chip VIA VL800-Q8

DeviceID=0x3432 VendorID=0x1106 Revision=3

 

PS. Why I can't upload files here?



#44
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,630 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Yes, Andy. As my controller is PCIe it probably can't sleep so I correct my Info.plist to have
SleepFix=NO
NoSleepForce=Yes

Additionally I made many declarations into my SSDT for XHCI according to the guide. This is the result

And I made new correction to HCSelect and Muxed support to be non-acpi method, I used Pci methods configRead...

Victory!!!
The driver works at full speed after sleep/wake.

For those who doesn't know yet:
I have 4-ports USB3.0 PCIe controller "Orient VA-3U4PE" with chip VIA VL800-Q8
DeviceID=0x3432 VendorID=0x1106 Revision=3

PS. Why I can't upload files here?

Cool.
If it works right we should share it with everybody.
If you would share the diff we could compile it and modify the first post.
Great work on the mux methods.
I look forward to test it on my Intel Panther Point I have... :D

#45
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,021 posts
  • Gender:Male
  • Location:Moscow

My files

Attached File  SSDT-10.aml.zip   490bytes   31 downloads

Attached File  IOUSBFamily-560.4.2-Sl11.diff.zip   190.41KB   16 downloads

Attached File  AppleUSBXHCI.kext.zip   111.64KB   21 downloads

 

All is fine now. Just cold start is slow with messages

USBF:	91.305	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	98.308	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	112.314	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	119.316	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	133.323	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	140.325	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	154.330	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1

After 8 restarts all work.



#46
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,630 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

My files

attachicon.gifSSDT-10.aml.zip

attachicon.gifIOUSBFamily-560.4.2-Sl11.diff.zip

attachicon.gifAppleUSBXHCI.kext.zip

 

All is fine now. Just cold start is slow with messages

USBF:	91.305	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	98.308	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	112.314	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	119.316	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	133.323	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	140.325	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1
USBF:	154.330	AppleUSBXHCI[0xffffff80fbee4000]::RestartStreams - called on non streams endpoint 1, 1

After 8 restarts all work.

Just took a look to the new HCSelect and IsPortMuxed methods.

I like them.

Looks like it checks if the port is attached to an EHCI or XHCI controller rather than doing ACPI lookup.

This has to be really efficient.

Gonna build and upload full IOUSBFamily for everybody this evening as I'm not home right now.

I also have the chance to test it on Intel Panther Point myself (as I have one of these).

Really great work :D

EDIT: You are right... my uploads fail too...

Odd...



#47
doof

doof

    InsanelyMac Protégé

  • Members
  • PipPip
  • 50 posts

560.4 works well for me on p8p67 pro. GenericUSB3 didn't pick up the second hub.



#48
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,630 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

The new version with our combined work is available from the first post.

Also the new diff to build it...

 

@Slice: Thanks, I'll test it now on my Intel Panther Point (muxing).

Ow... I just saw that with your diff sleep support is disabled by default and sleep is forced off...

Just uploaded version of AppeUSBXHCI.kext with PM re-enabled below... ;)

EDIT3: V12: Default is now sleep enabled... also in patch...

 

EDIT: @Slice: just tested.

No USB2 device functions on Intel Panther Point and the power state keeps in LOW mode.

So on Intel Panther Point controllers we need original IOUSBFamily.kext with only AppleUSBXHCI, AppleUSBOHCI, AppleUSBUHCI and AppleUSBEHCI replaced.

Otherwise also always low power state... see below:

EDIT2: Hmm... still no go... seems to be the power parameters... gonna fix them...

EDIT3: Ok, gonna test new version (V12).

This should fix the USB3 problems on Intel Panther Point.

I modded the default current in AppleUSBXHCI and removed the added errata from IOUSBController's errata (seems not to work right)...

EDIT4: Aaargh! what's wrong with this picture... still LOW POWER even with no device plugged... very frustrating...

No... no go on Intel Panther Point decently... reverted to V9...

The device keeps getting stuck on LOW POWER, even with no device plugged in...

EDIT5: Ok... now I've got it to work installed only new AppleUSB*HCI kexts with original IOUSBFamily, unplugged everything, complete shutdown after clearing caches and boot again.

Now it works but it still complains about power when I plug in a USB2 device.

If I unplug it, it works again...

EDIT6: No succes with HSUserClient, see .ioreg file (XHC1).

If I plug in a USB2 device (like my USB2 stick), it switched the status to ON however: it keeps on making new HSUserClients and never mounts the device.

USB3 HD works however...

EDIT7: With V9, if I plug in a USB2 device into USB3 port, it works and auto attaches on the correct EHCI port within seconds...

Did something change to the mux methods in AppleUSBXHCI? They don't seem to work right for Intel Panther Point  on V11/V12...

So for now, if you have Intel Panther Point, use V9... we need to sift this out...

@Slice, could you please check?

Second uploaded pic is with V9 (USB2 Flash Memory plugged into USB3 port and muxed on EHCI hub)...

It attached on EHC1 properly...

IOReg file with proper function is the second...

Attached Files



#49
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,021 posts
  • Gender:Male
  • Location:Moscow

Ya, strange.

I see LOW POWER too but stick is working.

Then I press "Eject" and power becomes "ON". Error is in the USBProber?

Related messages

Sep  4 23:21:58.423  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMRootHubStatusChange got bitmap (0x20)
Sep  4 23:21:58.423  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(+) now (1)
Sep  4 23:21:58.423  [3]	AppleUSBXHCI[0xffffff80fbee4000]::GetRootHubPortStatus port: 5, portSC: 0x0e001203, status: 0x0203, change: 0x0000, portIsDebouncing: 0
Sep  4 23:21:58.459  [3]	AppleUSBHub[0xffffff803d00c000]::HubAreAllPortsDisconnectedOrSuspended - port 4 still initing, status changing, or adding a device (0/1/0)
Sep  4 23:21:58.524  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(+) now (2)
Sep  4 23:21:58.524  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(-) now (1)
Sep  4 23:21:58.524  [3]	AppleUSBHub[0xffffff803d00c000]::DecrementOutstandingIO(363), outstandingIO(0), _interruptReadPending(false) - rearming read
Sep  4 23:21:58.524  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMCreateInterruptTransfer - root hub interrupt transfer - clearing unneeded memDesc (0xffffff803d01f500) from dmaCommand (0xffffff803ce4e780)
Sep  4 23:21:58.525  [3]	AppleUSBXHCI[0xffffff80fbee4000]::GetRootHubPortStatus port: 5, portSC: 0x0e201203, status: 0x0203, change: 0x0010, portIsDebouncing: 0
Sep  4 23:21:58.525  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(-) now (0)
Sep  4 23:21:58.556  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMRootHubStatusChange got bitmap (0x20)
Sep  4 23:21:58.556  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(+) now (1)
Sep  4 23:21:58.589  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMRootHubStatusChange got bitmap (0x20)



#50
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,630 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...


Ya, strange.
I see LOW POWER too but stick is working.
Then I press "Eject" and power becomes "ON". Error is in the USBProber?
Related messages

Sep  4 23:21:58.423  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMRootHubStatusChange got bitmap (0x20)
Sep  4 23:21:58.423  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(+) now (1)
Sep  4 23:21:58.423  [3]	AppleUSBXHCI[0xffffff80fbee4000]::GetRootHubPortStatus port: 5, portSC: 0x0e001203, status: 0x0203, change: 0x0000, portIsDebouncing: 0
Sep  4 23:21:58.459  [3]	AppleUSBHub[0xffffff803d00c000]::HubAreAllPortsDisconnectedOrSuspended - port 4 still initing, status changing, or adding a device (0/1/0)
Sep  4 23:21:58.524  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(+) now (2)
Sep  4 23:21:58.524  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(-) now (1)
Sep  4 23:21:58.524  [3]	AppleUSBHub[0xffffff803d00c000]::DecrementOutstandingIO(363), outstandingIO(0), _interruptReadPending(false) - rearming read
Sep  4 23:21:58.524  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMCreateInterruptTransfer - root hub interrupt transfer - clearing unneeded memDesc (0xffffff803d01f500) from dmaCommand (0xffffff803ce4e780)
Sep  4 23:21:58.525  [3]	AppleUSBXHCI[0xffffff80fbee4000]::GetRootHubPortStatus port: 5, portSC: 0x0e201203, status: 0x0203, change: 0x0010, portIsDebouncing: 0
Sep  4 23:21:58.525  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(-) now (0)
Sep  4 23:21:58.556  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMRootHubStatusChange got bitmap (0x20)
Sep  4 23:21:58.556  [3]	AppleUSBHub[0xffffff803d00c000]::ChangeRaisedPowerState(+) now (1)
Sep  4 23:21:58.589  [3]	AppleUSBXHCI[0xffffff80fbee4000]::UIMRootHubStatusChange got bitmap (0x20)

Gonna add a option like GenericUSBXHCI has.
Not to use PPT muxing with an option in Info.plist.
I think on Intel panther point it gets lost between controllers.
Going to test it this evening.

#51
Mirone

Mirone

    InsanelyMac Deity

  • Local Moderators
  • 1,825 posts
  • Gender:Male
  • Location:Brazil
Tested version 12.
Still not working for my Asmedia1042.


#52
Waldimor

Waldimor

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts

Not working with my Gigabyte Z77X-UD3H, I tried the latest v12 for intel.

All USB 3.0 Ports are not working after sleep, I'm so sad. :(

 

4x USB 3.0 Ports on the back are Via VL800 and 2x are from Intel.

 

Andy, do you have any idea how I can get them to work after sleep?

Could someone please post a working .kext file for the via vl800?



#53
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,021 posts
  • Gender:Male
  • Location:Moscow

Andy,

Is the kext you uploaded is "deployment" or "logging"? It may be a reason for non-working.



#54
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,630 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Andy,

Is the kext you uploaded is "deployment" or "logging"? It may be a reason for non-working.

That could be it.

I should still modify the option for Panther Point multiplexing (on / off) but I forgot to build the logging version instead of the deployment one.

Thanks for reminding me.

When I find some time I'll mod it some more (I've been quite busy with Apple firmware dumping and extracting, etc... also with UEFI BIOS modding)



#55
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,021 posts
  • Gender:Male
  • Location:Moscow

I also want to propose this procedure instead of vanilla

void AppleUSBXHCI::PrintInterrupter(int __unused level, int IRQ, const char * __unused s)
{
  long unsigned int IMAN, IMOD, ERDP;
                                                      //at IRQ = 0
  IMAN = Read32Reg(&_pXHCIRuntimeReg->IR[IRQ].IMAN);  // = 2
  IMOD = Read32Reg(&_pXHCIRuntimeReg->IR[IRQ].IMOD);  // = a0
  ERDP = Read64Reg(&_pXHCIRuntimeReg->IR[IRQ].ERDP);  // = 7c002300
                   
	USBLog(level, "AppleUSBXHCI[%p]::PrintInterrupter %s IRQ:%d - IMAN: %08lx IMOD: %08lx ERDP: %08lx", this, s, IRQ,
		   IMAN, IMOD, ERDP);
}

There will be warning "unused values" when compiled to deployment but I am lazy to correct this.



#56
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,630 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

I also want to propose this procedure instead of vanilla

void AppleUSBXHCI::PrintInterrupter(int __unused level, int IRQ, const char * __unused s)
{
  long unsigned int IMAN, IMOD, ERDP;
                                                      //at IRQ = 0
  IMAN = Read32Reg(&_pXHCIRuntimeReg->IR[IRQ].IMAN);  // = 2
  IMOD = Read32Reg(&_pXHCIRuntimeReg->IR[IRQ].IMOD);  // = a0
  ERDP = Read64Reg(&_pXHCIRuntimeReg->IR[IRQ].ERDP);  // = 7c002300
                   
	USBLog(level, "AppleUSBXHCI[%p]::PrintInterrupter %s IRQ:%d - IMAN: %08lx IMOD: %08lx ERDP: %08lx", this, s, IRQ,
		   IMAN, IMOD, ERDP);
}

There will be warning "unused values" when compiled to deployment but I am lazy to correct this.

Sure, I'll implement it when I make the mods.

Will probably be wednesday as I'm quite busy at the moment.

Thanks for the new print interrupter code.



#57
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,021 posts
  • Gender:Male
  • Location:Moscow
Works like a charm (deployment)
Attached File  IOUSBFamily.kext-v11-final.zip   778.78KB   63 downloads
First init is fast. Then I went to sleep with a stick inserted. After wake it said that the disk was ejected improperly but after 1 second the message disappear and the USB Volume is mounted.
All is fine!

#58
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,278 posts
  • Gender:Male
I just tried slice's build, and this one fails upon resume (just like all the others so far). Actually it fails worse in that the disk is force ejected immediately (and doesn't come back automatically as in slice's test). This seems to simply be due to NoSleepForced being set to true and SleepFix being set false. I flipped the logic on these two (like it was in prior builds) and then the failure is just as before, where there is a setPowerState() timeout after about 90 seconds followed by forced eject a minute or so later.

Dumb question -
Is slice's v11 or the v12 mentioned in earlier posts supposed to be the latest version?

I thought this fix was going to be easy so I didn't really look into the driver source until now. I just took a peek at the linux driver, and all they had to do to support the Etron & Asrock usb3 chips was set two quirk flags (XHCI_RESET_ON_RESUME and XHCI_TRUST_TX_LENGTH). Looks like you've implemented the first quirk but not the second.

Any plans to work on this for etron& asrock chips?

#59
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,021 posts
  • Gender:Male
  • Location:Moscow

I can work with hardware that I have to test or may be with a good tester that quickly show me kernel.log with debug version.

But why you not implement this features by yourself? Show your diff and Andy will add it to the topic.

 

About versions 11 and 12 I think sources in the topic are exactly the same as I compiled. Last my changes was in post 55.

Last my compilation was "IOUSBFamily (deployment) build for archiving". XCode 4.6.3 in OSX 10.8.4. I have private headers in System folder obtained after XNU compilation but I am not sure it influenced on something.



#60
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,278 posts
  • Gender:Male

I can work with hardware that I have to test or may be with a good tester that quickly show me kernel.log with debug version.

Yes, I tested like 8 versions already; and provided kernel logs in earlier posts here. I'm running out of time at this point to test; the system is back in "production" use of sorts already actually. Have to leave the system powered on 24x7 because of this issue unfortunately.

But why you not implement this features by yourself? Show your diff and Andy will add it to the topic.

I certainly could, but I thought Andy was on this, after all he made the thread whose purpose seemed to be to support such mainstream & common usb3 chips. That is why I've been asking if he plans to support this. I might get to it myself in a few weeks (or months). Any longer than that then I'll probably never get around to it as I'll have too many newer systems to use with intel usb3 instead.

This will be a great project, obsoleting the other usb3 driver choices if resume from sleep fully worked.





Also tagged with one or more of these keywords: USB, USB3, USB2, SleepFixed, AppleUSBXHCI, AppleUSBEHCI, AppleUSBOHCI, IOUSBFamily


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy