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
96 replies to this topic

#21
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

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

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)

 

Somebody with a non-standard recognized USB3 controller, could you test the sleep and report back please?

I also added Doze support for Intel Panther Point.

On my card the new sleep code works fine so I'm curious for the other chipsets.

 

 

EDIT: 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).

Latest version is thus V7.

Please test and report back (I need feedback).



#22
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

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

Just did a little test on the legacy fix by turning on USB3 legacy support and by copying 2 large ISO files to my Medion Drive-N-Go USB3 HD.

I captured it in quicktime and added it to Youtube...

 

 

It really goes super fast now.

Also tested the new PM.

Now the devices plugged into the USB3 port will be suspended completely (power off and on wake back on and recover).


New version V8:

 

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.



#23
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

Hi Andy, I tried your v5 and v8 versions with my  ej168 usb3.  v5 failed just like earlier versions with the  setPowerState() timeout message and the disk ejecting 1 minute later.

v8 had the same timeout message, but adds 1 more error and then I don't see the disk eject.  So it seems to work; but are those errors expected at this point?  With v8 (no Info.plist changes):

Aug 29 18:13:04 hostname kernel[0]: Wake reason: PXSX (Network)
Aug 29 18:14:45 hostname kernel[0]: IOUSBMassStorageClass::setPowerState(0xffffff8011365000, 0 -> 1) timed out after 101437 ms
Aug 29 18:15:13 hostname kernel[0]: USBF: 193.703 The USB Family found a device at  port 1 of hub @ 0xfc800000 with a bad USB device descriptor (0x300011203000112, 0x300011203000112 )


#24
Mirone

Mirone

    InsanelyMac Deity

  • Local Moderators
  • 2,049 posts
  • Gender:Male
  • Location:Brazil
Now works for my chip Asmedia1042.
 
