Contribute
Register

[Guide] How to patch DSDT for working battery status

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,950
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Sorry,it's my fault.
The first question:
There are some multibyte EC access in SSDT-2.aml.
You did not attach SSDT-2.aml this time.
No references to MCUR or BFCC in the SSDT-2.aml that you attached in post #3501.

Should I rename H_EC to EC0?
Not related to battery status. That SSDT is likely PTID... will not be used by OS X. H_EC is provided by Windows only (my guess... likely stands for "Host EC").
 
Joined
Jan 1, 2017
Messages
19
Motherboard
XiaoMi 4
CPU
Intel I5-6300HQ
Graphics
HD530 & GTX960M(HDMI is dedicated to the Nvidia)
Mobile Phone
Android,
You did not attach SSDT-2.aml this time.
No references to MCUR or BFCC in the SSDT-2.aml that you attached in post #3501.
Oh,sorry.
I mean,There are some multibyte EC access in SSDT-0.aml.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,950
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Oh,sorry.
I mean,There are some multibyte EC access in SSDT-0.aml.
These are related to WMI. Will not be used by OS X/macOS... WMI only used by Windows.
Patch them at your option.
 
Joined
Jan 1, 2017
Messages
19
Motherboard
XiaoMi 4
CPU
Intel I5-6300HQ
Graphics
HD530 & GTX960M(HDMI is dedicated to the Nvidia)
Mobile Phone
Android,
Not related to battery status. That SSDT is likely PTID... will not be used by OS X. H_EC is provided by Windows only (my guess... likely stands for "Host EC").
These are related to WMI. Will not be used by OS X/macOS... WMI only used by Windows.
Patch them at your option.
I know, thank you!
 
Joined
Jan 24, 2014
Messages
4
Motherboard
P9X79-LE
CPU
i7 4930k
Graphics
GTX 760
Mac
iMac
Mobile Phone
iOS
Hi RehabMan, fantastic guide btw
I've come up with this patch for the Razer Blade Stealth (Kaby-Lake). It is very similar to the Razer Blade 2014 patch in your repo, but I've added a buffer register to get it working properly.
Thanks for your awesome work!
 

Attachments

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,950
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Hi RehabMan, fantastic guide btw
I've come up with this patch for the Razer Blade Stealth (Kaby-Lake). It is very similar to the Razer Blade 2014 patch in your repo, but I've added a buffer register to get it working properly.
Thanks for your awesome work!
Thanks... I just added it to the Razer Blade 2014 patch (with a couple of fixes).

How is progress with the Razer Blade Stealth?
 
Joined
Jan 24, 2014
Messages
4
Motherboard
P9X79-LE
CPU
i7 4930k
Graphics
GTX 760
Mac
iMac
Mobile Phone
iOS
How is progress with the Razer Blade Stealth?
ATM I've got half the audio working, internal speakers need a bit of tweaking, it uses ALC298
Wifi is a no go I think, it has a Qualcomm Atheros QCA6174. I'm thinking of trying to replace it but just leaving it for now.
The graphics are all good, even if About This Mac says Intel Unknown. I'm using 10.11 for this because of all the problems for laptops in sierra, I though it would be safer.
The trackpad doesn't work, it uses i2c so I'm trying to use Voodooi2c to get it to work. The touchscreen worked straight away perfectly for some reason though...
 

RuleBreaker01

Banned
Joined
May 31, 2018
Messages
264
Hi Rehabman,, I make new patch for Acer one 14 z1402g, Intel Core i3-5005U (Broadwell Generations)

Here is the patch
Code:
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return (Or (Arg0, ShiftLeft (Arg1, 8))) }\n
end;

# 16-bit registers
into device label EC0 code_regex XIF1,\s+16, replace_matched begin IF10,8,IF11,8, end;
into device label EC0 code_regex XIF2,\s+16, replace_matched begin IF20,8,IF21,8, end;
into device label EC0 code_regex XIF3,\s+16, replace_matched begin IF30,8,IF31,8, end;
into device label EC0 code_regex XIF4,\s+16, replace_matched begin IF40,8,IF41,8, end;
into device label EC0 code_regex XIF7,\s+16, replace_matched begin IF70,8,IF71,8, end;
into device label EC0 code_regex XST0,\s+16, replace_matched begin ST00,8,ST01,8, end;
into device label EC0 code_regex XST1,\s+16, replace_matched begin ST10,8,ST11,8, end;
into device label EC0 code_regex XST2,\s+16, replace_matched begin ST20,8,ST21,8, end;
into device label EC0 code_regex XST3,\s+16, replace_matched begin ST30,8,ST31,8, end;
into device label EC0 code_regex BIF1,\s+16, replace_matched begin BIA0,8,BIA1,8, end;
into device label EC0 code_regex BIF1,\s+16, replace_matched begin BIB0,8,BIB1,8, end;
into device label EC0 code_regex BST1,\s+16, replace_matched begin BSA0,8,BSA1,8, end;

