Help - Search - Members - Calendar
Full Version: Dsdt Fix For Usb Device Dead After Wake From Sleep Since 10.6.3
Project OS X Forums > Snow Leopard Guides & Tutorials > DSDT Patching
boombeng
[Edit] The dsdt fix doesn't work properly since it brings device removal error to ehci device after wake
However you can download a kext that works in Extra/Extensions and should pass the updates here cheers
________________________________________________________________________________
___________________________________________________________

Since 10.6.3 update I had to unplug and replug the device that waked the system in order to make it usable after wake, so I checked a dsdt from another MSI board that was not experiencing this issue (P55 CD53) and found that pieces of codes were missing in my MSI P45T C51's DSDT... I just added and it worked smile.gif

In both EUSB and USBE I had only that :

CODE
            Device (EUSB)
            {
                Name (_ADR, 0x001D0007)
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x0D, 0x04))
                }
            }


And It needs to be like that :

CODE
   Device (EUSB)
            {
                Name (_ADR, 0x001D0000)
                Device (RHUB)
                {
                    Name (_ADR, Zero)
                    Device (PRT1)
                    {
                        Name (_ADR, One)
                        Name (_UPC, Package (0x04)
                        {
                            0xFF,
                            Zero,
                            Zero,
                            Zero
                        })
                        Name (_PLD, Buffer (0x10)
                        {
                            /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                            /* 0008 */    0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        })
                        Device (PRT1)
                        {
                            Name (_ADR, One)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                        }

                        Device (PRT2)
                        {
                            Name (_ADR, 0x02)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                            Name (_PLD, Buffer (0x10)
                            {
                                /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                /* 0008 */    0xA0, 0x10, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
                            })
                        }

                        Device (PRT3)
                        {
                            Name (_ADR, 0x03)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                        }

                        Device (PRT4)
                        {
                            Name (_ADR, 0x04)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                        }

                        Device (PRT5)
                        {
                            Name (_ADR, 0x05)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                        }

                        Device (PRT6)
                        {
                            Name (_ADR, 0x06)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                        }

                        Device (PRT7)
                        {
                            Name (_ADR, 0x07)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                        }

                        Device (PRT8)
                        {
                            Name (_ADR, 0x08)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF,
                                Zero,
                                Zero,
                                Zero
                            })
                        }
                    }

                    Device (PRT2)
                    {
                        Name (_ADR, 0x02)
                        Name (_UPC, Package (0x04)
                        {
                            Zero,
                            0xFF,
                            Zero,
                            Zero
                        })
                    }
        
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x0D, 0x04))
                }
            }


This changes have to be done on both EUSB and USBE device (ehci ports i believe)

I hope it can help others experiencing that usb issue that the only known trick for the moment was to use Power Bouton to wake
cheers
18seven
QUOTE (boombeng @ Apr 20 2010, 02:25 AM) *
CODE
Device (EUSB)
{
Name (_ADR, 0x001D0007)
Method (_PRW, 0, NotSerialized)
{
Return (GPRW (0x0D, 0x04))
}
}


And It needs to be like that :

