Contribute
Register

[Guide] Disabling discrete graphics in dual-GPU laptops

RehabMan

Moderator
Joined
May 2, 2012
Messages
183,775
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Happy new year to all

Hello RehabMan and thank you for your help.
I'm new to DSTD patches so it's a little bit difficult to understand..
I added INI method to SSDT-8-OptTabl and compiled with some warnings

Now i'm trying to patch DSDT.dsl _REG methods but when i compile i get the following errors
Code:
15344,6126 syntax error, unexpected PARSEOP_ZERO
15363, 6126, syntax error, unexpected PARSEOP_ZERO
15380, 6126, syntax error, unexpected PARSEOP_SCOPE, expecting $end and premature End-Of-File

I tried the following patched with no success

Fix PARSEOP_ZERO Error
Fix PARSEOP_ZERO Error (agressive)

Is something wrong with iasl?

Your DSDT requires no patches to _REG.
The only error in your DSDT.aml is from BNUM... simply remove the unneeded 'External(BNUM, ...' line.
Note: You have the wrong version of Clover installed.
 
Joined
Oct 3, 2015
Messages
8
Motherboard
Gigabyte H97N-WIFI
CPU
i5-4690K
Graphics
HD 4600
Yes you where right, it was clover problem, i used your fork and added modified SSDT-8-OptTabl.
Thank you
 

Sniki

Moderator
Joined
Jan 5, 2016
Messages
2,313
Motherboard
HP Elite 8300 SFF
CPU
i7-3770
Graphics
HD 3000 | GTX 1650 LP
Mac
  1. MacBook Pro
Mobile Phone
  1. iOS
@RehabMan i have been trying for a few days to disable DiscreteGPU on Lenovo ThinkPad T440P for one of the users on my Guide but i can't figure out.
I tried to read the Post #1 from this guide many times, his ACPI has GPOF but i can't tell which _INI Method should be used or make the patch on MaciASL to work with it

On this example both _INI and _OFF methods are located on DSDT

There are too many _INI & _OFF methods on DSDT which i can't figure out which one should be exactly used.

As far as i understand the _OFF method should be this one so please correct me if im wrong:
Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
                    {
                        \_SB.PCI0.PEG.VID.GPOF (0x00)
                        Store (Zero, _STA)
                    }
But when it comes to _INI i get confused but i do think it should be this one since in MaciASL address bar on bottom it says DSDT>\_SB.PCI0.PEG.VID._INI:
Code:
Method (_INI, 0, NotSerialized)  // _INI: Initialize
                    {
                        \VUPS (0x02)
                        Store (\VCDL, VQDL)
                        Store (\VCDC, VQDC)
                        Store (\VCDT, VQD0)
                        Store (\VCDD, VQD1)
                        VRSI ()
                        If (ISOP ())
                        {
                            \VHYB (0x04, 0x01)
                        }
                    }
How should your MaciASL existing "disable from _INI" patch be modified, if the _OFF & _INI mentioned by me are the right ones ?.
i attached the ACPI of that T440P and IOreg with everything else supposed to be fine except the none disabled DiscreteGPU.

Looking into an SSDT-DiscreteSpoof from another user of a T440P laptop with dual GPU he created this one:
Code:
DefinitionBlock ("", "SSDT", 2, "T440P", "DiscreteSpoof", 0)
{
    Method(_SB.PCI0.PEG.VID._DSM, 4)
    {
        If (!Arg2) { Return (Buffer() { 0x03 } ) }
        Return (Package()
        {
            "name", Buffer() { "#display" },
            "IOName", "#display",
            "class-code", Buffer() { 0xFF, 0xFF, 0xFF, 0xFF },
        })
    }
}
So the location should be _SB.PCI0.PEG.VID since he managed to boot correctly, i just can't seem to modify the patch so it can apply on DSDT.
 

Attachments

  • Shen MacBook Pro.ioreg
    7.4 MB · Views: 109
  • origin.zip
    53.4 KB · Views: 63

RehabMan

Moderator
Joined
May 2, 2012
Messages
183,775
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
But when it comes to _INI i get confused but i do think it should be this one since in MaciASL address bar on bottom it says DSDT>\_SB.PCI0.PEG.VID._INI:
Code:
Method (_INI, 0, NotSerialized)  // _INI: Initialize
                    {
                        \VUPS (0x02)
                        Store (\VCDL, VQDL)
                        Store (\VCDC, VQDC)
                        Store (\VCDT, VQD0)
                        Store (\VCDD, VQD1)
                        VRSI ()
                        If (ISOP ())
                        {
                            \VHYB (0x04, 0x01)
                        }
                    }

