Jump to content

Lenovo ThinkPad T420 with UEFI Only


K0gen
 Share

5,282 posts in this topic

Recommended Posts

@verleihnix 

 

i would do this:

 

sudo rm -rf /System/Library/Extension/AppleHDA.kext

install AppleHDA.kext with Kext Utility.app

Bungo posted something interesting here http://www.insanelymac.com/forum/topic/296358-mavericks-1092-released/?p=2002345

 

in my case it looks quite similar. built-in in en0 and en1 is false and HDA is not loaded.

Link to comment
Share on other sites

@verleihnix - so did that fix your HDA? what device is your ethernet? mine is en0.

 

@plinux - well a few things.

1) i presume you are using the OEM config.plist with the kext patch for SNBGraphicsBuffer?

2) the VGA port works only when you restart with the monitor plugged in. it will not do a live detect like the DisplayPort.  and speaking of that,  I would be connecting that monitor by the DisplayPort (unless you are just trying to test the VGA port).

 

I bought 2 adapters -  

(1) DisplayPort to VGA adapter which will live detect a VGA 

and

(2) DisplayPort to HDMI - which allows me to attach to any LCD TV or other HDMI device (including audio)

  • Like 1
Link to comment
Share on other sites

Hi tluck,

 

I hope my discovery ends the long time struggle against the UEFI sleep issue.

 

Please use MaciASL to open dsdt.dsl and dsdt.aml together and search _Y00. You will find the difference.

 

My solution is to turn off all iasl optimizations to compile dsdt.dsl.

 

I use "iasl -oa dsdt.dsl". Then use MaciASL to open dsdt.dsl and dsdt.aml again and search _Y00 to see the result.

 

My UEFI system can sleep now.

 

You can find the most recent iasl from the MaciASL/contents/MacOS folder.

 

I added some more info below.

 

Original version is here:

            Name (BUFA, ResourceTemplate ()
            {
                IRQ (Level, ActiveLow, Shared, _Y00)
                    {}
            })
            CreateWordField (BUFA, \_SB.LNKA._Y00._INT, IRA1)  // _INT: Interrupts

 

 

Optimized version is here:

            Name (BUFA, ResourceTemplate ()
            {
                IRQ (Level, ActiveLow, Shared,  )
                    {}
            })
            CreateWordField (BUFA, One, IRA1)

 

 

You will find _Y01, _Y02, ... are optimized.

 

 

I also test this method with 10.8.5 and it works too.

Edited by zhangqq
Link to comment
Share on other sites

@verleihnix - so did that fix your HDA? what device is your ethernet? mine is en0.

 

@plinux - well a few things.

1) i presume you are using the OEM config.plist with the kext patch for SNBGraphicsBuffer?

2) the VGA port works only when you restart with the monitor plugged in. it will not do a live detect like the DisplayPort.  and speaking of that,  I would be connecting that monitor by the DisplayPort (unless you are just trying to test the VGA port).

 

I bought 2 adapters -  

(1) DisplayPort to VGA adapter which will live detect a VGA 

and

(2) DisplayPort to HDMI - which allows me to attach to any LCD TV or other HDMI device (including audio)

 

Hi tluck,

 

thanks,

 

I will check the way you mentioned.

1> yes, i use the OEM config.plist instead. 