CODE
Device (EUSB)
{
Name (_ADR, 0x001D0000)
Device (RHUB)
{
Name (_ADR, Zero)
Device (PRT1)
{
Name (_ADR, One)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
Name (_PLD, Buffer (0x10)
{
/* 0000 */ 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0008 */ 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
})
Device (PRT1)
{
Name (_ADR, One)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
}

Device (PRT2)
{
Name (_ADR, 0x02)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
Name (_PLD, Buffer (0x10)
{
/* 0000 */ 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0008 */ 0xA0, 0x10, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
})
}

Device (PRT3)
{
Name (_ADR, 0x03)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
}

Device (PRT4)
{
Name (_ADR, 0x04)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
}

Device (PRT5)
{
Name (_ADR, 0x05)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
}

Device (PRT6)
{
Name (_ADR, 0x06)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
}

Device (PRT7)
{
Name (_ADR, 0x07)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
}

Device (PRT8)
{
Name (_ADR, 0x08)
Name (_UPC, Package (0x04)
{
0xFF,
Zero,
Zero,
Zero
})
}
}

Device (PRT2)
{
Name (_ADR, 0x02)
Name (_UPC, Package (0x04)
{
Zero,
0xFF,
Zero,
Zero
})
}

Method (_PRW, 0, NotSerialized)
{
Return (GPRW (0x0D, 0x04))
}
}


typo?

QUOTE
Platforms implementing USB2.0 host controllers that consist of one or more USB1.1 compliant companion controllers (e.g. UHCI or OHCI) must implement a _UPC and a _PLD object for each port USB port that can be routed between the EHCI host controller and its associated companion controller. This is required because a USB Port Capabilities object implemented for a port that is a child of an EHCI host controller may not be available if the OSPM disables the parent host controller. For example, if root port 1 on an EHCI host controller is routable to root port 1 on its companion controller, then the namespace must provide a _UPC and a _PLD object under each host controller’s associated port 1 child object.


However, not present in Apple ACPI dumps and appears to not have a negative effect if missing.

The magic really happens in the usb device scope. Details below. I find if I enable the BT controller and/or EHCI I loose sleep (A note for Galaxy/KiNG if you read this, that was the sleep issue with your old machine).

CODE

Device (USB0)
{
Name (_ADR, 0x001D0000)
OperationRegion (BAR0, PCI_Config, 0xC4, One) /*Config Space for Wake Enable*/
Field (BAR0, ByteAcc, NoLock, Preserve)
{
USBW, 2, // Wake Enable bit
Offset (0x01)
}

Method (_S3D, 0, NotSerialized) /*S3 Device State*/
{
Return (0x03)
}

Method (_PSW, 1, NotSerialized) /*Power State WakeCompatibility Note: The _PSW method is deprecated in ACPI 3.0. OSPM must use _DSW if it is present. Otherwise, it may use _PSW.*/
{
If (Arg0)
{
Store (0x03, USBW) // port zero and one enabled
}
Else
{
Store (Zero, USBW) // disabled
}

}
Method (_PRW, 0, NotSerialized) /*Power Resources for Wake is only required for devices that have the ability to wake the system from a system sleeping state.*/
{
Return (GPRW (0x03, 0x04))
}
}

boombeng
Well finaly it's not really a fix cause i have error on log with that and "device removal" after wake for ehci device sad.gif

Sorry to post too fast a fix that is not really a fix
18seven
boombeng post your dsdt and hardware details so we may take a look.
boombeng
QUOTE (18seven @ Apr 22 2010, 06:22 AM) *
boombeng post your dsdt and hardware details so we may take a look.


Here is my dsdt,
Click to view attachment


Before 10.6.3 i did not have usb issue, sleep and wake from sleep was working natively

Fix in my dsdt =
- HPET and RTC (I'm not sure... I don't remember)
- Removed alias CPU
- Removed IRQ of devices RTC0 TMR and PIC
- Injection HDA (only enabler)
- Replaced CID by HID in device (PWRB)
- Injection cosmetic of device PCI built-in (audio/ethernet/gfx)
- Injection of device SMBUS
- Changed name of usb with apple-like names (USB0=UHC1 etc...)
- Speedstep injection (no need of LPC injection, it was loading natively)

Hardware =
- Mobo MSI P45TC51 (ICH10+RTL8111/8168B+alc889a)
- CPU Q6600 @ 3GHz
- Radeon HD4850
- 6Go ram


Thx in advance for any help about usb issue since 10.6.3 (need to replug USB device that waked the system to use it)
cheers
18seven
The first debugging step I take is to patch OSI for the proper OS, Darwin.

Change

CODE

If (_OSI ("Windows 2006"))
{
Store (0x15, Local0)
}

to

CODE

If (_OSI ("Darwin"))
{
Store (0x15, Local0)
}


Give this a go, to see what is being corrected search OSFL.




boombeng
Done but still no go for usb device plug after wake sad.gif
THe KiNG
QUOTE (18seven @ Apr 20 2010, 01:36 PM) *
... (A note for Galaxy/KiNG if you read this, that was the sleep issue with your old machine).

I don't have any sleep/wake problem on my machines...
Maybe Galaxy have...no idea
18seven
QUOTE (boombeng @ Apr 22 2010, 12:12 PM) *
Done but still no go for usb device plug after wake sad.gif

Can I also see a lspci dump and an ioreg dump? Do you overclock?

QUOTE (THe KiNG)
I don't have any sleep/wake problem on my machines...
Maybe Galaxy have...no idea

You had patched a table for Galaxy that had this issue. You patched it correctly but the non-native hardware caused instant wake.
boombeng
QUOTE (18seven @ Apr 22 2010, 10:41 PM) *
Can I also see a lspci dump and an ioreg dump? Do you overclock?

lspci and ioreg dumps
Click to view attachmentClick to view attachment

The cpu Q6600 is overclocked @ 3Ghz
Slice
QUOTE (boombeng @ Apr 22 2010, 11:03 AM) *
- Removed IRQ of devices RTC0 TMR and PIC

PIC device needs IRQ 2 for IRQ>15 working properly.
18seven
QUOTE (boombeng @ Apr 22 2010, 07:41 PM) *
lspci and ioreg dumps
Click to view attachmentClick to view attachment

The cpu Q6600 is overclocked @ 3Ghz


disable overclock

... and dump lspci with -nnvv
boombeng
QUOTE (18seven @ Apr 23 2010, 08:11 AM) *
disable overclock

... and dump lspci with -nnvv


I tried without overclock and still no go, and here is lspci -nnvv dump
Click to view attachment

QUOTE (Slice @ Apr 23 2010, 08:02 AM) *
PIC device needs IRQ 2 for IRQ>15 working properly.


With IRQ 2 under PIC device my system doesn't sleep properly, fan still running and no wake
Gringo Vermelho
Mine has no IRQ..
Click to view attachment
IRQ 2 is used by the HPET device:
Click to view attachment

boombeng
In my dsdt, IRQ specified under Hpet are 8 and 0 but in Ioreg we can see it uses the same irq as yours Gringo

CODE
              Device (HPET)
                {
                    Name (_HID, EisaId ("PNP0103"))
                    Name (CRS, ResourceTemplate ()
                    {
                        IRQNoFlags ()
                            {0}
                        IRQNoFlags ()
                            {8}
boombeng
Digging a bit more to understand this usb problem I used Zhell's trick to debug acpi during sleep process http://www.projectosx.com/forum/index.php?showtopic=456

Console output when wake with power button (all usb ok then)
Click to view attachment

Console output when wake with mouse (need to replug it after wake to make it work then)
Click to view attachment

It seems they are the same, no error log when waking with mouse... so what does that mean ? may be it means the solution is not in dsdt change ?....
Slice
I am looking into new IOUSBHID and found that it changed. In system 10.6.3 a USB mouse must be more Apple-like.
So if mouse was not waking you need to change the mouse or IOUSBHIDDriver.kext that works for you.
boombeng
QUOTE (Slice @ Apr 25 2010, 05:51 AM) *
I am looking into new IOUSBHID and found that it changed. In system 10.6.3 a USB mouse must be more Apple-like.
So if mouse was not waking you need to change the mouse or IOUSBHIDDriver.kext that works for you.


I have the same issue with my keyboard and anther logitech mouse so I thought it was more a general problem than a compatibility problem, however yep, with IOUSBHID from 10.6.2 everything is ok, even if I was looking for a trick more "vanilla" it's ok like that, thanks Slice wink.gif

This problem seems to happen even on real macs, so it seems definitively to be an 10.6.3 kext problem
http://discussions.info.apple.com/thread.j...0&tstart=15
boombeng
No dsdt fix but here is a version of IOUSBHIDDriver.kext (based on 10.6.2) that works in Extra/Extension and should pass the other updates (hope so...)

Click to view attachment
boombeng
QUOTE (Slice @ Apr 25 2010, 06:51 AM) *
I am looking into new IOUSBHID and found that it changed. In system 10.6.3 a USB mouse must be more Apple-like.
So if mouse was not waking you need to change the mouse or IOUSBHIDDriver.kext that works for you.


I did try to use an apple usb mouse and still the same issue after sleep , strange
boombeng
Good news= The issue is fixed in 10.6.4_10f46 smile.gif
Hope the fix will stay until 10.6.4 public release
THe KiNG
QUOTE (boombeng @ May 9 2010, 07:32 PM) *
Good news= The issue is fixed in 10.6.4_10f46 smile.gif
Hope the fix will stay until 10.6.4 public release

Not on my Zotac MCP79 crap, still I got the removal error...
boombeng
QUOTE (THe KiNG @ May 10 2010, 10:35 AM) *
Not on my Zotac MCP79 crap, still I got the removal error...


Removal error appeared with 10.6.3 on your zotac ? or this issue was there before ?
THe KiNG
Dunno, tongue.gif
I restored a working 10.6.3 install on Zotac hdd so no idea...
atomiX_X
QUOTE (boombeng @ May 9 2010, 01:32 PM) *
Good news= The issue is fixed in 10.6.4_10f46 smile.gif
Hope the fix will stay until 10.6.4 public release

That's good to hear. I'm still on 10.6.2 postponing my update till this issue is fixed for my Asus P5E. Could the 10.6.4 beta seed kext be used in 10.6.3? I'd use it if it worked. Thanks.
gsam_fan
well...i had some experience in that 4 months ago...
i found 2 problems in the USB section in DSDT into 3 computers

1.didn't let the computers to go to sleep...
this was due the S3 S4 state and the easiest way to fix it is to remove the parameters from the device
example:
CODE
            Device (UHC1)
            {
                Name (_ADR, 0x001D0000)
                OperationRegion (BAR0, PCI_Config, 0xC4, One)
                Field (BAR0, ByteAcc, NoLock, Preserve)
                {
                    USBW,   2,
                            Offset (0x01)
                }
------------------------------------------------------------------------------------- delete from here
                Method (_S3D, 0, NotSerialized)
                {
                    If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        Return (0x03)
                    }
                }
-------------------------------------------------------------------------------------  to here
                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        Store (0x03, USBW)
                    }
                    Else
                    {
                        Store (Zero, USBW)
                    }
                }

                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x03, 0x04))
                }
            }

