into device label H_EC code_regex IWCW,\s+160, replace_matched begin XWCW,160, end;
into device label H_EC code_regex IWCR,\s+160, replace_matched begin XWCR,160, end;
into device label H_EC code_regex B2RC,\s+16, replace_matched begin RC20,8,RC21,8, end;
into device label H_EC code_regex B2FC,\s+16, replace_matched begin FC20,8,FC21,8, end;
into device label H_EC code_regex B2FV,\s+16, replace_matched begin FV20,8,FV21,8, end;
into device label H_EC code_regex B2DI,\s+16, replace_matched begin DI20,8,DI21,8, end;
into device label H_EC code_regex B2CI,\s+16, replace_matched begin CI20,8,CI21,8, end;
into device label H_EC code_regex WKRS,\s+16, replace_matched begin KRS0,8,KRS1,8, end;
into device label H_EC code_regex B2DC,\s+16, replace_matched begin DC20,8,DC21,8, end;
into device label H_EC code_regex B2DV,\s+16, replace_matched begin DV20,8,DV21,8, end;
into method label PCMD code_regex Store\s\(Arg0,\s\^\^PCI0.LPCB.H_EC.IWCW\) replaceall_matched begin \\_SB.PCI0.LPCB.H_EC.WECB(0x04,160,Arg0) end;
into method label ITPW code_regex Store\s\(Arg0,\s\^\^PCI0.LPCB.H_EC.IWCW\) replaceall_matched begin \\_SB.PCI0.LPCB.H_EC.WECB(0x04,160,Arg0) end;
into method label ITPR code_regex \(\^\^PCI0.LPCB.H_EC.IWCR\) replaceall_matched begin (\\_SB.PCI0.LPCB.H_EC.RECB(0x18,160)) end;
into method label _BST code_regex RefOf\s\(B2RC\) replaceall_matched begin B1B2(RefOf(RC20),RefOf(RC21)) end;
into method label _BIF code_regex RefOf\s\(B2FC\) replaceall_matched begin B1B2(RefOf(FC20),RefOf(FC21)) end;
into method label _BIX code_regex RefOf\s\(B2FC\) replaceall_matched begin B1B2(RefOf(FC20),RefOf(FC21)) end;
into method label _BLT code_regex RefOf\s\(B2FC\) replaceall_matched begin B1B2(RefOf(FC20),RefOf(FC21)) end;
into method label _BST code_regex RefOf\s\(B2FV\) replaceall_matched begin B1B2(RefOf(FV20),RefOf(FV21)) end;
into method label _BLT code_regex RefOf\s\(B2FV\) replaceall_matched begin B1B2(RefOf(FV20),RefOf(FV21)) end;
into method label _BST code_regex RefOf\s\(B2DI\) replaceall_matched begin B1B2(RefOf(DI20),RefOf(DI21)) end;
into method label _BST code_regex RefOf\s\(B2CI\) replaceall_matched begin B1B2(RefOf(CI20),RefOf(CI21)) end;
into method label _WAK code_regex \(\\_SB.PCI0.LPCB.H_EC.WKRS, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.KRS0,\\_SB.PCI0.LPCB.H_EC.KRS1), end;
into method label _BIF code_regex RefOf\s\(B2DC\) replaceall_matched begin B1B2(RefOf(DC20),RefOf(DC21)) end;
into method label _BIX code_regex RefOf\s\(B2DC\) replaceall_matched begin B1B2(RefOf(DC20),RefOf(DC21)) end;
into method label _BIF code_regex RefOf\s\(B2DV\) replaceall_matched begin B1B2(RefOf(DV20),RefOf(DV21)) end;
into method label _BIF code_regex \(B2DV, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.DV20,\\_SB.PCI0.LPCB.H_EC.DV21), end;
into method label _BIX code_regex RefOf\s\(B2DV\) replaceall_matched begin B1B2(RefOf(DV20),RefOf(DV21)) end;
into method label _BST code_regex RefOf\s\(B2DV\) replaceall_matched begin B1B2(RefOf(DV20),RefOf(DV21)) end;
into method label _STA parent_label BAT0 replace_content begin Return (0x00) end;
into method label _STA parent_label BAT2 replace_content begin Return (0x00) end;
into method label _STA parent_label ALSD replace_content begin Return (Zero) end;
#B1B2
#B1B3
#B1B4
#RECB
#WECB
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;
#For 24 bit registers
into method label B1B3 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B3, 3, NotSerialized)\n
{\n
Store(Arg2, Local0)\n
Or(Arg1, ShiftLeft(Local0, 8), Local0)\n
Or(Arg0, ShiftLeft(Local0, 8), Local0)\n
Return(Local0)\n
}\n
end;
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;
# utility methods to read/write buffers from/to EC
into method label RE1B parent_label H_EC remove_entry;
into method label RECB parent_label H_EC remove_entry;
# Some DSDTs use Mutex objects with non-zero a SyncLevel. Evidently,
# OS X has some difficulty with this part of the ACPI spec, either that
# or the DSDTs are, in fact, codec incorrectly and Windows is ignoring
# it.
# The common result of a non-zero SyncLevel is failure of methods at the
# point of Acquire on the mutext in question. This can result in strange
# behavior, failed battery status, or other issues.
#
# This patch corrects all Mutex objects declared with a non-zero
# SyncLevel to use zero.
#
# 2x as there is some sort of MaciASL bug...
# (code_regex_not seems broken)
#into_all all code_regex_not Mutex\s+\([^,]*,\s+0x00\) code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
#into_all all code_regex_not Mutex\s+\([^,]*,\s+0x00\) code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
# 10x as workaround for MaciASL bug...
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
#Logic bug with charging/discharging status (AC adapter detection)
#Some DSDTs suffer from a logic bug where at the point of 100% capacity (fully charged battery), an incorrect #status is returned from _BST. This mostly affects certain ASUS laptops, but also a few others.
#Here is a patch to correct this problem:
into method label FBST code_regex If\s\(CHGS\s\(Zero\)\)[\s]+\{[\s]+Store\s\(0x02,\sLocal0\)[\s]+\}[\s]+Else[\s]+\{[\s]+Store\s\(One,\sLocal0\)[\s]+\} replaceall_matched begin
If (CHGS (Zero))\n
{\n
Store (0x02, Local0)\n
}\n
Else\n
{\n
Store (Zero, Local0)\n
}
end;
#Fix HP OMEN Laptop Baterry to enabled percentage and discharge time
into method label SMWR code_regex If\s\(LNot\s\(ECOK\)\)\s+\{\s+Return\s\(0xFF\)\s+\} replaceall_matched begin
If (LEqual (ECOK, One))\n
{\n
Return (0xFF)\n
}\n
end;
#Fix Hasee YOUYA Laptop Baterry to enabled percentage and discharge time
into method label SMWR code_regex If\s\(LNot\s\(ECON\)\)\s+\{\s+Return\s\(0xFF\)\s+\} replaceall_matched begin
If (LEqual (ECON, One))\n
{\n
Return (0xFF)\n
}\n
end;
#into definitionblock code_regex . insert
#begin
#External (_SB.PCI0.BATC, DeviceObj)
#end
复制代码
SSDT-1打补丁:
#LENOVO Rescuer 15-ISK
#MaiBenBen FengMai (i7-6700HQ)
#Created By Mison
#SMD0, 256,
#B1CH, 32,
#B1DT, 16,
#B1CY, 16,
#B1MA, 64,
#B2MA, 64,
#RTEP, 16,
#BET2, 16,
#B1TM, 16,
#BAPV, 16,
#BARC, 16,
#BADC, 16,
#BADV, 16,
#BAFC, 16,
#B1CR, 16,
into_all all code_regex SMD0,\s+256, replace_matched begin XMD0,256, end;
into_all all code_regex B1CH,\s+32, replace_matched begin CH10,8,CH11,8,CH12,8,CH13,8, end;
into_all all code_regex B1DT,\s+16, replace_matched begin DT10,8,DT11,8, end;
into_all all code_regex B1CY,\s+16, replace_matched begin CY10,8,CY11,8, end;
into_all all code_regex B1MA,\s+64, replace_matched begin X1MA,64, end;
into_all all code_regex B2MA,\s+64, replace_matched begin X2MA,64, end;
into_all all code_regex RTEP,\s+16, replace_matched begin TEP0,8,TEP1,8, end;
into_all all code_regex BET2,\s+16, replace_matched begin ET20,8,ET21,8, end;
into_all all code_regex B1TM,\s+16, replace_matched begin TM10,8,TM11,8, end;
into_all all code_regex BAPV,\s+16, replace_matched begin APV0,8,APV1,8, end;
into_all all code_regex BARC,\s+16, replace_matched begin ARC0,8,ARC1,8, end;
into_all all code_regex BADC,\s+16, replace_matched begin ADC0,8,ADC1,8, end;
into_all all code_regex BADV,\s+16, replace_matched begin ADV0,8,ADV1,8, end;
into_all all code_regex BAFC,\s+16, replace_matched begin AFC0,8,AFC1,8, end;
into_all all code_regex B1CR,\s+16, replace_matched begin CR10,8,CR11,8, end;
into method label MHPF code_regex Store\s\(FB4,\sSMD0\) replaceall_matched begin \\_SB.PCI0.LPCB.H_EC.WECB(0x1C,256,FB4) end;
into method label MHPF code_regex \(SMD0, replaceall_matched begin (\\_SB.PCI0.LPCB.H_EC.RECB(0x1C,256), end;
into method label _BIF code_regex \(B1CH, replaceall_matched begin (B1B4(\\_SB.PCI0.LPCB.H_EC.CH10,\\_SB.PCI0.LPCB.H_EC.CH11,\\_SB.PCI0.LPCB.H_EC.CH12,\\_SB.PCI0.LPCB.H_EC.CH13), end;
into method label GSBI code_regex \(B1CH, replaceall_matched begin (B1B4(\\_SB.PCI0.LPCB.H_EC.CH10,\\_SB.PCI0.LPCB.H_EC.CH11,\\_SB.PCI0.LPCB.H_EC.CH12,\\_SB.PCI0.LPCB.H_EC.CH13), end;
into method label GSBI code_regex \(B1DT, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.DT10,\\_SB.PCI0.LPCB.H_EC.DT11), end;
into method label GBID code_regex \(B1CY, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.CY10,\\_SB.PCI0.LPCB.H_EC.CY11), end;
into method label GSBI code_regex \(B1MA, replaceall_matched begin (\\_SB.PCI0.LPCB.H_EC.RECB(0x8F,64), end;
into method label GSBI code_regex \(B2MA, replaceall_matched begin (\\_SB.PCI0.LPCB.H_EC.RECB(0x98,64), end;
into method label GSBI code_regex \(RTEP, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.TEP0,\\_SB.PCI0.LPCB.H_EC.TEP1), end;
into method label SMTF code_regex \(BET2\) replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ET20,\\_SB.PCI0.LPCB.H_EC.ET21)) end;
into method label GSBI code_regex \(BET2, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ET20,\\_SB.PCI0.LPCB.H_EC.ET21), end;
into method label GSBI code_regex \(B1TM, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.TM10,\\_SB.PCI0.LPCB.H_EC.TM11), end;
into method label _BST code_regex \(BAPV, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.APV0,\\_SB.PCI0.LPCB.H_EC.APV1), end;
into method label GSBI code_regex \(BAPV, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.APV0,\\_SB.PCI0.LPCB.H_EC.APV1), end;
into method label _BST code_regex \(BARC, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ARC0,\\_SB.PCI0.LPCB.H_EC.ARC1), end;
into method label GSBI code_regex \(BARC, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ARC0,\\_SB.PCI0.LPCB.H_EC.ARC1), end;
into method label _BIF code_regex \(BADC, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ADC0,\\_SB.PCI0.LPCB.H_EC.ADC1), end;
into method label GSBI code_regex \(BADC, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ADC0,\\_SB.PCI0.LPCB.H_EC.ADC1), end;
into method label _BIF code_regex \(BADV, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ADV0,\\_SB.PCI0.LPCB.H_EC.ADV1), end;
into method label _BST code_regex BADV, replaceall_matched begin B1B2(\\_SB.PCI0.LPCB.H_EC.ADV0,\\_SB.PCI0.LPCB.H_EC.ADV1), end;
into method label GSBI code_regex \(BADV, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.ADV0,\\_SB.PCI0.LPCB.H_EC.ADV1), end;
into method label _BIF code_regex \(BAFC, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.AFC0,\\_SB.PCI0.LPCB.H_EC.AFC1), end;
into method label GSBI code_regex \(BAFC, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.AFC0,\\_SB.PCI0.LPCB.H_EC.AFC1), end;
into method label _BST code_regex \(B1CR, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.CR10,\\_SB.PCI0.LPCB.H_EC.CR11), end;
into method label GSBI code_regex \(B1CR, replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.H_EC.CR10,\\_SB.PCI0.LPCB.H_EC.CR11), end;
into method label _STA parent_label BAT1 replace_content begin Return (0x1F) end;