diff options
Diffstat (limited to 'drivers/acpi/executer/exnames.c')
| -rw-r--r-- | drivers/acpi/executer/exnames.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 054fe5e1a314..d3d70364626c 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
| @@ -77,7 +77,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
| 77 | char *name_string; | 77 | char *name_string; |
| 78 | u32 size_needed; | 78 | u32 size_needed; |
| 79 | 79 | ||
| 80 | ACPI_FUNCTION_TRACE("ex_allocate_name_string"); | 80 | ACPI_FUNCTION_TRACE(ex_allocate_name_string); |
| 81 | 81 | ||
| 82 | /* | 82 | /* |
| 83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. | 83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. |
| @@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
| 85 | * This may actually be somewhat longer than needed. | 85 | * This may actually be somewhat longer than needed. |
| 86 | */ | 86 | */ |
| 87 | if (prefix_count == ACPI_UINT32_MAX) { | 87 | if (prefix_count == ACPI_UINT32_MAX) { |
| 88 | |||
| 88 | /* Special case for root */ | 89 | /* Special case for root */ |
| 89 | 90 | ||
| 90 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; | 91 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; |
| @@ -97,7 +98,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
| 97 | * Allocate a buffer for the name. | 98 | * Allocate a buffer for the name. |
| 98 | * This buffer must be deleted by the caller! | 99 | * This buffer must be deleted by the caller! |
| 99 | */ | 100 | */ |
| 100 | name_string = ACPI_MEM_ALLOCATE(size_needed); | 101 | name_string = ACPI_ALLOCATE(size_needed); |
| 101 | if (!name_string) { | 102 | if (!name_string) { |
| 102 | ACPI_ERROR((AE_INFO, | 103 | ACPI_ERROR((AE_INFO, |
| 103 | "Could not allocate size %d", size_needed)); | 104 | "Could not allocate size %d", size_needed)); |
| @@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
| 119 | /* Set up Dual or Multi prefixes if needed */ | 120 | /* Set up Dual or Multi prefixes if needed */ |
| 120 | 121 | ||
| 121 | if (num_name_segs > 2) { | 122 | if (num_name_segs > 2) { |
| 123 | |||
| 122 | /* Set up multi prefixes */ | 124 | /* Set up multi prefixes */ |
| 123 | 125 | ||
| 124 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; | 126 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; |
| 125 | *temp_ptr++ = (char)num_name_segs; | 127 | *temp_ptr++ = (char)num_name_segs; |
| 126 | } else if (2 == num_name_segs) { | 128 | } else if (2 == num_name_segs) { |
| 129 | |||
| 127 | /* Set up dual prefixes */ | 130 | /* Set up dual prefixes */ |
| 128 | 131 | ||
| 129 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; | 132 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; |
| @@ -159,7 +162,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
| 159 | u32 index; | 162 | u32 index; |
| 160 | char char_buf[5]; | 163 | char char_buf[5]; |
| 161 | 164 | ||
| 162 | ACPI_FUNCTION_TRACE("ex_name_segment"); | 165 | ACPI_FUNCTION_TRACE(ex_name_segment); |
| 163 | 166 | ||
| 164 | /* | 167 | /* |
| 165 | * If first character is a digit, then we know that we aren't looking at a | 168 | * If first character is a digit, then we know that we aren't looking at a |
| @@ -176,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
| 176 | 179 | ||
| 177 | for (index = 0; | 180 | for (index = 0; |
| 178 | (index < ACPI_NAME_SIZE) | 181 | (index < ACPI_NAME_SIZE) |
| 179 | && (acpi_ut_valid_acpi_character(*aml_address)); index++) { | 182 | && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { |
| 180 | char_buf[index] = *aml_address++; | 183 | char_buf[index] = *aml_address++; |
| 181 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); | 184 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); |
| 182 | } | 185 | } |
| @@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
| 184 | /* Valid name segment */ | 187 | /* Valid name segment */ |
| 185 | 188 | ||
| 186 | if (index == 4) { | 189 | if (index == 4) { |
| 190 | |||
| 187 | /* Found 4 valid characters */ | 191 | /* Found 4 valid characters */ |
| 188 | 192 | ||
| 189 | char_buf[4] = '\0'; | 193 | char_buf[4] = '\0'; |
| @@ -249,11 +253,12 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 249 | u32 prefix_count = 0; | 253 | u32 prefix_count = 0; |
| 250 | u8 has_prefix = FALSE; | 254 | u8 has_prefix = FALSE; |
| 251 | 255 | ||
| 252 | ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); | 256 | ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address); |
| 253 | 257 | ||
| 254 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || | 258 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || |
| 255 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || | 259 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || |
| 256 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { | 260 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { |
| 261 | |||
| 257 | /* Disallow prefixes for types associated with field_unit names */ | 262 | /* Disallow prefixes for types associated with field_unit names */ |
| 258 | 263 | ||
| 259 | name_string = acpi_ex_allocate_name_string(0, 1); | 264 | name_string = acpi_ex_allocate_name_string(0, 1); |
| @@ -272,7 +277,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 272 | case AML_ROOT_PREFIX: | 277 | case AML_ROOT_PREFIX: |
| 273 | 278 | ||
| 274 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 279 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
| 275 | "root_prefix(\\) at %p\n", | 280 | "RootPrefix(\\) at %p\n", |
| 276 | aml_address)); | 281 | aml_address)); |
| 277 | 282 | ||
| 278 | /* | 283 | /* |
| @@ -290,7 +295,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 290 | 295 | ||
| 291 | do { | 296 | do { |
| 292 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 297 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
| 293 | "parent_prefix (^) at %p\n", | 298 | "ParentPrefix (^) at %p\n", |
| 294 | aml_address)); | 299 | aml_address)); |
| 295 | 300 | ||
| 296 | aml_address++; | 301 | aml_address++; |
| @@ -314,7 +319,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 314 | case AML_DUAL_NAME_PREFIX: | 319 | case AML_DUAL_NAME_PREFIX: |
| 315 | 320 | ||
| 316 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 321 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
| 317 | "dual_name_prefix at %p\n", | 322 | "DualNamePrefix at %p\n", |
| 318 | aml_address)); | 323 | aml_address)); |
| 319 | 324 | ||
| 320 | aml_address++; | 325 | aml_address++; |
| @@ -341,7 +346,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 341 | case AML_MULTI_NAME_PREFIX_OP: | 346 | case AML_MULTI_NAME_PREFIX_OP: |
| 342 | 347 | ||
| 343 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 348 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
| 344 | "multi_name_prefix at %p\n", | 349 | "MultiNamePrefix at %p\n", |
| 345 | aml_address)); | 350 | aml_address)); |
| 346 | 351 | ||
| 347 | /* Fetch count of segments remaining in name path */ | 352 | /* Fetch count of segments remaining in name path */ |
| @@ -377,7 +382,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 377 | 382 | ||
| 378 | if (prefix_count == ACPI_UINT32_MAX) { | 383 | if (prefix_count == ACPI_UINT32_MAX) { |
| 379 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 384 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 380 | "name_seg is \"\\\" followed by NULL\n")); | 385 | "NameSeg is \"\\\" followed by NULL\n")); |
| 381 | } | 386 | } |
| 382 | 387 | ||
| 383 | /* Consume the NULL byte */ | 388 | /* Consume the NULL byte */ |
| @@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 410 | } | 415 | } |
| 411 | 416 | ||
| 412 | if (AE_CTRL_PENDING == status && has_prefix) { | 417 | if (AE_CTRL_PENDING == status && has_prefix) { |
| 418 | |||
| 413 | /* Ran out of segments after processing a prefix */ | 419 | /* Ran out of segments after processing a prefix */ |
| 414 | 420 | ||
| 415 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); | 421 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); |
| @@ -418,7 +424,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
| 418 | 424 | ||
| 419 | if (ACPI_FAILURE(status)) { | 425 | if (ACPI_FAILURE(status)) { |
| 420 | if (name_string) { | 426 | if (name_string) { |
| 421 | ACPI_MEM_FREE(name_string); | 427 | ACPI_FREE(name_string); |
| 422 | } | 428 | } |
| 423 | return_ACPI_STATUS(status); | 429 | return_ACPI_STATUS(status); |
| 424 | } | 430 | } |
