summaryrefslogtreecommitdiff
path: root/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/PchScc.asl
blob: 78a928a5da95a72ce3694abfa452f33c36ac5fdf (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
/**************************************************************************;
;*                                                                        *;
;*                                                                        *;
;*    Intel Corporation - ACPI Reference Code for the Baytrail            *;
;*    Family of Customer Reference Boards.                                *;
;*                                                                        *;
;*                                                                        *;
;*    Copyright (c) 2012  - 2014, Intel Corporation. All rights reserved    *;
;
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;*                                                                        *;
;*                                                                        *;
;**************************************************************************/
Device (PEPD)
{
  Name (_HID, "INT3396")
  Name(_CID, 0x800dd041)
  Name (_UID, 0x1)

  // Indicates if the platform PEP has loaded
  Name(PEPP, Zero)

  // Devices score-boarded by the PEP, Rev0 format
  Name (DEVS, Package() {0})

  // Devices score-boarded by the PEP, Rev1 format
  Name(DEVX, Package()
  {
    Package () {"\\_SB.PCI0.XHC1", 0x1},
    Package () {"\\_SB.PCI0.EHC1", 0x1},
    Package () {"\\_SB.PCI0.GFX0", 0x1},
    Package () {"\\_SB.PCI0.GFX0.ISP0", 0x1},
    Package () {"\\_SB.PCI0.SEC0", 0x1},
    Package () {"\\_SB.I2C1", 0x1},
    Package () {"\\_SB.I2C2", 0x1},
    Package () {"\\_SB.I2C3", 0x1},
    Package () {"\\_SB.I2C4", 0x1},
    Package () {"\\_SB.I2C5", 0x1},
    Package () {"\\_SB.I2C6", 0x1},
    Package () {"\\_SB.I2C7", 0x1},
    Package () {"\\_SB.SDHA", 0x1},
    Package () {"\\_SB.SDHB", 0x1},
    Package () {"\\_SB.SDHC", 0x1},
    Package () {"\\_SB.SPI1", 0x1},
    Package () {"\\_SB.URT1", 0x1},
    Package () {"\\_SB.URT2", 0x1},
  })
  // Crashdump device package
  Name(CDMP, Package(2) {})
  // Device dependency for uPEP
  Name(DEVY, Package()
  {
    Package() {"\\_PR.CPU0", 0x1, Package() {Package() {0xFF, 0}}},
    Package() {"\\_PR.CPU1", 0x1, Package() {Package() {0xFF, 0}}},
    Package() {"\\_PR.CPU2", 0x1, Package() {Package() {0xFF, 0}}},
    Package() {"\\_PR.CPU3", 0x1, Package() {Package() {0xFF, 0}}},
    Package() {"\\_SB.I2C1", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.I2C2", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.I2C3", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.I2C4", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.I2C5", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.I2C6", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.I2C7", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.PCI0.GFX0", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.PCI0.SEC0", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.PCI0.XHC1", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.PCI0.GFX0.ISP0", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.LPEA", 0x1, Package() {Package() {0x0,3}, Package() {0x1,0}, Package() {0x2,3}, Package() {0x3,3}}},
    Package() {"\\_SB.SDHA", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.SDHB", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.SDHC", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.SPI1", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.URT1", 0x1, Package() {Package() {0xFF,3}}},
    Package() {"\\_SB.URT2", 0x1, Package() {Package() {0xFF,3}}}
  })
  // BCCD crashdump information
  Name(BCCD, Package()
  {
    Package()
    {
      "\\_SB.SDHA",
      Package()
      {
        Package() { Package() {0, 32, 0,  3, 0xFFFFFFFFFFFFFFFF}, Package() {0xFFFFFFFC, 0x0, 0x4}, 0}
      }
    }
  })

  Method(_STA, 0x0, NotSerialized)
  {
    Return(0xf)
  }

  Method(_DSM, 0x4, Serialized)
  {
    If(LEqual(Arg0,ToUUID("B8FEBFE0-BAF8-454b-AECD-49FB91137B21")))
    {

      // Number of fn IDs supported
      If(LEqual(Arg2, Zero))
      {
        Return(Buffer(One)
        {
          0xf
        })
      }

      // Pep presence
      If(LEqual(Arg2, One))
      {
        Store(0x1, PEPP)
        Return(0xf)
      }

      // Mitigation devices
      If(LEqual(Arg2, 0x2))
      {
        If(LEqual(Arg1, 0x0))
        {
          // Rev0
          Return(DEVS)
        }
        If(LEqual(Arg1, 0x1))
        {
          // Rev1
          Return(DEVX)
        }
      }

      // Crashdump device data
      If(LEqual(Arg2, 0x3))
      {
        Store("\\_SB.SDHA", Index(CDMP,0))
        Store(EM1A, Index(CDMP,1))
        Return(CDMP)
      }
    }
    // New UUID for built-in uPEP
    If(LEqual(Arg0,ToUUID("C4EB40A0-6CD2-11E2-BCFD-0800200C9A66")))
    {

      // Number of fn IDs supported
      If(LEqual(Arg2, Zero))
      {
        Return(Buffer(One)
        {
          0x7
        })
      }
      // LPI device dependencies
      If(LEqual(Arg2, 0x1))
      {
        Return(DEVY)
      }
      // Crashdump device data
      If(LEqual(Arg2, 0x2))
      {
        Store(EM1A, Local0)
        Add(Local0, 0x84, Local0)
        Store(Local0, Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(BCCD, Zero, )), One, )), Zero, )), Zero, )), 0x4, ))
        Return(BCCD)
      }
    }

    Return(One)
  }
}

