Subscribe to our RSS news feed
AAPL 275.62 (0.56)

> Forum Guidelines

Welcome to the Genius Bar. Here's how this forum works:

1. Members are encouraged to make a guide that details something that they might have found troubling or challenging. Chances are, if you've seen the same question asked over and over again, you should write a guide for it.

2. This is not the forum for asking questions. If you have a question about a thread that's already here, feel free to ask it. Just don't start a thread for a specific question. Use the other forums here for that.

3. Posting links to off-site tutorials is not allowed.

4. That's it! Thanks for sharing your information with the rest of us. :)

To keep this forum clean this forum is moderated. You can post in existing topics but new ones will have to be approved before they show up. Quality guides promoting new methods and encouraging users to learn will be approved.


DSDT: trick retail drivers by changing "device-id" (e.g USB), Fix sleep issues of ICH9/-R faking ICH10-R
***
  • Group: Members
  • Posts: 121
  • Joined: 27-October 08
  • Member No.: 310,934
Patch DSDT to Enable Apple Drivers for non-Apple Hardware

Some KEXTs use the "device-id" of devices attached to the PCI bus to decide (i) whether to start and (ii) to tweak their behavior depending on the specific device.
This allows some but far from all KEXTs to be tricked into believing that you have hardware that is used by Apple and thus enjoying support from Apple's drivers.

