Contribute
Register

[solved] Discrete dual-GPU using hotpatch

Status
Not open for further replies.
Joined
Dec 13, 2015
Messages
92
Motherboard
Inspiron 7460
CPU
CPU Core i5 7200U
Graphics
Intel HD Graphics 620 + GeForce Nvidia 940MX
Mobile Phone
  1. iOS
Hey guys!
So, I'm having some doubts about how to discrete my 940MX.

I managed to get to the point where I have to create the patches for _REG, _INI and _OFF.
But, I don't have enough 'bytes' to generate the patches, so, what should I do?

To determine the binary patches needed, we need a mixed listing of DSDT.aml, SSDT-10.aml, and SSDT-11.aml.
Create with:
Code (Text):

iasl -dl -l DSDT.aml SSDT-10.aml SSDT-11.aml

The resulting mixed listing is in DSDT.dsl, SSDT-10.dsl, and SSDT-11.dsl.

Here is the mixed listing for _REG in DSDT.dsl:
Code (Text):

Method (_REG, 2, NotSerialized) // _REG: Region Availability
{

D2B8: 14 12 5F 52 45 47 02 // .._REG.

If (LEqual (Arg0, 0x03))
{

D2BF: A0 0B 93 68 0A 03 // ...h..

Store (Arg1, ECFL)
}
}
}
}


D2C5: 70 69 45 43 46 4C

The patch used should rename only this _REG, not other _REG methods in the ACPI set. We can rename it by grabbing the name/header plus a few bytes from the code.

This pattern grabs enough bytes to be unique for sure:
Find: <5F 52 45 47 02 A0 0B 93 68 0A 03 70 69 45 43 46 4C>
Replace: <58 52 45 47 02 A0 0B 93 68 0A 03 70 69 45 43 46 4C>

And the mixed listing for the target _INI in SSDT-10.dsl:

Code (Text):

Method (_INI, 0, NotSerialized) // _INI: Initialize
{

03D1: 14 1F 5F 49 4E 49 00 // .._INI.

Store (Zero, \_SB.PCI0.RP05.PEGP._ADR)
}


03D8: 70 00 5C 2F 05 5F 53 42 5F 50 43 49 30 52 50 30 // p.\/._SB_PCI0RP0
03E8: 35 50 45 47 50 5F 41 44 52 // 5PEGP_ADR

Resulting patch...
Find: <5F 49 4E 49 00 70 00 5C 2F 05 5F 53 42 5F 50 43 49 30 52 50 30 35 50 45 47 50>
Replace: <58 49 4E 49 00 70 00 5C 2F 05 5F 53 42 5F 50 43 49 30 52 50 30 35 50 45 47 50>

And the _OFF in SSDT-11.dsl:
Code (Text):

Method (_OFF, 0, Serialized) // _OFF: Power Off
{

032B: 14 45 04 5F 4F 46 46 08 // .E._OFF.

If (LEqual (CTXT, Zero))
{
\_SB.PCI0.LPCB.EC0.SPIN (0x96, Zero)

0333: A0 39 93 43 54 58 54 00 5C 2F 05 5F 53 42 5F 50 // .9.CTXT.\/._SB_P
0343: 43 49 30 4C 50 43 42 45 43 30 5F 53 50 49 4E 0A // CI0LPCBEC0_SPIN.
0353: 96 00

The patch...
Find: <5F 4F 46 46 08 A0 39 93 43 54 58 54>
Replace: <58 4F 46 46 08 A0 39 93 43 54 58 54>

Code:
My settings are:

_OFF is in SSDT-18. Path is _SB.PCI0.RP01.PEGP._OFF.
It calls HGOF. HGOF is in SSDT17. 
No EC references in either.
The related _INI is in SSDT-16.

Since my SSDT-16 is named SSDT-16-SgUlt.aml, and my SSDT-18 is named SSDT-18-OptTabl.aml, I run the following code in the respective folder:

Code:
iasl -dl -l DSDT.aml SSDT-16-SgUlt.aml SSDT-18-OptTabl.aml

Where I get the following codes

SSDT-16:

Code:
Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {

  03FD: 14 1F 5F 49 4E 49 00                             // .._INI.

            Store (Zero, \_SB.PCI0.RP01.PEGP._ADR)
        }
    }
}

