Contribute
Register

[Guide] Disabling discrete graphics in dual-GPU laptops

@ladeiko, could I ask you to share your complete EFI folder at this point, please? Thank you very much!
I am still making some changes to EFI, but after completion i will upload complete EFI to GitHUB
 
Hello, Mr. @RehabMan. I want to disable my Nvidia, my Clover haven't been patched because I'm still confused.
After search using grep command I found this code inside \_SB.PCI0.RP01.PXSX scope in SSDT-4.dsl
Code:
        Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {
            If (LEqual (CCHK (Zero), Zero))
            {
                Return (Zero)
            }

            If (LNotEqual (GPRF, One))
            {
                Store (VREG, VGAB)
            }

            HGOF ()
            Return (Zero)
        }
I can't found SPIN method in my SSDT, so I think I can skip step to modify _OFF method.
I found _INI method also in SSDT-4.dsl (same SSDT with _INI method).
So, I must patching SSDT-4 using this patch code, right?
Code:
into method label _INI parent_label \_SB.PCI0.RP01.PXSX insert
begin
//added to turn nvidia/radeon off\n
_OFF()\n
end;
And to patch _REG in DSDT I must use patch code like this, right?
Code:
into method label _REG parent_hid PNP0C09 insert
begin
//added to turn nvidia/radeon off\n
If (LAnd(LEqual(Arg0,3),LEqual(Arg1,1)))\n
{\n
    External(\_SB.PCI0.RP01.PXSX._OFF, MethodObj)\n
    \_SB.PCI0.RP01.PXSX._OFF()\n
}\n
end;
And if I facing Sleep Wake Problems I must fix it using patch code like this, right?
Code:
into method label _PTS code_regex ([\s\S]*) replace_matched
begin
External(\\_SB.PCI0.RP01.PXSX._ON, MethodObj)\n
If (CondRefOf(\\_SB.PCI0.RP01.PXSX._ON)) { \\_SB.PCI0.RP01.PXSX._ON() }\n
%1
end;