In this tutorial, I will show how to get boards with USB from the Intel ICH9/-R chip (Intel P35 chipset) to sleep properly by leading the USB KEXTs into believing that it is actually an ICH10-R, which is used in the MacPro4,1. [bThis fix requires Mac OS X 10.5.7.[/b]
Note: Automatic sleep after an idle period is not enabled by this fix. This problem is not necessarily even related to USB but might be caused by your DVD drive.

If your computer goes to sleep properly (i.e. all disks and fans completely switched off) but has trouble waking up, this fix may unfortunately not help.

If you have Mac OS X 10.5.5 or earlier, the fix won't change anything. Using it with Mac OS X 10.5.6 is not recommended.
If your computer has an ICH9/-R and can only sleep with slice's USB kexts, this fix should allow you to get sleep with the stock USB drivers from 10.5.7.
What the fix does is it lets the USB kext "recognize" the UHCI devices and enables the proper work-arounds for their quirks (see the "Errata" property of "AppleUSBUHCI" devices in IORegistryExplorer: if it is 0x0, the driver has probably not recognized the device).
To understand what is going on, you may want to install the USB Debug Kit from Apple. Using the supplied KEXTs, you will see at boot that the device is not supported and therefore power manangement is turned off. This results in the well-known behavior of the computer going to sleep only half-way and then requiring a hard reset to get back to life.

Thanks to CycloneFr and THe KiNG for beta testing!

Note: You are using this at your own risk. Tricking drivers into believing the hardware is something it isn't may seriously damage your computer.
The fix itself is quite simple for DSDT standards. However, I assume you are fairly experienced modding the DSDT. Otherwise, you should get your feet wet with some other tutorial.
Using the widely-used patch method "DTGP", we will add a property "device-id" to the UHCI devices in the DSDT. This property will be chosen to match that of the corresponding devices of the ICH10-R used in MacPro4,1.

Note: Do not set the model of your machine to MacPro4,1, as this will cause a kernel panic with 10.5.7. Just set it to MacPro3,1 or leave it at whatever you have used before.

Method DTGP
Ensure you have method DTGP defined somewhere in your DSDT.dsl. You might want to use the DSDT patcher to insert this method by applying one of its many fixes. This tutorial does not cover this. The end result is that you need to have the following code in the right place:
CODE

Method (DTGP, 5, NotSerialized)
{
If (LEqual (Arg0, Buffer (0x10)
{
/* 0000 */ 0xC6, 0xB7, 0xB5, 0xA0, 0x18, 0x13, 0x1C, 0x44,
/* 0008 */ 0xB0, 0xC9, 0xFE, 0x69, 0x5E, 0xAF, 0x94, 0x9B
}))
{
If (LEqual (Arg1, One))
{
If (LEqual (Arg2, Zero))
{
Store (Buffer (One)
{
0x03
}, Arg4)
Return (One)
}

If (LEqual (Arg2, One))
{
Return (One)
}
}
}

Store (Buffer (One)
{
0x00
}, Arg4)
Return (Zero)
}

Once you are done with this step and your DSDT.dsl still compiles without errors and warnings (or at least not more than before you touched it), you may proceed identifying the devices we will patch.

Identifying Your UHCI Devices
The UHCI devices may be called anything. However, we can identify them based on their addresses, which are given by the line that begins with "Name (_ADR, 0x...). My second UHCI device, called "UHC2", begins like this:
CODE
      Device (UHC2)
      {
        Name (_ADR, 0x001D0001)
      ...

From this value "0x001D0001", you may strip leading zeroes of every block of four figures and obtain "1D,1", which then corresponds to the addresses shown in IORegistryExplorer to the right of the "@" sign, such as "UHC2@1D,1". (IORegistryExplorer is part of XCode Tools, download from developer.apple.com). Limit the view by searching for "UHCI" and you should see something like this:
Attached File  IORegistryExplorer_UHCI.png ( 149.3K ) Number of downloads: 4529


This way, you should be able to spot the six UHCI devices. Note that there may be more devices in the DSDT that look like UHCI devices (often there are seven), but only six are shown in IORegistryExplorer. Those are the ones we are going to patch.

The corresponding lines from "lspci" are:
CODE
00:1d.0 USB Controller [0c03]: Intel Corporation 82801I (ICH9 Family)
  USB UHCI Controller #1 [8086:2934] (rev 03)
00:1d.1 USB Controller [0c03]: Intel Corporation 82801I (ICH9 Family)
  USB UHCI Controller #2 [8086:2935] (rev 03)
00:1d.2 USB Controller [0c03]: Intel Corporation 82801I (ICH9 Family)
  USB UHCI Controller #3 [8086:2936] (rev 03)
00:1a.0 USB Controller [0c03]: Intel Corporation 82801I (ICH9 Family)
  USB UHCI Controller #4 [8086:2937] (rev 03)
00:1a.1 USB Controller [0c03]: Intel Corporation 82801I (ICH9 Family)
  USB UHCI Controller #5 [8086:2938] (rev 03)
00:1a.2 USB Controller [0c03]: Intel Corporation 82801I (ICH9 Family)
  USB UHCI Controller #6 [8086:2939] (rev 03)

In the second pair of brackets, you can see the PCI vendor id (8086 for Intel) and the device-id (2934..2939).
For the ICH9/-R, devices UHCI 1...UHCI 6 have the following addresses and device IDs:
CODE
UHCI 1: 1D    2934
UHCI 2: 1D,1  2935
UHCI 3: 1D,2  2936
UHCI 4: 1A    2937
UHCI 5: 1A,1  2938
UHCI 6: 1A,2  2939

Do not change the names of your devices as the DSDT won't compile anymore if you do.
Only proceed to patching if the addresses of all six UHCI devices match exactly.

Patching the "device-id" of the UHCI Devices
Now, we just add a call to the DTGP method by inserting a few lines of code into every single one of the 6 UHCI devices. The arguments we pass are "device-id", which is the property we want to patch, and then a four-byte buffer that contains the value to assign to the "device-id" property. These buffers are written "back-wards", i.e. the device-id for the UHC2 device of the ICH10-R, which is "3a35", is written as "0x35, 0x3A, 0x00, 0x00"
The code to add to the UHC2 device is:
CODE

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{
0x35, 0x3A, 0x00, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}

The device-ids for the six UHCI devices on the ICH10-R are:
CODE
UHCI 1: 1D    3a34
UHCI 2: 1D,1  3a35
UHCI 3: 1D,2  3a36
UHCI 4: 1A    3a37
UHCI 5: 1A,1  3a38
UHCI 6: 1A,2  3a39

The end result of the UHCI devices should look as follows:
CODE

Device (UHC1)
{
Name (_ADR, 0x001D0000)
[...]

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{
0x34, 0x3A, 0x00, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}

Device (UHC2)
{
Name (_ADR, 0x001D0001)
[...]

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{
0x35, 0x3A, 0x00, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}

Device (UHC3)
{
Name (_ADR, 0x001D0002)
[...]

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{
0x36, 0x3A, 0x00, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}

Device (UHC4)
{
Name (_ADR, 0x001A0000)
[...]

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{
0x37, 0x3A, 0x00, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}

Device (UHC5)
{
Name (_ADR, 0x001A0001)
[...]

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{
0x38, 0x3A, 0x00, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}

Device (UHC6)
{
Name (_ADR, 0x001A0002)
[...]

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x02)
{
"device-id",
Buffer (0x04)
{
0x39, 0x3A, 0x00, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}

Have fun patching.

Verifying the Reliability of Sleep
You need to be aware that if your machine has never slept before, you may encounter surprises when using sleep now that it works. In order to be able to attribute any issues you may experience to sleep, I strongly recommend a thorough burn-in procedure.

First, unplug all USB devices that you do not need, in particular any storage devices.
Then, in all the applications you typically use, open a few documents and leave them open.

Now put the machine to sleep at least a hundred times and wake it up afterwards.

This sounds like a big hassle, but if you have a second computer that is capable of doing all the work, it's not that bad. Using the PHP script below allows you to remotely sleep and wake up your machine any number of times without human intervention.
Attached File  sleep_wake.php.zip ( 1.51K ) Number of downloads: 576


You need to edit the variables "$target", "$hwaddr" and "$login". Run the script with one argument, e.g.
CODE
/path/to/sleep-wake.php 100
will sleep and wake up your machine 100 times.
Note that for wake-up to work, UDP port 9 must be open. For sleep to work, SSH needs to be enabled and you need a public key installed on the target in order to allow automatic login. How to achieve this is outside the scope of this tutorial.
PM Profile Card
Go to the top of the page
+ Quote Post

Posts in this topic
- zhell   DSDT: trick retail drivers by changing "device-id" (e.g USB)   May 26 2009, 02:00 PM
- - kizwan   Very interesting. Do you know any other Intel chi...   May 26 2009, 04:33 PM
|- - zhell   QUOTE (kizwan @ May 26 2009, 05:33 PM) Ve...   May 26 2009, 04:19 PM
|- - kizwan   QUOTE (zhell @ May 27 2009, 12:19 AM) Tha...   May 28 2009, 02:21 AM
- - Master Chief   Okay... so first we had a patched kext (IOUSBFamil...   May 26 2009, 05:46 PM
|- - zhell   QUOTE (Master Chief @ May 26 2009, 06:46 ...   May 26 2009, 07:54 PM
|- - Master Chief   QUOTE (zhell @ May 26 2009, 08:54 PM) ......   May 27 2009, 01:41 AM
- - BlackCH   Looks good! I tryed it on a P5K-VM (ICH9). It ...   May 26 2009, 06:42 PM
|- - Master Chief   QUOTE (BlackCH @ May 26 2009, 07:42 PM) L...   May 26 2009, 07:23 PM
|- - zhell   QUOTE (BlackCH @ May 26 2009, 07:42 PM) L...   May 26 2009, 08:23 PM
- - downlord   Looks very promising. Will have a try ASA I upgrad...   May 26 2009, 08:04 PM
- - coconup   indeed I solved every sleep issue related to usb b...   May 26 2009, 09:26 PM
|- - zhell   QUOTE (coconup @ May 26 2009, 10:26 PM) i...   May 27 2009, 09:11 AM
- - kulos   Hi Tried your method on my GA-EP35-DS4. It didn...   May 27 2009, 01:35 AM
|- - Master Chief   QUOTE (kulos @ May 27 2009, 02:35 AM) Hi ...   May 27 2009, 02:32 AM
|- - kulos   QUOTE (Master Chief @ May 27 2009, 03:32 ...   May 27 2009, 07:27 AM
- - sama7896   Any chance this can be applied to a atheros 5006 w...   May 27 2009, 04:45 AM
- - Aranius   Could hthis possibly be working with ICH9M Chipset...   May 27 2009, 09:53 AM
|- - zhell   QUOTE (Aranius @ May 27 2009, 10:53 AM) C...   May 27 2009, 09:58 AM
|- - BlackCH   QUOTE (Aranius @ May 27 2009, 09:53 AM) A...   May 27 2009, 03:06 PM
|- - zhell   QUOTE (BlackCH @ May 27 2009, 04:06 PM) I...   May 27 2009, 03:16 PM
- - BlackCH   With the modded plist (inserted 8056 id): With ...   May 27 2009, 04:03 PM
- - Master Chief   I seem to be using the same network adapter (built...   May 27 2009, 06:45 PM
|- - BlackCH   QUOTE (Master Chief @ May 27 2009, 06:45 ...   May 27 2009, 08:54 PM
|- - Master Chief   QUOTE (BlackCH @ May 27 2009, 09:54 PM) T...   May 28 2009, 08:45 AM
|- - zhell   QUOTE (Master Chief @ May 28 2009, 09:45 ...   May 28 2009, 09:00 AM
|- - Master Chief   QUOTE (zhell @ May 28 2009, 10:00 AM) Sli...   May 28 2009, 10:54 AM
- - CPT_MAC   Hi, same problem no automatic sleep. But since I u...   May 27 2009, 06:45 PM
- - rx782p   Unfortunately the issue of my USB was not able to ...   May 28 2009, 07:28 AM
|- - zhell   QUOTE (rx782p @ May 28 2009, 08:28 AM) Un...   May 28 2009, 08:24 AM
|- - rx782p   @zhell My problem is EHCI Host Controller, does no...   May 28 2009, 01:06 PM
|- - zhell   QUOTE (rx782p @ May 28 2009, 02:06 PM) @z...   May 28 2009, 01:28 PM
|- - rx782p   QUOTE (zhell @ May 28 2009, 10:28 PM) Try...   May 28 2009, 03:20 PM
|- - zhell   QUOTE (rx782p @ May 28 2009, 04:20 PM) I ...   May 28 2009, 04:07 PM
|- - rx782p   Information on my Motherboard is as follows: Intel...   May 29 2009, 05:36 AM
- - kizwan   Hi zhell, Sorry, another slightly off-topic. I ha...   May 28 2009, 11:14 AM
|- - zhell   QUOTE (kizwan @ May 28 2009, 12:14 PM) So...   May 28 2009, 11:17 AM
|- - BlackCH   QUOTE (kizwan @ May 28 2009, 11:14 AM) So...   May 28 2009, 01:23 PM
- - kidalive   Hi, Zhell. Here is the my problem with sleep. I go...   May 28 2009, 12:06 PM
- - atka   First which sleep problem does this fix? Mine jus...   May 28 2009, 12:21 PM
|- - zhell   QUOTE (atka @ May 28 2009, 01:21 PM) Firs...   May 28 2009, 12:37 PM
- - Master Chief   zhell, you want us to add this: CODE Method (_DSM,...   May 28 2009, 12:49 PM
|- - zhell   QUOTE (Master Chief @ May 28 2009, 01:49 ...   May 28 2009, 01:05 PM
|- - Master Chief   QUOTE (zhell @ May 28 2009, 02:05 PM) The...   May 29 2009, 11:44 AM
|- - zhell   QUOTE (Master Chief @ May 29 2009, 12:44 ...   May 30 2009, 11:39 AM
- - Bart86   We have found that having a disk in the DVD drive ...   May 28 2009, 03:24 PM
- - ontoid   Great!!! It works for me. Cheating USB...   May 28 2009, 09:49 PM
|- - zhell   QUOTE (ontoid @ May 28 2009, 10:49 PM) Gr...   May 28 2009, 09:58 PM
- - BlackCH   I confirm it works to fake ICH9 SATA (with ICH10 i...   May 29 2009, 12:43 AM
- - atka   Thanks for the info it didn't fix sleep for me...   May 29 2009, 01:58 AM
- - SMF   I'm interested in the ICH10 fix (I have a Giga...   May 29 2009, 02:44 AM
- - atka   Well for ICH10 I post this at the end of my Device...   May 29 2009, 02:59 AM
- - mitch_de   Here is my part of USB dsdt for an GA-EP35 DS3 (IC...   May 29 2009, 04:32 AM
|- - SMF   QUOTE (mitch_de @ May 28 2009, 11:32 PM) ...   May 29 2009, 10:55 AM
- - Master Chief   I wonder if you checked your BIOS settings for som...   May 29 2009, 11:06 AM
|- - rx782p   QUOTE (Master Chief @ May 29 2009, 08:06 ...   May 30 2009, 12:02 PM
|- - Master Chief   QUOTE (rx782p @ May 30 2009, 01:02 PM) Th...   May 30 2009, 02:19 PM
- - mitch_de   Little bit oftopic: The new Chameleon RC1 has some...   May 30 2009, 05:31 AM
- - SMF   I'm interested in a couple of items and would ...   May 30 2009, 11:19 AM
- - stellarola   I'm not on my home computer right now, but I...   May 30 2009, 03:26 PM
- - rx782p   I removed moded subsystem-vondor-id form DSDT, Bec...   May 31 2009, 05:24 AM
- - rcfa   A quick question: is that limited to USB, or can t...   May 31 2009, 10:07 PM
|- - Master Chief   QUOTE (rcfa @ May 31 2009, 11:07 PM) A qu...   May 31 2009, 10:44 PM
|- - rcfa   QUOTE (Master Chief @ May 31 2009, 05:44 ...   Jun 1 2009, 01:11 AM
|- - zhell   QUOTE (rcfa @ Jun 1 2009, 02:11 AM) Well,...   Jun 1 2009, 10:12 AM
- - SMF   Well I'm learning more as I go. My Gigabyte P...   Jun 3 2009, 08:12 PM
|- - zhell   QUOTE (SMF @ Jun 3 2009, 09:12 PM) Well I...   Jun 3 2009, 08:31 PM
- - SMF   zhell, Thanks for the feedback. Changing the USB...   Jun 4 2009, 10:48 AM
|- - roisoft   QUOTE (SMF @ Jun 4 2009, 12:48 PM) zhell,...   Jun 7 2009, 04:51 PM
- - Drfrag   Note: Automatic sleep after an idle period is not ...   Jun 7 2009, 04:22 PM
- - SMF   roisoft, Once again giving me good input for my D...   Jun 7 2009, 06:19 PM
- - roisoft   you have a syntax error, replace CODEReturn ...   Jun 8 2009, 09:46 AM
|- - SMF   QUOTE (roisoft @ Jun 8 2009, 04:46 AM) yo...   Jun 9 2009, 12:06 AM
- - roisoft   RE: DSDT: trick retail drivers by changing "device-id" (e.g USB)   Jun 9 2009, 01:11 AM
- - eberts   Hi roisoft, how or where do you inject those ssdt ...   Jun 9 2009, 08:53 AM
- - SMF   roisoft, Tried both Mandriva and KUbuntu live CD...   Jun 9 2009, 11:14 PM
- - mimayin   modified dsdt made no difference to my sleep probl...   Jun 14 2009, 03:41 PM
|- - zhell   QUOTE (mimayin @ Jun 14 2009, 04:41 PM) m...   Jun 15 2009, 10:37 AM
|- - rcfa   QUOTE (zhell @ Jun 15 2009, 05:37 AM) Che...   Jun 15 2009, 07:16 PM
|- - zhell   QUOTE (rcfa @ Jun 15 2009, 08:16 PM) We r...   Jun 16 2009, 12:20 PM
- - Boombeng   Hi, I tried the method on a P5K-se (P35 ICH9) who...   Jun 17 2009, 04:50 PM
- - enb14   Guys this is my DSDT.dsl file of my DP45SG motherb...   Jun 17 2009, 10:14 PM
|- - zhell   QUOTE (enb14 @ Jun 17 2009, 11:14 PM) Guy...   Jun 23 2009, 09:09 PM
- - lukamar   Hi!! Great work zhell!! I confirm...   Jul 1 2009, 12:31 AM
|- - zhell   QUOTE (lukamar @ Jul 1 2009, 01:31 AM) Hi...   Jul 1 2009, 12:42 AM
|- - lukamar   QUOTE (zhell @ Jul 1 2009, 01:42 AM) Than...   Jul 1 2009, 12:48 AM
||- - zhell   QUOTE (lukamar @ Jul 1 2009, 01:48 AM) Tn...   Jul 1 2009, 12:53 AM
|- - enb14   QUOTE (zhell @ Jun 30 2009, 06:42 PM) Get...   Jul 1 2009, 03:57 AM
- - lukamar   He he he..tnx man. But I havn't resolved with ...   Jul 1 2009, 01:06 AM
- - zhell   Great, thanks for letting me know about those debu...   Jul 1 2009, 06:34 AM
- - enb14   this is what I got so look at my USB error log.   Jul 2 2009, 03:12 AM
|- - zhell   QUOTE (enb14 @ Jul 2 2009, 04:12 AM) this...   Jul 2 2009, 10:24 AM
|- - enb14   QUOTE (zhell @ Jul 2 2009, 04:24 AM) CODE...   Jul 3 2009, 03:47 PM
- - Cheezmen   Is there a separate guide or place i can get info ...   Jul 2 2009, 05:10 AM
|- - zhell   QUOTE (Cheezmen @ Jul 2 2009, 06:10 AM) I...   Jul 2 2009, 10:21 AM
- - bullys   hi guys, i am a very noob on patching dsdt so an...   Jul 2 2009, 10:22 AM
- - bullys   none of this works for me ( i dont have UHCI in my...   Jul 2 2009, 05:03 PM
- - Cheezmen   Thanks, that guide did help Now my computer goes...   Jul 3 2009, 07:27 AM
- - kdawg   zhell, what would happen if you tried to patch the...   Jul 20 2009, 10:56 AM
- - zhell   QUOTE (kdawg @ Jul 20 2009, 11:56 AM) zhe...   Jul 20 2009, 11:41 AM
4 Pages V   1 2 3 > » 

Reply to this topic Start new topic

4 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
3 Members: Arrte, Noltari, wujiaye

 

RSS Lo-Fi Version Time is now: 31st July 2010 - 02:02 PM