Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * |
| 3 | * Module Name: utmisc - common utility procedures |
| 4 | * |
| 5 | ******************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * 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 | |
Thomas Renninger | be63c92 | 2006-06-02 15:58:00 -0400 | [diff] [blame^] | 44 | #include <linux/module.h> |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #include <acpi/acpi.h> |
| 47 | #include <acpi/acnamesp.h> |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #define _COMPONENT ACPI_UTILITIES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | ACPI_MODULE_NAME("utmisc") |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 51 | |
| 52 | /******************************************************************************* |
| 53 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 54 | * FUNCTION: acpi_ut_is_aml_table |
| 55 | * |
| 56 | * PARAMETERS: Table - An ACPI table |
| 57 | * |
| 58 | * RETURN: TRUE if table contains executable AML; FALSE otherwise |
| 59 | * |
| 60 | * DESCRIPTION: Check ACPI Signature for a table that contains AML code. |
| 61 | * Currently, these are DSDT,SSDT,PSDT. All other table types are |
| 62 | * data tables that do not contain AML code. |
| 63 | * |
| 64 | ******************************************************************************/ |
| 65 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) |
| 66 | { |
| 67 | |
| 68 | /* Ignore tables that contain AML */ |
| 69 | |
| 70 | if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || |
| 71 | ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || |
| 72 | ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { |
| 73 | return (TRUE); |
| 74 | } |
| 75 | |
| 76 | return (FALSE); |
| 77 | } |
| 78 | |
| 79 | /******************************************************************************* |
| 80 | * |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 81 | * FUNCTION: acpi_ut_allocate_owner_id |
| 82 | * |
| 83 | * PARAMETERS: owner_id - Where the new owner ID is returned |
| 84 | * |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 85 | * RETURN: Status |
| 86 | * |
| 87 | * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to |
| 88 | * track objects created by the table or method, to be deleted |
| 89 | * when the method exits or the table is unloaded. |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 90 | * |
| 91 | ******************************************************************************/ |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 92 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 93 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 94 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 95 | acpi_native_uint i; |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 96 | acpi_native_uint j; |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 97 | acpi_native_uint k; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 98 | acpi_status status; |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 99 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 100 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 101 | |
Robert Moore | aff8c27 | 2005-09-02 17:24:17 -0400 | [diff] [blame] | 102 | /* Guard against multiple allocations of ID to the same location */ |
| 103 | |
| 104 | if (*owner_id) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 105 | ACPI_ERROR((AE_INFO, "Owner ID [%2.2X] already exists", |
| 106 | *owner_id)); |
Robert Moore | aff8c27 | 2005-09-02 17:24:17 -0400 | [diff] [blame] | 107 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
| 108 | } |
| 109 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 110 | /* Mutex for the global ID mask */ |
| 111 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 112 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); |
| 113 | if (ACPI_FAILURE(status)) { |
| 114 | return_ACPI_STATUS(status); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 115 | } |
| 116 | |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 117 | /* |
| 118 | * Find a free owner ID, cycle through all possible IDs on repeated |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 119 | * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have |
| 120 | * to be scanned twice. |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 121 | */ |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 122 | for (i = 0, j = acpi_gbl_last_owner_id_index; |
| 123 | i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { |
| 124 | if (j >= ACPI_NUM_OWNERID_MASKS) { |
| 125 | j = 0; /* Wraparound to start of mask array */ |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 126 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 127 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 128 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { |
| 129 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 130 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 131 | /* There are no free IDs in this mask */ |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 132 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 133 | break; |
| 134 | } |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 135 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 136 | if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) { |
| 137 | /* |
| 138 | * Found a free ID. The actual ID is the bit index plus one, |
| 139 | * making zero an invalid Owner ID. Save this as the last ID |
| 140 | * allocated and update the global ID mask. |
| 141 | */ |
| 142 | acpi_gbl_owner_id_mask[j] |= (1 << k); |
| 143 | |
| 144 | acpi_gbl_last_owner_id_index = (u8) j; |
| 145 | acpi_gbl_next_owner_id_offset = (u8) (k + 1); |
| 146 | |
| 147 | /* |
| 148 | * Construct encoded ID from the index and bit position |
| 149 | * |
| 150 | * Note: Last [j].k (bit 255) is never used and is marked |
| 151 | * permanently allocated (prevents +1 overflow) |
| 152 | */ |
| 153 | *owner_id = |
| 154 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); |
| 155 | |
| 156 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 157 | "Allocated OwnerId: %2.2X\n", |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 158 | (unsigned int)*owner_id)); |
| 159 | goto exit; |
| 160 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 161 | } |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 162 | |
| 163 | acpi_gbl_next_owner_id_offset = 0; |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | /* |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 167 | * All owner_ids have been allocated. This typically should |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 168 | * not happen since the IDs are reused after deallocation. The IDs are |
| 169 | * allocated upon table load (one per table) and method execution, and |
| 170 | * they are released when a table is unloaded or a method completes |
| 171 | * execution. |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 172 | * |
| 173 | * If this error happens, there may be very deep nesting of invoked control |
| 174 | * methods, or there may be a bug where the IDs are not released. |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 175 | */ |
| 176 | status = AE_OWNER_ID_LIMIT; |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 177 | ACPI_ERROR((AE_INFO, |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 178 | "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 179 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 180 | exit: |
| 181 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); |
| 182 | return_ACPI_STATUS(status); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 183 | } |
| 184 | |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 185 | /******************************************************************************* |
| 186 | * |
| 187 | * FUNCTION: acpi_ut_release_owner_id |
| 188 | * |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 189 | * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 190 | * |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 191 | * RETURN: None. No error is returned because we are either exiting a |
| 192 | * control method or unloading a table. Either way, we would |
| 193 | * ignore any error anyway. |
| 194 | * |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 195 | * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 196 | * |
| 197 | ******************************************************************************/ |
| 198 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 199 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 200 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 201 | acpi_owner_id owner_id = *owner_id_ptr; |
| 202 | acpi_status status; |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 203 | acpi_native_uint index; |
| 204 | u32 bit; |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 205 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 206 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 207 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 208 | /* Always clear the input owner_id (zero is an invalid ID) */ |
| 209 | |
| 210 | *owner_id_ptr = 0; |
| 211 | |
| 212 | /* Zero is not a valid owner_iD */ |
| 213 | |
Bob Moore | defba1d | 2005-12-16 17:05:00 -0500 | [diff] [blame] | 214 | if (owner_id == 0) { |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 215 | ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id)); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 216 | return_VOID; |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 217 | } |
| 218 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 219 | /* Mutex for the global ID mask */ |
| 220 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 221 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); |
| 222 | if (ACPI_FAILURE(status)) { |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 223 | return_VOID; |
| 224 | } |
| 225 | |
Robert Moore | aff8c27 | 2005-09-02 17:24:17 -0400 | [diff] [blame] | 226 | /* Normalize the ID to zero */ |
| 227 | |
| 228 | owner_id--; |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 229 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 230 | /* Decode ID to index/offset pair */ |
| 231 | |
| 232 | index = ACPI_DIV_32(owner_id); |
| 233 | bit = 1 << ACPI_MOD_32(owner_id); |
| 234 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 235 | /* Free the owner ID only if it is valid */ |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 236 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 237 | if (acpi_gbl_owner_id_mask[index] & bit) { |
| 238 | acpi_gbl_owner_id_mask[index] ^= bit; |
| 239 | } else { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 240 | ACPI_ERROR((AE_INFO, |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 241 | "Release of non-allocated OwnerId: %2.2X", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 242 | owner_id + 1)); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 243 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 244 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 245 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 246 | return_VOID; |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 247 | } |
| 248 | |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 249 | /******************************************************************************* |
| 250 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 251 | * FUNCTION: acpi_ut_strupr (strupr) |
| 252 | * |
| 253 | * PARAMETERS: src_string - The source string to convert |
| 254 | * |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 255 | * RETURN: None |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 256 | * |
| 257 | * DESCRIPTION: Convert string to uppercase |
| 258 | * |
| 259 | * NOTE: This is not a POSIX function, so it appears here, not in utclib.c |
| 260 | * |
| 261 | ******************************************************************************/ |
| 262 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 263 | void acpi_ut_strupr(char *src_string) |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 264 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 265 | char *string; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 266 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 267 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 268 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 269 | if (!src_string) { |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 270 | return; |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 271 | } |
| 272 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 273 | /* Walk entire string, uppercasing the letters */ |
| 274 | |
| 275 | for (string = src_string; *string; string++) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 276 | *string = (char)ACPI_TOUPPER(*string); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 277 | } |
| 278 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 279 | return; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 280 | } |
| 281 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | /******************************************************************************* |
| 283 | * |
| 284 | * FUNCTION: acpi_ut_print_string |
| 285 | * |
| 286 | * PARAMETERS: String - Null terminated ASCII string |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 287 | * max_length - Maximum output length |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | * |
| 289 | * RETURN: None |
| 290 | * |
| 291 | * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape |
| 292 | * sequences. |
| 293 | * |
| 294 | ******************************************************************************/ |
| 295 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 296 | void acpi_ut_print_string(char *string, u8 max_length) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 298 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
| 300 | if (!string) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 301 | acpi_os_printf("<\"NULL STRING PTR\">"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | return; |
| 303 | } |
| 304 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 305 | acpi_os_printf("\""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | for (i = 0; string[i] && (i < max_length); i++) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | /* Escape sequences */ |
| 309 | |
| 310 | switch (string[i]) { |
| 311 | case 0x07: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 312 | acpi_os_printf("\\a"); /* BELL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | break; |
| 314 | |
| 315 | case 0x08: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 316 | acpi_os_printf("\\b"); /* BACKSPACE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | break; |
| 318 | |
| 319 | case 0x0C: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 320 | acpi_os_printf("\\f"); /* FORMFEED */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | break; |
| 322 | |
| 323 | case 0x0A: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 324 | acpi_os_printf("\\n"); /* LINEFEED */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | break; |
| 326 | |
| 327 | case 0x0D: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 328 | acpi_os_printf("\\r"); /* CARRIAGE RETURN */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | break; |
| 330 | |
| 331 | case 0x09: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 332 | acpi_os_printf("\\t"); /* HORIZONTAL TAB */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | break; |
| 334 | |
| 335 | case 0x0B: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 336 | acpi_os_printf("\\v"); /* VERTICAL TAB */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | break; |
| 338 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 339 | case '\'': /* Single Quote */ |
| 340 | case '\"': /* Double Quote */ |
| 341 | case '\\': /* Backslash */ |
| 342 | acpi_os_printf("\\%c", (int)string[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | break; |
| 344 | |
| 345 | default: |
| 346 | |
| 347 | /* Check for printable character or hex escape */ |
| 348 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 349 | if (ACPI_IS_PRINT(string[i])) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | /* This is a normal character */ |
| 351 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 352 | acpi_os_printf("%c", (int)string[i]); |
| 353 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | /* All others will be Hex escapes */ |
| 355 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 356 | acpi_os_printf("\\x%2.2X", (s32) string[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | } |
| 358 | break; |
| 359 | } |
| 360 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 361 | acpi_os_printf("\""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | |
| 363 | if (i == max_length && string[i]) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 364 | acpi_os_printf("..."); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | } |
| 366 | } |
| 367 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | /******************************************************************************* |
| 369 | * |
| 370 | * FUNCTION: acpi_ut_dword_byte_swap |
| 371 | * |
| 372 | * PARAMETERS: Value - Value to be converted |
| 373 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 374 | * RETURN: u32 integer with bytes swapped |
| 375 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) |
| 377 | * |
| 378 | ******************************************************************************/ |
| 379 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 380 | u32 acpi_ut_dword_byte_swap(u32 value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | { |
| 382 | union { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 383 | u32 value; |
| 384 | u8 bytes[4]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | } out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | union { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 387 | u32 value; |
| 388 | u8 bytes[4]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | } in; |
| 390 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 391 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | |
| 393 | in.value = value; |
| 394 | |
| 395 | out.bytes[0] = in.bytes[3]; |
| 396 | out.bytes[1] = in.bytes[2]; |
| 397 | out.bytes[2] = in.bytes[1]; |
| 398 | out.bytes[3] = in.bytes[0]; |
| 399 | |
| 400 | return (out.value); |
| 401 | } |
| 402 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | /******************************************************************************* |
| 404 | * |
| 405 | * FUNCTION: acpi_ut_set_integer_width |
| 406 | * |
| 407 | * PARAMETERS: Revision From DSDT header |
| 408 | * |
| 409 | * RETURN: None |
| 410 | * |
| 411 | * DESCRIPTION: Set the global integer bit width based upon the revision |
| 412 | * of the DSDT. For Revision 1 and 0, Integers are 32 bits. |
| 413 | * For Revision 2 and above, Integers are 64 bits. Yes, this |
| 414 | * makes a difference. |
| 415 | * |
| 416 | ******************************************************************************/ |
| 417 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 418 | void acpi_ut_set_integer_width(u8 revision) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | { |
| 420 | |
| 421 | if (revision <= 1) { |
| 422 | acpi_gbl_integer_bit_width = 32; |
| 423 | acpi_gbl_integer_nybble_width = 8; |
| 424 | acpi_gbl_integer_byte_width = 4; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 425 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | acpi_gbl_integer_bit_width = 64; |
| 427 | acpi_gbl_integer_nybble_width = 16; |
| 428 | acpi_gbl_integer_byte_width = 8; |
| 429 | } |
| 430 | } |
| 431 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | #ifdef ACPI_DEBUG_OUTPUT |
| 433 | /******************************************************************************* |
| 434 | * |
| 435 | * FUNCTION: acpi_ut_display_init_pathname |
| 436 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 437 | * PARAMETERS: Type - Object type of the node |
| 438 | * obj_handle - Handle whose pathname will be displayed |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | * Path - Additional path string to be appended. |
| 440 | * (NULL if no extra path) |
| 441 | * |
| 442 | * RETURN: acpi_status |
| 443 | * |
| 444 | * DESCRIPTION: Display full pathname of an object, DEBUG ONLY |
| 445 | * |
| 446 | ******************************************************************************/ |
| 447 | |
| 448 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 449 | acpi_ut_display_init_pathname(u8 type, |
| 450 | struct acpi_namespace_node *obj_handle, |
| 451 | char *path) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 453 | acpi_status status; |
| 454 | struct acpi_buffer buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 456 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | |
| 458 | /* Only print the path if the appropriate debug level is enabled */ |
| 459 | |
| 460 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { |
| 461 | return; |
| 462 | } |
| 463 | |
| 464 | /* Get the full pathname to the node */ |
| 465 | |
| 466 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 467 | status = acpi_ns_handle_to_pathname(obj_handle, &buffer); |
| 468 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | return; |
| 470 | } |
| 471 | |
| 472 | /* Print what we're doing */ |
| 473 | |
| 474 | switch (type) { |
| 475 | case ACPI_TYPE_METHOD: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 476 | acpi_os_printf("Executing "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | break; |
| 478 | |
| 479 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 480 | acpi_os_printf("Initializing "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | break; |
| 482 | } |
| 483 | |
| 484 | /* Print the object type and pathname */ |
| 485 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 486 | acpi_os_printf("%-12s %s", |
| 487 | acpi_ut_get_type_name(type), (char *)buffer.pointer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | |
| 489 | /* Extra path is used to append names like _STA, _INI, etc. */ |
| 490 | |
| 491 | if (path) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 492 | acpi_os_printf(".%s", path); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 494 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 496 | ACPI_FREE(buffer.pointer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | } |
| 498 | #endif |
| 499 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | /******************************************************************************* |
| 501 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 502 | * FUNCTION: acpi_ut_valid_acpi_char |
| 503 | * |
| 504 | * PARAMETERS: Char - The character to be examined |
| 505 | * |
| 506 | * RETURN: TRUE if the character is valid, FALSE otherwise |
| 507 | * |
| 508 | * DESCRIPTION: Check for a valid ACPI character. Must be one of: |
| 509 | * 1) Upper case alpha |
| 510 | * 2) numeric |
| 511 | * 3) underscore |
| 512 | * |
| 513 | * We allow a '!' as the last character because of the ASF! table |
| 514 | * |
| 515 | ******************************************************************************/ |
| 516 | |
| 517 | u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) |
| 518 | { |
| 519 | |
| 520 | if (!((character >= 'A' && character <= 'Z') || |
| 521 | (character >= '0' && character <= '9') || (character == '_'))) { |
| 522 | |
| 523 | /* Allow a '!' in the last position */ |
| 524 | |
| 525 | if (character == '!' && position == 3) { |
| 526 | return (TRUE); |
| 527 | } |
| 528 | |
| 529 | return (FALSE); |
| 530 | } |
| 531 | |
| 532 | return (TRUE); |
| 533 | } |
| 534 | |
| 535 | /******************************************************************************* |
| 536 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | * FUNCTION: acpi_ut_valid_acpi_name |
| 538 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 539 | * PARAMETERS: Name - The name to be examined |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 541 | * RETURN: TRUE if the name is valid, FALSE otherwise |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | * |
| 543 | * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: |
| 544 | * 1) Upper case alpha |
| 545 | * 2) numeric |
| 546 | * 3) underscore |
| 547 | * |
| 548 | ******************************************************************************/ |
| 549 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 550 | u8 acpi_ut_valid_acpi_name(u32 name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 552 | acpi_native_uint i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 553 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 554 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | |
| 556 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 557 | if (!acpi_ut_valid_acpi_char |
| 558 | ((ACPI_CAST_PTR(char, &name))[i], i)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | return (FALSE); |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | return (TRUE); |
| 564 | } |
| 565 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | /******************************************************************************* |
| 567 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 568 | * FUNCTION: acpi_ut_repair_name |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 569 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 570 | * PARAMETERS: Name - The ACPI name to be repaired |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 572 | * RETURN: Repaired version of the name |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | * |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 574 | * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and |
| 575 | * return the new name. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | * |
| 577 | ******************************************************************************/ |
| 578 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 579 | acpi_name acpi_ut_repair_name(acpi_name name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | { |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 581 | char *name_ptr = ACPI_CAST_PTR(char, &name); |
| 582 | char new_name[ACPI_NAME_SIZE]; |
| 583 | acpi_native_uint i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 585 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
| 586 | new_name[i] = name_ptr[i]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 587 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 588 | /* |
| 589 | * Replace a bad character with something printable, yet technically |
| 590 | * still invalid. This prevents any collisions with existing "good" |
| 591 | * names in the namespace. |
| 592 | */ |
| 593 | if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) { |
| 594 | new_name[i] = '*'; |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | return (*ACPI_CAST_PTR(u32, new_name)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | } |
| 600 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | /******************************************************************************* |
| 602 | * |
| 603 | * FUNCTION: acpi_ut_strtoul64 |
| 604 | * |
| 605 | * PARAMETERS: String - Null terminated string |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 606 | * Base - Radix of the string: 16 or ACPI_ANY_BASE; |
| 607 | * ACPI_ANY_BASE means 'in behalf of to_integer' |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 608 | * ret_integer - Where the converted integer is returned |
| 609 | * |
| 610 | * RETURN: Status and Converted value |
| 611 | * |
| 612 | * DESCRIPTION: Convert a string into an unsigned value. |
| 613 | * NOTE: Does not support Octal strings, not needed. |
| 614 | * |
| 615 | ******************************************************************************/ |
| 616 | |
| 617 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 618 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 620 | u32 this_digit = 0; |
| 621 | acpi_integer return_value = 0; |
| 622 | acpi_integer quotient; |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 623 | acpi_integer dividend; |
| 624 | u32 to_integer_op = (base == ACPI_ANY_BASE); |
| 625 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); |
| 626 | u8 valid_digits = 0; |
| 627 | u8 sign_of0x = 0; |
| 628 | u8 term = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 630 | ACPI_FUNCTION_TRACE(ut_stroul64); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | switch (base) { |
| 633 | case ACPI_ANY_BASE: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | case 16: |
| 635 | break; |
| 636 | |
| 637 | default: |
| 638 | /* Invalid Base */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 639 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | } |
| 641 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 642 | if (!string) { |
| 643 | goto error_exit; |
| 644 | } |
| 645 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | /* Skip over any white space in the buffer */ |
| 647 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 648 | while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | string++; |
| 650 | } |
| 651 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 652 | if (to_integer_op) { |
| 653 | /* |
| 654 | * Base equal to ACPI_ANY_BASE means 'to_integer operation case'. |
| 655 | * We need to determine if it is decimal or hexadecimal. |
| 656 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 657 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 658 | sign_of0x = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | base = 16; |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 660 | |
| 661 | /* Skip over the leading '0x' */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | string += 2; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 663 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | base = 10; |
| 665 | } |
| 666 | } |
| 667 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 668 | /* Any string left? Check that '0x' is not followed by white space. */ |
| 669 | |
| 670 | if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { |
| 671 | if (to_integer_op) { |
| 672 | goto error_exit; |
| 673 | } else { |
| 674 | goto all_done; |
| 675 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 676 | } |
| 677 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 678 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 680 | /* At least one character in the string here */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 681 | |
| 682 | /* Main loop: convert the string to a 64-bit integer */ |
| 683 | |
| 684 | while (*string) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 685 | if (ACPI_IS_DIGIT(*string)) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 686 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 687 | /* Convert ASCII 0-9 to Decimal value */ |
| 688 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 689 | this_digit = ((u8) * string) - '0'; |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 690 | } else if (base == 10) { |
| 691 | |
| 692 | /* Digit is out of range; possible in to_integer case only */ |
| 693 | |
| 694 | term = 1; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 695 | } else { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 696 | this_digit = (u8) ACPI_TOUPPER(*string); |
| 697 | if (ACPI_IS_XDIGIT((char)this_digit)) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 698 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | /* Convert ASCII Hex char to value */ |
| 700 | |
| 701 | this_digit = this_digit - 'A' + 10; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 702 | } else { |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 703 | term = 1; |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | if (term) { |
| 708 | if (to_integer_op) { |
| 709 | goto error_exit; |
| 710 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 711 | break; |
| 712 | } |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 713 | } else if ((valid_digits == 0) && (this_digit == 0) |
| 714 | && !sign_of0x) { |
| 715 | |
| 716 | /* Skip zeros */ |
| 717 | string++; |
| 718 | continue; |
| 719 | } |
| 720 | |
| 721 | valid_digits++; |
| 722 | |
| 723 | if (sign_of0x |
| 724 | && ((valid_digits > 16) |
| 725 | || ((valid_digits > 8) && mode32))) { |
| 726 | /* |
| 727 | * This is to_integer operation case. |
| 728 | * No any restrictions for string-to-integer conversion, |
| 729 | * see ACPI spec. |
| 730 | */ |
| 731 | goto error_exit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | /* Divide the digit into the correct position */ |
| 735 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 736 | (void) |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 737 | acpi_ut_short_divide((dividend - (acpi_integer) this_digit), |
| 738 | base, "ient, NULL); |
| 739 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 740 | if (return_value > quotient) { |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 741 | if (to_integer_op) { |
| 742 | goto error_exit; |
| 743 | } else { |
| 744 | break; |
| 745 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | return_value *= base; |
| 749 | return_value += this_digit; |
| 750 | string++; |
| 751 | } |
| 752 | |
| 753 | /* All done, normal exit */ |
| 754 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 755 | all_done: |
| 756 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 757 | *ret_integer = return_value; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 758 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 759 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 760 | error_exit: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 761 | /* Base was set/validated above */ |
| 762 | |
| 763 | if (base == 10) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 764 | return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT); |
| 765 | } else { |
| 766 | return_ACPI_STATUS(AE_BAD_HEX_CONSTANT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 767 | } |
| 768 | } |
| 769 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 770 | /******************************************************************************* |
| 771 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 772 | * FUNCTION: acpi_ut_create_update_state_and_push |
| 773 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 774 | * PARAMETERS: Object - Object to be added to the new state |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 775 | * Action - Increment/Decrement |
| 776 | * state_list - List the state will be added to |
| 777 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 778 | * RETURN: Status |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 | * |
| 780 | * DESCRIPTION: Create a new state and push it |
| 781 | * |
| 782 | ******************************************************************************/ |
| 783 | |
| 784 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 785 | acpi_ut_create_update_state_and_push(union acpi_operand_object *object, |
| 786 | u16 action, |
| 787 | union acpi_generic_state **state_list) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 788 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 789 | union acpi_generic_state *state; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 790 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 791 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 792 | |
| 793 | /* Ignore null objects; these are expected */ |
| 794 | |
| 795 | if (!object) { |
| 796 | return (AE_OK); |
| 797 | } |
| 798 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 799 | state = acpi_ut_create_update_state(object, action); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | if (!state) { |
| 801 | return (AE_NO_MEMORY); |
| 802 | } |
| 803 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 804 | acpi_ut_push_generic_state(state_list, state); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 805 | return (AE_OK); |
| 806 | } |
| 807 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 808 | /******************************************************************************* |
| 809 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 810 | * FUNCTION: acpi_ut_walk_package_tree |
| 811 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 812 | * PARAMETERS: source_object - The package to walk |
| 813 | * target_object - Target object (if package is being copied) |
| 814 | * walk_callback - Called once for each package element |
| 815 | * Context - Passed to the callback function |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 816 | * |
| 817 | * RETURN: Status |
| 818 | * |
| 819 | * DESCRIPTION: Walk through a package |
| 820 | * |
| 821 | ******************************************************************************/ |
| 822 | |
| 823 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 824 | acpi_ut_walk_package_tree(union acpi_operand_object * source_object, |
| 825 | void *target_object, |
| 826 | acpi_pkg_callback walk_callback, void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 827 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 828 | acpi_status status = AE_OK; |
| 829 | union acpi_generic_state *state_list = NULL; |
| 830 | union acpi_generic_state *state; |
| 831 | u32 this_index; |
| 832 | union acpi_operand_object *this_source_obj; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 833 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 834 | ACPI_FUNCTION_TRACE(ut_walk_package_tree); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 835 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 836 | state = acpi_ut_create_pkg_state(source_object, target_object, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 837 | if (!state) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 838 | return_ACPI_STATUS(AE_NO_MEMORY); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 839 | } |
| 840 | |
| 841 | while (state) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 842 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | /* Get one element of the package */ |
| 844 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 845 | this_index = state->pkg.index; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 846 | this_source_obj = (union acpi_operand_object *) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 847 | state->pkg.source_object->package.elements[this_index]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 848 | |
| 849 | /* |
| 850 | * Check for: |
| 851 | * 1) An uninitialized package element. It is completely |
| 852 | * legal to declare a package and leave it uninitialized |
| 853 | * 2) Not an internal object - can be a namespace node instead |
| 854 | * 3) Any type other than a package. Packages are handled in else |
| 855 | * case below. |
| 856 | */ |
| 857 | if ((!this_source_obj) || |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 858 | (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) != |
| 859 | ACPI_DESC_TYPE_OPERAND) |
| 860 | || (ACPI_GET_OBJECT_TYPE(this_source_obj) != |
| 861 | ACPI_TYPE_PACKAGE)) { |
| 862 | status = |
| 863 | walk_callback(ACPI_COPY_TYPE_SIMPLE, |
| 864 | this_source_obj, state, context); |
| 865 | if (ACPI_FAILURE(status)) { |
| 866 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 867 | } |
| 868 | |
| 869 | state->pkg.index++; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 870 | while (state->pkg.index >= |
| 871 | state->pkg.source_object->package.count) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 872 | /* |
| 873 | * We've handled all of the objects at this level, This means |
| 874 | * that we have just completed a package. That package may |
| 875 | * have contained one or more packages itself. |
| 876 | * |
| 877 | * Delete this state and pop the previous state (package). |
| 878 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 879 | acpi_ut_delete_generic_state(state); |
| 880 | state = acpi_ut_pop_generic_state(&state_list); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 881 | |
| 882 | /* Finished when there are no more states */ |
| 883 | |
| 884 | if (!state) { |
| 885 | /* |
| 886 | * We have handled all of the objects in the top level |
| 887 | * package just add the length of the package objects |
| 888 | * and exit |
| 889 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 890 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 891 | } |
| 892 | |
| 893 | /* |
| 894 | * Go back up a level and move the index past the just |
| 895 | * completed package object. |
| 896 | */ |
| 897 | state->pkg.index++; |
| 898 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 899 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 900 | /* This is a subobject of type package */ |
| 901 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 902 | status = |
| 903 | walk_callback(ACPI_COPY_TYPE_PACKAGE, |
| 904 | this_source_obj, state, context); |
| 905 | if (ACPI_FAILURE(status)) { |
| 906 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 907 | } |
| 908 | |
| 909 | /* |
| 910 | * Push the current state and create a new one |
| 911 | * The callback above returned a new target package object. |
| 912 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 913 | acpi_ut_push_generic_state(&state_list, state); |
| 914 | state = acpi_ut_create_pkg_state(this_source_obj, |
| 915 | state->pkg. |
| 916 | this_target_obj, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 917 | if (!state) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 918 | return_ACPI_STATUS(AE_NO_MEMORY); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 919 | } |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | /* We should never get here */ |
| 924 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 925 | return_ACPI_STATUS(AE_AML_INTERNAL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 926 | } |
| 927 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 928 | /******************************************************************************* |
| 929 | * |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 930 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info |
| 931 | * |
| 932 | * PARAMETERS: module_name - Caller's module name (for error output) |
| 933 | * line_number - Caller's line number (for error output) |
| 934 | * Format - Printf format string + additional args |
| 935 | * |
| 936 | * RETURN: None |
| 937 | * |
| 938 | * DESCRIPTION: Print message with module/line/version info |
| 939 | * |
| 940 | ******************************************************************************/ |
| 941 | |
| 942 | void ACPI_INTERNAL_VAR_XFACE |
| 943 | acpi_ut_error(char *module_name, u32 line_number, char *format, ...) |
| 944 | { |
| 945 | va_list args; |
| 946 | |
| 947 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
| 948 | |
| 949 | va_start(args, format); |
| 950 | acpi_os_vprintf(format, args); |
| 951 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
| 952 | } |
Thomas Renninger | be63c92 | 2006-06-02 15:58:00 -0400 | [diff] [blame^] | 953 | EXPORT_SYMBOL(acpi_ut_error); |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 954 | |
| 955 | void ACPI_INTERNAL_VAR_XFACE |
| 956 | acpi_ut_exception(char *module_name, |
| 957 | u32 line_number, acpi_status status, char *format, ...) |
| 958 | { |
| 959 | va_list args; |
| 960 | |
| 961 | acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name, |
| 962 | line_number, acpi_format_exception(status)); |
| 963 | |
| 964 | va_start(args, format); |
| 965 | acpi_os_vprintf(format, args); |
| 966 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
| 967 | } |
Thomas Renninger | be63c92 | 2006-06-02 15:58:00 -0400 | [diff] [blame^] | 968 | EXPORT_SYMBOL(acpi_ut_exception); |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 969 | |
| 970 | void ACPI_INTERNAL_VAR_XFACE |
| 971 | acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) |
| 972 | { |
| 973 | va_list args; |
| 974 | |
| 975 | acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); |
| 976 | |
| 977 | va_start(args, format); |
| 978 | acpi_os_vprintf(format, args); |
| 979 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
| 980 | } |
Thomas Renninger | be63c92 | 2006-06-02 15:58:00 -0400 | [diff] [blame^] | 981 | EXPORT_SYMBOL(acpi_ut_warning); |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 982 | void ACPI_INTERNAL_VAR_XFACE |
| 983 | acpi_ut_info(char *module_name, u32 line_number, char *format, ...) |
| 984 | { |
| 985 | va_list args; |
| 986 | |
| 987 | acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); |
| 988 | |
| 989 | va_start(args, format); |
| 990 | acpi_os_vprintf(format, args); |
| 991 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
| 992 | } |