Contribute
Register

[Guide] Disabling discrete graphics in dual-GPU laptops

You should not expect to find the same code as the example (ACPI code varies by BIOS vendor/model/architecture/etc).

_OFF is in SSDT-8-OptTabl, it calls PGOF in SSDT-2-PegSsdt. Neither has EC references.
There is no _INI at path _SB.PCI0.PEG0.PEGP.
So you just need to add one... A good place is right before _OFF:
Code:
        Method (_INI) { _OFF() }

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?
 

Attachments

  • Screen Shot 2018-01-01 at 14.18.16.png
    Screen Shot 2018-01-01 at 14.18.16.png
    199.2 KB · Views: 133
  • debug_1797.zip
    2.4 MB · Views: 64
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.
 
Yes you where right, it was clover problem, i used your fork and added modified SSDT-8-OptTabl.
Thank you
 
@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: 138
  • origin.zip
    53.4 KB · Views: 77
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.
 
@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: 150
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.
 
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?
 
@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
 
Back
Top