forked from MashudiSudonym/t430-mojave-efi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathT430-DSDT-patches.txt
executable file
·798 lines (697 loc) · 28.8 KB
/
T430-DSDT-patches.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
######T430-DSDT-Patches
######system_SMBUS (unchanged))
#Maintained by: RehabMan for: Laptop Patches
#system_SMBUS.txt
# SMBUS fix
into device label BUS0 parent_adr 0x001F0003 remove_entry;
into device name_adr 0x001F0003 insert
begin
Device (BUS0)\n
{\n
Name (_CID, "smbus")\n
Name (_ADR, Zero)\n
Device (DVL0)\n
{\n
Name (_ADR, 0x57)\n
Name (_CID, "diagsvault")\n
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package() { "address", 0x57 })\n
}\n
}\n
}\n
end;
######system_IRQ (unchanged)
#Maintained by: RehabMan for: Laptop Patches
#system_IRQ.txt
# This can fix non-working audio and also has an affect on HPET.
#
# Use this if you have issues with patched AppleHDA (required on almost all laptops)
# or if you have issues with HPET (restart after wake).
# IRQ fix
into device name_hid PNP0000 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0100 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0B00 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0103 code_regex IRQNoFlags\s\(\)\n\s+\{.*\} removeall_matched;
into device name_hid PNP0103 code_regex Name\s\(([^,]+),\sResourceTemplate\s\(\).*\n\s+\{((?:.|\n)*)\}\) replace_matched
begin
Name (%1, ResourceTemplate()\n
{\n
IRQNoFlags() { 0, 8, 11, 15 }\n
%2
})\n
end;
######system_PNOT (unchanged)
#Maintained by: RehabMan for: Laptop Patches
#system_PNOT.txt
# PNOT or PPNT are commonly called from EC/AC adapter related code
# and often access identifiers that are present in SSDTs generally
# dropped (CPU SSDTs)
#
# Because of this, it is best to make these methods do nothing.
# make PNOT/PPNT/PNTF a no-op
into method label PNOT replace_content begin // nothing end;
into method label PPNT replace_content begin // nothing end;
into method label PNTF replace_content begin // nothing end;
######graphics_PNLF_ivy_sandy (unchanged)
#Maintained by: RehabMan for: Laptop Patches
#graphics_PNLF_ivy_sandy.txt
# This patch enables the brightness slider in SysPrefs->Displays
# and will also enable activation of sleep mode by closing
# the laptop lid.
#
# This particular version is intended to be used with ACPIBacklight.kext
# although it can also be used with AppleBacklight.kext,
# provided AppleBacklight.kext is patched to recognize your
# display or an injector is used to set brightness levels.
#
# See this thread for more information:
# http://www.tonymacx86.com/hp-probook-mavericks/121031-native-brightness-working-without-blinkscreen-using-patched-applebacklight-kext.html
# (also read any linked threads)
#
# Note: This patch should be applied to the DSDT or SSDT that defines
# your integrated graphics device (always at _ADR 0x00020000)
#
# This patch works for both Sandy Bridge and Ivy Bridge graphics.
# also reported to work with graphics prior to Sandy Bridge (eg. Arrandale)
#
into_all device label PNLF remove_entry;
into_all device name_adr 0x00020000 code_regex (OperationRegion\s\(RMPC,\sPCI_Config[^\}]*\}) remove_matched;
into device name_adr 0x00020000 insert
begin
OperationRegion (RMPC, PCI_Config, 0x10, 4)\n
Field (RMPC, AnyAcc, NoLock, Preserve)\n
{\n
BAR1,32,\n
}\n
Device (PNLF)\n
{\n
// normal PNLF declares (note some of this probably not necessary)\n
Name (_ADR, Zero)\n
Name (_HID, EisaId ("APP0002"))\n
Name (_CID, "backlight")\n
Name (_UID, 10)\n
Name (_STA, 0x0B)\n
//define hardware register access for brightness\n
// lower nibble of BAR1 is status bits and not part of the address\n
OperationRegion (BRIT, SystemMemory, And(^BAR1, Not(0xF)), 0xe1184)\n
Field (BRIT, AnyAcc, Lock, Preserve)\n
{\n
Offset(0x48250),\n
LEV2, 32,\n
LEVL, 32,\n
Offset(0x70040),\n
P0BL, 32,\n
Offset(0xc8250),\n
LEVW, 32,\n
LEVX, 32,\n
Offset(0xe1180),\n
PCHL, 32,\n
}\n
// DEB1 special for setting KLVX at runtime...\n
//Method (DEB1, 1, NotSerialized)\n
//{\n
// Store(Arg0, KLVX)\n
//}\n
// LMAX: use 0x710 to force OS X value\n
// or use any arbitrary value\n
// or use 0 to capture BIOS setting\n
Name (LMAX, 0x710)\n
// KMAX: defines the unscaled range in the _BCL table below\n
Name (KMAX, 0x710)\n
// KPCH: saved value for PCHL\n
// use Ones if PCHL does not need to be set (normal)\n
// use Zero if your laptop nees PCHL set on every brightness set\n
// you can also use a custom value (not Ones, not Zero)\n
Name(KPCH, Ones)\n
// _INI deals with differences between native setting and desired\n
Method (_INI, 0, NotSerialized)\n
{\n
// save value of PCHL for later\n
If (LNot(KPCH)) { Store(PCHL, KPCH) }\n
// determine LMAX to use\n
If (LNot(LMAX)) { Store(ShiftRight(LEVX,16), LMAX) }\n
If (LNot(LMAX)) { Store(KMAX, LMAX) }\n
Store(ShiftLeft(LMAX,16), KLVX)\n
If (LNotEqual(LMAX, KMAX))\n
{\n
// Scale all the values in _BCL to the PWM max in use\n
Store(0, Local0)\n
While (LLess(Local0, SizeOf(_BCL)))\n
{\n
Store(DerefOf(Index(_BCL,Local0)), Local1)\n
Divide(Multiply(Local1,LMAX), KMAX,, Local1)\n
Store(Local1, Index(_BCL,Local0))\n
Increment(Local0)\n
}\n
// Also scale XRGL and XRGH values\n
Divide(Multiply(XRGL,LMAX), KMAX,, XRGL)\n
Divide(Multiply(XRGH,LMAX), KMAX,, XRGH)\n
}\n
// adjust values to desired LMAX\n
Store(ShiftRight(LEVX,16), Local1)\n
If (LNotEqual(Local1, LMAX))\n
{\n
Store(LEVL, Local0)\n
If (LOr(LNot(Local0),LNot(Local1))) { Store(LMAX, Local0) Store(LMAX, Local1) }\n
Divide(Multiply(Local0,LMAX), Local1,, Local0)\n
//REVIEW: wait for vblank before setting new PWM config\n
//Store(P0BL, Local7)\n
//While (LEqual (P0BL, Local7)) {}\n
If (LGreater(LEVL, LMAX))\n
{ Store(KLVX, LEVX) Store(Local0, LEVL) }\n
Else\n
{ Store(Local0, LEVL) Store(KLVX, LEVX) }\n
}\n
}\n
// _BCM/_BQC: set/get for brightness level\n
Method (_BCM, 1, NotSerialized)\n
{\n
// initialize for consistent backlight level before/after sleep\n
If (LAnd(LNotEqual(KPCH, Ones),LNotEqual(PCHL, KPCH))) { Store(KPCH, PCHL) }\n
If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
// store new backlight level\n
Store(Match(_BCL, MGE, Arg0, MTR, 0, 2), Local0)\n
If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n
If (LNotEqual(LEV2, 0x80000000)) { Store(0x80000000, LEV2) }\n
Store(DerefOf(Index(_BCL, Local0)), LEVL)\n
}\n
Method (_BQC, 0, NotSerialized)\n
{\n
Store(Match(_BCL, MGE, LEVL, MTR, 0, 2), Local0)\n
If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n
Return(DerefOf(Index(_BCL, Local0)))\n
}\n
Method (_DOS, 1, NotSerialized)\n
{\n
// Note: Some systems have this defined in DSDT, so uncomment\n
// the next line if that is the case.\n
//External(^^_DOS, MethodObj)\n
^^_DOS(Arg0)\n
}\n
// extended _BCM/_BQC for setting "in between" levels\n
Method (XBCM, 1, NotSerialized)\n
{\n
// initialize for consistent backlight level before/after sleep\n
If (LAnd(LNotEqual(KPCH, Ones),LNotEqual(PCHL, KPCH))) { Store(KPCH, PCHL) }\n
If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
// store new backlight level\n
If (LGreater(Arg0, XRGH)) { Store(XRGH, Arg0) }\n
If (LAnd(Arg0, LLess(Arg0, XRGL))) { Store(XRGL, Arg0) }\n
If (LNotEqual(LEV2, 0x80000000)) { Store(0x80000000, LEV2) } \n
Store(Arg0, LEVL)\n
}\n
Method (XBQC, 0, NotSerialized)\n
{\n
Store(LEVL, Local0)\n
If (LGreater(Local0, XRGH)) { Store(XRGH, Local0) }\n
If (LAnd(Local0, LLess(Local0, XRGL))) { Store(XRGL, Local0) }\n
Return(Local0)\n
}\n
// Set XOPT bit 0 to disable smooth transitions\n
// Set XOPT bit 1 to wait for native BacklightHandler\n
// Set XOPT bit 2 to force use of native BacklightHandler\n
Name (XOPT, 0x02)\n
// XRGL/XRGH: defines the valid range\n
Name (XRGL, 40)\n
Name (XRGH, 1808)\n
// KLVX is initialization value for LEVX\n
Name (KLVX, 0x7100000)\n
// _BCL: returns list of valid brightness levels\n
// first two entries describe ac/battery power levels\n
Name (_BCL, Package()\n
{\n
1808,\n
479,\n
0,\n
53, 55, 57, 59,\n
62, 66, 71, 77,\n
83, 91, 99, 108,\n
119, 130, 142, 154,\n
168, 183, 198, 214,\n
232, 250, 269, 289,\n
309, 331, 354, 377,\n
401, 426, 453, 479,\n
507, 536, 566, 596,\n
627, 660, 693, 727,\n
762, 797, 834, 872,\n
910, 949, 990, 1031,\n
1073, 1115, 1159, 1204,\n
1249, 1296, 1343, 1391,\n
1440, 1490, 1541, 1592,\n
1645, 1698, 1753, 1808,\n
})\n
}\n
end;
######graphics_Rename-PCI0_VID (unchanged)
#Maintained by: RehabMan for: Laptop Patches
#graphics_Rename-PCI0_VID.txt
# Note: Most DSDT/SSDTs use GFX0 for the integrated graphics
# device. If that is the case with your DSDT, do not use this
# patch and instead use "Rename GFX0 to IGPU"
# Note: This patch is a minimalistic rename that only
# touches PCI0.VID. Useful for some Lenovo machines
# that have both a PCI0.VID and PCI0.PEG.VID.
into device label VID parent_label PCI0 set_label begin IGPU end;
into_all all code_regex PCI0\.VID_ replaceall_matched begin PCI0.IGPU end;
into_all all code_regex PCI0\.VID replaceall_matched begin PCI0.IGPU end;
into_all scope label \_SB.PCI0.VID.LCD0 set_label begin \_SB.PCI0.IGPU.LCD0 end;
into_all scope label \_SB.PCI0.VID set_label begin \_SB.PCI0.IGPU end;
######usb_7-series (unchanged)
#Maintained by: RehabMan for: Laptop Patches
#usb_USB_7-series.txt
# USB property injection for 7-series boards (originally HM76)
# Insert Apple USB properties into EHC1
into method label _DSM parent_adr 0x001D0000 remove_entry;
into device name_adr 0x001D0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"AAPL,clock-id", Buffer() { 0x01 },\n
"built-in", Buffer() { 0x00 },\n
"subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
"subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
"AAPL,current-available", 2100,\n
"AAPL,current-extra", 2200,\n
"AAPL,current-extra-in-sleep", 1600,\n
"AAPL,device-internal", 0x02,\n
"AAPL,max-port-current-in-sleep", 2100,\n
})\n
}\n
end;
# Insert Apple USB properties into EHC2
into method label _DSM parent_adr 0x001A0000 remove_entry;
into device name_adr 0x001A0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"AAPL,clock-id", Buffer() { 0x01 },\n
"built-in", Buffer() { 0x00 },\n
"subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
"subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
"AAPL,current-available", 2100,\n
"AAPL,current-extra", 2200,\n
"AAPL,current-extra-in-sleep", 1600,\n
"AAPL,device-internal", 0x02,\n
"AAPL,max-port-current-in-sleep", 2100,\n
})\n
}\n
end;
# Insert Apple USB properties into USB 3.0 XHC
into method label _DSM parent_adr 0x00140000 remove_entry;
into device name_adr 0x00140000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"AAPL,clock-id", Buffer() { 0x02 },\n
"built-in", Buffer() { 0x00 },\n
"subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
"subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
"AAPL,current-available", 2100,\n
"AAPL,current-extra", 2200,\n
"AAPL,current-extra-in-sleep", 1600,\n
"AAPL,device-internal", 0x02,\n
"AAPL,max-port-current-in-sleep", 2100,\n
})\n
}\n
end;
######usb_prw_0x0d_xhc (unchanged)
#Maintained by: RehabMan for: Laptop Patches
#usb_prw_0x0d_xhc.txt
# remove _PRW methods to prevent instant wake
# delete any existing XHC1 device
into device label XHC1 name_adr 0x00140000 remove_entry;
# delete any existing USB2 device
into device label USB2 name_adr 0x001D0000 remove_entry;
# if _PRW objects are methods
into method label _PRW parent_adr 0x001D0000 remove_entry;
into method label _PRW parent_adr 0x001A0000 remove_entry;
into method label _PRW parent_adr 0x00140000 remove_entry;
into method label _PRW parent_adr 0x001B0000 remove_entry;
# some other LAN cards use 0x00190000
into method label _PRW parent_adr 0x00190000 remove_entry;
# if _PRW methods are stuffed into a separate scope
into method label _PRW parent_label _SB.PCI0.EHC1 remove_entry;
into method label _PRW parent_label _SB.PCI0.EHC2 remove_entry;
into method label _PRW parent_label _SB.PCI0.XHC remove_entry;
into method label _PRW parent_label \_SB.PCI0.EHC1 remove_entry;
into method label _PRW parent_label \_SB.PCI0.EHC2 remove_entry;
into method label _PRW parent_label \_SB.PCI0.XHC remove_entry;
# if _PRW objects are names
into device name_adr 0x001D0000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x001A0000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00140000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x001B0000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00190000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
# some _PRW have three entries in the Package
into device name_adr 0x001D0000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x001A0000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00140000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x001B0000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00190000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
# seems to work better if _PRW is present, but returns 0 (original was 3) for sleep state
into device name_adr 0x001D0000 insert begin Name(_PRW, Package() { 0x0D, 0 }) end;
into device name_adr 0x001A0000 insert begin Name(_PRW, Package() { 0x0D, 0 }) end;
into device name_adr 0x00140000 insert begin Name(_PRW, Package() { 0x0D, 0 }) end;
into device name_adr 0x001B0000 insert begin Name(_PRW, Package() { 0x0D, 0 }) end;
into device name_adr 0x00190000 insert begin Name(_PRW, Package() { 0x0D, 0 }) end;
# USB property injection for 7-series boards (originally HM76)
# Insert Apple USB properties into EHC1
into method label _DSM parent_adr 0x001D0000 remove_entry;
into device name_adr 0x001D0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
"subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
"AAPL,current-available", 2100,\n
"AAPL,current-extra", 2200,\n
"AAPL,current-extra-in-sleep", 1600,\n
"AAPL,device-internal", 0x02,\n
"AAPL,max-port-current-in-sleep", 2100,\n
})\n
}\n
end;
# Insert Apple USB properties into EHC2
into method label _DSM parent_adr 0x001A0000 remove_entry;
into device name_adr 0x001A0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
"subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
"AAPL,current-available", 2100,\n
"AAPL,current-extra", 2200,\n
"AAPL,current-extra-in-sleep", 1600,\n
"AAPL,device-internal", 0x02,\n
"AAPL,max-port-current-in-sleep", 2100,\n
})\n
}\n
end;
# Insert Apple USB properties into USB 3.0 XHC
into method label _DSM parent_adr 0x00140000 remove_entry;
into device name_adr 0x00140000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
"subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
"AAPL,current-available", 2100,\n
"AAPL,current-extra", 2200,\n
"AAPL,current-extra-in-sleep", 1600,\n
"AAPL,device-internal", 0x02,\n
"AAPL,max-port-current-in-sleep", 2100,\n
})\n
}\n
end;
# special cases... (not in u430 DSDT)
#into scope label _SB.PCI0.XHC.RHUB.HS05 set_label begin _SB.PCI0.XHC1.RHUB.HS05 end;
######usb_extra (angepasst fuer T430)
# remove dumb code from _WAK (and it is not needed)
into method label \_WAK code_regex If.*LOr.*Equal.*Arg0.*LGreaterEqual.*Arg0.*0x05.*\n.*\{\n.*Return.*WAKI.*\n.*\} remove_matched;
into method label _WAK code_regex If.*LOr.*Equal.*Arg0.*LGreaterEqual.*Arg0.*0x05.*\n.*\{\n.*Return.*WAKI.*\n.*\} remove_matched;
# sleep related T430 (LED)
into method label _WAK code_regex (Return\s+\(.*) replace_matched
begin
If (LEqual(Arg0,3))\n
{\n
\\_SB.PCI0.LPC.EC.LED(Zero, 0x80)\n
\\_SB.PCI0.LPC.EC.LED(0x07, 0x00)\n
}\n
%1\n
end;
into method label \_WAK code_regex (Return\s+\(.*) replace_matched
begin
If (LEqual(Arg0,3))\n
{\n
\\_SB.PCI0.LPC.EC.LED(Zero, 0x80)\n
\\_SB.PCI0.LPC.EC.LED(0x07, 0x00)\n
}\n
%1\n
end;
######audio_HDEF-layout12 (bearbeitet: layout28(0X1C))
#Maintained by: RehabMan for: Laptop Patches
#audio_HDEF-layout12.txt
# Note: Change your layout ID if you need something different
# Note: "hda-gfx" is not needed with Haswell and should probably be removed
# Inject Audio info
into method label _DSM parent_label HDEF remove_entry;
into device label HDEF insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"layout-id", Buffer() { 0x1C, 0x00, 0x00, 0x00 },\n
"hda-gfx", Buffer() { "onboard-1" },\n
"PinConfigurations", Buffer() { },\n
//"MaximumBootBeepVolume", 77,\n
})\n
}\n
end;
into method label _DSM parent_label HDAS remove_entry;
into device label HDAS insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
Return (Package()\n
{\n
"layout-id", Buffer() { 0x1C, 0x00, 0x00, 0x00 },\n
"hda-gfx", Buffer() { "onboard-1" },\n
"PinConfigurations", Buffer() { },\n
//"MaximumBootBeepVolume", 77,\n
})\n
}\n
end;
######battery_Lenovo-X220 (bearbeitet: letzter Abschnitt auskommentiert, da in usb-extra schon vorhanden)
#Maintained by: RehabMan for: Laptop Patches
#battery_Lenovo-X220.txt
# created by RehabMan 8/14/2013
# created originally for fraisdos125
# works for:
# Lenovo x220
# Lenovo t431s
# Lenovo T410 model 2518-F5U
# Lenovo W510 model 4319RU
# Lenovo T440s
# Lenovo T60
# Lenovo T61 (courtesy Gringo Vermelho)
# Lenovo Thinkpad X1 Carbon, 3rd gen 20BS (per jcsnider)
# Lenovo L450 (tested by kaiomatico)
# Lenovo T530/T530i (per Swingkid)
# Lenovo W530 (2441A43) (per GerryGu)
# Lenovo T460 (per jkoneal)
# Lenovo x240
# Lenovo X1 Carbon 2017 (per jqqqqqqqqqq)
# Lenovo Yoga 260 (per gi10)
# Note: disable secondary battery
# *** remove this line if you have a second battery installed)
into method label _STA parent_label BAT1 replace_content begin Return(0) end;
# syntax fixes
into_all all code_regex Name\s+\(_HID,\s+\"\*(.*)\"\) replaceall_matched begin Name (_HID, "%1") end;
# some of these laptops need to fix _IRC error
into device label VID parent_label PEG code_regex Name\s+\(_IRC,\s+([^\)].*)\) replace_matched
begin
Method(_IRC, 0, NotSerialized) { Return(%1) }
end;
# _PLD is supposed to return a variable length Package of Buffers
into_all all code_regex (Name\s*\(_PLD,\s*)Buffer(\s\([^\)].*\)[^\)]*) replaceall_matched
begin
%1Package() { Buffer%2 }
end;
# requires mutex fix too (2x to work around MaciASL bug...)
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;
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return (Or (Arg0, ShiftLeft (Arg1, 8))) }\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 EC remove_entry;
into method label RECB parent_label EC remove_entry;
into device label 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
{\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;
# Change EC register declarations from 16-bit to 8-bit
into device label EC code_regex SBRC,\s+16 replace_matched begin BRC0,8,BRC1,8 end;
into device label EC code_regex SBFC,\s+16 replace_matched begin BFC0,8,BFC1,8 end;
into device label EC code_regex SBVO,\s+16 replace_matched begin BVO0,8,BVO1,8 end;
into device label EC code_regex SBDC,\s+16 replace_matched begin BDC0,8,BDC1,8 end;
into device label EC code_regex SBDV,\s+16 replace_matched begin BDV0,8,BDV1,8 end;
into device label EC code_regex SBSN,\s+16 replace_matched begin BSN0,8,BSN1,8 end;
into device label EC code_regex SBAC,\s+16 replace_matched begin BAC0,8,BAC1,8 end;
into device label EC code_regex SBCC,\s+16 replace_matched begin BCC0,8,BCC1,8 end;
# this one is fan related
into device label EC code_regex HFN1,\s+16 replace_matched begin FN10,8,FN11,8 end;
# might also be fan related
into device label EC code_regex HSPD,\s+16 replace_matched begin SPD0,8,SPD1,8 end;
# this one is sleep related
into device label EC code_regex HWAK,\s+16 replace_matched begin WAK0,8,WAK1,8 end;
# sleep related T440s
into device label EC code_regex HWAC,\s+16 replace_matched begin WAC0,8,WAC1,8 end;
# 32-bit
into device label EC code_regex SBCH,\s+32 replace_matched begin BCH0,8,BCH1,8,BCH2,8,BCH3,8 end;
# 128-bit
#
# Note: Offsets below into EC are based on the following data in the native DSDT
#
# Field (ECOR, ByteAcc, NoLock, Preserve)
# {
# Offset (0xA0),
# SBMN, 128
# }
#
# Field (ECOR, ByteAcc, NoLock, Preserve)
# {
# Offset (0xA0),
# SBDN, 128
# }
# If the native DSDT has any such data re-organized such that the fields
# being read with RECB are at a different offset, the offsets below
# (first param to WECB/RECB) would need to be changed for the DSDT.
#
# This is something to watch out for when adapting this patch to another
# computer and maybe even after updating to a new BIOS.
#
# deal with 128-bit SBMN
into device label EC code_regex (SBMN,)\s+(128) replace_matched begin BMNX,%2,//%1%2 end;
into method label GBIF code_regex \(SBMN, replaceall_matched begin (RECB(0xA0,128), end;
into method label GBIX code_regex \(SBMN, replaceall_matched begin (RECB(0xA0,128), end;
# deal with 128-bit SBDN
into device label EC code_regex (SBDN,)\s+(128) replace_matched begin BDNX,%2,//%1%2 end;
into method label GBIF code_regex \(SBDN, replaceall_matched begin (RECB(0xA0,128), end;
into method label GBIX code_regex \(SBDN, replaceall_matched begin (RECB(0xA0,128), end;
# Change access (reads) to those registers from 16-bit to 8-bit
into_all method label GBST code_regex \(SBRC, replaceall_matched begin (B1B2 (BRC0, BRC1), end;
into_all method label GBST code_regex \(SBFC, replaceall_matched begin (B1B2 (BFC0, BFC1), end;
into_all method label GBST code_regex \(SBVO, replaceall_matched begin (B1B2 (BVO0, BVO1), end;
into_all method label GBST code_regex \(SBDC, replaceall_matched begin (B1B2 (BDC0, BDC1), end;
into_all method label GBST code_regex \(SBDV, replaceall_matched begin (B1B2 (BDV0, BDV1), end;
into_all method label GBST code_regex \(SBSN, replaceall_matched begin (B1B2 (BSN0, BSN1), end;
into_all method label GBST code_regex \(SBAC, replaceall_matched begin (B1B2 (BAC0, BAC1), end;
into_all method label GBIF code_regex \(SBRC, replaceall_matched begin (B1B2 (BRC0, BRC1), end;
into_all method label GBIF code_regex \(SBFC, replaceall_matched begin (B1B2 (BFC0, BFC1), end;
into_all method label GBIF code_regex \(SBVO, replaceall_matched begin (B1B2 (BVO0, BVO1), end;
into_all method label GBIF code_regex \(SBDC, replaceall_matched begin (B1B2 (BDC0, BDC1), end;
into_all method label GBIF code_regex \(SBDV, replaceall_matched begin (B1B2 (BDV0, BDV1), end;
into_all method label GBIF code_regex \(SBSN, replaceall_matched begin (B1B2 (BSN0, BSN1), end;
into_all method label GBIF code_regex \(SBDV\) replaceall_matched begin (B1B2 (BDV0, BDV1)) end;
into_all method label GBIF code_regex ,\s+SBDV, replaceall_matched begin ,B1B2(BDV0, BDV1), end;
into device label EC code_regex SBBM,\s+16 replace_matched begin BBM0,8,BBM1,8 end;
into_all method label GBIF code_regex \(SBBM, replaceall_matched begin (B1B2(BBM0,BBM1), end;
into_all method label GBIF code_regex \(SBCH, replaceall_matched begin (B1B4(BCH0,BCH1,BCH2,BCH3), end;
# this one is added in a patched DSDT to return fan speed
into method label FAN0 parent_label SMCD code_regex \(\^\^EC\.HFN1, replaceall_matched begin (B1B2(^^EC.FN10,^^EC.FN11), end;
into method label MHST code_regex \(HSPD, replaceall_matched begin (B1B2(SPD0,SPD1), end;
into method label MHST code_regex \(\\_SB.PCI0.LPC.EC.HSPD, replaceall_matched begin (B1B2(\\_SB.PCI0.LPC.EC.SPD0,\\_SB.PCI0.LPC.EC.SPD1), end;
into method label RPM4 code_regex \(\^\^EC\.HSPD, replaceall_matched begin (B1B2(^^EC.SPD0,^^EC.SPD1), end;
# sleep related
into method label _L1D parent_label _GPE code_regex \(\\_SB\.PCI0\.LPC\.EC\.HWAK, replaceall_matched begin (B1B2(\\_SB.PCI0.LPC.EC.WAK0,\\_SB.PCI0.LPC.EC.WAK1), end;
into method label _L1D parent_label \_GPE code_regex \(\\_SB\.PCI0\.LPC\.EC\.HWAK, replaceall_matched begin (B1B2(\\_SB.PCI0.LPC.EC.WAK0,\\_SB.PCI0.LPC.EC.WAK1), end;
# remove dumb code from _WAK (and it is not needed)
into method label \_WAK code_regex If.*LOr.*Equal.*Arg0.*LGreaterEqual.*Arg0.*0x05.*\n.*\{\n.*Return.*WAKI.*\n.*\} remove_matched;
into method label _WAK code_regex If.*LOr.*Equal.*Arg0.*LGreaterEqual.*Arg0.*0x05.*\n.*\{\n.*Return.*WAKI.*\n.*\} remove_matched;
# sleep related T450 (LED)... may affect other models
#
# Note: for T430... LED(0x0A,...) must be changed to LED(0x07,...)
#into method label _WAK code_regex (Return\s+\(.*) replace_matched
#begin
#If (LEqual(Arg0,3))\n
#{\n
# \\_SB.PCI0.LPC.EC.LED(Zero, 0x80)\n
# \\_SB.PCI0.LPC.EC.LED(0x07, 0x00)\n
#}\n
#%1\n
#end;
#into method label \_WAK code_regex (Return\s+\(.*) replace_matched
#begin
#If (LEqual(Arg0,3))\n
#{\n
# \\_SB.PCI0.LPC.EC.LED(Zero, 0x80)\n
# \\_SB.PCI0.LPC.EC.LED(0x07, 0x00)\n
#}\n
#%1\n
#end;
######Fn-Tasten für Helligkeitsregelung (F8 und F9)
into method label _Q15 replace_content
begin
Notify(\_SB.PCI0.LPC.KBD, 0x0205)\n
Notify(\_SB.PCI0.LPC.KBD, 0x0285)\n
end;
into method label _Q14 replace_content
begin
Notify(\_SB.PCI0.LPC.KBD, 0x0206)\n
Notify(\_SB.PCI0.LPC.KBD, 0x0286)\n
end;
###### Additional modifications to DSDT
# 1. The following two lines (just above “Return (WAKI)”):
# \_SB.PCI0.LPC.EC.LED(Zero, 0x80)
# \_SB.PCI0.LPC.EC.LED(0x07, 0x00)
# must be changed to:
# \_SI._SST (One)
# \_GPE._L1D ()
#
# 2. Change 4 occurences of “EHC1” to “EH01".
#
# 3. Change 3 occurrences of “EHC2” to “EH02".
#
# 4. Change 23 occurences of “XHCI” to “XHC_".
#
# 5. Deactivate fn-F4:
# Comment out the contents of Method (_Q13, 0, NotSerialized)