Contribute
Register

[Guide] Using Clover to "hotpatch" ACPI

RehabMan

Moderator
Joined
May 3, 2012
Messages
186,691
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
And at your post, I found this, is that a typing mistake? <Find> is same as <Replace>.

I will look for and correct the typo.
 
Joined
Dec 27, 2011
Messages
146
CPU
i5-3317U
Graphics
HD4000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Hello Rehabman,
Thanks for this awesome guide.

Am trying to implement this kind of code in my SSDT-HACK:
Code:
Method(GPRW, 2)
{
    If (0x6d == Arg0) { Return(Package() { 0x6d, 0, }) }
    External(\XPRW, MethodObj)
    Return(XPRW(Arg0, Arg1))
}

but in my case, I have name instead method:
Code:
Name (_PRW, Package (0x02)
{
   0x0D,
   0x03
})

Can you please post a example?

Thanks in advance.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
186,691
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Hello Rehabman,
Thanks for this awesome guide.

Am trying to implement this kind of code in my SSDT-HACK:
Code:
Method(GPRW, 2)
{
    If (0x6d == Arg0) { Return(Package() { 0x6d, 0, }) }
    External(\XPRW, MethodObj)
    Return(XPRW(Arg0, Arg1))
}

but in my case, I have name instead method:
Code:
Name (_PRW, Package (0x02)
{
   0x0D,
   0x03
})

Can you please post a example?

Thanks in advance.

Look at the mixed listing to determine the byte pattern of that code.
 
Joined
Dec 27, 2011
Messages
146
CPU
i5-3317U
Graphics
HD4000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Yes, Am using this:
Code:
       4:                      Name (_PRW, Package (0x02)
       5:                      {
       6:                      0x0D,
       7:                      0x03
       8:                      })

00000024:  08 5F 50 52 57 .........    "._PRW"
00000029:  12 06 02 0A 0D 0A 03 ...    "......."

      10:                      Name (_PRW, Package (0x02)
      11:                      {
      12:                      0x0D,
      13:                      Zero
      14:                      })

00000030:  08 5F 50 52 57 .........    "._PRW"
00000035:  12 05 02 0A 0D 00 ......    "......"

to hot patch DSDT with Clover for now, but would like to know if i can implement your method to redirect _PRW calls into SSDT.
 
Last edited:

RehabMan

Moderator
Joined
May 3, 2012
Messages
186,691
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Yes, Am using this:
Code:
       4:                      Name (_PRW, Package (0x02)
       5:                      {
       6:                      0x0D,
       7:                      0x03
       8:                      })

00000024:  08 5F 50 52 57 .........    "._PRW"
00000029:  12 06 02 0A 0D 0A 03 ...    "......."

      10:                      Name (_PRW, Package (0x02)
      11:                      {
      12:                      0x0D,
      13:                      Zero
      14:                      })

00000030:  08 5F 50 52 57 .........    "._PRW"
00000035:  12 05 02 0A 0D 00 ......    "......"

to hot patch DSDT with Clover for now, but would like to know if i can implement your method to redirect _PRW calls into SSDT.

No need for SSDT. Simple Find/Replace:

Find: 08 5F 50 52 57 12 06 02 0A 0D 0A 03
Replace: 08 5F 50 52 57 12 06 02 0A 0D 0A 00
 
Joined
Dec 27, 2011
Messages
146
CPU
i5-3317U
Graphics
HD4000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Hello RM, regarding to SSDT-HACK in your HP ENVY repo, can you please explain the purpose to modify the _Q10 and _Q11 methods?
Thanks.