I already have one VGA cable.So I want to try if it works. Do i need replace the AppleIntelHDGraphicFB.kext (I'm not sure the kext name is right)?

the testing on VGA is for checking the function of system if it work with the external monitor .if the system works then will get  a DP cable.

Link to comment
Share on other sites

@verleihnix - so did that fix your HDA? what device is your ethernet? mine is en0.

 

 

I workaround/fixed it using device-properties string for Ethernet and HDEF in org.chameleon.Boot.plist.

 

It has something to do with update to 10.9.2. I verified this with a complete new install of 10.9.0 to 10.9.1 to 10.9.2.

First I tried to put built-in statements in dsdt but maybe I did it wrong or it won't work.

 

Maybe you can assist to try it with dsdt again.

Link to comment
Share on other sites

@verleihnix - weird. i don't recall any HDEF changes in my DSDT in a long time!  I take it you have your own custom DSDT. what are you asking? I did not understand your request. happy to help.

 

 

@zhanqq - interesting find. and its great you have a fix for sleep in your case. to me seems very odd that compiling unoptimized makes a difference. 

 

In my case, since I have been on 10.9.2 and using recent clover 2636 i switched back to using UEFI boot (versus the MBR boot workaround). And it has working very well! i also started using some of the newer clover dsdt patches too. (was curious if i could boot without DSDT and use just clover to create the DSDT - worked by the way)  but not sure how much that fixed any of the UEFI problems....  but certainly can't hurt IMO. 

 

bottom line:  many of the previous UEFI quirks seem to be gone for me now.  it can sleep/wake fine - it does not go off into zombie land anymore when trying to sleep. the mute button works etc. i have not done a lot of testing yet so time will tell. But wow clover boots in 5 seconds for me very fast.

 

---  Notes:

 

 _Y00, _Y01, _Y02 etc are not set anywhere in the dsdt with so the optimization is that theses variables are zero or null i.e. no value set.

 

so these calls sould be the same:

 

IRQ (Level, ActiveLow, Shared, _Y00)

IRQ (Level, ActiveLow, Shared, )

 

from this doc: http://www.acpi.info/DOWNLOADS/ACPI_5_Errata%20A.pdf

 

19.5.63 IRQ (Interrupt Resource Descriptor Macro) Syntax 

IRQ (EdgeLevel, ActiveLevel, Shared, DescriptorName) {InterruptList} => Buffer 

EdgeLevel describes whether the interrupt is edge triggered (Edge) or level triggered (Level). The field DescriptorName. _HE is automatically created to refer to this portion of the resource descriptor, where ‘1’ is Edge and ActiveHigh and ‘0’ is Level and ActiveLow.

ActiveLevel describes whether the interrupt is active-high (ActiveHigh) or active-low (ActiveLow). The field DescriptorName. _LL is automatically created to refer to this portion of the resource descriptor, where ‘1’ is Edge and ActiveHigh and ‘0’ is Level and ActiveLow.

Shared describes whether the interrupt can be shared with other devices (Shared) or not (Exclusive), and whether it is capable of waking the system from a low-power idle or system sleep state (SharedAndWake or ExclusiveAndWake). The field DescriptorName. _SHR is automatically created to refer to this portion of the resource descriptor, where ‘1’ is Shared and ‘0’ is Exclusive. If nothing is specified, then Exclusive is assumed.

DescriptorName is an optional argument that specifies a name for an integer constant that will be created in the current scope that contains the offset of this resource descriptor within the current resource template buffer. The predefined descriptor field names may be appended to this name to access individual fields within the descriptor via the Buffer Field operators.

InterruptList is a comma-delimited list of integers in the range 0 through 15, at least one value is required. There may be no duplicates in the list. 

The IRQ macro evaluates to a buffer that contains an IRQ resource descriptor. The format of the IRQ descriptor can be found in “IRQ Descriptor” ((page 309). The macro produces the three-byte form of the descriptor. The macro is designed to be used inside of a ResourceTemplate (page 789).Arguments Description

Link to comment
Share on other sites

Hi tluck,

 

I studied dsdt.aml from a real MBP8,2 and found it is not optimized.

 

I think maybe the difference is here:

 

CreateWordField (BUFA, \_SB.LNKA._Y00._INT, IRA1)  // _INT: Interrupts

 

CreateWordField (BUFA, One, IRA1)

 

Do you know why \_SB.LNKA._Y00._INT always equals to One ?

 

The most interesting thing is my 10.8.5 UEFI system also works after I applied the new dsdt.aml.

 

(I manually did all other optimizations so I don't need iasl to do any optimizations for me. )

Link to comment
Share on other sites

@zhangqq - this is a bit beyond my experience - and i am just learning as i go.

 

the compiler does this to optimize the code... 

 

current.dsl    716:             CreateWordField (BUFA, \_SB.LNKA._Y00._INT, IRA1)

Optimize 6075 -                                       NamePath optimized ^  (_Y00._INT)

 

current.dsl    716:             CreateWordField (BUFA, \_SB.LNKA._Y00._INT, IRA1)

Optimize 6039 -              Integer optimized to single-byte AML opcode ^  (One)

 

current.dsl    719:                 And (\_SB.PCI0.LPC.PIRA, 0x8F, Local0)

Optimize 6075 -                        NamePath optimized ^  (^^PCI0.LPC_.PIRA)

 

current.dsl    722:                     ShiftLeft (0x01, Local0, IRA1)

Optimize 6039 -                                       ^ Integer optimized to single-byte AML opcode (One)

 

current.dsl    726:                     Store (0x00, IRA1)

Optimize 6039 -                                   ^ Integer optimized to single-byte AML opcode (Zero)

Link to comment
Share on other sites

The dsdt is small enough that code optimization benefits should be nil/negligible. If optimization is indeed generating buggy code, then that indicates a problem with the iasl compiler rather than clover. Good find. Perhaps it is in our best interests to use unoptimized dsdt's going forward, at least for the time being.

Link to comment
Share on other sites

Hi tluck,

 

current.dsl    719:                 And (\_SB.PCI0.LPC.PIRA, 0x8F, Local0)
Optimize 6075 -                        NamePath optimized ^  (^^PCI0.LPC_.PIRA)

 

It means we can manually change  And (\_SB.PCI0.LPC.PIRA, 0x8F, Local0) to And (^^PCI0.LPC.PIRA, 0x8F, Local0).

I think the reason is the latter code is shorter so it may(I'm not sure) be faster for AML interpreter to execute it.

 

current.dsl    722:                     ShiftLeft (0x01, Local0, IRA1)
Optimize 6039 -                                       ^ Integer optimized to single-byte AML opcode (One)

 

It means we can manually change ShiftLeft (0x01, Local0, IRA1) to ShiftLeft (One, Local0, IRA1).
 

current.dsl    726:                     Store (0x00, IRA1)
Optimize 6039 -                                   ^ Integer optimized to single-byte AML opcode (Zero)

 

It means we can manually change Store (0x00, IRA1) to Store (Zero, IRA1).

 

For IASL v4,  to change 0x01 to One and to change 0x00 to Zero are not always allowed.

For example Package(0x01) ==> Package(One) is not allowed for IASL v4( v5 is ok ).

 

I prefer to keep 0x01 and 0x00 without changed.

Edited by zhangqq
Link to comment
Share on other sites

@verleihnix - so did that fix your HDA? what device is your ethernet? mine is en0.

 

@plinux - well a few things.

1) i presume you are using the OEM config.plist with the kext patch for SNBGraphicsBuffer?

2) the VGA port works only when you restart with the monitor plugged in. it will not do a live detect like the DisplayPort.  and speaking of that,  I would be connecting that monitor by the DisplayPort (unless you are just trying to test the VGA port).

 

I bought 2 adapters -  

(1) DisplayPort to VGA adapter which will live detect a VGA 

and

(2) DisplayPort to HDMI - which allows me to attach to any LCD TV or other HDMI device (including audio)

 

You can live detect a VGA monitor once per boot by opening the Display Preferences, holding down the Option key, and pressing the "Detect Displays" button that magically appears

  • Like 1
Link to comment
Share on other sites

  _Y00, _Y01, _Y02 etc are not set anywhere in the dsdt with so the optimization is that theses variables are zero or null i.e. no value set.

 

 

 
DescriptorName is an optional argument that specifies a name for an integer constant that will be created in the current scope that contains the offset of this resource descriptor within the current resource template buffer. The predefined descriptor field names may be appended to this name to access individual fields within the descriptor via the Buffer Field operators. 
IRQ is not a function call, it is a macro. Therefore, it is (attempting to) declare the variable _Y00. Where _Y00._INT would contain the list of interrupts needed to interact with this PCI interrupt (PNP0C0F) device.
 
So indeed, this is potentially a bad optimization. Nice find.
 
However, that may be only part of the story, since the IRQ documentation also states that the IRQ {} list is required to have a least one value. Where _Y00._INT would be set equal to the bitmask representing the interrupt for the device.
 
I suspect the IRQ statements in _PRS (possible resources) and _CRS (current resources) sections manage to merge, resulting in the assignment of a value to _Y00._INT of some combination of {3,4,5,6,7,9,10,11} (and never the value One).
  • Like 1
Link to comment
Share on other sites

well glad we have something to think about! here is a snippet of DSDT from my h61n-usb DSDT. it hints that the optimization is correct or at least not atypical in this area. i notice that this dsdt adds 2 more interrupt values (14 15) - which i coincidentally i added to HPET (8,11,14,15) !  

 

 

            Name (BUFA, ResourceTemplate ()
            {
                IRQ (Level, ActiveLow, Shared, )
                    {3,4,5,6,7,9,10,11,12,14,15}
            })
            Name (BUFB, ResourceTemplate ()
            {
                IRQ (Level, ActiveLow, Shared, )
                    {}
            })
            CreateWordField (BUFB, One, IRQV)
            Device (LNKA)
            {
                Name (_HID, EisaId ("PNP0C0F"))
                Name (_UID, One)
                Method (_STA, 0, NotSerialized)
                {
                    And (PIRA, 0x80, Local0)
                    If (LEqual (Local0, 0x80))
                    {
                        Return (0x09)
                    }
                    Else
                    {
                        Return (0x0B)
                    }
                }
 
                Method (_PRS, 0, NotSerialized)
                {
                    Return (BUFA)
                }
 
                Method (_DIS, 0, NotSerialized)
                {
                    Or (PIRA, 0x80, PIRA)
                }
 
                Method (_CRS, 0, NotSerialized)
                {
                    And (PIRA, 0x0F, Local0)
                    ShiftLeft (One, Local0, IRQV)
                    Return (BUFB)
                }
 
                Method (_SRS, 1, NotSerialized)
                {
                    CreateWordField (Arg0, One, IRQ1)
                    FindSetRightBit (IRQ1, Local0)
                    Decrement (Local0)
                    Store (Local0, PIRA)
                }
            }
Link to comment
Share on other sites

@tluck

 

That means that your understanding of DSDT's is better than you realize (or let on). You manually corrected a problem due to an iasl optimization bug without realizing it. You, Manwe, and Zhangqq akk have proof positive that iasl optimizations are leaving out code that our platforms need to operate correctly.

Link to comment
Share on other sites

k.surachai - well the package is somewhat specific to the T420 ( DSDT and kexts AppleHDA.kext, Bluetooth).  But should be easy to modify for other laptops. The T420 is UEFI capable but i don't think the X201 is UEFI capable so then you then must install the Legacy MBR tools to boot the installer USB and/or the HD.

 

TLUCK,

 

I had able to install 10.9.2 on my X201 now. Would you be kind to help make modification on your package to make the (DSDT and kexts) to work for X201. Or giving your expert advice how to do it. Hope this not too much to ask. 

  

Note that the ThankPad X201 is using Intel i5 with IntelHD Graphics.

 

PS. Yes, I finished it on my ThinkPad T420 already and it work great. Now I need thing work on X201 too. ^.^

Link to comment
Share on other sites

@verleihnix - weird. i don't recall any HDEF changes in my DSDT in a long time!  I take it you have your own custom DSDT. what are you asking? I did not understand your request. happy to help.

 

Took your dsdt.dsl and modified the HDEF Part with built-in Statement. Same with IGBE and EXP2. That gave me back sound and en0/1 built-in equals true.

Did you ever got "service battery"? is there anything to do against, beside of battery replacement. Bat is not that bad, at least 2,5hr.

 

Additional I gave Clover (ESP) a try with a complete new install of 10.9.2.

It won't boot to Desktop without replacement of AppleACPIPlatform.kext 2.0.

Guess what, No Sound. It only works with built-in in dsdt. en0/1 worked with no change in dsdt.

Link to comment
Share on other sites

@verleihnix

There is no suppression for the battery warning. However, you're in luck as the batteries in these thinkpads are plugged and easily replaceable. And by easy I mean that you literally remove one screw to release the keyboard, and there it is. The part numbers for the battery are 02K7078 or 04W1642. A quick ebay search finds some for around $12.

 

And if you need completely illustrated instructions on how to replace the battery, just check out the service manual. I gotta hand it to lenovo, they seriously provide too much documentation. Here is the link for the manual for everyone's convenience:

 

https://www.google.com/url?sa=t&source=web&rct=j&ei=GQMjU-6ELvTq0QHh6ICgBA&url=http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/t420_t420i_hmm.pdf&cd=2&ved=0CCkQFjAB&usg=AFQjCNHDRObYib_ftrnEMeVKYBB9iG-JKQ&sig2=H4hxqJrTdQafHlSmEtie9Q

Link to comment
Share on other sites

@T520 users...

 

Any best advice on the setup of the bios ( Bluetooth off already ) ?

 

I have a 4gb T520 4243-ES2 with a second hard disk in a optical drive caddy so I can have OSX completely separate ( Disk 1 ). Windows is on the main internal drive ( Disk 0 ).

 

Using the instructions at the start of this thread I installed 10.8.4 to my USB key as well as Clover.

 

When I boot up the installer every thing seems to be loading OK and I start seeing the GUI to load up until it kernal panics all of a sudden and restarts the machine.

 

I have installed a Hackintosh before but this is a my first laptop.

 

Thanks 

 

Terran

 

Link to comment
Share on other sites

@Terran

 

The front page not been updated in some time, though most of the information is still relevant. I suggest, instead, that you follow tlucks's guide in this very thread. It's more up to date with more detail as well. The link to it is in his signature, but I'm sure he won't mind if I relink it here for your convenience:

 

http://www.insanelymac.com/forum/topic/285678-lenovo-thinkpad-t420-with-uefi-only/page-25?do=findComment&comment=1952283

 

However, be warned: we do not have an official 520 guide, so you may need to change some things, specifically, your DSDT. Though, you'll likely get a mostly-functional system without one as clover does its best atempt to generate one dynamically for you.

 

Also stick to 10.9 for now. Most of us are seeing success with it.

  • Like 1
Link to comment
Share on other sites

i just posted a new bundle in my guide (I will see if Kogen is still active to put a link to this new Guide on the top page).

 

Clover UEFI on T420 Guide

 

Notes:

--------------------

14-Mar-2014

  • Tweaked custom DSDT.aml files and config.plist to add current patching
    added OEM config.plist options: 
    1 ) config.plist - (default) to use the custom DSDT and WITH extra Clover patching
    2 ) config.nopatch.plist - (old way) uses custom DSDT but no Clover patching
    3 ) config.nodsdt.plist - testing - remove DSDT.aml and use built-in DSDT with Clover patching (Note: battery will not work)
     
  • Updated AppleIntelE1000e.kext v3.0.4.1
  • Updated FakeSMC.kext to v6.0.1148 

