Jump to content

Disabling NVIDIA Optimus card on all laptops


Whit3Spirit
 Share

345 posts in this topic

Recommended Posts

OK, I stand corrected. So for L502X it is _OFF/_ON. Still the way to turn the card off and make restart work doesn't change. Everything is the same as L702X inside those methods.

Seems like the only exception is calling \_SB.PCI0.PEG0.PEGP._DSM prior to calling _PS3 (as you have in post #253). It is very much a {censored} shoot with various computers as to whether to call _OFF or _PS3. Often times, they do the same thing.

 

No need to copy any code from SSDT to DSDT...

 

Given that the ACPI files seem totally different from what you're expecting, this should probably be verified (via inspection of the _DSM code) by the OP.

Link to comment
Share on other sites

  • 4 weeks later...

Hi!,i wanna kown does it work on AMD 8500/8700m series?There's a "Method(SGOF,xxx)" in my SSDT-3 and "Method(_OFF,xxx)" in SSDT-4,i am not very sure the relationship between SGOF and _OFF,can u give me some advice? If u are glad to,i am very happy to provide my DSDT&SSDTs! Thanks a lot!!

Link to comment
Share on other sites

Hi!,i wanna kown does it work on AMD 8500/8700m series?There's a "Method(SGOF,xxx)" in my SSDT-3 and "Method(_OFF,xxx)" in SSDT-4,i am not very sure the relationship between SGOF and _OFF,can u give me some advice? If u are glad to,i am very happy to provide my DSDT&SSDTs! Thanks a lot!!

You will need both files. To understand the relationship between SGOF and _OFF, read the code for each.

Link to comment
Share on other sites

  • 4 weeks later...

@demonbane,

 

SSDT-2.dsl has not had GFX0->IGPU rename. Also notice the same thing about your DSDT as loaded in ioreg. Also the rename you're attempting can be tricky and I may be getting confused (because I think you're also renaming PEGP->GFX0?). Since your focus is on disabling nvidia, I would leave the name PEGP.

 

You might want to cleanup the _DSM methods prior to patching.

 

And you might need to call from _REG instead as your _OFF method accesses EC registers and so you should be certain the EC is ready.

 

Note: I will also do some tests to see if I can find any order dependencies by testing with small examples. I haven't seen any, but then again, I tend to keep everything in the original order.

 

My Method SGOF is like this,  i must be certain the EC is ready too,yes?

Method (SGOF, 0, Serialized)
        {
               \rmdt.p1("SGOF enter")
            If (LEqual (CCHK (Zero), Zero))
            {
                \rmdt.p1("SGON enter1")
                Return (Zero)
            }
            \rmdt.p1("SGOF enter2")
            Store (Zero, ONOF) /* \_SB_.PCI0.PEG0.PEGP.ONOF */
            Store (LCTL, ELCT) /* \_SB_.PCI0.PEG0.PEGP.ELCT */
            Store (SVID, HVID) /* \_SB_.PCI0.PEG0.PEGP.HVID */
            Store (SDID, HDID) /* \_SB_.PCI0.PEG0.PEGP.HDID */
            Store (EMLW, DMLW) /* \_SB_.PCI0.PEG0.PEGP.DMLW */
            SPP0 ()
            Store (One, LNKD) /* \_SB_.PCI0.PEG0.LNKD */
            \rmdt.p1("SGOF enter3")
            While (LNotEqual (LNKS, Zero))
            {
                Sleep (One)
            }
            \rmdt.p1("SGOF enter4")
            Store (Zero, \_SB.PCI0.LPCB.EC.FDAT) /* External reference */
            Store (0xBF, \_SB.PCI0.LPCB.EC.FCMD) /* External reference */
            \rmdt.p1("SGOF enter5")
            Sleep (0x012C)
            \rmdt.p1("SGOF exit6")
            Return (Zero)
        }

So i call the _OFF after the _REG() when arg0=3/arg1=1. sometime it works to disable the nv options, but sometimes it do not work.

do i do it right?

 

I have  upload my ioreg and my aml(source and patched).

 

My problem is that after wake up from sleep, if i reboot the pc , i will be the black screen  state.

 

 

Thanks

ioreg and aml.zip

Link to comment
Share on other sites

 

Yes, it is easy in concept. It is the details that trip people up.

 

Details:

- you must find the appropriate _INI method (the _INI on a device related to your discrete card... the one with _OFF)

- older machines do not have _OFF but contain similar methods... you have to search for them (use your brain)