//
// eMMC 4.41
//
Device(SDHA)
{
  Name (_ADR, 0)
  Name (_HID, "80860F14")
  Name (_CID, "PNP0D40")
  Name (_DDN, "Intel(R) eMMC Controller - 80860F14")
  Name (_UID, 1)
  Name(_DEP, Package(0x1)
  {
    PEPD
  })

  Name (RBF1, ResourceTemplate ()
  {
    Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
    Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, , , ) {45}  // eMMC 4.41 IRQ
  })

  Method (_CRS, 0x0, NotSerialized)
  {
    // Update the Base address for BAR0 of eMMC 4.41
    CreateDwordField(^RBF1, ^BAR0._BAS, B0B1)
    CreateDwordField(^RBF1, ^BAR0._LEN, B0L1)
    Store(eM0A, B0B1)
    Store(eM0L, B0L1)
    Return (RBF1)
  }
  Method (_STA, 0x0, NotSerialized)
  {
    //
    // PCIM>> 0:ACPI mode            1:PCI mode
    // SD1D>> 0:eMMC 4.41 enable     1:eMMC 4.41 disable
    //
    If (LAnd(LEqual(PCIM, 0), LEqual(SD1D, 0)))
    {
      Return (0xF)
    }
    Else
    {
      Return (0x0)
    }
  }


  Method (_PS3, 0, NotSerialized)
  {
    OR(PSAT, 0x00000003, PSAT)
    OR(PSAT, 0X00000000, PSAT)
    //
    // If not B1, still keep 2 ms w/a
    //
    If(LLess(SOCS, 0x03))
    {
      Sleep(2)
    }
  }
  Method (_PS0, 0, NotSerialized)
  {
    And(PSAT, 0xfffffffC, PSAT)
    OR(PSAT, 0X00000000, PSAT)
    //
    // If not B1, still keep 2 ms w/a
    //
    If(LLess(SOCS, 0x03))
    {
      Sleep(2)
    }
  }

  OperationRegion (KEYS, SystemMemory, eM1A, 0x100)
  Field (KEYS, DWordAcc, NoLock, WriteAsZeros)
  {
    Offset (0x84),
           PSAT,  32
  }

         Method (_DIS, 0x0, NotSerialized)
  {
    //Adding dummy disable methods for device EMM0
  }

  Device (EMMD)
  {
    Name (_ADR, 0x00000008) // Slot 0, Function 8
    Method (_RMV, 0, NotSerialized)
    {
      Return (0x0)
    }
  }
}


