aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exnames.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-04-18 22:49:35 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 00:08:52 -0400
commit44f6c01242da4e162f28d8e1216a8c7a91174605 (patch)
tree53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/executer/exnames.c
parentebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff)
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exnames.c')
-rw-r--r--drivers/acpi/executer/exnames.c70
1 files changed, 45 insertions, 25 deletions
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 7911c533c265..639f0bd3f6d8 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -50,13 +50,17 @@
50#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
51 ACPI_MODULE_NAME ("exnames") 51 ACPI_MODULE_NAME ("exnames")
52 52
53/* Local prototypes */
53 54
54/* AML Package Length encodings */ 55static char *
56acpi_ex_allocate_name_string (
57 u32 prefix_count,
58 u32 num_name_segs);
55 59
56#define ACPI_AML_PACKAGE_TYPE1 0x40 60static acpi_status
57#define ACPI_AML_PACKAGE_TYPE2 0x4000 61acpi_ex_name_segment (
58#define ACPI_AML_PACKAGE_TYPE3 0x400000 62 u8 **in_aml_address,
59#define ACPI_AML_PACKAGE_TYPE4 0x40000000 63 char *name_string);
60 64
61 65
62/******************************************************************************* 66/*******************************************************************************
@@ -64,7 +68,7 @@
64 * FUNCTION: acpi_ex_allocate_name_string 68 * FUNCTION: acpi_ex_allocate_name_string
65 * 69 *
66 * PARAMETERS: prefix_count - Count of parent levels. Special cases: 70 * PARAMETERS: prefix_count - Count of parent levels. Special cases:
67 * (-1) = root, 0 = none 71 * (-1)==root, 0==none
68 * num_name_segs - count of 4-character name segments 72 * num_name_segs - count of 4-character name segments
69 * 73 *
70 * RETURN: A pointer to the allocated string segment. This segment must 74 * RETURN: A pointer to the allocated string segment. This segment must
@@ -75,7 +79,7 @@
75 * 79 *
76 ******************************************************************************/ 80 ******************************************************************************/
77 81
78char * 82static char *
79acpi_ex_allocate_name_string ( 83acpi_ex_allocate_name_string (
80 u32 prefix_count, 84 u32 prefix_count,
81 u32 num_name_segs) 85 u32 num_name_segs)
@@ -88,7 +92,7 @@ acpi_ex_allocate_name_string (
88 92
89 93
90 /* 94 /*
91 * Allow room for all \ and ^ prefixes, all segments, and a multi_name_prefix. 95 * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
92 * Also, one byte for the null terminator. 96 * Also, one byte for the null terminator.
93 * This may actually be somewhat longer than needed. 97 * This may actually be somewhat longer than needed.
94 */ 98 */
@@ -107,7 +111,8 @@ acpi_ex_allocate_name_string (
107 */ 111 */
108 name_string = ACPI_MEM_ALLOCATE (size_needed); 112 name_string = ACPI_MEM_ALLOCATE (size_needed);
109 if (!name_string) { 113 if (!name_string) {
110 ACPI_REPORT_ERROR (("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); 114 ACPI_REPORT_ERROR ((
115 "ex_allocate_name_string: Could not allocate size %d\n", size_needed));
111 return_PTR (NULL); 116 return_PTR (NULL);
112 } 117 }
113 118
@@ -152,15 +157,17 @@ acpi_ex_allocate_name_string (
152 * 157 *
153 * FUNCTION: acpi_ex_name_segment 158 * FUNCTION: acpi_ex_name_segment
154 * 159 *
155 * PARAMETERS: interpreter_mode - Current running mode (load1/Load2/Exec) 160 * PARAMETERS: in_aml_address - Pointer to the name in the AML code
161 * name_string - Where to return the name. The name is appended
162 * to any existing string to form a namepath
156 * 163 *
157 * RETURN: Status 164 * RETURN: Status
158 * 165 *
159 * DESCRIPTION: Execute a name segment (4 bytes) 166 * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream
160 * 167 *
161 ******************************************************************************/ 168 ******************************************************************************/
162 169
163acpi_status 170static acpi_status
164acpi_ex_name_segment ( 171acpi_ex_name_segment (
165 u8 **in_aml_address, 172 u8 **in_aml_address,
166 char *name_string) 173 char *name_string)
@@ -223,10 +230,13 @@ acpi_ex_name_segment (
223 status = AE_CTRL_PENDING; 230 status = AE_CTRL_PENDING;
224 } 231 }
225 else { 232 else {
226 /* Segment started with one or more valid characters, but fewer than 4 */ 233 /*
227 234 * Segment started with one or more valid characters, but fewer than
235 * the required 4
236 */
228 status = AE_AML_BAD_NAME; 237 status = AE_AML_BAD_NAME;
229 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n", 238 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
239 "Bad character %02x in name, at %p\n",
230 *aml_address, aml_address)); 240 *aml_address, aml_address));
231 } 241 }
232 242
@@ -239,11 +249,16 @@ acpi_ex_name_segment (
239 * 249 *
240 * FUNCTION: acpi_ex_get_name_string 250 * FUNCTION: acpi_ex_get_name_string
241 * 251 *
242 * PARAMETERS: data_type - Data type to be associated with this name 252 * PARAMETERS: data_type - Object type to be associated with this
253 * name
254 * in_aml_address - Pointer to the namestring in the AML code
255 * out_name_string - Where the namestring is returned
256 * out_name_length - Length of the returned string
243 * 257 *
244 * RETURN: Status 258 * RETURN: Status, namestring and length
245 * 259 *
246 * DESCRIPTION: Get a name, including any prefixes. 260 * DESCRIPTION: Extract a full namepath from the AML byte stream,
261 * including any prefixes.
247 * 262 *
248 ******************************************************************************/ 263 ******************************************************************************/
249 264
@@ -286,7 +301,8 @@ acpi_ex_get_name_string (
286 switch (*aml_address) { 301 switch (*aml_address) {
287 case AML_ROOT_PREFIX: 302 case AML_ROOT_PREFIX:
288 303
289 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", aml_address)); 304 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
305 aml_address));
290 306
291 /* 307 /*
292 * Remember that we have a root_prefix -- 308 * Remember that we have a root_prefix --
@@ -303,7 +319,8 @@ acpi_ex_get_name_string (
303 /* Increment past possibly multiple parent prefixes */ 319 /* Increment past possibly multiple parent prefixes */
304 320
305 do { 321 do {
306 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", aml_address)); 322 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
323 aml_address));
307 324
308 aml_address++; 325 aml_address++;
309 prefix_count++; 326 prefix_count++;
@@ -321,13 +338,13 @@ acpi_ex_get_name_string (
321 break; 338 break;
322 } 339 }
323 340
324
325 /* Examine first character of name for name segment prefix operator */ 341 /* Examine first character of name for name segment prefix operator */
326 342
327 switch (*aml_address) { 343 switch (*aml_address) {
328 case AML_DUAL_NAME_PREFIX: 344 case AML_DUAL_NAME_PREFIX:
329 345
330 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", aml_address)); 346 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
347 aml_address));
331 348
332 aml_address++; 349 aml_address++;
333 name_string = acpi_ex_allocate_name_string (prefix_count, 2); 350 name_string = acpi_ex_allocate_name_string (prefix_count, 2);
@@ -349,7 +366,8 @@ acpi_ex_get_name_string (
349 366
350 case AML_MULTI_NAME_PREFIX_OP: 367 case AML_MULTI_NAME_PREFIX_OP:
351 368
352 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", aml_address)); 369 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
370 aml_address));
353 371
354 /* Fetch count of segments remaining in name path */ 372 /* Fetch count of segments remaining in name path */
355 373
@@ -368,7 +386,8 @@ acpi_ex_get_name_string (
368 has_prefix = TRUE; 386 has_prefix = TRUE;
369 387
370 while (num_segments && 388 while (num_segments &&
371 (status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) { 389 (status = acpi_ex_name_segment (&aml_address, name_string)) ==
390 AE_OK) {
372 num_segments--; 391 num_segments--;
373 } 392 }
374 393
@@ -380,7 +399,8 @@ acpi_ex_get_name_string (
380 /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ 399 /* null_name valid as of 8-12-98 ASL/AML Grammar Update */
381 400
382 if (prefix_count == ACPI_UINT32_MAX) { 401 if (prefix_count == ACPI_UINT32_MAX) {
383 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "name_seg is \"\\\" followed by NULL\n")); 402 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
403 "name_seg is \"\\\" followed by NULL\n"));
384 } 404 }
385 405
386 /* Consume the NULL byte */ 406 /* Consume the NULL byte */