Typically, the discrete card in Thinkpads is at _SB.PCI0.PEG.VID, so it seems you have found the related _INI.

How should your MaciASL existing "disable from _INI" patch be modified, if the _OFF & _INI mentioned by me are the right ones ?.

As per hotpatch guide, use "Rename/Replace" pattern.
See examples/discussion in the hotpatch guide.
 

the-braveknight

Moderator
Joined
Nov 24, 2015
Messages
1,220
Motherboard
Lenovo Legion Y520 (Clover)
CPU
i7-7700HQ
Graphics
HD 630 (1920x1080) + Nvidia GTX 1060
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
@RehabMan i have been trying for a few days to disable DiscreteGPU on Lenovo ThinkPad T440P for one of the users on my Guide but i can't figure out.
I tried to read the Post #1 from this guide many times, his ACPI has GPOF but i can't tell which _INI Method should be used or make the patch on MaciASL to work with it

On this example both _INI and _OFF methods are located on DSDT

There are too many _INI & _OFF methods on DSDT which i can't figure out which one should be exactly used.

As far as i understand the _OFF method should be this one so please correct me if im wrong:
Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
                    {
                        \_SB.PCI0.PEG.VID.GPOF (0x00)
                        Store (Zero, _STA)
                    }
But when it comes to _INI i get confused but i do think it should be this one since in MaciASL address bar on bottom it says DSDT>\_SB.PCI0.PEG.VID._INI:
Code:
Method (_INI, 0, NotSerialized)  // _INI: Initialize
                    {
                        \VUPS (0x02)
                        Store (\VCDL, VQDL)
                        Store (\VCDC, VQDC)
                        Store (\VCDT, VQD0)
                        Store (\VCDD, VQD1)
                        VRSI ()
                        If (ISOP ())
                        {
                            \VHYB (0x04, 0x01)
                        }
                    }
How should your MaciASL existing "disable from _INI" patch be modified, if the _OFF & _INI mentioned by me are the right ones ?.
i attached the ACPI of that T440P and IOreg with everything else supposed to be fine except the none disabled DiscreteGPU.

Looking into an SSDT-DiscreteSpoof from another user of a T440P laptop with dual GPU he created this one:
Code:
DefinitionBlock ("", "SSDT", 2, "T440P", "DiscreteSpoof", 0)
{
    Method(_SB.PCI0.PEG.VID._DSM, 4)
    {
        If (!Arg2) { Return (Buffer() { 0x03 } ) }
        Return (Package()
        {
            "name", Buffer() { "#display" },
            "IOName", "#display",
            "class-code", Buffer() { 0xFF, 0xFF, 0xFF, 0xFF },
        })
    }
}
So the location should be _SB.PCI0.PEG.VID since he managed to boot correctly, i just can't seem to modify the patch so it can apply on DSDT.

You could also try calling it from any _INI, so this SSDT might work as well without having to replace original _INI.
 

Attachments

  • SSDT-DGPU.dsl
    312 bytes · Views: 137

RehabMan

Moderator
Joined
May 2, 2012
Messages
183,775
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
You could also try calling it from any _INI, so this SSDT might work as well without having to replace original _INI.

Yes... and it generally works because I think an _INI in an add-on SSDT will be called after an _INI in a native SSDT (as an add-on SSDT appears later in the XDST than does a native SSDT).
I never verified that (_INI order of execution), which is why I wrote the hotpatch guide in a way that will always respect _INI order by using the "Rename/Replace/Delegate" pattern.

Either way... both child's play... if you understand hotpatch.
 

the-braveknight

Moderator
Joined
Nov 24, 2015
Messages
1,220
Motherboard
Lenovo Legion Y520 (Clover)
CPU
i7-7700HQ
Graphics
HD 630 (1920x1080) + Nvidia GTX 1060
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Yes... and it generally works because I think an _INI in an add-on SSDT will be called after an _INI in a native SSDT (as an add-on SSDT appears later in the XDST than does a native SSDT).
I never verified that (_INI order of execution), which is why I wrote the hotpatch guide in a way that will always respect _INI order by using the "Rename/Replace/Delegate" pattern.

Either way... both child's play... if you understand hotpatch.

Yeah. But just to understand, will calling _OFF before the original _INI is called cause a problem?
 

Sniki