//
// eMMC 4.5
//
Device(SDHD)
{
  Name (_ADR, 0)
  Name (_HID, "80860F14")
  Name (_CID, "PNP0D40")
  Name (_DDN, "Intel(R) eMMC Controller - 80860F14")
  Name (_UID, 1)
  Name(_DEP, Package(0x1)
  {
    PEPD
  })

  Name (RBF1, ResourceTemplate ()
  {
    Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
    Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, , , ) {44}  // eMMC 4.5 IRQ
  })
  Method (_CRS, 0x0, NotSerialized)
  {
    CreateDwordField(^RBF1, ^BAR0._BAS, B0B1)
    CreateDwordField(^RBF1, ^BAR0._LEN, B0L1)
    Store(eM0A, B0B1)
    Store(eM0L, B0L1)
    Return (RBF1)
  }
  Method (_STA, 0x0, NotSerialized)
  {
    //
    // PCIM>> 0:ACPI mode           1:PCI mode
    // HSID>> 0:eMMC 4.5 enable     1:eMMC 4.5 disable
    //
    If (LAnd(LEqual(PCIM, 0), LEqual(HSID, 0)))
    {
      Return (0xF)
    }
    Else
    {
      Return (0x0)
    }
  }


  Method (_PS3, 0, NotSerialized)
  {
    OR(PSAT, 0x00000003, PSAT)
    OR(PSAT, 0X00000000, PSAT)
    //
    // If not B1, still keep 2 ms w/a
    //
    If(LLess(SOCS, 0x03))
    {
      Sleep(2)
    }
  }
  Method (_PS0, 0, NotSerialized)
  {
    And(PSAT, 0xfffffffC, PSAT)
    OR(PSAT, 0X00000000, PSAT)
    //
    // If not B1, still keep 2 ms w/a
    //
    If(LLess(SOCS, 0x03))
    {
      Sleep(2)
    }
  }

  OperationRegion (KEYS, SystemMemory, eM1A, 0x100)
  Field (KEYS, DWordAcc, NoLock, WriteAsZeros)
  {
    Offset (0x84),
           PSAT,  32
  }

         Method (_DIS, 0x0, NotSerialized)
  {
    //Adding dummy disable methods for device EMM0
  }

  Device (EM45)
  {
    Name (_ADR, 0x00000008) // Slot 0, Function 8
    Method (_RMV, 0, NotSerialized)
    {
      Return (0x0)
    }
  }
}


//
// SDIO
//
Device(SDHB)
{
  Name (_ADR, 0)
  Name (_HID, "INT33BB")
  Name (_CID, "PNP0D40")
  Name (_DDN, "Intel(R) SDIO Controller - 80860F15")
  Name (_UID, 2)
  Name (_HRV, 2)
  Name(_DEP, Package(0x01)
  {
    PEPD
  })
  Name (PSTS, 0x0)

  Name (RBUF, ResourceTemplate ()
  {
    Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
    Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, , , ) {46}  // SDIO IRQ
  })

  Method (_CRS, 0x0, NotSerialized)
  {

    CreateDwordField(^RBUF, ^BAR0._BAS, B0BA)
    CreateDwordField(^RBUF, ^BAR0._LEN, B0LN)
    Store(SI0A, B0BA)
    Store(SI0L, B0LN)
    Return (RBUF)
  }
  Method (_STA, 0x0, NotSerialized)
  {
    If (LLessEqual(STEP, 0x04))
    {
      //A stepping
      Store(SDMD, _HRV)
    }

    //
    // PCIM>> 0:ACPI mode           1:PCI mode
    //
    If (LEqual(PCIM, 1)) {
      Return (0x0)
    }

    If (LOr(LEqual(SI0A, 0), LEqual(SD2D, 1)))
    {
      Return (0x0)
    }
    Return (0xF)
  }
  Method (_DIS, 0x0, NotSerialized)
  {
    //Adding dummy disable methods for device EMM0
  }

  Method (_PS3, 0, NotSerialized)
  {
    OR(PSAT, 0x00000003, PSAT)
    OR(PSAT, 0X00000000, PSAT)
  }
  Method (_PS0, 0, NotSerialized)
  {
    And(PSAT, 0xfffffffC, PSAT)
    OR(PSAT, 0X00000000, PSAT)

    if(LEqual(\_SB.SDHB.PSTS,0x0))
    {
      if(LEqual (\_SB.GPO2.AVBL, 1))
      {
        Store( 0x01, \_SB.GPO2.WFD3 ) // WL_WIFI_REQ_ON = 1 put the device to normal state
        Store( 0x01, \_SB.SDHB.PSTS)  // indicates that the device powered ON
      }
    }


  }
  OperationRegion (KEYS, SystemMemory, SI1A, 0x100)
  Field (KEYS, DWordAcc, NoLock, WriteAsZeros)
  {
    Offset (0x84),
           PSAT,   32
  }


         Device (BRCM)
  {
    Name (_ADR, 0x01)                 //SlotNumber + Function
    Name (_DEP, Package() {\_SB.GPO2})

    Method (_RMV, 0, NotSerialized)
    {
      Return (0x0)
    }
    Name (_PRW, Package() {0, 0})
    Name (_S4W, 2)

    Method (_CRS, 0, Serialized)
    {
      Name (RBUF, ResourceTemplate ()
      {
        Interrupt (ResourceConsumer, Edge, ActiveHigh, ExclusiveAndWake, , , ) {73}
      })
      Return (RBUF)
    }

    Method (_PS3, 0, NotSerialized)
    {
      if(LEqual (\_SB.GPO2.AVBL, 1))
      {
        Store( 0x00, \_SB.GPO2.WFD3 ) // WL_WIFI_REQ_ON = 0 puts the device in reset state
        Store( 0x00, \_SB.SDHB.PSTS) //Indicates that the device is powered off
      }

    }
    Method (_PS0, 0, NotSerialized)
    {
      if(LEqual(\_SB.SDHB.PSTS,0x0))
      {
        if(LEqual (\_SB.GPO2.AVBL, 1))
        {
          Store( 0x01, \_SB.GPO2.WFD3 ) // WL_WIFI_REQ_ON = 1 put the device to normal state
          Store( 0x01, \_SB.SDHB.PSTS)     // indicates that the device powered ON
        }
      }
    }
  } // Device (BRCM)
  //
  // Secondary Broadcom WIFI function
  //
  Device(BRC2)
  {
    Name(_ADR, 0x2) // function 2
    Name(_STA, 0xf)
    //
    // The device is not removable. This must be a method.
    //
    Method(_RMV, 0x0, NotSerialized)
    {
      Return(0x0)
    }

    //
    // Describe a vendor-defined connection between this device and the
    // primary wifi device
    //

    Method(_CRS)
    {
      Name(NAM, Buffer() {"\\_SB.SDHB.BRCM"})
      Name(SPB, Buffer()
      {
        0x8E,       // SPB Descriptor
        0x18, 0x00, // Length including NAM above
        0x01,       // +0x00 SPB Descriptor Revision
        0x00,       // +0x01 Resource Source Index
        0xc0,       // +0x02 Bus type - vendor defined
        0x02,       // +0x03 Consumer + controller initiated
        0x00, 0x00, // +0x04 Type specific flags
        0x01,       // +0x06 Type specific revision
        0x00, 0x00  // +0x07 type specific data length
        // +0x09 - 0xf bytes for NULL-terminated NAM
        // Length = 0x18
      })

      Name(END, Buffer() {0x79, 0x00})
      Concatenate(SPB, NAM, Local0)
      Concatenate(Local0, END, Local1)
      Return(Local1)
    }
  }

}

