forked from RehabMan/HP-ProBook-4x30s-DSDT-Patch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
06_Battery.txt
149 lines (130 loc) · 7.48 KB
/
06_Battery.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#Maintained by: RehabMan for: HP Probook 4x30s/4x40s
# 06_Battery.txt
# Add cycle count and temperature to battery info method
# 16-bit version
into method label BTIF code_regex Store\s\(BDAT,\sLocal1\) replace_matched
begin
Store (BDAT, Local1)\n
// battery cycle count\n
Store (BCC, Index (DerefOf (Index (NBTI, Arg0)), 0x0D))\n
// battery temperature\n
Store (\\_TZ.GTTP (0x04, 0x05, Zero, Zero, 0x7F), Local2)\n
Add (Multiply (Local2, 10), 2732, Local2) // Celsius to .1K\n
Store (Local2, Index (DerefOf (Index (NBTI, Arg0)), 0x0E))\n
end;
# Need to extend size of NBTI packages
into all code_regex \"Hewlett\-Packard\"\s+\},\s+Package\s\(0x0D\) replaceall_matched
begin
"Hewlett-Packard",\n
Zero,\n
Zero,\n
},\n
Package(0x0F)\n
end;
into all code_regex Name\s\(NBTI,\sPackage\s\(0x02\)\s+\{\s+Package\s\(0x0D\) replaceall_matched
begin
Name (NBTI, Package(0x02)\n
{\n
Package(0x0F)\n
end;
into_all all code_regex \"LIon\",\s+\"Hewlett\-Packard\"\n\s+\}\n replaceall_matched
begin
"LIon",\n
"Hewlett-Packard",\n
Zero,\n
Zero,\n
}\n
end;
# Convert battery EC info from 16-bit to 8-bit fields...
# Need this utility method B1B2(lowbyte, hibyte)... returns ((hibyte << 8) | lowbyte)
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized)\n
{\n
ShiftLeft (Arg1, 8, Local0)\n
Or (Arg0, Local0, Local0)\n
Return (Local0)\n
}\n
end;
# Change EC register declarations from 16-bit to 8-bit
into device label EC0 code_regex BSN,\s+16 replace_matched begin BSN0, 8, BSN1, 8 end;
into device label EC0 code_regex CBT,\s+16 replace_matched begin CBT0, 8, CBT1, 8 end;
into device label EC0 code_regex BDC,\s+16 replace_matched begin BDC0, 8, BDC1, 8 end;
into device label EC0 code_regex BFC,\s+16 replace_matched begin BFC0, 8, BFC1, 8 end;
into device label EC0 code_regex BPR,\s+16 replace_matched begin BPR0, 8, BPR1, 8 end;
into device label EC0 code_regex BCR,\s+16 replace_matched begin BCR0, 8, BCR1, 8 end;
into device label EC0 code_regex BRC,\s+16 replace_matched begin BRC0, 8, BRC1, 8 end;
into device label EC0 code_regex BCC,\s+16 replace_matched begin BCC0, 8, BCC1, 8 end;
into device label EC0 code_regex BPV,\s+16 replace_matched begin BPV0, 8, BPV1, 8 end;
into device label EC0 code_regex BME,\s+16 replace_matched begin BME0, 8, BME1, 8 end;
into device label EC0 code_regex BDV,\s+16 replace_matched begin BDV0, 8, BDV1, 8 end;
into device label EC0 code_regex BRTE,\s+16 replace_matched begin RTE0, 8, RTE1, 8 end;
into device label EC0 code_regex BATE,\s+16 replace_matched begin ATE0, 8, ATE1, 8 end;
into device label EC0 code_regex BCV1,\s+16 replace_matched begin BCX0, 8, BCX1, 8 end;
into device label EC0 code_regex BCV2,\s+16 replace_matched begin BCA0, 8, BCA1, 8 end;
into device label EC0 code_regex BCV3,\s+16 replace_matched begin BCB0, 8, BCB1, 8 end;
into device label EC0 code_regex BCV4,\s+16 replace_matched begin BCP0, 8, BCP1, 8 end;
into device label EC0 code_regex BATF,\s+16 replace_matched begin ATF0, 8, ATF1, 8 end;
into device label EC0 code_regex MAXC,\s+16 replace_matched begin AXC0, 8, AXC1, 8 end;
into device label EC0 code_regex BSTS,\s+16 replace_matched begin BST0, 8, BST1, 8 end;
into device label EC0 code_regex BDAT,\s+16 replace_matched begin BDA0, 8, BDA1, 8 end;
# Change access (reads) to those registers from 16-bit to 8-bit
into_all method label BTIF code_regex \(BFC, replaceall_matched begin (B1B2 (BFC0, BFC1), end;
into_all method label GBTI code_regex \(BFC, replaceall_matched begin (B1B2 (BFC0, BFC1), end;
into_all method label BTIF code_regex \(BDV, replaceall_matched begin (B1B2 (BDV0, BDV1), end;
into_all method label GBTI code_regex \(BDV, replaceall_matched begin (B1B2 (BDV0, BDV1), end;
into_all method label BTIF code_regex \(BSN, replaceall_matched begin (B1B2 (BSN0, BSN1), end;
into_all method label GBTI code_regex \(BSN, replaceall_matched begin (B1B2 (BSN0, BSN1), end;
into_all method label BTST code_regex \(BPR, replaceall_matched begin (B1B2 (BPR0, BPR1), end;
into_all method label GBTI code_regex \(BPR, replaceall_matched begin (B1B2 (BPR0, BPR1), end;
into_all method label BTST code_regex \(BRC, replaceall_matched begin (B1B2 (BRC0, BRC1), end;
into_all method label GBTI code_regex \(BRC, replaceall_matched begin (B1B2 (BRC0, BRC1), end;
into_all method label GBTI code_regex \(BCR, replaceall_matched begin (B1B2 (BCR0, BCR1), end;
into_all method label BTST code_regex \(BPV, replaceall_matched begin (B1B2 (BPV0, BPV1), end;
into_all method label GBTI code_regex \(BPV, replaceall_matched begin (B1B2 (BPV0, BPV1), end;
into_all method label GBTI code_regex \(BDC, replaceall_matched begin (B1B2 (BDC0, BDC1), end;
into_all method label GBTI code_regex \(BME, replaceall_matched begin (B1B2 (BME0, BME1), end;
into_all method label GBTI code_regex \(BCC, replaceall_matched begin (B1B2 (BCC0, BCC1), end;
into_all method label BTIF code_regex \(BCC, replaceall_matched begin (B1B2 (BCC0, BCC1), end;
into_all method label GBTI code_regex \(CBT, replaceall_matched begin (B1B2 (CBT0, CBT1), end;
into_all method label GBTI code_regex \(BSTS, replaceall_matched begin (B1B2 (BST0, BST1), end;
into_all method label BTIF code_regex \(BDAT, replaceall_matched begin (B1B2 (BDA0, BDA1), end;
into_all method label GBTI code_regex \(BDAT, replaceall_matched begin (B1B2 (BDA0, BDA1), end;
into_all method label GBTI code_regex \(BCV1, replaceall_matched begin (B1B2 (BCX0, BCX1), end;
into_all method label GBTI code_regex \(BCV2, replaceall_matched begin (B1B2 (BCA0, BCA1), end;
into_all method label GBTI code_regex \(BCV3, replaceall_matched begin (B1B2 (BCB0, BCB1), end;
into_all method label GBTI code_regex \(BCV4, replaceall_matched begin (B1B2 (BCP0, BCP1), end;
into_all method label GBTI code_regex \(BRTE, replaceall_matched begin (B1B2 (RTE0, RTE1), end;
into_all method label GBTI code_regex \(BATE, replaceall_matched begin (B1B2 (ATE0, ATE1), end;
into_all method label GBTI code_regex \(BATF, replaceall_matched begin (B1B2 (ATF0, ATF1), end;
into_all method label GBTC code_regex \(MAXC, replaceall_matched begin (B1B2 (AXC0, AXC1), end;
# Now deal with the writes to those registers
# Store (0xFA, MAXC)
into_all method label SBTC code_regex \(0xFA,\sMAXC\) replaceall_matched begin (0xFA, AXC0)\nStore (Zero, AXC1) end;
# Store (Zero, MAXC)
into_all method label SBTC code_regex \(Zero,\sMAXC\) replaceall_matched begin (Zero, AXC0)\nStore (Zero, AXC1) end;
# Store (0x00, MAXC)
into_all method label SBTC code_regex \(0x00,\sMAXC\) replaceall_matched begin (0x00, AXC0)\nStore (0x00, AXC1) end;
# Store (GBSS (B1B2 (BSN0, BSN1), BDAT, BTSN)
into_all method label GBTI code_regex Store\s\(GBSS\s\(B1B2\s\(BSN0,\sBSN1\),\sBDAT\),\sBTSN\) replaceall_matched
begin
Store (GBSS (B1B2 (BSN0, BSN1), B1B2 (BDA0, BDA1)), BTSN)\n
end;
# Disable BAT1 device
into method label _STA parent_label BAT1 replace_content begin Return (Zero) end;
# Fix method PPNT, called from AC adapter device (AC/ADP1) (ProBooks)
into method label PPNT parent_label EC0 replace_content begin // nothing end;
# Fix method PNOT, called from AC adapter device (AC/ADP1) (EliteBooks?)
into method label PNOT replace_content begin // nothing end;
# These are not really battery related, but similar problems...
# Fix method PCNT, called from HWAK which is called from _WAK
into method label PCNT replace_content begin // nothing end;
# CFGD is an External in an SSDT being dropped...
into method label _WAK code_regex (If\s+\(And\s+\(CFGD,\s+0x01000000\)\)[\s\S]*\((0x01|One),\s+0x48\)\n.*\n.*\}) replace_matched
begin
If (CondRefOf(CFGD))\n
{\n
%1\n
}\n
end;