Code:
Method (_Q11, 0, NotSerialized) // _Qxx: EC Query
{
External(\_PR.CPU0, DeviceObj)
External(\_PR.CPU1, DeviceObj)
External(\_PR.CPU2, DeviceObj)
External(\_PR.CPU3, DeviceObj)
External(\_PR.CPU4, DeviceObj)
External(\_PR.CPU5, DeviceObj)
External(\_PR.CPU6, DeviceObj)
External(\_PR.CPU7, DeviceObj)
External(\_PR.CPU0._PPC, IntObj)
Subtract (NPS, One, NPS)
If (CondRefOf (\_PR.CPU0._PPC, Local0))
{
Store (NPS, \_PR.CPU0._PPC)
Notify (\_PR.CPU0, 0x80)
}
If (CondRefOf (\_PR.CPU1._PPC, Local0))
{
//Store (NPS, \_PR.CPU1._PPC)
Notify (\_PR.CPU1, 0x80)
}
If (CondRefOf (\_PR.CPU2._PPC, Local0))
{
//Store (NPS, \_PR.CPU2._PPC)
Notify (\_PR.CPU2, 0x80)
}
If (CondRefOf (\_PR.CPU3._PPC, Local0))
{
//Store (NPS, \_PR.CPU3._PPC)
Notify (\_PR.CPU3, 0x80)
}
If (CondRefOf (\_PR.CPU4._PPC, Local0))
{
//Store (NPS, \_PR.CPU4._PPC)
Notify (\_PR.CPU4, 0x80)
}
If (CondRefOf (\_PR.CPU5._PPC, Local0))
{
//Store (NPS, \_PR.CPU5._PPC)
Notify (\_PR.CPU5, 0x80)
}
If (CondRefOf (\_PR.CPU6._PPC, Local0))
{
//Store (NPS, \_PR.CPU6._PPC)
Notify (\_PR.CPU6, 0x80)
}
If (CondRefOf (\_PR.CPU7._PPC, Local0))
{
//Store (NPS, \_PR.CPU7._PPC)
Notify (\_PR.CPU7, 0x80)
}
}
Method (_Q10, 0, NotSerialized) // _Qxx: EC Query
{
Add (NPS, One, NPS)
If (CondRefOf (\_PR.CPU0._PPC, Local0))
{
Store (NPS, \_PR.CPU0._PPC)
Notify (\_PR.CPU0, 0x80)
}
If (CondRefOf (\_PR.CPU1._PPC, Local0))
{
//Store (NPS, \_PR.CPU1._PPC)
Notify (\_PR.CPU1, 0x80)
}
If (CondRefOf (\_PR.CPU2._PPC, Local0))
{
//Store (NPS, \_PR.CPU2._PPC)
Notify (\_PR.CPU2, 0x80)
}
If (CondRefOf (\_PR.CPU3._PPC, Local0))
{
//Store (NPS, \_PR.CPU3._PPC)
Notify (\_PR.CPU3, 0x80)
}
If (CondRefOf (\_PR.CPU4._PPC, Local0))
{
//Store (NPS, \_PR.CPU4._PPC)
Notify (\_PR.CPU4, 0x80)
}
If (CondRefOf (\_PR.CPU5._PPC, Local0))
{
//Store (NPS, \_PR.CPU5._PPC)
Notify (\_PR.CPU5, 0x80)
}
If (CondRefOf (\_PR.CPU6._PPC, Local0))
{
//Store (NPS, \_PR.CPU6._PPC)
Notify (\_PR.CPU6, 0x80)
}
If (CondRefOf (\_PR.CPU7._PPC, Local0))
{
Notify (\_PR.CPU7, 0x80)
}
}
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
186,691
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Hello RM, regarding to SSDT-HACK in your HP ENVY repo, can you please explain the purpose to modify the _Q10 and _Q11 methods?
Thanks.