"dirty" but it works.....

2.after wake from sleep the device is not working.
this happens for two reasons.
First is that the device is usb 1.1 and the solution is to unplug it and plug it again or see the jumper setting of the motherboard for "5V-DV" , "Wake" for that usb port or Bios setting for APM (PowerOn from usb keyboard-mouse)
Second is that for example in my case...go buy a new keyboard and throw away that "dump_cheap_usb1.1_keyboard_for_2euros" blink.gif hahahaha

Now in the "case" we have a laptop and can't "buy" a new keyboard or touchpad the solution is to remove the "Wake from Sleep" (the device can wake the computer from sleep) section into DSDT , and we don't mind that cause this usbport connection is internal (no physical port) and the PowerButtom of the laptop is very close to the keyboard and mouse.
Press that , don't need to press a key or touch the trackpad to wake.

CODE
            Device (UHC3)
            {
                Name (_ADR, 0x001D0000)
                OperationRegion (BAR0, PCI_Config, 0xC4, One)
                Field (BAR0, ByteAcc, NoLock, Preserve)
                {
                    USBW,   2,
                            Offset (0x01)
                }

                Method (_S3D, 0, NotSerialized)
                {
                    If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        Return (0x03)
                    }
                }

                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        Store (0x03, USBW)
                    }
                    Else
                    {
                        Store (Zero, USBW)
                    }
                }
------------------------------------------------------------------------------------- delete from here
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x03, 0x04))
                }
            }
-------------------------------------------------------------------------------------  to here


.....
for the EHCI section (this is classical)
CODE
            Device (EHC1)
            {
                Name (_ADR, 0x001D0007)
                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x04)
                        {
                            "AAPL,clock-id",
                            Buffer (One)
                            {
                                0x02
                            },

                            "device_type",
                            Buffer (0x05)
                            {
                                "EHCI"
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x0D, 0x04))
                }
            }



p.s. hope to helped somebody, sorry for my english rolleyes.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.