1/**************************************************************************;
2;*                                                                        *;
3;*                                                                        *;
4;*    Intel Corporation - ACPI Reference Code for the Baytrail            *;
5;*    Family of Customer Reference Boards.                                *;
6;*                                                                        *;
7;*                                                                        *;
8;*    Copyright (c) 2012  - 2014, Intel Corporation. All rights reserved    *;
9;
10; This program and the accompanying materials are licensed and made available under
11; the terms and conditions of the BSD License that accompanies this distribution.
12; The full text of the license may be found at
13; http://opensource.org/licenses/bsd-license.php.
14;
15; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17;
18;*                                                                        *;
19;*                                                                        *;
20;**************************************************************************/
21DefinitionBlock (
22  "Rtd3.aml",
23  "SSDT",
24  1,
25  "AcpiRef",
26  "Msg_Rtd3",
27  0x1000
28)
29{
30  External(RTD3)             //flag if RTD3 is enabled
31
32  If(LEqual(RTD3,1))
33  {
34    Scope (\_SB)
35    {
36      Name(OSCI, 0)  // \_SB._OSC DWORD2 input
37      Name(OSCO, 0)  // \_SB._OSC DWORD2 output
38
39      //Arg0 -- A buffer containing UUID
40      //Arg1 -- An Interger containing a Revision ID of the buffer format
41      //Arg2 -- An interger containing a count of entries in Arg3
42      //Arg3 -- A buffer containing a list of DWORD capacities
43      Method(_OSC, 4, NotSerialized)
44      {
45        // Check for proper UUID
46        If(LEqual(Arg0, ToUUID("0811B06E-4A27-44F9-8D60-3CBBC22E7B48")))
47        {
48          CreateDWordField(Arg3,0,CDW1)     //bit1,2 is always clear
49          CreateDWordField(Arg3,4,CDW2)     //Table 6-147 from ACPI spec
50
51          Store(CDW2, OSCI)                 // Save DWord2
52          Or(OSCI, 0x4, OSCO)               // Only allow _PR3 support
53
54          If(LNotEqual(Arg1,One))
55          {
56            Or(CDW1,0x08,CDW1)            // Unknown revision
57          }
58
59          If(LNotEqual(OSCI, OSCO))
60          {
61            Or(CDW1,0x10,CDW1)            // Capabilities bits were masked
62          }
63
64          Store(OSCO, CDW2)                 // Replace DWord2
65          Return(Arg3)
66        } Else
67        {
68          Or(CDW1,4,CDW1)                   // Unrecognized UUID
69          Return(Arg3)
70        }
71      }// End _OSC
72    }
73  }//end of RTD3 condition
74
75
76  //USB RTD3 code
77  If(LEqual(RTD3,1))
78  {
79    Scope(\_SB.PCI0.EHC1.HUBN.PR01.PR13)
80    {
81      Name(_PR0, Package() {\PR34})
82      Name(_PR3, Package() {\PR34})
83
84      Method(_S0W, 0)
85      {
86        If(And(\_SB.OSCO, 0x04))              // PMEs can be genrated from D3cold
87        {
88          Return(4)                         // OS comprehends D3cold, as described via \_SB._OSC
89        } Else
90        {
91          Return(3)
92        }
93      } // End _S0W
94    }
95
96    Scope(\_SB.PCI0.EHC1.HUBN.PR01.PR14)
97    {
98      Name(_PR0, Package() {\PR34})
99      Name(_PR3, Package() {\PR34})
100
101      Method(_S0W, 0)
102      {
103        If(And(\_SB.OSCO, 0x04))
104        {
105          Return(4)
106        } Else
107        {
108          Return(3)
109        }
110      } // End _S0W
111    }
112
113
114    Scope(\_SB.PCI0.EHC1.HUBN.PR01.PR15)
115    {
116      Name(_PR0, Package() {\PR56})
117      Name(_PR3, Package() {\PR56})
118
119      Method(_S0W, 0)
120      {
121        If(And(\_SB.OSCO, 0x04))
122        {
123          Return(4)
124        } Else
125        {
126          Return(3)
127        }
128      } // End _S0W
129    }
130
131    Scope(\_SB.PCI0.EHC1.HUBN.PR01.PR16)
132    {
133      Name(_PR0, Package() {\PR56})
134      Name(_PR3, Package() {\PR56})
135
136      Method(_S0W, 0)
137      {
138        If(And(\_SB.OSCO, 0x04))
139        {
140          Return(4)
141        } Else
142        {
143          Return(3)
144        }
145      } // End _S0W
146    }
147
148    Scope(\_SB.PCI0.XHC1)                              // XHCI host only controller
149    {
150
151      Method(_PS0,0,Serialized)                      // set device into D0 state
152      {
153      }
154
155      Method(_PS3,0,Serialized)                      // place device into D3H state
156      {
157        //write to PMCSR
158      }
159
160      Method(_DSW, 3,Serialized)                     // enable or disable the device’s ability to wake a sleeping system.
161      {
162      }
163    }
164
165    Scope(\_SB.PCI0.XHC1.RHUB.HS01)
166    {
167
168    }
169
170    Scope(\_SB.PCI0.XHC1.RHUB.SSP1)
171    {
172
173    }
174
175    Scope(\_SB.PCI0.XHC2)                              // OTG
176    {
177
178      Method(_PS0,0,Serialized)                      // set device into D0 state
179      {
180      }
181
182      Method(_PS3,0,Serialized)                      // place device into D3H state
183      {
184        //write to PMCSR
185      }
186
187      Method(_DSW, 3,Serialized)                      // enable or disable the device’s ability to wake a sleeping system.
188      {
189      }
190    }
191
192    Scope(\_SB.PCI0.XHC2.RHUB.HS01)
193    {
194
195    }
196
197    Scope(\_SB.PCI0.XHC2.RHUB.SSP1)
198    {
199
200    }
201  } //If(LEqual(RTD3,1)) USB
202
203}//end of SSDT
204