diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-12 19:04:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-12 19:04:50 -0400 |
commit | 3f603ed319d5120e883e64ac5967b2fc848fc43b (patch) | |
tree | 52ef311c245e4e4cd623b546ea1daf05a5ea8911 /drivers/acpi/executer/exnames.c | |
parent | 55ee3b8365fd5d301b9076eea739146f2b91e82c (diff) | |
parent | 5028770a42e7bc4d15791a44c28f0ad539323807 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-2.6
Diffstat (limited to 'drivers/acpi/executer/exnames.c')
-rw-r--r-- | drivers/acpi/executer/exnames.c | 70 |
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 */ | 55 | static char * |
56 | acpi_ex_allocate_name_string ( | ||
57 | u32 prefix_count, | ||
58 | u32 num_name_segs); | ||
55 | 59 | ||
56 | #define ACPI_AML_PACKAGE_TYPE1 0x40 | 60 | static acpi_status |
57 | #define ACPI_AML_PACKAGE_TYPE2 0x4000 | 61 | acpi_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 | ||
78 | char * | 82 | static char * |
79 | acpi_ex_allocate_name_string ( | 83 | acpi_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 | ||
163 | acpi_status | 170 | static acpi_status |
164 | acpi_ex_name_segment ( | 171 | acpi_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 */ |