- errors are reduced with 'iasl -da' but you may still have errors... fix them prior to applying patches

- even after your files are patched, errors corrected, if you open the patched/compiled .aml files, your errors may come back. The errors are not real, as they are created by the disassembly process. Always disassemble in a group with 'iasl -da'

- edit the resulting .dsl files, not .aml files when making changes

- save the resulting files as .aml files (format: ACPI Machine Language Binary). Not surprisingly, AppleACPIPlatform does not like loading text files into ACPI.

- if you rename devices in DSDT, you must do the same rename in all SSDTs you plan on loading (eg. GFX0->IGPU, B0D3->HDAU must be done universally)

- SSDTs that contain duplicate method (any duplicate object, actually) definitions will be thrown away (eg. DTGP can be defined only in one place; best not to use DTGP)

- SSDTs must be placed where the bootloader will load them. Chameleon, in Extra: SSDT.aml, SSDT-1.aml, SSDT-2.aml, no gaps in the numbers (Chameleon stops at first file not found... at first gap). Clover, in EFI/CLOVER/ACPI/patched, SSDT.aml, SSDT-? (where ? is a digit), gaps in the numbers allowed.

- you must drop each OEM SSDT you are patching. Best strategy: drop them all, add the ones you need (patched or not patched)

- some people experience problems with sleep/restart/shutdown when the discrete card is left in the off state... call _ON from DSDT _PTS and _OFF from DSDT _WAK. Use External to access the methods from DSDT. You must refer to the actual path (eg. _SB.PCI0.PEGP.PEG0._OFF)

- if the device with _INI in it (eg. PEG0.PEGP) is not active, OS X will not call _INI. An inactive device is one that returns Zero from _STA. Usually points to other issues with DSDT...

- if you upgrade hardware or BIOS, you must repeat the process...

 

 

Having a basic understanding of ACPI, ACPI namespace, how SSDTs are loaded, goes a long way.

 

One way to troubleshoot an issue is to extract all *patched* DSDT/SSDTs *binaries* from your running system (from ioreg). Then disassemble them with 'iasl -da'. If iasl finds errors in loading all your DSDT/SSDTs into a namespace, so will OS X have the same problems.

 

 

 

 

how to extract all *patched* DSDT/SSDTs *binaries* from ioreg

Link to comment
Share on other sites

For the users, where _OFF method doesn't work:

 

The _OFF method works!

Its just not working for you, because you need to fix Offsets of your Operationregions!

 

Clover can do this automatically for you if you enable in config.plist under ACPI-->DSDT-->Fixes:

FixRegions_10000000  --> YES

NewWay_80000000 ---> YES

 

Sometimes Clover have a bug in Autofixing Operationregions in your custom DSDT.aml

So you need to do that yourself...

Just dump your Tables with F4 in Clover and compare Operationregion offsets with your custom DSDT...

 

Cheers!

Link to comment
Share on other sites

So I'm totally a beginner with this stuff called DSDT, SSDT, etc.. I dumped (is that really the right word?) my DSDT using Clover bootloader and pressed F4 in boot menu. I was pretty surprised there are lots of stuff in my EFI/CLOVER/ACPI/origin folder... but I resolved this by asking a friend to see which file I should be using.

 

My laptop has Optimus card as well and I just actually don't know what to do to follow the instructions. Is there anyone can help me to do it? I've attached my DSDT, which I only patched Low Res HD3000, kinda scared to edit anything there...

 

Please tell me if there is anything else I need to attach here :)

DSDT.aml.zip

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

I ask for an help to switch off my NVIDIA 610M 2Gb on my laptop ASUS k53SD (Yosemite 10.10). I extracted the DSDT and SSDTs files. It seems that _OFF, _ON and other methods are stored into DSDT file (no SSDT) and the graphic card is recognized as \_SB.PCI0.PEG0.GFX0. 

 

I used you guide to try to switch the card off, but no results. Can someone explain to me where I'm wrong?

 

I attach all the files of my laptop.

Thanks in advance!

 

 

DSDT and SSDT.zip

Link to comment
Share on other sites

Hello,

I ask for an help to switch off my NVIDIA 610M 2Gb on my laptop ASUS k53SD (Yosemite 10.10). I extracted the DSDT and SSDTs files. It seems that _OFF, _ON and other methods are stored into DSDT file (no SSDT) and the graphic card is recognized as \_SB.PCI0.PEG0.GFX0. 

 