-------------------------------------------------------------

I am still not 100% convinced that the iasl optimization is doing anything bad - i see no difference personally - but sleep is working for me!

 

I have always posted a precompiled dsdt.aml file as well as the source dsdt.dsl so you can see the mods/edits/comments to create your dsdt etc and compile it however you like!

 

What I did mostly to update/add to this new DSDT I just posted is merge in a few recent clover mod/fixes. The new (default) config.plist will apply clover patches on top of the custom DSDT to continue to add more value.  Note: Clover can patch the built-in DSDT (bios version) and it get pretty much everything working (sound, sleep etc) with the exception of the Battery stuff. As i side effect, I posted config.nodsdt.plist to allow one to test etc.

 

@verleihnix

- see if this DSDT has the built-in stuff you might need?

- Battery- yeah i got a service battery flag in the menu-bar. so i used the Windows/Lenovo power management tool to "reset the battery". it discharges and recharges the battery and perhaps updates some parameters. anyway the notice went away in OSX after i ran this tool.

 

@Terran Brown - i can't recall if folks were able to boot OSX off a disk in the caddy - i recall some chatter about that - you may have to flip/flop etc.

Link to comment
Share on other sites

@verleihnix. odd these 3 devices already have the built-in parameter for me? glad its working for you now!

 

