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

DefinitionBlock (
	"SsdtZpOddult.aml",
	"SSDT",
	1,
	"Intel",
	"zpoddult",
	0x1000
  )
{
External(\GO17)
External(\_SB.PCI0.SAT0.PRT1, DeviceObj)
External(RTD3, IntObj)
External(ECON, IntObj)
External(\_SB.WTGP, MethodObj)


 If(LEqual(RTD3, Zero))
 {
    Scope(\_SB.PCI0.SAT0.PRT1)
	{		
        
          //
          // _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(ECON, Zero)) {
                            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.
                  //
                  \_SB.WTGP(86,1) // Power Off the device
                  Store(0,\GO17) // Enable GPIO86
                  Return (1)
                } // Case (2)
                //
                // Power ON Device
                //
                Case (3) {
                  \_SB.WTGP(86,0) // Power ON Device
                  Store(1,\GO17) // Enable GPIO86
                  Sleep(0x0A) // To turn the FET
                  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) {
  //
  // GPI03 = SATA_ODD_DA 
  //
  Method(_L11) {
    If(LEqual(ECON, Zero)) {
        Return ()
    }

    Store(1,\GO17) // Enable GPIO86
    Notify(\_SB.PCI0.SAT0, 0x81)
    Return ()
  }
} // \_GPE
} // If(LEqual(RTD3, Zero))
} // End SSDT