I used you guide to try to switch the card off, but no results. Can someone explain to me where I'm wrong?

 

I attach all the files of my laptop.

Thanks in advance!

Since your _OFF method accesses the EC, you should call from _REG

 

Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LEqual (Arg0, 0x03))
                {
                    Store (Arg1, ECFL)
                    \_SB.PCI0.PEG0.GFX0._OFF()
                }
            }

 

Also, DOFF calls _OFF, so it may be more appropriate to use than _OFF. You'll have to experiment.

 

Warning: _OFF methods that access the EC are problematic.  Because you can't access the EC until _REG makes the EC available, the _OFF method is called later than it would if called from _INI, and sometimes the drivers can already be loading/loaded (causing a crash when the device suddenly turns off).

Link to comment
Share on other sites

Since your _OFF method accesses the EC, you should call from _REG

 

Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LEqual (Arg0, 0x03))
                {
                    Store (Arg1, ECFL)
                    \_SB.PCI0.PEG0.GFX0._OFF()
                }
            }
 

Also, DOFF calls _OFF, so it may be more appropriate to use than _OFF. You'll have to experiment.

 

Warning: _OFF methods that access the EC are problematic.  Because you can't access the EC until _REG makes the EC available, the _OFF method is called later than it would if called from _INI, and sometimes the drivers can already be loading/loaded (causing a crash when the device suddenly turns off).

Thank you for your answer!!! Now I have my NVIDIA card disabled! :-)

But...another little problemi: now the laptop does not completely shutdown. Everything going off except fans and leds. I already patched SSDT (as said into the guide). Have you any other suggestione to solve this final problemi?

 

Thank you for your kind support

Link to comment
Share on other sites

Thank you for your answer!!! Now I have my NVIDIA card disabled! :-)

But...another little problemi: now the laptop does not completely shutdown. Everything going off except fans and leds. I already patched SSDT (as said into the guide). Have you any other suggestione to solve this final problemi?

 

Thank you for your kind support

Was shutdown working prior to turning nvidia off?

Link to comment
Share on other sites

Sorry, I have another little problem: the laptop does noto go to sleep!

I already call the DON method inside _PTS and the DOFF method inside _WAK

 

Can you help me please to fix this last problem?

Thank you!!!

Do you have power management working? Did sleep work before? What happens when you attempt to sleep?

Finally fixed!!! I used your patch for the shutdown and it works!!! Everything is working now :-) thanks for your support!

Which patch are you referring to?

Link to comment
Share on other sites

Do you have power management working? Did sleep work before? What happens when you attempt to sleep?Which patch are you referring to?

The laptop seems to shutdown everything except fans. Leds are not intermittente, they are fixed. The sleep stopped working after the application of the patch to shutdown nVidia.

I think that power management is working because I can recognize the battery. Shutdown and reboot work correctely!!!

 

I'm refferring to the patch here: https://github.com/RehabMan/Laptop-DSDT-Patch/tree/master/system

 

Thank you!

Link to comment
Share on other sites

The laptop seems to shutdown everything except fans. Leds are not intermittente, they are fixed. The sleep stopped working after the application of the patch to shutdown nVidia.

I think that power management is working because I can recognize the battery. Shutdown and reboot work correctely!!!

 

I'm refferring to the patch here: https://github.com/RehabMan/Laptop-DSDT-Patch/tree/master/system

 

Thank you!

 

Download patchmatic: https://github.com/RehabMan/OS-X-MaciASL-patchmatic.

Extract the 'patchmatic' binary from the ZIP. Copy it to /usr/bin, such that you have the binary at /usr/bin/patchmatic.

 

In terminal,

rm -Rf ~/Downloads/RehabMan
mkdir ~/Downloads/RehabMan
cd ~/Downloads/RehabMan
patchmatic -extract
Post contents of Downloads/RehabMan directory (as ZIP).

 

Also, post copy of ioreg using IORegistryExplorer v2.1.

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

I am a beginner with DSDT editing and I edited my own DSDT. Now everything works, I just need to disable optimus. I searched a lot of forums and websites. Tried a lot of solutions but none of them worked.

 

I tried your guide to switch off the nvidia card but with no result.

Can someone explain to me what I do wrong?

 

The dsdt/ssdt files are attached.

Thanks in advance!

 

EDIT:

I just found out what the problem was. I had to place _OFF () in the _INI method for my nvidia card in the dsdt. It now switches the NVidia card off.

DSDTSSDT files.zip