using ioreg -l|more and searched for built-in

 

but maybe EXP2 is picking built-in from my broadcom wifi (ARPT is added by clover).

the new DSDT i just posted adds built-in to IGBE device (and more )

Link to comment
Share on other sites

Hey!

 

Does anyone have an AppleHDA for 10.9.2 and X220? I believe my codec is a conexant 20672.

 

I successfully used the appended AppleHDA on 10.8.5.

 

Has anyone tried the approach described here on a thinkpad? http://www.tonymacx86.com/hp-probook-mavericks/118877-patch-applehda-kext-fly-clover-bootloader.html

 

Thanks for the help!

AppleHDA.kext.zip

Link to comment
Share on other sites

Actually, I just installed VoodooHDA 2.8.4 which works great so far.

 

One things that does not work out of the box is the displayport. Any idea where to begin? DSDT or missing kext?

 

Great work by the way! An installation was never so easy...

 

Thanks!

Link to comment
Share on other sites

i just posted a new bundle in my guide (I will see if Kogen is still active to put a link to this new Guide on the top page).

 

Clover UEFI on T420 Guide

 

Notes:

--------------------

14-Mar-2014

  • Tweaked custom DSDT.aml files and config.plist to add current patching

    added OEM config.plist options: 

    1 ) config.plist - (default) to use the custom DSDT and WITH extra Clover patching

    2 ) config.nopatch.plist - (old way) uses custom DSDT but no Clover patching

    3 ) config.nodsdt.plist - testing - remove DSDT.aml and use built-in DSDT with Clover patching (Note: battery will not work)

     

  • Updated AppleIntelE1000e.kext v3.0.4.1
  • Updated FakeSMC.kext to v6.0.1148 

