diff options
author | Lv Zheng <lv.zheng@intel.com> | 2013-07-22 04:08:16 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-22 22:06:03 -0400 |
commit | 2cf9f5bcc8d8cb31d6ea7baebac5056f39fb4f40 (patch) | |
tree | f91ff2046741f8c88c257ad7969ff5bd38d4f9ae /drivers/acpi | |
parent | 53b1631e3a274f84686853fa2531d1aa918ee36c (diff) |
ACPICA: Add acpi_update_interfaces() public interface
Add new API to allow OSPM to disable/enable specific types of _OSI
interface strings.
ACPICA does not have the knowledge about whether an _OSI interface
string is an OS vendor string or a feature group string and there
isn't any API interface to allow OSPM to install a new interface
string as a feature group string.
This patch simply adds all feature group strings defined by ACPI
specification into the acpi_default_supported_interfaces with
ACPI_OSI_FEATURE flag set to fix this gap. This patch also adds
codes to keep their default states as ACPI_OSI_INVALID before the
initialization and after the termination.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Conflicts:
include/acpi/actypes.h (with commit 242b228)
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/aclocal.h | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/acutils.h | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/utosi.c | 77 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxface.c | 29 |
4 files changed, 98 insertions, 13 deletions
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index d4a4901637cd..b0e3d15cfe96 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -942,6 +942,9 @@ struct acpi_interface_info { | |||
942 | 942 | ||
943 | #define ACPI_OSI_INVALID 0x01 | 943 | #define ACPI_OSI_INVALID 0x01 |
944 | #define ACPI_OSI_DYNAMIC 0x02 | 944 | #define ACPI_OSI_DYNAMIC 0x02 |
945 | #define ACPI_OSI_FEATURE 0x04 | ||
946 | #define ACPI_OSI_DEFAULT_INVALID 0x08 | ||
947 | #define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID) | ||
945 | 948 | ||
946 | struct acpi_port_info { | 949 | struct acpi_port_info { |
947 | char *name; | 950 | char *name; |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 4c081c436089..d5a62a6182bb 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -470,6 +470,8 @@ acpi_status acpi_ut_install_interface(acpi_string interface_name); | |||
470 | 470 | ||
471 | acpi_status acpi_ut_remove_interface(acpi_string interface_name); | 471 | acpi_status acpi_ut_remove_interface(acpi_string interface_name); |
472 | 472 | ||
473 | acpi_status acpi_ut_update_interfaces(u8 action); | ||
474 | |||
473 | struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name); | 475 | struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name); |
474 | 476 | ||
475 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); | 477 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 7e807725c636..8856bd37bc76 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c | |||
@@ -77,21 +77,20 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = { | |||
77 | 77 | ||
78 | /* Feature Group Strings */ | 78 | /* Feature Group Strings */ |
79 | 79 | ||
80 | {"Extended Address Space Descriptor", NULL, 0, 0} | 80 | {"Extended Address Space Descriptor", NULL, ACPI_OSI_FEATURE, 0}, |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * All "optional" feature group strings (features that are implemented | 83 | * All "optional" feature group strings (features that are implemented |
84 | * by the host) should be dynamically added by the host via | 84 | * by the host) should be dynamically modified to VALID by the host via |
85 | * acpi_install_interface and should not be manually added here. | 85 | * acpi_install_interface or acpi_update_interfaces. Such optional feature |
86 | * | 86 | * group strings are set as INVALID by default here. |
87 | * Examples of optional feature group strings: | ||
88 | * | ||
89 | * "Module Device" | ||
90 | * "Processor Device" | ||
91 | * "3.0 Thermal Model" | ||
92 | * "3.0 _SCP Extensions" | ||
93 | * "Processor Aggregator Device" | ||
94 | */ | 87 | */ |
88 | |||
89 | {"Module Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, | ||
90 | {"Processor Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, | ||
91 | {"3.0 Thermal Model", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, | ||
92 | {"3.0 _SCP Extensions", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, | ||
93 | {"Processor Aggregator Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0} | ||
95 | }; | 94 | }; |
96 | 95 | ||
97 | /******************************************************************************* | 96 | /******************************************************************************* |
@@ -158,11 +157,20 @@ acpi_status acpi_ut_interface_terminate(void) | |||
158 | while (next_interface) { | 157 | while (next_interface) { |
159 | acpi_gbl_supported_interfaces = next_interface->next; | 158 | acpi_gbl_supported_interfaces = next_interface->next; |
160 | 159 | ||
161 | /* Only interfaces added at runtime can be freed */ | ||
162 | |||
163 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { | 160 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { |
161 | |||
162 | /* Only interfaces added at runtime can be freed */ | ||
163 | |||
164 | ACPI_FREE(next_interface->name); | 164 | ACPI_FREE(next_interface->name); |
165 | ACPI_FREE(next_interface); | 165 | ACPI_FREE(next_interface); |
166 | } else { | ||
167 | /* Interface is in static list. Reset it to invalid or valid. */ | ||
168 | |||
169 | if (next_interface->flags & ACPI_OSI_DEFAULT_INVALID) { | ||
170 | next_interface->flags |= ACPI_OSI_INVALID; | ||
171 | } else { | ||
172 | next_interface->flags &= ~ACPI_OSI_INVALID; | ||
173 | } | ||
166 | } | 174 | } |
167 | 175 | ||
168 | next_interface = acpi_gbl_supported_interfaces; | 176 | next_interface = acpi_gbl_supported_interfaces; |
@@ -278,6 +286,49 @@ acpi_status acpi_ut_remove_interface(acpi_string interface_name) | |||
278 | 286 | ||
279 | /******************************************************************************* | 287 | /******************************************************************************* |
280 | * | 288 | * |
289 | * FUNCTION: acpi_ut_update_interfaces | ||
290 | * | ||
291 | * PARAMETERS: action - Actions to be performed during the | ||
292 | * update | ||
293 | * | ||
294 | * RETURN: Status | ||
295 | * | ||
296 | * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor | ||
297 | * strings or/and feature group strings. | ||
298 | * Caller MUST hold acpi_gbl_osi_mutex | ||
299 | * | ||
300 | ******************************************************************************/ | ||
301 | |||
302 | acpi_status acpi_ut_update_interfaces(u8 action) | ||
303 | { | ||
304 | struct acpi_interface_info *next_interface; | ||
305 | |||
306 | next_interface = acpi_gbl_supported_interfaces; | ||
307 | while (next_interface) { | ||
308 | if (((next_interface->flags & ACPI_OSI_FEATURE) && | ||
309 | (action & ACPI_FEATURE_STRINGS)) || | ||
310 | (!(next_interface->flags & ACPI_OSI_FEATURE) && | ||
311 | (action & ACPI_VENDOR_STRINGS))) { | ||
312 | if (action & ACPI_DISABLE_INTERFACES) { | ||
313 | |||
314 | /* Mark the interfaces as invalid */ | ||
315 | |||
316 | next_interface->flags |= ACPI_OSI_INVALID; | ||
317 | } else { | ||
318 | /* Mark the interfaces as valid */ | ||
319 | |||
320 | next_interface->flags &= ~ACPI_OSI_INVALID; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | next_interface = next_interface->next; | ||
325 | } | ||
326 | |||
327 | return (AE_OK); | ||
328 | } | ||
329 | |||
330 | /******************************************************************************* | ||
331 | * | ||
281 | * FUNCTION: acpi_ut_get_interface | 332 | * FUNCTION: acpi_ut_get_interface |
282 | * | 333 | * |
283 | * PARAMETERS: interface_name - The interface to find | 334 | * PARAMETERS: interface_name - The interface to find |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 6505774f223e..03a211e6e26a 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -389,6 +389,34 @@ ACPI_EXPORT_SYMBOL(acpi_install_interface_handler) | |||
389 | 389 | ||
390 | /***************************************************************************** | 390 | /***************************************************************************** |
391 | * | 391 | * |
392 | * FUNCTION: acpi_update_interfaces | ||
393 | * | ||
394 | * PARAMETERS: action - Actions to be performed during the | ||
395 | * update | ||
396 | * | ||
397 | * RETURN: Status | ||
398 | * | ||
399 | * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor | ||
400 | * string or/and feature group strings. | ||
401 | * | ||
402 | ****************************************************************************/ | ||
403 | acpi_status acpi_update_interfaces(u8 action) | ||
404 | { | ||
405 | acpi_status status; | ||
406 | |||
407 | status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
408 | if (ACPI_FAILURE(status)) { | ||
409 | return (status); | ||
410 | } | ||
411 | |||
412 | status = acpi_ut_update_interfaces(action); | ||
413 | |||
414 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
415 | return (status); | ||
416 | } | ||
417 | |||
418 | /***************************************************************************** | ||
419 | * | ||
392 | * FUNCTION: acpi_check_address_range | 420 | * FUNCTION: acpi_check_address_range |
393 | * | 421 | * |
394 | * PARAMETERS: space_id - Address space ID | 422 | * PARAMETERS: space_id - Address space ID |
@@ -402,6 +430,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_interface_handler) | |||
402 | * ASL operation region address ranges. | 430 | * ASL operation region address ranges. |
403 | * | 431 | * |
404 | ****************************************************************************/ | 432 | ****************************************************************************/ |
433 | |||
405 | u32 | 434 | u32 |
406 | acpi_check_address_range(acpi_adr_space_type space_id, | 435 | acpi_check_address_range(acpi_adr_space_type space_id, |
407 | acpi_physical_address address, | 436 | acpi_physical_address address, |