hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
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
/**@file
 
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
 
**/
 
#define SERIAL_IO_PMECTRLSTATUS 0x84
 
#define SERIAL_IO_DISABLED 0
#define SERIAL_IO_ACPI 1
#define SERIAL_IO_PCI 2
#define SERIAL_IO_ACPIHIDDEN 3
#define SERIAL_IO_LEGACY_UART 4
 
#define KBL_GENERATION 2
 
#define SERIAL_IO_SPT_LP_GPIO_HID "INT344B"
#define SERIAL_IO_SPT_H_GPIO_HID  "INT345D"
#define SERIAL_IO_KBL_H_GPIO_HID  "INT3451"
 
#define SERIAL_IO_I2C0_HID "INT3442"
#define SERIAL_IO_I2C1_HID "INT3443"
#define SERIAL_IO_I2C2_HID "INT3444"
#define SERIAL_IO_I2C3_HID "INT3445"
#define SERIAL_IO_I2C4_HID "INT3446"
#define SERIAL_IO_I2C5_HID "INT3447"
#define SERIAL_IO_SPI0_HID "INT3440"
#define SERIAL_IO_SPI1_HID "INT3441"
#define SERIAL_IO_UART0_HID "INT3448"
#define SERIAL_IO_UART1_HID "INT3449"
#define SERIAL_IO_UART2_HID "INT344A"
 
#define SERIAL_IO_I2C0_ADR 0x00150000
#define SERIAL_IO_I2C1_ADR 0x00150001
#define SERIAL_IO_I2C2_ADR 0x00150002
#define SERIAL_IO_I2C3_ADR 0x00150003
#define SERIAL_IO_I2C4_ADR 0x00190002
#define SERIAL_IO_I2C5_ADR 0x00190001
#define SERIAL_IO_SPI0_ADR 0x001E0002
#define SERIAL_IO_SPI1_ADR 0x001E0003
#define SERIAL_IO_UART0_ADR 0x001E0000
#define SERIAL_IO_UART1_ADR 0x001E0001
#define SERIAL_IO_UART2_ADR 0x00190000
 
