1 /******************************************************************************
3 * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures
6 *****************************************************************************/
9 * Copyright (C) 2000, 2001 R. Byron Moore
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
33 ACPI_OPERAND_OBJECT *source_object,
34 ACPI_GENERIC_STATE *state,
39 acpi_cm_walk_package_tree (
40 ACPI_OPERAND_OBJECT *source_object,
42 ACPI_PKG_CALLBACK walk_callback,
46 typedef struct acpi_pkg_info
54 #define REF_INCREMENT (u16) 0
55 #define REF_DECREMENT (u16) 1
56 #define REF_FORCE_DELETE (u16) 2
58 /* Acpi_cm_dump_buffer */
60 #define DB_BYTE_DISPLAY 1
61 #define DB_WORD_DISPLAY 2
62 #define DB_DWORD_DISPLAY 4
63 #define DB_QWORD_DISPLAY 8
66 /* Global initialization interfaces */
69 acpi_cm_init_globals (
78 * Cm_init - miscellaneous initialization and shutdown
82 acpi_cm_hardware_initialize (
86 acpi_cm_subsystem_shutdown (
90 acpi_cm_validate_fadt (
94 * Cm_global - Global data structures and procedures
100 acpi_cm_get_mutex_name (
104 acpi_cm_get_type_name (
108 acpi_cm_get_region_name (
115 acpi_cm_valid_object_type (
119 acpi_cm_allocate_owner_id (
124 * Cm_clib - Local implementations of C library functions
127 #ifndef ACPI_USE_SYSTEM_CLIBRARY
131 const NATIVE_CHAR *string);
135 NATIVE_CHAR *dst_string,
136 const NATIVE_CHAR *src_string);
140 NATIVE_CHAR *dst_string,
141 const NATIVE_CHAR *src_string,
146 const NATIVE_CHAR *string1,
147 const NATIVE_CHAR *string2,
152 const NATIVE_CHAR *string1,
153 const NATIVE_CHAR *string2);
157 NATIVE_CHAR *dst_string,
158 const NATIVE_CHAR *src_string);
162 NATIVE_CHAR *dst_string,
163 const NATIVE_CHAR *src_string,
168 const NATIVE_CHAR *string,
169 NATIVE_CHAR **terminator,
174 NATIVE_CHAR *string1,
175 NATIVE_CHAR *string2);
179 NATIVE_CHAR *src_string);
201 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
204 * Cm_copy - Object construction and conversion interfaces
208 acpi_cm_build_simple_object(
209 ACPI_OPERAND_OBJECT *obj,
210 ACPI_OBJECT *user_obj,
212 u32 *buffer_space_used);
215 acpi_cm_build_package_object (
216 ACPI_OPERAND_OBJECT *obj,
221 acpi_cm_copy_iobject_to_eobject (
222 ACPI_OPERAND_OBJECT *obj,
223 ACPI_BUFFER *ret_buffer);
226 acpi_cm_copy_esimple_to_isimple(
227 ACPI_OBJECT *user_obj,
228 ACPI_OPERAND_OBJECT *obj);
231 acpi_cm_copy_eobject_to_iobject (
233 ACPI_OPERAND_OBJECT *internal_obj);
236 acpi_cm_copy_isimple_to_isimple (
237 ACPI_OPERAND_OBJECT *source_obj,
238 ACPI_OPERAND_OBJECT *dest_obj);
241 acpi_cm_copy_ipackage_to_ipackage (
242 ACPI_OPERAND_OBJECT *source_obj,
243 ACPI_OPERAND_OBJECT *dest_obj,
244 ACPI_WALK_STATE *walk_state);
248 * Cm_create - Object creation
252 acpi_cm_update_object_reference (
253 ACPI_OPERAND_OBJECT *object,
256 ACPI_OPERAND_OBJECT *
257 _cm_create_internal_object (
258 NATIVE_CHAR *module_name,
261 OBJECT_TYPE_INTERNAL type);
265 * Cm_debug - Debug interfaces
278 NATIVE_CHAR *module_name,
281 NATIVE_CHAR *function_name);
285 NATIVE_CHAR *module_name,
288 NATIVE_CHAR *function_name,
293 NATIVE_CHAR *module_name,
296 NATIVE_CHAR *function_name,
301 NATIVE_CHAR *module_name,
304 NATIVE_CHAR *function_name,
305 NATIVE_CHAR *string);
309 NATIVE_CHAR *module_name,
312 NATIVE_CHAR *function_name);
315 function_status_exit (
316 NATIVE_CHAR *module_name,
319 NATIVE_CHAR *function_name,
323 function_value_exit (
324 NATIVE_CHAR *module_name,
327 NATIVE_CHAR *function_name,
332 NATIVE_CHAR *module_name,
335 NATIVE_CHAR *function_name,
340 NATIVE_CHAR *module_name,
345 NATIVE_CHAR *module_name,
349 NATIVE_CHAR *format, ...);
353 NATIVE_CHAR *format, ...);
357 NATIVE_CHAR *module_name,
363 NATIVE_CHAR *module_name,
369 NATIVE_CHAR *module_name,
374 acpi_cm_dump_buffer (
382 * Cm_delete - Object deletion
386 acpi_cm_delete_internal_obj (
387 ACPI_OPERAND_OBJECT *object);
390 acpi_cm_delete_internal_package_object (
391 ACPI_OPERAND_OBJECT *object);
394 acpi_cm_delete_internal_simple_object (
395 ACPI_OPERAND_OBJECT *object);
398 acpi_cm_delete_internal_object_list (
399 ACPI_OPERAND_OBJECT **obj_list);
403 * Cm_eval - object evaluation
406 /* Method name strings */
408 #define METHOD_NAME__HID "_HID"
409 #define METHOD_NAME__UID "_UID"
410 #define METHOD_NAME__ADR "_ADR"
411 #define METHOD_NAME__STA "_STA"
412 #define METHOD_NAME__REG "_REG"
413 #define METHOD_NAME__SEG "_SEG"
414 #define METHOD_NAME__BBN "_BBN"
418 acpi_cm_evaluate_numeric_object (
419 NATIVE_CHAR *object_name,
420 ACPI_NAMESPACE_NODE *device_node,
421 ACPI_INTEGER *address);
424 acpi_cm_execute_HID (
425 ACPI_NAMESPACE_NODE *device_node,
429 acpi_cm_execute_STA (
430 ACPI_NAMESPACE_NODE *device_node,
434 acpi_cm_execute_UID (
435 ACPI_NAMESPACE_NODE *device_node,
440 * Cm_error - exception interfaces
444 acpi_cm_format_exception (
449 * Cm_mutex - mutual exclusion interfaces
453 acpi_cm_mutex_initialize (
457 acpi_cm_mutex_terminate (
461 acpi_cm_create_mutex (
462 ACPI_MUTEX_HANDLE mutex_id);
465 acpi_cm_delete_mutex (
466 ACPI_MUTEX_HANDLE mutex_id);
469 acpi_cm_acquire_mutex (
470 ACPI_MUTEX_HANDLE mutex_id);
473 acpi_cm_release_mutex (
474 ACPI_MUTEX_HANDLE mutex_id);
478 * Cm_object - internal object create/delete/cache routines
482 _cm_allocate_object_desc (
483 NATIVE_CHAR *module_name,
487 #define acpi_cm_create_internal_object(t) _cm_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t)
488 #define acpi_cm_allocate_object_desc() _cm_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT)
491 acpi_cm_delete_object_desc (
492 ACPI_OPERAND_OBJECT *object);
495 acpi_cm_valid_internal_object (
500 * Cm_ref_cnt - Object reference count management
504 acpi_cm_add_reference (
505 ACPI_OPERAND_OBJECT *object);
508 acpi_cm_remove_reference (
509 ACPI_OPERAND_OBJECT *object);
512 * Cm_size - Object size routines
516 acpi_cm_get_simple_object_size (
517 ACPI_OPERAND_OBJECT *obj,
521 acpi_cm_get_package_object_size (
522 ACPI_OPERAND_OBJECT *obj,
526 acpi_cm_get_object_size(
527 ACPI_OPERAND_OBJECT *obj,
532 * Cm_state - Generic state creation/cache routines
536 acpi_cm_push_generic_state (
537 ACPI_GENERIC_STATE **list_head,
538 ACPI_GENERIC_STATE *state);
541 acpi_cm_pop_generic_state (
542 ACPI_GENERIC_STATE **list_head);
546 acpi_cm_create_generic_state (
550 acpi_cm_create_update_state (
551 ACPI_OPERAND_OBJECT *object,
555 acpi_cm_create_pkg_state (
556 void *internal_object,
557 void *external_object,
561 acpi_cm_create_update_state_and_push (
562 ACPI_OPERAND_OBJECT *object,
564 ACPI_GENERIC_STATE **state_list);
567 acpi_cm_create_pkg_state_and_push (
568 void *internal_object,
569 void *external_object,
571 ACPI_GENERIC_STATE **state_list);
574 acpi_cm_create_control_state (
578 acpi_cm_delete_generic_state (
579 ACPI_GENERIC_STATE *state);
582 acpi_cm_delete_generic_state_cache (
586 acpi_cm_delete_object_cache (
594 acpi_cm_valid_acpi_name (
598 acpi_cm_valid_acpi_character (
599 NATIVE_CHAR character);
602 acpi_cm_resolve_package_references (
603 ACPI_OPERAND_OBJECT *obj_desc);
608 acpi_cm_display_init_pathname (
609 ACPI_HANDLE obj_handle,
616 * Memory allocation functions and related macros.
617 * Macros that expand to include filename and line number
642 acpi_cm_init_static_object (
643 ACPI_OPERAND_OBJECT *obj_desc);
645 #define acpi_cm_allocate(a) _cm_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
646 #define acpi_cm_callocate(a) _cm_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
647 #define acpi_cm_free(a) _cm_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
649 #ifndef ACPI_DEBUG_TRACK_ALLOCATIONS
651 #define acpi_cm_add_element_to_alloc_list(a,b,c,d,e,f)
652 #define acpi_cm_delete_element_from_alloc_list(a,b,c,d)
653 #define acpi_cm_dump_current_allocations(a,b)
654 #define acpi_cm_dump_allocation_info()
656 #define DECREMENT_OBJECT_METRICS(a)
657 #define INCREMENT_OBJECT_METRICS(a)
658 #define INITIALIZE_ALLOCATION_METRICS()
659 #define DECREMENT_NAME_TABLE_METRICS(a)
660 #define INCREMENT_NAME_TABLE_METRICS(a)
664 #define INITIALIZE_ALLOCATION_METRICS() \
665 acpi_gbl_current_object_count = 0; \
666 acpi_gbl_current_object_size = 0; \
667 acpi_gbl_running_object_count = 0; \
668 acpi_gbl_running_object_size = 0; \
669 acpi_gbl_max_concurrent_object_count = 0; \
670 acpi_gbl_max_concurrent_object_size = 0; \
671 acpi_gbl_current_alloc_size = 0; \
672 acpi_gbl_current_alloc_count = 0; \
673 acpi_gbl_running_alloc_size = 0; \
674 acpi_gbl_running_alloc_count = 0; \
675 acpi_gbl_max_concurrent_alloc_size = 0; \
676 acpi_gbl_max_concurrent_alloc_count = 0; \
677 acpi_gbl_current_node_count = 0; \
678 acpi_gbl_current_node_size = 0; \
679 acpi_gbl_max_concurrent_node_count = 0
682 #define DECREMENT_OBJECT_METRICS(a) \
683 acpi_gbl_current_object_count--; \
684 acpi_gbl_current_object_size -= a
686 #define INCREMENT_OBJECT_METRICS(a) \
687 acpi_gbl_current_object_count++; \
688 acpi_gbl_running_object_count++; \
689 if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \
691 acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \
693 acpi_gbl_running_object_size += a; \
694 acpi_gbl_current_object_size += a; \
695 if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \
697 acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \
700 #define DECREMENT_NAME_TABLE_METRICS(a) \
701 acpi_gbl_current_node_count--; \
702 acpi_gbl_current_node_size -= (a)
704 #define INCREMENT_NAME_TABLE_METRICS(a) \
705 acpi_gbl_current_node_count++; \
706 acpi_gbl_current_node_size+= (a); \
707 if (acpi_gbl_max_concurrent_node_count < acpi_gbl_current_node_count) \
709 acpi_gbl_max_concurrent_node_count = acpi_gbl_current_node_count; \
714 acpi_cm_dump_allocation_info (
718 acpi_cm_dump_current_allocations (
720 NATIVE_CHAR *module);
725 #endif /* _ACCOMMON_H */