Jump to content

Disabling NVIDIA Optimus card on all laptops


Whit3Spirit
 Share

345 posts in this topic

Recommended Posts

We do the same thing on the ProBook. You use an External declaration to gain access to the methods in SSDT from DSDT. These are the DSDT patches we use:

into definitionblock code_regex . insert
begin
External(\_SB_.PCI0.PEGP.DGFX._OFF, MethodObj)\n
External(\_SB_.PCI0.PEGP.DGFX._ON, MethodObj)\n
end;

into method label _PTS code_regex ([\s\S]*) replace_matched
begin
If (CondRefOf(\\_SB_.PCI0.PEGP.DGFX._ON)) { \\_SB_.PCI0.PEGP.DGFX._ON() }\n
%1
end;

into method label _WAK code_regex (Return\s+\(.*) replace_matched
begin
If (CondRefOf(\\_SB_.PCI0.PEGP.DGFX._OFF)) { \\_SB_.PCI0.PEGP.DGFX._OFF() }\n
%1
end;
The paths to _ON/_OFF may be different in your SSDT, so be sure to tweak the patch as necessary.

 

 

Rehab?

 

Just a question, Why do you turn the card on, on PTS?

Link to comment
Share on other sites

Rehab?

 

Just a question, Why do you turn the card on, on PTS?

We found that leaving the card in _OFF mode across sleep caused problems with restart and wake. So, in _PTS we restore via _ON, and _WAK turns it back off again.

  • Like 1
Link to comment
Share on other sites

I use already the latest Clover...how can I use it on the fly?

 

Go make this SSDT with clover in patched DSDT folder, normaly it's good for you. Remember to disable the DropOEM tables.

 

 

I'm not even touching the DSDT but only adding _DSM methods and other things that I need in a SSDT which is injected by Clover (DSDT free Clover config). The _PTS and _WAK methods do not exist in the SSDT where I have turned off the card. Can I reference to the _PTS and _ WAK in the SSDT? How? And will that overwrite the methods with the ones defined in DSDT? Thanks again.

 

My SSDT is similar to this one as decribed by Stevo here

DefinitionBlock ("SSDT-1.aml", "SSDT", 2, "APPLE ", "Optimus", 0x00001000)
{
    External (\_SB_.PCI0.PEG0, DeviceObj)
    External (\_SB_.PCI0.PEG0.PEGP._PS3, MethodObj)
    External (\_SB_.PCI0.PEG0.PEGP._DSM, MethodObj)
    Scope (\_SB.PCI0.PEG0)
    {
        Method (_INI, 0, NotSerialized)
        {
            \_SB.PCI0.PEG0.PEGP._DSM (Buffer (0x10)
                {
                    /* 0000 */   0xF8, 0xD8, 0x86, 0xA4, 0xDA, 0x0B, 0x1B, 0x47,
                    /* 0008 */   0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0
                }, 0x0100, 0x1A, Buffer (0x04)
                {
                     0x01, 0x00, 0x00, 0x03
                })
            If (One)
            {
                \_SB.PCI0.PEG0.PEGP._PS3 ()
            }
        }
    }
}
Link to comment
Share on other sites

RehabMan - I already have a patched DSDT that works :)

 

I'm just trying this new method of not using a patched DSDT and using Clover to do patching on the fly. I guess I will patch in the _PTS and _WAK sections of the DSDT using Clover.

One thing you could do is rename (with Clover search/replace patching) _PTS and _WAK (to something like ZPTS/ZWAK... make sure they are not used). Then from SSDT, you can define new _PTS and _WAK, that call back into DSDTs now renamed ZPTS/ZWAK and do the extra stuff you want them to do...

Go make this SSDT with clover in patched DSDT folder, normaly it's good for you. Remember to disable the DropOEM tables.

I don't think you understand completely what webcivilian is trying to do...

  • Like 1
Link to comment
Share on other sites

Go make this SSDT with clover in patched DSDT folder, normaly it's good for you. Remember to disable the DropOEM tables.

Always enable DropOEM when you use patched SSDT, or it will cause conflict between ssdt tables.

Link to comment
Share on other sites