Scope(\_SB.PCI0) {
 
 
  //
  //  Common code for D3 entry for all SerialIo devices including PCI mode
  //
  //  @param[in]  Arg0      PCI calculated address or ACPI BAR1 address of device to be put in D3
  //
  Method (LPD3, 1, Serialized) {
    OperationRegion(ICB1, SystemMemory, Add(Arg0,SERIAL_IO_PMECTRLSTATUS), 4)
    Field(ICB1, DWordAcc, NoLock, Preserve) { PMEC, 32 } //Note: SerialIO Does Not Support PME
    Store(0x3, PMEC) // Set BIT[1:0] = 11b - Power State D3
    Store(PMEC,TEMP) // perform a read to avoid ordering and noncoherency problems
  }
 
  //
  //  Common code for D0 entry for all SerialIo devices including PCI mode
  //
  //  @param[in]  Arg0      PCI calculated address or ACPI BAR1 address of device to be put in D0
  //
  Method (LPD0, 1, Serialized) {
    OperationRegion(ICB1, SystemMemory, Add(Arg0,SERIAL_IO_PMECTRLSTATUS), 4)
    Field(ICB1, DWordAcc, NoLock, Preserve) { PMEC, 32 } //Note: SerialIO Does Not Support PME
    And(PMEC, 0xFFFF7FFC, PMEC) // Set BIT[1:0] = 00b - Power State D0
    Store(PMEC,TEMP) // perform a read to avoid ordering and noncoherency problems
  }
 
  //
  //  Common code for retrieving hardware revision for all SerialIo devices
  //
  //  @param[in]  Arg0      BAR1 of device
  //
  //  @retval               Hardware Revison
  //
  Method (LHRV, 1, Serialized) {
    OperationRegion(ICB1, SystemMemory, Add(Arg0,0x8) , 4)
    Field(ICB1, DWordAcc, NoLock, Preserve) { HRV, 8 }
    Return(HRV)
  }
 
  //
  //  Get D state of SerialIo device - for use in _PSC method
  //
  //  @param[in]  Arg0      PCI calculated address or ACPI BAR1 of device
  //
  //  @retval               D State
  //
  Method (GETD, 1, Serialized) {
    OperationRegion(ICB1, SystemMemory, Add(Arg0,SERIAL_IO_PMECTRLSTATUS) , 4)
    Field(ICB1, DWordAcc, NoLock, Preserve) { PMEC, 32 }
    Return (And(PMEC, 0x3))
  }
 
  //
  //  Common code for reporting memory and interrupt resources for all SerialIo devices
  //
  //  @param[in]  Arg0      Device mode
  //  @param[in]  Arg1      Memory address
  //  @param[in]  Arg2      Interrupt number
  //
  //  @retval               Resource buffer
  //
  Method (LCRS, 3, Serialized) {
    Name (RBUF, ResourceTemplate () {
      Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
      Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , SIRQ) {20}
    })
    CreateDWordField(RBUF,BAR0._BAS,BVAL)
    CreateDWordField(RBUF,BAR0._LEN,BLEN)
    CreateDWordField(RBUF,SIRQ._INT,IRQN)
    Store (Arg1, BVAL)
    Store (Arg2, IRQN)
    If(LEqual(Arg0,4)) {Store(8, BLEN)}
    Return (RBUF)
  }
 
  //
  //  Common code for reporting status of all SerialIo devices
  //
  //  @param[in]  Arg0      Device's mode
  //
  //  @retval               0 (do not show device) or 0xF (device is present)
  //
  Method (LSTA, 1, Serialized) {
    If(LOr(LEqual(Arg0,0),LEqual(Arg0,3)))  { Return(0) }
    If(LLess(OSYS,2012)) { Return(0) } // OS older than Win8 = not supported
    Return (0xF)
  }
 
  //
  //  Converts driver-visible GPIO number to interrupt number
  //
  //  @param[in]  Arg0      BAR1 of device
  //
  //  @retval               Interrupt number
  //
  Method (GIRQ,1,Serialized) {
    Return (Add(24,Mod(Arg0,96)))
  }
 
} // END Scope(\_SB.PCI0)
 
 
 