Moderator
Joined
Jan 5, 2016
Messages
2,313
Motherboard
HP Elite 8300 SFF
CPU
i7-3770
Graphics
HD 3000 | GTX 1650 LP
Mac
  1. MacBook Pro
Mobile Phone
  1. iOS
@the-braveknight & @RehabMan
in case the laptop needs it Enabled on _PTS & Disabled on _WAK:
In my case the Original WAK is renamed to ZWAK and copied as patched for Battery Status on lets say SSDT-BAT and PTS to ZPTS so i have it on SSDT-PTS with:
Code:
// Overriding _PTS

DefinitionBlock("", "SSDT", 2, "T440P", "PTS", 0)
{
    External(ZPTS, MethodObj)
    External(_SB.PCI0.XHC.PMEE, FieldUnitObj)
    // In DSDT, native _PTS is renamed to ZPTS
    // As a result, calls to this method land here.
    Method(_PTS, 1)
    {
        ZPTS(Arg0)
        If (5 == Arg0)
        {
            // fix "auto start after shutdown if a USB Device is Plugged In"
            \_SB.PCI0.XHC.PMEE = 0
        }
    }
}
//EOF
Is it ok to have the _PTS / _WAK on separate SSDTs, will that cause problems for Discrete GPU or its fine like this:
Code:
// Overriding _PTS

DefinitionBlock("", "SSDT", 2, "T440P", "PTS", 0)
{
    External(ZPTS, MethodObj)
    External(_SB.PCI0.XHC.PMEE, FieldUnitObj)
    External(\_SB.PCI0.PEG.VID._ON, MethodObj)
    // In DSDT, native _PTS is renamed to ZPTS
    // As a result, calls to this method land here.
    Method(_PTS, 1)
    {
        If (CondRefOf(\_SB.PCI0.PEG.VID._ON)) { \_SB.PCI0.PEG.VID._ON() }
        ZPTS(Arg0)
        If (5 == Arg0)
        {
            // fix "auto start after shutdown if a USB Device is Plugged In"
            \_SB.PCI0.XHC.PMEE = 0
        }
    }
}
//EOF
And the same with _OFF on WAK on SSDT-BAT
 

RehabMan

Moderator
Joined
May 2, 2012
Messages
183,775
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
@the-braveknight & @RehabMan
in case the laptop needs it Enabled on _PTS & Disabled on _WAK:
In my case the Original WAK is renamed to ZWAK and copied as patched for Battery Status on lets say SSDT-BAT and PTS to ZPTS so i have it on SSDT-PTS with:
Code:
// Overriding _PTS

DefinitionBlock("", "SSDT", 2, "T440P", "PTS", 0)
{
    External(ZPTS, MethodObj)
    External(_SB.PCI0.XHC.PMEE, FieldUnitObj)
    // In DSDT, native _PTS is renamed to ZPTS
    // As a result, calls to this method land here.
    Method(_PTS, 1)
    {
        ZPTS(Arg0)
        If (5 == Arg0)
        {
            // fix "auto start after shutdown if a USB Device is Plugged In"
            \_SB.PCI0.XHC.PMEE = 0
        }
    }
}
//EOF
Is it ok to have the _PTS / _WAK on separate SSDTs, will that cause problems for Discrete GPU or its fine like this:
Code:
// Overriding _PTS

DefinitionBlock("", "SSDT", 2, "T440P", "PTS", 0)
{
    External(ZPTS, MethodObj)
    External(_SB.PCI0.XHC.PMEE, FieldUnitObj)
    External(\_SB.PCI0.PEG.VID._ON, MethodObj)
    // In DSDT, native _PTS is renamed to ZPTS
    // As a result, calls to this method land here.
    Method(_PTS, 1)
    {
        If (CondRefOf(\_SB.PCI0.PEG.VID._ON)) { \_SB.PCI0.PEG.VID._ON() }
        ZPTS(Arg0)
        If (5 == Arg0)
        {
            // fix "auto start after shutdown if a USB Device is Plugged In"
            \_SB.PCI0.XHC.PMEE = 0
        }
    }
}
//EOF
And the same with _OFF on WAK on SSDT-BAT

You can only have one \_PTS and one \_WAK in the entire ACPI set.
If you want _PTS/_WAK to do multiple things, you'll need to have all the code you need in a single place.

You will notice my SSDT-PTSWAK.dsl in my hotpatch example repo does a variety of things, optionally, based on SSDT-Config.dsl settings.
 
Last edited:
Top