# fix 16-bit methods
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF1, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF10,^^PCI0.LPCB.EC0.IF11), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF2, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF20,^^PCI0.LPCB.EC0.IF21), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF3, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF30,^^PCI0.LPCB.EC0.IF31), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF4, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF40,^^PCI0.LPCB.EC0.IF41), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF7, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF70,^^PCI0.LPCB.EC0.IF71), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST00,^^PCI0.LPCB.EC0.ST01), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST1, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST10,^^PCI0.LPCB.EC0.ST11), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST2, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST20,^^PCI0.LPCB.EC0.ST21), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST3, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST30,^^PCI0.LPCB.EC0.ST31), end;


# utility methods to read/write buffers from/to EC
into method label RE1B parent_label EC0 remove_entry;
into method label RECB parent_label EC0 remove_entry;
into device label EC0 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 EC\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 EC0 remove_entry;
into method label WECB parent_label EC0 remove_entry;
into device label EC0 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;
I hope you can check it and add to your repository
Sukses.png
Sukses1.png
 

Attachments

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,950
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
ATM I've got half the audio working, internal speakers need a bit of tweaking, it uses ALC298
Wifi is a no go I think, it has a Qualcomm Atheros QCA6174. I'm thinking of trying to replace it but just leaving it for now.
The graphics are all good, even if About This Mac says Intel Unknown. I'm using 10.11 for this because of all the problems for laptops in sierra, I though it would be safer.
The trackpad doesn't work, it uses i2c so I'm trying to use Voodooi2c to get it to work. The touchscreen worked straight away perfectly for some reason though...
Hopefully WiFi is replaceable (eg. no BIOS whitelist).
You can inject "model" to fix the graphics name cosmetics.
Did you need to use the minStolenSize patch or is DVMT-prealloc changeable in BIOS (or large enough by default)?
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,950
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Hi Rehabman,, I make new patch for Acer one 14 z1402g, Intel Core i3-5005U (Broadwell Generations)

Here is the patch
Code:
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return (Or (Arg0, ShiftLeft (Arg1, 8))) }\n
end;

# 16-bit registers
into device label EC0 code_regex XIF1,\s+16, replace_matched begin IF10,8,IF11,8, end;
into device label EC0 code_regex XIF2,\s+16, replace_matched begin IF20,8,IF21,8, end;
into device label EC0 code_regex XIF3,\s+16, replace_matched begin IF30,8,IF31,8, end;
into device label EC0 code_regex XIF4,\s+16, replace_matched begin IF40,8,IF41,8, end;
into device label EC0 code_regex XIF7,\s+16, replace_matched begin IF70,8,IF71,8, end;
into device label EC0 code_regex XST0,\s+16, replace_matched begin ST00,8,ST01,8, end;
into device label EC0 code_regex XST1,\s+16, replace_matched begin ST10,8,ST11,8, end;
into device label EC0 code_regex XST2,\s+16, replace_matched begin ST20,8,ST21,8, end;
into device label EC0 code_regex XST3,\s+16, replace_matched begin ST30,8,ST31,8, end;
into device label EC0 code_regex BIF1,\s+16, replace_matched begin BIA0,8,BIA1,8, end;
into device label EC0 code_regex BIF1,\s+16, replace_matched begin BIB0,8,BIB1,8, end;
into device label EC0 code_regex BST1,\s+16, replace_matched begin BSA0,8,BSA1,8, end;

# fix 16-bit methods
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF1, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF10,^^PCI0.LPCB.EC0.IF11), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF2, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF20,^^PCI0.LPCB.EC0.IF21), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF3, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF30,^^PCI0.LPCB.EC0.IF31), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF4, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF40,^^PCI0.LPCB.EC0.IF41), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF7, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF70,^^PCI0.LPCB.EC0.IF71), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST00,^^PCI0.LPCB.EC0.ST01), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST1, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST10,^^PCI0.LPCB.EC0.ST11), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST2, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST20,^^PCI0.LPCB.EC0.ST21), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST3, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST30,^^PCI0.LPCB.EC0.ST31), end;


# utility methods to read/write buffers from/to EC
into method label RE1B parent_label EC0 remove_entry;
into method label RECB parent_label EC0 remove_entry;
into device label EC0 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 EC\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 EC0 remove_entry;
into method label WECB parent_label EC0 remove_entry;
into device label EC0 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;
I hope you can check it and add to your repository
View attachment 228727 View attachment 228728
The "MECHREVO x6TI" patch already in the repo is a match.
 
Top