One thing you could do is rename (with Clover search/replace patching) _PTS and _WAK (to something like ZPTS/ZWAK... make sure they are not used). Then from SSDT, you can define new _PTS and _WAK, that call back into DSDTs now renamed ZPTS/ZWAK and do the extra stuff you want them to do...

 

Good idea. Let me try it :)

Link to comment
Share on other sites

Restart still broken even after call the ON method on _PTS.

If you want another set of eyes, post ioreg (use IORegistryExplorer 2.1).

Link to comment
Share on other sites

OK here are the files. I have also included my modified SSDT and Clover patched DSDT. Also a patched DSDT which works.

 

Thanks again for your help.

I wasn't expecting ZPTS/ZWAK to be completely empty, but ok...

 

Looks like you just copied _WAK/_PTS to ssdt-2 and then patched (to call PINI/OPOF/etc).

 

Seems like it should work. And if I extract all your DSDT/SSDTs from ioreg and use "iasl -da *" I get successful disassembly. In addition, PNLF is loaded and attached to ACPIBacklight, so we know that ssdt-2 is loading ok.

 

Your next step would be to do some traces... Have you used ACPIDebug yet? https://github.com/RehabMan/OS-X-ACPI-Debug. It is very useful...

Link to comment
Share on other sites

I haven't used ACPIDebug yet. Let me try it and see if I find something. 

 

But can you check my working DSDT against the SSDTs. The ON and OFF methods are a little different and I'm just calling the PS3 methods from IGPU _DSM and there are no issues with restart.

Link to comment
Share on other sites

I haven't used ACPIDebug yet. Let me try it and see if I find something. 

 

But can you check my working DSDT against the SSDTs. The ON and OFF methods are a little different and I'm just calling the PS3 methods from IGPU _DSM and there are no issues with restart.

I didn't look at your "working DSDT." I assumed you were doing the *same* thing with your SSDT solution. Is that not the case? If so, why?

Link to comment
Share on other sites

There are some differences. Doix actually created the Optimus off DSDT patch for XPS laptops. I need some help understanding the difference.

I would try my way... then see if you can adapt to your desire for SSDT-based solution:

- patch SSDT to call _OFF from _INI

- patch _PTS to call _ON

- patch _WAK to call _OFF

 

I don't really think the "lets copy a bunch of code from SSDT into DSDT" technique is a good one.

Link to comment
Share on other sites

I don't understand all your work but :

 

- Why make a SSDT solution for disabled Optimus if the DSDT must be changed ?

- What is the technic for change the DSDT code on the fly in clover ? (for change WAK to ZWAK) Because if you make a SSDT solution, this is for those can't change their DSDT...

 

Can you post just a link for me so I can learn to change DSDT on the fly with clover ?

 

Thanks dudes

Link to comment
Share on other sites

@ Whit3Spirit - The DSDT doen't need to be changed because we can disable nvidia optimus from SSDT. My problem is that my computer won't restart but shutdown when I turn off Optimus so I was trying some suggestions given by Rehabman to turn on the card.

 

The technique is called Clover DSDT patching. You can read it here: http://clover-wiki.zetam.org/Configuration/ACPI#DSDT

Link to comment
Share on other sites

@ Whit3Spirit - The DSDT doen't need to be changed because we can disable nvidia optimus from SSDT. My problem is that my computer won't restart but shutdown when I turn off Optimus so I was trying some suggestions given by Rehabman to turn on the card.

 

The technique is called Clover DSDT patching. You can read it here: http://clover-wiki.zetam.org/Configuration/ACPI#DSDT

You can't, the _OFF method is called inevitably in _WAK and in _INI method and you can't call their method in a DSDT. Or i don't understand... ? :(

 

And thanks for Patches in Clovers, instructive !

Link to comment
Share on other sites

You can't, the _OFF method is called inevitably in _WAK and in _INI method and you can't call their method in a DSDT. Or i don't understand... ? :(

 

And thanks for Patches in Clovers, instructive !

I don't think you understand. You can call whatever method you want, no matter where it exists... just use External to reach it.

Link to comment
Share on other sites

I don't think you understand. You can call whatever method you want, no matter where it exists... just use External to reach it.

You can add PINI method in _WAK from SSDT then ?

 

Because you have to call the OFF method in the WAK method, not with and if you call WAK from SSDT with an External link, you can't modify it... No ?

 