-------------------------------------------------------------

I am still not 100% convinced that the iasl optimization is doing anything bad - i see no difference personally - but sleep is working for me!

 

I have always posted a precompiled dsdt.aml file as well as the source dsdt.dsl so you can see the mods/edits/comments to create your dsdt etc and compile it however you like!

 

What I did mostly to update/add to this new DSDT I just posted is merge in a few recent clover mod/fixes. The new (default) config.plist will apply clover patches on top of the custom DSDT to continue to add more value.  Note: Clover can patch the built-in DSDT (bios version) and it get pretty much everything working (sound, sleep etc) with the exception of the Battery stuff. As i side effect, I posted config.nodsdt.plist to allow one to test etc.

 

@verleihnix

- see if this DSDT has the built-in stuff you might need?

- Battery- yeah i got a service battery flag in the menu-bar. so i used the Windows/Lenovo power management tool to "reset the battery". it discharges and recharges the battery and perhaps updates some parameters. anyway the notice went away in OSX after i ran this tool.

 

@Terran Brown - i can't recall if folks were able to boot OSX off a disk in the caddy - i recall some chatter about that - you may have to flip/flop etc.

 

TLUCK,

 

I'm interested in your new approach (#3, remove DSDT.aml and use built-in DSDT with Clover patching) However, I found out that your "config.nodsdt.plist" still quoted to "dsdt.aml" which I believe that it will took the custom dsdt.aml under "ACPI/patched" (rather than using the built-in DSDT)

 

Pls kindly explain more about this new approach. Many tks.

Link to comment
Share on other sites

 Share

×
×
  • Create New...