1 /******************************************************************************
2 *
3 * Module Name: utosi - Support for the _OSI predefined control method
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
60 * BIOS-provided ASL code.
61 *
62 * The last element of each entry is used to track the newest version of
63 * Windows that the BIOS has requested.
64 */
65 static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] =
66 {
67 /* Operating System Vendor Strings */
68
69 {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */
70 {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */
71 {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */
72 {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */
73 {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */
74 {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */
75 {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */
76 {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */
77 {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */
78 {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */
79 {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */
80
81 /* Feature Group Strings */
82
83 {"Extended Address Space Descriptor", NULL, 0, 0}
84
85 /*
86 * All "optional" feature group strings (features that are implemented
87 * by the host) should be dynamically added by the host via
88 * AcpiInstallInterface and should not be manually added here.
89 *
90 * Examples of optional feature group strings:
91 *
92 * "Module Device"
93 * "Processor Device"
94 * "3.0 Thermal Model"
95 * "3.0 _SCP Extensions"
96 * "Processor Aggregator Device"
97 */
98 };
99
100
101 /*******************************************************************************
102 *
103 * FUNCTION: AcpiUtInitializeInterfaces
104 *
105 * PARAMETERS: None
106 *
107 * RETURN: Status
108 *
109 * DESCRIPTION: Initialize the global _OSI supported interfaces list
110 *
111 ******************************************************************************/
112
113 ACPI_STATUS
114 AcpiUtInitializeInterfaces (
115 void)
116 {
117 UINT32 i;
118
119
120 (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
121 AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces;
122
123 /* Link the static list of supported interfaces */
124
125 for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++)
126 {
127 AcpiDefaultSupportedInterfaces[i].Next =
128 &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1];
129 }
130
131 AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
132 return (AE_OK);
133 }
134
135
136 /*******************************************************************************
137 *
138 * FUNCTION: AcpiUtInterfaceTerminate
139 *
140 * PARAMETERS: None
141 *
142 * RETURN: None
143 *
144 * DESCRIPTION: Delete all interfaces in the global list. Sets
145 * AcpiGbl_SupportedInterfaces to NULL.
146 *
147 ******************************************************************************/
148
149 void
150 AcpiUtInterfaceTerminate (
151 void)
152 {
153 ACPI_INTERFACE_INFO *NextInterface;
154
155
156 (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
157 NextInterface = AcpiGbl_SupportedInterfaces;
158
159 while (NextInterface)
160 {
161 AcpiGbl_SupportedInterfaces = NextInterface->Next;
162
163 /* Only interfaces added at runtime can be freed */
164
165 if (NextInterface->Flags & ACPI_OSI_DYNAMIC)
166 {
167 ACPI_FREE (NextInterface->Name);
168 ACPI_FREE (NextInterface);
169 }
170
171 NextInterface = AcpiGbl_SupportedInterfaces;
172 }
173
174 AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
175 }
176
177
178 /*******************************************************************************
179 *
180 * FUNCTION: AcpiUtInstallInterface
181 *
182 * PARAMETERS: InterfaceName - The interface to install
183 *
184 * RETURN: Status
185 *
186 * DESCRIPTION: Install the interface into the global interface list.
187 * Caller MUST hold AcpiGbl_OsiMutex
188 *
189 ******************************************************************************/
190
191 ACPI_STATUS
192 AcpiUtInstallInterface (
193 ACPI_STRING InterfaceName)
194 {
277 }
278
279 NextInterface->Flags |= ACPI_OSI_INVALID;
280 }
281
282 return (AE_OK);
283 }
284
285 PreviousInterface = NextInterface;
286 NextInterface = NextInterface->Next;
287 }
288
289 /* Interface was not found */
290
291 return (AE_NOT_EXIST);
292 }
293
294
295 /*******************************************************************************
296 *
297 * FUNCTION: AcpiUtGetInterface
298 *
299 * PARAMETERS: InterfaceName - The interface to find
300 *
301 * RETURN: ACPI_INTERFACE_INFO if found. NULL if not found.
302 *
303 * DESCRIPTION: Search for the specified interface name in the global list.
304 * Caller MUST hold AcpiGbl_OsiMutex
305 *
306 ******************************************************************************/
307
308 ACPI_INTERFACE_INFO *
309 AcpiUtGetInterface (
310 ACPI_STRING InterfaceName)
311 {
312 ACPI_INTERFACE_INFO *NextInterface;
313
314
315 NextInterface = AcpiGbl_SupportedInterfaces;
316 while (NextInterface)
332 * FUNCTION: AcpiUtOsiImplementation
333 *
334 * PARAMETERS: WalkState - Current walk state
335 *
336 * RETURN: Status
337 *
338 * DESCRIPTION: Implementation of the _OSI predefined control method. When
339 * an invocation of _OSI is encountered in the system AML,
340 * control is transferred to this function.
341 *
342 ******************************************************************************/
343
344 ACPI_STATUS
345 AcpiUtOsiImplementation (
346 ACPI_WALK_STATE *WalkState)
347 {
348 ACPI_OPERAND_OBJECT *StringDesc;
349 ACPI_OPERAND_OBJECT *ReturnDesc;
350 ACPI_INTERFACE_INFO *InterfaceInfo;
351 ACPI_INTERFACE_HANDLER InterfaceHandler;
352 UINT32 ReturnValue;
353
354
355 ACPI_FUNCTION_TRACE (UtOsiImplementation);
356
357
358 /* Validate the string input argument (from the AML caller) */
359
360 StringDesc = WalkState->Arguments[0].Object;
361 if (!StringDesc ||
362 (StringDesc->Common.Type != ACPI_TYPE_STRING))
363 {
364 return_ACPI_STATUS (AE_TYPE);
365 }
366
367 /* Create a return object */
368
369 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
370 if (!ReturnDesc)
371 {
372 return_ACPI_STATUS (AE_NO_MEMORY);
373 }
374
375 /* Default return value is 0, NOT SUPPORTED */
376
377 ReturnValue = 0;
378 (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
379
380 /* Lookup the interface in the global _OSI list */
381
382 InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer);
383 if (InterfaceInfo &&
384 !(InterfaceInfo->Flags & ACPI_OSI_INVALID))
385 {
386 /*
387 * The interface is supported.
388 * Update the OsiData if necessary. We keep track of the latest
389 * version of Windows that has been requested by the BIOS.
390 */
391 if (InterfaceInfo->Value > AcpiGbl_OsiData)
392 {
393 AcpiGbl_OsiData = InterfaceInfo->Value;
394 }
395
396 ReturnValue = ACPI_UINT32_MAX;
397 }
398
|
1 /******************************************************************************
2 *
3 * Module Name: utosi - Support for the _OSI predefined control method
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
60 * BIOS-provided ASL code.
61 *
62 * The last element of each entry is used to track the newest version of
63 * Windows that the BIOS has requested.
64 */
65 static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] =
66 {
67 /* Operating System Vendor Strings */
68
69 {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */
70 {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */
71 {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */
72 {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */
73 {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */
74 {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */
75 {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */
76 {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */
77 {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */
78 {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */
79 {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */
80 {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */
81
82 /* Feature Group Strings */
83
84 {"Extended Address Space Descriptor", NULL, ACPI_OSI_FEATURE, 0},
85
86 /*
87 * All "optional" feature group strings (features that are implemented
88 * by the host) should be dynamically modified to VALID by the host via
89 * AcpiInstallInterface or AcpiUpdateInterfaces. Such optional feature
90 * group strings are set as INVALID by default here.
91 */
92
93 {"Module Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
94 {"Processor Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
95 {"3.0 Thermal Model", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
96 {"3.0 _SCP Extensions", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
97 {"Processor Aggregator Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}
98 };
99
100
101 /*******************************************************************************
102 *
103 * FUNCTION: AcpiUtInitializeInterfaces
104 *
105 * PARAMETERS: None
106 *
107 * RETURN: Status
108 *
109 * DESCRIPTION: Initialize the global _OSI supported interfaces list
110 *
111 ******************************************************************************/
112
113 ACPI_STATUS
114 AcpiUtInitializeInterfaces (
115 void)
116 {
117 ACPI_STATUS Status;
118 UINT32 i;
119
120
121 Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
122 if (ACPI_FAILURE (Status))
123 {
124 return (Status);
125 }
126
127 AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces;
128
129 /* Link the static list of supported interfaces */
130
131 for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++)
132 {
133 AcpiDefaultSupportedInterfaces[i].Next =
134 &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1];
135 }
136
137 AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
138 return (AE_OK);
139 }
140
141
142 /*******************************************************************************
143 *
144 * FUNCTION: AcpiUtInterfaceTerminate
145 *
146 * PARAMETERS: None
147 *
148 * RETURN: Status
149 *
150 * DESCRIPTION: Delete all interfaces in the global list. Sets
151 * AcpiGbl_SupportedInterfaces to NULL.
152 *
153 ******************************************************************************/
154
155 ACPI_STATUS
156 AcpiUtInterfaceTerminate (
157 void)
158 {
159 ACPI_STATUS Status;
160 ACPI_INTERFACE_INFO *NextInterface;
161
162
163 Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
164 if (ACPI_FAILURE (Status))
165 {
166 return (Status);
167 }
168
169 NextInterface = AcpiGbl_SupportedInterfaces;
170 while (NextInterface)
171 {
172 AcpiGbl_SupportedInterfaces = NextInterface->Next;
173
174 if (NextInterface->Flags & ACPI_OSI_DYNAMIC)
175 {
176 /* Only interfaces added at runtime can be freed */
177
178 ACPI_FREE (NextInterface->Name);
179 ACPI_FREE (NextInterface);
180 }
181 else
182 {
183 /* Interface is in static list. Reset it to invalid or valid. */
184
185 if (NextInterface->Flags & ACPI_OSI_DEFAULT_INVALID)
186 {
187 NextInterface->Flags |= ACPI_OSI_INVALID;
188 }
189 else
190 {
191 NextInterface->Flags &= ~ACPI_OSI_INVALID;
192 }
193 }
194
195 NextInterface = AcpiGbl_SupportedInterfaces;
196 }
197
198 AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
199 return (AE_OK);
200 }
201
202
203 /*******************************************************************************
204 *
205 * FUNCTION: AcpiUtInstallInterface
206 *
207 * PARAMETERS: InterfaceName - The interface to install
208 *
209 * RETURN: Status
210 *
211 * DESCRIPTION: Install the interface into the global interface list.
212 * Caller MUST hold AcpiGbl_OsiMutex
213 *
214 ******************************************************************************/
215
216 ACPI_STATUS
217 AcpiUtInstallInterface (
218 ACPI_STRING InterfaceName)
219 {
302 }
303
304 NextInterface->Flags |= ACPI_OSI_INVALID;
305 }
306
307 return (AE_OK);
308 }
309
310 PreviousInterface = NextInterface;
311 NextInterface = NextInterface->Next;
312 }
313
314 /* Interface was not found */
315
316 return (AE_NOT_EXIST);
317 }
318
319
320 /*******************************************************************************
321 *
322 * FUNCTION: AcpiUtUpdateInterfaces
323 *
324 * PARAMETERS: Action - Actions to be performed during the
325 * update
326 *
327 * RETURN: Status
328 *
329 * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor
330 * strings or/and feature group strings.
331 * Caller MUST hold AcpiGbl_OsiMutex
332 *
333 ******************************************************************************/
334
335 ACPI_STATUS
336 AcpiUtUpdateInterfaces (
337 UINT8 Action)
338 {
339 ACPI_INTERFACE_INFO *NextInterface;
340
341
342 NextInterface = AcpiGbl_SupportedInterfaces;
343 while (NextInterface)
344 {
345 if (((NextInterface->Flags & ACPI_OSI_FEATURE) &&
346 (Action & ACPI_FEATURE_STRINGS)) ||
347 (!(NextInterface->Flags & ACPI_OSI_FEATURE) &&
348 (Action & ACPI_VENDOR_STRINGS)))
349 {
350 if (Action & ACPI_DISABLE_INTERFACES)
351 {
352 /* Mark the interfaces as invalid */
353
354 NextInterface->Flags |= ACPI_OSI_INVALID;
355 }
356 else
357 {
358 /* Mark the interfaces as valid */
359
360 NextInterface->Flags &= ~ACPI_OSI_INVALID;
361 }
362 }
363
364 NextInterface = NextInterface->Next;
365 }
366
367 return (AE_OK);
368 }
369
370
371 /*******************************************************************************
372 *
373 * FUNCTION: AcpiUtGetInterface
374 *
375 * PARAMETERS: InterfaceName - The interface to find
376 *
377 * RETURN: ACPI_INTERFACE_INFO if found. NULL if not found.
378 *
379 * DESCRIPTION: Search for the specified interface name in the global list.
380 * Caller MUST hold AcpiGbl_OsiMutex
381 *
382 ******************************************************************************/
383
384 ACPI_INTERFACE_INFO *
385 AcpiUtGetInterface (
386 ACPI_STRING InterfaceName)
387 {
388 ACPI_INTERFACE_INFO *NextInterface;
389
390
391 NextInterface = AcpiGbl_SupportedInterfaces;
392 while (NextInterface)
408 * FUNCTION: AcpiUtOsiImplementation
409 *
410 * PARAMETERS: WalkState - Current walk state
411 *
412 * RETURN: Status
413 *
414 * DESCRIPTION: Implementation of the _OSI predefined control method. When
415 * an invocation of _OSI is encountered in the system AML,
416 * control is transferred to this function.
417 *
418 ******************************************************************************/
419
420 ACPI_STATUS
421 AcpiUtOsiImplementation (
422 ACPI_WALK_STATE *WalkState)
423 {
424 ACPI_OPERAND_OBJECT *StringDesc;
425 ACPI_OPERAND_OBJECT *ReturnDesc;
426 ACPI_INTERFACE_INFO *InterfaceInfo;
427 ACPI_INTERFACE_HANDLER InterfaceHandler;
428 ACPI_STATUS Status;
429 UINT32 ReturnValue;
430
431
432 ACPI_FUNCTION_TRACE (UtOsiImplementation);
433
434
435 /* Validate the string input argument (from the AML caller) */
436
437 StringDesc = WalkState->Arguments[0].Object;
438 if (!StringDesc ||
439 (StringDesc->Common.Type != ACPI_TYPE_STRING))
440 {
441 return_ACPI_STATUS (AE_TYPE);
442 }
443
444 /* Create a return object */
445
446 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
447 if (!ReturnDesc)
448 {
449 return_ACPI_STATUS (AE_NO_MEMORY);
450 }
451
452 /* Default return value is 0, NOT SUPPORTED */
453
454 ReturnValue = 0;
455 Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
456 if (ACPI_FAILURE (Status))
457 {
458 AcpiUtRemoveReference (ReturnDesc);
459 return_ACPI_STATUS (Status);
460 }
461
462 /* Lookup the interface in the global _OSI list */
463
464 InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer);
465 if (InterfaceInfo &&
466 !(InterfaceInfo->Flags & ACPI_OSI_INVALID))
467 {
468 /*
469 * The interface is supported.
470 * Update the OsiData if necessary. We keep track of the latest
471 * version of Windows that has been requested by the BIOS.
472 */
473 if (InterfaceInfo->Value > AcpiGbl_OsiData)
474 {
475 AcpiGbl_OsiData = InterfaceInfo->Value;
476 }
477
478 ReturnValue = ACPI_UINT32_MAX;
479 }
480
|