#Maintained by: RehabMan for: Laptop Patches #battery_Lenovo-Rescuer-ISK.txt # created by shiy05 06/28/2017 # based on: HP Envy dv6 battery patch (by RehabMan) # works for: # Lenovo rescuer 14-ISK (per shiy05) # Lenovo rescuer 15-ISK (per Xc233haha) # add method B1B2 into method label B1B2 remove_entry; into definitionblock code_regex . insert begin Method (B1B2, 2, NotSerialized)\n {\n Return(Or(Arg0, ShiftLeft(Arg1, 8)))\n }\n end; # add method B1B4 into method label B1B4 remove_entry; into definitionblock code_regex . insert begin Method (B1B4, 4, NotSerialized)\n {\n Store(Arg3, Local0)\n Or(Arg2, ShiftLeft(Local0, 8), Local0)\n Or(Arg1, ShiftLeft(Local0, 8), Local0)\n Or(Arg0, ShiftLeft(Local0, 8), Local0)\n Return(Local0)\n }\n end; # add utility methods to read/write buffers from/to \_SB.PCI0.LPCB.H_EC into method label RE1B parent_label \_SB.PCI0.LPCB.H_EC remove_entry; into method label RECB parent_label \_SB.PCI0.LPCB.H_EC remove_entry; into scope label \_SB.PCI0.LPCB.H_EC insert begin Method (RE1B, 1, NotSerialized)\n {\n OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n Return(BYTE)\n }\n Method (RECB, 2, Serialized)\n // Arg0 - offset in bytes from zero-based\n // Arg1 - size of buffer in bits\n {\n ShiftRight(Arg1, 3, Arg1)\n Name(TEMP, Buffer(Arg1) { })\n Add(Arg0, Arg1, Arg1)\n Store(0, Local0)\n While (LLess(Arg0, Arg1))\n {\n Store(RE1B(Arg0), Index(TEMP, Local0))\n Increment(Arg0)\n Increment(Local0)\n }\n Return(TEMP)\n }\n end; into method label WE1B parent_label \_SB.PCI0.LPCB.H_EC remove_entry; into method label WECB parent_label \_SB.PCI0.LPCB.H_EC remove_entry; into scope label \_SB.PCI0.LPCB.H_EC insert begin Method (WE1B, 2, NotSerialized)\n {\n OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n Store(Arg1, BYTE)\n }\n Method (WECB, 3, Serialized)\n // Arg0 - offset in bytes from zero-based EC\n // Arg1 - size of buffer in bits\n // Arg2 - value to write\n {\n ShiftRight(Arg1, 3, Arg1)\n Name(TEMP, Buffer(Arg1) { })\n Store(Arg2, TEMP)\n Add(Arg0, Arg1, Arg1)\n Store(0, Local0)\n While (LLess(Arg0, Arg1))\n {\n WE1B(Arg0, DerefOf(Index(TEMP, Local0)))\n Increment(Arg0)\n Increment(Local0)\n }\n }\n end; # patch battery status into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1CY,\s+16, replace_matched begin BCY0,8,BCY1,8, end; into method label GBID code_regex B1CY replaceall_matched begin B1B2(BCY0,BCY1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex RTEP,\s+16, replace_matched begin RTP0,8,PTP1,8, end; into method label GSBI code_regex RTEP replaceall_matched begin B1B2(RTP0,PTP1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1TM,\s+16, replace_matched begin BTM0,8,BTM1,8, end; into method label GSBI code_regex B1TM replaceall_matched begin B1B2(BTM0,BTM1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1DT,\s+16, replace_matched begin BDT0,8,BDT1,8, end; into method label GSBI code_regex B1DT replaceall_matched begin B1B2(BDT0,BDT1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex BET2,\s+16, replace_matched begin B0ET,8,B1ET,8, end; into method label SMTF code_regex BET2 replaceall_matched begin B1B2(B0ET,B1ET) end; into method label GSBI code_regex BET2 replaceall_matched begin B1B2(B0ET,B1ET) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex BARC,\s+16, replace_matched begin BAC0,8,BAC1,8, end; into method label _BST code_regex BARC replaceall_matched begin B1B2(BAC0,BAC1) end; into method label GSBI code_regex BARC replaceall_matched begin B1B2(BAC0,BAC1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex BAFC,\s+16, replace_matched begin BFC0,8,BFC1,8, end; into method label _BIF code_regex BAFC replaceall_matched begin B1B2(BFC0,BFC1) end; into method label GSBI code_regex BAFC replaceall_matched begin B1B2(BFC0,BFC1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1CR,\s+16, replace_matched begin BCR0,8,BCR1,8, end; into method label _BST code_regex B1CR replaceall_matched begin B1B2(BCR0,BCR1) end; into method label GSBI code_regex B1CR replaceall_matched begin B1B2(BCR0,BCR1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex BAPV,\s+16, replace_matched begin B0PV,8,B1PV,8, end; into method label _BST code_regex BAPV replaceall_matched begin B1B2(B0PV,B1PV) end; into method label GSBI code_regex BAPV replaceall_matched begin B1B2(B0PV,B1PV) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex BADC,\s+16, replace_matched begin BDC0,8,BDC1,8, end; into method label _BIF code_regex BADC replaceall_matched begin B1B2(BDC0,BDC1) end; into method label GSBI code_regex BADC replaceall_matched begin B1B2(BDC0,BDC1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex BADV,\s+16, replace_matched begin BDV0,8,BDV1,8, end; into method label _BIF code_regex BADV replaceall_matched begin B1B2(BDV0,BDV1) end; into method label GSBI code_regex BADV replaceall_matched begin B1B2(BDV0,BDV1) end; into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1CH,\s+32, replace_matched begin BC0H,8,BC1H,8,BC2H,8,BC3H,8, end; into method label _BIF code_regex B1CH replaceall_matched begin B1B4(BC0H,BC1H,BC2H,BC3H) end; into method label GSBI code_regex B1CH replaceall_matched begin B1B4(BC0H,BC1H,BC2H,BC3H) end; # rename 64 variable into Scope label \_SB.PCI0.LPCB.H_EC code_regex (B1MA,)\s+(64) replace_matched begin BXMA,%2,//%1%2 end; into method label GSBI code_regex B1MA replaceall_matched begin RECB(0x8F, 64) end; # rename 64 variable into Scope label \_SB.PCI0.LPCB.H_EC code_regex (B2MA,)\s+(64) replace_matched begin BYMA,%2,//%1%2 end; into method label GSBI code_regex B2MA replaceall_matched begin RECB(0x98, 64) end; into method label MHPF code_regex Store\s\(FB4,\sSMD0\) replaceall_matched begin WECB(0x1C,256,FB4) end; into method label MHPF code_regex SMD0 replaceall_matched begin RECB(0x1C, 256) end; #this line must followed the previous line # rename 256 variable into Scope label \_SB.PCI0.LPCB.H_EC code_regex (SMD0,)\s+(256) replace_matched begin SMDX,%2,//%1%2 end; # deal with the Mutex problem into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;