into method label _WAK code_regex (Return\s+\(.*) replace_matched
begin
External(\\_SB.PCI0.RP01.PXSX._OFF, MethodObj)\n
If (CondRefOf(\\_SB.PCI0.RP01.PXSX._OFF)) { \\_SB.PCI0.RP01.PXSX._OFF() }\n
%1
end;
I also attach my required attachment below.
Please correct me. Thank you very much.
 

Attachments

  • debug_19072.zip
    2.7 MB · Views: 101
Hello, Mr. @RehabMan. I want to disable my Nvidia, my Clover haven't been patched because I'm still confused.
After search using grep command I found this code inside \_SB.PCI0.RP01.PXSX scope in SSDT-4.dsl
Code:
        Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {
            If (LEqual (CCHK (Zero), Zero))
            {
                Return (Zero)
            }

            If (LNotEqual (GPRF, One))
            {
                Store (VREG, VGAB)
            }

            HGOF ()
            Return (Zero)
        }
I can't found SPIN method in my SSDT, so I think I can skip step to modify _OFF method.
I found _INI method also in SSDT-4.dsl (same SSDT with _INI method).
So, I must patching SSDT-4 using this patch code, right?
Code:
into method label _INI parent_label \_SB.PCI0.RP01.PXSX insert
begin
//added to turn nvidia/radeon off\n
_OFF()\n
end;
And to patch _REG in DSDT I must use patch code like this, right?
Code:
into method label _REG parent_hid PNP0C09 insert
begin
//added to turn nvidia/radeon off\n
If (LAnd(LEqual(Arg0,3),LEqual(Arg1,1)))\n
{\n
    External(\_SB.PCI0.RP01.PXSX._OFF, MethodObj)\n
    \_SB.PCI0.RP01.PXSX._OFF()\n
}\n
end;
And if I facing Sleep Wake Problems I must fix it using patch code like this, right?
Code:
into method label _PTS code_regex ([\s\S]*) replace_matched
begin
External(\\_SB.PCI0.RP01.PXSX._ON, MethodObj)\n
If (CondRefOf(\\_SB.PCI0.RP01.PXSX._ON)) { \\_SB.PCI0.RP01.PXSX._ON() }\n
%1
end;

into method label _WAK code_regex (Return\s+\(.*) replace_matched
begin
External(\\_SB.PCI0.RP01.PXSX._OFF, MethodObj)\n
If (CondRefOf(\\_SB.PCI0.RP01.PXSX._OFF)) { \\_SB.PCI0.RP01.PXSX._OFF() }\n
%1
end;
I also attach my required attachment below.
Please correct me. Thank you very much.

As per guide, without any EC related code in _OFF, no changes to _OFF or _REG required.
But... _OFF calls HGOF, which does have EC references!

Only apply patches to _PTS/_WAK if necessary.
 
As per guide, without any EC related code in _OFF, no changes to _OFF or _REG required.
But... _OFF calls HGOF, which does have EC references!

Only apply patches to _PTS/_WAK if necessary.
So, I only must to calling _OFF method inside my _INI method,right?
My HGOF method looks like this.
Code:
Method (HGOF, 0, Serialized)
        {
            If (LEqual (CCHK (Zero), Zero))
            {
                Return (Zero)
            }

            Store (Zero, ONOF)
            Store (LCTL, ELCT)
            Store (One, LNKD)
            While (LNotEqual (LNKS, Zero))
            {
                DDLY (One)
            }

            SGPO (HLRS, One)
            SGPO (PWEN, Zero)
            Store (Zero, \_SB.PCI0.LPCB.EC0.VGAF)
            \_SB.PCI0.LPCB.EC0.SCTB ()
            Return (Zero)
        }
Is it need to be patched? What patch must be applied? Thank you very much.
 
Last edited:
So, I only must to calling _OFF method inside my _INI method,right?
My HGOF method looks like this.
Code:
Method (HGOF, 0, Serialized)
        {
            If (LEqual (CCHK (Zero), Zero))
            {
                Return (Zero)
            }

            Store (Zero, ONOF)
            Store (LCTL, ELCT)
            Store (One, LNKD)
            While (LNotEqual (LNKS, Zero))
            {
                DDLY (One)
            }

            SGPO (HLRS, One)
            SGPO (PWEN, Zero)
            Store (Zero, \_SB.PCI0.LPCB.EC0.VGAF)
            \_SB.PCI0.LPCB.EC0.SCTB ()
            Return (Zero)
        }
Is it need to be patched? What patch must be applied? Thank you very much.

The EC related code in HGOF (since it is called from _OFF, therefore in the _OFF execution path), must be moved to _REG as described in post #1.
 
@RehabMan,

I need to disable Nvidia Optimus on the Dell E6520.

I have disassembled all files and applied the recommended fixes to DSDT.

A searched revealed that there is only one _INI method and it is in the DSDT.dsl

Code:
Scope (\_SB.PCI0)
    {
        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            \EV1 (0x02, 0x00)
            If (ECG4 ())
            {
                GENS (0x1C, 0x01, 0x00)
            }
            Else
            {
                GENS (0x1C, 0x00, 0x00)
            }
        }
    }

The _OFF method can only be found in SSDT-3-NvdTabl.dsl

Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {
            Sleep (0x64)
            Store (PREG, PEGB)
            Sleep (0x64)
            Store (VREG, VGAB)
            Sleep (0x64)
            Store (0x01, LNKM)
            While (LNotEqual (LNKS, 0x00))
            {
                Sleep (0x01)
            }

            Store (0x00, PO34)
            ECS4 (0x00)
        }

The path to the _OFF method is \_SB.PCI0.PEG0.VID.

I'm not sure how to call the _OFF method from _INI?

Should I replace _INI method to read ?

Code:
Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            Store (Zero, \_SB.PCI0.PEG0.VID._ADR)
            //added to turn nvidia off
            External(\_SB.PCI0.PEG0.VID._OFF, MethodObj)
            _OFF()      
           
        }

Problem is _SB.PCI0.PEG0.VID._ADR "ADR" does not exist?

Do I require Store (Zero, \_SB.PCI0.PEG0.VID._ADR) ? or is the External command sufficient ?
 

Attachments

  • DSDT.dsl
    286.8 KB · Views: 161
  • SSDT-3-NvdTabl.dsl
    50.3 KB · Views: 150
Hello RehabMan,

The _INI method is located on SSDT-5.aml, after I applied Patche Disable from _INI (SSDT) the laptop entered Panic. See attached pictures. The _0FF method is located on SSDT-6.aml, I applied this patch: Method (_INI) {_OFF ()}, the laptop boots, but the graphics card is not disabled.

I would like help solving the problem. Follows requested files.
 

Attachments

  • Files.zip
    10 MB · Views: 99
@RehabMan,

I need to disable Nvidia Optimus on the Dell E6520.

I have disassembled all files and applied the recommended fixes to DSDT.

