1 /******************************************************************************
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2005, R. Byron Moore
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
49 acpi_status (*acpi_pkg_callback) (
51 union acpi_operand_object *source_object,
52 union acpi_generic_state *state,
63 #define REF_INCREMENT (u16) 0
64 #define REF_DECREMENT (u16) 1
65 #define REF_FORCE_DELETE (u16) 2
67 /* acpi_ut_dump_buffer */
69 #define DB_BYTE_DISPLAY 1
70 #define DB_WORD_DISPLAY 2
71 #define DB_DWORD_DISPLAY 4
72 #define DB_QWORD_DISPLAY 8
76 * utglobal - Global data structures and procedures
79 acpi_ut_init_globals (
82 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
85 acpi_ut_get_mutex_name (
91 acpi_ut_get_type_name (
92 acpi_object_type type);
95 acpi_ut_get_node_name (
99 acpi_ut_get_descriptor_name (
103 acpi_ut_get_object_type_name (
104 union acpi_operand_object *obj_desc);
107 acpi_ut_get_region_name (
111 acpi_ut_get_event_name (
115 acpi_ut_hex_to_ascii_char (
116 acpi_integer integer,
120 acpi_ut_valid_object_type (
121 acpi_object_type type);
125 * utinit - miscellaneous initialization and shutdown
128 acpi_ut_hardware_initialize (
132 acpi_ut_subsystem_shutdown (
136 acpi_ut_validate_fadt (
141 * utclib - Local implementations of C library functions
143 #ifndef ACPI_USE_SYSTEM_CLIBRARY
152 const char *src_string);
157 const char *src_string,
175 const char *string2);
180 const char *src_string);
185 const char *src_string,
208 acpi_native_uint value,
219 extern const u8 _acpi_ctype[];
221 #define _ACPI_XA 0x00 /* extra alphabetic - not supported */
222 #define _ACPI_XS 0x40 /* extra space */
223 #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
224 #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
225 #define _ACPI_DI 0x04 /* '0'-'9' */
226 #define _ACPI_LO 0x02 /* 'a'-'z' */
227 #define _ACPI_PU 0x10 /* punctuation */
228 #define _ACPI_SP 0x08 /* space */
229 #define _ACPI_UP 0x01 /* 'A'-'Z' */
230 #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
232 #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
233 #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
234 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
235 #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
236 #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
237 #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
238 #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
239 #define ACPI_IS_ASCII(c) ((c) < 0x80)
241 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
245 * utcopy - Object construction and conversion interfaces
248 acpi_ut_build_simple_object(
249 union acpi_operand_object *obj,
250 union acpi_object *user_obj,
252 u32 *buffer_space_used);
255 acpi_ut_build_package_object (
256 union acpi_operand_object *obj,
261 acpi_ut_copy_iobject_to_eobject (
262 union acpi_operand_object *obj,
263 struct acpi_buffer *ret_buffer);
266 acpi_ut_copy_eobject_to_iobject (
267 union acpi_object *obj,
268 union acpi_operand_object **internal_obj);
271 acpi_ut_copy_isimple_to_isimple (
272 union acpi_operand_object *source_obj,
273 union acpi_operand_object *dest_obj);
276 acpi_ut_copy_iobject_to_iobject (
277 union acpi_operand_object *source_desc,
278 union acpi_operand_object **dest_desc,
279 struct acpi_walk_state *walk_state);
283 * utcreate - Object creation
286 acpi_ut_update_object_reference (
287 union acpi_operand_object *object,
292 * utdebug - Debug interfaces
295 acpi_ut_init_stack_ptr_trace (
299 acpi_ut_track_stack_ptr (
305 const char *function_name,
312 const char *function_name,
320 const char *function_name,
328 const char *function_name,
336 const char *function_name,
341 acpi_ut_status_exit (
343 const char *function_name,
351 const char *function_name,
359 const char *function_name,
365 acpi_ut_report_info (
371 acpi_ut_report_error (
377 acpi_ut_report_warning (
383 acpi_ut_dump_buffer (
389 void ACPI_INTERNAL_VAR_XFACE
390 acpi_ut_debug_print (
391 u32 requested_debug_level,
393 const char *function_name,
397 ...) ACPI_PRINTF_LIKE_FUNC;
399 void ACPI_INTERNAL_VAR_XFACE
400 acpi_ut_debug_print_raw (
401 u32 requested_debug_level,
403 const char *function_name,
407 ...) ACPI_PRINTF_LIKE_FUNC;
411 * utdelete - Object deletion and reference counts
414 acpi_ut_add_reference (
415 union acpi_operand_object *object);
418 acpi_ut_remove_reference (
419 union acpi_operand_object *object);
422 acpi_ut_delete_internal_package_object (
423 union acpi_operand_object *object);
426 acpi_ut_delete_internal_simple_object (
427 union acpi_operand_object *object);
430 acpi_ut_delete_internal_object_list (
431 union acpi_operand_object **obj_list);
435 * uteval - object evaluation
438 acpi_ut_osi_implementation (
439 struct acpi_walk_state *walk_state);
442 acpi_ut_evaluate_object (
443 struct acpi_namespace_node *prefix_node,
445 u32 expected_return_btypes,
446 union acpi_operand_object **return_desc);
449 acpi_ut_evaluate_numeric_object (
451 struct acpi_namespace_node *device_node,
452 acpi_integer *address);
455 acpi_ut_execute_HID (
456 struct acpi_namespace_node *device_node,
457 struct acpi_device_id *hid);
460 acpi_ut_execute_CID (
461 struct acpi_namespace_node *device_node,
462 struct acpi_compatible_id_list **return_cid_list);
465 acpi_ut_execute_STA (
466 struct acpi_namespace_node *device_node,
470 acpi_ut_execute_UID (
471 struct acpi_namespace_node *device_node,
472 struct acpi_device_id *uid);
475 acpi_ut_execute_sxds (
476 struct acpi_namespace_node *device_node,
481 * utobject - internal object create/delete/cache routines
483 union acpi_operand_object *
484 acpi_ut_create_internal_object_dbg (
488 acpi_object_type type);
491 acpi_ut_allocate_object_desc_dbg (
496 #define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
497 #define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
500 acpi_ut_delete_object_desc (
501 union acpi_operand_object *object);
504 acpi_ut_valid_internal_object (
507 union acpi_operand_object *
508 acpi_ut_create_buffer_object (
509 acpi_size buffer_size);
511 union acpi_operand_object *
512 acpi_ut_create_string_object (
513 acpi_size string_size);
516 acpi_ut_get_object_size(
517 union acpi_operand_object *obj,
518 acpi_size *obj_length);
522 * utstate - Generic state creation/cache routines
525 acpi_ut_push_generic_state (
526 union acpi_generic_state **list_head,
527 union acpi_generic_state *state);
529 union acpi_generic_state *
530 acpi_ut_pop_generic_state (
531 union acpi_generic_state **list_head);
534 union acpi_generic_state *
535 acpi_ut_create_generic_state (
538 struct acpi_thread_state *
539 acpi_ut_create_thread_state (
542 union acpi_generic_state *
543 acpi_ut_create_update_state (
544 union acpi_operand_object *object,
547 union acpi_generic_state *
548 acpi_ut_create_pkg_state (
549 void *internal_object,
550 void *external_object,
554 acpi_ut_create_update_state_and_push (
555 union acpi_operand_object *object,
557 union acpi_generic_state **state_list);
559 #ifdef ACPI_FUTURE_USAGE
561 acpi_ut_create_pkg_state_and_push (
562 void *internal_object,
563 void *external_object,
565 union acpi_generic_state **state_list);
566 #endif /* ACPI_FUTURE_USAGE */
568 union acpi_generic_state *
569 acpi_ut_create_control_state (
573 acpi_ut_delete_generic_state (
574 union acpi_generic_state *state);
582 acpi_integer in_dividend,
583 acpi_integer in_divisor,
584 acpi_integer *out_quotient,
585 acpi_integer *out_remainder);
588 acpi_ut_short_divide (
589 acpi_integer in_dividend,
591 acpi_integer *out_quotient,
598 acpi_ut_allocate_owner_id (
599 acpi_owner_id *owner_id);
602 acpi_ut_release_owner_id (
603 acpi_owner_id *owner_id);
606 acpi_ut_walk_package_tree (
607 union acpi_operand_object *source_object,
609 acpi_pkg_callback walk_callback,
617 acpi_ut_print_string (
622 acpi_ut_valid_acpi_name (
626 acpi_ut_valid_acpi_character (
633 acpi_integer *ret_integer);
635 /* Values for Base above (16=Hex, 10=Decimal) */
637 #define ACPI_ANY_BASE 0
640 acpi_ut_get_resource_end_tag (
641 union acpi_operand_object *obj_desc);
644 acpi_ut_generate_checksum (
649 acpi_ut_dword_byte_swap (
653 acpi_ut_set_integer_width (
656 #ifdef ACPI_DEBUG_OUTPUT
658 acpi_ut_display_init_pathname (
660 struct acpi_namespace_node *obj_handle,
667 * utmutex - mutex support
670 acpi_ut_mutex_initialize (
674 acpi_ut_mutex_terminate (
678 acpi_ut_acquire_mutex (
679 acpi_mutex_handle mutex_id);
682 acpi_ut_release_mutex (
683 acpi_mutex_handle mutex_id);
687 * utalloc - memory allocation and object caching
690 acpi_ut_create_caches (
694 acpi_ut_delete_caches (
698 acpi_ut_validate_buffer (
699 struct acpi_buffer *buffer);
702 acpi_ut_initialize_buffer (
703 struct acpi_buffer *buffer,
704 acpi_size required_length);
720 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
722 acpi_ut_allocate_and_track (
729 acpi_ut_callocate_and_track (
736 acpi_ut_free_and_track (
742 #ifdef ACPI_FUTURE_USAGE
744 acpi_ut_dump_allocation_info (
746 #endif /* ACPI_FUTURE_USAGE */
749 acpi_ut_dump_allocations (
754 #endif /* _ACUTILS_H */