Link to comment
Share on other sites

  • 4 months later...

Hi,

 

I found today that instead of calling the method from _REG or _WAK and _PTS, a simple method _INI under Scope (_SB) in the DSDT  will do the trick also.

        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            ^PCI0.PEG0.PEGP._OFF ()
            ^PCI0.PEG0.PEGP._PS3 ()
        }

Link to comment
Share on other sites

Hi,

 

I found today that instead of calling the method from _REG or _WAK and _PTS, a simple method _INI under Scope (_SB) in the DSDT  will do the trick also.

        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            ^PCI0.PEG0.PEGP._OFF ()
            ^PCI0.PEG0.PEGP._PS3 ()
        }

 

It is not always as simple as it might seem.

 

It depends on what the _OFF/_PS3 does... If it accesses the EC, the calls must originate from _REG (only when EC region is ready, see ACPI spec).

 

And you must be certain there is no existing _SB._INI. And you must verify the path. Not all discrete devices are defined at _SB.PCI0.PEG0.PEGP. In addition, you must be certain that all required SSDTs are loaded, and patched correctly (if you did renames [GFX0->IGPU], or added _DSM methods).

Link to comment
Share on other sites

It is not always as simple as it might seem.

 

It depends on what the _OFF/_PS3 does... If it accesses the EC, the calls must originate from _REG (only when EC region is ready, see ACPI spec).

 

And you must be certain there is no existing _SB._INI. And you must verify the path. Not all discrete devices are defined at _SB.PCI0.PEG0.PEGP. In addition, you must be certain that all required SSDTs are loaded, and patched correctly (if you did renames [GFX0->IGPU], or added _DSM methods).

Hi RehabMan,

 

I always merge my SSDT with the DSDT, makes things easier in my opinion. A _SB._INI was not present, but if it where, would it not be possible to add the 2 lines _OFF/_PS3 to it? 

 

PS3 call _OFF()

                    Method (_PS3, 0, NotSerialized)  // _PS3: Power State 3
                    {
                        If (LEqual (OMPR, 0x03))
                        {
                            _OFF ()
                            Store (One, DGOS)
                            Store (0x02, OMPR)
                        }
                    }

But only calling the _OFF method does not, and never has worked for me, i have to call both, _PS3 and _OFF. (Also had to on the Dell 7720)

_OFF method: 

                  Method (_OFF, 0, Serialized)  // _OFF: Power Off
                    {
                        Store (LCTL, ELCT)
                        Store (VREG, VGAB)
                        Store (EMLW, DMLW)
                        SPP0 ()
                        Store (One, LNKD)
                        Store (Zero, TCNT)
                        While (LNotEqual (LNKS, Zero))
                        {
                            Sleep (0x10)
                        }

                        Store (0x02, AFES)
                        If (LGreaterEqual (And (PNHM, 0x0F), 0x03))
                        {
                            Store (GMXB (), MBDL)
                            PDUB (MBDL)
                        }

                        If (LGreaterEqual (PCSL, 0x04))
                        {
                            If (LEqual (SC7A, One))
                            {
                                C7OK (One)
                            }
                        }

                        SGPO (HLRS, One)
                        Sleep (0x20)
                        SGPO (PWEN, Zero)
                        Sleep (0x20)
                        Return (Zero)
                    }
 

The current edit i made, does not require calling _ON and PS0 in _PTS for the display to wake after sleep, it just works :P

 

Anyway, attached my current DSDT which seems to work. Going to reinstall tonight to make sure. 

DSDTP70.zip

Link to comment
Share on other sites

I always merge my SSDT with the DSDT, makes things easier in my opinion.

Unnecessary and messy, IMHO. And patching SSDTs and including them can be automated where merging is difficult to automate.

 

A _SB._INI was not present, but if it where, would it not be possible to add the 2 lines _OFF/_PS3 to it?

Yes.

 

But only calling the _OFF method does not, and never has worked for me, i have to call both, _PS3 and _OFF. (Also had to on the Dell 7720)

It is machine specific. But you probably do not need to call both, as _PS3 calls _OFF for you...

 

The current edit i made, does not require calling _ON and PS0 in _PTS for the display to wake after sleep, it just works :P

Also machine specific. Some laptops have problematic restart and/or shutdown without calling _ON/_PS0 in _PTS (and then turn back off in _WAK).

 

Disabling the discrete card in a switched dual-GPU laptop is one of those tasks that requires the human brain and appropriate experimentation.

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...