Great job Andy!  :thumbsup_anim:
Edit: unfortunately I was wrong I had a Genericxhci installed
still not working. :(


#25
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

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

 

Now works for my chip Asmedia1042.
 
Great job Andy!  :thumbsup_anim:
Edit: unfortunately I was wrong I had a Genericxhci installed
still not working. :(

 

Try V9 which I've just uploaded.

It has support for any asmedia chip... (errata present)

 

 

Hi Andy, I tried your v5 and v8 versions with my  ej168 usb3.  v5 failed just like earlier versions with the  setPowerState() timeout message and the disk ejecting 1 minute later.

v8 had the same timeout message, but adds 1 more error and then I don't see the disk eject.  So it seems to work; but are those errors expected at this point?  With v8 (no Info.plist changes):

Aug 29 18:13:04 hostname kernel[0]: Wake reason: PXSX (Network)
Aug 29 18:14:45 hostname kernel[0]: IOUSBMassStorageClass::setPowerState(0xffffff8011365000, 0 -> 1) timed out after 101437 ms
Aug 29 18:15:13 hostname kernel[0]: USBF: 193.703 The USB Family found a device at  port 1 of hub @ 0xfc800000 with a bad USB device descriptor (0x300011203000112, 0x300011203000112 )

The second is the reenumeration of the USB port...

I added this to be able to recover from these errors.

So the powerstate fails and next the USB3 driver does exactly what it should: recover from the problem (which is a start).

The second is part of AppleUSBHub

			// No error, but let's validate the bMaxPacketSize0
			if ( (_desc.bMaxPacketSize0 < 8) ||  (_desc.bMaxPacketSize0 > 64 ) )
			{
				// The USB descriptor is not right.  Don't even retry
				USBError(1, "The USB Family found a device at  port %d of hub @ 0x%x with a bad USB device descriptor (0x%qx, 0x%qx )", (uint32_t)_portNum, (uint32_t)_hub->_locationID, * (uint64_t *)(&_desc), * (uint64_t *)(&_desc.idVendor));
				USBTrace( kUSBTHubPort,  kTPHubPortGetDevZeroDescriptorWithRetries, (uintptr_t)this, _portNum, _hub->_locationID, 6 );
				retries = 0;
				err = kIOReturnDeviceError;
				break;
			}
			

I think the new version will fix this, test it please ;)

 

As for ASM1042: I noticed in GenericUSBXHCI that it uses 32bit registers instead of 64bit ones.

This will need more work...



#26
radargb

radargb

    InsanelyMac Protégé

  • Members
  • PipPip
  • 63 posts
  • Gender:Male
  • Location:Krakow, Poland

Hey! 

Just tried new version and still no success.

 

Can only boot in safe mode.

 

Getting these on boot:

30.08.2013 09:02:08,000 kernel[0]: USBF: 1.702 Attempting to get EHCI Controller from BIOS
30.08.2013 09:02:08,000 kernel[0]: USBF: 1.707 USBLEGCTLSTS value 0xe0000000
30.08.2013 09:02:08,000 kernel[0]: USBF: 1.711 acquireOSOwnership done - value 0x1000001
30.08.2013 09:02:08,000 kernel[0]: USBF: 1.722 AppleUSBEHCI[0xffffff8008517000]::CheckSleepCapability - forced ON
30.08.2013 09:02:08,000 kernel[0]: USBF: 1.804 Attempting to get EHCI Controller from BIOS
30.08.2013 09:02:08,000 kernel[0]: USBF: 1.809 USBLEGCTLSTS value 0xe0000000
30.08.2013 09:02:08,000 kernel[0]: USBF: 1.813 acquireOSOwnership done - value 0x1000001
30.08.2013 09:02:08,000 kernel[0]: USBF: 1.824 AppleUSBEHCI[0xffffff800897e000]::CheckSleepCapability - forced ON
30.08.2013 09:02:08,000 kernel[0]: HWSensors Project Copyright 2013 netkas, slice, usr-sse2, kozlek, navi, THe KiNG, RehabMan. All rights reserved.
30.08.2013 09:02:08,000 kernel[0]: FakeSMCDevice: 15 preconfigured keys added
30.08.2013 09:02:08,000 kernel[0]: FakeSMCDevice: 5 keys exported by Clover EFI
30.08.2013 09:02:08,000 kernel[0]: SMC: successfully initialized
30.08.2013 09:02:08,000 kernel[0]: CPUSensors: CPU family 0x6, model 0x2a, stepping 0x7, cores 2, threads 4, TJmax 100
30.08.2013 09:02:08,000 kernel[0]: CPUSensors: setting platform to k62
30.08.2013 09:02:08,000 kernel[0]: SuperIODevice: [Fatal] found unsupported ship ID=0xffff
30.08.2013 09:02:08,000 kernel[0]: PTIDSensors: started
30.08.2013 09:02:08,000 kernel[0]: mbinit: done [96 MB total pool size, (64/32) split]
30.08.2013 09:02:08,000 kernel[0]: Pthread support ABORTS when sync kernel primitives misused
30.08.2013 09:02:08,000 kernel[0]: USBF: 2. 43 AppleUSBXHCI[0xffffff80c7de8000]::CheckSleepCapability - forced ON

Any clues?



#27
giacomoleopardo

giacomoleopardo

    InsanelyMac Protégé

  • Members
  • PipPip
  • 63 posts
  • Gender:Male

As for ASM1042: I noticed in GenericUSBXHCI that it uses 32bit registers instead of 64bit ones.

This will need more work...

As a matter of fact V9 doesn't work on ASM1042 (ML 10.8.4 - ASRock Z77E-ITX)



#28
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

 V9 doesn't work for me.  Upon resume from sleep, same setPowerState() timeout as always.

Then, 1 minute later:
Aug 30 13:41:47 hostname kernel[0]: [0xffffff8011443000](0)/(5) Device not responding

and the disk unmounts.

 

Update: V8 is failing for me this same way too.  I don't know why it worked on that 1 previous attempt.



#29
Slice

Slice

    InsanelyMacaholic

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

Hi Andy!

Great work!

I took your sources V9, added errata for my VIA VL800 controller and it works!

Read 420Mb from USB3 stick is about 7sec.

Aug 31 13:19:53 localhost kernel[0]: USBF:	4614.150	AppleUSBXHCI[0xffffff80d7093000]::CheckSleepCapability - forced ON
Aug 31 13:19:53 localhost kernel[0]: USBMSC Identifier (non-unique): 000000000000000044 0x1f75 0x916 0xd
Aug 31 13:19:54 localhost kernel[0]: USBF:	4615.101	AppleUSBXHCI[0xffffff80d7093000]::WaitForCMD (Configure Endpoint Command) - Command failed:-1017 (num interrupts: 81, num primary: 81, inactive:0, unavailable:0, is controller available:1)
Aug 31 13:19:54 localhost kernel[0]: USBF:	4615.101	AppleUSBXHCI[0xffffff80d7093000]::PrintInterrupter WaitForCMD IRQ:0 - IMAN: 00000002 IMOD: 000000a0 ERDP: 7c361690
Aug 31 13:19:54 localhost kernel[0]: USBF:	4615.101	AppleUSBXHCI[0xffffff80d7093000]::ClearEndpoint - configure endpoint failed:-1017
Aug 31 13:19:54 localhost kernel[0]: USBF:	4615.101	AppleUSBXHCI[0xffffff80d7093000]::ClearEndpoint - Input Context 0
Aug 31 13:19:54 localhost kernel[0]: USBF:	4615.101	AppleUSBXHCI[0xffffff80d7093000]::ClearEndpoint - Input Context 1
Aug 31 13:19:54 localhost kernel[0]: USBF:	4615.101	AppleUSBXHCI[0xffffff80d7093000]::ClearEndpoint - Input Context X
Aug 31 13:19:54 localhost fseventsd[51]: check_vol_last_mod_time:XXX failed to get mount time (25; &mount_time == 0x10d058518)
Aug 31 13:19:54 localhost fseventsd[51]: log dir: /Volumes/NO NAME/.fseventsd getting new uuid: 50721F07-F6D7-42B8-B39E-E15AAE719885

I think some more sources tuning is needed.

 

PS. I have no patches in DSDT concerning XHCI. I think we may exclude acpi calls from the driver.



#30
pokenguyen

pokenguyen

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 473 posts
  • Gender:Male

Your kext works with Renesas controller in my laptop:

9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.233	Attempting to get EHCI Controller from BIOS
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.233	USBLEGCTLSTS value 0xe0000000
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.233	acquireOSOwnership done - value 0x1000001
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.240	Attempting to get EHCI Controller from BIOS
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.240	USBLEGCTLSTS value 0xe0000000
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.240	acquireOSOwnership done - value 0x1000001
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.240	AppleUSBXHCI[0xffffff80d16f3000]::CheckSleepCapability - forced ON
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.241	AppleUSBEHCI[0xffffff8011afd000]::CheckSleepCapability - forced ON
9/1/13 1:35:43.000 AM kernel[0]: USBF:	0.249	AppleUSBEHCI[0xffffff8011d51000]::CheckSleepCapability - forced ON

However, after sleep, all the usb 3.0 ports do not work anymore, even after plugging in again. The device names in System Profiler don't refresh. Here are the log after sleep:

9/1/13 1:40:16.609 AM com.apple.usbmuxd[30]: DeviceRequestAsync failed: 0xe0004057
9/1/13 1:40:17.000 AM kernel[0]: USBF:	240.130	IOUSBHIDDriver(IOUSBHIDDriver)[0xffffff801310b400]::RearmInterruptRead  returning error 0xe0004057 (Endpoint does not exist), not issuing any reads to device
9/1/13 1:40:21.610 AM com.apple.usbmuxd[30]: DeviceRequestAsync failed: 0xe0004057
9/1/13 1:40:23.108 AM com.apple.usbmuxd[30]: SCEDeviceSocketCallback 0x101803400-iTunes/com.apple.iTunes remote peer closed connection for sce 0x101803400.
9/1/13 1:40:26.610 AM com.apple.usbmuxd[30]: DeviceRequestAsync failed: 0xe0004057
9/1/13 1:40:27.162 AM com.apple.usbmuxd[30]: _heartbeat_failed heartbeat detected detach for device 0x2-192.168.1.7:0!
9/1/13 1:40:31.610 AM com.apple.usbmuxd[30]: DeviceRequestAsync failed: 0xe0004057
9/1/13 1:40:36.611 AM com.apple.usbmuxd[30]: DeviceRequestAsync failed: 0xe0004057
9/1/13 1:40:39.528 AM com.apple.usbmuxd[30]: WriteAsyncInternal USB write error on 0x3-6ae2335bca842c6308ed1d7dcce38f4ac43ce726@0xfc200000: 0xe0004057
9/1/13 1:40:39.529 AM com.apple.usbmuxd[30]: MuxInterfaceSend send failed on 0x3-6ae2335bca842c6308ed1d7dcce38f4ac43ce726@0xfc200000: 0xe0004057
9/1/13 1:40:39.529 AM com.apple.usbmuxd[30]: HandleUSBMuxConnect Client 0x101a030a0-iTunes/com.apple.iTunes MuxTCPInitiateConnect failed
9/1/13 1:40:41.611 AM com.apple.usbmuxd[30]: DeviceRequestAsync failed: 0xe0004057
9/1/13 1:40:46.613 AM com.apple.usbmuxd[30]: DeviceRequestAsync failed: 0xe0004057

The GenericXHCI works perfectly with my system.



#31
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 3,182 posts
  • Gender:Male
  • Location:Moscow
And vice versa. GenericXHCI don't work for me after sleep while V9 works with some problems. I am going to correct them.
 
EDITED.
At now I have two problems: where to get sources for IsPortMuxed  and HandleLinkState.
Apple's sources are just incomplete.

#32
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

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

And vice versa. GenericXHCI don't work for me after sleep while V9 works with some problems. I am going to correct them.

EDITED.
At now I have two problems: where to get sources for IsPortMuxed and HandleLinkState.
Apple's sources are just incomplete.

They are part of IOUSBFamily's IOUSBController.
They are not open source.
You can use the original IOUSBFamily and only replace AppleUSB*HCI.kext in the kext's plugins.
HandleLinkstate is part of AppleUSBHub.kext

 

@Slice: New diff. (V10 patch)

This version can build a mostly working IOUSBFamily.

- SetPortPower and GetPortPower is implemented.

 

However - 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)

