-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbattery_Lenovo-Z70-80.txt
executable file
·128 lines (115 loc) · 4.68 KB
/
battery_Lenovo-Z70-80.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#Maintained by: shiyunjin for: Mojave Patches
#battery_Lenovo-Z70-80.txt
# created by shiyunjin 2018-10-28
# works for:
# Lenovo Z70-80
#Adding Methods
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\n
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;
#16BITS
into device label EC0 code_regex B1RC,\s+16, replace_matched begin RC00,8,RC01,8, end;
into device label EC0 code_regex B1FV,\s+16, replace_matched begin FV00,8,FV01,8, end;
into device label EC0 code_regex B1DV,\s+16, replace_matched begin DV00,8,DV01,8, end;
into device label EC0 code_regex B1DC,\s+16, replace_matched begin DC00,8,DC01,8, end;
into device label EC0 code_regex B1FC,\s+16, replace_matched begin FC00,8,FC01,8, end;
into device label EC0 code_regex B1AC,\s+16, replace_matched begin AC00,8,AC01,8, end;
into method label _BST code_regex \(B1RC, replaceall_matched begin (B1B2(RC00,RC01), end;
into method label _BST code_regex \(B1FV, replaceall_matched begin (B1B2(FV00,FV01), end;
into method label _BIF code_regex \(B1DV, replaceall_matched begin (B1B2(DV00,DV01), end;
into method label _BIF code_regex \(B1DC, replaceall_matched begin (B1B2(DC00,DC01), end;
into method label _BIF code_regex \(B1FC, replaceall_matched begin (B1B2(FC00,FC01), end;
into method label _BST code_regex \(B1AC, replaceall_matched begin (B1B2(AC00,AC01), end;
into method label SMTF code_regex \(B1RC, replaceall_matched begin (B1B2(RC00,RC01), end;
into method label SMTF code_regex \(B1FV, replaceall_matched begin (B1B2(FV00,FV01), end;
into method label SMTF code_regex \(B1DV, replaceall_matched begin (B1B2(DV00,DV01), end;
into method label SMTF code_regex \(B1DC, replaceall_matched begin (B1B2(DC00,DC01), end;
into method label SMTF code_regex \(B1FC, replaceall_matched begin (B1B2(FC00,FC01), end;
into method label SMTF code_regex \(B1AC, replaceall_matched begin (B1B2(AC00,AC01), end;
#MORE THAN 16BIT
# From native DSDT:
#
# OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
# Field (ERAM, ByteAcc, Lock, Preserve)
# {
# ...
# Offset (0x12),
# FUSL, 8, //12
# FUSH, 8, //13
# FWBT, 64, //14
# Offset (0x5D),
# EXSI, 8, //5d
# EXSB, 8, //5e
# EXND, 8, //5f
# SMPR, 8, //60
# SMST, 8, //61
# SMAD, 8, //62
# SMCM, 8, //63
# SMDA, 256,//64
# Note: Offsets corrected by RehabMan (original calculations by raff were wrong)
into device label EC0 code_regex (FWBT,)\s+(64) replace_matched begin FWBZ,%2,//%1%2 end;
into method label MHIF code_regex \(FWBT, replaceall_matched begin (RECB(0x14,64), end;
into method label GBID code_regex \(FWBT, replaceall_matched begin (RECB(0x14,64), end;
into device label EC0 code_regex (SMDA,)\s+(256) replace_matched begin SMDY,%2,//%1%2 end;
into method label MHPF code_regex \(SMDA, replaceall_matched begin (RECB(0x64,256), end;
into method label CFUN code_regex \(SMDA, replaceall_matched begin (RECB(0x64,256), end;
into method label MHPF code_regex Store\s\(FB4,\sSMDA\) replaceall_matched begin WECB(0x64,256, FB4) end;
into method label CFUN code_regex Store\s\(Zero,\sSMDA\) replaceall_matched begin WECB(0x64,256, Zero) end;