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>
50 #define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME("utmisc")
53 /*******************************************************************************
55 * FUNCTION: acpi_ut_validate_exception
57 * PARAMETERS: Status - The acpi_status code to be formatted
59 * RETURN: A string containing the exception text. NULL if exception is
62 * DESCRIPTION: This function validates and translates an ACPI exception into
65 ******************************************************************************/
66 const char *acpi_ut_validate_exception(acpi_status status
)
69 const char *exception
= NULL
;
71 ACPI_FUNCTION_ENTRY();
74 * Status is composed of two parts, a "type" and an actual code
76 sub_status
= (status
& ~AE_CODE_MASK
);
78 switch (status
& AE_CODE_MASK
) {
79 case AE_CODE_ENVIRONMENTAL
:
81 if (sub_status
<= AE_CODE_ENV_MAX
) {
82 exception
= acpi_gbl_exception_names_env
[sub_status
];
86 case AE_CODE_PROGRAMMER
:
88 if (sub_status
<= AE_CODE_PGM_MAX
) {
89 exception
= acpi_gbl_exception_names_pgm
[sub_status
];
93 case AE_CODE_ACPI_TABLES
:
95 if (sub_status
<= AE_CODE_TBL_MAX
) {
96 exception
= acpi_gbl_exception_names_tbl
[sub_status
];
102 if (sub_status
<= AE_CODE_AML_MAX
) {
103 exception
= acpi_gbl_exception_names_aml
[sub_status
];
107 case AE_CODE_CONTROL
:
109 if (sub_status
<= AE_CODE_CTRL_MAX
) {
110 exception
= acpi_gbl_exception_names_ctrl
[sub_status
];
118 return (ACPI_CAST_PTR(const char, exception
));
121 /*******************************************************************************
123 * FUNCTION: acpi_ut_is_aml_table
125 * PARAMETERS: Table - An ACPI table
127 * RETURN: TRUE if table contains executable AML; FALSE otherwise
129 * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
130 * Currently, these are DSDT,SSDT,PSDT. All other table types are
131 * data tables that do not contain AML code.
133 ******************************************************************************/
135 u8
acpi_ut_is_aml_table(struct acpi_table_header
*table
)
138 /* These are the only tables that contain executable AML */
140 if (ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_DSDT
) ||
141 ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_PSDT
) ||
142 ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_SSDT
)) {
149 /*******************************************************************************
151 * FUNCTION: acpi_ut_allocate_owner_id
153 * PARAMETERS: owner_id - Where the new owner ID is returned
157 * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
158 * track objects created by the table or method, to be deleted
159 * when the method exits or the table is unloaded.
161 ******************************************************************************/
163 acpi_status
acpi_ut_allocate_owner_id(acpi_owner_id
* owner_id
)
170 ACPI_FUNCTION_TRACE(ut_allocate_owner_id
);
172 /* Guard against multiple allocations of ID to the same location */
175 ACPI_ERROR((AE_INFO
, "Owner ID [%2.2X] already exists",
177 return_ACPI_STATUS(AE_ALREADY_EXISTS
);
180 /* Mutex for the global ID mask */
182 status
= acpi_ut_acquire_mutex(ACPI_MTX_CACHES
);
183 if (ACPI_FAILURE(status
)) {
184 return_ACPI_STATUS(status
);
188 * Find a free owner ID, cycle through all possible IDs on repeated
189 * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
190 * to be scanned twice.
192 for (i
= 0, j
= acpi_gbl_last_owner_id_index
;
193 i
< (ACPI_NUM_OWNERID_MASKS
+ 1); i
++, j
++) {
194 if (j
>= ACPI_NUM_OWNERID_MASKS
) {
195 j
= 0; /* Wraparound to start of mask array */
198 for (k
= acpi_gbl_next_owner_id_offset
; k
< 32; k
++) {
199 if (acpi_gbl_owner_id_mask
[j
] == ACPI_UINT32_MAX
) {
201 /* There are no free IDs in this mask */
206 if (!(acpi_gbl_owner_id_mask
[j
] & (1 << k
))) {
208 * Found a free ID. The actual ID is the bit index plus one,
209 * making zero an invalid Owner ID. Save this as the last ID
210 * allocated and update the global ID mask.
212 acpi_gbl_owner_id_mask
[j
] |= (1 << k
);
214 acpi_gbl_last_owner_id_index
= (u8
) j
;
215 acpi_gbl_next_owner_id_offset
= (u8
) (k
+ 1);
218 * Construct encoded ID from the index and bit position
220 * Note: Last [j].k (bit 255) is never used and is marked
221 * permanently allocated (prevents +1 overflow)
224 (acpi_owner_id
) ((k
+ 1) + ACPI_MUL_32(j
));
226 ACPI_DEBUG_PRINT((ACPI_DB_VALUES
,
227 "Allocated OwnerId: %2.2X\n",
228 (unsigned int)*owner_id
));
233 acpi_gbl_next_owner_id_offset
= 0;
237 * All owner_ids have been allocated. This typically should
238 * not happen since the IDs are reused after deallocation. The IDs are
239 * allocated upon table load (one per table) and method execution, and
240 * they are released when a table is unloaded or a method completes
243 * If this error happens, there may be very deep nesting of invoked control
244 * methods, or there may be a bug where the IDs are not released.
246 status
= AE_OWNER_ID_LIMIT
;
248 "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
251 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES
);
252 return_ACPI_STATUS(status
);
255 /*******************************************************************************
257 * FUNCTION: acpi_ut_release_owner_id
259 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD
261 * RETURN: None. No error is returned because we are either exiting a
262 * control method or unloading a table. Either way, we would
263 * ignore any error anyway.
265 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
267 ******************************************************************************/
269 void acpi_ut_release_owner_id(acpi_owner_id
* owner_id_ptr
)
271 acpi_owner_id owner_id
= *owner_id_ptr
;
276 ACPI_FUNCTION_TRACE_U32(ut_release_owner_id
, owner_id
);
278 /* Always clear the input owner_id (zero is an invalid ID) */
282 /* Zero is not a valid owner_iD */
285 ACPI_ERROR((AE_INFO
, "Invalid OwnerId: %2.2X", owner_id
));
289 /* Mutex for the global ID mask */
291 status
= acpi_ut_acquire_mutex(ACPI_MTX_CACHES
);
292 if (ACPI_FAILURE(status
)) {
296 /* Normalize the ID to zero */
300 /* Decode ID to index/offset pair */
302 index
= ACPI_DIV_32(owner_id
);
303 bit
= 1 << ACPI_MOD_32(owner_id
);
305 /* Free the owner ID only if it is valid */
307 if (acpi_gbl_owner_id_mask
[index
] & bit
) {
308 acpi_gbl_owner_id_mask
[index
] ^= bit
;
311 "Release of non-allocated OwnerId: %2.2X",
315 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES
);
319 /*******************************************************************************
321 * FUNCTION: acpi_ut_strupr (strupr)
323 * PARAMETERS: src_string - The source string to convert
327 * DESCRIPTION: Convert string to uppercase
329 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
331 ******************************************************************************/
333 void acpi_ut_strupr(char *src_string
)
337 ACPI_FUNCTION_ENTRY();
343 /* Walk entire string, uppercasing the letters */
345 for (string
= src_string
; *string
; string
++) {
346 *string
= (char)ACPI_TOUPPER(*string
);
352 /*******************************************************************************
354 * FUNCTION: acpi_ut_print_string
356 * PARAMETERS: String - Null terminated ASCII string
357 * max_length - Maximum output length
361 * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
364 ******************************************************************************/
366 void acpi_ut_print_string(char *string
, u8 max_length
)
371 acpi_os_printf("<\"NULL STRING PTR\">");
375 acpi_os_printf("\"");
376 for (i
= 0; string
[i
] && (i
< max_length
); i
++) {
378 /* Escape sequences */
382 acpi_os_printf("\\a"); /* BELL */
386 acpi_os_printf("\\b"); /* BACKSPACE */
390 acpi_os_printf("\\f"); /* FORMFEED */
394 acpi_os_printf("\\n"); /* LINEFEED */
398 acpi_os_printf("\\r"); /* CARRIAGE RETURN */
402 acpi_os_printf("\\t"); /* HORIZONTAL TAB */
406 acpi_os_printf("\\v"); /* VERTICAL TAB */
409 case '\'': /* Single Quote */
410 case '\"': /* Double Quote */
411 case '\\': /* Backslash */
412 acpi_os_printf("\\%c", (int)string
[i
]);
417 /* Check for printable character or hex escape */
419 if (ACPI_IS_PRINT(string
[i
])) {
420 /* This is a normal character */
422 acpi_os_printf("%c", (int)string
[i
]);
424 /* All others will be Hex escapes */
426 acpi_os_printf("\\x%2.2X", (s32
) string
[i
]);
431 acpi_os_printf("\"");
433 if (i
== max_length
&& string
[i
]) {
434 acpi_os_printf("...");
438 /*******************************************************************************
440 * FUNCTION: acpi_ut_dword_byte_swap
442 * PARAMETERS: Value - Value to be converted
444 * RETURN: u32 integer with bytes swapped
446 * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
448 ******************************************************************************/
450 u32
acpi_ut_dword_byte_swap(u32 value
)
461 ACPI_FUNCTION_ENTRY();
465 out
.bytes
[0] = in
.bytes
[3];
466 out
.bytes
[1] = in
.bytes
[2];
467 out
.bytes
[2] = in
.bytes
[1];
468 out
.bytes
[3] = in
.bytes
[0];
473 /*******************************************************************************
475 * FUNCTION: acpi_ut_set_integer_width
477 * PARAMETERS: Revision From DSDT header
481 * DESCRIPTION: Set the global integer bit width based upon the revision
482 * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
483 * For Revision 2 and above, Integers are 64 bits. Yes, this
484 * makes a difference.
486 ******************************************************************************/
488 void acpi_ut_set_integer_width(u8 revision
)
495 acpi_gbl_integer_bit_width
= 32;
496 acpi_gbl_integer_nybble_width
= 8;
497 acpi_gbl_integer_byte_width
= 4;
499 /* 64-bit case (ACPI 2.0+) */
501 acpi_gbl_integer_bit_width
= 64;
502 acpi_gbl_integer_nybble_width
= 16;
503 acpi_gbl_integer_byte_width
= 8;
507 #ifdef ACPI_DEBUG_OUTPUT
508 /*******************************************************************************
510 * FUNCTION: acpi_ut_display_init_pathname
512 * PARAMETERS: Type - Object type of the node
513 * obj_handle - Handle whose pathname will be displayed
514 * Path - Additional path string to be appended.
515 * (NULL if no extra path)
517 * RETURN: acpi_status
519 * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
521 ******************************************************************************/
524 acpi_ut_display_init_pathname(u8 type
,
525 struct acpi_namespace_node
*obj_handle
,
529 struct acpi_buffer buffer
;
531 ACPI_FUNCTION_ENTRY();
533 /* Only print the path if the appropriate debug level is enabled */
535 if (!(acpi_dbg_level
& ACPI_LV_INIT_NAMES
)) {
539 /* Get the full pathname to the node */
541 buffer
.length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
542 status
= acpi_ns_handle_to_pathname(obj_handle
, &buffer
);
543 if (ACPI_FAILURE(status
)) {
547 /* Print what we're doing */
550 case ACPI_TYPE_METHOD
:
551 acpi_os_printf("Executing ");
555 acpi_os_printf("Initializing ");
559 /* Print the object type and pathname */
561 acpi_os_printf("%-12s %s",
562 acpi_ut_get_type_name(type
), (char *)buffer
.pointer
);
564 /* Extra path is used to append names like _STA, _INI, etc. */
567 acpi_os_printf(".%s", path
);
569 acpi_os_printf("\n");
571 ACPI_FREE(buffer
.pointer
);
575 /*******************************************************************************
577 * FUNCTION: acpi_ut_valid_acpi_char
579 * PARAMETERS: Char - The character to be examined
580 * Position - Byte position (0-3)
582 * RETURN: TRUE if the character is valid, FALSE otherwise
584 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
585 * 1) Upper case alpha
589 * We allow a '!' as the last character because of the ASF! table
591 ******************************************************************************/
593 u8
acpi_ut_valid_acpi_char(char character
, u32 position
)
596 if (!((character
>= 'A' && character
<= 'Z') ||
597 (character
>= '0' && character
<= '9') || (character
== '_'))) {
599 /* Allow a '!' in the last position */
601 if (character
== '!' && position
== 3) {
611 /*******************************************************************************
613 * FUNCTION: acpi_ut_valid_acpi_name
615 * PARAMETERS: Name - The name to be examined
617 * RETURN: TRUE if the name is valid, FALSE otherwise
619 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
620 * 1) Upper case alpha
624 ******************************************************************************/
626 u8
acpi_ut_valid_acpi_name(u32 name
)
630 ACPI_FUNCTION_ENTRY();
632 for (i
= 0; i
< ACPI_NAME_SIZE
; i
++) {
633 if (!acpi_ut_valid_acpi_char
634 ((ACPI_CAST_PTR(char, &name
))[i
], i
)) {
642 /*******************************************************************************
644 * FUNCTION: acpi_ut_repair_name
646 * PARAMETERS: Name - The ACPI name to be repaired
648 * RETURN: Repaired version of the name
650 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
651 * return the new name.
653 ******************************************************************************/
655 acpi_name
acpi_ut_repair_name(char *name
)
658 char new_name
[ACPI_NAME_SIZE
];
660 for (i
= 0; i
< ACPI_NAME_SIZE
; i
++) {
661 new_name
[i
] = name
[i
];
664 * Replace a bad character with something printable, yet technically
665 * still invalid. This prevents any collisions with existing "good"
666 * names in the namespace.
668 if (!acpi_ut_valid_acpi_char(name
[i
], i
)) {
673 return (*(u32
*) new_name
);
676 /*******************************************************************************
678 * FUNCTION: acpi_ut_strtoul64
680 * PARAMETERS: String - Null terminated string
681 * Base - Radix of the string: 16 or ACPI_ANY_BASE;
682 * ACPI_ANY_BASE means 'in behalf of to_integer'
683 * ret_integer - Where the converted integer is returned
685 * RETURN: Status and Converted value
687 * DESCRIPTION: Convert a string into an unsigned value. Performs either a
688 * 32-bit or 64-bit conversion, depending on the current mode
689 * of the interpreter.
690 * NOTE: Does not support Octal strings, not needed.
692 ******************************************************************************/
695 acpi_ut_strtoul64(char *string
, u32 base
, acpi_integer
* ret_integer
)
698 acpi_integer return_value
= 0;
699 acpi_integer quotient
;
700 acpi_integer dividend
;
701 u32 to_integer_op
= (base
== ACPI_ANY_BASE
);
702 u32 mode32
= (acpi_gbl_integer_byte_width
== 4);
707 ACPI_FUNCTION_TRACE_STR(ut_stroul64
, string
);
716 return_ACPI_STATUS(AE_BAD_PARAMETER
);
723 /* Skip over any white space in the buffer */
725 while ((*string
) && (ACPI_IS_SPACE(*string
) || *string
== '\t')) {
731 * Base equal to ACPI_ANY_BASE means 'to_integer operation case'.
732 * We need to determine if it is decimal or hexadecimal.
734 if ((*string
== '0') && (ACPI_TOLOWER(*(string
+ 1)) == 'x')) {
738 /* Skip over the leading '0x' */
745 /* Any string left? Check that '0x' is not followed by white space. */
747 if (!(*string
) || ACPI_IS_SPACE(*string
) || *string
== '\t') {
756 * Perform a 32-bit or 64-bit conversion, depending upon the current
757 * execution mode of the interpreter
759 dividend
= (mode32
) ? ACPI_UINT32_MAX
: ACPI_UINT64_MAX
;
761 /* Main loop: convert the string to a 32- or 64-bit integer */
764 if (ACPI_IS_DIGIT(*string
)) {
766 /* Convert ASCII 0-9 to Decimal value */
768 this_digit
= ((u8
) * string
) - '0';
769 } else if (base
== 10) {
771 /* Digit is out of range; possible in to_integer case only */
775 this_digit
= (u8
) ACPI_TOUPPER(*string
);
776 if (ACPI_IS_XDIGIT((char)this_digit
)) {
778 /* Convert ASCII Hex char to value */
780 this_digit
= this_digit
- 'A' + 10;
792 } else if ((valid_digits
== 0) && (this_digit
== 0)
802 if (sign_of0x
&& ((valid_digits
> 16)
803 || ((valid_digits
> 8) && mode32
))) {
805 * This is to_integer operation case.
806 * No any restrictions for string-to-integer conversion,
812 /* Divide the digit into the correct position */
815 acpi_ut_short_divide((dividend
- (acpi_integer
) this_digit
),
816 base
, "ient
, NULL
);
818 if (return_value
> quotient
) {
826 return_value
*= base
;
827 return_value
+= this_digit
;
831 /* All done, normal exit */
835 ACPI_DEBUG_PRINT((ACPI_DB_EXEC
, "Converted value: %8.8X%8.8X\n",
836 ACPI_FORMAT_UINT64(return_value
)));
838 *ret_integer
= return_value
;
839 return_ACPI_STATUS(AE_OK
);
842 /* Base was set/validated above */
845 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT
);
847 return_ACPI_STATUS(AE_BAD_HEX_CONSTANT
);
851 /*******************************************************************************
853 * FUNCTION: acpi_ut_create_update_state_and_push
855 * PARAMETERS: Object - Object to be added to the new state
856 * Action - Increment/Decrement
857 * state_list - List the state will be added to
861 * DESCRIPTION: Create a new state and push it
863 ******************************************************************************/
866 acpi_ut_create_update_state_and_push(union acpi_operand_object
*object
,
868 union acpi_generic_state
**state_list
)
870 union acpi_generic_state
*state
;
872 ACPI_FUNCTION_ENTRY();
874 /* Ignore null objects; these are expected */
880 state
= acpi_ut_create_update_state(object
, action
);
882 return (AE_NO_MEMORY
);
885 acpi_ut_push_generic_state(state_list
, state
);
889 /*******************************************************************************
891 * FUNCTION: acpi_ut_walk_package_tree
893 * PARAMETERS: source_object - The package to walk
894 * target_object - Target object (if package is being copied)
895 * walk_callback - Called once for each package element
896 * Context - Passed to the callback function
900 * DESCRIPTION: Walk through a package
902 ******************************************************************************/
905 acpi_ut_walk_package_tree(union acpi_operand_object
* source_object
,
907 acpi_pkg_callback walk_callback
, void *context
)
909 acpi_status status
= AE_OK
;
910 union acpi_generic_state
*state_list
= NULL
;
911 union acpi_generic_state
*state
;
913 union acpi_operand_object
*this_source_obj
;
915 ACPI_FUNCTION_TRACE(ut_walk_package_tree
);
917 state
= acpi_ut_create_pkg_state(source_object
, target_object
, 0);
919 return_ACPI_STATUS(AE_NO_MEMORY
);
924 /* Get one element of the package */
926 this_index
= state
->pkg
.index
;
927 this_source_obj
= (union acpi_operand_object
*)
928 state
->pkg
.source_object
->package
.elements
[this_index
];
932 * 1) An uninitialized package element. It is completely
933 * legal to declare a package and leave it uninitialized
934 * 2) Not an internal object - can be a namespace node instead
935 * 3) Any type other than a package. Packages are handled in else
938 if ((!this_source_obj
) ||
939 (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj
) !=
940 ACPI_DESC_TYPE_OPERAND
)
941 || (this_source_obj
->common
.type
!= 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_error, acpi_exception, acpi_warning, acpi_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_error(const char *module_name
, u32 line_number
, const char *format
, ...)
1036 acpi_os_printf("ACPI Error: ");
1038 va_start(args
, format
);
1039 acpi_os_vprintf(format
, args
);
1040 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION
, module_name
,
1045 void ACPI_INTERNAL_VAR_XFACE
1046 acpi_exception(const char *module_name
,
1047 u32 line_number
, acpi_status status
, const char *format
, ...)
1051 acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status
));
1053 va_start(args
, format
);
1054 acpi_os_vprintf(format
, args
);
1055 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION
, module_name
,
1060 void ACPI_INTERNAL_VAR_XFACE
1061 acpi_warning(const char *module_name
, u32 line_number
, const char *format
, ...)
1065 acpi_os_printf("ACPI Warning: ");
1067 va_start(args
, format
);
1068 acpi_os_vprintf(format
, args
);
1069 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION
, module_name
,
1074 void ACPI_INTERNAL_VAR_XFACE
1075 acpi_info(const char *module_name
, u32 line_number
, const char *format
, ...)
1079 acpi_os_printf("ACPI: ");
1081 va_start(args
, format
);
1082 acpi_os_vprintf(format
, args
);
1083 acpi_os_printf("\n");
1087 ACPI_EXPORT_SYMBOL(acpi_error
)
1088 ACPI_EXPORT_SYMBOL(acpi_exception
)
1089 ACPI_EXPORT_SYMBOL(acpi_warning
)
1090 ACPI_EXPORT_SYMBOL(acpi_info
)