It works but USB2 on USB3 port doesn't work in case of a multiplexed controller (like Intel Panther Point)

IsPortMuxed's ACPI check method needs to be implemented...

Other than that it works...

I still recommend only using AppleUSB*HCI.kext with original IOUSBFamily.kext



#33
Slice

Slice

    InsanelyMacaholic

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

Andy,
I also make implementations for   AppleUSBHub::SetPortPower, AppleUSBHub::HandleLinkState,AppleUSBXHCI::IsPortMuxed,
AppleUSBEHCI::GetErrataBits, IOUSBControllerV3::GetErrataBits,

And after that I am able to use full IOUSBFamily.kext as created from the project.

With V9 I had repeating follow message after wake:

Attached File  Screen Shot 2013-08-31 at 18.01.00.png   52.53KB   7 downloads

now it will not appear.

But again. I can't mount USB stick after wake.

See my diff compared to vanilla project. It includes your diff v9.

Attached File  IOUSBFamily-560.4.2-SL.diff.zip   179.41KB   6 downloads

 

May be we create a project on sf.net and will commit our changes?

 

In Clover I made and tested the follow DSDT fix (rev 1996):

Originally it was 

            Device (RP06)
            {
                Name (_ADR, 0x001C0005)  // _ADR: Address
...

                Device (PXSX)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                    {
                        0x09, 
                        0x04
                    })
                }

