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_pci_root_bridge
125 * PARAMETERS: Id - The HID/CID in string format
127 * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
129 * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
131 ******************************************************************************/
133 u8
acpi_ut_is_pci_root_bridge(char *id
)
137 * Check if this is a PCI root bridge.
138 * ACPI 3.0+: check for a PCI Express root also.
140 if (!(ACPI_STRCMP(id
,
141 PCI_ROOT_HID_STRING
)) ||
142 !(ACPI_STRCMP(id
, PCI_EXPRESS_ROOT_HID_STRING
))) {
149 /*******************************************************************************
151 * FUNCTION: acpi_ut_is_aml_table
153 * PARAMETERS: Table - An ACPI table
155 * RETURN: TRUE if table contains executable AML; FALSE otherwise
157 * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
158 * Currently, these are DSDT,SSDT,PSDT. All other table types are
159 * data tables that do not contain AML code.
161 ******************************************************************************/
163 u8
acpi_ut_is_aml_table(struct acpi_table_header
*table
)
166 /* These are the only tables that contain executable AML */
168 if (ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_DSDT
) ||
169 ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_PSDT
) ||
170 ACPI_COMPARE_NAME(table
->signature
, ACPI_SIG_SSDT
)) {
177 /*******************************************************************************
179 * FUNCTION: acpi_ut_allocate_owner_id
181 * PARAMETERS: owner_id - Where the new owner ID is returned
185 * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
186 * track objects created by the table or method, to be deleted
187 * when the method exits or the table is unloaded.
189 ******************************************************************************/
191 acpi_status
acpi_ut_allocate_owner_id(acpi_owner_id
* owner_id
)
198 ACPI_FUNCTION_TRACE(ut_allocate_owner_id
);
200 /* Guard against multiple allocations of ID to the same location */
203 ACPI_ERROR((AE_INFO
, "Owner ID [%2.2X] already exists",
205 return_ACPI_STATUS(AE_ALREADY_EXISTS
);
208 /* Mutex for the global ID mask */
210 status
= acpi_ut_acquire_mutex(ACPI_MTX_CACHES
);
211 if (ACPI_FAILURE(status
)) {
212 return_ACPI_STATUS(status
);
216 * Find a free owner ID, cycle through all possible IDs on repeated
217 * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
218 * to be scanned twice.
220 for (i
= 0, j
= acpi_gbl_last_owner_id_index
;
221 i
< (ACPI_NUM_OWNERID_MASKS
+ 1); i
++, j
++) {
222 if (j
>= ACPI_NUM_OWNERID_MASKS
) {
223 j
= 0; /* Wraparound to start of mask array */
226 for (k
= acpi_gbl_next_owner_id_offset
; k
< 32; k
++) {
227 if (acpi_gbl_owner_id_mask
[j
] == ACPI_UINT32_MAX
) {
229 /* There are no free IDs in this mask */
234 if (!(acpi_gbl_owner_id_mask
[j
] & (1 << k
))) {
236 * Found a free ID. The actual ID is the bit index plus one,
237 * making zero an invalid Owner ID. Save this as the last ID
238 * allocated and update the global ID mask.
240 acpi_gbl_owner_id_mask
[j
] |= (1 << k
);
242 acpi_gbl_last_owner_id_index
= (u8
) j
;
243 acpi_gbl_next_owner_id_offset
= (u8
) (k
+ 1);
246 * Construct encoded ID from the index and bit position
248 * Note: Last [j].k (bit 255) is never used and is marked
249 * permanently allocated (prevents +1 overflow)
252 (acpi_owner_id
) ((k
+ 1) + ACPI_MUL_32(j
));
254 ACPI_DEBUG_PRINT((ACPI_DB_VALUES
,
255 "Allocated OwnerId: %2.2X\n",
256 (unsigned int)*owner_id
));
261 acpi_gbl_next_owner_id_offset
= 0;
265 * All owner_ids have been allocated. This typically should
266 * not happen since the IDs are reused after deallocation. The IDs are
267 * allocated upon table load (one per table) and method execution, and
268 * they are released when a table is unloaded or a method completes
271 * If this error happens, there may be very deep nesting of invoked control
272 * methods, or there may be a bug where the IDs are not released.
274 status
= AE_OWNER_ID_LIMIT
;
276 "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
279 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES
);
280 return_ACPI_STATUS(status
);
283 /*******************************************************************************
285 * FUNCTION: acpi_ut_release_owner_id
287 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD
289 * RETURN: None. No error is returned because we are either exiting a
290 * control method or unloading a table. Either way, we would
291 * ignore any error anyway.
293 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
295 ******************************************************************************/
297 void acpi_ut_release_owner_id(acpi_owner_id
* owner_id_ptr
)
299 acpi_owner_id owner_id
= *owner_id_ptr
;
304 ACPI_FUNCTION_TRACE_U32(ut_release_owner_id
, owner_id
);
306 /* Always clear the input owner_id (zero is an invalid ID) */
310 /* Zero is not a valid owner_iD */
313 ACPI_ERROR((AE_INFO
, "Invalid OwnerId: %2.2X", owner_id
));
317 /* Mutex for the global ID mask */
319 status
= acpi_ut_acquire_mutex(ACPI_MTX_CACHES
);
320 if (ACPI_FAILURE(status
)) {
324 /* Normalize the ID to zero */
328 /* Decode ID to index/offset pair */
330 index
= ACPI_DIV_32(owner_id
);
331 bit
= 1 << ACPI_MOD_32(owner_id
);
333 /* Free the owner ID only if it is valid */
335 if (acpi_gbl_owner_id_mask
[index
] & bit
) {
336 acpi_gbl_owner_id_mask
[index
] ^= bit
;
339 "Release of non-allocated OwnerId: %2.2X",
343 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES
);
347 /*******************************************************************************
349 * FUNCTION: acpi_ut_strupr (strupr)
351 * PARAMETERS: src_string - The source string to convert
355 * DESCRIPTION: Convert string to uppercase
357 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
359 ******************************************************************************/
361 void acpi_ut_strupr(char *src_string
)
365 ACPI_FUNCTION_ENTRY();
371 /* Walk entire string, uppercasing the letters */
373 for (string
= src_string
; *string
; string
++) {
374 *string
= (char)ACPI_TOUPPER(*string
);
380 /*******************************************************************************
382 * FUNCTION: acpi_ut_print_string
384 * PARAMETERS: String - Null terminated ASCII string
385 * max_length - Maximum output length
389 * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
392 ******************************************************************************/
394 void acpi_ut_print_string(char *string
, u8 max_length
)
399 acpi_os_printf("<\"NULL STRING PTR\">");
403 acpi_os_printf("\"");
404 for (i
= 0; string
[i
] && (i
< max_length
); i
++) {
406 /* Escape sequences */
410 acpi_os_printf("\\a"); /* BELL */
414 acpi_os_printf("\\b"); /* BACKSPACE */
418 acpi_os_printf("\\f"); /* FORMFEED */
422 acpi_os_printf("\\n"); /* LINEFEED */
426 acpi_os_printf("\\r"); /* CARRIAGE RETURN */
430 acpi_os_printf("\\t"); /* HORIZONTAL TAB */
434 acpi_os_printf("\\v"); /* VERTICAL TAB */
437 case '\'': /* Single Quote */
438 case '\"': /* Double Quote */
439 case '\\': /* Backslash */
440 acpi_os_printf("\\%c", (int)string
[i
]);
445 /* Check for printable character or hex escape */
447 if (ACPI_IS_PRINT(string
[i
])) {
448 /* This is a normal character */
450 acpi_os_printf("%c", (int)string
[i
]);
452 /* All others will be Hex escapes */
454 acpi_os_printf("\\x%2.2X", (s32
) string
[i
]);
459 acpi_os_printf("\"");
461 if (i
== max_length
&& string
[i
]) {
462 acpi_os_printf("...");
466 /*******************************************************************************
468 * FUNCTION: acpi_ut_dword_byte_swap
470 * PARAMETERS: Value - Value to be converted
472 * RETURN: u32 integer with bytes swapped
474 * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
476 ******************************************************************************/
478 u32
acpi_ut_dword_byte_swap(u32 value
)
489 ACPI_FUNCTION_ENTRY();
493 out
.bytes
[0] = in
.bytes
[3];
494 out
.bytes
[1] = in
.bytes
[2];
495 out
.bytes
[2] = in
.bytes
[1];
496 out
.bytes
[3] = in
.bytes
[0];
501 /*******************************************************************************
503 * FUNCTION: acpi_ut_set_integer_width
505 * PARAMETERS: Revision From DSDT header
509 * DESCRIPTION: Set the global integer bit width based upon the revision
510 * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
511 * For Revision 2 and above, Integers are 64 bits. Yes, this
512 * makes a difference.
514 ******************************************************************************/
516 void acpi_ut_set_integer_width(u8 revision
)
523 acpi_gbl_integer_bit_width
= 32;
524 acpi_gbl_integer_nybble_width
= 8;
525 acpi_gbl_integer_byte_width
= 4;
527 /* 64-bit case (ACPI 2.0+) */
529 acpi_gbl_integer_bit_width
= 64;
530 acpi_gbl_integer_nybble_width
= 16;
531 acpi_gbl_integer_byte_width
= 8;
535 #ifdef ACPI_DEBUG_OUTPUT
536 /*******************************************************************************
538 * FUNCTION: acpi_ut_display_init_pathname
540 * PARAMETERS: Type - Object type of the node
541 * obj_handle - Handle whose pathname will be displayed
542 * Path - Additional path string to be appended.
543 * (NULL if no extra path)
545 * RETURN: acpi_status
547 * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
549 ******************************************************************************/
552 acpi_ut_display_init_pathname(u8 type
,
553 struct acpi_namespace_node
*obj_handle
,
557 struct acpi_buffer buffer
;
559 ACPI_FUNCTION_ENTRY();
561 /* Only print the path if the appropriate debug level is enabled */
563 if (!(acpi_dbg_level
& ACPI_LV_INIT_NAMES
)) {
567 /* Get the full pathname to the node */
569 buffer
.length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
570 status
= acpi_ns_handle_to_pathname(obj_handle
, &buffer
);
571 if (ACPI_FAILURE(status
)) {
575 /* Print what we're doing */
578 case ACPI_TYPE_METHOD
:
579 acpi_os_printf("Executing ");
583 acpi_os_printf("Initializing ");
587 /* Print the object type and pathname */
589 acpi_os_printf("%-12s %s",
590 acpi_ut_get_type_name(type
), (char *)buffer
.pointer
);
592 /* Extra path is used to append names like _STA, _INI, etc. */
595 acpi_os_printf(".%s", path
);
597 acpi_os_printf("\n");
599 ACPI_FREE(buffer
.pointer
);
603 /*******************************************************************************
605 * FUNCTION: acpi_ut_valid_acpi_char
607 * PARAMETERS: Char - The character to be examined
608 * Position - Byte position (0-3)
610 * RETURN: TRUE if the character is valid, FALSE otherwise
612 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
613 * 1) Upper case alpha
617 * We allow a '!' as the last character because of the ASF! table
619 ******************************************************************************/
621 u8
acpi_ut_valid_acpi_char(char character
, u32 position
)
624 if (!((character
>= 'A' && character
<= 'Z') ||
625 (character
>= '0' && character
<= '9') || (character
== '_'))) {
627 /* Allow a '!' in the last position */
629 if (character
== '!' && position
== 3) {
639 /*******************************************************************************
641 * FUNCTION: acpi_ut_valid_acpi_name
643 * PARAMETERS: Name - The name to be examined
645 * RETURN: TRUE if the name is valid, FALSE otherwise
647 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
648 * 1) Upper case alpha
652 ******************************************************************************/
654 u8
acpi_ut_valid_acpi_name(u32 name
)
658 ACPI_FUNCTION_ENTRY();
660 for (i
= 0; i
< ACPI_NAME_SIZE
; i
++) {
661 if (!acpi_ut_valid_acpi_char
662 ((ACPI_CAST_PTR(char, &name
))[i
], i
)) {
670 /*******************************************************************************
672 * FUNCTION: acpi_ut_repair_name
674 * PARAMETERS: Name - The ACPI name to be repaired
676 * RETURN: Repaired version of the name
678 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
679 * return the new name.
681 ******************************************************************************/
683 acpi_name
acpi_ut_repair_name(char *name
)
686 char new_name
[ACPI_NAME_SIZE
];
688 for (i
= 0; i
< ACPI_NAME_SIZE
; i
++) {
689 new_name
[i
] = name
[i
];
692 * Replace a bad character with something printable, yet technically
693 * still invalid. This prevents any collisions with existing "good"
694 * names in the namespace.
696 if (!acpi_ut_valid_acpi_char(name
[i
], i
)) {
701 return (*(u32
*) new_name
);
704 /*******************************************************************************
706 * FUNCTION: acpi_ut_strtoul64
708 * PARAMETERS: String - Null terminated string
709 * Base - Radix of the string: 16 or ACPI_ANY_BASE;
710 * ACPI_ANY_BASE means 'in behalf of to_integer'
711 * ret_integer - Where the converted integer is returned
713 * RETURN: Status and Converted value
715 * DESCRIPTION: Convert a string into an unsigned value. Performs either a
716 * 32-bit or 64-bit conversion, depending on the current mode
717 * of the interpreter.
718 * NOTE: Does not support Octal strings, not needed.
720 ******************************************************************************/
723 acpi_ut_strtoul64(char *string
, u32 base
, acpi_integer
* ret_integer
)
726 acpi_integer return_value
= 0;
727 acpi_integer quotient
;
728 acpi_integer dividend
;
729 u32 to_integer_op
= (base
== ACPI_ANY_BASE
);
730 u32 mode32
= (acpi_gbl_integer_byte_width
== 4);
735 ACPI_FUNCTION_TRACE_STR(ut_stroul64
, string
);
744 return_ACPI_STATUS(AE_BAD_PARAMETER
);
751 /* Skip over any white space in the buffer */
753 while ((*string
) && (ACPI_IS_SPACE(*string
) || *string
== '\t')) {
759 * Base equal to ACPI_ANY_BASE means 'to_integer operation case'.
760 * We need to determine if it is decimal or hexadecimal.
762 if ((*string
== '0') && (ACPI_TOLOWER(*(string
+ 1)) == 'x')) {
766 /* Skip over the leading '0x' */
773 /* Any string left? Check that '0x' is not followed by white space. */
775 if (!(*string
) || ACPI_IS_SPACE(*string
) || *string
== '\t') {
784 * Perform a 32-bit or 64-bit conversion, depending upon the current
785 * execution mode of the interpreter
787 dividend
= (mode32
) ? ACPI_UINT32_MAX
: ACPI_UINT64_MAX
;
789 /* Main loop: convert the string to a 32- or 64-bit integer */
792 if (ACPI_IS_DIGIT(*string
)) {
794 /* Convert ASCII 0-9 to Decimal value */
796 this_digit
= ((u8
) * string
) - '0';
797 } else if (base
== 10) {
799 /* Digit is out of range; possible in to_integer case only */
803 this_digit
= (u8
) ACPI_TOUPPER(*string
);
804 if (ACPI_IS_XDIGIT((char)this_digit
)) {
806 /* Convert ASCII Hex char to value */
808 this_digit
= this_digit
- 'A' + 10;
820 } else if ((valid_digits
== 0) && (this_digit
== 0)
830 if (sign_of0x
&& ((valid_digits
> 16)
831 || ((valid_digits
> 8) && mode32
))) {
833 * This is to_integer operation case.
834 * No any restrictions for string-to-integer conversion,
840 /* Divide the digit into the correct position */
843 acpi_ut_short_divide((dividend
- (acpi_integer
) this_digit
),
844 base
, "ient
, NULL
);
846 if (return_value
> quotient
) {
854 return_value
*= base
;
855 return_value
+= this_digit
;
859 /* All done, normal exit */
863 ACPI_DEBUG_PRINT((ACPI_DB_EXEC
, "Converted value: %8.8X%8.8X\n",
864 ACPI_FORMAT_UINT64(return_value
)));
866 *ret_integer
= return_value
;
867 return_ACPI_STATUS(AE_OK
);
870 /* Base was set/validated above */
873 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT
);
875 return_ACPI_STATUS(AE_BAD_HEX_CONSTANT
);
879 /*******************************************************************************
881 * FUNCTION: acpi_ut_create_update_state_and_push
883 * PARAMETERS: Object - Object to be added to the new state
884 * Action - Increment/Decrement
885 * state_list - List the state will be added to
889 * DESCRIPTION: Create a new state and push it
891 ******************************************************************************/
894 acpi_ut_create_update_state_and_push(union acpi_operand_object
*object
,
896 union acpi_generic_state
**state_list
)
898 union acpi_generic_state
*state
;
900 ACPI_FUNCTION_ENTRY();
902 /* Ignore null objects; these are expected */
908 state
= acpi_ut_create_update_state(object
, action
);
910 return (AE_NO_MEMORY
);
913 acpi_ut_push_generic_state(state_list
, state
);
917 /*******************************************************************************
919 * FUNCTION: acpi_ut_walk_package_tree
921 * PARAMETERS: source_object - The package to walk
922 * target_object - Target object (if package is being copied)
923 * walk_callback - Called once for each package element
924 * Context - Passed to the callback function
928 * DESCRIPTION: Walk through a package
930 ******************************************************************************/
933 acpi_ut_walk_package_tree(union acpi_operand_object
* source_object
,
935 acpi_pkg_callback walk_callback
, void *context
)
937 acpi_status status
= AE_OK
;
938 union acpi_generic_state
*state_list
= NULL
;
939 union acpi_generic_state
*state
;
941 union acpi_operand_object
*this_source_obj
;
943 ACPI_FUNCTION_TRACE(ut_walk_package_tree
);
945 state
= acpi_ut_create_pkg_state(source_object
, target_object
, 0);
947 return_ACPI_STATUS(AE_NO_MEMORY
);
952 /* Get one element of the package */
954 this_index
= state
->pkg
.index
;
955 this_source_obj
= (union acpi_operand_object
*)
956 state
->pkg
.source_object
->package
.elements
[this_index
];
960 * 1) An uninitialized package element. It is completely
961 * legal to declare a package and leave it uninitialized
962 * 2) Not an internal object - can be a namespace node instead
963 * 3) Any type other than a package. Packages are handled in else
966 if ((!this_source_obj
) ||
967 (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj
) !=
968 ACPI_DESC_TYPE_OPERAND
)
969 || (this_source_obj
->common
.type
!= ACPI_TYPE_PACKAGE
)) {
971 walk_callback(ACPI_COPY_TYPE_SIMPLE
,
972 this_source_obj
, state
, context
);
973 if (ACPI_FAILURE(status
)) {
974 return_ACPI_STATUS(status
);
978 while (state
->pkg
.index
>=
979 state
->pkg
.source_object
->package
.count
) {
981 * We've handled all of the objects at this level, This means
982 * that we have just completed a package. That package may
983 * have contained one or more packages itself.
985 * Delete this state and pop the previous state (package).
987 acpi_ut_delete_generic_state(state
);
988 state
= acpi_ut_pop_generic_state(&state_list
);
990 /* Finished when there are no more states */
994 * We have handled all of the objects in the top level
995 * package just add the length of the package objects
998 return_ACPI_STATUS(AE_OK
);
1002 * Go back up a level and move the index past the just
1003 * completed package object.
1008 /* This is a subobject of type package */
1011 walk_callback(ACPI_COPY_TYPE_PACKAGE
,
1012 this_source_obj
, state
, context
);
1013 if (ACPI_FAILURE(status
)) {
1014 return_ACPI_STATUS(status
);
1018 * Push the current state and create a new one
1019 * The callback above returned a new target package object.
1021 acpi_ut_push_generic_state(&state_list
, state
);
1022 state
= acpi_ut_create_pkg_state(this_source_obj
,
1024 this_target_obj
, 0);
1027 /* Free any stacked Update State objects */
1029 while (state_list
) {
1031 acpi_ut_pop_generic_state
1033 acpi_ut_delete_generic_state(state
);
1035 return_ACPI_STATUS(AE_NO_MEMORY
);
1040 /* We should never get here */
1042 return_ACPI_STATUS(AE_AML_INTERNAL
);
1045 /*******************************************************************************
1047 * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info
1049 * PARAMETERS: module_name - Caller's module name (for error output)
1050 * line_number - Caller's line number (for error output)
1051 * Format - Printf format string + additional args
1055 * DESCRIPTION: Print message with module/line/version info
1057 ******************************************************************************/
1059 void ACPI_INTERNAL_VAR_XFACE
1060 acpi_error(const char *module_name
, u32 line_number
, const char *format
, ...)
1064 acpi_os_printf("ACPI Error: ");
1066 va_start(args
, format
);
1067 acpi_os_vprintf(format
, args
);
1068 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION
, module_name
,
1073 void ACPI_INTERNAL_VAR_XFACE
1074 acpi_exception(const char *module_name
,
1075 u32 line_number
, acpi_status status
, const char *format
, ...)
1079 acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status
));
1081 va_start(args
, format
);
1082 acpi_os_vprintf(format
, args
);
1083 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION
, module_name
,
1088 void ACPI_INTERNAL_VAR_XFACE
1089 acpi_warning(const char *module_name
, u32 line_number
, const char *format
, ...)
1093 acpi_os_printf("ACPI Warning: ");
1095 va_start(args
, format
);
1096 acpi_os_vprintf(format
, args
);
1097 acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION
, module_name
,
1102 void ACPI_INTERNAL_VAR_XFACE
1103 acpi_info(const char *module_name
, u32 line_number
, const char *format
, ...)
1107 acpi_os_printf("ACPI: ");
1109 va_start(args
, format
);
1110 acpi_os_vprintf(format
, args
);
1111 acpi_os_printf("\n");
1115 ACPI_EXPORT_SYMBOL(acpi_error
)
1116 ACPI_EXPORT_SYMBOL(acpi_exception
)
1117 ACPI_EXPORT_SYMBOL(acpi_warning
)
1118 ACPI_EXPORT_SYMBOL(acpi_info
)