summaryrefslogtreecommitdiff
path: root/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/Dsdt/Gpe.asl
blob: 8433c1fcab63c8134ed392c459a14d299c30319a (plain)
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
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
/** @file
  ACPI DSDT table

Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

  // General Purpose Events.  This Scope handles the Run-time and
  // Wake-time SCIs.  The specific method called will be determined by
  // the _Lxx value, where xx equals the bit location in the General
  // Purpose Event register(s).


  External(D1F0)
  External(D1F1)
  External(D1F2)
  External(\_SB.PCI0.PEG0.HPME, MethodObj)
  External(\_SB.PCI0.PEG1.HPME, MethodObj)
  External(\_SB.PCI0.PEG2.HPME, MethodObj)
  External(\_GPE.AL6F, MethodObj)
  External(\_SB.THDR, MethodObj)
  External(\_GPE.P0L6, MethodObj)
  External(\_GPE.P1L6, MethodObj)
  External(\_GPE.P2L6, MethodObj)
  External(SGGP)
  External(P1GP)
  External(P2GP)
  External(P0WK)
  External(P1WK)
  External(P2WK)
  External(\CPG0)
  External(\RPS0)
  External(\RPT0)
  External(\_PR.HWPI, IntObj)
  External(\_PR.DTSI, IntObj)

  Scope(\_GPE)
  {
  // Note:
  // Originally, the two GPE methods below are automatically generated, but, for ASL code restructuring,
  // disabled the automatic generation and declare the ASL code here.
  //

  //
  // This PME event (PCH's GPE 69h) is received on one or more of the PCI Express* ports or
  // an assert PMEGPE message received via DMI
  //
  Method(_L69, 0, serialized) {
    \_SB.PCI0.RP01.HPME()
    \_SB.PCI0.RP02.HPME()
    \_SB.PCI0.RP03.HPME()
    \_SB.PCI0.RP04.HPME()
    \_SB.PCI0.RP05.HPME()
    \_SB.PCI0.RP06.HPME()
    \_SB.PCI0.RP07.HPME()
    \_SB.PCI0.RP08.HPME()
    \_SB.PCI0.RP09.HPME()
    \_SB.PCI0.RP10.HPME()
    \_SB.PCI0.RP11.HPME()
    \_SB.PCI0.RP12.HPME()
    \_SB.PCI0.RP13.HPME()
    \_SB.PCI0.RP14.HPME()
    \_SB.PCI0.RP15.HPME()
    \_SB.PCI0.RP16.HPME()
    \_SB.PCI0.RP17.HPME()
    \_SB.PCI0.RP18.HPME()
    \_SB.PCI0.RP19.HPME()
    \_SB.PCI0.RP20.HPME()
    \_SB.PCI0.RP21.HPME()
    \_SB.PCI0.RP22.HPME()
    \_SB.PCI0.RP23.HPME()
    \_SB.PCI0.RP24.HPME()

    If(LEqual(D1F0,1))
    {
      \_SB.PCI0.PEG0.HPME()
      Notify(\_SB.PCI0.PEG0, 0x02)
      Notify(\_SB.PCI0.PEG0.PEGP, 0x02)
    }

    If(LEqual(D1F1,1))
    {
      \_SB.PCI0.PEG1.HPME()
      Notify(\_SB.PCI0.PEG1, 0x02)
    }

    If(LEqual(D1F2,1))
    {
      \_SB.PCI0.PEG2.HPME()
      Notify(\_SB.PCI0.PEG2, 0x02)
    }
  }

  // PCI Express Hot-Plug caused the wake event.

  Method(_L61)
  {
    Add(L01C,1,L01C)  // Increment L01 Entry Count.

    P8XH(0,0x01)      // Output information to Port 80h.
    P8XH(1,L01C)


    // Check Root Port 1 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP01.VDID,0xFFFFFFFF),\_SB.PCI0.RP01.HPSX))
    {
      // Delay for 100ms to meet the timing requirements
      // of the PCI Express Base Specification, Revision
      // 1.0A, Section 6.6 ("...software must wait at
      // least 100ms from the end of reset of one or more
      // device before it is permitted to issue
      // Configuration Requests to those devices").

      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x1),LNotEqual(TBS1,0x1)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP01.PDCX)
      {
        // Clear all status bits first.

        Store(1,\_SB.PCI0.RP01.PDCX)
        Store(1,\_SB.PCI0.RP01.HPSX)

        //
        // PCH BIOS Spec Update Rev 1.03, Section 8.9 PCI Express* Hot-Plug BIOS Support
        // In addition, BIOS should intercept Presence Detect Changed interrupt, enable L0s on
        // hot plug and disable L0s on hot unplug. BIOS should also make sure the L0s is
        // disabled on empty slots prior booting to OS.
        //
        If(LNot(\_SB.PCI0.RP01.PDSX)) {
          // The PCI Express slot is empty, so disable L0s on hot unplug
          //
          Store(0,\_SB.PCI0.RP01.L0SE)

        }

        // Perform proper notification
        // to the OS.
        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x1),LNotEqual(TBS1,0x1)))) {
          Notify(\_SB.PCI0.RP01,0)
        }
      }
      Else
      {
        // False event.  Clear Hot-Plug Status
        // then exit.

        Store(1,\_SB.PCI0.RP01.HPSX)
      }
    }

    // Check Root Port 2 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP02.VDID,0xFFFFFFFF),\_SB.PCI0.RP02.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x2),LNotEqual(TBS1,0x2)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP02.PDCX)
      {
        Store(1,\_SB.PCI0.RP02.PDCX)
        Store(1,\_SB.PCI0.RP02.HPSX)

        If(LNot(\_SB.PCI0.RP02.PDSX)) {
          Store(0,\_SB.PCI0.RP02.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x2),LNotEqual(TBS1,0x2)))) {
          Notify(\_SB.PCI0.RP02,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP02.HPSX)
      }
    }

    // Check Root Port 3 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP03.VDID,0xFFFFFFFF),\_SB.PCI0.RP03.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x3),LNotEqual(TBS1,0x3)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP03.PDCX)
      {
        Store(1,\_SB.PCI0.RP03.PDCX)
        Store(1,\_SB.PCI0.RP03.HPSX)

        If(LNot(\_SB.PCI0.RP03.PDSX)) {
          Store(0,\_SB.PCI0.RP03.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x3),LNotEqual(TBS1,0x3)))) {
          Notify(\_SB.PCI0.RP03,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP03.HPSX)
      }
    }

    // Check Root Port 4 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP04.VDID,0xFFFFFFFF),\_SB.PCI0.RP04.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x4),LNotEqual(TBS1,0x4)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP04.PDCX)
      {
        Store(1,\_SB.PCI0.RP04.PDCX)
        Store(1,\_SB.PCI0.RP04.HPSX)

        If(LNot(\_SB.PCI0.RP04.PDSX)) {
          Store(0,\_SB.PCI0.RP04.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x4),LNotEqual(TBS1,0x4)))) {
          Notify(\_SB.PCI0.RP04,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP04.HPSX)
      }
    }

    // Check Root Port 5 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP05.VDID,0xFFFFFFFF),\_SB.PCI0.RP05.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x5),LNotEqual(TBS1,0x5)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP05.PDCX)
      {
        Store(1,\_SB.PCI0.RP05.PDCX)
        Store(1,\_SB.PCI0.RP05.HPSX)

        If(LNot(\_SB.PCI0.RP05.PDSX)) {
          Store(0,\_SB.PCI0.RP05.L0SE)
        }

      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x5),LNotEqual(TBS1,0x5)))) {
          Notify(\_SB.PCI0.RP05,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP05.HPSX)
      }
    }

    // Check Root Port 6 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP06.VDID,0xFFFFFFFF),\_SB.PCI0.RP06.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x6),LNotEqual(TBS1,0x6)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP06.PDCX)
      {
        Store(1,\_SB.PCI0.RP06.PDCX)
        Store(1,\_SB.PCI0.RP06.HPSX)

        If(LNot(\_SB.PCI0.RP06.PDSX)) {
          Store(0,\_SB.PCI0.RP06.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x6),LNotEqual(TBS1,0x6)))) {
          Notify(\_SB.PCI0.RP06,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP06.HPSX)
      }
    }

    // Check Root Port 7 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP07.VDID,0xFFFFFFFF),\_SB.PCI0.RP07.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x7),LNotEqual(TBS1,0x7)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP07.PDCX)
      {
        Store(1,\_SB.PCI0.RP07.PDCX)
        Store(1,\_SB.PCI0.RP07.HPSX)

        If(LNot(\_SB.PCI0.RP07.PDSX)) {
          Store(0,\_SB.PCI0.RP07.L0SE)
        }

      }
      Else
      {
        Store(1,\_SB.PCI0.RP07.HPSX)
      }
    }

    // Check Root Port 8 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP08.VDID,0xFFFFFFFF),\_SB.PCI0.RP08.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x8),LNotEqual(TBS1,0x8)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP08.PDCX)
      {
        Store(1,\_SB.PCI0.RP08.PDCX)
        Store(1,\_SB.PCI0.RP08.HPSX)

        If(LNot(\_SB.PCI0.RP08.PDSX)) {
          Store(0,\_SB.PCI0.RP08.L0SE)
        }

      }
      Else
      {
        Store(1,\_SB.PCI0.RP08.HPSX)
      }
    }

    // Check Root Port 9 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP09.VDID,0xFFFFFFFF),\_SB.PCI0.RP09.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x9),LNotEqual(TBS1,0x9)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP09.PDCX)
      {
        Store(1,\_SB.PCI0.RP09.PDCX)
        Store(1,\_SB.PCI0.RP09.HPSX)

        If(LNot(\_SB.PCI0.RP09.PDSX)) {
          Store(0,\_SB.PCI0.RP09.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x9),LNotEqual(TBS1,0x9)))) {
          Notify(\_SB.PCI0.RP09,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP09.HPSX)
      }
    }

    // Check Root Port 10 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP10.VDID,0xFFFFFFFF),\_SB.PCI0.RP10.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xA),LNotEqual(TBS1,0xA)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP10.PDCX)
      {
        Store(1,\_SB.PCI0.RP10.PDCX)
        Store(1,\_SB.PCI0.RP10.HPSX)

        If(LNot(\_SB.PCI0.RP10.PDSX)) {
          Store(0,\_SB.PCI0.RP10.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xA),LNotEqual(TBS1,0xA)))) {
          Notify(\_SB.PCI0.RP10,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP10.HPSX)
      }
    }

    // Check Root Port 11 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP11.VDID,0xFFFFFFFF),\_SB.PCI0.RP11.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xB),LNotEqual(TBS1,0xB)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP11.PDCX)
      {
        Store(1,\_SB.PCI0.RP11.PDCX)
        Store(1,\_SB.PCI0.RP11.HPSX)

        If(LNot(\_SB.PCI0.RP11.PDSX)) {
          Store(0,\_SB.PCI0.RP11.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xB),LNotEqual(TBS1,0xB)))) {
          Notify(\_SB.PCI0.RP11,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP11.HPSX)
      }
    }

    // Check Root Port 12 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP12.VDID,0xFFFFFFFF),\_SB.PCI0.RP12.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xC),LNotEqual(TBS1,0xC)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP12.PDCX)
      {
        Store(1,\_SB.PCI0.RP12.PDCX)
        Store(1,\_SB.PCI0.RP12.HPSX)

        If(LNot(\_SB.PCI0.RP12.PDSX)) {
          Store(0,\_SB.PCI0.RP12.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xC),LNotEqual(TBS1,0xC)))) {
          Notify(\_SB.PCI0.RP12,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP12.HPSX)
      }
    }

    // Check Root Port 13 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP13.VDID,0xFFFFFFFF),\_SB.PCI0.RP13.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xD),LNotEqual(TBS1,0xD)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP13.PDCX)
      {
        Store(1,\_SB.PCI0.RP13.PDCX)
        Store(1,\_SB.PCI0.RP13.HPSX)

        If(LNot(\_SB.PCI0.RP13.PDSX)) {
          Store(0,\_SB.PCI0.RP13.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xD),LNotEqual(TBS1,0xD)))) {
          Notify(\_SB.PCI0.RP13,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP13.HPSX)
      }
    }

    // Check Root Port 14 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP14.VDID,0xFFFFFFFF),\_SB.PCI0.RP14.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xE),LNotEqual(TBS1,0xE)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP14.PDCX)
      {
        Store(1,\_SB.PCI0.RP14.PDCX)
        Store(1,\_SB.PCI0.RP14.HPSX)

        If(LNot(\_SB.PCI0.RP14.PDSX)) {
          Store(0,\_SB.PCI0.RP14.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xE),LNotEqual(TBS1,0xE)))) {
          Notify(\_SB.PCI0.RP14,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP14.HPSX)
      }
    }

    // Check Root Port 15 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP15.VDID,0xFFFFFFFF),\_SB.PCI0.RP15.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xF),LNotEqual(TBS1,0xF)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP15.PDCX)
      {
        Store(1,\_SB.PCI0.RP15.PDCX)
        Store(1,\_SB.PCI0.RP15.HPSX)

        If(LNot(\_SB.PCI0.RP15.PDSX)) {
          Store(0,\_SB.PCI0.RP15.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0xF),LNotEqual(TBS1,0xF)))) {
          Notify(\_SB.PCI0.RP15,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP15.HPSX)
      }
    }

    // Check Root Port 16 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP16.VDID,0xFFFFFFFF),\_SB.PCI0.RP16.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x10),LNotEqual(TBS1,0x10)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP16.PDCX)
      {
        Store(1,\_SB.PCI0.RP16.PDCX)
        Store(1,\_SB.PCI0.RP16.HPSX)

        If(LNot(\_SB.PCI0.RP16.PDSX)) {
          Store(0,\_SB.PCI0.RP16.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x10),LNotEqual(TBS1,0x10)))) {
          Notify(\_SB.PCI0.RP16,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP16.HPSX)
      }
    }

    // Check Root Port 17 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP17.VDID,0xFFFFFFFF),\_SB.PCI0.RP17.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x11),LNotEqual(TBS1,0x11)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP17.PDCX)
      {
        Store(1,\_SB.PCI0.RP17.PDCX)
        Store(1,\_SB.PCI0.RP17.HPSX)

        If(LNot(\_SB.PCI0.RP17.PDSX)) {
          Store(0,\_SB.PCI0.RP17.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x11),LNotEqual(TBS1,0x11)))) {
          Notify(\_SB.PCI0.RP17,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP17.HPSX)
      }
    }

    // Check Root Port 18 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP18.VDID,0xFFFFFFFF),\_SB.PCI0.RP18.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x12),LNotEqual(TBS1,0x12)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP18.PDCX)
      {
        Store(1,\_SB.PCI0.RP18.PDCX)
        Store(1,\_SB.PCI0.RP18.HPSX)

        If(LNot(\_SB.PCI0.RP18.PDSX)) {
          Store(0,\_SB.PCI0.RP18.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x12),LNotEqual(TBS1,0x12)))) {
          Notify(\_SB.PCI0.RP18,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP18.HPSX)
      }
    }

    // Check Root Port 19 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP19.VDID,0xFFFFFFFF),\_SB.PCI0.RP19.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x13),LNotEqual(TBS1,0x13)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP19.PDCX)
      {
        Store(1,\_SB.PCI0.RP19.PDCX)
        Store(1,\_SB.PCI0.RP19.HPSX)

        If(LNot(\_SB.PCI0.RP19.PDSX)) {
          Store(0,\_SB.PCI0.RP19.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x13),LNotEqual(TBS1,0x13)))) {
          Notify(\_SB.PCI0.RP19,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP19.HPSX)
      }
    }

    // Check Root Port 20 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP20.VDID,0xFFFFFFFF),\_SB.PCI0.RP20.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x14),LNotEqual(TBS1,0x14)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP20.PDCX)
      {
        Store(1,\_SB.PCI0.RP20.PDCX)
        Store(1,\_SB.PCI0.RP20.HPSX)

        If(LNot(\_SB.PCI0.RP20.PDSX)) {
          Store(0,\_SB.PCI0.RP20.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x14),LNotEqual(TBS1,0x14)))) {
          Notify(\_SB.PCI0.RP20,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP20.HPSX)
      }
    }

    // Check Root Port 21 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP21.VDID,0xFFFFFFFF),\_SB.PCI0.RP21.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x21),LNotEqual(TBS1,0x21)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP21.PDCX)
      {
        Store(1,\_SB.PCI0.RP21.PDCX)
        Store(1,\_SB.PCI0.RP21.HPSX)

        If(LNot(\_SB.PCI0.RP21.PDSX)) {
          Store(0,\_SB.PCI0.RP21.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x21),LNotEqual(TBS1,0x21)))) {
          Notify(\_SB.PCI0.RP21,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP21.HPSX)
      }
    }

    // Check Root Port 22 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP22.VDID,0xFFFFFFFF),\_SB.PCI0.RP22.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x22),LNotEqual(TBS1,0x22)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP22.PDCX)
      {
        Store(1,\_SB.PCI0.RP22.PDCX)
        Store(1,\_SB.PCI0.RP22.HPSX)

        If(LNot(\_SB.PCI0.RP22.PDSX)) {
          Store(0,\_SB.PCI0.RP22.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x22),LNotEqual(TBS1,0x22)))) {
          Notify(\_SB.PCI0.RP22,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP22.HPSX)
      }
    }

    // Check Root Port 23 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP23.VDID,0xFFFFFFFF),\_SB.PCI0.RP23.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x23),LNotEqual(TBS1,0x23)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP23.PDCX)
      {
        Store(1,\_SB.PCI0.RP23.PDCX)
        Store(1,\_SB.PCI0.RP23.HPSX)

        If(LNot(\_SB.PCI0.RP23.PDSX)) {
          Store(0,\_SB.PCI0.RP23.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x23),LNotEqual(TBS1,0x23)))) {
          Notify(\_SB.PCI0.RP23,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP23.HPSX)
      }
    }

    // Check Root Port 24 for a Hot Plug Event if the Port is
    // enabled.

    If(LAnd(LNotEqual(\_SB.PCI0.RP24.VDID,0xFFFFFFFF),\_SB.PCI0.RP24.HPSX))
    {
      If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x24),LNotEqual(TBS1,0x24)))) {
        Sleep(100)
      }

      If(\_SB.PCI0.RP24.PDCX)
      {
        Store(1,\_SB.PCI0.RP24.PDCX)
        Store(1,\_SB.PCI0.RP24.HPSX)

        If(LNot(\_SB.PCI0.RP24.PDSX)) {
          Store(0,\_SB.PCI0.RP24.L0SE)
        }

        If(LOr(LNotEqual(TBTS, 0x01),LOr(LNotEqual(TBSE,0x24),LNotEqual(TBS1,0x24)))) {
          Notify(\_SB.PCI0.RP24,0)
        }
      }
      Else
      {
        Store(1,\_SB.PCI0.RP24.HPSX)
      }
    }
  }

  //
  // Software GPE caused the event.
  //
  Method(_L62)
  {
    // Clear GPE status bit.
    Store(0,GPEC)

    //
    // Handle DTS Thermal SCI Event.
    //
    If(CondRefOf(\_PR.DTSE)){
      If(LGreaterEqual(\_PR.DTSE, 0x01)){
        If(LEqual(\_PR.DTSI, 1)){
          Notify(\_TZ.TZ00,0x80)
          Notify(\_TZ.TZ01,0x80)
          ///
          /// Clear HWP interrupt status
          ///
          Store(0,\_PR.DTSI)
        }
      }
    }
    ///
    /// Handle HWP SCI event
    ///
    External(\_GPE.HLVT, MethodObj)
    If(LEqual(\_PR.HWPI, 1)){
      If(CondRefOf(\_GPE.HLVT)){
        \_GPE.HLVT()
      }
      ///
      /// Clear HWP interrupt status
      ///
      Store(0,\_PR.HWPI)
    }
  }

  // IGD OpRegion SCI event (see IGD OpRegion/Software SCI BIOS SPEC).

  Method(_L66)
  {
    If(LAnd(\_SB.PCI0.GFX0.GSSE, LNot(GSMI))) // Graphics software SCI event?
    {
      \_SB.PCI0.GFX0.GSCI() // Handle the SWSCI
    }
  }
  //
  // BIOS Needs to implement appropriate handler based on CIO_PLUG_EVENT GPIO
  // This is generic 2-tier GPIO handler
  //
  Method(_L6F)
  {
    \_SB.THDR(\CPG0,\RPS0,\RPT0) // Check for TBT Hotplug Handler event (2-tier GPI GPE event architecture)
  }
}