My PCIe USB3 adapter occupies this slot and PXSX becomes to be XHCI device.

So Clover find where the adapter inserted and made renaming to XHC1 and add _DSM method with properties as you said


                Device (XHC1)
                {
                    Name (_ADR, Zero)
                    Name (_PRW, Package (0x02)
                    {
                        0x09, 
                        0x04
                    })
                    Method (_DSM, 4, NotSerialized)
                    {
                        Store (Package (0x13)
                            {
                                "device-id", 
                                Buffer (0x04)
... 

For properties XHCA, XHCB, ... I made additional SSDT. One have to change names in it to correspond his configuration.


DefinitionBlock ("SSDT-1.aml", "SSDT", 1, "USB3", "XHCIDEV", 0x00030000)
{
    External (\_SB_.PCI0.RP06.XHC1, DeviceObj)

    Scope (\_SB.PCI0.RP06.XHC1)
    {
        OperationRegion (XH1C, PCI_Config, 0xD0, 0x10)
        Field (XH1C, ByteAcc, NoLock, Preserve)
        {
            PAHC,   1, 
            PBHC,   1, 
            PCHC,   1, 
            PDHC,   1, 
            Offset (0x08), 
            PASS,   1, 
            PBSS,   1, 
            PCSS,   1, 
            PDSS,   1
        }
 

 Instead of _SB.PCI0.RP06.XHC1 one must write his name.

Attached File  SSDT-10.dsl.zip   1.2KB   8 downloads


No need to make fix ownership because Clover and Chameleon already did this.



#34
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

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

Andy,
I also make implementations for AppleUSBHub::SetPortPower, AppleUSBHub::HandleLinkState,AppleUSBXHCI::IsPortMuxed,
AppleUSBEHCI::GetErrataBits, IOUSBControllerV3::GetErrataBits,

And after that I am able to use full IOUSBFamily.kext as created from the project.
With V9 I had repeating follow message after wake:
Screen Shot 2013-08-31 at 18.01.00.png
now it will not appear.
But again. I can't mount USB stick after wake.
See my diff compared to vanilla project. It includes your diff v9.
IOUSBFamily-560.4.2-SL.diff.zip

May be we create a project on sf.net and will commit our changes?

In Clover I made and tested the follow DSDT fix (rev 1996):
Originally it was

            Device (RP06)
            {
                Name (_ADR, 0x001C0005)  // _ADR: Address
...

                Device (PXSX)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                    {
                        0x09, 
                        0x04
                    })
                }

My PCIe USB3 adapter occupies this slot and PXSX becomes to be XHCI device.
So Clover find where the adapter inserted and made renaming to XHC1 and add _DSM method with properties as you said
                Device (XHC1)
                {
                    Name (_ADR, Zero)
                    Name (_PRW, Package (0x02)
                    {
                        0x09, 
                        0x04
                    })
                    Method (_DSM, 4, NotSerialized)
                    {
                        Store (Package (0x13)
                            {
                                "device-id", 
                                Buffer (0x04)
...
For properties XHCA, XHCB, ... I made additional SSDT. One have to change names in it to correspond his configuration.
DefinitionBlock ("SSDT-1.aml", "SSDT", 1, "USB3", "XHCIDEV", 0x00030000)
{
    External (\_SB_.PCI0.RP06.XHC1, DeviceObj)

    Scope (\_SB.PCI0.RP06.XHC1)
    {
        OperationRegion (XH1C, PCI_Config, 0xD0, 0x10)
        Field (XH1C, ByteAcc, NoLock, Preserve)
        {
            PAHC,   1, 
            PBHC,   1, 
            PCHC,   1, 
            PDHC,   1, 
            Offset (0x08), 
            PASS,   1, 
            PBSS,   1, 
            PCSS,   1, 
            PDSS,   1
        }
Instead of _SB.PCI0.RP06.XHC1 one must write his name.
SSDT-10.dsl.zip

No need to make fix ownership because Clover and Chameleon already did this.
Great, good work.
I think making an sf page for the project is a great plan.

#35
Mirone

Mirone

    InsanelyMac Deity

  • Local Moderators
  • 2,049 posts
  • Gender:Male
  • Location:Brazil
Still not working for me.
Andy made ​​new changes to Asmedia 1042?

with GenericXHCI.kext or Caldigit.kext for the sleep function normally use this method in Device RP04/PSXS:

Device (RP04)
            {
                Name (_ADR, 0x001C0003)
                Name (_HPP, Package (0x04)
                {
                    0x08, 
                    0x40, 
                    One, 
                    Zero
                })
                OperationRegion (PXCS, PCI_Config, 0x40, 0xC0)
                Field (PXCS, AnyAcc, NoLock, Preserve)
                {
                    Offset (0x10), 
                    L0SE,   1, 
                    Offset (0x11), 
                    Offset (0x12), 
                        ,   13, 
                    LASX,   1, 
                    Offset (0x14), 
                        ,   6, 
                    HPCE,   1, 
                    Offset (0x1A), 
                    ABPX,   1, 
                        ,   2, 
                    PDCX,   1, 
                        ,   2, 
                    PDSX,   1, 
                    Offset (0x1B), 
                    Offset (0x20), 
                    Offset (0x22), 
                    PSPX,   1, 
                    Offset (0x98), 
                        ,   30, 
                    HPEX,   1, 
                    PMEX,   1
                }
                Field (PXCS, AnyAcc, NoLock, WriteAsZeros)
                {
                    Offset (0x94), 
                        ,   1, 
                    EIFD,   1, 
                    Offset (0x95), 
                    Offset (0x9C), 
                        ,   30, 
                    HPSX,   1, 
                    PMSX,   1
                }
                Device (PXSX)
                {
                    Name (_ADR, Zero)
                    Name (_PRW, Package (0x02)
                    {
                        0x09, 
                        0x04
                    })
                    Method (_DSM, 4, NotSerialized)
                    {
                        Store (Package (0x12)
                            {
                                "AAPL,clock-id", 
                                Buffer (One)
                                {
                                     0x02
                                }, 
                                "AAPL,device-internal", 
                                Buffer (One)
                                {
                                     0x00
                                }, 
                                "name", 
                                "ASMedia XHCI Controller", 
                                "model", 
                                Buffer (0x28)
                                {
                                    "ASMedia ASM1042 USB 3.0 xHCI Controller"
                                }, 
                                "device_type", 
                                Buffer (0x0F)
                                {
                                    "USB Controller"
                                }, 
                                "AAPL,current-available", 
                                0x0834, 
                                "AAPL,current-extra", 
                                0x0898, 
                                "AAPL,current-extra-in-sleep", 
                                0x0640, 
                                "AAPL,max-port-current-in-sleep", 
                                0x0834
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }
                }


#36
Slice

Slice

    InsanelyMacaholic

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

Hi Andy,

I merged your changes V10 with my and have no questions. Thank you for the "include" corrections. Will test and debug the new version.

I noticed some strange thing. IOUSBFamily(logging) works better then "deployment". Why? It means some of USBLog() make a significant change if present. But I can't find what is it.



#37
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

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

Hi Andy,
I merged your changes V10 with my and have no questions. Thank you for the "include" corrections. Will test and debug the new version.
I noticed some strange thing. IOUSBFamily(logging) works better then "deployment". Why? It means some of USBLog() make a significant change if present. But I can't find what is it.

Maybe because there is that delay when it passes it to the log.
Some of the USB functions work better when they are delay for a few msecs.
If you are done with it, will you upload a diff or will we just make a project page?
Let me know please ;)

 

EDIT: Also just updated to Clover R2010.

I like the new structure of the config.plist.

Just updated my old config.plist and it works well...

Thx for that too :D

Could you take a peek if you have time to see if I did the new config.plist I uploaded here right?

Thanks in advance 

Attached Files



#38
Slice

Slice

    InsanelyMacaholic

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

Hi Andy,

New observation with my latest version:

After wake it can't make it working

inactive:0, unavailable:0, is controller available:1)
USBF:	879.956	AppleUSBXHCI[0xffffff80d2f1c000]::PrintInterrupter WaitForCMD IRQ:0 - IMAN: 00000002 IMOD: 000000a0 ERDP: 7c002e10
USBF:	879.956	AppleUSBXHCI[0xffffff80d2f1c000]::SetTRDQPtr - slot context error
USBF:	880.483	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Set TR Dequeue Pointer Command) - Command not completed in 502ms
USBF:	886.143	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Set TR Dequeue Pointer Command) - abort, command ring did not stop, count = 5000.1000, ret: -1
USBF:	886.143	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Set TR Dequeue Pointer Command) - Command failed:-1 (num interrupts: 19353, num primary: 19353, inactive:0, unavailable:0, is controller available:1)
USBF:	886.144	AppleUSBXHCI[0xffffff80d2f1c000]::PrintInterrupter WaitForCMD IRQ:0 - IMAN: 00000002 IMOD: 000000a0 ERDP: 7c002e10
USBF:	886.144	AppleUSBXHCI[0xffffff80d2f1c000]::SetTRDQPtr - slot context error
USBF:	888.671	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Set TR Dequeue Pointer Command) - Command not completed in 502ms
USBF:	894.329	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Set TR Dequeue Pointer Command) - abort, command ring did not stop, count = 5000.1000, ret: -1
USBF:	894.329	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Set TR Dequeue Pointer Command) - Command failed:-1 (num interrupts: 19353, num primary: 19353, 

But then I make 

sudo kextunload -v /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBXHCI.kext

and then load again

sudo kextutil -v /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBXHCI.kext

And victory! The USB stick is working again! The log of the action:

USBF:	963.719	AppleUSBXHCI[0xffffff80d2f1c000]::PrintInterrupter WaitForCMD IRQ:0 - IMAN: 00000002 IMOD: 000000a0 ERDP: 7c002e10
USBF:	963.719	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateControlEndpoint 2 - Enable slot failed:-1
USBF:	963.719	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateControlTransfer 2 - unallocated slot ID: fn 0, returning kIOUSBEndpointNotFound
USBF:	963.750	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateControlTransfer 2 - unallocated slot ID: fn 0, returning kIOUSBEndpointNotFound
USBF:	963.781	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateControlTransfer 2 - unallocated slot ID: fn 0, returning kIOUSBEndpointNotFound
USBF:	963.785	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateControlTransfer 2 - unallocated slot ID: fn 0, returning kIOUSBEndpointNotFound
USBF:	963.815	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateInterruptEndpoint 2 - Unused slot ID for functionAddress: 1
USBF:	963.815	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateControlEndpoint 2 - unknown function number: 1
USBF:	963.815	AppleUSBXHCI[0xffffff80d2f1c000]::UIMAbortStream - unknown function number: 1
USBF:	963.815	AppleUSBXHCI[0xffffff80d2f1c000]::UIMAbortStream - unknown function number: 1
USBF:	964.775	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Enable Slot Command) - Command not completed in 502ms
USBF:	970.431	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Enable Slot Command) - abort, command ring did not stop, count = 5000.1000, ret: -1
USBF:	970.431	AppleUSBXHCI[0xffffff80d2f1c000]::WaitForCMD (Enable Slot Command) - Command failed:-1 (num interrupts: 19353, num primary: 19353, inactive:0, unavailable:0, is controller available:1)
USBF:	970.431	AppleUSBXHCI[0xffffff80d2f1c000]::PrintInterrupter WaitForCMD IRQ:0 - IMAN: 00000002 IMOD: 000000a0 ERDP: 7c002e10
USBF:	970.431	AppleUSBXHCI[0xffffff80d2f1c000]::UIMCreateControlEndpoint 2 - Enable slot failed:-1
USBF:	975.517	AppleUSBXHCI[0xffffff80d2f1c000]::UIMFinalize
USBF:	1346.527	AppleUSBXHCI[0xffffff80d2f2f000]::CheckSleepCapability - forced ON
USBF:	1347.373	AppleUSBXHCI[0xffffff80d2f2f000]::WaitForCMD (Configure Endpoint Command) - Command failed:-1017 (num interrupts: 35, num primary: 35, inactive:0, unavailable:0, is controller available:1)
USBF:	1347.373	AppleUSBXHCI[0xffffff80d2f2f000]::PrintInterrupter WaitForCMD IRQ:0 - IMAN: 00000002 IMOD: 000000a0 ERDP: 7c022300
USBF:	1347.373	AppleUSBXHCI[0xffffff80d2f2f000]::ClearEndpoint - configure endpoint failed:-1017
USBF:	1347.373	AppleUSBXHCI[0xffffff80d2f2f000]::ClearEndpoint - Input Context 0
USBF:	1347.373	AppleUSBXHCI[0xffffff80d2f2f000]::ClearEndpoint - Input Context 1
USBF:	1347.373	AppleUSBXHCI[0xffffff80d2f2f000]::ClearEndpoint - Input Context X
USBF:	1442.594	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1449.599	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1463.611	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1470.615	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1484.628	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1491.633	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1506.636	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1513.638	AppleUSBXHCI[0xffffff80d2f2f000]::RestartStreams - called on non streams endpoint 2, 1
USBF:	1520.673	AppleXHCIAsyncEndpoint[0xffffff8016f43200]::free 12 ATDs in doneQueue returning as 0xe00002eb
USBMSC Identifier (non-unique): 000000000000000044 0x1f75 0x916 0xd
 

It mean procedures for init controller are different for Start and for Wake. I think we can correct this.

May latest sources:

Attached File  IOUSBFamily-560.4.2-Sl10.diff.zip   188.79KB   5 downloads



#39
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

Hi Andy,
New observation with my latest version:
After wake it can't make it working

Welcome to the club :)
Nice observation that it works with kextunload/kextload.
So we could work around this bug with sleepwatcher doing the unload/load automatically.

#40
Slice

Slice

    InsanelyMacaholic

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

Maybe because there is that delay when it passes it to the log.
Some of the USB functions work better when they are delay for a few msecs.
If you are done with it, will you upload a diff or will we just make a project page?
Let me know please ;)

 

EDIT: Also just updated to Clover R2010.

I like the new structure of the config.plist.

Just updated my old config.plist and it works well...

Thx for that too :D

Could you take a peek if you have time to see if I did the new config.plist I uploaded here right?

Thanks in advance 

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

 

Welcome to the club :)
Nice observation that it works with kextunload/kextload.
So we could work around this bug with sleepwatcher doing the unload/load automatically.

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?







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