summaryrefslogtreecommitdiff
path: root/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.asl
blob: bd6943182dc75252f3f34cc4df370dae813fffee (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

DefinitionBlock (
	"SsdtZpOdd.aml",
	"SSDT",
	1,
	"Intel",
	"zpodd",
	0x1000
  )
{
External(PFLV)
External(FDTP)
External(GPE3)
External(\GL00)
External(\GL08)
External(GPS3)
External(\_SB.PCI0.SAT0.PRT2, DeviceObj)
External(\GIV0)
External(RTD3, IntObj)

 If(LEqual(RTD3, Zero))
 {
    Scope(\_SB.PCI0.SAT0.PRT2)
	{		
        
          //
          // _DSM Device Specific Method supporting SATA ZPODD function
          //
          // Arg0: UUID Unique function identifier
          // Arg1: Integer Revision Level
          // Arg2: Integer Function Index
          // Arg3: Package Parameters
          //
          Method (_DSM, 4, NotSerialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
            If (LEqual(Arg0, ToUUID ("bdfaef30-aebb-11de-8a39-0800200c9a66"))) {
              //
              // Switch by function index
              //
              Switch (ToInteger(Arg2)) {
                //
                // Standard query - A bitmask of functions supported
                // Supports function 0-5
                //
                Case (0) {
                  switch(ToInteger(Arg1)) {
                    case(1) {
                        //
                        // Return - 0 (No Functions supported) for Desktop Platforms
                        //
                         If(LEqual(PFLV,FDTP)) { 
                            Return (Buffer () {0})
                         }
                         Return (Buffer () {0xF})
                    }
                    Default {Return (Buffer () {0})}
                  }
                } // Case (0)
                //
                // Enable ZPODD feature
                //
                Case (1) {
                   Return (1)
                } // Case (1)
                //
                // Power Off Device
                //
                Case (2) {
                  //
                  // Drive GPIO to low to power off device.
                  //
                  Store(0,GPE3)
                  If(LEqual(And(\GL00, 0x08), 0x08))
                  {
                     Or(\GIV0, 0x08, \GIV0)
                  } Else {
                     And(\GIV0, 0xF7, \GIV0)
                  }
                  And(\GL08, 0xEF, \GL08)
                  Sleep(0xC8) 
                  Store(1,GPS3)
                  Store(1,GPE3)
                  Return (1)
                } // Case (2)
                //
                // Power ON Device
                //
                Case (3) {
                  Store(0,GPE3)
                  Store(1,GPS3)
                  Or(\GL08, 0x10, \GL08)
                  Return (1)
                } // Case (3)

               Default { 
                Return (0) 
               }
              } // Switch (ToInteger(Arg2))
            } Else {
              Return (0) 
            } // bdfaef30-aebb-11de-8a39-0800200c9a66
          } // _DSM
    } // (\_SB.PCI0.SAT0)
//
// GPE Event Handler
//
Scope(\_GPE) {
  //
  // SATA_ODD_DA 
  //
  Method(_L13) {
    //
    // Do nothing if Desktop platform
    //
    If(LEqual(PFLV,FDTP)) {
      Return ()
    }
    //
    // Power on drive, disable SCI on GPI
    // Disable SCI on GPIO3 (PMBASE+0x28 - BIT19)
    //
    Store(0,GPE3)
    //
    // Drive GPIO68 to High to power on device.
    //
    Or(\GL08, 0x10, \GL08)
    //
    // Notify the OSPM
    //
    Notify(\_SB.PCI0.SAT0, 0x82)
    Return ()
  }
} // \_GPE
} // If(LEqual(RTD3, Zero))
} // End SSDT