diff options
author | Len Brown <len.brown@intel.com> | 2010-10-25 02:10:36 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-10-25 02:10:36 -0400 |
commit | aca209e5e654951a3a90f5aaa8e04e0c470993b4 (patch) | |
tree | 5de472175d8edcbdf7a98022af7bf650bde761e9 | |
parent | f6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff) | |
parent | 8df3fc981dc12d9fdcaef4100a2193b605024d7a (diff) |
Merge branch 'acpica' into release
Conflicts:
drivers/acpi/acpica/aclocal.h
Signed-off-by: Len Brown <len.brown@intel.com>
40 files changed, 1826 insertions, 717 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index d93cc06f4bf8..a7e1d1aa4107 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -21,7 +21,7 @@ acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ | |||
21 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ | 21 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ |
22 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdebug.o | 22 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdebug.o |
23 | 23 | ||
24 | acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o | 24 | acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o hwpci.o |
25 | 25 | ||
26 | acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o | 26 | acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o |
27 | 27 | ||
@@ -44,4 +44,5 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | |||
44 | 44 | ||
45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | 45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ |
46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | 46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ |
47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o | 47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o \ |
48 | utosi.o utxferror.o | ||
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index 48faf3eba9fb..72e9d5eb083c 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -105,6 +105,8 @@ void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); | |||
105 | acpi_status | 105 | acpi_status |
106 | acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); | 106 | acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); |
107 | 107 | ||
108 | void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg); | ||
109 | |||
108 | acpi_status acpi_db_find_name_in_namespace(char *name_arg); | 110 | acpi_status acpi_db_find_name_in_namespace(char *name_arg); |
109 | 111 | ||
110 | void acpi_db_set_scope(char *name); | 112 | void acpi_db_set_scope(char *name); |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 1d192142c691..b8dbb9bd6962 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -132,6 +132,7 @@ struct acpi_table_fadt acpi_gbl_FADT; | |||
132 | u32 acpi_current_gpe_count; | 132 | u32 acpi_current_gpe_count; |
133 | u32 acpi_gbl_trace_flags; | 133 | u32 acpi_gbl_trace_flags; |
134 | acpi_name acpi_gbl_trace_method_name; | 134 | acpi_name acpi_gbl_trace_method_name; |
135 | u8 acpi_gbl_system_awake_and_running; | ||
135 | 136 | ||
136 | #endif | 137 | #endif |
137 | 138 | ||
@@ -187,6 +188,10 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width; | |||
187 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; | 188 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; |
188 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | 189 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; |
189 | 190 | ||
191 | /* Mutex for _OSI support */ | ||
192 | |||
193 | ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex; | ||
194 | |||
190 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ | 195 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ |
191 | 196 | ||
192 | ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; | 197 | ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; |
@@ -255,6 +260,7 @@ ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; | |||
255 | ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; | 260 | ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; |
256 | ACPI_EXTERN void *acpi_gbl_table_handler_context; | 261 | ACPI_EXTERN void *acpi_gbl_table_handler_context; |
257 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; | 262 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; |
263 | ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; | ||
258 | 264 | ||
259 | /* Owner ID support */ | 265 | /* Owner ID support */ |
260 | 266 | ||
@@ -273,8 +279,8 @@ ACPI_EXTERN u8 acpi_gbl_debugger_configuration; | |||
273 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; | 279 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; |
274 | ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; | 280 | ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; |
275 | ACPI_EXTERN u8 acpi_gbl_events_initialized; | 281 | ACPI_EXTERN u8 acpi_gbl_events_initialized; |
276 | ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; | ||
277 | ACPI_EXTERN u8 acpi_gbl_osi_data; | 282 | ACPI_EXTERN u8 acpi_gbl_osi_data; |
283 | ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces; | ||
278 | 284 | ||
279 | #ifndef DEFINE_ACPI_GLOBALS | 285 | #ifndef DEFINE_ACPI_GLOBALS |
280 | 286 | ||
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 120b3af56596..167470ad2d21 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -121,6 +121,13 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
121 | struct acpi_gpe_block_info *gpe_block, | 121 | struct acpi_gpe_block_info *gpe_block, |
122 | void *context); | 122 | void *context); |
123 | 123 | ||
124 | /* | ||
125 | * hwpci - PCI configuration support | ||
126 | */ | ||
127 | acpi_status | ||
128 | acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, | ||
129 | acpi_handle root_pci_device, acpi_handle pci_region); | ||
130 | |||
124 | #ifdef ACPI_FUTURE_USAGE | 131 | #ifdef ACPI_FUTURE_USAGE |
125 | /* | 132 | /* |
126 | * hwtimer - ACPI Timer prototypes | 133 | * hwtimer - ACPI Timer prototypes |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 7dad9160f209..8acf1e8e479f 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -854,7 +854,7 @@ struct acpi_bit_register_info { | |||
854 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | 854 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ |
855 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | 855 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ |
856 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | 856 | ACPI_BITMASK_RT_CLOCK_STATUS | \ |
857 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE | \ | 857 | ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ |
858 | ACPI_BITMASK_WAKE_STATUS) | 858 | ACPI_BITMASK_WAKE_STATUS) |
859 | 859 | ||
860 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | 860 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 |
@@ -909,15 +909,21 @@ struct acpi_bit_register_info { | |||
909 | #define ACPI_OSI_WIN_VISTA 0x07 | 909 | #define ACPI_OSI_WIN_VISTA 0x07 |
910 | #define ACPI_OSI_WINSRV_2008 0x08 | 910 | #define ACPI_OSI_WINSRV_2008 0x08 |
911 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 | 911 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 |
912 | #define ACPI_OSI_WIN_7 0x0A | 912 | #define ACPI_OSI_WIN_VISTA_SP2 0x0A |
913 | #define ACPI_OSI_WIN_7 0x0B | ||
913 | 914 | ||
914 | #define ACPI_ALWAYS_ILLEGAL 0x00 | 915 | #define ACPI_ALWAYS_ILLEGAL 0x00 |
915 | 916 | ||
916 | struct acpi_interface_info { | 917 | struct acpi_interface_info { |
917 | char *name; | 918 | char *name; |
919 | struct acpi_interface_info *next; | ||
920 | u8 flags; | ||
918 | u8 value; | 921 | u8 value; |
919 | }; | 922 | }; |
920 | 923 | ||
924 | #define ACPI_OSI_INVALID 0x01 | ||
925 | #define ACPI_OSI_DYNAMIC 0x02 | ||
926 | |||
921 | struct acpi_port_info { | 927 | struct acpi_port_info { |
922 | char *name; | 928 | char *name; |
923 | u16 start; | 929 | u16 start; |
@@ -997,7 +1003,7 @@ struct acpi_port_info { | |||
997 | struct acpi_db_method_info { | 1003 | struct acpi_db_method_info { |
998 | acpi_handle main_thread_gate; | 1004 | acpi_handle main_thread_gate; |
999 | acpi_handle thread_complete_gate; | 1005 | acpi_handle thread_complete_gate; |
1000 | u32 *threads; | 1006 | acpi_thread_id *threads; |
1001 | u32 num_threads; | 1007 | u32 num_threads; |
1002 | u32 num_created; | 1008 | u32 num_created; |
1003 | u32 num_completed; | 1009 | u32 num_completed; |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 9894929a2abb..8d5c9e0a495f 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -338,8 +338,8 @@ | |||
338 | * the plist contains a set of parens to allow variable-length lists. | 338 | * the plist contains a set of parens to allow variable-length lists. |
339 | * These macros are used for both the debug and non-debug versions of the code. | 339 | * These macros are used for both the debug and non-debug versions of the code. |
340 | */ | 340 | */ |
341 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); | 341 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); |
342 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); | 342 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); |
343 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist | 343 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist |
344 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist | 344 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist |
345 | 345 | ||
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 9f60ff002203..d44d3bc5b847 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -339,18 +339,6 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); | |||
339 | u32 acpi_ns_local(acpi_object_type type); | 339 | u32 acpi_ns_local(acpi_object_type type); |
340 | 340 | ||
341 | void | 341 | void |
342 | acpi_ns_report_error(const char *module_name, | ||
343 | u32 line_number, | ||
344 | const char *internal_name, acpi_status lookup_status); | ||
345 | |||
346 | void | ||
347 | acpi_ns_report_method_error(const char *module_name, | ||
348 | u32 line_number, | ||
349 | const char *message, | ||
350 | struct acpi_namespace_node *node, | ||
351 | const char *path, acpi_status lookup_status); | ||
352 | |||
353 | void | ||
354 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); | 342 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); |
355 | 343 | ||
356 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); | 344 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 54857fa87aaf..bdbfaf22bd14 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -248,7 +248,7 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | |||
248 | u32 base_byte_offset; /* Byte offset within containing object */\ | 248 | u32 base_byte_offset; /* Byte offset within containing object */\ |
249 | u32 value; /* Value to store into the Bank or Index register */\ | 249 | u32 value; /* Value to store into the Bank or Index register */\ |
250 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | 250 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ |
251 | u8 access_bit_width; /* Read/Write size in bits (8-64) */ | 251 | |
252 | 252 | ||
253 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | 253 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ |
254 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ | 254 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 35df755251ce..72e4183c1937 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -312,8 +312,6 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list); | |||
312 | /* | 312 | /* |
313 | * uteval - object evaluation | 313 | * uteval - object evaluation |
314 | */ | 314 | */ |
315 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); | ||
316 | |||
317 | acpi_status | 315 | acpi_status |
318 | acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | 316 | acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, |
319 | char *path, | 317 | char *path, |
@@ -395,6 +393,21 @@ acpi_status | |||
395 | acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); | 393 | acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); |
396 | 394 | ||
397 | /* | 395 | /* |
396 | * utosi - Support for the _OSI predefined control method | ||
397 | */ | ||
398 | acpi_status acpi_ut_initialize_interfaces(void); | ||
399 | |||
400 | void acpi_ut_interface_terminate(void); | ||
401 | |||
402 | acpi_status acpi_ut_install_interface(acpi_string interface_name); | ||
403 | |||
404 | acpi_status acpi_ut_remove_interface(acpi_string interface_name); | ||
405 | |||
406 | struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name); | ||
407 | |||
408 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); | ||
409 | |||
410 | /* | ||
398 | * utstate - Generic state creation/cache routines | 411 | * utstate - Generic state creation/cache routines |
399 | */ | 412 | */ |
400 | void | 413 | void |
@@ -473,17 +486,6 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position); | |||
473 | 486 | ||
474 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); | 487 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); |
475 | 488 | ||
476 | void ACPI_INTERNAL_VAR_XFACE | ||
477 | acpi_ut_predefined_warning(const char *module_name, | ||
478 | u32 line_number, | ||
479 | char *pathname, | ||
480 | u8 node_flags, const char *format, ...); | ||
481 | |||
482 | void ACPI_INTERNAL_VAR_XFACE | ||
483 | acpi_ut_predefined_info(const char *module_name, | ||
484 | u32 line_number, | ||
485 | char *pathname, u8 node_flags, const char *format, ...); | ||
486 | |||
487 | /* Values for Base above (16=Hex, 10=Decimal) */ | 489 | /* Values for Base above (16=Hex, 10=Decimal) */ |
488 | 490 | ||
489 | #define ACPI_ANY_BASE 0 | 491 | #define ACPI_ANY_BASE 0 |
@@ -574,6 +576,32 @@ acpi_status | |||
574 | acpi_ut_create_list(char *list_name, | 576 | acpi_ut_create_list(char *list_name, |
575 | u16 object_size, struct acpi_memory_list **return_cache); | 577 | u16 object_size, struct acpi_memory_list **return_cache); |
576 | 578 | ||
577 | #endif | 579 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
580 | |||
581 | /* | ||
582 | * utxferror - various error/warning output functions | ||
583 | */ | ||
584 | void ACPI_INTERNAL_VAR_XFACE | ||
585 | acpi_ut_predefined_warning(const char *module_name, | ||
586 | u32 line_number, | ||
587 | char *pathname, | ||
588 | u8 node_flags, const char *format, ...); | ||
589 | |||
590 | void ACPI_INTERNAL_VAR_XFACE | ||
591 | acpi_ut_predefined_info(const char *module_name, | ||
592 | u32 line_number, | ||
593 | char *pathname, u8 node_flags, const char *format, ...); | ||
594 | |||
595 | void | ||
596 | acpi_ut_namespace_error(const char *module_name, | ||
597 | u32 line_number, | ||
598 | const char *internal_name, acpi_status lookup_status); | ||
599 | |||
600 | void | ||
601 | acpi_ut_method_error(const char *module_name, | ||
602 | u32 line_number, | ||
603 | const char *message, | ||
604 | struct acpi_namespace_node *node, | ||
605 | const char *path, acpi_status lookup_status); | ||
578 | 606 | ||
579 | #endif /* _ACUTILS_H */ | 607 | #endif /* _ACUTILS_H */ |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 64750ee96e20..d94dd8974b55 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -573,7 +573,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
573 | 573 | ||
574 | acpi_os_release_mutex(method_desc->method. | 574 | acpi_os_release_mutex(method_desc->method. |
575 | mutex->mutex.os_mutex); | 575 | mutex->mutex.os_mutex); |
576 | method_desc->method.mutex->mutex.thread_id = NULL; | 576 | method_desc->method.mutex->mutex.thread_id = 0; |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index d555b374e314..6b0b5d08d97a 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
300 | * we must enter this object into the namespace. The created | 300 | * we must enter this object into the namespace. The created |
301 | * object is temporary and will be deleted upon completion of | 301 | * object is temporary and will be deleted upon completion of |
302 | * the execution of this method. | 302 | * the execution of this method. |
303 | * | ||
304 | * Note 10/2010: Except for the Scope() op. This opcode does | ||
305 | * not actually create a new object, it refers to an existing | ||
306 | * object. However, for Scope(), we want to indeed open a | ||
307 | * new scope. | ||
303 | */ | 308 | */ |
304 | status = acpi_ds_load2_begin_op(walk_state, NULL); | 309 | if (op->common.aml_opcode != AML_SCOPE_OP) { |
310 | status = | ||
311 | acpi_ds_load2_begin_op(walk_state, NULL); | ||
312 | } else { | ||
313 | status = | ||
314 | acpi_ds_scope_stack_push(op->named.node, | ||
315 | op->named.node-> | ||
316 | type, walk_state); | ||
317 | if (ACPI_FAILURE(status)) { | ||
318 | return_ACPI_STATUS(status); | ||
319 | } | ||
320 | } | ||
305 | } | 321 | } |
306 | |||
307 | break; | 322 | break; |
308 | 323 | ||
309 | case AML_CLASS_EXECUTE: | 324 | case AML_CLASS_EXECUTE: |
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index df0aea9a8cfd..fcaed9fb44ff 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
@@ -553,7 +553,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
553 | acpi_gbl_global_lock_acquired = FALSE; | 553 | acpi_gbl_global_lock_acquired = FALSE; |
554 | 554 | ||
555 | /* Release the local GL mutex */ | 555 | /* Release the local GL mutex */ |
556 | acpi_ev_global_lock_thread_id = NULL; | 556 | acpi_ev_global_lock_thread_id = 0; |
557 | acpi_ev_global_lock_acquired = 0; | 557 | acpi_ev_global_lock_acquired = 0; |
558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); | 558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); |
559 | return_ACPI_STATUS(status); | 559 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index f40d271bf568..0b47a6dc9290 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -289,8 +289,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /* | 291 | /* |
292 | * Get the PCI device and function numbers from the _ADR object contained | 292 | * Get the PCI device and function numbers from the _ADR object |
293 | * in the parent's scope. | 293 | * contained in the parent's scope. |
294 | */ | 294 | */ |
295 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, | 295 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, |
296 | pci_device_node, &pci_value); | 296 | pci_device_node, &pci_value); |
@@ -320,9 +320,15 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
320 | pci_id->bus = ACPI_LOWORD(pci_value); | 320 | pci_id->bus = ACPI_LOWORD(pci_value); |
321 | } | 321 | } |
322 | 322 | ||
323 | /* Complete this device's pci_id */ | 323 | /* Complete/update the PCI ID for this device */ |
324 | 324 | ||
325 | acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id); | 325 | status = |
326 | acpi_hw_derive_pci_id(pci_id, pci_root_node, | ||
327 | region_obj->region.node); | ||
328 | if (ACPI_FAILURE(status)) { | ||
329 | ACPI_FREE(pci_id); | ||
330 | return_ACPI_STATUS(status); | ||
331 | } | ||
326 | 332 | ||
327 | *region_context = pci_id; | 333 | *region_context = pci_id; |
328 | return_ACPI_STATUS(AE_OK); | 334 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index 541cbc1544d5..ce9314f79451 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
@@ -64,6 +64,12 @@ ACPI_MODULE_NAME("evxfregn") | |||
64 | * | 64 | * |
65 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. | 65 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. |
66 | * | 66 | * |
67 | * NOTE: This function should only be called after acpi_enable_subsystem has | ||
68 | * been called. This is because any _REG methods associated with the Space ID | ||
69 | * are executed here, and these methods can only be safely executed after | ||
70 | * the default handlers have been installed and the hardware has been | ||
71 | * initialized (via acpi_enable_subsystem.) | ||
72 | * | ||
67 | ******************************************************************************/ | 73 | ******************************************************************************/ |
68 | acpi_status | 74 | acpi_status |
69 | acpi_install_address_space_handler(acpi_handle device, | 75 | acpi_install_address_space_handler(acpi_handle device, |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 047217303a4b..38293fd3e088 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -119,8 +119,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Exit now for SMBus or IPMI address space, it has a non-linear address space | 122 | * Exit now for SMBus or IPMI address space, it has a non-linear |
123 | * and the request cannot be directly validated | 123 | * address space and the request cannot be directly validated |
124 | */ | 124 | */ |
125 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || | 125 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || |
126 | rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { | 126 | rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { |
@@ -147,8 +147,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
147 | * (Region length is specified in bytes) | 147 | * (Region length is specified in bytes) |
148 | */ | 148 | */ |
149 | if (rgn_desc->region.length < | 149 | if (rgn_desc->region.length < |
150 | (obj_desc->common_field.base_byte_offset + | 150 | (obj_desc->common_field.base_byte_offset + field_datum_byte_offset + |
151 | field_datum_byte_offset + | ||
152 | obj_desc->common_field.access_byte_width)) { | 151 | obj_desc->common_field.access_byte_width)) { |
153 | if (acpi_gbl_enable_interpreter_slack) { | 152 | if (acpi_gbl_enable_interpreter_slack) { |
154 | /* | 153 | /* |
@@ -680,6 +679,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
680 | u32 buffer_tail_bits; | 679 | u32 buffer_tail_bits; |
681 | u32 datum_count; | 680 | u32 datum_count; |
682 | u32 field_datum_count; | 681 | u32 field_datum_count; |
682 | u32 access_bit_width; | ||
683 | u32 i; | 683 | u32 i; |
684 | 684 | ||
685 | ACPI_FUNCTION_TRACE(ex_extract_from_field); | 685 | ACPI_FUNCTION_TRACE(ex_extract_from_field); |
@@ -694,16 +694,36 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
694 | 694 | ||
695 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); | 695 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); |
696 | } | 696 | } |
697 | |||
697 | ACPI_MEMSET(buffer, 0, buffer_length); | 698 | ACPI_MEMSET(buffer, 0, buffer_length); |
699 | access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); | ||
700 | |||
701 | /* Handle the simple case here */ | ||
702 | |||
703 | if ((obj_desc->common_field.start_field_bit_offset == 0) && | ||
704 | (obj_desc->common_field.bit_length == access_bit_width)) { | ||
705 | status = acpi_ex_field_datum_io(obj_desc, 0, buffer, ACPI_READ); | ||
706 | return_ACPI_STATUS(status); | ||
707 | } | ||
708 | |||
709 | /* TBD: Move to common setup code */ | ||
710 | |||
711 | /* Field algorithm is limited to sizeof(u64), truncate if needed */ | ||
712 | |||
713 | if (obj_desc->common_field.access_byte_width > sizeof(u64)) { | ||
714 | obj_desc->common_field.access_byte_width = sizeof(u64); | ||
715 | access_bit_width = sizeof(u64) * 8; | ||
716 | } | ||
698 | 717 | ||
699 | /* Compute the number of datums (access width data items) */ | 718 | /* Compute the number of datums (access width data items) */ |
700 | 719 | ||
701 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, | 720 | datum_count = |
702 | obj_desc->common_field.access_bit_width); | 721 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
722 | access_bit_width); | ||
723 | |||
703 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | 724 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
704 | obj_desc->common_field. | 725 | obj_desc->common_field. |
705 | start_field_bit_offset, | 726 | start_field_bit_offset, |
706 | obj_desc->common_field. | ||
707 | access_bit_width); | 727 | access_bit_width); |
708 | 728 | ||
709 | /* Priming read from the field */ | 729 | /* Priming read from the field */ |
@@ -738,12 +758,11 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
738 | * This avoids the differences in behavior between different compilers | 758 | * This avoids the differences in behavior between different compilers |
739 | * concerning shift values larger than the target data width. | 759 | * concerning shift values larger than the target data width. |
740 | */ | 760 | */ |
741 | if ((obj_desc->common_field.access_bit_width - | 761 | if (access_bit_width - |
742 | obj_desc->common_field.start_field_bit_offset) < | 762 | obj_desc->common_field.start_field_bit_offset < |
743 | ACPI_INTEGER_BIT_SIZE) { | 763 | ACPI_INTEGER_BIT_SIZE) { |
744 | merged_datum |= | 764 | merged_datum |= |
745 | raw_datum << (obj_desc->common_field. | 765 | raw_datum << (access_bit_width - |
746 | access_bit_width - | ||
747 | obj_desc->common_field. | 766 | obj_desc->common_field. |
748 | start_field_bit_offset); | 767 | start_field_bit_offset); |
749 | } | 768 | } |
@@ -765,8 +784,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
765 | 784 | ||
766 | /* Mask off any extra bits in the last datum */ | 785 | /* Mask off any extra bits in the last datum */ |
767 | 786 | ||
768 | buffer_tail_bits = obj_desc->common_field.bit_length % | 787 | buffer_tail_bits = obj_desc->common_field.bit_length % access_bit_width; |
769 | obj_desc->common_field.access_bit_width; | ||
770 | if (buffer_tail_bits) { | 788 | if (buffer_tail_bits) { |
771 | merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); | 789 | merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); |
772 | } | 790 | } |
@@ -798,6 +816,7 @@ acpi_status | |||
798 | acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | 816 | acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, |
799 | void *buffer, u32 buffer_length) | 817 | void *buffer, u32 buffer_length) |
800 | { | 818 | { |
819 | void *new_buffer; | ||
801 | acpi_status status; | 820 | acpi_status status; |
802 | u64 mask; | 821 | u64 mask; |
803 | u64 width_mask; | 822 | u64 width_mask; |
@@ -808,9 +827,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
808 | u32 buffer_tail_bits; | 827 | u32 buffer_tail_bits; |
809 | u32 datum_count; | 828 | u32 datum_count; |
810 | u32 field_datum_count; | 829 | u32 field_datum_count; |
811 | u32 i; | 830 | u32 access_bit_width; |
812 | u32 required_length; | 831 | u32 required_length; |
813 | void *new_buffer; | 832 | u32 i; |
814 | 833 | ||
815 | ACPI_FUNCTION_TRACE(ex_insert_into_field); | 834 | ACPI_FUNCTION_TRACE(ex_insert_into_field); |
816 | 835 | ||
@@ -844,17 +863,24 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
844 | buffer_length = required_length; | 863 | buffer_length = required_length; |
845 | } | 864 | } |
846 | 865 | ||
866 | /* TBD: Move to common setup code */ | ||
867 | |||
868 | /* Algo is limited to sizeof(u64), so cut the access_byte_width */ | ||
869 | if (obj_desc->common_field.access_byte_width > sizeof(u64)) { | ||
870 | obj_desc->common_field.access_byte_width = sizeof(u64); | ||
871 | } | ||
872 | |||
873 | access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); | ||
874 | |||
847 | /* | 875 | /* |
848 | * Create the bitmasks used for bit insertion. | 876 | * Create the bitmasks used for bit insertion. |
849 | * Note: This if/else is used to bypass compiler differences with the | 877 | * Note: This if/else is used to bypass compiler differences with the |
850 | * shift operator | 878 | * shift operator |
851 | */ | 879 | */ |
852 | if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { | 880 | if (access_bit_width == ACPI_INTEGER_BIT_SIZE) { |
853 | width_mask = ACPI_UINT64_MAX; | 881 | width_mask = ACPI_UINT64_MAX; |
854 | } else { | 882 | } else { |
855 | width_mask = | 883 | width_mask = ACPI_MASK_BITS_ABOVE(access_bit_width); |
856 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field. | ||
857 | access_bit_width); | ||
858 | } | 884 | } |
859 | 885 | ||
860 | mask = width_mask & | 886 | mask = width_mask & |
@@ -863,12 +889,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
863 | /* Compute the number of datums (access width data items) */ | 889 | /* Compute the number of datums (access width data items) */ |
864 | 890 | ||
865 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, | 891 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
866 | obj_desc->common_field.access_bit_width); | 892 | access_bit_width); |
867 | 893 | ||
868 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | 894 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
869 | obj_desc->common_field. | 895 | obj_desc->common_field. |
870 | start_field_bit_offset, | 896 | start_field_bit_offset, |
871 | obj_desc->common_field. | ||
872 | access_bit_width); | 897 | access_bit_width); |
873 | 898 | ||
874 | /* Get initial Datum from the input buffer */ | 899 | /* Get initial Datum from the input buffer */ |
@@ -905,12 +930,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
905 | * This avoids the differences in behavior between different compilers | 930 | * This avoids the differences in behavior between different compilers |
906 | * concerning shift values larger than the target data width. | 931 | * concerning shift values larger than the target data width. |
907 | */ | 932 | */ |
908 | if ((obj_desc->common_field.access_bit_width - | 933 | if ((access_bit_width - |
909 | obj_desc->common_field.start_field_bit_offset) < | 934 | obj_desc->common_field.start_field_bit_offset) < |
910 | ACPI_INTEGER_BIT_SIZE) { | 935 | ACPI_INTEGER_BIT_SIZE) { |
911 | merged_datum = | 936 | merged_datum = |
912 | raw_datum >> (obj_desc->common_field. | 937 | raw_datum >> (access_bit_width - |
913 | access_bit_width - | ||
914 | obj_desc->common_field. | 938 | obj_desc->common_field. |
915 | start_field_bit_offset); | 939 | start_field_bit_offset); |
916 | } else { | 940 | } else { |
@@ -929,6 +953,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
929 | ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, | 953 | ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, |
930 | ACPI_MIN(obj_desc->common_field.access_byte_width, | 954 | ACPI_MIN(obj_desc->common_field.access_byte_width, |
931 | buffer_length - buffer_offset)); | 955 | buffer_length - buffer_offset)); |
956 | |||
932 | merged_datum |= | 957 | merged_datum |= |
933 | raw_datum << obj_desc->common_field.start_field_bit_offset; | 958 | raw_datum << obj_desc->common_field.start_field_bit_offset; |
934 | } | 959 | } |
@@ -937,7 +962,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
937 | 962 | ||
938 | buffer_tail_bits = (obj_desc->common_field.bit_length + | 963 | buffer_tail_bits = (obj_desc->common_field.bit_length + |
939 | obj_desc->common_field.start_field_bit_offset) % | 964 | obj_desc->common_field.start_field_bit_offset) % |
940 | obj_desc->common_field.access_bit_width; | 965 | access_bit_width; |
941 | if (buffer_tail_bits) { | 966 | if (buffer_tail_bits) { |
942 | mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); | 967 | mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); |
943 | } | 968 | } |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index f73be97043c0..6af14e43f839 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -336,7 +336,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) | |||
336 | 336 | ||
337 | /* Clear mutex info */ | 337 | /* Clear mutex info */ |
338 | 338 | ||
339 | obj_desc->mutex.thread_id = NULL; | 339 | obj_desc->mutex.thread_id = 0; |
340 | return_ACPI_STATUS(status); | 340 | return_ACPI_STATUS(status); |
341 | } | 341 | } |
342 | 342 | ||
@@ -393,10 +393,10 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
393 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && | 393 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && |
394 | (obj_desc != acpi_gbl_global_lock_mutex)) { | 394 | (obj_desc != acpi_gbl_global_lock_mutex)) { |
395 | ACPI_ERROR((AE_INFO, | 395 | ACPI_ERROR((AE_INFO, |
396 | "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", | 396 | "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", |
397 | ACPI_CAST_PTR(void, walk_state->thread->thread_id), | 397 | (u32)walk_state->thread->thread_id, |
398 | acpi_ut_get_node_name(obj_desc->mutex.node), | 398 | acpi_ut_get_node_name(obj_desc->mutex.node), |
399 | ACPI_CAST_PTR(void, owner_thread->thread_id))); | 399 | (u32)owner_thread->thread_id)); |
400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
401 | } | 401 | } |
402 | 402 | ||
@@ -488,7 +488,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
488 | /* Mark mutex unowned */ | 488 | /* Mark mutex unowned */ |
489 | 489 | ||
490 | obj_desc->mutex.owner_thread = NULL; | 490 | obj_desc->mutex.owner_thread = NULL; |
491 | obj_desc->mutex.thread_id = NULL; | 491 | obj_desc->mutex.thread_id = 0; |
492 | 492 | ||
493 | /* Update Thread sync_level (Last mutex is the important one) */ | 493 | /* Update Thread sync_level (Last mutex is the important one) */ |
494 | 494 | ||
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 98a331d2249b..7aae29f73d3f 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -355,12 +355,10 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
355 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 355 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
356 | } | 356 | } |
357 | 357 | ||
358 | /* Setup width (access granularity) fields */ | 358 | /* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */ |
359 | 359 | ||
360 | obj_desc->common_field.access_byte_width = (u8) | 360 | obj_desc->common_field.access_byte_width = (u8) |
361 | ACPI_DIV_8(access_bit_width); /* 1, 2, 4, 8 */ | 361 | ACPI_DIV_8(access_bit_width); |
362 | |||
363 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; | ||
364 | 362 | ||
365 | /* | 363 | /* |
366 | * base_byte_offset is the address of the start of the field within the | 364 | * base_byte_offset is the address of the start of the field within the |
@@ -405,8 +403,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
405 | { | 403 | { |
406 | union acpi_operand_object *obj_desc; | 404 | union acpi_operand_object *obj_desc; |
407 | union acpi_operand_object *second_desc = NULL; | 405 | union acpi_operand_object *second_desc = NULL; |
408 | u32 type; | ||
409 | acpi_status status; | 406 | acpi_status status; |
407 | u32 access_byte_width; | ||
408 | u32 type; | ||
410 | 409 | ||
411 | ACPI_FUNCTION_TRACE(ex_prep_field_value); | 410 | ACPI_FUNCTION_TRACE(ex_prep_field_value); |
412 | 411 | ||
@@ -421,8 +420,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
421 | type = acpi_ns_get_type(info->region_node); | 420 | type = acpi_ns_get_type(info->region_node); |
422 | if (type != ACPI_TYPE_REGION) { | 421 | if (type != ACPI_TYPE_REGION) { |
423 | ACPI_ERROR((AE_INFO, | 422 | ACPI_ERROR((AE_INFO, |
424 | "Needed Region, found type 0x%X (%s)", | 423 | "Needed Region, found type 0x%X (%s)", type, |
425 | type, acpi_ut_get_type_name(type))); | 424 | acpi_ut_get_type_name(type))); |
426 | 425 | ||
427 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 426 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
428 | } | 427 | } |
@@ -438,7 +437,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
438 | /* Initialize areas of the object that are common to all fields */ | 437 | /* Initialize areas of the object that are common to all fields */ |
439 | 438 | ||
440 | obj_desc->common_field.node = info->field_node; | 439 | obj_desc->common_field.node = info->field_node; |
441 | status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags, | 440 | status = acpi_ex_prep_common_field_object(obj_desc, |
441 | info->field_flags, | ||
442 | info->attribute, | 442 | info->attribute, |
443 | info->field_bit_position, | 443 | info->field_bit_position, |
444 | info->field_bit_length); | 444 | info->field_bit_length); |
@@ -455,26 +455,25 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
455 | obj_desc->field.region_obj = | 455 | obj_desc->field.region_obj = |
456 | acpi_ns_get_attached_object(info->region_node); | 456 | acpi_ns_get_attached_object(info->region_node); |
457 | 457 | ||
458 | /* An additional reference for the container */ | 458 | /* Allow full data read from EC address space */ |
459 | 459 | ||
460 | acpi_ut_add_reference(obj_desc->field.region_obj); | 460 | if ((obj_desc->field.region_obj->region.space_id == |
461 | ACPI_ADR_SPACE_EC) | ||
462 | && (obj_desc->common_field.bit_length > 8)) { | ||
463 | access_byte_width = | ||
464 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field. | ||
465 | bit_length); | ||
466 | |||
467 | /* Maximum byte width supported is 255 */ | ||
461 | 468 | ||
462 | /* allow full data read from EC address space */ | 469 | if (access_byte_width < 256) { |
463 | if (obj_desc->field.region_obj->region.space_id == | ||
464 | ACPI_ADR_SPACE_EC) { | ||
465 | if (obj_desc->common_field.bit_length > 8) { | ||
466 | unsigned width = | ||
467 | ACPI_ROUND_BITS_UP_TO_BYTES( | ||
468 | obj_desc->common_field.bit_length); | ||
469 | // access_bit_width is u8, don't overflow it | ||
470 | if (width > 8) | ||
471 | width = 8; | ||
472 | obj_desc->common_field.access_byte_width = | 470 | obj_desc->common_field.access_byte_width = |
473 | width; | 471 | (u8)access_byte_width; |
474 | obj_desc->common_field.access_bit_width = | ||
475 | 8 * width; | ||
476 | } | 472 | } |
477 | } | 473 | } |
474 | /* An additional reference for the container */ | ||
475 | |||
476 | acpi_ut_add_reference(obj_desc->field.region_obj); | ||
478 | 477 | ||
479 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 478 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
480 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", | 479 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 8819d2ac5aee..de17e10da0ed 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
@@ -353,7 +353,6 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
353 | acpi_status status = AE_OK; | 353 | acpi_status status = AE_OK; |
354 | struct acpi_pci_id *pci_id; | 354 | struct acpi_pci_id *pci_id; |
355 | u16 pci_register; | 355 | u16 pci_register; |
356 | u32 value32; | ||
357 | 356 | ||
358 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); | 357 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); |
359 | 358 | ||
@@ -381,8 +380,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
381 | case ACPI_READ: | 380 | case ACPI_READ: |
382 | 381 | ||
383 | status = acpi_os_read_pci_configuration(pci_id, pci_register, | 382 | status = acpi_os_read_pci_configuration(pci_id, pci_register, |
384 | &value32, bit_width); | 383 | value, bit_width); |
385 | *value = value32; | ||
386 | break; | 384 | break; |
387 | 385 | ||
388 | case ACPI_WRITE: | 386 | case ACPI_WRITE: |
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c new file mode 100644 index 000000000000..ad21c7d8bf4f --- /dev/null +++ b/drivers/acpi/acpica/hwpci.c | |||
@@ -0,0 +1,412 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: hwpci - Obtain PCI bus, device, and function numbers | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2010, 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. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | |||
47 | #define _COMPONENT ACPI_NAMESPACE | ||
48 | ACPI_MODULE_NAME("hwpci") | ||
49 | |||
50 | /* PCI configuration space values */ | ||
51 | #define PCI_CFG_HEADER_TYPE_REG 0x0E | ||
52 | #define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18 | ||
53 | #define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19 | ||
54 | /* PCI header values */ | ||
55 | #define PCI_HEADER_TYPE_MASK 0x7F | ||
56 | #define PCI_TYPE_BRIDGE 0x01 | ||
57 | #define PCI_TYPE_CARDBUS_BRIDGE 0x02 | ||
58 | typedef struct acpi_pci_device { | ||
59 | acpi_handle device; | ||
60 | struct acpi_pci_device *next; | ||
61 | |||
62 | } acpi_pci_device; | ||
63 | |||
64 | /* Local prototypes */ | ||
65 | |||
66 | static acpi_status | ||
67 | acpi_hw_build_pci_list(acpi_handle root_pci_device, | ||
68 | acpi_handle pci_region, | ||
69 | struct acpi_pci_device **return_list_head); | ||
70 | |||
71 | static acpi_status | ||
72 | acpi_hw_process_pci_list(struct acpi_pci_id *pci_id, | ||
73 | struct acpi_pci_device *list_head); | ||
74 | |||
75 | static void acpi_hw_delete_pci_list(struct acpi_pci_device *list_head); | ||
76 | |||
77 | static acpi_status | ||
78 | acpi_hw_get_pci_device_info(struct acpi_pci_id *pci_id, | ||
79 | acpi_handle pci_device, | ||
80 | u16 *bus_number, u8 *is_bridge); | ||
81 | |||
82 | /******************************************************************************* | ||
83 | * | ||
84 | * FUNCTION: acpi_hw_derive_pci_id | ||
85 | * | ||
86 | * PARAMETERS: pci_id - Initial values for the PCI ID. May be | ||
87 | * modified by this function. | ||
88 | * root_pci_device - A handle to a PCI device object. This | ||
89 | * object must be a PCI Root Bridge having a | ||
90 | * _HID value of either PNP0A03 or PNP0A08 | ||
91 | * pci_region - A handle to a PCI configuration space | ||
92 | * Operation Region being initialized | ||
93 | * | ||
94 | * RETURN: Status | ||
95 | * | ||
96 | * DESCRIPTION: This function derives a full PCI ID for a PCI device, | ||
97 | * consisting of a Segment number, Bus number, Device number, | ||
98 | * and function code. | ||
99 | * | ||
100 | * The PCI hardware dynamically configures PCI bus numbers | ||
101 | * depending on the bus topology discovered during system | ||
102 | * initialization. This function is invoked during configuration | ||
103 | * of a PCI_Config Operation Region in order to (possibly) update | ||
104 | * the Bus/Device/Function numbers in the pci_id with the actual | ||
105 | * values as determined by the hardware and operating system | ||
106 | * configuration. | ||
107 | * | ||
108 | * The pci_id parameter is initially populated during the Operation | ||
109 | * Region initialization. This function is then called, and is | ||
110 | * will make any necessary modifications to the Bus, Device, or | ||
111 | * Function number PCI ID subfields as appropriate for the | ||
112 | * current hardware and OS configuration. | ||
113 | * | ||
114 | * NOTE: Created 08/2010. Replaces the previous OSL acpi_os_derive_pci_id | ||
115 | * interface since this feature is OS-independent. This module | ||
116 | * specifically avoids any use of recursion by building a local | ||
117 | * temporary device list. | ||
118 | * | ||
119 | ******************************************************************************/ | ||
120 | |||
121 | acpi_status | ||
122 | acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, | ||
123 | acpi_handle root_pci_device, acpi_handle pci_region) | ||
124 | { | ||
125 | acpi_status status; | ||
126 | struct acpi_pci_device *list_head = NULL; | ||
127 | |||
128 | ACPI_FUNCTION_TRACE(hw_derive_pci_id); | ||
129 | |||
130 | if (!pci_id) { | ||
131 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
132 | } | ||
133 | |||
134 | /* Build a list of PCI devices, from pci_region up to root_pci_device */ | ||
135 | |||
136 | status = | ||
137 | acpi_hw_build_pci_list(root_pci_device, pci_region, &list_head); | ||
138 | if (ACPI_SUCCESS(status)) { | ||
139 | |||
140 | /* Walk the list, updating the PCI device/function/bus numbers */ | ||
141 | |||
142 | status = acpi_hw_process_pci_list(pci_id, list_head); | ||
143 | } | ||
144 | |||
145 | /* Always delete the list */ | ||
146 | |||
147 | acpi_hw_delete_pci_list(list_head); | ||
148 | return_ACPI_STATUS(status); | ||
149 | } | ||
150 | |||
151 | /******************************************************************************* | ||
152 | * | ||
153 | * FUNCTION: acpi_hw_build_pci_list | ||
154 | * | ||
155 | * PARAMETERS: root_pci_device - A handle to a PCI device object. This | ||
156 | * object is guaranteed to be a PCI Root | ||
157 | * Bridge having a _HID value of either | ||
158 | * PNP0A03 or PNP0A08 | ||
159 | * pci_region - A handle to the PCI configuration space | ||
160 | * Operation Region | ||
161 | * return_list_head - Where the PCI device list is returned | ||
162 | * | ||
163 | * RETURN: Status | ||
164 | * | ||
165 | * DESCRIPTION: Builds a list of devices from the input PCI region up to the | ||
166 | * Root PCI device for this namespace subtree. | ||
167 | * | ||
168 | ******************************************************************************/ | ||
169 | |||
170 | static acpi_status | ||
171 | acpi_hw_build_pci_list(acpi_handle root_pci_device, | ||
172 | acpi_handle pci_region, | ||
173 | struct acpi_pci_device **return_list_head) | ||
174 | { | ||
175 | acpi_handle current_device; | ||
176 | acpi_handle parent_device; | ||
177 | acpi_status status; | ||
178 | struct acpi_pci_device *list_element; | ||
179 | struct acpi_pci_device *list_head = NULL; | ||
180 | |||
181 | /* | ||
182 | * Ascend namespace branch until the root_pci_device is reached, building | ||
183 | * a list of device nodes. Loop will exit when either the PCI device is | ||
184 | * found, or the root of the namespace is reached. | ||
185 | */ | ||
186 | current_device = pci_region; | ||
187 | while (1) { | ||
188 | status = acpi_get_parent(current_device, &parent_device); | ||
189 | if (ACPI_FAILURE(status)) { | ||
190 | return (status); | ||
191 | } | ||
192 | |||
193 | /* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */ | ||
194 | |||
195 | if (parent_device == root_pci_device) { | ||
196 | *return_list_head = list_head; | ||
197 | return (AE_OK); | ||
198 | } | ||
199 | |||
200 | list_element = ACPI_ALLOCATE(sizeof(struct acpi_pci_device)); | ||
201 | if (!list_element) { | ||
202 | return (AE_NO_MEMORY); | ||
203 | } | ||
204 | |||
205 | /* Put new element at the head of the list */ | ||
206 | |||
207 | list_element->next = list_head; | ||
208 | list_element->device = parent_device; | ||
209 | list_head = list_element; | ||
210 | |||
211 | current_device = parent_device; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | /******************************************************************************* | ||
216 | * | ||
217 | * FUNCTION: acpi_hw_process_pci_list | ||
218 | * | ||
219 | * PARAMETERS: pci_id - Initial values for the PCI ID. May be | ||
220 | * modified by this function. | ||
221 | * list_head - Device list created by | ||
222 | * acpi_hw_build_pci_list | ||
223 | * | ||
224 | * RETURN: Status | ||
225 | * | ||
226 | * DESCRIPTION: Walk downward through the PCI device list, getting the device | ||
227 | * info for each, via the PCI configuration space and updating | ||
228 | * the PCI ID as necessary. Deletes the list during traversal. | ||
229 | * | ||
230 | ******************************************************************************/ | ||
231 | |||
232 | static acpi_status | ||
233 | acpi_hw_process_pci_list(struct acpi_pci_id *pci_id, | ||
234 | struct acpi_pci_device *list_head) | ||
235 | { | ||
236 | acpi_status status = AE_OK; | ||
237 | struct acpi_pci_device *info; | ||
238 | u16 bus_number; | ||
239 | u8 is_bridge = TRUE; | ||
240 | |||
241 | ACPI_FUNCTION_NAME(hw_process_pci_list); | ||
242 | |||
243 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
244 | "Input PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X\n", | ||
245 | pci_id->segment, pci_id->bus, pci_id->device, | ||
246 | pci_id->function)); | ||
247 | |||
248 | bus_number = pci_id->bus; | ||
249 | |||
250 | /* | ||
251 | * Descend down the namespace tree, collecting PCI device, function, | ||
252 | * and bus numbers. bus_number is only important for PCI bridges. | ||
253 | * Algorithm: As we descend the tree, use the last valid PCI device, | ||
254 | * function, and bus numbers that are discovered, and assign them | ||
255 | * to the PCI ID for the target device. | ||
256 | */ | ||
257 | info = list_head; | ||
258 | while (info) { | ||
259 | status = acpi_hw_get_pci_device_info(pci_id, info->device, | ||
260 | &bus_number, &is_bridge); | ||
261 | if (ACPI_FAILURE(status)) { | ||
262 | return_ACPI_STATUS(status); | ||
263 | } | ||
264 | |||
265 | info = info->next; | ||
266 | } | ||
267 | |||
268 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
269 | "Output PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X " | ||
270 | "Status %X BusNumber %X IsBridge %X\n", | ||
271 | pci_id->segment, pci_id->bus, pci_id->device, | ||
272 | pci_id->function, status, bus_number, is_bridge)); | ||
273 | |||
274 | return_ACPI_STATUS(AE_OK); | ||
275 | } | ||
276 | |||
277 | /******************************************************************************* | ||
278 | * | ||
279 | * FUNCTION: acpi_hw_delete_pci_list | ||
280 | * | ||
281 | * PARAMETERS: list_head - Device list created by | ||
282 | * acpi_hw_build_pci_list | ||
283 | * | ||
284 | * RETURN: None | ||
285 | * | ||
286 | * DESCRIPTION: Free the entire PCI list. | ||
287 | * | ||
288 | ******************************************************************************/ | ||
289 | |||
290 | static void acpi_hw_delete_pci_list(struct acpi_pci_device *list_head) | ||
291 | { | ||
292 | struct acpi_pci_device *next; | ||
293 | struct acpi_pci_device *previous; | ||
294 | |||
295 | next = list_head; | ||
296 | while (next) { | ||
297 | previous = next; | ||
298 | next = previous->next; | ||
299 | ACPI_FREE(previous); | ||
300 | } | ||
301 | } | ||
302 | |||
303 | /******************************************************************************* | ||
304 | * | ||
305 | * FUNCTION: acpi_hw_get_pci_device_info | ||
306 | * | ||
307 | * PARAMETERS: pci_id - Initial values for the PCI ID. May be | ||
308 | * modified by this function. | ||
309 | * pci_device - Handle for the PCI device object | ||
310 | * bus_number - Where a PCI bridge bus number is returned | ||
311 | * is_bridge - Return value, indicates if this PCI | ||
312 | * device is a PCI bridge | ||
313 | * | ||
314 | * RETURN: Status | ||
315 | * | ||
316 | * DESCRIPTION: Get the device info for a single PCI device object. Get the | ||
317 | * _ADR (contains PCI device and function numbers), and for PCI | ||
318 | * bridge devices, get the bus number from PCI configuration | ||
319 | * space. | ||
320 | * | ||
321 | ******************************************************************************/ | ||
322 | |||
323 | static acpi_status | ||
324 | acpi_hw_get_pci_device_info(struct acpi_pci_id *pci_id, | ||
325 | acpi_handle pci_device, | ||
326 | u16 *bus_number, u8 *is_bridge) | ||
327 | { | ||
328 | acpi_status status; | ||
329 | acpi_object_type object_type; | ||
330 | u64 return_value; | ||
331 | u64 pci_value; | ||
332 | |||
333 | /* We only care about objects of type Device */ | ||
334 | |||
335 | status = acpi_get_type(pci_device, &object_type); | ||
336 | if (ACPI_FAILURE(status)) { | ||
337 | return (status); | ||
338 | } | ||
339 | |||
340 | if (object_type != ACPI_TYPE_DEVICE) { | ||
341 | return (AE_OK); | ||
342 | } | ||
343 | |||
344 | /* We need an _ADR. Ignore device if not present */ | ||
345 | |||
346 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, | ||
347 | pci_device, &return_value); | ||
348 | if (ACPI_FAILURE(status)) { | ||
349 | return (AE_OK); | ||
350 | } | ||
351 | |||
352 | /* | ||
353 | * From _ADR, get the PCI Device and Function and | ||
354 | * update the PCI ID. | ||
355 | */ | ||
356 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(return_value)); | ||
357 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(return_value)); | ||
358 | |||
359 | /* | ||
360 | * If the previous device was a bridge, use the previous | ||
361 | * device bus number | ||
362 | */ | ||
363 | if (*is_bridge) { | ||
364 | pci_id->bus = *bus_number; | ||
365 | } | ||
366 | |||
367 | /* | ||
368 | * Get the bus numbers from PCI Config space: | ||
369 | * | ||
370 | * First, get the PCI header_type | ||
371 | */ | ||
372 | *is_bridge = FALSE; | ||
373 | status = acpi_os_read_pci_configuration(pci_id, | ||
374 | PCI_CFG_HEADER_TYPE_REG, | ||
375 | &pci_value, 8); | ||
376 | if (ACPI_FAILURE(status)) { | ||
377 | return (status); | ||
378 | } | ||
379 | |||
380 | /* We only care about bridges (1=pci_bridge, 2=card_bus_bridge) */ | ||
381 | |||
382 | pci_value &= PCI_HEADER_TYPE_MASK; | ||
383 | |||
384 | if ((pci_value != PCI_TYPE_BRIDGE) && | ||
385 | (pci_value != PCI_TYPE_CARDBUS_BRIDGE)) { | ||
386 | return (AE_OK); | ||
387 | } | ||
388 | |||
389 | /* Bridge: Get the Primary bus_number */ | ||
390 | |||
391 | status = acpi_os_read_pci_configuration(pci_id, | ||
392 | PCI_CFG_PRIMARY_BUS_NUMBER_REG, | ||
393 | &pci_value, 8); | ||
394 | if (ACPI_FAILURE(status)) { | ||
395 | return (status); | ||
396 | } | ||
397 | |||
398 | *is_bridge = TRUE; | ||
399 | pci_id->bus = (u16)pci_value; | ||
400 | |||
401 | /* Bridge: Get the Secondary bus_number */ | ||
402 | |||
403 | status = acpi_os_read_pci_configuration(pci_id, | ||
404 | PCI_CFG_SECONDARY_BUS_NUMBER_REG, | ||
405 | &pci_value, 8); | ||
406 | if (ACPI_FAILURE(status)) { | ||
407 | return (status); | ||
408 | } | ||
409 | |||
410 | *bus_number = (u16)pci_value; | ||
411 | return (AE_OK); | ||
412 | } | ||
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 4009498fbabd..4ef9f43ea926 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -74,10 +74,18 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data, | |||
74 | union acpi_operand_object **return_object_ptr); | 74 | union acpi_operand_object **return_object_ptr); |
75 | 75 | ||
76 | static acpi_status | 76 | static acpi_status |
77 | acpi_ns_repair_CID(struct acpi_predefined_data *data, | ||
78 | union acpi_operand_object **return_object_ptr); | ||
79 | |||
80 | static acpi_status | ||
77 | acpi_ns_repair_FDE(struct acpi_predefined_data *data, | 81 | acpi_ns_repair_FDE(struct acpi_predefined_data *data, |
78 | union acpi_operand_object **return_object_ptr); | 82 | union acpi_operand_object **return_object_ptr); |
79 | 83 | ||
80 | static acpi_status | 84 | static acpi_status |
85 | acpi_ns_repair_HID(struct acpi_predefined_data *data, | ||
86 | union acpi_operand_object **return_object_ptr); | ||
87 | |||
88 | static acpi_status | ||
81 | acpi_ns_repair_PSS(struct acpi_predefined_data *data, | 89 | acpi_ns_repair_PSS(struct acpi_predefined_data *data, |
82 | union acpi_operand_object **return_object_ptr); | 90 | union acpi_operand_object **return_object_ptr); |
83 | 91 | ||
@@ -108,8 +116,10 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
108 | * As necessary: | 116 | * As necessary: |
109 | * | 117 | * |
110 | * _ALR: Sort the list ascending by ambient_illuminance | 118 | * _ALR: Sort the list ascending by ambient_illuminance |
119 | * _CID: Strings: uppercase all, remove any leading asterisk | ||
111 | * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs | 120 | * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs |
112 | * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs | 121 | * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs |
122 | * _HID: Strings: uppercase all, remove any leading asterisk | ||
113 | * _PSS: Sort the list descending by Power | 123 | * _PSS: Sort the list descending by Power |
114 | * _TSS: Sort the list descending by Power | 124 | * _TSS: Sort the list descending by Power |
115 | * | 125 | * |
@@ -122,8 +132,10 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
122 | */ | 132 | */ |
123 | static const struct acpi_repair_info acpi_ns_repairable_names[] = { | 133 | static const struct acpi_repair_info acpi_ns_repairable_names[] = { |
124 | {"_ALR", acpi_ns_repair_ALR}, | 134 | {"_ALR", acpi_ns_repair_ALR}, |
135 | {"_CID", acpi_ns_repair_CID}, | ||
125 | {"_FDE", acpi_ns_repair_FDE}, | 136 | {"_FDE", acpi_ns_repair_FDE}, |
126 | {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */ | 137 | {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */ |
138 | {"_HID", acpi_ns_repair_HID}, | ||
127 | {"_PSS", acpi_ns_repair_PSS}, | 139 | {"_PSS", acpi_ns_repair_PSS}, |
128 | {"_TSS", acpi_ns_repair_TSS}, | 140 | {"_TSS", acpi_ns_repair_TSS}, |
129 | {{0, 0, 0, 0}, NULL} /* Table terminator */ | 141 | {{0, 0, 0, 0}, NULL} /* Table terminator */ |
@@ -321,6 +333,157 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data, | |||
321 | 333 | ||
322 | /****************************************************************************** | 334 | /****************************************************************************** |
323 | * | 335 | * |
336 | * FUNCTION: acpi_ns_repair_CID | ||
337 | * | ||
338 | * PARAMETERS: Data - Pointer to validation data structure | ||
339 | * return_object_ptr - Pointer to the object returned from the | ||
340 | * evaluation of a method or object | ||
341 | * | ||
342 | * RETURN: Status. AE_OK if object is OK or was repaired successfully | ||
343 | * | ||
344 | * DESCRIPTION: Repair for the _CID object. If a string, ensure that all | ||
345 | * letters are uppercase and that there is no leading asterisk. | ||
346 | * If a Package, ensure same for all string elements. | ||
347 | * | ||
348 | *****************************************************************************/ | ||
349 | |||
350 | static acpi_status | ||
351 | acpi_ns_repair_CID(struct acpi_predefined_data *data, | ||
352 | union acpi_operand_object **return_object_ptr) | ||
353 | { | ||
354 | acpi_status status; | ||
355 | union acpi_operand_object *return_object = *return_object_ptr; | ||
356 | union acpi_operand_object **element_ptr; | ||
357 | union acpi_operand_object *original_element; | ||
358 | u16 original_ref_count; | ||
359 | u32 i; | ||
360 | |||
361 | /* Check for _CID as a simple string */ | ||
362 | |||
363 | if (return_object->common.type == ACPI_TYPE_STRING) { | ||
364 | status = acpi_ns_repair_HID(data, return_object_ptr); | ||
365 | return (status); | ||
366 | } | ||
367 | |||
368 | /* Exit if not a Package */ | ||
369 | |||
370 | if (return_object->common.type != ACPI_TYPE_PACKAGE) { | ||
371 | return (AE_OK); | ||
372 | } | ||
373 | |||
374 | /* Examine each element of the _CID package */ | ||
375 | |||
376 | element_ptr = return_object->package.elements; | ||
377 | for (i = 0; i < return_object->package.count; i++) { | ||
378 | original_element = *element_ptr; | ||
379 | original_ref_count = original_element->common.reference_count; | ||
380 | |||
381 | status = acpi_ns_repair_HID(data, element_ptr); | ||
382 | if (ACPI_FAILURE(status)) { | ||
383 | return (status); | ||
384 | } | ||
385 | |||
386 | /* Take care with reference counts */ | ||
387 | |||
388 | if (original_element != *element_ptr) { | ||
389 | |||
390 | /* Element was replaced */ | ||
391 | |||
392 | (*element_ptr)->common.reference_count = | ||
393 | original_ref_count; | ||
394 | |||
395 | acpi_ut_remove_reference(original_element); | ||
396 | } | ||
397 | |||
398 | element_ptr++; | ||
399 | } | ||
400 | |||
401 | return (AE_OK); | ||
402 | } | ||
403 | |||
404 | /****************************************************************************** | ||
405 | * | ||
406 | * FUNCTION: acpi_ns_repair_HID | ||
407 | * | ||
408 | * PARAMETERS: Data - Pointer to validation data structure | ||
409 | * return_object_ptr - Pointer to the object returned from the | ||
410 | * evaluation of a method or object | ||
411 | * | ||
412 | * RETURN: Status. AE_OK if object is OK or was repaired successfully | ||
413 | * | ||
414 | * DESCRIPTION: Repair for the _HID object. If a string, ensure that all | ||
415 | * letters are uppercase and that there is no leading asterisk. | ||
416 | * | ||
417 | *****************************************************************************/ | ||
418 | |||
419 | static acpi_status | ||
420 | acpi_ns_repair_HID(struct acpi_predefined_data *data, | ||
421 | union acpi_operand_object **return_object_ptr) | ||
422 | { | ||
423 | union acpi_operand_object *return_object = *return_object_ptr; | ||
424 | union acpi_operand_object *new_string; | ||
425 | char *source; | ||
426 | char *dest; | ||
427 | |||
428 | ACPI_FUNCTION_NAME(ns_repair_HID); | ||
429 | |||
430 | /* We only care about string _HID objects (not integers) */ | ||
431 | |||
432 | if (return_object->common.type != ACPI_TYPE_STRING) { | ||
433 | return (AE_OK); | ||
434 | } | ||
435 | |||
436 | if (return_object->string.length == 0) { | ||
437 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
438 | "Invalid zero-length _HID or _CID string")); | ||
439 | |||
440 | /* Return AE_OK anyway, let driver handle it */ | ||
441 | |||
442 | data->flags |= ACPI_OBJECT_REPAIRED; | ||
443 | return (AE_OK); | ||
444 | } | ||
445 | |||
446 | /* It is simplest to always create a new string object */ | ||
447 | |||
448 | new_string = acpi_ut_create_string_object(return_object->string.length); | ||
449 | if (!new_string) { | ||
450 | return (AE_NO_MEMORY); | ||
451 | } | ||
452 | |||
453 | /* | ||
454 | * Remove a leading asterisk if present. For some unknown reason, there | ||
455 | * are many machines in the field that contains IDs like this. | ||
456 | * | ||
457 | * Examples: "*PNP0C03", "*ACPI0003" | ||
458 | */ | ||
459 | source = return_object->string.pointer; | ||
460 | if (*source == '*') { | ||
461 | source++; | ||
462 | new_string->string.length--; | ||
463 | |||
464 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
465 | "%s: Removed invalid leading asterisk\n", | ||
466 | data->pathname)); | ||
467 | } | ||
468 | |||
469 | /* | ||
470 | * Copy and uppercase the string. From the ACPI specification: | ||
471 | * | ||
472 | * A valid PNP ID must be of the form "AAA####" where A is an uppercase | ||
473 | * letter and # is a hex digit. A valid ACPI ID must be of the form | ||
474 | * "ACPI####" where # is a hex digit. | ||
475 | */ | ||
476 | for (dest = new_string->string.pointer; *source; dest++, source++) { | ||
477 | *dest = (char)ACPI_TOUPPER(*source); | ||
478 | } | ||
479 | |||
480 | acpi_ut_remove_reference(return_object); | ||
481 | *return_object_ptr = new_string; | ||
482 | return (AE_OK); | ||
483 | } | ||
484 | |||
485 | /****************************************************************************** | ||
486 | * | ||
324 | * FUNCTION: acpi_ns_repair_TSS | 487 | * FUNCTION: acpi_ns_repair_TSS |
325 | * | 488 | * |
326 | * PARAMETERS: Data - Pointer to validation data structure | 489 | * PARAMETERS: Data - Pointer to validation data structure |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index e1add3491b04..a7d6ad9c111b 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -60,104 +60,6 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); | |||
60 | 60 | ||
61 | /******************************************************************************* | 61 | /******************************************************************************* |
62 | * | 62 | * |
63 | * FUNCTION: acpi_ns_report_error | ||
64 | * | ||
65 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
66 | * line_number - Caller's line number (for error output) | ||
67 | * internal_name - Name or path of the namespace node | ||
68 | * lookup_status - Exception code from NS lookup | ||
69 | * | ||
70 | * RETURN: None | ||
71 | * | ||
72 | * DESCRIPTION: Print warning message with full pathname | ||
73 | * | ||
74 | ******************************************************************************/ | ||
75 | |||
76 | void | ||
77 | acpi_ns_report_error(const char *module_name, | ||
78 | u32 line_number, | ||
79 | const char *internal_name, acpi_status lookup_status) | ||
80 | { | ||
81 | acpi_status status; | ||
82 | u32 bad_name; | ||
83 | char *name = NULL; | ||
84 | |||
85 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
86 | |||
87 | if (lookup_status == AE_BAD_CHARACTER) { | ||
88 | |||
89 | /* There is a non-ascii character in the name */ | ||
90 | |||
91 | ACPI_MOVE_32_TO_32(&bad_name, | ||
92 | ACPI_CAST_PTR(u32, internal_name)); | ||
93 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); | ||
94 | } else { | ||
95 | /* Convert path to external format */ | ||
96 | |||
97 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
98 | internal_name, NULL, &name); | ||
99 | |||
100 | /* Print target name */ | ||
101 | |||
102 | if (ACPI_SUCCESS(status)) { | ||
103 | acpi_os_printf("[%s]", name); | ||
104 | } else { | ||
105 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
106 | } | ||
107 | |||
108 | if (name) { | ||
109 | ACPI_FREE(name); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | acpi_os_printf(" Namespace lookup failure, %s\n", | ||
114 | acpi_format_exception(lookup_status)); | ||
115 | } | ||
116 | |||
117 | /******************************************************************************* | ||
118 | * | ||
119 | * FUNCTION: acpi_ns_report_method_error | ||
120 | * | ||
121 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
122 | * line_number - Caller's line number (for error output) | ||
123 | * Message - Error message to use on failure | ||
124 | * prefix_node - Prefix relative to the path | ||
125 | * Path - Path to the node (optional) | ||
126 | * method_status - Execution status | ||
127 | * | ||
128 | * RETURN: None | ||
129 | * | ||
130 | * DESCRIPTION: Print warning message with full pathname | ||
131 | * | ||
132 | ******************************************************************************/ | ||
133 | |||
134 | void | ||
135 | acpi_ns_report_method_error(const char *module_name, | ||
136 | u32 line_number, | ||
137 | const char *message, | ||
138 | struct acpi_namespace_node *prefix_node, | ||
139 | const char *path, acpi_status method_status) | ||
140 | { | ||
141 | acpi_status status; | ||
142 | struct acpi_namespace_node *node = prefix_node; | ||
143 | |||
144 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
145 | |||
146 | if (path) { | ||
147 | status = | ||
148 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
149 | &node); | ||
150 | if (ACPI_FAILURE(status)) { | ||
151 | acpi_os_printf("[Could not get node by pathname]"); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | acpi_ns_print_node_pathname(node, message); | ||
156 | acpi_os_printf(", %s\n", acpi_format_exception(method_status)); | ||
157 | } | ||
158 | |||
159 | /******************************************************************************* | ||
160 | * | ||
161 | * FUNCTION: acpi_ns_print_node_pathname | 63 | * FUNCTION: acpi_ns_print_node_pathname |
162 | * | 64 | * |
163 | * PARAMETERS: Node - Object | 65 | * PARAMETERS: Node - Object |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 1728cb9bf600..d2ff4325c427 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -49,7 +49,7 @@ | |||
49 | ACPI_MODULE_NAME("tbfadt") | 49 | ACPI_MODULE_NAME("tbfadt") |
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static inline void | 52 | static ACPI_INLINE void |
53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
54 | u8 space_id, u8 byte_width, u64 address); | 54 | u8 space_id, u8 byte_width, u64 address); |
55 | 55 | ||
@@ -181,7 +181,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { | |||
181 | * | 181 | * |
182 | ******************************************************************************/ | 182 | ******************************************************************************/ |
183 | 183 | ||
184 | static inline void | 184 | static ACPI_INLINE void |
185 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 185 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
186 | u8 space_id, u8 byte_width, u64 address) | 186 | u8 space_id, u8 byte_width, u64 address) |
187 | { | 187 | { |
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 983510640059..f21c486929a5 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -179,9 +179,8 @@ acpi_debug_print(u32 requested_debug_level, | |||
179 | if (thread_id != acpi_gbl_prev_thread_id) { | 179 | if (thread_id != acpi_gbl_prev_thread_id) { |
180 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 180 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
181 | acpi_os_printf | 181 | acpi_os_printf |
182 | ("\n**** Context Switch from TID %p to TID %p ****\n\n", | 182 | ("\n**** Context Switch from TID %u to TID %u ****\n\n", |
183 | ACPI_CAST_PTR(void, acpi_gbl_prev_thread_id), | 183 | (u32)acpi_gbl_prev_thread_id, (u32)thread_id); |
184 | ACPI_CAST_PTR(void, thread_id)); | ||
185 | } | 184 | } |
186 | 185 | ||
187 | acpi_gbl_prev_thread_id = thread_id; | 186 | acpi_gbl_prev_thread_id = thread_id; |
@@ -194,7 +193,7 @@ acpi_debug_print(u32 requested_debug_level, | |||
194 | acpi_os_printf("%8s-%04ld ", module_name, line_number); | 193 | acpi_os_printf("%8s-%04ld ", module_name, line_number); |
195 | 194 | ||
196 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 195 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
197 | acpi_os_printf("[%p] ", ACPI_CAST_PTR(void, thread_id)); | 196 | acpi_os_printf("[%u] ", (u32)thread_id); |
198 | } | 197 | } |
199 | 198 | ||
200 | acpi_os_printf("[%02ld] %-22.22s: ", | 199 | acpi_os_printf("[%02ld] %-22.22s: ", |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 6dfdeb653490..22f59ef604e0 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -48,153 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME("uteval") | 49 | ACPI_MODULE_NAME("uteval") |
50 | 50 | ||
51 | /* | ||
52 | * Strings supported by the _OSI predefined (internal) method. | ||
53 | * | ||
54 | * March 2009: Removed "Linux" as this host no longer wants to respond true | ||
55 | * for this string. Basically, the only safe OS strings are windows-related | ||
56 | * and in many or most cases represent the only test path within the | ||
57 | * BIOS-provided ASL code. | ||
58 | * | ||
59 | * The second element of each entry is used to track the newest version of | ||
60 | * Windows that the BIOS has requested. | ||
61 | */ | ||
62 | static struct acpi_interface_info acpi_interfaces_supported[] = { | ||
63 | /* Operating System Vendor Strings */ | ||
64 | |||
65 | {"Windows 2000", ACPI_OSI_WIN_2000}, /* Windows 2000 */ | ||
66 | {"Windows 2001", ACPI_OSI_WIN_XP}, /* Windows XP */ | ||
67 | {"Windows 2001 SP1", ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ | ||
68 | {"Windows 2001.1", ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ | ||
69 | {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ | ||
70 | {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ | ||
71 | {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ | ||
72 | {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ | ||
73 | {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ | ||
74 | {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ | ||
75 | |||
76 | /* Feature Group Strings */ | ||
77 | |||
78 | {"Extended Address Space Descriptor", 0} | ||
79 | |||
80 | /* | ||
81 | * All "optional" feature group strings (features that are implemented | ||
82 | * by the host) should be implemented in the host version of | ||
83 | * acpi_os_validate_interface and should not be added here. | ||
84 | */ | ||
85 | }; | ||
86 | |||
87 | /******************************************************************************* | ||
88 | * | ||
89 | * FUNCTION: acpi_ut_osi_implementation | ||
90 | * | ||
91 | * PARAMETERS: walk_state - Current walk state | ||
92 | * | ||
93 | * RETURN: Status | ||
94 | * | ||
95 | * DESCRIPTION: Implementation of the _OSI predefined control method | ||
96 | * | ||
97 | ******************************************************************************/ | ||
98 | |||
99 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | ||
100 | { | ||
101 | acpi_status status; | ||
102 | union acpi_operand_object *string_desc; | ||
103 | union acpi_operand_object *return_desc; | ||
104 | u32 return_value; | ||
105 | u32 i; | ||
106 | |||
107 | ACPI_FUNCTION_TRACE(ut_osi_implementation); | ||
108 | |||
109 | /* Validate the string input argument */ | ||
110 | |||
111 | string_desc = walk_state->arguments[0].object; | ||
112 | if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { | ||
113 | return_ACPI_STATUS(AE_TYPE); | ||
114 | } | ||
115 | |||
116 | /* Create a return object */ | ||
117 | |||
118 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
119 | if (!return_desc) { | ||
120 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
121 | } | ||
122 | |||
123 | /* Default return value is 0, NOT SUPPORTED */ | ||
124 | |||
125 | return_value = 0; | ||
126 | |||
127 | /* Compare input string to static table of supported interfaces */ | ||
128 | |||
129 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { | ||
130 | if (!ACPI_STRCMP(string_desc->string.pointer, | ||
131 | acpi_interfaces_supported[i].name)) { | ||
132 | /* | ||
133 | * The interface is supported. | ||
134 | * Update the osi_data if necessary. We keep track of the latest | ||
135 | * version of Windows that has been requested by the BIOS. | ||
136 | */ | ||
137 | if (acpi_interfaces_supported[i].value > | ||
138 | acpi_gbl_osi_data) { | ||
139 | acpi_gbl_osi_data = | ||
140 | acpi_interfaces_supported[i].value; | ||
141 | } | ||
142 | |||
143 | return_value = ACPI_UINT32_MAX; | ||
144 | goto exit; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | * Did not match the string in the static table, call the host OSL to | ||
150 | * check for a match with one of the optional strings (such as | ||
151 | * "Module Device", "3.0 Thermal Model", etc.) | ||
152 | */ | ||
153 | status = acpi_os_validate_interface(string_desc->string.pointer); | ||
154 | if (ACPI_SUCCESS(status)) { | ||
155 | |||
156 | /* The interface is supported */ | ||
157 | |||
158 | return_value = ACPI_UINT32_MAX; | ||
159 | } | ||
160 | |||
161 | exit: | ||
162 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, | ||
163 | "ACPI: BIOS _OSI(%s) is %ssupported\n", | ||
164 | string_desc->string.pointer, return_value == 0 ? "not " : "")); | ||
165 | |||
166 | /* Complete the return value */ | ||
167 | |||
168 | return_desc->integer.value = return_value; | ||
169 | walk_state->return_desc = return_desc; | ||
170 | return_ACPI_STATUS (AE_OK); | ||
171 | } | ||
172 | |||
173 | /******************************************************************************* | ||
174 | * | ||
175 | * FUNCTION: acpi_osi_invalidate | ||
176 | * | ||
177 | * PARAMETERS: interface_string | ||
178 | * | ||
179 | * RETURN: Status | ||
180 | * | ||
181 | * DESCRIPTION: invalidate string in pre-defiend _OSI string list | ||
182 | * | ||
183 | ******************************************************************************/ | ||
184 | |||
185 | acpi_status acpi_osi_invalidate(char *interface) | ||
186 | { | ||
187 | int i; | ||
188 | |||
189 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { | ||
190 | if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i].name)) { | ||
191 | *acpi_interfaces_supported[i].name = '\0'; | ||
192 | return AE_OK; | ||
193 | } | ||
194 | } | ||
195 | return AE_NOT_FOUND; | ||
196 | } | ||
197 | |||
198 | /******************************************************************************* | 51 | /******************************************************************************* |
199 | * | 52 | * |
200 | * FUNCTION: acpi_ut_evaluate_object | 53 | * FUNCTION: acpi_ut_evaluate_object |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 0558747579ef..4a5dcaa268de 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -154,14 +154,16 @@ ACPI_EXPORT_SYMBOL(acpi_format_exception) | |||
154 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run | 154 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run |
155 | * during the initialization sequence. | 155 | * during the initialization sequence. |
156 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to | 156 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to |
157 | * perform a Notify() operation on it. | 157 | * perform a Notify() operation on it. 09/2010: Changed to type Device. |
158 | * This still allows notifies, but does not confuse host code that | ||
159 | * searches for valid thermal_zone objects. | ||
158 | */ | 160 | */ |
159 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { | 161 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { |
160 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 162 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
161 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 163 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
162 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, | 164 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, |
163 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 165 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
164 | {"_TZ_", ACPI_TYPE_THERMAL, NULL}, | 166 | {"_TZ_", ACPI_TYPE_DEVICE, NULL}, |
165 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, | 167 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, |
166 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, | 168 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, |
167 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, | 169 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, |
@@ -774,6 +776,7 @@ acpi_status acpi_ut_init_globals(void) | |||
774 | acpi_gbl_exception_handler = NULL; | 776 | acpi_gbl_exception_handler = NULL; |
775 | acpi_gbl_init_handler = NULL; | 777 | acpi_gbl_init_handler = NULL; |
776 | acpi_gbl_table_handler = NULL; | 778 | acpi_gbl_table_handler = NULL; |
779 | acpi_gbl_interface_handler = NULL; | ||
777 | 780 | ||
778 | /* Global Lock support */ | 781 | /* Global Lock support */ |
779 | 782 | ||
@@ -800,6 +803,7 @@ acpi_status acpi_ut_init_globals(void) | |||
800 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; | 803 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; |
801 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; | 804 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; |
802 | acpi_gbl_osi_data = 0; | 805 | acpi_gbl_osi_data = 0; |
806 | acpi_gbl_osi_mutex = NULL; | ||
803 | 807 | ||
804 | /* Hardware oriented */ | 808 | /* Hardware oriented */ |
805 | 809 | ||
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index 1397fadd0d4b..d2906328535d 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c | |||
@@ -48,42 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME("utids") | 49 | ACPI_MODULE_NAME("utids") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | static void acpi_ut_copy_id_string(char *destination, char *source); | ||
53 | |||
54 | /******************************************************************************* | ||
55 | * | ||
56 | * FUNCTION: acpi_ut_copy_id_string | ||
57 | * | ||
58 | * PARAMETERS: Destination - Where to copy the string | ||
59 | * Source - Source string | ||
60 | * | ||
61 | * RETURN: None | ||
62 | * | ||
63 | * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. | ||
64 | * Performs removal of a leading asterisk if present -- workaround | ||
65 | * for a known issue on a bunch of machines. | ||
66 | * | ||
67 | ******************************************************************************/ | ||
68 | |||
69 | static void acpi_ut_copy_id_string(char *destination, char *source) | ||
70 | { | ||
71 | |||
72 | /* | ||
73 | * Workaround for ID strings that have a leading asterisk. This construct | ||
74 | * is not allowed by the ACPI specification (ID strings must be | ||
75 | * alphanumeric), but enough existing machines have this embedded in their | ||
76 | * ID strings that the following code is useful. | ||
77 | */ | ||
78 | if (*source == '*') { | ||
79 | source++; | ||
80 | } | ||
81 | |||
82 | /* Do the actual copy */ | ||
83 | |||
84 | ACPI_STRCPY(destination, source); | ||
85 | } | ||
86 | |||
87 | /******************************************************************************* | 51 | /******************************************************************************* |
88 | * | 52 | * |
89 | * FUNCTION: acpi_ut_execute_HID | 53 | * FUNCTION: acpi_ut_execute_HID |
@@ -101,7 +65,6 @@ static void acpi_ut_copy_id_string(char *destination, char *source) | |||
101 | * NOTE: Internal function, no parameter validation | 65 | * NOTE: Internal function, no parameter validation |
102 | * | 66 | * |
103 | ******************************************************************************/ | 67 | ******************************************************************************/ |
104 | |||
105 | acpi_status | 68 | acpi_status |
106 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | 69 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, |
107 | struct acpica_device_id **return_id) | 70 | struct acpica_device_id **return_id) |
@@ -147,7 +110,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
147 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | 110 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { |
148 | acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); | 111 | acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); |
149 | } else { | 112 | } else { |
150 | acpi_ut_copy_id_string(hid->string, obj_desc->string.pointer); | 113 | ACPI_STRCPY(hid->string, obj_desc->string.pointer); |
151 | } | 114 | } |
152 | 115 | ||
153 | hid->length = length; | 116 | hid->length = length; |
@@ -224,7 +187,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
224 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | 187 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { |
225 | acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); | 188 | acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); |
226 | } else { | 189 | } else { |
227 | acpi_ut_copy_id_string(uid->string, obj_desc->string.pointer); | 190 | ACPI_STRCPY(uid->string, obj_desc->string.pointer); |
228 | } | 191 | } |
229 | 192 | ||
230 | uid->length = length; | 193 | uid->length = length; |
@@ -357,8 +320,8 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node, | |||
357 | 320 | ||
358 | /* Copy the String CID from the returned object */ | 321 | /* Copy the String CID from the returned object */ |
359 | 322 | ||
360 | acpi_ut_copy_id_string(next_id_string, | 323 | ACPI_STRCPY(next_id_string, |
361 | cid_objects[i]->string.pointer); | 324 | cid_objects[i]->string.pointer); |
362 | length = cid_objects[i]->string.length + 1; | 325 | length = cid_objects[i]->string.length + 1; |
363 | } | 326 | } |
364 | 327 | ||
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index a39c93dac719..c1b1c803ea9b 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
@@ -117,6 +117,10 @@ void acpi_ut_subsystem_shutdown(void) | |||
117 | /* Close the acpi_event Handling */ | 117 | /* Close the acpi_event Handling */ |
118 | 118 | ||
119 | acpi_ev_terminate(); | 119 | acpi_ev_terminate(); |
120 | |||
121 | /* Delete any dynamic _OSI interfaces */ | ||
122 | |||
123 | acpi_ut_interface_terminate(); | ||
120 | #endif | 124 | #endif |
121 | 125 | ||
122 | /* Close the Namespace */ | 126 | /* Close the Namespace */ |
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index 35059a14eb72..49cf7b7fd816 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
@@ -48,11 +48,27 @@ | |||
48 | ACPI_MODULE_NAME("utmath") | 48 | ACPI_MODULE_NAME("utmath") |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * Support for double-precision integer divide. This code is included here | 51 | * Optional support for 64-bit double-precision integer divide. This code |
52 | * in order to support kernel environments where the double-precision math | 52 | * is configurable and is implemented in order to support 32-bit kernel |
53 | * library is not available. | 53 | * environments where a 64-bit double-precision math library is not available. |
54 | * | ||
55 | * Support for a more normal 64-bit divide/modulo (with check for a divide- | ||
56 | * by-zero) appears after this optional section of code. | ||
54 | */ | 57 | */ |
55 | #ifndef ACPI_USE_NATIVE_DIVIDE | 58 | #ifndef ACPI_USE_NATIVE_DIVIDE |
59 | /* Structures used only for 64-bit divide */ | ||
60 | typedef struct uint64_struct { | ||
61 | u32 lo; | ||
62 | u32 hi; | ||
63 | |||
64 | } uint64_struct; | ||
65 | |||
66 | typedef union uint64_overlay { | ||
67 | u64 full; | ||
68 | struct uint64_struct part; | ||
69 | |||
70 | } uint64_overlay; | ||
71 | |||
56 | /******************************************************************************* | 72 | /******************************************************************************* |
57 | * | 73 | * |
58 | * FUNCTION: acpi_ut_short_divide | 74 | * FUNCTION: acpi_ut_short_divide |
@@ -69,6 +85,7 @@ ACPI_MODULE_NAME("utmath") | |||
69 | * 32-bit remainder. | 85 | * 32-bit remainder. |
70 | * | 86 | * |
71 | ******************************************************************************/ | 87 | ******************************************************************************/ |
88 | |||
72 | acpi_status | 89 | acpi_status |
73 | acpi_ut_short_divide(u64 dividend, | 90 | acpi_ut_short_divide(u64 dividend, |
74 | u32 divisor, u64 *out_quotient, u32 *out_remainder) | 91 | u32 divisor, u64 *out_quotient, u32 *out_remainder) |
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index e8d0724ee403..c7d0e05ef5a4 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -50,11 +50,6 @@ | |||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME("utmisc") | 51 | ACPI_MODULE_NAME("utmisc") |
52 | 52 | ||
53 | /* | ||
54 | * Common suffix for messages | ||
55 | */ | ||
56 | #define ACPI_COMMON_MSG_SUFFIX \ | ||
57 | acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
58 | /******************************************************************************* | 53 | /******************************************************************************* |
59 | * | 54 | * |
60 | * FUNCTION: acpi_ut_validate_exception | 55 | * FUNCTION: acpi_ut_validate_exception |
@@ -1044,160 +1039,3 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
1044 | 1039 | ||
1045 | return_ACPI_STATUS(AE_AML_INTERNAL); | 1040 | return_ACPI_STATUS(AE_AML_INTERNAL); |
1046 | } | 1041 | } |
1047 | |||
1048 | /******************************************************************************* | ||
1049 | * | ||
1050 | * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info | ||
1051 | * | ||
1052 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1053 | * line_number - Caller's line number (for error output) | ||
1054 | * Format - Printf format string + additional args | ||
1055 | * | ||
1056 | * RETURN: None | ||
1057 | * | ||
1058 | * DESCRIPTION: Print message with module/line/version info | ||
1059 | * | ||
1060 | ******************************************************************************/ | ||
1061 | |||
1062 | void ACPI_INTERNAL_VAR_XFACE | ||
1063 | acpi_error(const char *module_name, u32 line_number, const char *format, ...) | ||
1064 | { | ||
1065 | va_list args; | ||
1066 | |||
1067 | acpi_os_printf("ACPI Error: "); | ||
1068 | |||
1069 | va_start(args, format); | ||
1070 | acpi_os_vprintf(format, args); | ||
1071 | ACPI_COMMON_MSG_SUFFIX; | ||
1072 | va_end(args); | ||
1073 | } | ||
1074 | |||
1075 | void ACPI_INTERNAL_VAR_XFACE | ||
1076 | acpi_exception(const char *module_name, | ||
1077 | u32 line_number, acpi_status status, const char *format, ...) | ||
1078 | { | ||
1079 | va_list args; | ||
1080 | |||
1081 | acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status)); | ||
1082 | |||
1083 | va_start(args, format); | ||
1084 | acpi_os_vprintf(format, args); | ||
1085 | ACPI_COMMON_MSG_SUFFIX; | ||
1086 | va_end(args); | ||
1087 | } | ||
1088 | |||
1089 | void ACPI_INTERNAL_VAR_XFACE | ||
1090 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...) | ||
1091 | { | ||
1092 | va_list args; | ||
1093 | |||
1094 | acpi_os_printf("ACPI Warning: "); | ||
1095 | |||
1096 | va_start(args, format); | ||
1097 | acpi_os_vprintf(format, args); | ||
1098 | ACPI_COMMON_MSG_SUFFIX; | ||
1099 | va_end(args); | ||
1100 | } | ||
1101 | |||
1102 | void ACPI_INTERNAL_VAR_XFACE | ||
1103 | acpi_info(const char *module_name, u32 line_number, const char *format, ...) | ||
1104 | { | ||
1105 | va_list args; | ||
1106 | |||
1107 | acpi_os_printf("ACPI: "); | ||
1108 | |||
1109 | va_start(args, format); | ||
1110 | acpi_os_vprintf(format, args); | ||
1111 | acpi_os_printf("\n"); | ||
1112 | va_end(args); | ||
1113 | } | ||
1114 | |||
1115 | ACPI_EXPORT_SYMBOL(acpi_error) | ||
1116 | ACPI_EXPORT_SYMBOL(acpi_exception) | ||
1117 | ACPI_EXPORT_SYMBOL(acpi_warning) | ||
1118 | ACPI_EXPORT_SYMBOL(acpi_info) | ||
1119 | |||
1120 | /******************************************************************************* | ||
1121 | * | ||
1122 | * FUNCTION: acpi_ut_predefined_warning | ||
1123 | * | ||
1124 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1125 | * line_number - Caller's line number (for error output) | ||
1126 | * Pathname - Full pathname to the node | ||
1127 | * node_flags - From Namespace node for the method/object | ||
1128 | * Format - Printf format string + additional args | ||
1129 | * | ||
1130 | * RETURN: None | ||
1131 | * | ||
1132 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
1133 | * only emitted the first time a problem with a particular | ||
1134 | * method/object is detected. This prevents a flood of error | ||
1135 | * messages for methods that are repeatedly evaluated. | ||
1136 | * | ||
1137 | ******************************************************************************/ | ||
1138 | |||
1139 | void ACPI_INTERNAL_VAR_XFACE | ||
1140 | acpi_ut_predefined_warning(const char *module_name, | ||
1141 | u32 line_number, | ||
1142 | char *pathname, | ||
1143 | u8 node_flags, const char *format, ...) | ||
1144 | { | ||
1145 | va_list args; | ||
1146 | |||
1147 | /* | ||
1148 | * Warning messages for this method/object will be disabled after the | ||
1149 | * first time a validation fails or an object is successfully repaired. | ||
1150 | */ | ||
1151 | if (node_flags & ANOBJ_EVALUATED) { | ||
1152 | return; | ||
1153 | } | ||
1154 | |||
1155 | acpi_os_printf("ACPI Warning for %s: ", pathname); | ||
1156 | |||
1157 | va_start(args, format); | ||
1158 | acpi_os_vprintf(format, args); | ||
1159 | ACPI_COMMON_MSG_SUFFIX; | ||
1160 | va_end(args); | ||
1161 | } | ||
1162 | |||
1163 | /******************************************************************************* | ||
1164 | * | ||
1165 | * FUNCTION: acpi_ut_predefined_info | ||
1166 | * | ||
1167 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1168 | * line_number - Caller's line number (for error output) | ||
1169 | * Pathname - Full pathname to the node | ||
1170 | * node_flags - From Namespace node for the method/object | ||
1171 | * Format - Printf format string + additional args | ||
1172 | * | ||
1173 | * RETURN: None | ||
1174 | * | ||
1175 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
1176 | * are only emitted the first time a problem with a particular | ||
1177 | * method/object is detected. This prevents a flood of | ||
1178 | * messages for methods that are repeatedly evaluated. | ||
1179 | * | ||
1180 | ******************************************************************************/ | ||
1181 | |||
1182 | void ACPI_INTERNAL_VAR_XFACE | ||
1183 | acpi_ut_predefined_info(const char *module_name, | ||
1184 | u32 line_number, | ||
1185 | char *pathname, u8 node_flags, const char *format, ...) | ||
1186 | { | ||
1187 | va_list args; | ||
1188 | |||
1189 | /* | ||
1190 | * Warning messages for this method/object will be disabled after the | ||
1191 | * first time a validation fails or an object is successfully repaired. | ||
1192 | */ | ||
1193 | if (node_flags & ANOBJ_EVALUATED) { | ||
1194 | return; | ||
1195 | } | ||
1196 | |||
1197 | acpi_os_printf("ACPI Info for %s: ", pathname); | ||
1198 | |||
1199 | va_start(args, format); | ||
1200 | acpi_os_vprintf(format, args); | ||
1201 | ACPI_COMMON_MSG_SUFFIX; | ||
1202 | va_end(args); | ||
1203 | } | ||
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index f5cca3a1300c..d9efa495b433 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -86,6 +86,12 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
86 | spin_lock_init(acpi_gbl_gpe_lock); | 86 | spin_lock_init(acpi_gbl_gpe_lock); |
87 | spin_lock_init(acpi_gbl_hardware_lock); | 87 | spin_lock_init(acpi_gbl_hardware_lock); |
88 | 88 | ||
89 | /* Mutex for _OSI support */ | ||
90 | status = acpi_os_create_mutex(&acpi_gbl_osi_mutex); | ||
91 | if (ACPI_FAILURE(status)) { | ||
92 | return_ACPI_STATUS(status); | ||
93 | } | ||
94 | |||
89 | /* Create the reader/writer lock for namespace access */ | 95 | /* Create the reader/writer lock for namespace access */ |
90 | 96 | ||
91 | status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock); | 97 | status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock); |
@@ -117,6 +123,8 @@ void acpi_ut_mutex_terminate(void) | |||
117 | acpi_ut_delete_mutex(i); | 123 | acpi_ut_delete_mutex(i); |
118 | } | 124 | } |
119 | 125 | ||
126 | acpi_os_delete_mutex(acpi_gbl_osi_mutex); | ||
127 | |||
120 | /* Delete the spinlocks */ | 128 | /* Delete the spinlocks */ |
121 | 129 | ||
122 | acpi_os_delete_lock(acpi_gbl_gpe_lock); | 130 | acpi_os_delete_lock(acpi_gbl_gpe_lock); |
@@ -220,18 +228,17 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
220 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 228 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
221 | if (i == mutex_id) { | 229 | if (i == mutex_id) { |
222 | ACPI_ERROR((AE_INFO, | 230 | ACPI_ERROR((AE_INFO, |
223 | "Mutex [%s] already acquired by this thread [%p]", | 231 | "Mutex [%s] already acquired by this thread [%u]", |
224 | acpi_ut_get_mutex_name | 232 | acpi_ut_get_mutex_name |
225 | (mutex_id), | 233 | (mutex_id), |
226 | ACPI_CAST_PTR(void, | 234 | (u32)this_thread_id)); |
227 | this_thread_id))); | ||
228 | 235 | ||
229 | return (AE_ALREADY_ACQUIRED); | 236 | return (AE_ALREADY_ACQUIRED); |
230 | } | 237 | } |
231 | 238 | ||
232 | ACPI_ERROR((AE_INFO, | 239 | ACPI_ERROR((AE_INFO, |
233 | "Invalid acquire order: Thread %p owns [%s], wants [%s]", | 240 | "Invalid acquire order: Thread %u owns [%s], wants [%s]", |
234 | ACPI_CAST_PTR(void, this_thread_id), | 241 | (u32)this_thread_id, |
235 | acpi_ut_get_mutex_name(i), | 242 | acpi_ut_get_mutex_name(i), |
236 | acpi_ut_get_mutex_name(mutex_id))); | 243 | acpi_ut_get_mutex_name(mutex_id))); |
237 | 244 | ||
@@ -242,24 +249,24 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
242 | #endif | 249 | #endif |
243 | 250 | ||
244 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 251 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
245 | "Thread %p attempting to acquire Mutex [%s]\n", | 252 | "Thread %u attempting to acquire Mutex [%s]\n", |
246 | ACPI_CAST_PTR(void, this_thread_id), | 253 | (u32)this_thread_id, |
247 | acpi_ut_get_mutex_name(mutex_id))); | 254 | acpi_ut_get_mutex_name(mutex_id))); |
248 | 255 | ||
249 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 256 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
250 | ACPI_WAIT_FOREVER); | 257 | ACPI_WAIT_FOREVER); |
251 | if (ACPI_SUCCESS(status)) { | 258 | if (ACPI_SUCCESS(status)) { |
252 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 259 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
253 | "Thread %p acquired Mutex [%s]\n", | 260 | "Thread %u acquired Mutex [%s]\n", |
254 | ACPI_CAST_PTR(void, this_thread_id), | 261 | (u32)this_thread_id, |
255 | acpi_ut_get_mutex_name(mutex_id))); | 262 | acpi_ut_get_mutex_name(mutex_id))); |
256 | 263 | ||
257 | acpi_gbl_mutex_info[mutex_id].use_count++; | 264 | acpi_gbl_mutex_info[mutex_id].use_count++; |
258 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; | 265 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; |
259 | } else { | 266 | } else { |
260 | ACPI_EXCEPTION((AE_INFO, status, | 267 | ACPI_EXCEPTION((AE_INFO, status, |
261 | "Thread %p could not acquire Mutex [0x%X]", | 268 | "Thread %u could not acquire Mutex [0x%X]", |
262 | ACPI_CAST_PTR(void, this_thread_id), mutex_id)); | 269 | (u32)this_thread_id, mutex_id)); |
263 | } | 270 | } |
264 | 271 | ||
265 | return (status); | 272 | return (status); |
@@ -279,10 +286,14 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
279 | 286 | ||
280 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | 287 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) |
281 | { | 288 | { |
289 | acpi_thread_id this_thread_id; | ||
290 | |||
282 | ACPI_FUNCTION_NAME(ut_release_mutex); | 291 | ACPI_FUNCTION_NAME(ut_release_mutex); |
283 | 292 | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", | 293 | this_thread_id = acpi_os_get_thread_id(); |
285 | ACPI_CAST_PTR(void, acpi_os_get_thread_id()), | 294 | |
295 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", | ||
296 | (u32)this_thread_id, | ||
286 | acpi_ut_get_mutex_name(mutex_id))); | 297 | acpi_ut_get_mutex_name(mutex_id))); |
287 | 298 | ||
288 | if (mutex_id > ACPI_MAX_MUTEX) { | 299 | if (mutex_id > ACPI_MAX_MUTEX) { |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c new file mode 100644 index 000000000000..18c59a85fdca --- /dev/null +++ b/drivers/acpi/acpica/utosi.c | |||
@@ -0,0 +1,380 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utosi - Support for the _OSI predefined control method | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2010, 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. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | |||
47 | #define _COMPONENT ACPI_UTILITIES | ||
48 | ACPI_MODULE_NAME("utosi") | ||
49 | |||
50 | /* | ||
51 | * Strings supported by the _OSI predefined control method (which is | ||
52 | * implemented internally within this module.) | ||
53 | * | ||
54 | * March 2009: Removed "Linux" as this host no longer wants to respond true | ||
55 | * for this string. Basically, the only safe OS strings are windows-related | ||
56 | * and in many or most cases represent the only test path within the | ||
57 | * BIOS-provided ASL code. | ||
58 | * | ||
59 | * The last element of each entry is used to track the newest version of | ||
60 | * Windows that the BIOS has requested. | ||
61 | */ | ||
62 | static struct acpi_interface_info acpi_default_supported_interfaces[] = { | ||
63 | /* Operating System Vendor Strings */ | ||
64 | |||
65 | {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */ | ||
66 | {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */ | ||
67 | {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ | ||
68 | {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ | ||
69 | {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ | ||
70 | {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ | ||
71 | {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ | ||
72 | {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ | ||
73 | {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ | ||
74 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ | ||
75 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ | ||
76 | |||
77 | /* Feature Group Strings */ | ||
78 | |||
79 | {"Extended Address Space Descriptor", NULL, 0, 0} | ||
80 | |||
81 | /* | ||
82 | * All "optional" feature group strings (features that are implemented | ||
83 | * by the host) should be dynamically added by the host via | ||
84 | * acpi_install_interface and should not be manually added here. | ||
85 | * | ||
86 | * Examples of optional feature group strings: | ||
87 | * | ||
88 | * "Module Device" | ||
89 | * "Processor Device" | ||
90 | * "3.0 Thermal Model" | ||
91 | * "3.0 _SCP Extensions" | ||
92 | * "Processor Aggregator Device" | ||
93 | */ | ||
94 | }; | ||
95 | |||
96 | /******************************************************************************* | ||
97 | * | ||
98 | * FUNCTION: acpi_ut_initialize_interfaces | ||
99 | * | ||
100 | * PARAMETERS: None | ||
101 | * | ||
102 | * RETURN: Status | ||
103 | * | ||
104 | * DESCRIPTION: Initialize the global _OSI supported interfaces list | ||
105 | * | ||
106 | ******************************************************************************/ | ||
107 | |||
108 | acpi_status acpi_ut_initialize_interfaces(void) | ||
109 | { | ||
110 | u32 i; | ||
111 | |||
112 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
113 | acpi_gbl_supported_interfaces = acpi_default_supported_interfaces; | ||
114 | |||
115 | /* Link the static list of supported interfaces */ | ||
116 | |||
117 | for (i = 0; | ||
118 | i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1); | ||
119 | i++) { | ||
120 | acpi_default_supported_interfaces[i].next = | ||
121 | &acpi_default_supported_interfaces[(acpi_size) i + 1]; | ||
122 | } | ||
123 | |||
124 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
125 | return (AE_OK); | ||
126 | } | ||
127 | |||
128 | /******************************************************************************* | ||
129 | * | ||
130 | * FUNCTION: acpi_ut_interface_terminate | ||
131 | * | ||
132 | * PARAMETERS: None | ||
133 | * | ||
134 | * RETURN: None | ||
135 | * | ||
136 | * DESCRIPTION: Delete all interfaces in the global list. Sets | ||
137 | * acpi_gbl_supported_interfaces to NULL. | ||
138 | * | ||
139 | ******************************************************************************/ | ||
140 | |||
141 | void acpi_ut_interface_terminate(void) | ||
142 | { | ||
143 | struct acpi_interface_info *next_interface; | ||
144 | |||
145 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
146 | next_interface = acpi_gbl_supported_interfaces; | ||
147 | |||
148 | while (next_interface) { | ||
149 | acpi_gbl_supported_interfaces = next_interface->next; | ||
150 | |||
151 | /* Only interfaces added at runtime can be freed */ | ||
152 | |||
153 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { | ||
154 | ACPI_FREE(next_interface->name); | ||
155 | ACPI_FREE(next_interface); | ||
156 | } | ||
157 | |||
158 | next_interface = acpi_gbl_supported_interfaces; | ||
159 | } | ||
160 | |||
161 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
162 | } | ||
163 | |||
164 | /******************************************************************************* | ||
165 | * | ||
166 | * FUNCTION: acpi_ut_install_interface | ||
167 | * | ||
168 | * PARAMETERS: interface_name - The interface to install | ||
169 | * | ||
170 | * RETURN: Status | ||
171 | * | ||
172 | * DESCRIPTION: Install the interface into the global interface list. | ||
173 | * Caller MUST hold acpi_gbl_osi_mutex | ||
174 | * | ||
175 | ******************************************************************************/ | ||
176 | |||
177 | acpi_status acpi_ut_install_interface(acpi_string interface_name) | ||
178 | { | ||
179 | struct acpi_interface_info *interface_info; | ||
180 | |||
181 | /* Allocate info block and space for the name string */ | ||
182 | |||
183 | interface_info = | ||
184 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info)); | ||
185 | if (!interface_info) { | ||
186 | return (AE_NO_MEMORY); | ||
187 | } | ||
188 | |||
189 | interface_info->name = | ||
190 | ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1); | ||
191 | if (!interface_info->name) { | ||
192 | ACPI_FREE(interface_info); | ||
193 | return (AE_NO_MEMORY); | ||
194 | } | ||
195 | |||
196 | /* Initialize new info and insert at the head of the global list */ | ||
197 | |||
198 | ACPI_STRCPY(interface_info->name, interface_name); | ||
199 | interface_info->flags = ACPI_OSI_DYNAMIC; | ||
200 | interface_info->next = acpi_gbl_supported_interfaces; | ||
201 | |||
202 | acpi_gbl_supported_interfaces = interface_info; | ||
203 | return (AE_OK); | ||
204 | } | ||
205 | |||
206 | /******************************************************************************* | ||
207 | * | ||
208 | * FUNCTION: acpi_ut_remove_interface | ||
209 | * | ||
210 | * PARAMETERS: interface_name - The interface to remove | ||
211 | * | ||
212 | * RETURN: Status | ||
213 | * | ||
214 | * DESCRIPTION: Remove the interface from the global interface list. | ||
215 | * Caller MUST hold acpi_gbl_osi_mutex | ||
216 | * | ||
217 | ******************************************************************************/ | ||
218 | |||
219 | acpi_status acpi_ut_remove_interface(acpi_string interface_name) | ||
220 | { | ||
221 | struct acpi_interface_info *previous_interface; | ||
222 | struct acpi_interface_info *next_interface; | ||
223 | |||
224 | previous_interface = next_interface = acpi_gbl_supported_interfaces; | ||
225 | while (next_interface) { | ||
226 | if (!ACPI_STRCMP(interface_name, next_interface->name)) { | ||
227 | |||
228 | /* Found: name is in either the static list or was added at runtime */ | ||
229 | |||
230 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { | ||
231 | |||
232 | /* Interface was added dynamically, remove and free it */ | ||
233 | |||
234 | if (previous_interface == next_interface) { | ||
235 | acpi_gbl_supported_interfaces = | ||
236 | next_interface->next; | ||
237 | } else { | ||
238 | previous_interface->next = | ||
239 | next_interface->next; | ||
240 | } | ||
241 | |||
242 | ACPI_FREE(next_interface->name); | ||
243 | ACPI_FREE(next_interface); | ||
244 | } else { | ||
245 | /* | ||
246 | * Interface is in static list. If marked invalid, then it | ||
247 | * does not actually exist. Else, mark it invalid. | ||
248 | */ | ||
249 | if (next_interface->flags & ACPI_OSI_INVALID) { | ||
250 | return (AE_NOT_EXIST); | ||
251 | } | ||
252 | |||
253 | next_interface->flags |= ACPI_OSI_INVALID; | ||
254 | } | ||
255 | |||
256 | return (AE_OK); | ||
257 | } | ||
258 | |||
259 | previous_interface = next_interface; | ||
260 | next_interface = next_interface->next; | ||
261 | } | ||
262 | |||
263 | /* Interface was not found */ | ||
264 | |||
265 | return (AE_NOT_EXIST); | ||
266 | } | ||
267 | |||
268 | /******************************************************************************* | ||
269 | * | ||
270 | * FUNCTION: acpi_ut_get_interface | ||
271 | * | ||
272 | * PARAMETERS: interface_name - The interface to find | ||
273 | * | ||
274 | * RETURN: struct acpi_interface_info if found. NULL if not found. | ||
275 | * | ||
276 | * DESCRIPTION: Search for the specified interface name in the global list. | ||
277 | * Caller MUST hold acpi_gbl_osi_mutex | ||
278 | * | ||
279 | ******************************************************************************/ | ||
280 | |||
281 | struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name) | ||
282 | { | ||
283 | struct acpi_interface_info *next_interface; | ||
284 | |||
285 | next_interface = acpi_gbl_supported_interfaces; | ||
286 | while (next_interface) { | ||
287 | if (!ACPI_STRCMP(interface_name, next_interface->name)) { | ||
288 | return (next_interface); | ||
289 | } | ||
290 | |||
291 | next_interface = next_interface->next; | ||
292 | } | ||
293 | |||
294 | return (NULL); | ||
295 | } | ||
296 | |||
297 | /******************************************************************************* | ||
298 | * | ||
299 | * FUNCTION: acpi_ut_osi_implementation | ||
300 | * | ||
301 | * PARAMETERS: walk_state - Current walk state | ||
302 | * | ||
303 | * RETURN: Status | ||
304 | * | ||
305 | * DESCRIPTION: Implementation of the _OSI predefined control method. When | ||
306 | * an invocation of _OSI is encountered in the system AML, | ||
307 | * control is transferred to this function. | ||
308 | * | ||
309 | ******************************************************************************/ | ||
310 | |||
311 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state) | ||
312 | { | ||
313 | union acpi_operand_object *string_desc; | ||
314 | union acpi_operand_object *return_desc; | ||
315 | struct acpi_interface_info *interface_info; | ||
316 | acpi_interface_handler interface_handler; | ||
317 | u32 return_value; | ||
318 | |||
319 | ACPI_FUNCTION_TRACE(ut_osi_implementation); | ||
320 | |||
321 | /* Validate the string input argument (from the AML caller) */ | ||
322 | |||
323 | string_desc = walk_state->arguments[0].object; | ||
324 | if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { | ||
325 | return_ACPI_STATUS(AE_TYPE); | ||
326 | } | ||
327 | |||
328 | /* Create a return object */ | ||
329 | |||
330 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
331 | if (!return_desc) { | ||
332 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
333 | } | ||
334 | |||
335 | /* Default return value is 0, NOT SUPPORTED */ | ||
336 | |||
337 | return_value = 0; | ||
338 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
339 | |||
340 | /* Lookup the interface in the global _OSI list */ | ||
341 | |||
342 | interface_info = acpi_ut_get_interface(string_desc->string.pointer); | ||
343 | if (interface_info && !(interface_info->flags & ACPI_OSI_INVALID)) { | ||
344 | /* | ||
345 | * The interface is supported. | ||
346 | * Update the osi_data if necessary. We keep track of the latest | ||
347 | * version of Windows that has been requested by the BIOS. | ||
348 | */ | ||
349 | if (interface_info->value > acpi_gbl_osi_data) { | ||
350 | acpi_gbl_osi_data = interface_info->value; | ||
351 | } | ||
352 | |||
353 | return_value = ACPI_UINT32_MAX; | ||
354 | } | ||
355 | |||
356 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
357 | |||
358 | /* | ||
359 | * Invoke an optional _OSI interface handler. The host OS may wish | ||
360 | * to do some interface-specific handling. For example, warn about | ||
361 | * certain interfaces or override the true/false support value. | ||
362 | */ | ||
363 | interface_handler = acpi_gbl_interface_handler; | ||
364 | if (interface_handler) { | ||
365 | return_value = | ||
366 | interface_handler(string_desc->string.pointer, | ||
367 | return_value); | ||
368 | } | ||
369 | |||
370 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, | ||
371 | "ACPI: BIOS _OSI(\"%s\") is %ssupported\n", | ||
372 | string_desc->string.pointer, | ||
373 | return_value == 0 ? "not " : "")); | ||
374 | |||
375 | /* Complete the return object */ | ||
376 | |||
377 | return_desc->integer.value = return_value; | ||
378 | walk_state->return_desc = return_desc; | ||
379 | return_ACPI_STATUS(AE_OK); | ||
380 | } | ||
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 7f8cefcb2b32..c2da90f5fbe9 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -110,6 +110,15 @@ acpi_status __init acpi_initialize_subsystem(void) | |||
110 | return_ACPI_STATUS(status); | 110 | return_ACPI_STATUS(status); |
111 | } | 111 | } |
112 | 112 | ||
113 | /* Initialize the global OSI interfaces list with the static names */ | ||
114 | |||
115 | status = acpi_ut_initialize_interfaces(); | ||
116 | if (ACPI_FAILURE(status)) { | ||
117 | ACPI_EXCEPTION((AE_INFO, status, | ||
118 | "During OSI interfaces initialization")); | ||
119 | return_ACPI_STATUS(status); | ||
120 | } | ||
121 | |||
113 | /* If configured, initialize the AML debugger */ | 122 | /* If configured, initialize the AML debugger */ |
114 | 123 | ||
115 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | 124 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); |
@@ -506,6 +515,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
506 | 515 | ||
507 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) | 516 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) |
508 | #endif /* ACPI_FUTURE_USAGE */ | 517 | #endif /* ACPI_FUTURE_USAGE */ |
518 | |||
509 | /***************************************************************************** | 519 | /***************************************************************************** |
510 | * | 520 | * |
511 | * FUNCTION: acpi_purge_cached_objects | 521 | * FUNCTION: acpi_purge_cached_objects |
@@ -529,4 +539,117 @@ acpi_status acpi_purge_cached_objects(void) | |||
529 | } | 539 | } |
530 | 540 | ||
531 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) | 541 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) |
532 | #endif | 542 | |
543 | /***************************************************************************** | ||
544 | * | ||
545 | * FUNCTION: acpi_install_interface | ||
546 | * | ||
547 | * PARAMETERS: interface_name - The interface to install | ||
548 | * | ||
549 | * RETURN: Status | ||
550 | * | ||
551 | * DESCRIPTION: Install an _OSI interface to the global list | ||
552 | * | ||
553 | ****************************************************************************/ | ||
554 | acpi_status acpi_install_interface(acpi_string interface_name) | ||
555 | { | ||
556 | acpi_status status; | ||
557 | struct acpi_interface_info *interface_info; | ||
558 | |||
559 | /* Parameter validation */ | ||
560 | |||
561 | if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { | ||
562 | return (AE_BAD_PARAMETER); | ||
563 | } | ||
564 | |||
565 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
566 | |||
567 | /* Check if the interface name is already in the global list */ | ||
568 | |||
569 | interface_info = acpi_ut_get_interface(interface_name); | ||
570 | if (interface_info) { | ||
571 | /* | ||
572 | * The interface already exists in the list. This is OK if the | ||
573 | * interface has been marked invalid -- just clear the bit. | ||
574 | */ | ||
575 | if (interface_info->flags & ACPI_OSI_INVALID) { | ||
576 | interface_info->flags &= ~ACPI_OSI_INVALID; | ||
577 | status = AE_OK; | ||
578 | } else { | ||
579 | status = AE_ALREADY_EXISTS; | ||
580 | } | ||
581 | } else { | ||
582 | /* New interface name, install into the global list */ | ||
583 | |||
584 | status = acpi_ut_install_interface(interface_name); | ||
585 | } | ||
586 | |||
587 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
588 | return (status); | ||
589 | } | ||
590 | |||
591 | ACPI_EXPORT_SYMBOL(acpi_install_interface) | ||
592 | |||
593 | /***************************************************************************** | ||
594 | * | ||
595 | * FUNCTION: acpi_remove_interface | ||
596 | * | ||
597 | * PARAMETERS: interface_name - The interface to remove | ||
598 | * | ||
599 | * RETURN: Status | ||
600 | * | ||
601 | * DESCRIPTION: Remove an _OSI interface from the global list | ||
602 | * | ||
603 | ****************************************************************************/ | ||
604 | acpi_status acpi_remove_interface(acpi_string interface_name) | ||
605 | { | ||
606 | acpi_status status; | ||
607 | |||
608 | /* Parameter validation */ | ||
609 | |||
610 | if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { | ||
611 | return (AE_BAD_PARAMETER); | ||
612 | } | ||
613 | |||
614 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
615 | |||
616 | status = acpi_ut_remove_interface(interface_name); | ||
617 | |||
618 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
619 | return (status); | ||
620 | } | ||
621 | |||
622 | ACPI_EXPORT_SYMBOL(acpi_remove_interface) | ||
623 | |||
624 | /***************************************************************************** | ||
625 | * | ||
626 | * FUNCTION: acpi_install_interface_handler | ||
627 | * | ||
628 | * PARAMETERS: Handler - The _OSI interface handler to install | ||
629 | * NULL means "remove existing handler" | ||
630 | * | ||
631 | * RETURN: Status | ||
632 | * | ||
633 | * DESCRIPTION: Install a handler for the predefined _OSI ACPI method. | ||
634 | * invoked during execution of the internal implementation of | ||
635 | * _OSI. A NULL handler simply removes any existing handler. | ||
636 | * | ||
637 | ****************************************************************************/ | ||
638 | acpi_status acpi_install_interface_handler(acpi_interface_handler handler) | ||
639 | { | ||
640 | acpi_status status = AE_OK; | ||
641 | |||
642 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
643 | |||
644 | if (handler && acpi_gbl_interface_handler) { | ||
645 | status = AE_ALREADY_EXISTS; | ||
646 | } else { | ||
647 | acpi_gbl_interface_handler = handler; | ||
648 | } | ||
649 | |||
650 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
651 | return (status); | ||
652 | } | ||
653 | |||
654 | ACPI_EXPORT_SYMBOL(acpi_install_interface_handler) | ||
655 | #endif /* !ACPI_ASL_COMPILER */ | ||
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c new file mode 100644 index 000000000000..6f12e314fbae --- /dev/null +++ b/drivers/acpi/acpica/utxferror.c | |||
@@ -0,0 +1,415 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: utxferror - Various error/warning output functions | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2010, 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. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utxferror") | ||
50 | |||
51 | /* | ||
52 | * This module is used for the in-kernel ACPICA as well as the ACPICA | ||
53 | * tools/applications. | ||
54 | * | ||
55 | * For the i_aSL compiler case, the output is redirected to stderr so that | ||
56 | * any of the various ACPI errors and warnings do not appear in the output | ||
57 | * files, for either the compiler or disassembler portions of the tool. | ||
58 | */ | ||
59 | #ifdef ACPI_ASL_COMPILER | ||
60 | #include <stdio.h> | ||
61 | extern FILE *acpi_gbl_output_file; | ||
62 | |||
63 | #define ACPI_MSG_REDIRECT_BEGIN \ | ||
64 | FILE *output_file = acpi_gbl_output_file; \ | ||
65 | acpi_os_redirect_output (stderr); | ||
66 | |||
67 | #define ACPI_MSG_REDIRECT_END \ | ||
68 | acpi_os_redirect_output (output_file); | ||
69 | |||
70 | #else | ||
71 | /* | ||
72 | * non-i_aSL case - no redirection, nothing to do | ||
73 | */ | ||
74 | #define ACPI_MSG_REDIRECT_BEGIN | ||
75 | #define ACPI_MSG_REDIRECT_END | ||
76 | #endif | ||
77 | /* | ||
78 | * Common message prefixes | ||
79 | */ | ||
80 | #define ACPI_MSG_ERROR "ACPI Error: " | ||
81 | #define ACPI_MSG_EXCEPTION "ACPI Exception: " | ||
82 | #define ACPI_MSG_WARNING "ACPI Warning: " | ||
83 | #define ACPI_MSG_INFO "ACPI: " | ||
84 | /* | ||
85 | * Common message suffix | ||
86 | */ | ||
87 | #define ACPI_MSG_SUFFIX \ | ||
88 | acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
89 | /******************************************************************************* | ||
90 | * | ||
91 | * FUNCTION: acpi_error | ||
92 | * | ||
93 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
94 | * line_number - Caller's line number (for error output) | ||
95 | * Format - Printf format string + additional args | ||
96 | * | ||
97 | * RETURN: None | ||
98 | * | ||
99 | * DESCRIPTION: Print "ACPI Error" message with module/line/version info | ||
100 | * | ||
101 | ******************************************************************************/ | ||
102 | void ACPI_INTERNAL_VAR_XFACE | ||
103 | acpi_error(const char *module_name, u32 line_number, const char *format, ...) | ||
104 | { | ||
105 | va_list arg_list; | ||
106 | |||
107 | ACPI_MSG_REDIRECT_BEGIN; | ||
108 | acpi_os_printf(ACPI_MSG_ERROR); | ||
109 | |||
110 | va_start(arg_list, format); | ||
111 | acpi_os_vprintf(format, arg_list); | ||
112 | ACPI_MSG_SUFFIX; | ||
113 | va_end(arg_list); | ||
114 | |||
115 | ACPI_MSG_REDIRECT_END; | ||
116 | } | ||
117 | |||
118 | ACPI_EXPORT_SYMBOL(acpi_error) | ||
119 | |||
120 | /******************************************************************************* | ||
121 | * | ||
122 | * FUNCTION: acpi_exception | ||
123 | * | ||
124 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
125 | * line_number - Caller's line number (for error output) | ||
126 | * Status - Status to be formatted | ||
127 | * Format - Printf format string + additional args | ||
128 | * | ||
129 | * RETURN: None | ||
130 | * | ||
131 | * DESCRIPTION: Print "ACPI Exception" message with module/line/version info | ||
132 | * and decoded acpi_status. | ||
133 | * | ||
134 | ******************************************************************************/ | ||
135 | void ACPI_INTERNAL_VAR_XFACE | ||
136 | acpi_exception(const char *module_name, | ||
137 | u32 line_number, acpi_status status, const char *format, ...) | ||
138 | { | ||
139 | va_list arg_list; | ||
140 | |||
141 | ACPI_MSG_REDIRECT_BEGIN; | ||
142 | acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", | ||
143 | acpi_format_exception(status)); | ||
144 | |||
145 | va_start(arg_list, format); | ||
146 | acpi_os_vprintf(format, arg_list); | ||
147 | ACPI_MSG_SUFFIX; | ||
148 | va_end(arg_list); | ||
149 | |||
150 | ACPI_MSG_REDIRECT_END; | ||
151 | } | ||
152 | |||
153 | ACPI_EXPORT_SYMBOL(acpi_exception) | ||
154 | |||
155 | /******************************************************************************* | ||
156 | * | ||
157 | * FUNCTION: acpi_warning | ||
158 | * | ||
159 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
160 | * line_number - Caller's line number (for error output) | ||
161 | * Format - Printf format string + additional args | ||
162 | * | ||
163 | * RETURN: None | ||
164 | * | ||
165 | * DESCRIPTION: Print "ACPI Warning" message with module/line/version info | ||
166 | * | ||
167 | ******************************************************************************/ | ||
168 | void ACPI_INTERNAL_VAR_XFACE | ||
169 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...) | ||
170 | { | ||
171 | va_list arg_list; | ||
172 | |||
173 | ACPI_MSG_REDIRECT_BEGIN; | ||
174 | acpi_os_printf(ACPI_MSG_WARNING); | ||
175 | |||
176 | va_start(arg_list, format); | ||
177 | acpi_os_vprintf(format, arg_list); | ||
178 | ACPI_MSG_SUFFIX; | ||
179 | va_end(arg_list); | ||
180 | |||
181 | ACPI_MSG_REDIRECT_END; | ||
182 | } | ||
183 | |||
184 | ACPI_EXPORT_SYMBOL(acpi_warning) | ||
185 | |||
186 | /******************************************************************************* | ||
187 | * | ||
188 | * FUNCTION: acpi_info | ||
189 | * | ||
190 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
191 | * line_number - Caller's line number (for error output) | ||
192 | * Format - Printf format string + additional args | ||
193 | * | ||
194 | * RETURN: None | ||
195 | * | ||
196 | * DESCRIPTION: Print generic "ACPI:" information message. There is no | ||
197 | * module/line/version info in order to keep the message simple. | ||
198 | * | ||
199 | * TBD: module_name and line_number args are not needed, should be removed. | ||
200 | * | ||
201 | ******************************************************************************/ | ||
202 | void ACPI_INTERNAL_VAR_XFACE | ||
203 | acpi_info(const char *module_name, u32 line_number, const char *format, ...) | ||
204 | { | ||
205 | va_list arg_list; | ||
206 | |||
207 | ACPI_MSG_REDIRECT_BEGIN; | ||
208 | acpi_os_printf(ACPI_MSG_INFO); | ||
209 | |||
210 | va_start(arg_list, format); | ||
211 | acpi_os_vprintf(format, arg_list); | ||
212 | acpi_os_printf("\n"); | ||
213 | va_end(arg_list); | ||
214 | |||
215 | ACPI_MSG_REDIRECT_END; | ||
216 | } | ||
217 | |||
218 | ACPI_EXPORT_SYMBOL(acpi_info) | ||
219 | |||
220 | /* | ||
221 | * The remainder of this module contains internal error functions that may | ||
222 | * be configured out. | ||
223 | */ | ||
224 | #if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP) | ||
225 | /******************************************************************************* | ||
226 | * | ||
227 | * FUNCTION: acpi_ut_predefined_warning | ||
228 | * | ||
229 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
230 | * line_number - Caller's line number (for error output) | ||
231 | * Pathname - Full pathname to the node | ||
232 | * node_flags - From Namespace node for the method/object | ||
233 | * Format - Printf format string + additional args | ||
234 | * | ||
235 | * RETURN: None | ||
236 | * | ||
237 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
238 | * only emitted the first time a problem with a particular | ||
239 | * method/object is detected. This prevents a flood of error | ||
240 | * messages for methods that are repeatedly evaluated. | ||
241 | * | ||
242 | ******************************************************************************/ | ||
243 | void ACPI_INTERNAL_VAR_XFACE | ||
244 | acpi_ut_predefined_warning(const char *module_name, | ||
245 | u32 line_number, | ||
246 | char *pathname, | ||
247 | u8 node_flags, const char *format, ...) | ||
248 | { | ||
249 | va_list arg_list; | ||
250 | |||
251 | /* | ||
252 | * Warning messages for this method/object will be disabled after the | ||
253 | * first time a validation fails or an object is successfully repaired. | ||
254 | */ | ||
255 | if (node_flags & ANOBJ_EVALUATED) { | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname); | ||
260 | |||
261 | va_start(arg_list, format); | ||
262 | acpi_os_vprintf(format, arg_list); | ||
263 | ACPI_MSG_SUFFIX; | ||
264 | va_end(arg_list); | ||
265 | } | ||
266 | |||
267 | /******************************************************************************* | ||
268 | * | ||
269 | * FUNCTION: acpi_ut_predefined_info | ||
270 | * | ||
271 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
272 | * line_number - Caller's line number (for error output) | ||
273 | * Pathname - Full pathname to the node | ||
274 | * node_flags - From Namespace node for the method/object | ||
275 | * Format - Printf format string + additional args | ||
276 | * | ||
277 | * RETURN: None | ||
278 | * | ||
279 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
280 | * are only emitted the first time a problem with a particular | ||
281 | * method/object is detected. This prevents a flood of | ||
282 | * messages for methods that are repeatedly evaluated. | ||
283 | * | ||
284 | ******************************************************************************/ | ||
285 | |||
286 | void ACPI_INTERNAL_VAR_XFACE | ||
287 | acpi_ut_predefined_info(const char *module_name, | ||
288 | u32 line_number, | ||
289 | char *pathname, u8 node_flags, const char *format, ...) | ||
290 | { | ||
291 | va_list arg_list; | ||
292 | |||
293 | /* | ||
294 | * Warning messages for this method/object will be disabled after the | ||
295 | * first time a validation fails or an object is successfully repaired. | ||
296 | */ | ||
297 | if (node_flags & ANOBJ_EVALUATED) { | ||
298 | return; | ||
299 | } | ||
300 | |||
301 | acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname); | ||
302 | |||
303 | va_start(arg_list, format); | ||
304 | acpi_os_vprintf(format, arg_list); | ||
305 | ACPI_MSG_SUFFIX; | ||
306 | va_end(arg_list); | ||
307 | } | ||
308 | |||
309 | /******************************************************************************* | ||
310 | * | ||
311 | * FUNCTION: acpi_ut_namespace_error | ||
312 | * | ||
313 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
314 | * line_number - Caller's line number (for error output) | ||
315 | * internal_name - Name or path of the namespace node | ||
316 | * lookup_status - Exception code from NS lookup | ||
317 | * | ||
318 | * RETURN: None | ||
319 | * | ||
320 | * DESCRIPTION: Print error message with the full pathname for the NS node. | ||
321 | * | ||
322 | ******************************************************************************/ | ||
323 | |||
324 | void | ||
325 | acpi_ut_namespace_error(const char *module_name, | ||
326 | u32 line_number, | ||
327 | const char *internal_name, acpi_status lookup_status) | ||
328 | { | ||
329 | acpi_status status; | ||
330 | u32 bad_name; | ||
331 | char *name = NULL; | ||
332 | |||
333 | ACPI_MSG_REDIRECT_BEGIN; | ||
334 | acpi_os_printf(ACPI_MSG_ERROR); | ||
335 | |||
336 | if (lookup_status == AE_BAD_CHARACTER) { | ||
337 | |||
338 | /* There is a non-ascii character in the name */ | ||
339 | |||
340 | ACPI_MOVE_32_TO_32(&bad_name, | ||
341 | ACPI_CAST_PTR(u32, internal_name)); | ||
342 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); | ||
343 | } else { | ||
344 | /* Convert path to external format */ | ||
345 | |||
346 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
347 | internal_name, NULL, &name); | ||
348 | |||
349 | /* Print target name */ | ||
350 | |||
351 | if (ACPI_SUCCESS(status)) { | ||
352 | acpi_os_printf("[%s]", name); | ||
353 | } else { | ||
354 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
355 | } | ||
356 | |||
357 | if (name) { | ||
358 | ACPI_FREE(name); | ||
359 | } | ||
360 | } | ||
361 | |||
362 | acpi_os_printf(" Namespace lookup failure, %s", | ||
363 | acpi_format_exception(lookup_status)); | ||
364 | |||
365 | ACPI_MSG_SUFFIX; | ||
366 | ACPI_MSG_REDIRECT_END; | ||
367 | } | ||
368 | |||
369 | /******************************************************************************* | ||
370 | * | ||
371 | * FUNCTION: acpi_ut_method_error | ||
372 | * | ||
373 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
374 | * line_number - Caller's line number (for error output) | ||
375 | * Message - Error message to use on failure | ||
376 | * prefix_node - Prefix relative to the path | ||
377 | * Path - Path to the node (optional) | ||
378 | * method_status - Execution status | ||
379 | * | ||
380 | * RETURN: None | ||
381 | * | ||
382 | * DESCRIPTION: Print error message with the full pathname for the method. | ||
383 | * | ||
384 | ******************************************************************************/ | ||
385 | |||
386 | void | ||
387 | acpi_ut_method_error(const char *module_name, | ||
388 | u32 line_number, | ||
389 | const char *message, | ||
390 | struct acpi_namespace_node *prefix_node, | ||
391 | const char *path, acpi_status method_status) | ||
392 | { | ||
393 | acpi_status status; | ||
394 | struct acpi_namespace_node *node = prefix_node; | ||
395 | |||
396 | ACPI_MSG_REDIRECT_BEGIN; | ||
397 | acpi_os_printf(ACPI_MSG_ERROR); | ||
398 | |||
399 | if (path) { | ||
400 | status = | ||
401 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
402 | &node); | ||
403 | if (ACPI_FAILURE(status)) { | ||
404 | acpi_os_printf("[Could not get node by pathname]"); | ||
405 | } | ||
406 | } | ||
407 | |||
408 | acpi_ns_print_node_pathname(node, message); | ||
409 | acpi_os_printf(", %s", acpi_format_exception(method_status)); | ||
410 | |||
411 | ACPI_MSG_SUFFIX; | ||
412 | ACPI_MSG_REDIRECT_END; | ||
413 | } | ||
414 | |||
415 | #endif /* ACPI_NO_ERROR_MESSAGES */ | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 65b25a303b86..d3bed219c442 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -96,7 +96,9 @@ static LIST_HEAD(resource_list_head); | |||
96 | static DEFINE_SPINLOCK(acpi_res_lock); | 96 | static DEFINE_SPINLOCK(acpi_res_lock); |
97 | 97 | ||
98 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ | 98 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ |
99 | static char osi_additional_string[OSI_STRING_LENGTH_MAX]; | 99 | static char osi_setup_string[OSI_STRING_LENGTH_MAX]; |
100 | |||
101 | static void __init acpi_osi_setup_late(void); | ||
100 | 102 | ||
101 | /* | 103 | /* |
102 | * The story of _OSI(Linux) | 104 | * The story of _OSI(Linux) |
@@ -138,6 +140,20 @@ static struct osi_linux { | |||
138 | unsigned int known:1; | 140 | unsigned int known:1; |
139 | } osi_linux = { 0, 0, 0, 0}; | 141 | } osi_linux = { 0, 0, 0, 0}; |
140 | 142 | ||
143 | static u32 acpi_osi_handler(acpi_string interface, u32 supported) | ||
144 | { | ||
145 | if (!strcmp("Linux", interface)) { | ||
146 | |||
147 | printk(KERN_NOTICE FW_BUG PREFIX | ||
148 | "BIOS _OSI(Linux) query %s%s\n", | ||
149 | osi_linux.enable ? "honored" : "ignored", | ||
150 | osi_linux.cmdline ? " via cmdline" : | ||
151 | osi_linux.dmi ? " via DMI" : ""); | ||
152 | } | ||
153 | |||
154 | return supported; | ||
155 | } | ||
156 | |||
141 | static void __init acpi_request_region (struct acpi_generic_address *addr, | 157 | static void __init acpi_request_region (struct acpi_generic_address *addr, |
142 | unsigned int length, char *desc) | 158 | unsigned int length, char *desc) |
143 | { | 159 | { |
@@ -198,6 +214,8 @@ acpi_status acpi_os_initialize1(void) | |||
198 | BUG_ON(!kacpid_wq); | 214 | BUG_ON(!kacpid_wq); |
199 | BUG_ON(!kacpi_notify_wq); | 215 | BUG_ON(!kacpi_notify_wq); |
200 | BUG_ON(!kacpi_hotplug_wq); | 216 | BUG_ON(!kacpi_hotplug_wq); |
217 | acpi_install_interface_handler(acpi_osi_handler); | ||
218 | acpi_osi_setup_late(); | ||
201 | return AE_OK; | 219 | return AE_OK; |
202 | } | 220 | } |
203 | 221 | ||
@@ -547,9 +565,10 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | |||
547 | 565 | ||
548 | acpi_status | 566 | acpi_status |
549 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | 567 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
550 | u32 *value, u32 width) | 568 | u64 *value, u32 width) |
551 | { | 569 | { |
552 | int result, size; | 570 | int result, size; |
571 | u32 value32; | ||
553 | 572 | ||
554 | if (!value) | 573 | if (!value) |
555 | return AE_BAD_PARAMETER; | 574 | return AE_BAD_PARAMETER; |
@@ -570,7 +589,8 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
570 | 589 | ||
571 | result = raw_pci_read(pci_id->segment, pci_id->bus, | 590 | result = raw_pci_read(pci_id->segment, pci_id->bus, |
572 | PCI_DEVFN(pci_id->device, pci_id->function), | 591 | PCI_DEVFN(pci_id->device, pci_id->function), |
573 | reg, size, value); | 592 | reg, size, &value32); |
593 | *value = value32; | ||
574 | 594 | ||
575 | return (result ? AE_ERROR : AE_OK); | 595 | return (result ? AE_ERROR : AE_OK); |
576 | } | 596 | } |
@@ -602,74 +622,6 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
602 | return (result ? AE_ERROR : AE_OK); | 622 | return (result ? AE_ERROR : AE_OK); |
603 | } | 623 | } |
604 | 624 | ||
605 | /* TODO: Change code to take advantage of driver model more */ | ||
606 | static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ | ||
607 | acpi_handle chandle, /* current node */ | ||
608 | struct acpi_pci_id **id, | ||
609 | int *is_bridge, u8 * bus_number) | ||
610 | { | ||
611 | acpi_handle handle; | ||
612 | struct acpi_pci_id *pci_id = *id; | ||
613 | acpi_status status; | ||
614 | unsigned long long temp; | ||
615 | acpi_object_type type; | ||
616 | |||
617 | acpi_get_parent(chandle, &handle); | ||
618 | if (handle != rhandle) { | ||
619 | acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, | ||
620 | bus_number); | ||
621 | |||
622 | status = acpi_get_type(handle, &type); | ||
623 | if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE)) | ||
624 | return; | ||
625 | |||
626 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, | ||
627 | &temp); | ||
628 | if (ACPI_SUCCESS(status)) { | ||
629 | u32 val; | ||
630 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); | ||
631 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); | ||
632 | |||
633 | if (*is_bridge) | ||
634 | pci_id->bus = *bus_number; | ||
635 | |||
636 | /* any nicer way to get bus number of bridge ? */ | ||
637 | status = | ||
638 | acpi_os_read_pci_configuration(pci_id, 0x0e, &val, | ||
639 | 8); | ||
640 | if (ACPI_SUCCESS(status) | ||
641 | && ((val & 0x7f) == 1 || (val & 0x7f) == 2)) { | ||
642 | status = | ||
643 | acpi_os_read_pci_configuration(pci_id, 0x18, | ||
644 | &val, 8); | ||
645 | if (!ACPI_SUCCESS(status)) { | ||
646 | /* Certainly broken... FIX ME */ | ||
647 | return; | ||
648 | } | ||
649 | *is_bridge = 1; | ||
650 | pci_id->bus = val; | ||
651 | status = | ||
652 | acpi_os_read_pci_configuration(pci_id, 0x19, | ||
653 | &val, 8); | ||
654 | if (ACPI_SUCCESS(status)) { | ||
655 | *bus_number = val; | ||
656 | } | ||
657 | } else | ||
658 | *is_bridge = 0; | ||
659 | } | ||
660 | } | ||
661 | } | ||
662 | |||
663 | void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ | ||
664 | acpi_handle chandle, /* current node */ | ||
665 | struct acpi_pci_id **id) | ||
666 | { | ||
667 | int is_bridge = 1; | ||
668 | u8 bus_number = (*id)->bus; | ||
669 | |||
670 | acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number); | ||
671 | } | ||
672 | |||
673 | static void acpi_os_execute_deferred(struct work_struct *work) | 625 | static void acpi_os_execute_deferred(struct work_struct *work) |
674 | { | 626 | { |
675 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | 627 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); |
@@ -977,6 +929,12 @@ static void __init set_osi_linux(unsigned int enable) | |||
977 | printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", | 929 | printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", |
978 | enable ? "Add": "Delet"); | 930 | enable ? "Add": "Delet"); |
979 | } | 931 | } |
932 | |||
933 | if (osi_linux.enable) | ||
934 | acpi_osi_setup("Linux"); | ||
935 | else | ||
936 | acpi_osi_setup("!Linux"); | ||
937 | |||
980 | return; | 938 | return; |
981 | } | 939 | } |
982 | 940 | ||
@@ -1011,21 +969,33 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) | |||
1011 | * string starting with '!' disables that string | 969 | * string starting with '!' disables that string |
1012 | * otherwise string is added to list, augmenting built-in strings | 970 | * otherwise string is added to list, augmenting built-in strings |
1013 | */ | 971 | */ |
1014 | int __init acpi_osi_setup(char *str) | 972 | static void __init acpi_osi_setup_late(void) |
1015 | { | 973 | { |
1016 | if (str == NULL || *str == '\0') { | 974 | char *str = osi_setup_string; |
1017 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | 975 | |
1018 | acpi_gbl_create_osi_method = FALSE; | 976 | if (*str == '\0') |
1019 | } else if (!strcmp("!Linux", str)) { | 977 | return; |
978 | |||
979 | if (!strcmp("!Linux", str)) { | ||
1020 | acpi_cmdline_osi_linux(0); /* !enable */ | 980 | acpi_cmdline_osi_linux(0); /* !enable */ |
1021 | } else if (*str == '!') { | 981 | } else if (*str == '!') { |
1022 | if (acpi_osi_invalidate(++str) == AE_OK) | 982 | if (acpi_remove_interface(++str) == AE_OK) |
1023 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); | 983 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); |
1024 | } else if (!strcmp("Linux", str)) { | 984 | } else if (!strcmp("Linux", str)) { |
1025 | acpi_cmdline_osi_linux(1); /* enable */ | 985 | acpi_cmdline_osi_linux(1); /* enable */ |
1026 | } else if (*osi_additional_string == '\0') { | 986 | } else { |
1027 | strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX); | 987 | if (acpi_install_interface(str) == AE_OK) |
1028 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); | 988 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); |
989 | } | ||
990 | } | ||
991 | |||
992 | int __init acpi_osi_setup(char *str) | ||
993 | { | ||
994 | if (str == NULL || *str == '\0') { | ||
995 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | ||
996 | acpi_gbl_create_osi_method = FALSE; | ||
997 | } else { | ||
998 | strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX); | ||
1029 | } | 999 | } |
1030 | 1000 | ||
1031 | return 1; | 1001 | return 1; |
@@ -1282,38 +1252,6 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1282 | return (AE_OK); | 1252 | return (AE_OK); |
1283 | } | 1253 | } |
1284 | 1254 | ||
1285 | /****************************************************************************** | ||
1286 | * | ||
1287 | * FUNCTION: acpi_os_validate_interface | ||
1288 | * | ||
1289 | * PARAMETERS: interface - Requested interface to be validated | ||
1290 | * | ||
1291 | * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise | ||
1292 | * | ||
1293 | * DESCRIPTION: Match an interface string to the interfaces supported by the | ||
1294 | * host. Strings originate from an AML call to the _OSI method. | ||
1295 | * | ||
1296 | *****************************************************************************/ | ||
1297 | |||
1298 | acpi_status | ||
1299 | acpi_os_validate_interface (char *interface) | ||
1300 | { | ||
1301 | if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX)) | ||
1302 | return AE_OK; | ||
1303 | if (!strcmp("Linux", interface)) { | ||
1304 | |||
1305 | printk(KERN_NOTICE PREFIX | ||
1306 | "BIOS _OSI(Linux) query %s%s\n", | ||
1307 | osi_linux.enable ? "honored" : "ignored", | ||
1308 | osi_linux.cmdline ? " via cmdline" : | ||
1309 | osi_linux.dmi ? " via DMI" : ""); | ||
1310 | |||
1311 | if (osi_linux.enable) | ||
1312 | return AE_OK; | ||
1313 | } | ||
1314 | return AE_SUPPORT; | ||
1315 | } | ||
1316 | |||
1317 | static inline int acpi_res_list_add(struct acpi_res_list *res) | 1255 | static inline int acpi_res_list_add(struct acpi_res_list *res) |
1318 | { | 1256 | { |
1319 | struct acpi_res_list *res_list_elem; | 1257 | struct acpi_res_list *res_list_elem; |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 29bf945143e8..43027432a055 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -223,25 +223,15 @@ acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); | |||
223 | */ | 223 | */ |
224 | acpi_status | 224 | acpi_status |
225 | acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, | 225 | acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, |
226 | u32 reg, u32 *value, u32 width); | 226 | u32 reg, u64 *value, u32 width); |
227 | 227 | ||
228 | acpi_status | 228 | acpi_status |
229 | acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, | 229 | acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, |
230 | u32 reg, u64 value, u32 width); | 230 | u32 reg, u64 value, u32 width); |
231 | 231 | ||
232 | /* | 232 | /* |
233 | * Interim function needed for PCI IRQ routing | ||
234 | */ | ||
235 | void | ||
236 | acpi_os_derive_pci_id(acpi_handle device, | ||
237 | acpi_handle region, struct acpi_pci_id **pci_id); | ||
238 | |||
239 | /* | ||
240 | * Miscellaneous | 233 | * Miscellaneous |
241 | */ | 234 | */ |
242 | acpi_status acpi_os_validate_interface(char *interface); | ||
243 | acpi_status acpi_osi_invalidate(char* interface); | ||
244 | |||
245 | acpi_status | 235 | acpi_status |
246 | acpi_os_validate_address(u8 space_id, acpi_physical_address address, | 236 | acpi_os_validate_address(u8 space_id, acpi_physical_address address, |
247 | acpi_size length, char *name); | 237 | acpi_size length, char *name); |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 984cdc62e30b..7db647c96283 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 49 | ||
50 | #define ACPI_CA_VERSION 0x20100702 | 50 | #define ACPI_CA_VERSION 0x20101013 |
51 | 51 | ||
52 | #include "actypes.h" | 52 | #include "actypes.h" |
53 | #include "actbl.h" | 53 | #include "actbl.h" |
@@ -72,6 +72,7 @@ extern u8 acpi_gbl_truncate_io_addresses; | |||
72 | 72 | ||
73 | extern u32 acpi_current_gpe_count; | 73 | extern u32 acpi_current_gpe_count; |
74 | extern struct acpi_table_fadt acpi_gbl_FADT; | 74 | extern struct acpi_table_fadt acpi_gbl_FADT; |
75 | extern u8 acpi_gbl_system_awake_and_running; | ||
75 | 76 | ||
76 | extern u32 acpi_rsdt_forced; | 77 | extern u32 acpi_rsdt_forced; |
77 | /* | 78 | /* |
@@ -105,6 +106,10 @@ const char *acpi_format_exception(acpi_status exception); | |||
105 | 106 | ||
106 | acpi_status acpi_purge_cached_objects(void); | 107 | acpi_status acpi_purge_cached_objects(void); |
107 | 108 | ||
109 | acpi_status acpi_install_interface(acpi_string interface_name); | ||
110 | |||
111 | acpi_status acpi_remove_interface(acpi_string interface_name); | ||
112 | |||
108 | /* | 113 | /* |
109 | * ACPI Memory management | 114 | * ACPI Memory management |
110 | */ | 115 | */ |
@@ -263,6 +268,8 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
263 | acpi_status acpi_install_exception_handler(acpi_exception_handler handler); | 268 | acpi_status acpi_install_exception_handler(acpi_exception_handler handler); |
264 | #endif | 269 | #endif |
265 | 270 | ||
271 | acpi_status acpi_install_interface_handler(acpi_interface_handler handler); | ||
272 | |||
266 | /* | 273 | /* |
267 | * Event interfaces | 274 | * Event interfaces |
268 | */ | 275 | */ |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 5db8f472fec9..2b134b691e34 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -115,7 +115,6 @@ | |||
115 | * | 115 | * |
116 | * ACPI_SIZE 16/32/64-bit unsigned value | 116 | * ACPI_SIZE 16/32/64-bit unsigned value |
117 | * ACPI_NATIVE_INT 16/32/64-bit signed value | 117 | * ACPI_NATIVE_INT 16/32/64-bit signed value |
118 | * | ||
119 | */ | 118 | */ |
120 | 119 | ||
121 | /******************************************************************************* | 120 | /******************************************************************************* |
@@ -132,6 +131,16 @@ typedef COMPILER_DEPENDENT_INT64 INT64; | |||
132 | 131 | ||
133 | /*! [End] no source code translation !*/ | 132 | /*! [End] no source code translation !*/ |
134 | 133 | ||
134 | /* | ||
135 | * Value returned by acpi_os_get_thread_id. There is no standard "thread_id" | ||
136 | * across operating systems or even the various UNIX systems. Since ACPICA | ||
137 | * only needs the thread ID as a unique thread identifier, we use a u64 | ||
138 | * as the only common data type - it will accommodate any type of pointer or | ||
139 | * any type of integer. It is up to the host-dependent OSL to cast the | ||
140 | * native thread ID type to a u64 (in acpi_os_get_thread_id). | ||
141 | */ | ||
142 | #define acpi_thread_id u64 | ||
143 | |||
135 | /******************************************************************************* | 144 | /******************************************************************************* |
136 | * | 145 | * |
137 | * Types specific to 64-bit targets | 146 | * Types specific to 64-bit targets |
@@ -211,12 +220,6 @@ typedef u32 acpi_physical_address; | |||
211 | * | 220 | * |
212 | ******************************************************************************/ | 221 | ******************************************************************************/ |
213 | 222 | ||
214 | /* Value returned by acpi_os_get_thread_id */ | ||
215 | |||
216 | #ifndef acpi_thread_id | ||
217 | #define acpi_thread_id acpi_size | ||
218 | #endif | ||
219 | |||
220 | /* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ | 223 | /* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ |
221 | 224 | ||
222 | #ifndef acpi_cpu_flags | 225 | #ifndef acpi_cpu_flags |
@@ -375,16 +378,6 @@ typedef void *acpi_handle; /* Actually a ptr to a NS Node */ | |||
375 | typedef u8 acpi_owner_id; | 378 | typedef u8 acpi_owner_id; |
376 | #define ACPI_OWNER_ID_MAX 0xFF | 379 | #define ACPI_OWNER_ID_MAX 0xFF |
377 | 380 | ||
378 | struct uint64_struct { | ||
379 | u32 lo; | ||
380 | u32 hi; | ||
381 | }; | ||
382 | |||
383 | union uint64_overlay { | ||
384 | u64 full; | ||
385 | struct uint64_struct part; | ||
386 | }; | ||
387 | |||
388 | #define ACPI_INTEGER_BIT_SIZE 64 | 381 | #define ACPI_INTEGER_BIT_SIZE 64 |
389 | #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ | 382 | #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ |
390 | 383 | ||
@@ -950,6 +943,9 @@ acpi_status(*acpi_walk_callback) (acpi_handle object, | |||
950 | u32 nesting_level, | 943 | u32 nesting_level, |
951 | void *context, void **return_value); | 944 | void *context, void **return_value); |
952 | 945 | ||
946 | typedef | ||
947 | u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported); | ||
948 | |||
953 | /* Interrupt handler return values */ | 949 | /* Interrupt handler return values */ |
954 | 950 | ||
955 | #define ACPI_INTERRUPT_NOT_HANDLED 0x00 | 951 | #define ACPI_INTERRUPT_NOT_HANDLED 0x00 |
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index c05aeba9e8f0..a3e334ab1119 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h | |||
@@ -193,6 +193,12 @@ | |||
193 | #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE | 193 | #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE |
194 | #endif | 194 | #endif |
195 | 195 | ||
196 | /* "inline" keywords - configurable since inline is not standardized */ | ||
197 | |||
198 | #ifndef ACPI_INLINE | ||
199 | #define ACPI_INLINE | ||
200 | #endif | ||
201 | |||
196 | /* | 202 | /* |
197 | * Debugger threading model | 203 | * Debugger threading model |
198 | * Use single threaded if the entire subsystem is contained in an application | 204 | * Use single threaded if the entire subsystem is contained in an application |
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 0cd53e3cd1a3..5dcb9537343c 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #ifndef __ACGCC_H__ | 44 | #ifndef __ACGCC_H__ |
45 | #define __ACGCC_H__ | 45 | #define __ACGCC_H__ |
46 | 46 | ||
47 | #define ACPI_INLINE __inline__ | ||
48 | |||
47 | /* Function name is used for debug output. Non-ANSI, compiler-dependent */ | 49 | /* Function name is used for debug output. Non-ANSI, compiler-dependent */ |
48 | 50 | ||
49 | #define ACPI_GET_FUNCTION_NAME __func__ | 51 | #define ACPI_GET_FUNCTION_NAME __func__ |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 103f08aca764..572189e37133 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -75,7 +75,6 @@ | |||
75 | #define acpi_cache_t struct kmem_cache | 75 | #define acpi_cache_t struct kmem_cache |
76 | #define acpi_spinlock spinlock_t * | 76 | #define acpi_spinlock spinlock_t * |
77 | #define acpi_cpu_flags unsigned long | 77 | #define acpi_cpu_flags unsigned long |
78 | #define acpi_thread_id struct task_struct * | ||
79 | 78 | ||
80 | #else /* !__KERNEL__ */ | 79 | #else /* !__KERNEL__ */ |
81 | 80 | ||
@@ -88,7 +87,7 @@ | |||
88 | /* Host-dependent types and defines for user-space ACPICA */ | 87 | /* Host-dependent types and defines for user-space ACPICA */ |
89 | 88 | ||
90 | #define ACPI_FLUSH_CPU_CACHE() | 89 | #define ACPI_FLUSH_CPU_CACHE() |
91 | #define acpi_thread_id pthread_t | 90 | #define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread)) |
92 | 91 | ||
93 | #if defined(__ia64__) || defined(__x86_64__) | 92 | #if defined(__ia64__) || defined(__x86_64__) |
94 | #define ACPI_MACHINE_WIDTH 64 | 93 | #define ACPI_MACHINE_WIDTH 64 |
@@ -113,12 +112,13 @@ | |||
113 | 112 | ||
114 | 113 | ||
115 | #ifdef __KERNEL__ | 114 | #ifdef __KERNEL__ |
115 | #include <acpi/actypes.h> | ||
116 | /* | 116 | /* |
117 | * Overrides for in-kernel ACPICA | 117 | * Overrides for in-kernel ACPICA |
118 | */ | 118 | */ |
119 | static inline acpi_thread_id acpi_os_get_thread_id(void) | 119 | static inline acpi_thread_id acpi_os_get_thread_id(void) |
120 | { | 120 | { |
121 | return current; | 121 | return (acpi_thread_id)(unsigned long)current; |
122 | } | 122 | } |
123 | 123 | ||
124 | /* | 124 | /* |
@@ -127,7 +127,6 @@ static inline acpi_thread_id acpi_os_get_thread_id(void) | |||
127 | * However, boot has (system_state != SYSTEM_RUNNING) | 127 | * However, boot has (system_state != SYSTEM_RUNNING) |
128 | * to quiet __might_sleep() in kmalloc() and resume does not. | 128 | * to quiet __might_sleep() in kmalloc() and resume does not. |
129 | */ | 129 | */ |
130 | #include <acpi/actypes.h> | ||
131 | static inline void *acpi_os_allocate(acpi_size size) | 130 | static inline void *acpi_os_allocate(acpi_size size) |
132 | { | 131 | { |
133 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); | 132 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); |