//
// SD Card
//
Device(SDHC)
{
  Name (_ADR, 0)
  Name (_HID, "80860F16")
  Name (_CID, "PNP0D40")
  Name (_DDN, "Intel(R) SD Card Controller - 80860F16")
  Name (_UID, 3)
  Name(_DEP, Package(0x01)
  {
    PEPD
  })
  Name (RBUF, ResourceTemplate ()
  {
    Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
    Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, , , ) {47}  // SD Card IRQ
  })
  Method (_CRS, 0x0, NotSerialized)
  {
    CreateDwordField(^RBUF, ^BAR0._BAS, B0BA)
    CreateDwordField(^RBUF, ^BAR0._LEN, B0LN)
    Store(SD0A, B0BA)
    Store(SD0L, B0LN)
    Return (RBUF)
  }
  Method (_STA, 0x0, NotSerialized)
  {
    //
    // PCIM>> 0:ACPI mode           1:PCI mode
    //
    If (LEqual(PCIM, 1)) {
      Return (0x0)
    }

    If (LOr(LEqual(SD0A, 0), LEqual(SD3D, 1)))
    {
      Return (0x0)
    }
    Return (0xF)
  }

  Method (_PS3, 0, NotSerialized)
  {
    OR(PSAT, 0x00000003, PSAT)
    OR(PSAT, 0X00000000, PSAT)
  }
  Method (_PS0, 0, NotSerialized)
  {
    And(PSAT, 0xfffffffC, PSAT)
    OR(PSAT, 0X00000000, PSAT)
  }
  OperationRegion (KEYS, SystemMemory, SD1A, 0x100)
  Field (KEYS, DWordAcc, NoLock, WriteAsZeros)
  {
    Offset (0x84),
           PSAT,   32
  }

  Device (CARD)
  {
    Name (_ADR, 0x00000008)
    Method(_RMV, 0x0, NotSerialized)
    {
      // SDRM = 0 non-removable;
      If (LEqual(SDRM, 0))
      {
        Return (0)
      }

      Return (1)
    }
  }

}