blob: ab95d452f87dfc50e51594dc7b7f1422cd60059a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4 *
5 *****************************************************************************/
6
7/*
Bob Mooreb4e104e2011-01-17 11:05:40 +08008 * Copyright (C) 2000 - 2011, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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#ifndef _ACUTILS_H
45#define _ACUTILS_H
46
Bob Moore96db2552005-11-02 00:00:00 -050047extern const u8 acpi_gbl_resource_aml_sizes[];
Lin Minge0fe0a82011-11-16 14:38:13 +080048extern const u8 acpi_gbl_resource_aml_serial_bus_sizes[];
Bob Moore96db2552005-11-02 00:00:00 -050049
Bob Mooredefba1d2005-12-16 17:05:00 -050050/* Strings used by the disassembler and debugger resource dump routines */
51
52#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
53
Bob Mooreb229cf92006-04-21 17:15:00 -040054extern const char *acpi_gbl_bm_decode[];
55extern const char *acpi_gbl_config_decode[];
56extern const char *acpi_gbl_consume_decode[];
57extern const char *acpi_gbl_dec_decode[];
58extern const char *acpi_gbl_he_decode[];
59extern const char *acpi_gbl_io_decode[];
60extern const char *acpi_gbl_ll_decode[];
61extern const char *acpi_gbl_max_decode[];
62extern const char *acpi_gbl_mem_decode[];
63extern const char *acpi_gbl_min_decode[];
64extern const char *acpi_gbl_mtp_decode[];
65extern const char *acpi_gbl_rng_decode[];
66extern const char *acpi_gbl_rw_decode[];
67extern const char *acpi_gbl_shr_decode[];
68extern const char *acpi_gbl_siz_decode[];
69extern const char *acpi_gbl_trs_decode[];
70extern const char *acpi_gbl_ttp_decode[];
71extern const char *acpi_gbl_typ_decode[];
Bob Mooredefba1d2005-12-16 17:05:00 -050072#endif
73
Bob Moore96db2552005-11-02 00:00:00 -050074/* Types for Resource descriptor entries */
75
76#define ACPI_INVALID_RESOURCE 0
77#define ACPI_FIXED_LENGTH 1
78#define ACPI_VARIABLE_LENGTH 2
79#define ACPI_SMALL_VARIABLE_LENGTH 3
80
Linus Torvalds1da177e2005-04-16 15:20:36 -070081typedef
Bob Moore616861242006-03-17 16:44:00 -050082acpi_status(*acpi_walk_aml_callback) (u8 * aml,
83 u32 length,
84 u32 offset,
Bob Mooreb229cf92006-04-21 17:15:00 -040085 u8 resource_index, void **context);
Bob Moore616861242006-03-17 16:44:00 -050086
87typedef
Len Brown4be44fc2005-08-05 00:44:28 -040088acpi_status(*acpi_pkg_callback) (u8 object_type,
89 union acpi_operand_object * source_object,
90 union acpi_generic_state * state,
91 void *context);
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
Len Brown4be44fc2005-08-05 00:44:28 -040093struct acpi_pkg_info {
94 u8 *free_space;
95 acpi_size length;
96 u32 object_space;
97 u32 num_packages;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098};
99
100#define REF_INCREMENT (u16) 0
101#define REF_DECREMENT (u16) 1
102#define REF_FORCE_DELETE (u16) 2
103
104/* acpi_ut_dump_buffer */
105
106#define DB_BYTE_DISPLAY 1
107#define DB_WORD_DISPLAY 2
108#define DB_DWORD_DISPLAY 4
109#define DB_QWORD_DISPLAY 8
110
Robert Moore44f6c012005-04-18 22:49:35 -0400111/*
112 * utglobal - Global data structures and procedures
113 */
Yi Yangb417d402008-08-04 10:30:09 +0800114acpi_status acpi_ut_init_globals(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
117
Len Brown4be44fc2005-08-05 00:44:28 -0400118char *acpi_ut_get_mutex_name(u32 mutex_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
Zhang Rui514d18d2008-04-10 19:06:44 +0400120const char *acpi_ut_get_notify_name(u32 notify_value);
121
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122#endif
123
Len Brown4be44fc2005-08-05 00:44:28 -0400124char *acpi_ut_get_type_name(acpi_object_type type);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
Len Brown4be44fc2005-08-05 00:44:28 -0400126char *acpi_ut_get_node_name(void *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127
Len Brown4be44fc2005-08-05 00:44:28 -0400128char *acpi_ut_get_descriptor_name(void *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
Bob Mooref02a99a2008-08-04 10:40:09 +0800130const char *acpi_ut_get_reference_name(union acpi_operand_object *object);
131
Len Brown4be44fc2005-08-05 00:44:28 -0400132char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
Len Brown4be44fc2005-08-05 00:44:28 -0400134char *acpi_ut_get_region_name(u8 space_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
Len Brown4be44fc2005-08-05 00:44:28 -0400136char *acpi_ut_get_event_name(u32 event_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
Bob Moore5df7e6c2010-01-21 10:06:32 +0800138char acpi_ut_hex_to_ascii_char(u64 integer, u32 position);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139
Len Brown4be44fc2005-08-05 00:44:28 -0400140u8 acpi_ut_valid_object_type(acpi_object_type type);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
142/*
Robert Moore44f6c012005-04-18 22:49:35 -0400143 * utinit - miscellaneous initialization and shutdown
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 */
Len Brown4be44fc2005-08-05 00:44:28 -0400145acpi_status acpi_ut_hardware_initialize(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Len Brown4be44fc2005-08-05 00:44:28 -0400147void acpi_ut_subsystem_shutdown(void);
Robert Moore44f6c012005-04-18 22:49:35 -0400148
Robert Moore44f6c012005-04-18 22:49:35 -0400149/*
150 * utclib - Local implementations of C library functions
151 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152#ifndef ACPI_USE_SYSTEM_CLIBRARY
153
Len Brown4be44fc2005-08-05 00:44:28 -0400154acpi_size acpi_ut_strlen(const char *string);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155
Len Brown4be44fc2005-08-05 00:44:28 -0400156char *acpi_ut_strcpy(char *dst_string, const char *src_string);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
Len Brown4be44fc2005-08-05 00:44:28 -0400158char *acpi_ut_strncpy(char *dst_string,
159 const char *src_string, acpi_size count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
Len Brown4be44fc2005-08-05 00:44:28 -0400161int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162
Len Brown4be44fc2005-08-05 00:44:28 -0400163int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
Len Brown4be44fc2005-08-05 00:44:28 -0400165int acpi_ut_strcmp(const char *string1, const char *string2);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
Len Brown4be44fc2005-08-05 00:44:28 -0400167char *acpi_ut_strcat(char *dst_string, const char *src_string);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
Len Brown4be44fc2005-08-05 00:44:28 -0400169char *acpi_ut_strncat(char *dst_string,
170 const char *src_string, acpi_size count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
Len Brown4be44fc2005-08-05 00:44:28 -0400172u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173
Len Brown4be44fc2005-08-05 00:44:28 -0400174char *acpi_ut_strstr(char *string1, char *string2);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175
Len Brown4be44fc2005-08-05 00:44:28 -0400176void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177
Bob Moore67a119f2008-06-10 13:42:13 +0800178void *acpi_ut_memset(void *dest, u8 value, acpi_size count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179
Len Brown4be44fc2005-08-05 00:44:28 -0400180int acpi_ut_to_upper(int c);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181
Len Brown4be44fc2005-08-05 00:44:28 -0400182int acpi_ut_to_lower(int c);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183
184extern const u8 _acpi_ctype[];
185
Len Brown4be44fc2005-08-05 00:44:28 -0400186#define _ACPI_XA 0x00 /* extra alphabetic - not supported */
187#define _ACPI_XS 0x40 /* extra space */
188#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
189#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
190#define _ACPI_DI 0x04 /* '0'-'9' */
191#define _ACPI_LO 0x02 /* 'a'-'z' */
192#define _ACPI_PU 0x10 /* punctuation */
193#define _ACPI_SP 0x08 /* space */
194#define _ACPI_UP 0x01 /* 'A'-'Z' */
195#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196
197#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
198#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
199#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
200#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
201#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
202#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
203#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204
Len Brown4be44fc2005-08-05 00:44:28 -0400205#endif /* ACPI_USE_SYSTEM_CLIBRARY */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206
Robert Moore44f6c012005-04-18 22:49:35 -0400207/*
208 * utcopy - Object construction and conversion interfaces
209 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400211acpi_ut_build_simple_object(union acpi_operand_object *obj,
212 union acpi_object *user_obj,
213 u8 * data_space, u32 * buffer_space_used);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214
215acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400216acpi_ut_build_package_object(union acpi_operand_object *obj,
217 u8 * buffer, u32 * space_used);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218
219acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400220acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
221 struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222
223acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400224acpi_ut_copy_eobject_to_iobject(union acpi_object *obj,
225 union acpi_operand_object **internal_obj);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226
227acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400228acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj,
229 union acpi_operand_object *dest_obj);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230
231acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400232acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
233 union acpi_operand_object **dest_desc,
234 struct acpi_walk_state *walk_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235
236/*
Robert Moore44f6c012005-04-18 22:49:35 -0400237 * utcreate - Object creation
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400240acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241
242/*
Robert Moore44f6c012005-04-18 22:49:35 -0400243 * utdebug - Debug interfaces
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 */
Len Brown4be44fc2005-08-05 00:44:28 -0400245void acpi_ut_init_stack_ptr_trace(void);
246
247void acpi_ut_track_stack_ptr(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248
249void
Len Brown4be44fc2005-08-05 00:44:28 -0400250acpi_ut_trace(u32 line_number,
Bob Moore4b8ed632008-06-10 13:55:53 +0800251 const char *function_name,
252 const char *module_name, u32 component_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253
254void
Len Brown4be44fc2005-08-05 00:44:28 -0400255acpi_ut_trace_ptr(u32 line_number,
256 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800257 const char *module_name, u32 component_id, void *pointer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258
259void
Len Brown4be44fc2005-08-05 00:44:28 -0400260acpi_ut_trace_u32(u32 line_number,
261 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800262 const char *module_name, u32 component_id, u32 integer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263
264void
Len Brown4be44fc2005-08-05 00:44:28 -0400265acpi_ut_trace_str(u32 line_number,
266 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800267 const char *module_name, u32 component_id, char *string);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268
269void
Len Brown4be44fc2005-08-05 00:44:28 -0400270acpi_ut_exit(u32 line_number,
Bob Moore4b8ed632008-06-10 13:55:53 +0800271 const char *function_name,
272 const char *module_name, u32 component_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273
274void
Len Brown4be44fc2005-08-05 00:44:28 -0400275acpi_ut_status_exit(u32 line_number,
276 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800277 const char *module_name,
278 u32 component_id, acpi_status status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279
280void
Len Brown4be44fc2005-08-05 00:44:28 -0400281acpi_ut_value_exit(u32 line_number,
282 const char *function_name,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800283 const char *module_name, u32 component_id, u64 value);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284
285void
Len Brown4be44fc2005-08-05 00:44:28 -0400286acpi_ut_ptr_exit(u32 line_number,
287 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800288 const char *module_name, u32 component_id, u8 *ptr);
Len Brown4be44fc2005-08-05 00:44:28 -0400289
Bob Mooreb8e4d892006-01-27 16:43:00 -0500290void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
291
Bob Moore793c2382006-03-31 00:00:00 -0500292void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
293
Bob Moore4a90c7e2006-01-13 16:22:00 -0500294void acpi_ut_report_error(char *module_name, u32 line_number);
Len Brown4be44fc2005-08-05 00:44:28 -0400295
Bob Moore4a90c7e2006-01-13 16:22:00 -0500296void acpi_ut_report_info(char *module_name, u32 line_number);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297
Bob Moore4a90c7e2006-01-13 16:22:00 -0500298void acpi_ut_report_warning(char *module_name, u32 line_number);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300/*
Robert Moore44f6c012005-04-18 22:49:35 -0400301 * utdelete - Object deletion and reference counts
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 */
Len Brown4be44fc2005-08-05 00:44:28 -0400303void acpi_ut_add_reference(union acpi_operand_object *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304
Len Brown4be44fc2005-08-05 00:44:28 -0400305void acpi_ut_remove_reference(union acpi_operand_object *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306
Len Brown4be44fc2005-08-05 00:44:28 -0400307void acpi_ut_delete_internal_package_object(union acpi_operand_object *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308
Len Brown4be44fc2005-08-05 00:44:28 -0400309void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310
Len Brown4be44fc2005-08-05 00:44:28 -0400311void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312
313/*
Robert Moore44f6c012005-04-18 22:49:35 -0400314 * uteval - object evaluation
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400317acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
318 char *path,
319 u32 expected_return_btypes,
320 union acpi_operand_object **return_desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321
322acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400323acpi_ut_evaluate_numeric_object(char *object_name,
324 struct acpi_namespace_node *device_node,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800325 u64 *value);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326
327acpi_status
Bob Moore15b8dd52009-06-29 13:39:29 +0800328acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags);
329
330acpi_status
331acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
332 const char **method_names,
333 u8 method_count, u8 *out_values);
334
335/*
336 * utids - device ID support
337 */
338acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400339acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
Bob Moore15b8dd52009-06-29 13:39:29 +0800340 struct acpica_device_id **return_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341
342acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400343acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
Bob Moore15b8dd52009-06-29 13:39:29 +0800344 struct acpica_device_id **return_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345
346acpi_status
Bob Moore15b8dd52009-06-29 13:39:29 +0800347acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
348 struct acpica_device_id_list **return_cid_list);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349
350/*
Bob Moore8a335a232009-03-09 16:31:04 +0800351 * utlock - reader/writer locks
352 */
353acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock);
354
355void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock);
356
357acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock);
358
359acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock);
360
361acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock);
362
363void acpi_ut_release_write_lock(struct acpi_rw_lock *lock);
364
365/*
Robert Moore44f6c012005-04-18 22:49:35 -0400366 * utobject - internal object create/delete/cache routines
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367 */
Bob Moore4b8ed632008-06-10 13:55:53 +0800368union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
369 *module_name,
Len Brown4be44fc2005-08-05 00:44:28 -0400370 u32 line_number,
371 u32 component_id,
372 acpi_object_type
373 type);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374
Bob Moore4b8ed632008-06-10 13:55:53 +0800375void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
Len Brown4be44fc2005-08-05 00:44:28 -0400376 u32 line_number, u32 component_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377
Robert Mooref9f46012005-07-08 00:00:00 -0400378#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
379#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380
Len Brown4be44fc2005-08-05 00:44:28 -0400381void acpi_ut_delete_object_desc(union acpi_operand_object *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382
Len Brown4be44fc2005-08-05 00:44:28 -0400383u8 acpi_ut_valid_internal_object(void *object);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384
Bob Moore6287ee32007-04-03 19:59:37 -0400385union acpi_operand_object *acpi_ut_create_package_object(u32 count);
386
Bob Moore502f7ef2009-11-12 09:49:50 +0800387union acpi_operand_object *acpi_ut_create_integer_object(u64 value);
388
Len Brown4be44fc2005-08-05 00:44:28 -0400389union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390
Len Brown4be44fc2005-08-05 00:44:28 -0400391union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400394acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395
396/*
Lin Mingb0ed7a92010-08-06 09:35:51 +0800397 * utosi - Support for the _OSI predefined control method
398 */
399acpi_status acpi_ut_initialize_interfaces(void);
400
401void acpi_ut_interface_terminate(void);
402
403acpi_status acpi_ut_install_interface(acpi_string interface_name);
404
405acpi_status acpi_ut_remove_interface(acpi_string interface_name);
406
407struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name);
408
409acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
410
411/*
Robert Moore44f6c012005-04-18 22:49:35 -0400412 * utstate - Generic state creation/cache routines
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414void
Len Brown4be44fc2005-08-05 00:44:28 -0400415acpi_ut_push_generic_state(union acpi_generic_state **list_head,
416 union acpi_generic_state *state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417
Len Brown4be44fc2005-08-05 00:44:28 -0400418union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
419 **list_head);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420
Len Brown4be44fc2005-08-05 00:44:28 -0400421union acpi_generic_state *acpi_ut_create_generic_state(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422
Len Brown4be44fc2005-08-05 00:44:28 -0400423struct acpi_thread_state *acpi_ut_create_thread_state(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424
Len Brown4be44fc2005-08-05 00:44:28 -0400425union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
426 *object, u16 action);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427
Len Brown4be44fc2005-08-05 00:44:28 -0400428union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
429 void *external_object,
430 u16 index);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431
432acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400433acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
434 u16 action,
435 union acpi_generic_state **state_list);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436
Robert Moore44f6c012005-04-18 22:49:35 -0400437#ifdef ACPI_FUTURE_USAGE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400439acpi_ut_create_pkg_state_and_push(void *internal_object,
440 void *external_object,
441 u16 index,
442 union acpi_generic_state **state_list);
443#endif /* ACPI_FUTURE_USAGE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444
Len Brown4be44fc2005-08-05 00:44:28 -0400445union acpi_generic_state *acpi_ut_create_control_state(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446
Len Brown4be44fc2005-08-05 00:44:28 -0400447void acpi_ut_delete_generic_state(union acpi_generic_state *state);
Robert Moore44f6c012005-04-18 22:49:35 -0400448
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449/*
Robert Moore44f6c012005-04-18 22:49:35 -0400450 * utmath
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452acpi_status
Bob Moore5df7e6c2010-01-21 10:06:32 +0800453acpi_ut_divide(u64 in_dividend,
454 u64 in_divisor, u64 *out_quotient, u64 *out_remainder);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455
456acpi_status
Bob Moore5df7e6c2010-01-21 10:06:32 +0800457acpi_ut_short_divide(u64 in_dividend,
458 u32 divisor, u64 *out_quotient, u32 *out_remainder);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459
Robert Moore44f6c012005-04-18 22:49:35 -0400460/*
461 * utmisc
462 */
Bob Moore84fb2c92007-02-02 19:48:19 +0300463const char *acpi_ut_validate_exception(acpi_status status);
464
Bob Moore15b8dd52009-06-29 13:39:29 +0800465u8 acpi_ut_is_pci_root_bridge(char *id);
466
Bob Moore793c2382006-03-31 00:00:00 -0500467u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
468
Len Brown4be44fc2005-08-05 00:44:28 -0400469acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
Robert Mooref9f46012005-07-08 00:00:00 -0400470
Len Brown4be44fc2005-08-05 00:44:28 -0400471void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
Robert Mooref9f46012005-07-08 00:00:00 -0400472
473acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400474acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
475 void *target_object,
476 acpi_pkg_callback walk_callback, void *context);
Robert Moore44f6c012005-04-18 22:49:35 -0400477
Len Brown4be44fc2005-08-05 00:44:28 -0400478void acpi_ut_strupr(char *src_string);
Robert Moore44f6c012005-04-18 22:49:35 -0400479
Len Brown4be44fc2005-08-05 00:44:28 -0400480void acpi_ut_print_string(char *string, u8 max_length);
Robert Moore44f6c012005-04-18 22:49:35 -0400481
Len Brown4be44fc2005-08-05 00:44:28 -0400482u8 acpi_ut_valid_acpi_name(u32 name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483
Bob Moore3d81b232007-02-02 19:48:19 +0300484acpi_name acpi_ut_repair_name(char *name);
Bob Moore793c2382006-03-31 00:00:00 -0500485
Bob Moore67a119f2008-06-10 13:42:13 +0800486u8 acpi_ut_valid_acpi_char(char character, u32 position);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487
Bob Moore5df7e6c2010-01-21 10:06:32 +0800488acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489
490/* Values for Base above (16=Hex, 10=Decimal) */
491
492#define ACPI_ANY_BASE 0
493
Bob Moore616861242006-03-17 16:44:00 -0500494u32 acpi_ut_dword_byte_swap(u32 value);
495
496void acpi_ut_set_integer_width(u8 revision);
497
498#ifdef ACPI_DEBUG_OUTPUT
499void
500acpi_ut_display_init_pathname(u8 type,
501 struct acpi_namespace_node *obj_handle,
502 char *path);
503#endif
504
505/*
506 * utresrc
507 */
508acpi_status
509acpi_ut_walk_aml_resources(u8 * aml,
510 acpi_size aml_length,
Len Brownfd350942007-05-09 23:34:35 -0400511 acpi_walk_aml_callback user_function,
512 void **context);
Bob Moore616861242006-03-17 16:44:00 -0500513
Bob Moore96db2552005-11-02 00:00:00 -0500514acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
515
Bob Moore08978312005-10-21 00:00:00 -0400516u32 acpi_ut_get_descriptor_length(void *aml);
517
518u16 acpi_ut_get_resource_length(void *aml);
519
Bob Moore96db2552005-11-02 00:00:00 -0500520u8 acpi_ut_get_resource_header_length(void *aml);
521
Bob Moore08978312005-10-21 00:00:00 -0400522u8 acpi_ut_get_resource_type(void *aml);
523
Bob Moore96db2552005-11-02 00:00:00 -0500524acpi_status
525acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
526 u8 ** end_tag);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528/*
Robert Moore73459f72005-06-24 00:00:00 -0400529 * utmutex - mutex support
530 */
Len Brown4be44fc2005-08-05 00:44:28 -0400531acpi_status acpi_ut_mutex_initialize(void);
Robert Moore73459f72005-06-24 00:00:00 -0400532
Len Brown4be44fc2005-08-05 00:44:28 -0400533void acpi_ut_mutex_terminate(void);
Robert Moore73459f72005-06-24 00:00:00 -0400534
Len Brown4be44fc2005-08-05 00:44:28 -0400535acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id);
Robert Moore73459f72005-06-24 00:00:00 -0400536
Len Brown4be44fc2005-08-05 00:44:28 -0400537acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id);
Robert Moore73459f72005-06-24 00:00:00 -0400538
539/*
Robert Moore44f6c012005-04-18 22:49:35 -0400540 * utalloc - memory allocation and object caching
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541 */
Len Brown4be44fc2005-08-05 00:44:28 -0400542acpi_status acpi_ut_create_caches(void);
543
544acpi_status acpi_ut_delete_caches(void);
545
546acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547
Robert Moore73459f72005-06-24 00:00:00 -0400548acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400549acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
550 acpi_size required_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551
Bob Moore4b8ed632008-06-10 13:55:53 +0800552void *acpi_ut_allocate(acpi_size size,
553 u32 component, const char *module, u32 line);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554
Bob Moore616861242006-03-17 16:44:00 -0500555void *acpi_ut_allocate_zeroed(acpi_size size,
Bob Moore4b8ed632008-06-10 13:55:53 +0800556 u32 component, const char *module, u32 line);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558#ifdef ACPI_DBG_TRACK_ALLOCATIONS
Len Brown4be44fc2005-08-05 00:44:28 -0400559void *acpi_ut_allocate_and_track(acpi_size size,
Bob Moore4b8ed632008-06-10 13:55:53 +0800560 u32 component, const char *module, u32 line);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561
Bob Moore616861242006-03-17 16:44:00 -0500562void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
Bob Moore4b8ed632008-06-10 13:55:53 +0800563 u32 component,
564 const char *module, u32 line);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565
566void
Bob Moore4b8ed632008-06-10 13:55:53 +0800567acpi_ut_free_and_track(void *address,
568 u32 component, const char *module, u32 line);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569
Robert Moore44f6c012005-04-18 22:49:35 -0400570#ifdef ACPI_FUTURE_USAGE
Len Brown4be44fc2005-08-05 00:44:28 -0400571void acpi_ut_dump_allocation_info(void);
572#endif /* ACPI_FUTURE_USAGE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573
Bob Moore4b8ed632008-06-10 13:55:53 +0800574void acpi_ut_dump_allocations(u32 component, const char *module);
Bob Moore616861242006-03-17 16:44:00 -0500575
576acpi_status
577acpi_ut_create_list(char *list_name,
578 u16 object_size, struct acpi_memory_list **return_cache);
579
Bob Moorecc84e262010-09-15 14:09:14 +0800580#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
581
582/*
583 * utxferror - various error/warning output functions
584 */
585void ACPI_INTERNAL_VAR_XFACE
586acpi_ut_predefined_warning(const char *module_name,
587 u32 line_number,
588 char *pathname,
589 u8 node_flags, const char *format, ...);
590
591void ACPI_INTERNAL_VAR_XFACE
592acpi_ut_predefined_info(const char *module_name,
593 u32 line_number,
594 char *pathname, u8 node_flags, const char *format, ...);
595
596void
597acpi_ut_namespace_error(const char *module_name,
598 u32 line_number,
599 const char *internal_name, acpi_status lookup_status);
600
601void
602acpi_ut_method_error(const char *module_name,
603 u32 line_number,
604 const char *message,
605 struct acpi_namespace_node *node,
606 const char *path, acpi_status lookup_status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607
Len Brown4be44fc2005-08-05 00:44:28 -0400608#endif /* _ACUTILS_H */