Scope(\_SB.PCI0) {
  //
  //  An invisible device that claims memory resources reserved for SerialIo devices
  //  SerialIo devices in ACPI mode can't claim their BAR1 resources because these are aliases for PciCfg space
  //
  Device(SIRC) {
    Name(_HID,EISAID("PNP0C02"))
    Name(_STA,0x3) // device present and decodes its resources, but not to be displayed in OSPM
    Name(_UID,5)
 
    //
    //  Returns resource buffer with memory ranges used but not explicitely claimed by the device:
    //  in ACPI mode (SMDn=1) returns BAR1. In HIDDEN mode (SMDn=3) returns both BARs.
    //  In LegacyUART mode(SMDn=4) returns BAR1+ BAR0 except for first 8 bytes
    //
    //  @param[in]  Arg0      SMDn
    //  @param[in]  Arg1      SB0n
    //  @param[in]  Arg2      SB1n
    //
    //  @retval               Resource buffer with memory ranges
    //                        if SMDn=0 (SERIAL_IO_DISABLED) or SMDn=2 (SERIAL_IO_PCI) returns an empty buffer
    //
    Method (ADDB, 3, Serialized) {
 
      Name(BUFF,ResourceTemplate() { Memory32Fixed (ReadWrite, 0, 0x1000, BUF) })
      CreateDWordField(BUFF, BUF._BAS, ADDR)
      CreateDWordField(BUFF, BUF._LEN, LENG)
 
      Store(ResourceTemplate() { }, Local0)  // an empty buffer
 
      If(LOr(LOr(LEqual(Arg0, SERIAL_IO_ACPI), LEqual(Arg0, SERIAL_IO_ACPIHIDDEN)), LEqual(Arg0, SERIAL_IO_LEGACY_UART))) {
        Store(Arg2, ADDR)
        ConcatenateResTemplate(Local0, BUFF, Local1) // add BAR1
        Store(Local1, Local0)
      }
 
      If(LEqual(Arg0,SERIAL_IO_ACPIHIDDEN)) {
        Store(Arg1,ADDR)
        ConcatenateResTemplate(Local0, BUFF, Local1) // add BAR0
        Store(Local1, Local0)
      }
 
      If(LEqual(Arg0, SERIAL_IO_LEGACY_UART)) {
        Store(Add(8, Arg1), ADDR)
        Store(0xFF8, LENG)
        ConcatenateResTemplate(Local0, BUFF, Local1) // add BAR0 without 8 bytes
        Store(Local1, Local0)
      }
      Return (Local0)
    }
 
    Method (_CRS, 0x0, Serialized) {
      Store(ResourceTemplate() { }, Local0)  // placeholder for concatenated buffers
      //
      // SB1[X] if device is configured as ACPI represents BAR1
      //        in case of PCI it stands for memory mapped BDF
      //
      ConcatenateResTemplate(Local0, ADDB(SMD0,SB00,SB10), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD1,SB01,SB11), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD2,SB02,SB12), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD3,SB03,SB13), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD4,SB04,SB14), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD5,SB05,SB15), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD6,SB06,SB16), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD7,SB07,SB17), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD8,SB08,SB18), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMD9,SB09,SB19), Local1)
      Store(Local1, Local0)
      ConcatenateResTemplate(Local0, ADDB(SMDA,SB0A,SB1A), Local1)
      Store(Local1, Local0)
      //
      //  GPIO device always exists in chipset. If it's not visible in ACPI
      //  and doesn't claim its resources, declare it here to prevent OS from reusing its mem addresses
      //
      If(LEqual(\_SB.PCI0.GPI0._STA(),0)) {
        ConcatenateResTemplate(Local0, \_SB.PCI0.GPI0._CRS(), Local1)
        Store(Local1, Local0)
      }
      Return (Local0)
    } // END _CRS
  } // END Device(SIRC)
 
  //----------------------------
  //  Serial IO GPIO Controller
  //----------------------------
  Device (GPI0)
  {
    Method (_HID) {
      // Return HID based on PCH Product
      If (LEqual(PCHV, SPTH)) {
        If (LEqual(PCHG, KBL_GENERATION)) { Return(SERIAL_IO_KBL_H_GPIO_HID) }
        Return(SERIAL_IO_SPT_H_GPIO_HID)
      }
      Return(SERIAL_IO_SPT_LP_GPIO_HID)
    }
 
    Name (LINK,"\\_SB.PCI0.GPI0")
 
    Method (_CRS, 0x0, NotSerialized) {
      Name (RBUF, ResourceTemplate () {
        Memory32Fixed (ReadWrite, 0x00000000, 0x00010000, BAR0)
        Memory32Fixed (ReadWrite, 0x00000000, 0x00010000, BAR1)
        Memory32Fixed (ReadWrite, 0x00000000, 0x00010000, BAR3)
        Interrupt (ResourceConsumer, Level, ActiveLow, Shared, , , IRQ) { 14 } //Interrupt IRQ_EN
      })
      CreateDWordField(RBUF,BAR0._BAS,COM0)
      CreateDWordField(RBUF,BAR1._BAS,COM1)
      CreateDWordField(RBUF,IRQ._INT,IRQN)
      Store( Add(SBRG,PCH_GPIO_COM0), COM0)
      Store( Add(SBRG,PCH_GPIO_COM1), COM1)
      CreateDWordField(RBUF,BAR3._BAS,COM3)
      Store( Add(SBRG,PCH_GPIO_COM3), COM3)
      Store(SGIR,IRQN)
      Return (RBUF)
    }
 
    Method (_STA, 0x0, NotSerialized) {
      If(LEqual(SBRG, 0))   { Return(0x0) } // has BAR for this device been programmed by the OS?
      If(LEqual(GPEN, 0))   { Return(0x0) } // GPIO disabled in platform policy
      Return(0xF)
    }
  }
 
} // END Scope(\_SB.PCI0)
 
 
//------------------------------------------
//  Serial IO I2C Controller 0 Configuration
//------------------------------------------
Scope(\_SB.PCI0) {
  Device (I2C0) {
    Name (LINK,"\\_SB.PCI0.I2C0") // Support for Windows 7
    //
    // I2C0 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD(SB10))
    }
    Method (_PS0) {
      LPD0(SB10)
    }
    Method (_PS3) {
      LPD3(SB10)
    }
 
    //
    // Apllies for I2C0 all modes except PCI
    //
    If(LNotEqual(SMD0,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_I2C0_HID)
      Method (_HRV) { Return (LHRV(SB10)) }
      Method (_CRS) { Return (LCRS(SMD0,SB00,SIR0)) }
      Method (_STA) { Return (LSTA(SMD0)) }
    }
 
    //
    // Apllies for I2C0 PCI mode only
    //
    If(LEqual(SMD0,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_I2C0_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
  }
 
  } // Device (I2C0)
} // Scope(\_SB.PCI0)
 
