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