SSDT-18:

Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {

  0750: 14 36 5F 4F 46 46 08                             // .6_OFF.

            If (LEqual (CTXT, Zero))
            {

  0757: A0 1F 93 43 54 58 54 00

So, what patches should I use?
Also, what the name should I put it ?

My files are attached.
Thanks!
 

Attachments

  • origin files bytes.zip
    363.9 KB · Views: 56
  • CLOVER.zip
    3.8 MB · Views: 54

RehabMan

Moderator
Joined
May 3, 2012
Messages
184,623
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Hey guys!
So, I'm having some doubts about how to discrete my 940MX.

I managed to get to the point where I have to create the patches for _REG, _INI and _OFF.
But, I don't have enough 'bytes' to generate the patches, so, what should I do?



Code:
My settings are:

_OFF is in SSDT-18. Path is _SB.PCI0.RP01.PEGP._OFF.
It calls HGOF. HGOF is in SSDT17.
No EC references in either.
The related _INI is in SSDT-16.

Since my SSDT-16 is named SSDT-16-SgUlt.aml, and my SSDT-18 is named SSDT-18-OptTabl.aml, I run the following code in the respective folder:

Code:
iasl -dl -l DSDT.aml SSDT-16-SgUlt.aml SSDT-18-OptTabl.aml

Where I get the following codes

SSDT-16:

Code:
Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {

  03FD: 14 1F 5F 49 4E 49 00                             // .._INI.

            Store (Zero, \_SB.PCI0.RP01.PEGP._ADR)
        }
    }
}

SSDT-18:

Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {

  0750: 14 36 5F 4F 46 46 08                             // .6_OFF.

            If (LEqual (CTXT, Zero))
            {

  0757: A0 1F 93 43 54 58 54 00

So, what patches should I use?
Also, what the name should I put it ?

My files are attached.
Thanks!

You're seeing a bug in iasl. In a mixed listing, it omits the last bit of opcodes at the end of the file.
Adding some extra code to _INI will expose them:
Code:
        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            Store (Zero, \_SB.PCI0.RP01.PEGP._ADR)
            Store (Zero, Local0)
        }

Result:
Code:
        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            \_SB.PCI0.RP01.PEGP._ADR = Zero

  03FE: 14 22 5F 49 4E 49 00 70 00 5C 2F 05 5F 53 42 5F  // ."_INI.p.\/._SB_
  040E: 50 43 49 30 52 50 30 31 50 45 47 50 5F 41 44 52  // PCI0RP01PEGP_ADR

            Local0 = Zero
        }
    }

Or you can use a hex editor to see what the extra code bytes are.
 
Joined
Dec 13, 2015
Messages
92
Motherboard
Inspiron 7460
CPU
CPU Core i5 7200U
Graphics
Intel HD Graphics 620 + GeForce Nvidia 940MX
Mobile Phone
  1. iOS
You're seeing a bug in iasl. In a mixed listing, it omits the last bit of opcodes at the end of the file.
Adding some extra code to _INI will expose them:
Code:
        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            Store (Zero, \_SB.PCI0.RP01.PEGP._ADR)
            Store (Zero, Local0)
        }

Result:
Code:
        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            \_SB.PCI0.RP01.PEGP._ADR = Zero

  03FE: 14 22 5F 49 4E 49 00 70 00 5C 2F 05 5F 53 42 5F  // ."_INI.p.\/._SB_
  040E: 50 43 49 30 52 50 30 31 50 45 47 50 5F 41 44 52  // PCI0RP01PEGP_ADR

            Local0 = Zero
        }
    }

Or you can use a hex editor to see what the extra code bytes are.

Thanks Rehab! Solved.
Going to make a tutorial for this Inspiron 7460 only using hotpatch (High Sierra) thanks to you.
You rock, dude!
 
Status
Not open for further replies.
Top