Sorry if i have a very bad english :P i just learn with all your know :lol:

Link to comment
Share on other sites

You can add PINI method in _WAK from SSDT then ?

You use External to access a method defined elsewhere.

 

Because you have to call the OFF method in the WAK method, not with and if you call WAK from SSDT with an External link, you can't modify it... No ?

Not sure what you're asking.

Link to comment
Share on other sites

With clover patch :

 

Change :

Method (_WAK

base64 : TWV0aG9kIChfV0FL

 

To :

Method (PINI, 0, NotSerialized)
    {
        \_SB.PCI0.PEG0.PEGP._DSM (Buffer (0x10)
            {
                /* 0000 */   0xF8, 0xD8, 0x86, 0xA4, 0xDA, 0x0B, 0x1B, 0x47,
                /* 0008 */   0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0
            }, 0x0100, 0x1A, Buffer (0x04)
            {
                 0x01, 0x00, 0x00, 0x03
            })
        If (One)
        {
            \_SB.PCI0.PEG0.PEGP._PS3 ()
        }
​    }
Method (_WAK

base64 : TWV0aG9kIChQSU5JLCAwLCBOb3RTZXJpYWxpemVkKQ0KICAgIHsNCiAgICAgICAgXF9TQi5QQ0kwLlBFRzAuUEVHUC5fRFNNIChCdWZmZXIgKDB4MTApDQogICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgLyogMDAwMCAqLyAgIDB4RjgsIDB4RDgsIDB4ODYsIDB4QTQsIDB4REEsIDB4MEIsIDB4MUIsIDB4NDcsDQogICAgICAgICAgICAgICAgLyogMDAwOCAqLyAgIDB4QTcsIDB4MkIsIDB4NjAsIDB4NDIsIDB4QTYsIDB4QjUsIDB4QkUsIDB4RTANCiAgICAgICAgICAgIH0sIDB4MDEwMCwgMHgxQSwgQnVmZmVyICgweDA0KQ0KICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAweDAxLCAweDAwLCAweDAwLCAweDAzDQogICAgICAgICAgICB9KQ0KICAgICAgICBJZiAoT25lKQ0KICAgICAgICB7DQogICAgICAgICAgICBcX1NCLlBDSTAuUEVHMC5QRUdQLl9QUzMgKCkNCiAgICAgICAgfQ0K4oCLICAgIH0NCk1ldGhvZCAoX1dBSw==

 

Change :

Method (_WAK, 1, Serialized)
     {

Base64 : TWV0aG9kIChfV0FLLCAxLCBTZXJpYWxpemVkKQ0KICAgICB7

 

To :

Method (_WAK, 1, Serialized)
     {
         PINI ()

Base64 : TWV0aG9kIChfV0FLLCAxLCBTZXJpYWxpemVkKQ0KICAgICB7DQogICAgICAgICBQSU5JICgp

 

 

Change :

Method (_INI, 0, NotSerialized)
        {
            Store (0x07D0, OSYS)      

Base64 : TWV0aG9kIChfSU5JLCAwLCBOb3RTZXJpYWxpemVkKQ0KICAgICAgICB7DQogICAgICAgICAgICBTdG9yZSAoMHgwN0QwLCBPU1lTKQ==

 

To :

Method (_INI, 0, NotSerialized)
        {
            Store (0x07D0, OSYS)
            PINI()

Base64 : TWV0aG9kIChfSU5JLCAwLCBOb3RTZXJpYWxpemVkKQ0KICAgICAgICB7DQogICAgICAgICAgICBTdG9yZSAoMHgwN0QwLCBPU1lTKQ0KICAgICAgICAgICAgUElOSSgp

 

 

 

 

 

Like that in config.plist :

<key>Patches</key>
            <array>
                <dict>
                    <key>Find</key>
                    <data>TWV0aG9kIChfV0FL</data>
                    <key>Replace</key>
                    <data>TWV0aG9kIChQSU5JLCAwLCBOb3RTZXJpYWxpemVkKQ0KICAgIHsNCiAgICAgICAgXF9TQi5QQ0kwLlBFRzAuUEVHUC5fRFNNIChCdWZmZXIgKDB4MTApDQogICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgLyogMDAwMCAqLyAgIDB4RjgsIDB4RDgsIDB4ODYsIDB4QTQsIDB4REEsIDB4MEIsIDB4MUIsIDB4NDcsDQogICAgICAgICAgICAgICAgLyogMDAwOCAqLyAgIDB4QTcsIDB4MkIsIDB4NjAsIDB4NDIsIDB4QTYsIDB4QjUsIDB4QkUsIDB4RTANCiAgICAgICAgICAgIH0sIDB4MDEwMCwgMHgxQSwgQnVmZmVyICgweDA0KQ0KICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAweDAxLCAweDAwLCAweDAwLCAweDAzDQogICAgICAgICAgICB9KQ0KICAgICAgICBJZiAoT25lKQ0KICAgICAgICB7DQogICAgICAgICAgICBcX1NCLlBDSTAuUEVHMC5QRUdQLl9QUzMgKCkNCiAgICAgICAgfQ0K4oCLICAgIH0NCk1ldGhvZCAoX1dBSw==</data>
                </dict>
                <dict>
                    <key>Find</key>
                    <data>TWV0aG9kIChfV0FLLCAxLCBTZXJpYWxpemVkKQ0KICAgICB7</data>
                    <key>Replace</key>
                    <data>TWV0aG9kIChfV0FLLCAxLCBTZXJpYWxpemVkKQ0KICAgICB7DQogICAgICAgICBQSU5JICgp</data>
                </dict>
                <dict>
                    <key>Find</key>
                    <data>TWV0aG9kIChfSU5JLCAwLCBOb3RTZXJpYWxpemVkKQ0KICAgICAgICB7DQogICAgICAgICAgICBTdG9yZSAoMHgwN0QwLCBPU1lTKQ==</data>
                    <key>Replace</key>
                    <data>TWV0aG9kIChfSU5JLCAwLCBOb3RTZXJpYWxpemVkKQ0KICAgICAgICB7DQogICAgICAgICAgICBTdG9yZSAoMHgwN0QwLCBPU1lTKQ0KICAgICAgICAgICAgUElOSSgp</data>
                </dict>
            </array>

that's good ?

Link to comment
Share on other sites

Or you can just add an SSDT file and do the following without Clover patching the DSDT:

DefinitionBlock ("SSDT-1.aml", "SSDT", 2, "DELL ", "Optimus", 0x00001000)
{
    External (\_SB_.PCI0.PEG0.PEGP._PS3, MethodObj)    
    External (\_SB_.PCI0.PEG0.PEGP._DSM, MethodObj)    
    Method (\_SB._INI, 0, NotSerialized)
    {
        \_SB.PCI0.PEG0.PEGP._DSM (Buffer (0x10)
            {
                /* 0000 */   0xF8, 0xD8, 0x86, 0xA4, 0xDA, 0x0B, 0x1B, 0x47,
                /* 0008 */   0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0
            }, 0x0100, 0x1A, Buffer (0x04)
            {
                 0x01, 0x00, 0x00, 0x03
            })
        If (One)
        {
            \_SB.PCI0.PEG0.PEGP._PS3 ()
        }
    }
}

Link to comment
Share on other sites

Or you can just add an SSDT file and do the following without Clover patching the DSDT:

DefinitionBlock ("SSDT-1.aml", "SSDT", 2, "DELL ", "Optimus", 0x00001000)
{
    External (\_SB_.PCI0.PEG0.PEGP._PS3, MethodObj)    
    External (\_SB_.PCI0.PEG0.PEGP._DSM, MethodObj)    
    Method (\_SB._INI, 0, NotSerialized)
    {
        \_SB.PCI0.PEG0.PEGP._DSM (Buffer (0x10)
            {
                /* 0000 */   0xF8, 0xD8, 0x86, 0xA4, 0xDA, 0x0B, 0x1B, 0x47,
                /* 0008 */   0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0
            }, 0x0100, 0x1A, Buffer (0x04)
            {
                 0x01, 0x00, 0x00, 0x03
            })
        If (One)
        {
            \_SB.PCI0.PEG0.PEGP._PS3 ()
        }
    }
}

 

This only works if there is no _SB._INI already defined in DSDT.

Link to comment
Share on other sites

 Share

×
×
  • Create New...