Jump to content

Custom DSDT for Lenovo T510-4313 Thinkpad


theaussiepea
 Share

7 posts in this topic

Recommended Posts

DSDT.aml file for Lenovo T510-4313

 

I've posted a guide for installing OSX 10.6.8 on a Lenovo T510 Thinkpad here:

http://www.insanelym...howtopic=274162

 

This post details the modifications I've made to the DSDT file to better work with OSX

 

This DSDT file was saved and decompiled by using an Ubuntu Live CD, and then edited with DSDTSE.

See the tutorial here: http://aserebln.blog...epare-dsdt.html

And the software here: http://www.osx86.es/?p=610

 

Most edits came from this guide for a T60 Thinkpad:

http://forum.thinkpa...php?f=5&t=85344

 

Here's what is changed in the DSDT file, one fix at a time. The lines that discribe the fixes are commented out with /* */ so that you can see where the new code was added.

 

Compile Error:

 

First, lets remove all compile warnings and errors, to clean up the code. There is an "*" hidden in the DSDT code, which isn't allowed by the IASL compiler. So first we remove that.

 

Replace this:

Device (WMI1)
{
Name (_HID, "*pnp0c14")
Name (_UID, "MXM2")

 

With this:

Device (WMI1)
{
/* Fix - Remove * from "*pnp0c14" to prevent compile error */
Name (_HID, "pnp0c14")
Name (_UID, "MXM2")

 

Compile Warnings:

 

Next we want to get rid of the compile warnings. This is optional, because the DSDT file will still function fine, even with warnings

 

Example compile warning

 

5366: If (LFLS ()) Warning  1093 - Called method may not always return a value ^

 

Many of the Methods in the DSDT don't return a value if none of the code is specifically applied. All we need to do is add a line "Return (Zero)" at the end of the Method, before the final "}". For example:

 

Method (LFLS, 0, NotSerialized)
{
Name (TMPB, Buffer (0x02)
{
	0x00, 0x00
})
CreateByteField (TMPB, 0x00, LPCT)
CreateByteField (TMPB, 0x01, SSUM)
TPHY (0x00)
Store (PH02, LPCT)
If (LPCT)
{
	Store (0x00, SSUM)
	Add (SSUM, PH01, SSUM)
	Add (SSUM, PH02, SSUM)
	Add (SSUM, PH03, SSUM)
	Add (SSUM, PPRQ, SSUM)
	Add (SSUM, PPLO, SSUM)
	Add (SSUM, PPRP, SSUM)
	Add (SSUM, PPOR, SSUM)
	Add (SSUM, TPRS, SSUM)
	Add (SSUM, TPMV, SSUM)
	Add (SSUM, MOR, SSUM)
	Add (SSUM, RSV0, SSUM)
	If (SSUM) {}
	Else
	{
		Return (0x00)
	}

	Return (0x02)
}
/* Fix - Remove LFLS Compile Warnings */
Return (Zero)
/* Fix End */
}

 

Do the same for Methods _Q15, _Q16, MXDS, _DSM (apply this fix for the methods referenced in the warnings that compiler returns)

 

Display Brightness:

 

Above "Device (LNKA)" add code to enable the brightness slider in the System Preferences

 

/* Fix - Enable Brightness Slider */
Device (PNLF)
{
	Name (_HID, EisaId ("APP0002"))
	Name (_CID, "backlight")
	Name (_UID, 0x0A)
	Name (_STA, 0x0B)
}
/* Fix End */

Device (LNKA)

 

Keyboard:

 

Enable Fn Keys on the keyboard, including shutdown menu when you press the power button

 

Device (KBD)
{
Name (_HID, EisaId ("PNP0303"))
Name (_CID, EisaId ("PNP030B")) /* Fix */
/* Fix - Enable Fn Keys on Keyboard */
Method (_DSM, 4, NotSerialized)
{
	Store (Package (0x02)
	{
		"AAPL,has-embedded-fn-keys",
		Buffer (0x04)
		{
			0x01, 0x00, 0x00, 0x00
		}
	 }, Local0)
	 DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
	 Return (Local0)
}
/* Fix End */

 

Video:

 

Video Injection to enable brightness. Don't forget to comment out the original _DSM method below, after you add a new one

 

Device (VID)
{
Name (_ADR, 0x00)
Name (_SUN, 0x0B) /* Fix */
OperationRegion (VPCG, PCI_Config, 0x00, 0x0100)
Field (VPCG, DWordAcc, NoLock, Preserve)
{
	Offset (0x64),
	VPWR,   8
}

Name (_S3D, 0x03)
Method (_INI, 0, NotSerialized)
{
	\VUPS (0x02)
	Store (\VCDL, VQDL)
	Store (\VCDC, VQDC)
	Store (\VCDT, VQD0)
	Store (\VCDD, VQD1)
}

/* Fix - Video Driver Injection to Enable LCD Brightness */
Method (_DSM, 4, NotSerialized)
{
	Store (Package (0x06)
	{		   					
		"AAPL,backlight-control",
		Buffer (0x04)
		{
			0x01, 0x00, 0x00, 0x00								
		},						
		"@0,backlight-control",
		Buffer (0x04)
		{
	   	  0x01, 0x00, 0x00, 0x00
		},
		"@0,pwm-info",
		Buffer (0x14)
		{
	   	 0x01, 0x14, 0x00, 0x64, 0xA8, 0x61, 0x00, 0x00,
	   	 0x1C, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
	   	 0x00, 0x04, 0x00, 0x00
		}
	}, Local0)
  	 DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
  	 Return (Local0)
}
/* Fix End */

…
Method (_STA, 0, NotSerialized)
{
	If (\_SB.PCI0.VID.ISOP ())
	{
		Return (0x0F)
	}

	If (And (RISA (0x118E), 0x02))
	{
		Return (0x0F)
	}
	Else
	{
		Return (0x00)
	}
}

/* Fix - Disable _DSM here for Video Injection Above
Method (_DSM, 4, NotSerialized)
{
	If (\CMPB (Arg0, Buffer (0x10)
	{
		0xF8, 0xD8, 0x86, 0xA4, 0xDA, 0x0B, 0x1B, 0x47,
		0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0
	}))
	{
		Return (NVOP (Arg0, Arg1, Arg2, Arg3))
	}
	Return (\_SB.PCI0.VID._DSM (Arg0, Arg1, Arg2, Arg3))
}
Fix End */

 

Sleep:

 

Sleep works fine, including when you close the lid, except for the fact that one of the USB devices immediately wakes the machine. If the lid is closed, the computer goes to sleep and wakes back up in an endless cycle. This code fixes it. Add within the "Device (EHC2)" section, before "Device (URTH)"

(from http://osx86.co/f36/...dsdt-fix-t3849/)

 

Device (EHC2)
...
  /* Fix - Prevent EHC2 (Bluetooth, Camera, and Fingerprint) waking from Sleep */
  Method (_DSM, 4, NotSerialized)
  {
  Store (Package (0x02)
  {
	 "AAPL,clock-id",
	 Buffer (0x01)
	 {
		0x02
	 }
  }, Local0)
  DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
  Return (Local0)
  }
  /* Fix End */

  Device (URTH)

 

Shutdown:

 

Shut down almost works, but the system fan and power button LED are not powered down, unless you use this code. Take a look at my DSDT file to see where it goes.

(from http://www.insanelym...ic=246491&st=20)

 

/* Fix - Shutdown */
OperationRegion (PMRS, SystemIO, 0x1030, 0x13)
Field (PMRS, ByteAcc, NoLock, Preserve)
  {
  , 4,
  SLPE, 1,
  }
/* Fix End */
Method (\_PTS, 1, NotSerialized)
  {
  /* Fix - Shutdown cont */
  If (LEqual (Arg0, 0x05))
  {
  Store (Zero, SLPE)
  Sleep(0x10)
  }
  Else
  {
  /* Fix End  (also extra bracket below) */
  Store (0x01, Local0)
…
  \_SB.PCI0.LPC.EC.HKEY.WGPS (Arg0)
  }
  } /* Fix */
}

 

Enable PCI root auto-detection for the bootloader:

 

Device (PCI0)
{
  Name (_BBN, 0x00)
  Name (_ADR, 0x00)
  /* Fix - UID for PCI root auto-detection */
  Name (_UID, Zero)
  /* Fix End */

 

HPET Fixes:

 

Note part is commented out, the other part is added

 

Device (HPET)
{
  Name (_HID, EisaId ("PNP0103"))
  Name (_CID, EisaId ("PNP0C01")) /* Fix minor */
  Method (_STA, 0, NotSerialized)
  {
  /* Fix - HPET fix
  If (LAnd (\WNTF, LNot (\WXPF)))
  {
	 Return (0x00)
  }
  Else
  {
  */	
  Return (0x0F)
  /* }

  Return (0x00)
  Fix End */
  }

  Name (_CRS, ResourceTemplate ()
  {
  /* Fix - HPET fix */
  IRQNoFlags ()
	 {0}
  IRQNoFlags ()
	 {2}
  IRQNoFlags ()
	 {8}
  /* Fix End */
  Memory32Fixed (ReadOnly,
	 0xFED00000,		 // Address Base
	 0x00000400,		 // Address Length
  )
  })
  }

 

RTC:

 

Comment out the IRQNoFlags

 

Device (RTC)
{
  Name (_HID, EisaId ("PNP0B00"))
  Name (_CRS, ResourceTemplate ()
  {
  IO (Decode16,
	 0x0070,			 // Range Minimum
	 0x0070,			 // Range Maximum
	 0x01,			   // Alignment
	 0x02,			   // Length
	 )
  /* Fix - RTC fix
  IRQNoFlags ()
	 {8}
  Fix End */
  })
}

 

AC Adapter:

 

Recognize AC adapter (not technically necessary when using VoodooBattery.kext, but a good idea anyway)

 

Device (AC)
{
  Name (_HID, "ACPI0003")
  Name (_UID, 0x00)
  /* Fix - Enable AppleACAdapter driver */
  Name (_PRW, Package (0x02)
  {
  0x18,
  0x03
  })
  /* Fix End */
  Name (_PCL, Package (0x01)

 

Minor Fixes:

 

Device (PIC)
{
  Name (_HID, EisaId ("PNP0000"))
  Name (_CRS, ResourceTemplate ()
  {
  IO (Decode16,
	 0x0020,			 // Range Minimum
	 0x0020,			 // Range Maximum
	 0x01,			   // Alignment
	 0x02,			   // Length
	 )
  IO (Decode16,
	 0x00A0,			 // Range Minimum
	 0x00A0,			 // Range Maximum
	 0x01,			   // Alignment
	 0x02,			   // Length
	 )
  IO (Decode16,
	 0x04D0,			 // Range Minimum
	 0x04D0,			 // Range Maximum
	 0x01,			   // Alignment
	 0x02,			   // Length
	 )
  /* Fix minor
  IRQNoFlags ()
	 {2} */
  })
}

 

Device (TIMR)
{
  Name (_HID, EisaId ("PNP0100"))
  Name (_CRS, ResourceTemplate ()
  {
  IO (Decode16,
	 0x0040,			 // Range Minimum
	 0x0040,			 // Range Maximum
	 0x01,			   // Alignment
	 0x04,			   // Length
	 )
  /* Fix minor
  IRQNoFlags ()
	 {0} */
  })
}

 

DTGP:

 

Finally, you must add this method, which enables several of the other fixes above. Put it before "Name (WAKI,"

 

/* Fix - DTGP method  - supporting other fixes */
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)
}
/* Fix End */

Name (WAKI, Package (0x02)

 

This should help you with custom DSDTs for other Thinkpad models as well. Goodluck!

T510 DSDT.zip

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 3 years later...

wow this helped me a lot but.. i found a way to merge the brightness fix with current dsm

            Method (_DSM, 4, NotSerialized)
            {
                Store (Package (0x06)
                    {
                        "AAPL,backlight-control", 
                        Buffer (0x04)
                        {
                            0x01, 0x00, 0x00, 0x00
                        }, 

                        "@0,backlight-control", 
                        Buffer (0x04)
                        {
                            0x01, 0x00, 0x00, 0x00
                        }, 

                        "@0,pwm-info", 
                        Buffer (0x14)
                        {
                            /* 0000 */    0x01, 0x14, 0x00, 0x64, 0xA8, 0x61, 0x00, 0x00, 
                            /* 0008 */    0x1C, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 
                            /* 0010 */    0x00, 0x04, 0x00, 0x00
                        }
                    }, Local0)
                DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))// here i cut and let rest of oem dsm take over
                Name (CTOI, Zero)
                If (LEqual (Arg0, Buffer (0x10).........

 

no compile error!!  :drool:

 

the pnp0c14 needs CAPS for new iasl

Link to comment
Share on other sites

  • 3 months later...

Can someone please help me with my T510. I have everything working other than

 

1) Sleeps but immediately wakes up. I have applied patches suggested above for this

2) Brightness Slider works. However Brightness Slider setting is not saved between restarts.

3) VoodooHDA preferences also not saved between restarts (only mentioning in case there is any connection with 2)

 

I've attached my DSDT.

 

PS - This is with El Capitan 10.11.5

 

Thanks in advance.

DSDT-Patched-May2016.aml.zip

Link to comment
Share on other sites

If Brightness Slider works this means that DSDT is correctely patched.

Have you tried to repair permissions and rebuild cache?

 

Yes, like I said above, that was my problem why QE/CI was not working earlier. After that I have not installed any kexts. Just trying to get Sleep working with EHC2 dsdt patch. In the meantime I noticed brightness slider setting and voodoohda setting were not getting preserved. Where are these setting stored? I can check if they are getting saved and after restart if they are disappearing for some  reason. That might offer a clue may be?

 

In any case I can totally live with settings not getting saved. Just need to get "Resume after Sleep" to work.

 

PS - I dunno if this is also a clue. Fn + Brightness does not work. Other Fn keys do seem to work. i.e. if I use Fn + Sleep then it does accept the command.

Link to comment
Share on other sites

Brightness Preference problem fixed. Saw Rehabman has released IntelBacklight kext this month. Got it. Installed it. Boom!

Now if only I could get the Fn keys to work to adjust it. Will keep searching. I have KBD patch applied to my DSDT so not sure why Fn keys not working.

 

My Voodoo setting problem solved by putting VoodooHDASettingsEnabler to startup on login  :)

 

Now if I can only get my "resume after sleep" problem solved  :(. I double and triple checked my DSDT patch. I dunno why it works for all but not me.

Link to comment
Share on other sites

 Share

×
×
  • Create New...