1 /*******************************************************************************
3 * Module Name: utmisc - common utility procedures
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2008, Intel Corp.
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.
44 #include <linux/module.h>
46 #include <acpi/acpi.h>
47 #include <acpi/acnamesp.h>
49 #define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME("utmisc")
52 /*******************************************************************************
54 * FUNCTION: acpi_ut_validate_exception
56 * PARAMETERS: Status - The acpi_status code to be formatted
58 * RETURN: A string containing the exception text. NULL if exception is
61 * DESCRIPTION: This function validates and translates an ACPI exception into
64 ******************************************************************************/
65 const char *acpi_ut_validate_exception(acpi_status status
)
68 const char *exception
= NULL
;
70 ACPI_FUNCTION_ENTRY();
73 * Status is composed of two parts, a "type" and an actual code
75 sub_status
= (status
& ~AE_CODE_MASK
);
77 switch (status
& AE_CODE_MASK
) {
78 case AE_CODE_ENVIRONMENTAL
:
80 if (sub_status
<= AE_CODE_ENV_MAX
) {
81 exception
= acpi_gbl_exception_names_env
[sub_status
];
85 case AE_CODE_PROGRAMMER
:
87 if (sub_status
<= AE_CODE_PGM_MAX
) {
88 exception
= acpi_gbl_exception_names_pgm
[sub_status
];
92 case AE_CODE_ACPI_TABLES
:
94 if (sub_status
<= AE_CODE_TBL_MAX
) {
95 exception
= acpi_gbl_exception_names_tbl
[sub_status
];
101 if (sub_status
<= AE_CODE_AML_MAX
) {
102 exception
= acpi_gbl_exception_names_aml
[sub_status
];
106 case AE_CODE_CONTROL
:
108 if (sub_status
<= AE_CODE_CTRL_MAX
) {
109 exception
= acpi_gbl_exception_names_ctrl
[sub_status
];
117 return (ACPI_CAST_PTR(const char, exception
));
120 /*******************************************************************************
122 * FUNCTION: acpi_ut_is_aml_table
124 * PARAMETERS: Table - An ACPI table
126 * RETURN: TRUE if table contains executable AML; FALSE otherwise
128 * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
129 * Currently, these are DSDT,SSDT,PSDT. All other table types are
130 * data tables that do not contain AML code.
132 ******************************************************************************/
134 u8
acpi_ut_is_aml_table(struct acpi_table_header
*table
)
137 /* These are the only tables that contain executable AML */
139 if (ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_DSDT
) ||
140 ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_PSDT
) ||
141 ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_SSDT
)) {
148 /*******************************************************************************
150 * FUNCTION: acpi_ut_allocate_owner_id
152 * PARAMETERS: owner_id - Where the new owner ID is returned
156 * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
157 * track objects created by the table or method, to be deleted
158 * when the method exits or the table is unloaded.
160 ******************************************************************************/
162 acpi_status
acpi_ut_allocate_owner_id(acpi_owner_id
* owner_id
)
169 ACPI_FUNCTION_TRACE(ut_allocate_owner_id
);
171 /* Guard against multiple allocations of ID to the same location */
174 ACPI_ERROR((AE_INFO
, "Owner ID [%2.2X] already exists",
176 return_ACPI_STATUS(AE_ALREADY_EXISTS
);
179 /* Mutex for the global ID mask */
181 status
= acpi_ut_acquire_mutex(ACPI_MTX_CACHES
);
182 if (ACPI_FAILURE(status
)) {
183 return_ACPI_STATUS(status
);
187 * Find a free owner ID, cycle through all possible IDs on repeated
188 * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
189 * to be scanned twice.
191 for (i
= 0, j
= acpi_gbl_last_owner_id_index
;
192 i
< (ACPI_NUM_OWNERID_MASKS
+ 1); i
++, j
++) {
193 if (j
>= ACPI_NUM_OWNERID_MASKS
) {
194 j
= 0; /* Wraparound to start of mask array */
197 for (k
= acpi_gbl_next_owner_id_offset
; k
< 32; k
++) {
198 if (acpi_gbl_owner_id_mask
[j
] == ACPI_UINT32_MAX
) {
200 /* There are no free IDs in this mask */
205 if (!(acpi_gbl_owner_id_mask
[j
] & (1 << k
))) {
207 * Found a free ID. The actual ID is the bit index plus one,
208 * making zero an invalid Owner ID. Save this as the last ID
209 * allocated and update the global ID mask.
211 acpi_gbl_owner_id_mask
[j
] |= (1 << k
);
213 acpi_gbl_last_owner_id_index
= (u8
) j
;
214 acpi_gbl_next_owner_id_offset
= (u8
) (k
+ 1);
217 * Construct encoded ID from the index and bit position
219 * Note: Last [j].k (bit 255) is never used and is marked
220 * permanently allocated (prevents +1 overflow)
223 (acpi_owner_id
) ((k
+ 1) + ACPI_MUL_32(j
));
225 ACPI_DEBUG_PRINT((ACPI_DB_VALUES
,
226 "Allocated OwnerId: %2.2X\n",
227 (unsigned int)*owner_id
));
232 acpi_gbl_next_owner_id_offset
= 0;
236 * All owner_ids have been allocated. This typically should
237 * not happen since the IDs are reused after deallocation. The IDs are
238 * allocated upon table load (one per table) and method execution, and
239 * they are released when a table is unloaded or a method completes
242 * If this error happens, there may be very deep nesting of invoked control
243 * methods, or there may be a bug where the IDs are not released.
245 status
= AE_OWNER_ID_LIMIT
;
247 "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
250 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES
);
251 return_ACPI_STATUS(status
);
254 /*******************************************************************************
256 * FUNCTION: acpi_ut_release_owner_id
258 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD
260 * RETURN: None. No error is returned because we are either exiting a
261 * control method or unloading a table. Either way, we would
262 * ignore any error anyway.
264 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
266 ******************************************************************************/
268 void acpi_ut_release_owner_id(acpi_owner_id
* owner_id_ptr
)
270 acpi_owner_id owner_id
= *owner_id_ptr
;
275 ACPI_FUNCTION_TRACE_U32(ut_release_owner_id
, owner_id
);
277 /* Always clear the input owner_id (zero is an invalid ID) */
281 /* Zero is not a valid owner_iD */
284 ACPI_ERROR((AE_INFO
, "Invalid OwnerId: %2.2X", owner_id
));
288 /* Mutex for the global ID mask */
290 status
= acpi_ut_acquire_mutex(ACPI_MTX_CACHES
);
291 if (ACPI_FAILURE(status
)) {
295 /* Normalize the ID to zero */
299 /* Decode ID to index/offset pair */
301 index
= ACPI_DIV_32(owner_id
);
302 bit
= 1 << ACPI_MOD_32(owner_id
);
304 /* Free the owner ID only if it is valid */
306 if (acpi_gbl_owner_id_mask
[index
] & bit
) {
307 acpi_gbl_owner_id_mask
[index
] ^= bit
;
310 "Release of non-allocated OwnerId: %2.2X",
314 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES
);
318 /*******************************************************************************
320 * FUNCTION: acpi_ut_strupr (strupr)
322 * PARAMETERS: src_string - The source string to convert
326 * DESCRIPTION: Convert string to uppercase
328 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
330 ******************************************************************************/
332 void acpi_ut_strupr(char *src_string
)
336 ACPI_FUNCTION_ENTRY();
342 /* Walk entire string, uppercasing the letters */
344 for (string
= src_string
; *string
; string
++) {
345 *string
= (char)ACPI_TOUPPER(*string
);
351 /*******************************************************************************
353 * FUNCTION: acpi_ut_print_string
355 * PARAMETERS: String - Null terminated ASCII string
356 * max_length - Maximum output length
360 * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
363 ******************************************************************************/
365 void acpi_ut_print_string(char *string
, u8 max_length
)
370 acpi_os_printf("<\"NULL STRING PTR\">");
374 acpi_os_printf("\"");
375 for (i
= 0; string
[i
] && (i
< max_length
); i
++) {
377 /* Escape sequences */
381 acpi_os_printf("\\a"); /* BELL */
385 acpi_os_printf("\\b"); /* BACKSPACE */
389 acpi_os_printf("\\f"); /* FORMFEED */
393 acpi_os_printf("\\n"); /* LINEFEED */
397 acpi_os_printf("\\r"); /* CARRIAGE RETURN */
401 acpi_os_printf("\\t"); /* HORIZONTAL TAB */
405 acpi_os_printf("\\v"); /* VERTICAL TAB */
408 case '\'': /* Single Quote */
409 case '\"': /* Double Quote */
410 case '\\': /* Backslash */
411 acpi_os_printf("\\%c", (int)string
[i
]);
416 /* Check for printable character or hex escape */
418 if (ACPI_IS_PRINT(string
[i
])) {
419 /* This is a normal character */
421 acpi_os_printf("%c", (int)string
[i
]);
423 /* All others will be Hex escapes */
425 acpi_os_printf("\\x%2.2X", (s32
) string
[i
]);
430 acpi_os_printf("\"");
432 if (i
== max_length
&& string
[i
]) {
433 acpi_os_printf("...");
437 /*******************************************************************************
439 * FUNCTION: acpi_ut_dword_byte_swap
441 * PARAMETERS: Value - Value to be converted
443 * RETURN: u32 integer with bytes swapped
445 * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
447 ******************************************************************************/
449 u32
acpi_ut_dword_byte_swap(u32 value
)
460 ACPI_FUNCTION_ENTRY();
464 out
.bytes
[0] = in
.bytes
[3];
465 out
.bytes
[1] = in
.bytes
[2];
466 out
.bytes
[2] = in
.bytes
[1];
467 out
.bytes
[3] = in
.bytes
[0];
472 /*******************************************************************************
474 * FUNCTION: acpi_ut_set_integer_width
476 * PARAMETERS: Revision From DSDT header
480 * DESCRIPTION: Set the global integer bit width based upon the revision
481 * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
482 * For Revision 2 and above, Integers are 64 bits. Yes, this
483 * makes a difference.
485 ******************************************************************************/
487 void acpi_ut_set_integer_width(u8 revision
)
494 acpi_gbl_integer_bit_width
= 32;
495 acpi_gbl_integer_nybble_width
= 8;
496 acpi_gbl_integer_byte_width
= 4;
498 /* 64-bit case (ACPI 2.0+) */
500 acpi_gbl_integer_bit_width
= 64;
501 acpi_gbl_integer_nybble_width
= 16;
502 acpi_gbl_integer_byte_width
= 8;
506 #ifdef ACPI_DEBUG_OUTPUT
507 /*******************************************************************************
509 * FUNCTION: acpi_ut_display_init_pathname
511 * PARAMETERS: Type - Object type of the node
512 * obj_handle - Handle whose pathname will be displayed
513 * Path - Additional path string to be appended.
514 * (NULL if no extra path)
516 * RETURN: acpi_status
518 * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
520 ******************************************************************************/
523 acpi_ut_display_init_pathname(u8 type
,
524 struct acpi_namespace_node
*obj_handle
,
528 struct acpi_buffer buffer
;
530 ACPI_FUNCTION_ENTRY();
532 /* Only print the path if the appropriate debug level is enabled */
534 if (!(acpi_dbg_level
& ACPI_LV_INIT_NAMES
)) {
538 /* Get the full pathname to the node */
540 buffer
.length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
541 status
= acpi_ns_handle_to_pathname(obj_handle
, &buffer
);
542 if (ACPI_FAILURE(status
)) {
546 /* Print what we're doing */
549 case ACPI_TYPE_METHOD
:
550 acpi_os_printf("Executing ");
554 acpi_os_printf("Initializing ");
558 /* Print the object type and pathname */
560 acpi_os_printf("%-12s %s",
561 acpi_ut_get_type_name(type
), (char *)buffer
.pointer
);
563 /* Extra path is used to append names like _STA, _INI, etc. */
566 acpi_os_printf(".%s", path
);
568 acpi_os_printf("\n");
570 ACPI_FREE(buffer
.pointer
);
574 /*******************************************************************************
576 * FUNCTION: acpi_ut_valid_acpi_char
578 * PARAMETERS: Char - The character to be examined
579 * Position - Byte position (0-3)
581 * RETURN: TRUE if the character is valid, FALSE otherwise
583 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
584 * 1) Upper case alpha
588 * We allow a '!' as the last character because of the ASF! table
590 ******************************************************************************/
592 u8
acpi_ut_valid_acpi_char(char character
, u32 position
)
595 if (!((character
>= 'A' && character
<= 'Z') ||
596 (character
>= '0' && character
<= '9') || (character
== '_'))) {
598 /* Allow a '!' in the last position */
600 if (character
== '!' && position
== 3) {
610 /*******************************************************************************
612 * FUNCTION: acpi_ut_valid_acpi_name
614 * PARAMETERS: Name - The name to be examined
616 * RETURN: TRUE if the name is valid, FALSE otherwise
618 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
619 * 1) Upper case alpha
623 ******************************************************************************/
625 u8
acpi_ut_valid_acpi_name(u32 name
)
629 ACPI_FUNCTION_ENTRY();
631 for (i
= 0; i
< ACPI_NAME_SIZE
; i
++) {
632 if (!acpi_ut_valid_acpi_char
633 ((ACPI_CAST_PTR(char, &name
))[i
], i
)) {
641 /*******************************************************************************
643 * FUNCTION: acpi_ut_repair_name
645 * PARAMETERS: Name - The ACPI name to be repaired
647 * RETURN: Repaired version of the name
649 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
650 * return the new name.
652 ******************************************************************************/
654 acpi_name
acpi_ut_repair_name(char *name
)
657 char new_name
[ACPI_NAME_SIZE
];
659 for (i
= 0; i
< ACPI_NAME_SIZE
; i
++) {
660 new_name
[i
] = name
[i
];
663 * Replace a bad character with something printable, yet technically
664 * still invalid. This prevents any collisions with existing "good"
665 * names in the namespace.
667 if (!acpi_ut_valid_acpi_char(name
[i
], i
)) {
672 return (*(u32
*) new_name
);
675 /*******************************************************************************
677 * FUNCTION: acpi_ut_strtoul64
679 * PARAMETERS: String - Null terminated string
680 * Base - Radix of the string: 16 or ACPI_ANY_BASE;
681 * ACPI_ANY_BASE means 'in behalf of to_integer'
682 * ret_integer - Where the converted integer is returned
684 * RETURN: Status and Converted value
686 * DESCRIPTION: Convert a string into an unsigned value. Performs either a
687 * 32-bit or 64-bit conversion, depending on the current mode
688 * of the interpreter.
689 * NOTE: Does not support Octal strings, not needed.
691 ******************************************************************************/
694 acpi_ut_strtoul64(char *string
, u32 base
, acpi_integer
* ret_integer
)
697 acpi_integer return_value
= 0;
698 acpi_integer quotient
;
699 acpi_integer dividend
;
700 u32 to_integer_op
= (base
== ACPI_ANY_BASE
);
701 u32 mode32
= (acpi_gbl_integer_byte_width
== 4);
706 ACPI_FUNCTION_TRACE_STR(ut_stroul64
, string
);
715 return_ACPI_STATUS(AE_BAD_PARAMETER
);
722 /* Skip over any white space in the buffer */
724 while ((*string
) && (ACPI_IS_SPACE(*string
) || *string
== '\t')) {
730 * Base equal to ACPI_ANY_BASE means 'to_integer operation case'.
731 * We need to determine if it is decimal or hexadecimal.
733 if ((*string
== '0') && (ACPI_TOLOWER(*(string
+ 1)) == 'x')) {
737 /* Skip over the leading '0x' */
744 /* Any string left? Check that '0x' is not followed by white space. */
746 if (!(*string
) || ACPI_IS_SPACE(*string
) || *string
== '\t') {
755 * Perform a 32-bit or 64-bit conversion, depending upon the current
756 * execution mode of the interpreter
758 dividend
= (mode32
) ? ACPI_UINT32_MAX
: ACPI_UINT64_MAX
;
760 /* Main loop: convert the string to a 32- or 64-bit integer */
763 if (ACPI_IS_DIGIT(*string
)) {
765 /* Convert ASCII 0-9 to Decimal value */
767 this_digit
= ((u8
) * string
) - '0';
768 } else if (base
== 10) {
770 /* Digit is out of range; possible in to_integer case only */
774 this_digit
= (u8
) ACPI_TOUPPER(*string
);
775 if (ACPI_IS_XDIGIT((char)this_digit
)) {
777 /* Convert ASCII Hex char to value */
779 this_digit
= this_digit
- 'A' + 10;
791 } else if ((valid_digits
== 0) && (this_digit
== 0)
801 if (sign_of0x
&& ((valid_digits
> 16)
802 || ((valid_digits
> 8) && mode32
))) {
804 * This is to_integer operation case.
805 * No any restrictions for string-to-integer conversion,
811 /* Divide the digit into the correct position */
814 acpi_ut_short_divide((dividend
- (acpi_integer
) this_digit
),
815 base
, "ient
, NULL
);
817 if (return_value
> quotient
) {
825 return_value
*= base
;
826 return_value
+= this_digit
;
830 /* All done, normal exit */
834 ACPI_DEBUG_PRINT((ACPI_DB_EXEC
, "Converted value: %8.8X%8.8X\n",
835 ACPI_FORMAT_UINT64(return_value
)));
837 *ret_integer
= return_value
;
838 return_ACPI_STATUS(AE_OK
);
841 /* Base was set/validated above */
844 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT
);
846 return_ACPI_STATUS(AE_BAD_HEX_CONSTANT
);
850 /*******************************************************************************
852 * FUNCTION: acpi_ut_create_update_state_and_push
854 * PARAMETERS: Object - Object to be added to the new state
855 * Action - Increment/Decrement
856 * state_list - List the state will be added to
860 * DESCRIPTION: Create a new state and push it
862 ******************************************************************************/
865 acpi_ut_create_update_state_and_push(union acpi_operand_object
*object
,
867 union acpi_generic_state
**state_list
)
869 union acpi_generic_state
*state
;
871 ACPI_FUNCTION_ENTRY();
873 /* Ignore null objects; these are expected */
879 state
= acpi_ut_create_update_state(object
, action
);
881 return (AE_NO_MEMORY
);
884 acpi_ut_push_generic_state(state_list
, state
);
888 /*******************************************************************************
890 * FUNCTION: acpi_ut_walk_package_tree
892 * PARAMETERS: source_object - The package to walk
893 * target_object - Target object (if package is being copied)
894 * walk_callback - Called once for each package element
895 * Context - Passed to the callback function
899 * DESCRIPTION: Walk through a package
901 ******************************************************************************/
904 acpi_ut_walk_package_tree(union acpi_operand_object
* source_object
,
906 acpi_pkg_callback walk_callback
, void *context
)
908 acpi_status status
= AE_OK
;
909 union acpi_generic_state
*state_list
= NULL
;
910 union acpi_generic_state
*state
;
912 union acpi_operand_object
*this_source_obj
;
914 ACPI_FUNCTION_TRACE(ut_walk_package_tree
);
916 state
= acpi_ut_create_pkg_state(source_object
, target_object
, 0);
918 return_ACPI_STATUS(AE_NO_MEMORY
);
923 /* Get one element of the package */
925 this_index
= state
->pkg
.index
;
926 this_source_obj
= (union acpi_operand_object
*)
927 state
->pkg
.source_object
->package
.elements
[this_index
];
931 * 1) An uninitialized package element. It is completely
932 * legal to declare a package and leave it uninitialized
933 * 2) Not an internal object - can be a namespace node instead
934 * 3) Any type other than a package. Packages are handled in else
937 if ((!this_source_obj
) ||
938 (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj
) !=
939 ACPI_DESC_TYPE_OPERAND
)
940 || (ACPI_GET_OBJECT_TYPE(this_source_obj
) !=
941 ACPI_TYPE_PACKAGE
)) {
943 walk_callback(ACPI_COPY_TYPE_SIMPLE
,
944 this_source_obj
, state
, context
);
945 if (ACPI_FAILURE(status
)) {
946 return_ACPI_STATUS(status
);
950 while (state
->pkg
.index
>=
951 state
->pkg
.source_object
->package
.count
) {
953 * We've handled all of the objects at this level, This means
954 * that we have just completed a package. That package may
955 * have contained one or more packages itself.
957 * Delete this state and pop the previous state (package).
959 acpi_ut_delete_generic_state(state
);
960 state
= acpi_ut_pop_generic_state(&state_list
);
962 /* Finished when there are no more states */
966 * We have handled all of the objects in the top level
967 * package just add the length of the package objects
970 return_ACPI_STATUS(AE_OK
);
974 * Go back up a level and move the index past the just
975 * completed package object.
980 /* This is a subobject of type package */
983 walk_callback(ACPI_COPY_TYPE_PACKAGE
,
984 this_source_obj
, state
, context
);
985 if (ACPI_FAILURE(status
)) {
986 return_ACPI_STATUS(status
);
990 * Push the current state and create a new one
991 * The callback above returned a new target package object.
993 acpi_ut_push_generic_state(&state_list
, state
);
994 state
= acpi_ut_create_pkg_state(this_source_obj
,
999 /* Free any stacked Update State objects */
1001 while (state_list
) {
1003 acpi_ut_pop_generic_state
1005 acpi_ut_delete_generic_state(state
);
1007 return_ACPI_STATUS(AE_NO_MEMORY
);
1012 /* We should never get here */
1014 return_ACPI_STATUS(AE_AML_INTERNAL
);
1017 /*******************************************************************************
1019 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
1021 * PARAMETERS: module_name - Caller's module name (for error output)
1022 * line_number - Caller's line number (for error output)
1023 * Format - Printf format string + additional args
1027 * DESCRIPTION: Print message with module/line/version info
1029 ******************************************************************************/
1031 void ACPI_INTERNAL_VAR_XFACE
1032 acpi_ut_error(const char *module_name
, u32 line_number
, const char *format
, ...)
1036 acpi_os_printf("ACPI Error (%s-%04d): ", module_name
, line_number
);
1038 va_start(args
, format
);
1039 acpi_os_vprintf(format
, args
);
1040 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION
);
1044 void ACPI_INTERNAL_VAR_XFACE
1045 acpi_ut_exception(const char *module_name
,
1046 u32 line_number
, acpi_status status
, const char *format
, ...)
1050 acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name
,
1051 line_number
, acpi_format_exception(status
));
1053 va_start(args
, format
);
1054 acpi_os_vprintf(format
, args
);
1055 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION
);
1059 EXPORT_SYMBOL(acpi_ut_exception
);
1061 void ACPI_INTERNAL_VAR_XFACE
1062 acpi_ut_warning(const char *module_name
,
1063 u32 line_number
, const char *format
, ...)
1067 acpi_os_printf("ACPI Warning (%s-%04d): ", module_name
, line_number
);
1069 va_start(args
, format
);
1070 acpi_os_vprintf(format
, args
);
1071 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION
);
1075 void ACPI_INTERNAL_VAR_XFACE
1076 acpi_ut_info(const char *module_name
, u32 line_number
, const char *format
, ...)
1081 * Removed module_name, line_number, and acpica version, not needed
1084 acpi_os_printf("ACPI: ");
1086 va_start(args
, format
);
1087 acpi_os_vprintf(format
, args
);
1088 acpi_os_printf("\n");