A searched revealed that there is only one _INI method and it is in the DSDT.dsl

Code:
Scope (\_SB.PCI0)
    {
        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            \EV1 (0x02, 0x00)
            If (ECG4 ())
            {
                GENS (0x1C, 0x01, 0x00)
            }
            Else
            {
                GENS (0x1C, 0x00, 0x00)
            }
        }
    }

The _OFF method can only be found in SSDT-3-NvdTabl.dsl

Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {
            Sleep (0x64)
            Store (PREG, PEGB)
            Sleep (0x64)
            Store (VREG, VGAB)
            Sleep (0x64)
            Store (0x01, LNKM)
            While (LNotEqual (LNKS, 0x00))
            {
                Sleep (0x01)
            }

            Store (0x00, PO34)
            ECS4 (0x00)
        }

The path to the _OFF method is \_SB.PCI0.PEG0.VID.

I'm not sure how to call the _OFF method from _INI?

Should I replace _INI method to read ?

Code:
Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            Store (Zero, \_SB.PCI0.PEG0.VID._ADR)
            //added to turn nvidia off
            External(\_SB.PCI0.PEG0.VID._OFF, MethodObj)
            _OFF()     
          
        }

Problem is _SB.PCI0.PEG0.VID._ADR "ADR" does not exist?

Do I require Store (Zero, \_SB.PCI0.PEG0.VID._ADR) ? or is the External command sufficient ?

You should just add an _INI just before the _OFF:
Code:
Method(_INI) { _OFF() }

You will want to look at the ECS4 method to see if it accesses the EC (likely). As per guide, all EC related code in _OFF execution path must be moved to _REG.
 
Hello RehabMan,

The _INI method is located on SSDT-5.aml, after I applied Patche Disable from _INI (SSDT) the laptop entered Panic. See attached pictures. The _0FF method is located on SSDT-6.aml, I applied this patch: Method (_INI) {_OFF ()}, the laptop boots, but the graphics card is not disabled.

I would like help solving the problem. Follows requested files.

"Problem Reporting" files are incomplete (no verbose boot photo attached).
Read FAQ, "Problem Reporting" again. Carefully. Attach all requested files/output.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/

PR files must represent exactly the scenario you are reporting.
 
You should just add an _INI just before the _OFF:
Code:
Method(_INI) { _OFF() }

You will want to look at the ECS4 method to see if it accesses the EC (likely). As per guide, all EC related code in _OFF execution path must be moved to _REG.

Ok, hang on before I go nuts .... I'm in green fields here

My one and only ECS4 method is in "DSDT.dsl" under root
Code:
Method (ECS4, 1, NotSerialized)
        {
            ECWB (0x11, Arg0)
        }

It calls ECWB.

Code:
Method (ECWB, 2, NotSerialized)
        {
            \_SB.PCI0.LPCB.ECDV.ECW1 (Arg0, Arg1)
        }

I don't see how it relates to _SB.PCIO.PEG0.VID (defined in "SSDT-3-NvdTabl.dsl") ?

Also, if I follow the logic,

Step 1: Add a new _INI method in "SSDT-3-NvdTabl.dsl" just before _OFF method. That is easy.
Code:
Method(_INI) { _OFF() }

Step 2: All EC related code in _OFF execution path must be moved to _REG. This is a bit greek.

How do a know which code is EC ?

Let me guess ... can it be ECS4 as per below ?

Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {
            Sleep (0x64)
            Store (PREG, PEGB)
            Sleep (0x64)
            Store (VREG, VGAB)
            Sleep (0x64)
            Store (0x01, LNKM)
            While (LNotEqual (LNKS, 0x00))
            {
                Sleep (0x01)
            }

            Store (0x00, PO34)
            ECS4 (0x00). // to be removed ?
        }


Step 3: Add code from Step 2 to _REG method.

The only _REG method I could find is in "DSDT.dsl". It is part off \_SB.PCIO.LPCB.ECDV

Code:
Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LAnd (LEqual (Arg0, 0x03), LEqual (Arg1, 0x01)))
                {
                    ECIN ()
                    Store (0x01, \ECRD)
                }
                ECS4 (0x00) // To be added here ?
            }

How will the code be executed to call _OFF method in "SSDT-3-NvdTabl.dsl". We have created an _INI method that call _OFF. However, what is calling _INI ? or is it invoked automatically ?
 

Attachments

  • SSDT-3-NvdTabl.dsl
    50.4 KB · Views: 139
  • DSDT.dsl
    286.8 KB · Views: 173
Back
Top