//------------------------------------------
//  Serial IO I2C Controller 1 Configuration
//------------------------------------------
Scope(\_SB.PCI0) {
  Device (I2C1) {
    Name (LINK,"\\_SB.PCI0.I2C1") // Support for Windows 7
    //
    // I2C1 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD(SB11))
    }
    Method (_PS0) {
      LPD0(SB11)
    }
    Method (_PS3) {
      LPD3(SB11)
    }
 
    //
    // Apllies for I2C1 all modes except PCI
    //
    If(LNotEqual(SMD1,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_I2C1_HID)
      Method (_HRV) { Return (LHRV(SB11)) }
      Method (_CRS) { Return (LCRS(SMD1,SB01,SIR1)) }
      Method (_STA) { Return (LSTA(SMD1)) }
    }
 
    //
    // Apllies for I2C1 PCI mode only
    //
    If(LEqual(SMD1,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_I2C1_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
  } // Device (I2C1)
} // Scope(\_SB.PCI0)
 
//------------------------------------------
//  Serial IO I2C Controller 2 Configuration
//------------------------------------------
Scope(\_SB.PCI0) {
  Device (I2C2) {
    Name (LINK,"\\_SB.PCI0.I2C2") // Support for Windows 7
    //
    // I2C2 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD(SB12))
    }
    Method (_PS0) {
      LPD0(SB12)
    }
    Method (_PS3) {
      LPD3(SB12)
    }
 
    //
    // Apllies for I2C2 all modes except PCI
    //
    If(LNotEqual(SMD2,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_I2C2_HID)
      Method (_HRV) { Return (LHRV(SB12)) }
      Method (_CRS) { Return (LCRS(SMD2,SB02,SIR2)) }
      Method (_STA) { Return (LSTA(SMD2)) }
    }
 
    //
    // Apllies for I2C2 PCI mode only
    //
    If(LEqual(SMD2,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_I2C2_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
  } // Device (I2C2)
} // Scope(\_SB.PCI0)
 
//------------------------------------------
//  Serial IO I2C Controller 3 Configuration
//------------------------------------------
Scope(\_SB.PCI0) {
  Device (I2C3) {
    Name (LINK,"\\_SB.PCI0.I2C3") // Windows 7 W/A
    //
    // I2C3 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD(SB13))
    }
    Method (_PS0) {
      LPD0(SB13)
    }
    Method (_PS3) {
      LPD3(SB13)
    }
 
    //
    // Apllies for I2C3 all modes except PCI
    //
    If(LNotEqual(SMD3,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_I2C3_HID)
      Method (_HRV) { Return (LHRV(SB13)) }
      Method (_CRS) { Return (LCRS(SMD3,SB03,SIR3)) }
      Method (_STA) { Return (LSTA(SMD3)) }
    }
 
    //
    // Apllies for I2C3 PCI mode only
    //
    If(LEqual(SMD3,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_I2C3_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
  } // Device (I2C3)
} // Scope(\_SB.PCI0)
 
//------------------------------------------
//  Serial IO I2C Controller 4 Configuration
//------------------------------------------
Scope(\_SB.PCI0) {
  Device (I2C4) {
    Name (LINK,"\\_SB.PCI0.I2C4") // Support for Windows 7
    //
    // I2C4 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD(SB14))
    }
    Method (_PS0) {
      LPD0(SB14)
    }
    Method (_PS3) {
      LPD3(SB14)
    }
 
    //
    // Apllies for I2C4 all modes except PCI
    //
    If(LNotEqual(SMD4,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_I2C4_HID)
      Method (_HRV) { Return (LHRV(SB14)) }
      Method (_CRS) { Return (LCRS(SMD4,SB04,SIR4)) }
      Method (_STA) { Return (LSTA(SMD4)) }
    }
 
    //
    // Apllies for I2C4 PCI mode only
    //
    If(LEqual(SMD4,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_I2C4_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
  } // Device (I2C4)
} // Scope(\_SB.PCI0)
 
//------------------------------------------
//  Serial IO I2C Controller 5 Configuration
//------------------------------------------
Scope(\_SB.PCI0) {
  Device (I2C5) {
    Name (LINK,"\\_SB.PCI0.I2C5") // Support for Windows 7
    //
    // I2C5 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD(SB15))
    }
    Method (_PS0) {
      LPD0(SB15)
    }
    Method (_PS3) {
      LPD3(SB15)
    }
 
    //
    // Apllies for I2C5 all modes except PCI
    //
    If(LNotEqual(SMD5,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_I2C5_HID)
      Method (_HRV) { Return (LHRV(SB15)) }
      Method (_CRS) { Return (LCRS(SMD5,SB05,SIR5)) }
      Method (_STA) { Return (LSTA(SMD5)) }
    }
 
    //
    // Apllies for I2C5 PCI mode only
    //
    If(LEqual(SMD5,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_I2C5_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
  } // Device (I2C5)
} // Scope(\_SB.PCI0)
 
//-------------------------------------------
//  Serial IO SPI Controller 0 Configuration
//-------------------------------------------
Scope(\_SB.PCI0) {
  Device (SPI0) {
    //
    // SPI0 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD(SB16))
    }
    Method (_PS0) {
      LPD0(SB16)
    }
    Method (_PS3) {
      LPD3(SB16)
    }
 
    //
    // Apllies for SPI0 all modes except PCI
    //
    If(LNotEqual(SMD6,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_SPI0_HID)
      Method (_HRV) { Return (LHRV(SB16)) }
      Method (_CRS) { Return (LCRS(SMD6,SB06,SIR6)) }
      Method (_STA) { Return (LSTA(SMD6)) }
    }
 
    //
    // Apllies for SPI0 PCI mode only
    //
    If(LEqual(SMD6,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_SPI0_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
  } // Device (SPI0)
} // Scope(\_SB.PCI0)
 
//------------------------------------------
//  Serial IO SPI Controller 1 Configuration
//------------------------------------------
Scope(\_SB.PCI0) {
  Device (SPI1) {
    //
    // SPI1 PCI/ACPI PS0 PS3 and PSC
    //
    Method (_PSC) {
      Return (GETD (SB17))
    }
    Method (_PS0) {
      LPD0(SB17)
    }
    Method (_PS3) {
      LPD3(SB17)
    }
 
    //
    // Apllies for SPI0 all modes except PCI
    //
    If(LNotEqual(SMD7,SERIAL_IO_PCI)) {
      Name (_HID, SERIAL_IO_SPI1_HID)
      Method (_HRV) { Return (LHRV(SB17)) }
      Method (_CRS) { Return (LCRS(SMD7,SB07,SIR7)) }
      Method (_STA) { Return (LSTA(SMD7)) }
    }
 
    //
    // Apllies for SPI1 PCI mode only
    //
    If(LEqual(SMD7,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_SPI1_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
  } // Device (SPI1)
} // Scope(\_SB.PCI0)
 
//-------------------------------------------
//  Serial IO UART Controller 0 Configuration
//-------------------------------------------
Scope(\_SB.PCI0) {
  Device (UA00) {
 
    //
    // Apllies for UART0 all modes except PCI
    //
    If(LNotEqual(SMD8,SERIAL_IO_PCI)) {
      Method(_HID) {
        If(LEqual(SMD8,SERIAL_IO_LEGACY_UART)) { Return (EISAID("PNP0C02")) }
        Else { Return (SERIAL_IO_UART0_HID) }
      }
      Name (_UID, "SerialIoUart0")
      Name (_DDN, "SerialIoUart0")
      Method (_HRV) { Return (LHRV(SB18)) }
      Method (_CRS) { Return (LCRS(SMD8,SB08,SIR8)) }
      Method (_STA) { Return (LSTA(SMD8)) }
    }
 
    //
    // Apllies for UART0 PCI mode only
    //
    If(LEqual(SMD8,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_UART0_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
    //
    // UART0 PCI/ACPI PS0 PS3 and PSC
    //
    If(LNotEqual(SMD8,SERIAL_IO_LEGACY_UART)) {
      Method (_PSC) {
        Return (GETD (SB18))
      }
      Method (_PS0) {
        LPD0(SB18)
      }
      Method (_PS3) {
        LPD3(SB18)
      }
    }
 
  } // Device (UA00)
} // Scope(\_SB.PCI0)
 
//-------------------------------------------
//  Serial IO UART Controller 1 Configuration
//-------------------------------------------
Scope(\_SB.PCI0) {
  Device (UA01) {
 
    //
    // Apllies for UART1 all modes except PCI
    //
    If(LNotEqual(SMD9,SERIAL_IO_PCI)) {
      Method(_HID) {
        If(LEqual(SMD9,SERIAL_IO_LEGACY_UART)) { Return (EISAID("PNP0C02")) }
        Else { Return (SERIAL_IO_UART1_HID) }
      }
      Name (_UID, "SerialIoUart1")
      Name (_DDN, "SerialIoUart1")
      Method (_HRV) { Return (LHRV(SB19)) }
      Method (_CRS) { Return (LCRS(SMD9,SB09,SIR9)) }
      Method (_STA) { Return (LSTA(SMD9)) }
    }
 
    //
    // Apllies for UART1 PCI mode only
    //
    If(LEqual(SMD9,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_UART1_ADR)
      Method (_DSM,4,Serialized){If(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
    //
    // UART1 PCI/ACPI PS0 PS3 and PSC
    //
    If(LNotEqual(SMD9,SERIAL_IO_LEGACY_UART)) {
      Method (_PSC) {
        Return (GETD (SB19))
      }
      Method (_PS0) {
        LPD0(SB19)
      }
      Method (_PS3) {
        LPD3(SB19)
      }
    }
 
  } // Device (UA01)
} // Scope(\_SB.PCI0)
 
//-------------------------------------------
//  Serial IO UART Controller 2 Configuration
//-------------------------------------------
Scope(\_SB.PCI0) {
  Device (UA02) {
 
    //
    // Apllies for UART2 all modes except PCI
    //
    If(LNotEqual(SMDA,SERIAL_IO_PCI)) {
      Method (_HID) {
        If(LEqual(SMDA,SERIAL_IO_LEGACY_UART)) { Return (EISAID("PNP0C02")) }
        Else { Return (SERIAL_IO_UART2_HID) }
      }
      Name (_UID, "SerialIoUart2")
      Name (_DDN, "SerialIoUart2")
      Method (_HRV) { Return (LHRV(SB1A)) }
      Method (_CRS) { Return (LCRS(SMDA,SB0A,SIRA)) }
      Method (_STA) { Return (LSTA(SMDA)) }
    }
 
    //
    // Apllies for UART2 PCI mode only
    //
    If(LEqual(SMDA,SERIAL_IO_PCI)) {
      Name (_ADR, SERIAL_IO_UART2_ADR)
      Method (_DSM,4,Serialized){if(PCIC(Arg0)) { Return(PCID(Arg0,Arg1,Arg2,Arg3)) }; Return(Buffer() {0})}
    }
 
    //
    // UART2 PCI/ACPI PS0 PS3 and PSC excluding Legacy Uart
    //
    If(LNotEqual(SMDA,SERIAL_IO_LEGACY_UART)) {
      Method (_PSC) {
        Return (GETD(SB1A))
      }
      Method (_PS0) {
        LPD0(SB1A)
      }
      Method (_PS3) {
        LPD3(SB1A)
      }
    }
 
  } // Device (UA02)
} // Scope(\_SB.PCI0)