1/*++
2
3Copyright (c)  1999  - 2014, Intel Corporation. All rights reserved
4
5  This program and the accompanying materials are licensed and made available under
6  the terms and conditions of the BSD License that accompanies this distribution.
7  The full text of the license may be found at
8  http://opensource.org/licenses/bsd-license.php.
9
10  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14
15Module Name:
16
17  IgdOSBCB.ASL
18
19Abstract:
20
21  IGD OpRegion/Software SCI Reference Code for the Baytrail Family.
22  This file contains the system BIOS call back functionality for the
23  OpRegion/Software SCI mechanism.
24
25--*/
26
27
28Method (SBCB, 0, Serialized)
29{
30
31  // Supported Callbacks: Sub-function 0
32
33  If (LEqual(GESF, 0x0))
34  {
35
36    //<TODO> An OEM may support the driver->SBIOS status callbacks, but
37    // the supported callbacks value must be modified.  The code that is
38    // executed upon reception of the callbacks must be also be updated
39    // to perform the desired functionality.
40
41    Store(0x00000000, PARM)         // No callbacks supported
42
43    If(LEqual(PFLV,FMBL))
44    {
45      Store(0x000F87FD, PARM)         // Mobile
46    }
47    If(LEqual(PFLV,FDTP))
48    {
49      Store(0x000F87BD, PARM)         // Desktop
50    }
51
52    Store(Zero, GESF)               // Clear the exit parameter
53    Return(SUCC)                    // "Success"
54  }
55
56  // BIOS POST Completion: Sub-function 1
57
58  If (LEqual(GESF, 1))
59  {
60    Store(Zero, GESF)               // Clear the exit parameter
61    Store(Zero, PARM)
62    Return(SUCC)                    // Not supported, but no failure
63  }
64
65  // Pre-Hires Set Mode: Sub-function 3
66
67  If (LEqual(GESF, 3))
68  {
69    Store(Zero, GESF)               // Clear the exit parameter
70    Store(Zero, PARM)
71    Return(SUCC)                    // Not supported, but no failure
72  }
73
74  // Post-Hires Set Mode: Sub-function 4
75
76  If (LEqual(GESF, 4))
77  {
78    Store(Zero, GESF)               // Clear the exit parameter
79    Store(Zero, PARM)
80    Return(SUCC)                    // Not supported, but no failure
81  }
82
83  // Display Switch: Sub-function 5
84
85  If (LEqual(GESF, 5))
86  {
87    Store(Zero, GESF)               // Clear the exit parameter
88    Store(Zero, PARM)
89    Return(SUCC)                    // Not supported, but no failure
90  }
91
92  // Set TV format: Sub-function 6
93
94  If (LEqual(GESF, 6))
95  {
96
97    //<TODO> If implemented, the input values must be saved into
98    // non-volatile storage for parsing during the next boot.  The
99    // following Sample code is Intel validated implementation.
100
101    Store(And(PARM, 0x0F), ITVF)
102    Store(ShiftRight(And(PARM, 0xF0), 4), ITVM)
103    Store(Zero, GESF)               // Clear the exit parameter
104    Store(Zero, PARM)
105    Return(SUCC)
106  }
107
108  // Adapter Power State: Sub-function 7
109
110  If (LEqual(GESF, 7))
111  {
112
113    // Upon notification from driver that the Adapter Power State = D0,
114    // check if previous lid event failed.  If it did, retry the lid
115    // event here.
116    If(LEqual(PARM, 0))
117    {
118      Store(CLID, Local0)
119      If(And(0x80000000,Local0))
120      {
121        And(CLID, 0x0000000F, CLID)
122        GLID(CLID)
123      }
124    }
125    Store(Zero, GESF)               // Clear the exit parameter
126    Store(Zero, PARM)
127    Return(SUCC)                    // Not supported, but no failure
128  }
129
130  // Display Power State: Sub-function 8
131
132  If (LEqual(GESF, 8))
133  {
134    Store(Zero, GESF)               // Clear the exit parameter
135    Store(Zero, PARM)
136    Return(SUCC)                    // Not supported, but no failure
137  }
138
139  // Set Boot Display: Sub-function 9
140
141  If (LEqual(GESF, 9))
142  {
143
144    //<TODO> An OEM may elect to implement this method.  In that case,
145    // the input values must be saved into non-volatile storage for
146    // parsing during the next boot.  The following Sample code is Intel
147    // validated implementation.
148
149    And(PARM, 0xFF, IBTT)           // Save the boot display to NVS
150    Store(Zero, GESF)               // Clear the exit parameter
151    Store(Zero, PARM)
152    Return(SUCC)                    // Reserved, "Critical failure"
153  }
154
155  // Set Panel Details: Sub-function 10 (0Ah)
156
157  If (LEqual(GESF, 10))
158  {
159
160    //<TODO> An OEM may elect to implement this method.  In that case,
161    // the input values must be saved into non-volatile storage for
162    // parsing during the next boot.  The following Sample code is Intel
163    // validated implementation.
164
165    // Set the panel-related NVRAM variables based the input from the driver.
166
167    And(PARM, 0xFF, IPSC)
168
169    // Change panel type if a change is requested by the driver (Change if
170    // panel type input is non-zero).  Zero=No change requested.
171
172    If(And(ShiftRight(PARM, 8), 0xFF))
173    {
174      And(ShiftRight(PARM, 8), 0xFF, IPAT)
175      Decrement(IPAT)         // 0 = no change, so fit to CMOS map
176    }
177    And(ShiftRight(PARM, 18), 0x3, IBLC)
178    And(ShiftRight(PARM, 20), 0x7, IBIA)
179    Store(Zero, GESF)               // Clear the exit parameter
180    Store(Zero, PARM)
181    Return(SUCC)                    // Success
182  }
183
184  // Set Internal Graphics: Sub-function 11 (0Bh)
185
186  If (LEqual(GESF, 11))
187  {
188
189    //<TODO> An OEM may elect to implement this method.  In that case,
190    // the input values must be saved into non-volatile storage for
191    // parsing during the next boot.  The following Sample code is Intel
192    // validated implementation.
193
194    And(ShiftRight(PARM, 1), 1, IF1E) // Program the function 1 option
195
196    // Fixed memory/DVMT memory
197
198    And(ShiftRight(PARM, 17), 0xF, IDMS) // Program DVMT/fixed memory size
199
200    Store(Zero, GESF)               // Clear the exit parameter
201    Store(Zero, PARM)
202    Return(SUCC)                    // Success
203  }
204
205  // Post-Hires to DOS FS: Sub-function 16 (10h)
206
207  If (LEqual(GESF, 16))
208  {
209    Store(Zero, GESF)               // Clear the exit parameter
210    Store(Zero, PARM)
211    Return(SUCC)                    // Not supported, but no failure
212  }
213
214  // APM Complete:  Sub-function 17 (11h)
215
216  If (LEqual(GESF, 17))
217  {
218
219    Store(ShiftLeft(LIDS, 8), PARM) // Report the lid state
220    Add(PARM, 0x100, PARM)          // Adjust the lid state, 0 = Unknown
221
222    Store(Zero, GESF)               // Clear the exit parameter
223    Return(SUCC)                    // Not supported, but no failure
224  }
225
226  // Set Spread Spectrum Clocks: Sub-function 18 (12h)
227
228  If (LEqual(GESF, 18))
229  {
230
231    //<TODO> An OEM may elect to implement this method.  In that case,
232    // the input values must be saved into non-volatile storage for
233    // parsing during the next boot.  The following Sample code is Intel
234    // validated implementation.
235
236    If(And(PARM, 1))
237    {
238      If(LEqual(ShiftRight(PARM, 1), 1))
239      {
240        Store(1, ISSC)  // Enable HW SSC, only for clock 1
241      }
242      Else
243      {
244        Store(Zero, GESF)
245        Return(CRIT)    // Failure, as the SSC clock must be 1
246      }
247    }
248    Else
249    {
250      Store(0, ISSC)          // Disable SSC
251    }
252    Store(Zero, GESF)               // Clear the exit parameter
253    Store(Zero, PARM)
254    Return(SUCC)                    // Success
255  }
256
257  // Post VBE/PM Callback: Sub-function 19 (13h)
258
259  If (LEqual(GESF, 19))
260  {
261    Store(Zero, GESF)               // Clear the exit parameter
262    Store(Zero, PARM)
263    Return(SUCC)                    // Not supported, but no failure
264  }
265
266  // Set PAVP Data: Sub-function 20 (14h)
267
268  If (LEqual(GESF, 20))
269  {
270    And(PARM, 0xF, PAVP)    // Store PAVP info
271    Store(Zero, GESF)               // Clear the exit parameter
272    Store(Zero, PARM)
273    Return(SUCC)                    // Success
274  }
275
276  // A call to a reserved "System BIOS callbacks" function was received
277
278  Store(Zero, GESF)                     // Clear the exit parameter
279  Return(SUCC)                          // Reserved, "Critical failure"
280}
281