Code:
Method (_Q11, 0, NotSerialized) // _Qxx: EC Query
{
External(\_PR.CPU0, DeviceObj)
External(\_PR.CPU1, DeviceObj)
External(\_PR.CPU2, DeviceObj)
External(\_PR.CPU3, DeviceObj)
External(\_PR.CPU4, DeviceObj)
External(\_PR.CPU5, DeviceObj)
External(\_PR.CPU6, DeviceObj)
External(\_PR.CPU7, DeviceObj)
External(\_PR.CPU0._PPC, IntObj)
Subtract (NPS, One, NPS)
If (CondRefOf (\_PR.CPU0._PPC, Local0))
{
Store (NPS, \_PR.CPU0._PPC)
Notify (\_PR.CPU0, 0x80)
}
If (CondRefOf (\_PR.CPU1._PPC, Local0))
{
//Store (NPS, \_PR.CPU1._PPC)
Notify (\_PR.CPU1, 0x80)
}
If (CondRefOf (\_PR.CPU2._PPC, Local0))
{
//Store (NPS, \_PR.CPU2._PPC)
Notify (\_PR.CPU2, 0x80)
}
If (CondRefOf (\_PR.CPU3._PPC, Local0))
{
//Store (NPS, \_PR.CPU3._PPC)
Notify (\_PR.CPU3, 0x80)
}
If (CondRefOf (\_PR.CPU4._PPC, Local0))
{
//Store (NPS, \_PR.CPU4._PPC)
Notify (\_PR.CPU4, 0x80)
}
If (CondRefOf (\_PR.CPU5._PPC, Local0))
{
//Store (NPS, \_PR.CPU5._PPC)
Notify (\_PR.CPU5, 0x80)
}
If (CondRefOf (\_PR.CPU6._PPC, Local0))
{
//Store (NPS, \_PR.CPU6._PPC)
Notify (\_PR.CPU6, 0x80)
}
If (CondRefOf (\_PR.CPU7._PPC, Local0))
{
//Store (NPS, \_PR.CPU7._PPC)
Notify (\_PR.CPU7, 0x80)
}
}
Method (_Q10, 0, NotSerialized) // _Qxx: EC Query
{
Add (NPS, One, NPS)
If (CondRefOf (\_PR.CPU0._PPC, Local0))
{
Store (NPS, \_PR.CPU0._PPC)
Notify (\_PR.CPU0, 0x80)
}
If (CondRefOf (\_PR.CPU1._PPC, Local0))
{
//Store (NPS, \_PR.CPU1._PPC)
Notify (\_PR.CPU1, 0x80)
}
If (CondRefOf (\_PR.CPU2._PPC, Local0))
{
//Store (NPS, \_PR.CPU2._PPC)
Notify (\_PR.CPU2, 0x80)
}
If (CondRefOf (\_PR.CPU3._PPC, Local0))
{
//Store (NPS, \_PR.CPU3._PPC)
Notify (\_PR.CPU3, 0x80)
}
If (CondRefOf (\_PR.CPU4._PPC, Local0))
{
//Store (NPS, \_PR.CPU4._PPC)
Notify (\_PR.CPU4, 0x80)
}
If (CondRefOf (\_PR.CPU5._PPC, Local0))
{
//Store (NPS, \_PR.CPU5._PPC)
Notify (\_PR.CPU5, 0x80)
}
If (CondRefOf (\_PR.CPU6._PPC, Local0))
{
//Store (NPS, \_PR.CPU6._PPC)
Notify (\_PR.CPU6, 0x80)
}
If (CondRefOf (\_PR.CPU7._PPC, Local0))
{
Notify (\_PR.CPU7, 0x80)
}
}

The Store ops to _PR.CPUx._PPC are invalid due to _PPC being a method.
 
Joined
Sep 5, 2016
Messages
19
Motherboard
XPS 15 9550 4825T
CPU
Intel(R) Core(TM) i7-6700HQ @ 2.60GHz
Graphics
Intel HD 530 & NVIDIA GTX 960M
Mac
  1. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
Hello Rehabman.

I want to use this method to patch battery with my hp pavilion g4 laptop,and i use diffmerge find some diffs but i don't know how to create a SSDT-Battery.dsl to make it well.

QQ20161225-203413@2x.png


Thanks.
 

Attachments

  • BatteryNO.dsl.zip
    39.2 KB · Views: 117
  • BatteryYES.dsl.zip
    40.7 KB · Views: 118
  • SSDT-HPBAT.dsl.zip
    2.2 KB · Views: 107

RehabMan

Moderator
Joined
May 3, 2012
Messages
186,691
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Hello Rehabman.

I want to use this method to patch battery with my hp pavilion g4 laptop,and i use diffmerge find some diffs but i don't know how to create a SSDT-Battery.dsl to make it well.

View attachment 226791

Thanks.

You need to use 'External' to access the fields present in DSDT from the SSDT.
 
Top