diff options
author | Robert Moore <Robert.Moore@intel.com> | 2005-09-02 17:24:17 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-09-03 00:15:11 -0400 |
commit | aff8c2777d1a9edf97f26bf60579f9c931443eb1 (patch) | |
tree | fcd5bfe84e0e3aeb328d60ec41776522b9b7d122 /drivers | |
parent | a94f18810f52d3a6de0a09bee0c7258b62eca262 (diff) |
[ACPI] ACPICA 20050902
Fixed a problem with the internal Owner ID allocation and
deallocation mechanisms for control method execution and
recursive method invocation. This should eliminate the
OWNER_ID_LIMIT exceptions and "Invalid OwnerId" messages
seen on some systems. Recursive method invocation depth
is currently limited to 255. (Alexey Starikovskiy)
http://bugzilla.kernel.org/show_bug.cgi?id=4892
Completely eliminated all vestiges of support for the
"module-level executable code" until this support is
fully implemented and debugged. This should eliminate the
NO_RETURN_VALUE exceptions seen during table load on some
systems that invoke this support.
http://bugzilla.kernel.org/show_bug.cgi?id=5162
Fixed a problem within the resource manager code where
the transaction flags for a 64-bit address descriptor were
handled incorrectly in the type-specific flag byte.
Consolidated duplicate code within the address descriptor
resource manager code, reducing overall subsystem code size.
Signed-off-by: Robert Moore <Robert.Moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 69 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswload.c | 5 | ||||
-rw-r--r-- | drivers/acpi/parser/psparse.c | 23 | ||||
-rw-r--r-- | drivers/acpi/parser/psxface.c | 14 | ||||
-rw-r--r-- | drivers/acpi/resources/rsaddr.c | 542 | ||||
-rw-r--r-- | drivers/acpi/resources/rsirq.c | 21 | ||||
-rw-r--r-- | drivers/acpi/utilities/utmisc.c | 15 |
7 files changed, 331 insertions, 358 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 77fcfc3070db..36c1ca0b9adb 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -207,6 +207,13 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
207 | return_ACPI_STATUS(AE_NULL_ENTRY); | 207 | return_ACPI_STATUS(AE_NULL_ENTRY); |
208 | } | 208 | } |
209 | 209 | ||
210 | /* Prevent wraparound of thread count */ | ||
211 | |||
212 | if (obj_desc->method.thread_count == ACPI_UINT8_MAX) { | ||
213 | ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n")); | ||
214 | return_ACPI_STATUS(AE_AML_METHOD_LIMIT); | ||
215 | } | ||
216 | |||
210 | /* | 217 | /* |
211 | * If there is a concurrency limit on this method, we need to | 218 | * If there is a concurrency limit on this method, we need to |
212 | * obtain a unit from the method semaphore. | 219 | * obtain a unit from the method semaphore. |
@@ -237,6 +244,18 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
237 | } | 244 | } |
238 | 245 | ||
239 | /* | 246 | /* |
247 | * Allocate an Owner ID for this method, only if this is the first thread | ||
248 | * to begin concurrent execution. We only need one owner_id, even if the | ||
249 | * method is invoked recursively. | ||
250 | */ | ||
251 | if (!obj_desc->method.owner_id) { | ||
252 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | ||
253 | if (ACPI_FAILURE(status)) { | ||
254 | return_ACPI_STATUS(status); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | /* | ||
240 | * Increment the method parse tree thread count since it has been | 259 | * Increment the method parse tree thread count since it has been |
241 | * reentered one more time (even if it is the same thread) | 260 | * reentered one more time (even if it is the same thread) |
242 | */ | 261 | */ |
@@ -289,11 +308,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
289 | return_ACPI_STATUS(AE_NULL_OBJECT); | 308 | return_ACPI_STATUS(AE_NULL_OBJECT); |
290 | } | 309 | } |
291 | 310 | ||
292 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | ||
293 | if (ACPI_FAILURE(status)) { | ||
294 | return_ACPI_STATUS(status); | ||
295 | } | ||
296 | |||
297 | /* Init for new method, wait on concurrency semaphore */ | 311 | /* Init for new method, wait on concurrency semaphore */ |
298 | 312 | ||
299 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 313 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
@@ -345,9 +359,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
345 | } | 359 | } |
346 | /* | 360 | /* |
347 | * The resolved arguments were put on the previous walk state's operand | 361 | * The resolved arguments were put on the previous walk state's operand |
348 | * stack. Operands on the previous walk state stack always | 362 | * stack. Operands on the previous walk state stack always |
349 | * start at index 0. | 363 | * start at index 0. Also, null terminate the list of arguments |
350 | * Null terminate the list of arguments | ||
351 | */ | 364 | */ |
352 | this_walk_state->operands[this_walk_state->num_operands] = NULL; | 365 | this_walk_state->operands[this_walk_state->num_operands] = NULL; |
353 | 366 | ||
@@ -380,21 +393,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
380 | 393 | ||
381 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 394 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
382 | status = obj_desc->method.implementation(next_walk_state); | 395 | status = obj_desc->method.implementation(next_walk_state); |
383 | return_ACPI_STATUS(status); | ||
384 | } | 396 | } |
385 | 397 | ||
386 | return_ACPI_STATUS(AE_OK); | 398 | return_ACPI_STATUS(status); |
387 | |||
388 | /* On error, we must delete the new walk state */ | ||
389 | 399 | ||
390 | cleanup: | 400 | cleanup: |
391 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); | 401 | /* Decrement the thread count on the method parse tree */ |
392 | if (next_walk_state && (next_walk_state->method_desc)) { | ||
393 | /* Decrement the thread count on the method parse tree */ | ||
394 | 402 | ||
403 | if (next_walk_state && (next_walk_state->method_desc)) { | ||
395 | next_walk_state->method_desc->method.thread_count--; | 404 | next_walk_state->method_desc->method.thread_count--; |
396 | } | 405 | } |
397 | (void)acpi_ds_terminate_control_method(next_walk_state); | 406 | |
407 | /* On error, we must delete the new walk state */ | ||
408 | |||
409 | acpi_ds_terminate_control_method(next_walk_state); | ||
398 | acpi_ds_delete_walk_state(next_walk_state); | 410 | acpi_ds_delete_walk_state(next_walk_state); |
399 | return_ACPI_STATUS(status); | 411 | return_ACPI_STATUS(status); |
400 | } | 412 | } |
@@ -479,7 +491,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
479 | * | 491 | * |
480 | * PARAMETERS: walk_state - State of the method | 492 | * PARAMETERS: walk_state - State of the method |
481 | * | 493 | * |
482 | * RETURN: Status | 494 | * RETURN: None |
483 | * | 495 | * |
484 | * DESCRIPTION: Terminate a control method. Delete everything that the method | 496 | * DESCRIPTION: Terminate a control method. Delete everything that the method |
485 | * created, delete all locals and arguments, and delete the parse | 497 | * created, delete all locals and arguments, and delete the parse |
@@ -487,7 +499,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
487 | * | 499 | * |
488 | ******************************************************************************/ | 500 | ******************************************************************************/ |
489 | 501 | ||
490 | acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 502 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) |
491 | { | 503 | { |
492 | union acpi_operand_object *obj_desc; | 504 | union acpi_operand_object *obj_desc; |
493 | struct acpi_namespace_node *method_node; | 505 | struct acpi_namespace_node *method_node; |
@@ -496,14 +508,14 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
496 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 508 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); |
497 | 509 | ||
498 | if (!walk_state) { | 510 | if (!walk_state) { |
499 | return (AE_BAD_PARAMETER); | 511 | return_VOID; |
500 | } | 512 | } |
501 | 513 | ||
502 | /* The current method object was saved in the walk state */ | 514 | /* The current method object was saved in the walk state */ |
503 | 515 | ||
504 | obj_desc = walk_state->method_desc; | 516 | obj_desc = walk_state->method_desc; |
505 | if (!obj_desc) { | 517 | if (!obj_desc) { |
506 | return_ACPI_STATUS(AE_OK); | 518 | return_VOID; |
507 | } | 519 | } |
508 | 520 | ||
509 | /* Delete all arguments and locals */ | 521 | /* Delete all arguments and locals */ |
@@ -517,7 +529,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
517 | */ | 529 | */ |
518 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 530 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); |
519 | if (ACPI_FAILURE(status)) { | 531 | if (ACPI_FAILURE(status)) { |
520 | return_ACPI_STATUS(status); | 532 | return_VOID; |
521 | } | 533 | } |
522 | 534 | ||
523 | /* Signal completion of the execution of this method if necessary */ | 535 | /* Signal completion of the execution of this method if necessary */ |
@@ -528,7 +540,6 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
528 | semaphore, 1); | 540 | semaphore, 1); |
529 | if (ACPI_FAILURE(status)) { | 541 | if (ACPI_FAILURE(status)) { |
530 | ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); | 542 | ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); |
531 | status = AE_OK; | ||
532 | 543 | ||
533 | /* Ignore error and continue cleanup */ | 544 | /* Ignore error and continue cleanup */ |
534 | } | 545 | } |
@@ -539,9 +550,8 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
539 | "*** Not deleting method namespace, there are still %d threads\n", | 550 | "*** Not deleting method namespace, there are still %d threads\n", |
540 | walk_state->method_desc->method. | 551 | walk_state->method_desc->method. |
541 | thread_count)); | 552 | thread_count)); |
542 | } | 553 | } else { /* This is the last executing thread */ |
543 | 554 | ||
544 | if (!walk_state->method_desc->method.thread_count) { | ||
545 | /* | 555 | /* |
546 | * Support to dynamically change a method from not_serialized to | 556 | * Support to dynamically change a method from not_serialized to |
547 | * Serialized if it appears that the method is written foolishly and | 557 | * Serialized if it appears that the method is written foolishly and |
@@ -574,7 +584,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
574 | */ | 584 | */ |
575 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 585 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
576 | if (ACPI_FAILURE(status)) { | 586 | if (ACPI_FAILURE(status)) { |
577 | return_ACPI_STATUS(status); | 587 | goto exit; |
578 | } | 588 | } |
579 | 589 | ||
580 | if (method_node->child) { | 590 | if (method_node->child) { |
@@ -590,12 +600,9 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
590 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 600 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
591 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | 601 | acpi_ut_release_owner_id(&walk_state->method_desc->method. |
592 | owner_id); | 602 | owner_id); |
593 | |||
594 | if (ACPI_FAILURE(status)) { | ||
595 | return_ACPI_STATUS(status); | ||
596 | } | ||
597 | } | 603 | } |
598 | 604 | ||
599 | status = acpi_ut_release_mutex(ACPI_MTX_PARSER); | 605 | exit: |
600 | return_ACPI_STATUS(status); | 606 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); |
607 | return_VOID; | ||
601 | } | 608 | } |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 362bbcfc1718..411731261c29 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -486,8 +486,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, | |||
486 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && | 486 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && |
487 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | 487 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || |
488 | (!(walk_state->op_info->flags & AML_NAMED))) { | 488 | (!(walk_state->op_info->flags & AML_NAMED))) { |
489 | #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE | ||
489 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 490 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
490 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | 491 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { |
492 | |||
491 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 493 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
492 | "Begin/EXEC: %s (fl %8.8X)\n", | 494 | "Begin/EXEC: %s (fl %8.8X)\n", |
493 | walk_state->op_info->name, | 495 | walk_state->op_info->name, |
@@ -499,6 +501,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, | |||
499 | acpi_ds_exec_begin_op(walk_state, out_op); | 501 | acpi_ds_exec_begin_op(walk_state, out_op); |
500 | return_ACPI_STATUS(status); | 502 | return_ACPI_STATUS(status); |
501 | } | 503 | } |
504 | #endif | ||
502 | return_ACPI_STATUS(AE_OK); | 505 | return_ACPI_STATUS(AE_OK); |
503 | } | 506 | } |
504 | 507 | ||
@@ -731,6 +734,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
731 | 734 | ||
732 | if (!(walk_state->op_info->flags & AML_NSOBJECT)) { | 735 | if (!(walk_state->op_info->flags & AML_NSOBJECT)) { |
733 | #ifndef ACPI_NO_METHOD_EXECUTION | 736 | #ifndef ACPI_NO_METHOD_EXECUTION |
737 | #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE | ||
734 | /* No namespace object. Executable opcode? */ | 738 | /* No namespace object. Executable opcode? */ |
735 | 739 | ||
736 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 740 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
@@ -746,6 +750,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
746 | return_ACPI_STATUS(status); | 750 | return_ACPI_STATUS(status); |
747 | } | 751 | } |
748 | #endif | 752 | #endif |
753 | #endif | ||
749 | return_ACPI_STATUS(AE_OK); | 754 | return_ACPI_STATUS(AE_OK); |
750 | } | 755 | } |
751 | 756 | ||
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 3248051d77ee..76d4d640d83c 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -438,7 +438,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
438 | acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | 438 | acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) |
439 | { | 439 | { |
440 | acpi_status status; | 440 | acpi_status status; |
441 | acpi_status terminate_status; | ||
442 | struct acpi_thread_state *thread; | 441 | struct acpi_thread_state *thread; |
443 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; | 442 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; |
444 | struct acpi_walk_state *previous_walk_state; | 443 | struct acpi_walk_state *previous_walk_state; |
@@ -508,6 +507,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
508 | walk_state->method_node, NULL, | 507 | walk_state->method_node, NULL, |
509 | status); | 508 | status); |
510 | 509 | ||
510 | /* Ensure proper cleanup */ | ||
511 | |||
512 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE; | ||
513 | |||
511 | /* Check for possible multi-thread reentrancy problem */ | 514 | /* Check for possible multi-thread reentrancy problem */ |
512 | 515 | ||
513 | if ((status == AE_ALREADY_EXISTS) && | 516 | if ((status == AE_ALREADY_EXISTS) && |
@@ -524,14 +527,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
524 | } | 527 | } |
525 | } | 528 | } |
526 | 529 | ||
527 | if (walk_state->method_desc) { | ||
528 | /* Decrement the thread count on the method parse tree */ | ||
529 | |||
530 | if (walk_state->method_desc->method.thread_count) { | ||
531 | walk_state->method_desc->method.thread_count--; | ||
532 | } | ||
533 | } | ||
534 | |||
535 | /* We are done with this walk, move on to the parent if any */ | 530 | /* We are done with this walk, move on to the parent if any */ |
536 | 531 | ||
537 | walk_state = acpi_ds_pop_walk_state(thread); | 532 | walk_state = acpi_ds_pop_walk_state(thread); |
@@ -546,13 +541,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
546 | */ | 541 | */ |
547 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 542 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
548 | ACPI_PARSE_EXECUTE) { | 543 | ACPI_PARSE_EXECUTE) { |
549 | terminate_status = | 544 | if (walk_state->method_desc) { |
550 | acpi_ds_terminate_control_method(walk_state); | 545 | /* Decrement the thread count on the method parse tree */ |
551 | if (ACPI_FAILURE(terminate_status)) { | ||
552 | ACPI_REPORT_ERROR(("Could not terminate control method properly\n")); | ||
553 | 546 | ||
554 | /* Ignore error and continue */ | 547 | walk_state->method_desc->method.thread_count--; |
555 | } | 548 | } |
549 | |||
550 | acpi_ds_terminate_control_method(walk_state); | ||
556 | } | 551 | } |
557 | 552 | ||
558 | /* Delete this walk state and all linked control states */ | 553 | /* Delete this walk state and all linked control states */ |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 80c67f2d3dd2..4dcbd443160e 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -99,16 +99,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * Get a new owner_id for objects created by this method. Namespace | ||
103 | * objects (such as Operation Regions) can be created during the | ||
104 | * first pass parse. | ||
105 | */ | ||
106 | status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id); | ||
107 | if (ACPI_FAILURE(status)) { | ||
108 | return_ACPI_STATUS(status); | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | * The caller "owns" the parameters, so give each one an extra | 102 | * The caller "owns" the parameters, so give each one an extra |
113 | * reference | 103 | * reference |
114 | */ | 104 | */ |
@@ -139,10 +129,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
139 | status = acpi_ps_execute_pass(info); | 129 | status = acpi_ps_execute_pass(info); |
140 | 130 | ||
141 | cleanup: | 131 | cleanup: |
142 | if (info->obj_desc->method.owner_id) { | ||
143 | acpi_ut_release_owner_id(&info->obj_desc->method.owner_id); | ||
144 | } | ||
145 | |||
146 | /* Take away the extra reference that we gave the parameters above */ | 132 | /* Take away the extra reference that we gave the parameters above */ |
147 | 133 | ||
148 | acpi_ps_update_parameter_list(info, REF_DECREMENT); | 134 | acpi_ps_update_parameter_list(info, REF_DECREMENT); |
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 4cf46e1ee01b..23b54baa0cb2 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c | |||
@@ -47,6 +47,180 @@ | |||
47 | #define _COMPONENT ACPI_RESOURCES | 47 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsaddr") | 48 | ACPI_MODULE_NAME("rsaddr") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | static void | ||
52 | acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags); | ||
53 | |||
54 | static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource); | ||
55 | |||
56 | static void | ||
57 | acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); | ||
58 | |||
59 | static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); | ||
60 | |||
61 | /******************************************************************************* | ||
62 | * | ||
63 | * FUNCTION: acpi_rs_decode_general_flags | ||
64 | * | ||
65 | * PARAMETERS: Resource - Address resource data struct | ||
66 | * Flags - Actual flag byte | ||
67 | * | ||
68 | * RETURN: Decoded flag bits in resource struct | ||
69 | * | ||
70 | * DESCRIPTION: Decode a general flag byte to an address resource struct | ||
71 | * | ||
72 | ******************************************************************************/ | ||
73 | |||
74 | static void | ||
75 | acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) | ||
76 | { | ||
77 | ACPI_FUNCTION_ENTRY(); | ||
78 | |||
79 | /* Producer / Consumer - flag bit[0] */ | ||
80 | |||
81 | resource->address.producer_consumer = (u32) (flags & 0x01); | ||
82 | |||
83 | /* Decode (_DEC) - flag bit[1] */ | ||
84 | |||
85 | resource->address.decode = (u32) ((flags >> 1) & 0x01); | ||
86 | |||
87 | /* Min Address Fixed (_MIF) - flag bit[2] */ | ||
88 | |||
89 | resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01); | ||
90 | |||
91 | /* Max Address Fixed (_MAF) - flag bit[3] */ | ||
92 | |||
93 | resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01); | ||
94 | } | ||
95 | |||
96 | /******************************************************************************* | ||
97 | * | ||
98 | * FUNCTION: acpi_rs_encode_general_flags | ||
99 | * | ||
100 | * PARAMETERS: Resource - Address resource data struct | ||
101 | * | ||
102 | * RETURN: Encoded general flag byte | ||
103 | * | ||
104 | * DESCRIPTION: Construct a general flag byte from an address resource struct | ||
105 | * | ||
106 | ******************************************************************************/ | ||
107 | |||
108 | static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) | ||
109 | { | ||
110 | u8 flags; | ||
111 | |||
112 | ACPI_FUNCTION_ENTRY(); | ||
113 | |||
114 | /* Producer / Consumer - flag bit[0] */ | ||
115 | |||
116 | flags = (u8) (resource->address.producer_consumer & 0x01); | ||
117 | |||
118 | /* Decode (_DEC) - flag bit[1] */ | ||
119 | |||
120 | flags |= (u8) ((resource->address.decode & 0x01) << 1); | ||
121 | |||
122 | /* Min Address Fixed (_MIF) - flag bit[2] */ | ||
123 | |||
124 | flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2); | ||
125 | |||
126 | /* Max Address Fixed (_MAF) - flag bit[3] */ | ||
127 | |||
128 | flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3); | ||
129 | |||
130 | return (flags); | ||
131 | } | ||
132 | |||
133 | /******************************************************************************* | ||
134 | * | ||
135 | * FUNCTION: acpi_rs_decode_specific_flags | ||
136 | * | ||
137 | * PARAMETERS: Resource - Address resource data struct | ||
138 | * Flags - Actual flag byte | ||
139 | * | ||
140 | * RETURN: Decoded flag bits in attribute struct | ||
141 | * | ||
142 | * DESCRIPTION: Decode a type-specific flag byte to an attribute struct. | ||
143 | * Type-specific flags are only defined for the Memory and IO | ||
144 | * resource types. | ||
145 | * | ||
146 | ******************************************************************************/ | ||
147 | |||
148 | static void | ||
149 | acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) | ||
150 | { | ||
151 | ACPI_FUNCTION_ENTRY(); | ||
152 | |||
153 | if (resource->address.resource_type == ACPI_MEMORY_RANGE) { | ||
154 | /* Write Status (_RW) - flag bit[0] */ | ||
155 | |||
156 | resource->address.attribute.memory.read_write_attribute = | ||
157 | (u16) (flags & 0x01); | ||
158 | |||
159 | /* Memory Attributes (_MEM) - flag bits[2:1] */ | ||
160 | |||
161 | resource->address.attribute.memory.cache_attribute = | ||
162 | (u16) ((flags >> 1) & 0x03); | ||
163 | } else if (resource->address.resource_type == ACPI_IO_RANGE) { | ||
164 | /* Ranges (_RNG) - flag bits[1:0] */ | ||
165 | |||
166 | resource->address.attribute.io.range_attribute = | ||
167 | (u16) (flags & 0x03); | ||
168 | |||
169 | /* Translations (_TTP and _TRS) - flag bits[5:4] */ | ||
170 | |||
171 | resource->address.attribute.io.translation_attribute = | ||
172 | (u16) ((flags >> 4) & 0x03); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | /******************************************************************************* | ||
177 | * | ||
178 | * FUNCTION: acpi_rs_encode_specific_flags | ||
179 | * | ||
180 | * PARAMETERS: Resource - Address resource data struct | ||
181 | * | ||
182 | * RETURN: Encoded type-specific flag byte | ||
183 | * | ||
184 | * DESCRIPTION: Construct a type-specific flag byte from an attribute struct. | ||
185 | * Type-specific flags are only defined for the Memory and IO | ||
186 | * resource types. | ||
187 | * | ||
188 | ******************************************************************************/ | ||
189 | |||
190 | static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) | ||
191 | { | ||
192 | u8 flags = 0; | ||
193 | |||
194 | ACPI_FUNCTION_ENTRY(); | ||
195 | |||
196 | if (resource->address.resource_type == ACPI_MEMORY_RANGE) { | ||
197 | /* Write Status (_RW) - flag bit[0] */ | ||
198 | |||
199 | flags = (u8) | ||
200 | (resource->address.attribute.memory. | ||
201 | read_write_attribute & 0x01); | ||
202 | |||
203 | /* Memory Attributes (_MEM) - flag bits[2:1] */ | ||
204 | |||
205 | flags |= (u8) | ||
206 | ((resource->address.attribute.memory. | ||
207 | cache_attribute & 0x03) << 1); | ||
208 | } else if (resource->address.resource_type == ACPI_IO_RANGE) { | ||
209 | /* Ranges (_RNG) - flag bits[1:0] */ | ||
210 | |||
211 | flags = (u8) | ||
212 | (resource->address.attribute.io.range_attribute & 0x03); | ||
213 | |||
214 | /* Translations (_TTP and _TRS) - flag bits[5:4] */ | ||
215 | |||
216 | flags |= (u8) | ||
217 | ((resource->address.attribute.io. | ||
218 | translation_attribute & 0x03) << 4); | ||
219 | } | ||
220 | |||
221 | return (flags); | ||
222 | } | ||
223 | |||
50 | /******************************************************************************* | 224 | /******************************************************************************* |
51 | * | 225 | * |
52 | * FUNCTION: acpi_rs_address16_resource | 226 | * FUNCTION: acpi_rs_address16_resource |
@@ -67,6 +241,7 @@ ACPI_MODULE_NAME("rsaddr") | |||
67 | * number of bytes consumed from the byte stream. | 241 | * number of bytes consumed from the byte stream. |
68 | * | 242 | * |
69 | ******************************************************************************/ | 243 | ******************************************************************************/ |
244 | |||
70 | acpi_status | 245 | acpi_status |
71 | acpi_rs_address16_resource(u8 * byte_stream_buffer, | 246 | acpi_rs_address16_resource(u8 * byte_stream_buffer, |
72 | acpi_size * bytes_consumed, | 247 | acpi_size * bytes_consumed, |
@@ -83,7 +258,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, | |||
83 | 258 | ||
84 | ACPI_FUNCTION_TRACE("rs_address16_resource"); | 259 | ACPI_FUNCTION_TRACE("rs_address16_resource"); |
85 | 260 | ||
86 | /* Point past the Descriptor to get the number of bytes consumed */ | 261 | /* Get the Descriptor Length field */ |
87 | 262 | ||
88 | buffer += 1; | 263 | buffer += 1; |
89 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 264 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
@@ -113,46 +288,12 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, | |||
113 | /* Get the General Flags (Byte4) */ | 288 | /* Get the General Flags (Byte4) */ |
114 | 289 | ||
115 | buffer += 1; | 290 | buffer += 1; |
116 | temp8 = *buffer; | 291 | acpi_rs_decode_general_flags(&output_struct->data, *buffer); |
117 | |||
118 | /* Producer / Consumer */ | ||
119 | |||
120 | output_struct->data.address16.producer_consumer = temp8 & 0x01; | ||
121 | |||
122 | /* Decode */ | ||
123 | |||
124 | output_struct->data.address16.decode = (temp8 >> 1) & 0x01; | ||
125 | |||
126 | /* Min Address Fixed */ | ||
127 | |||
128 | output_struct->data.address16.min_address_fixed = (temp8 >> 2) & 0x01; | ||
129 | |||
130 | /* Max Address Fixed */ | ||
131 | |||
132 | output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; | ||
133 | 292 | ||
134 | /* Get the Type Specific Flags (Byte5) */ | 293 | /* Get the Type Specific Flags (Byte5) */ |
135 | 294 | ||
136 | buffer += 1; | 295 | buffer += 1; |
137 | temp8 = *buffer; | 296 | acpi_rs_decode_specific_flags(&output_struct->data, *buffer); |
138 | |||
139 | if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) { | ||
140 | output_struct->data.address16.attribute.memory. | ||
141 | read_write_attribute = (u16) (temp8 & 0x01); | ||
142 | output_struct->data.address16.attribute.memory.cache_attribute = | ||
143 | (u16) ((temp8 >> 1) & 0x03); | ||
144 | } else { | ||
145 | if (ACPI_IO_RANGE == | ||
146 | output_struct->data.address16.resource_type) { | ||
147 | output_struct->data.address16.attribute.io. | ||
148 | range_attribute = (u16) (temp8 & 0x03); | ||
149 | output_struct->data.address16.attribute.io. | ||
150 | translation_attribute = (u16) ((temp8 >> 4) & 0x03); | ||
151 | } else { | ||
152 | /* BUS_NUMBER_RANGE == Address16.Data->resource_type */ | ||
153 | /* Nothing needs to be filled in */ | ||
154 | } | ||
155 | } | ||
156 | 297 | ||
157 | /* Get Granularity (Bytes 6-7) */ | 298 | /* Get Granularity (Bytes 6-7) */ |
158 | 299 | ||
@@ -200,9 +341,8 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, | |||
200 | if (*bytes_consumed > (16 + 1)) { | 341 | if (*bytes_consumed > (16 + 1)) { |
201 | /* Dereference the Index */ | 342 | /* Dereference the Index */ |
202 | 343 | ||
203 | temp8 = *buffer; | ||
204 | output_struct->data.address16.resource_source.index = | 344 | output_struct->data.address16.resource_source.index = |
205 | (u32) temp8; | 345 | (u32) * buffer; |
206 | 346 | ||
207 | /* Point to the String */ | 347 | /* Point to the String */ |
208 | 348 | ||
@@ -216,22 +356,20 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, | |||
216 | temp_ptr = (u8 *) | 356 | temp_ptr = (u8 *) |
217 | output_struct->data.address16.resource_source.string_ptr; | 357 | output_struct->data.address16.resource_source.string_ptr; |
218 | 358 | ||
219 | /* Copy the string into the buffer */ | 359 | /* Copy the resource_source string into the buffer */ |
220 | 360 | ||
221 | index = 0; | 361 | index = 0; |
222 | 362 | while (*buffer) { | |
223 | while (0x00 != *buffer) { | ||
224 | *temp_ptr = *buffer; | 363 | *temp_ptr = *buffer; |
225 | 364 | ||
226 | temp_ptr += 1; | 365 | temp_ptr++; |
227 | buffer += 1; | 366 | buffer++; |
228 | index += 1; | 367 | index++; |
229 | } | 368 | } |
230 | 369 | ||
231 | /* Add the terminating null */ | 370 | /* Add the terminating null and set the string length */ |
232 | |||
233 | *temp_ptr = 0x00; | ||
234 | 371 | ||
372 | *temp_ptr = 0; | ||
235 | output_struct->data.address16.resource_source.string_length = | 373 | output_struct->data.address16.resource_source.string_length = |
236 | index + 1; | 374 | index + 1; |
237 | 375 | ||
@@ -243,7 +381,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer, | |||
243 | temp8 = (u8) (index + 1); | 381 | temp8 = (u8) (index + 1); |
244 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); | 382 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); |
245 | } else { | 383 | } else { |
246 | output_struct->data.address16.resource_source.index = 0x00; | 384 | output_struct->data.address16.resource_source.index = 0; |
247 | output_struct->data.address16.resource_source.string_length = 0; | 385 | output_struct->data.address16.resource_source.string_length = 0; |
248 | output_struct->data.address16.resource_source.string_ptr = NULL; | 386 | output_struct->data.address16.resource_source.string_ptr = NULL; |
249 | } | 387 | } |
@@ -280,15 +418,13 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, | |||
280 | { | 418 | { |
281 | u8 *buffer = *output_buffer; | 419 | u8 *buffer = *output_buffer; |
282 | u8 *length_field; | 420 | u8 *length_field; |
283 | u8 temp8; | ||
284 | char *temp_pointer = NULL; | ||
285 | acpi_size actual_bytes; | 421 | acpi_size actual_bytes; |
286 | 422 | ||
287 | ACPI_FUNCTION_TRACE("rs_address16_stream"); | 423 | ACPI_FUNCTION_TRACE("rs_address16_stream"); |
288 | 424 | ||
289 | /* The descriptor field is static */ | 425 | /* Set the Descriptor Type field */ |
290 | 426 | ||
291 | *buffer = 0x88; | 427 | *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; |
292 | buffer += 1; | 428 | buffer += 1; |
293 | 429 | ||
294 | /* Save a pointer to the Length field - to be filled in later */ | 430 | /* Save a pointer to the Length field - to be filled in later */ |
@@ -298,43 +434,17 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, | |||
298 | 434 | ||
299 | /* Set the Resource Type (Memory, Io, bus_number) */ | 435 | /* Set the Resource Type (Memory, Io, bus_number) */ |
300 | 436 | ||
301 | temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); | 437 | *buffer = (u8) (linked_list->data.address16.resource_type & 0x03); |
302 | *buffer = temp8; | ||
303 | buffer += 1; | 438 | buffer += 1; |
304 | 439 | ||
305 | /* Set the general flags */ | 440 | /* Set the general flags */ |
306 | 441 | ||
307 | temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); | 442 | *buffer = acpi_rs_encode_general_flags(&linked_list->data); |
308 | |||
309 | temp8 |= (linked_list->data.address16.decode & 0x01) << 1; | ||
310 | temp8 |= (linked_list->data.address16.min_address_fixed & 0x01) << 2; | ||
311 | temp8 |= (linked_list->data.address16.max_address_fixed & 0x01) << 3; | ||
312 | |||
313 | *buffer = temp8; | ||
314 | buffer += 1; | 443 | buffer += 1; |
315 | 444 | ||
316 | /* Set the type specific flags */ | 445 | /* Set the type specific flags */ |
317 | 446 | ||
318 | temp8 = 0; | 447 | *buffer = acpi_rs_encode_specific_flags(&linked_list->data); |
319 | |||
320 | if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { | ||
321 | temp8 = (u8) | ||
322 | (linked_list->data.address16.attribute.memory. | ||
323 | read_write_attribute & 0x01); | ||
324 | |||
325 | temp8 |= | ||
326 | (linked_list->data.address16.attribute.memory. | ||
327 | cache_attribute & 0x03) << 1; | ||
328 | } else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { | ||
329 | temp8 = (u8) | ||
330 | (linked_list->data.address16.attribute.io.range_attribute & | ||
331 | 0x03); | ||
332 | temp8 |= | ||
333 | (linked_list->data.address16.attribute.io. | ||
334 | translation_attribute & 0x03) << 4; | ||
335 | } | ||
336 | |||
337 | *buffer = temp8; | ||
338 | buffer += 1; | 448 | buffer += 1; |
339 | 449 | ||
340 | /* Set the address space granularity */ | 450 | /* Set the address space granularity */ |
@@ -368,22 +478,19 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list, | |||
368 | 478 | ||
369 | /* Resource Source Index and Resource Source are optional */ | 479 | /* Resource Source Index and Resource Source are optional */ |
370 | 480 | ||
371 | if (0 != linked_list->data.address16.resource_source.string_length) { | 481 | if (linked_list->data.address16.resource_source.string_length) { |
372 | temp8 = (u8) linked_list->data.address16.resource_source.index; | 482 | *buffer = |
373 | 483 | (u8) linked_list->data.address16.resource_source.index; | |
374 | *buffer = temp8; | ||
375 | buffer += 1; | 484 | buffer += 1; |
376 | 485 | ||
377 | temp_pointer = (char *)buffer; | 486 | /* Copy the resource_source string */ |
378 | |||
379 | /* Copy the string */ | ||
380 | 487 | ||
381 | ACPI_STRCPY(temp_pointer, | 488 | ACPI_STRCPY((char *)buffer, |
382 | linked_list->data.address16.resource_source. | 489 | linked_list->data.address16.resource_source. |
383 | string_ptr); | 490 | string_ptr); |
384 | 491 | ||
385 | /* | 492 | /* |
386 | * Buffer needs to be set to the length of the sting + one for the | 493 | * Buffer needs to be set to the length of the string + one for the |
387 | * terminating null | 494 | * terminating null |
388 | */ | 495 | */ |
389 | buffer += | 496 | buffer += |
@@ -432,20 +539,18 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, | |||
432 | acpi_size * bytes_consumed, | 539 | acpi_size * bytes_consumed, |
433 | u8 ** output_buffer, acpi_size * structure_size) | 540 | u8 ** output_buffer, acpi_size * structure_size) |
434 | { | 541 | { |
435 | u8 *buffer; | ||
436 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
437 | u16 temp16; | 542 | u16 temp16; |
438 | u8 temp8; | 543 | u8 temp8; |
439 | u8 *temp_ptr; | 544 | u8 *temp_ptr; |
440 | acpi_size struct_size; | ||
441 | u32 index; | 545 | u32 index; |
546 | u8 *buffer = byte_stream_buffer; | ||
547 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
548 | acpi_size struct_size = | ||
549 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); | ||
442 | 550 | ||
443 | ACPI_FUNCTION_TRACE("rs_address32_resource"); | 551 | ACPI_FUNCTION_TRACE("rs_address32_resource"); |
444 | 552 | ||
445 | buffer = byte_stream_buffer; | 553 | /* Get the Descriptor Length field */ |
446 | struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); | ||
447 | |||
448 | /* Point past the Descriptor to get the number of bytes consumed */ | ||
449 | 554 | ||
450 | buffer += 1; | 555 | buffer += 1; |
451 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 556 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
@@ -475,47 +580,12 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, | |||
475 | /* Get the General Flags (Byte4) */ | 580 | /* Get the General Flags (Byte4) */ |
476 | 581 | ||
477 | buffer += 1; | 582 | buffer += 1; |
478 | temp8 = *buffer; | 583 | acpi_rs_decode_general_flags(&output_struct->data, *buffer); |
479 | |||
480 | /* Producer / Consumer */ | ||
481 | |||
482 | output_struct->data.address32.producer_consumer = temp8 & 0x01; | ||
483 | |||
484 | /* Decode */ | ||
485 | |||
486 | output_struct->data.address32.decode = (temp8 >> 1) & 0x01; | ||
487 | |||
488 | /* Min Address Fixed */ | ||
489 | |||
490 | output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; | ||
491 | |||
492 | /* Max Address Fixed */ | ||
493 | |||
494 | output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; | ||
495 | 584 | ||
496 | /* Get the Type Specific Flags (Byte5) */ | 585 | /* Get the Type Specific Flags (Byte5) */ |
497 | 586 | ||
498 | buffer += 1; | 587 | buffer += 1; |
499 | temp8 = *buffer; | 588 | acpi_rs_decode_specific_flags(&output_struct->data, *buffer); |
500 | |||
501 | if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) { | ||
502 | output_struct->data.address32.attribute.memory. | ||
503 | read_write_attribute = (u16) (temp8 & 0x01); | ||
504 | |||
505 | output_struct->data.address32.attribute.memory.cache_attribute = | ||
506 | (u16) ((temp8 >> 1) & 0x03); | ||
507 | } else { | ||
508 | if (ACPI_IO_RANGE == | ||
509 | output_struct->data.address32.resource_type) { | ||
510 | output_struct->data.address32.attribute.io. | ||
511 | range_attribute = (u16) (temp8 & 0x03); | ||
512 | output_struct->data.address32.attribute.io. | ||
513 | translation_attribute = (u16) ((temp8 >> 4) & 0x03); | ||
514 | } else { | ||
515 | /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */ | ||
516 | /* Nothing needs to be filled in */ | ||
517 | } | ||
518 | } | ||
519 | 589 | ||
520 | /* Get Granularity (Bytes 6-9) */ | 590 | /* Get Granularity (Bytes 6-9) */ |
521 | 591 | ||
@@ -561,9 +631,8 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, | |||
561 | if (*bytes_consumed > (26 + 1)) { | 631 | if (*bytes_consumed > (26 + 1)) { |
562 | /* Dereference the Index */ | 632 | /* Dereference the Index */ |
563 | 633 | ||
564 | temp8 = *buffer; | ||
565 | output_struct->data.address32.resource_source.index = | 634 | output_struct->data.address32.resource_source.index = |
566 | (u32) temp8; | 635 | (u32) * buffer; |
567 | 636 | ||
568 | /* Point to the String */ | 637 | /* Point to the String */ |
569 | 638 | ||
@@ -577,20 +646,20 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, | |||
577 | temp_ptr = (u8 *) | 646 | temp_ptr = (u8 *) |
578 | output_struct->data.address32.resource_source.string_ptr; | 647 | output_struct->data.address32.resource_source.string_ptr; |
579 | 648 | ||
580 | /* Copy the string into the buffer */ | 649 | /* Copy the resource_source string into the buffer */ |
581 | 650 | ||
582 | index = 0; | 651 | index = 0; |
583 | while (0x00 != *buffer) { | 652 | while (*buffer) { |
584 | *temp_ptr = *buffer; | 653 | *temp_ptr = *buffer; |
585 | 654 | ||
586 | temp_ptr += 1; | 655 | temp_ptr++; |
587 | buffer += 1; | 656 | buffer++; |
588 | index += 1; | 657 | index++; |
589 | } | 658 | } |
590 | 659 | ||
591 | /* Add the terminating null */ | 660 | /* Add the terminating null and set the string length */ |
592 | 661 | ||
593 | *temp_ptr = 0x00; | 662 | *temp_ptr = 0; |
594 | output_struct->data.address32.resource_source.string_length = | 663 | output_struct->data.address32.resource_source.string_length = |
595 | index + 1; | 664 | index + 1; |
596 | 665 | ||
@@ -602,7 +671,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer, | |||
602 | temp8 = (u8) (index + 1); | 671 | temp8 = (u8) (index + 1); |
603 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); | 672 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); |
604 | } else { | 673 | } else { |
605 | output_struct->data.address32.resource_source.index = 0x00; | 674 | output_struct->data.address32.resource_source.index = 0; |
606 | output_struct->data.address32.resource_source.string_length = 0; | 675 | output_struct->data.address32.resource_source.string_length = 0; |
607 | output_struct->data.address32.resource_source.string_ptr = NULL; | 676 | output_struct->data.address32.resource_source.string_ptr = NULL; |
608 | } | 677 | } |
@@ -639,62 +708,34 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, | |||
639 | { | 708 | { |
640 | u8 *buffer; | 709 | u8 *buffer; |
641 | u16 *length_field; | 710 | u16 *length_field; |
642 | u8 temp8; | ||
643 | char *temp_pointer; | ||
644 | 711 | ||
645 | ACPI_FUNCTION_TRACE("rs_address32_stream"); | 712 | ACPI_FUNCTION_TRACE("rs_address32_stream"); |
646 | 713 | ||
647 | buffer = *output_buffer; | 714 | buffer = *output_buffer; |
648 | 715 | ||
649 | /* The descriptor field is static */ | 716 | /* Set the Descriptor Type field */ |
650 | 717 | ||
651 | *buffer = 0x87; | 718 | *buffer = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE; |
652 | buffer += 1; | 719 | buffer += 1; |
653 | 720 | ||
654 | /* Set a pointer to the Length field - to be filled in later */ | 721 | /* Save a pointer to the Length field - to be filled in later */ |
655 | 722 | ||
656 | length_field = ACPI_CAST_PTR(u16, buffer); | 723 | length_field = ACPI_CAST_PTR(u16, buffer); |
657 | buffer += 2; | 724 | buffer += 2; |
658 | 725 | ||
659 | /* Set the Resource Type (Memory, Io, bus_number) */ | 726 | /* Set the Resource Type (Memory, Io, bus_number) */ |
660 | 727 | ||
661 | temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); | 728 | *buffer = (u8) (linked_list->data.address32.resource_type & 0x03); |
662 | |||
663 | *buffer = temp8; | ||
664 | buffer += 1; | 729 | buffer += 1; |
665 | 730 | ||
666 | /* Set the general flags */ | 731 | /* Set the general flags */ |
667 | 732 | ||
668 | temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); | 733 | *buffer = acpi_rs_encode_general_flags(&linked_list->data); |
669 | temp8 |= (linked_list->data.address32.decode & 0x01) << 1; | ||
670 | temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; | ||
671 | temp8 |= (linked_list->data.address32.max_address_fixed & 0x01) << 3; | ||
672 | |||
673 | *buffer = temp8; | ||
674 | buffer += 1; | 734 | buffer += 1; |
675 | 735 | ||
676 | /* Set the type specific flags */ | 736 | /* Set the type specific flags */ |
677 | 737 | ||
678 | temp8 = 0; | 738 | *buffer = acpi_rs_encode_specific_flags(&linked_list->data); |
679 | |||
680 | if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { | ||
681 | temp8 = (u8) | ||
682 | (linked_list->data.address32.attribute.memory. | ||
683 | read_write_attribute & 0x01); | ||
684 | |||
685 | temp8 |= | ||
686 | (linked_list->data.address32.attribute.memory. | ||
687 | cache_attribute & 0x03) << 1; | ||
688 | } else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { | ||
689 | temp8 = (u8) | ||
690 | (linked_list->data.address32.attribute.io.range_attribute & | ||
691 | 0x03); | ||
692 | temp8 |= | ||
693 | (linked_list->data.address32.attribute.io. | ||
694 | translation_attribute & 0x03) << 4; | ||
695 | } | ||
696 | |||
697 | *buffer = temp8; | ||
698 | buffer += 1; | 739 | buffer += 1; |
699 | 740 | ||
700 | /* Set the address space granularity */ | 741 | /* Set the address space granularity */ |
@@ -728,22 +769,19 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, | |||
728 | 769 | ||
729 | /* Resource Source Index and Resource Source are optional */ | 770 | /* Resource Source Index and Resource Source are optional */ |
730 | 771 | ||
731 | if (0 != linked_list->data.address32.resource_source.string_length) { | 772 | if (linked_list->data.address32.resource_source.string_length) { |
732 | temp8 = (u8) linked_list->data.address32.resource_source.index; | 773 | *buffer = |
733 | 774 | (u8) linked_list->data.address32.resource_source.index; | |
734 | *buffer = temp8; | ||
735 | buffer += 1; | 775 | buffer += 1; |
736 | 776 | ||
737 | temp_pointer = (char *)buffer; | 777 | /* Copy the resource_source string */ |
738 | |||
739 | /* Copy the string */ | ||
740 | 778 | ||
741 | ACPI_STRCPY(temp_pointer, | 779 | ACPI_STRCPY((char *)buffer, |
742 | linked_list->data.address32.resource_source. | 780 | linked_list->data.address32.resource_source. |
743 | string_ptr); | 781 | string_ptr); |
744 | 782 | ||
745 | /* | 783 | /* |
746 | * Buffer needs to be set to the length of the sting + one for the | 784 | * Buffer needs to be set to the length of the string + one for the |
747 | * terminating null | 785 | * terminating null |
748 | */ | 786 | */ |
749 | buffer += | 787 | buffer += |
@@ -758,7 +796,7 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list, | |||
758 | 796 | ||
759 | /* | 797 | /* |
760 | * Set the length field to the number of bytes consumed | 798 | * Set the length field to the number of bytes consumed |
761 | * minus the header size (3 bytes) | 799 | * minus the header size (3 bytes) |
762 | */ | 800 | */ |
763 | *length_field = (u16) (*bytes_consumed - 3); | 801 | *length_field = (u16) (*bytes_consumed - 3); |
764 | return_ACPI_STATUS(AE_OK); | 802 | return_ACPI_STATUS(AE_OK); |
@@ -790,22 +828,23 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, | |||
790 | acpi_size * bytes_consumed, | 828 | acpi_size * bytes_consumed, |
791 | u8 ** output_buffer, acpi_size * structure_size) | 829 | u8 ** output_buffer, acpi_size * structure_size) |
792 | { | 830 | { |
793 | u8 *buffer; | ||
794 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
795 | u16 temp16; | 831 | u16 temp16; |
796 | u8 temp8; | 832 | u8 temp8; |
797 | u8 resource_type; | 833 | u8 resource_type; |
798 | u8 *temp_ptr; | 834 | u8 *temp_ptr; |
799 | acpi_size struct_size; | ||
800 | u32 index; | 835 | u32 index; |
836 | u8 *buffer = byte_stream_buffer; | ||
837 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
838 | acpi_size struct_size = | ||
839 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); | ||
801 | 840 | ||
802 | ACPI_FUNCTION_TRACE("rs_address64_resource"); | 841 | ACPI_FUNCTION_TRACE("rs_address64_resource"); |
803 | 842 | ||
804 | buffer = byte_stream_buffer; | 843 | /* Get the Descriptor Type */ |
805 | struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); | 844 | |
806 | resource_type = *buffer; | 845 | resource_type = *buffer; |
807 | 846 | ||
808 | /* Point past the Descriptor to get the number of bytes consumed */ | 847 | /* Get the Descriptor Length field */ |
809 | 848 | ||
810 | buffer += 1; | 849 | buffer += 1; |
811 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 850 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
@@ -835,47 +874,12 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, | |||
835 | /* Get the General Flags (Byte4) */ | 874 | /* Get the General Flags (Byte4) */ |
836 | 875 | ||
837 | buffer += 1; | 876 | buffer += 1; |
838 | temp8 = *buffer; | 877 | acpi_rs_decode_general_flags(&output_struct->data, *buffer); |
839 | |||
840 | /* Producer / Consumer */ | ||
841 | |||
842 | output_struct->data.address64.producer_consumer = temp8 & 0x01; | ||
843 | |||
844 | /* Decode */ | ||
845 | |||
846 | output_struct->data.address64.decode = (temp8 >> 1) & 0x01; | ||
847 | |||
848 | /* Min Address Fixed */ | ||
849 | |||
850 | output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; | ||
851 | |||
852 | /* Max Address Fixed */ | ||
853 | |||
854 | output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; | ||
855 | 878 | ||
856 | /* Get the Type Specific Flags (Byte5) */ | 879 | /* Get the Type Specific Flags (Byte5) */ |
857 | 880 | ||
858 | buffer += 1; | 881 | buffer += 1; |
859 | temp8 = *buffer; | 882 | acpi_rs_decode_specific_flags(&output_struct->data, *buffer); |
860 | |||
861 | if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) { | ||
862 | output_struct->data.address64.attribute.memory. | ||
863 | read_write_attribute = (u16) (temp8 & 0x01); | ||
864 | |||
865 | output_struct->data.address64.attribute.memory.cache_attribute = | ||
866 | (u16) ((temp8 >> 1) & 0x03); | ||
867 | } else { | ||
868 | if (ACPI_IO_RANGE == | ||
869 | output_struct->data.address64.resource_type) { | ||
870 | output_struct->data.address64.attribute.io. | ||
871 | range_attribute = (u16) (temp8 & 0x03); | ||
872 | output_struct->data.address64.attribute.io. | ||
873 | translation_attribute = (u16) ((temp8 >> 4) & 0x03); | ||
874 | } else { | ||
875 | /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */ | ||
876 | /* Nothing needs to be filled in */ | ||
877 | } | ||
878 | } | ||
879 | 883 | ||
880 | if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { | 884 | if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { |
881 | /* Move past revision_id and Reserved byte */ | 885 | /* Move past revision_id and Reserved byte */ |
@@ -912,7 +916,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, | |||
912 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, | 916 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, |
913 | buffer); | 917 | buffer); |
914 | 918 | ||
915 | output_struct->data.address64.resource_source.index = 0x00; | 919 | output_struct->data.address64.resource_source.index = 0; |
916 | output_struct->data.address64.resource_source.string_length = 0; | 920 | output_struct->data.address64.resource_source.string_length = 0; |
917 | output_struct->data.address64.resource_source.string_ptr = NULL; | 921 | output_struct->data.address64.resource_source.string_ptr = NULL; |
918 | 922 | ||
@@ -942,9 +946,8 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, | |||
942 | if (*bytes_consumed > (46 + 1)) { | 946 | if (*bytes_consumed > (46 + 1)) { |
943 | /* Dereference the Index */ | 947 | /* Dereference the Index */ |
944 | 948 | ||
945 | temp8 = *buffer; | ||
946 | output_struct->data.address64.resource_source.index = | 949 | output_struct->data.address64.resource_source.index = |
947 | (u32) temp8; | 950 | (u32) * buffer; |
948 | 951 | ||
949 | /* Point to the String */ | 952 | /* Point to the String */ |
950 | 953 | ||
@@ -960,21 +963,21 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer, | |||
960 | output_struct->data.address64.resource_source. | 963 | output_struct->data.address64.resource_source. |
961 | string_ptr; | 964 | string_ptr; |
962 | 965 | ||
963 | /* Copy the string into the buffer */ | 966 | /* Copy the resource_source string into the buffer */ |
964 | 967 | ||
965 | index = 0; | 968 | index = 0; |
966 | while (0x00 != *buffer) { | 969 | while (*buffer) { |
967 | *temp_ptr = *buffer; | 970 | *temp_ptr = *buffer; |
968 | 971 | ||
969 | temp_ptr += 1; | 972 | temp_ptr++; |
970 | buffer += 1; | 973 | buffer++; |
971 | index += 1; | 974 | index++; |
972 | } | 975 | } |
973 | 976 | ||
974 | /* | 977 | /* |
975 | * Add the terminating null | 978 | * Add the terminating null and set the string length |
976 | */ | 979 | */ |
977 | *temp_ptr = 0x00; | 980 | *temp_ptr = 0; |
978 | output_struct->data.address64.resource_source. | 981 | output_struct->data.address64.resource_source. |
979 | string_length = index + 1; | 982 | string_length = index + 1; |
980 | 983 | ||
@@ -1020,62 +1023,34 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list, | |||
1020 | { | 1023 | { |
1021 | u8 *buffer; | 1024 | u8 *buffer; |
1022 | u16 *length_field; | 1025 | u16 *length_field; |
1023 | u8 temp8; | ||
1024 | char *temp_pointer; | ||
1025 | 1026 | ||
1026 | ACPI_FUNCTION_TRACE("rs_address64_stream"); | 1027 | ACPI_FUNCTION_TRACE("rs_address64_stream"); |
1027 | 1028 | ||
1028 | buffer = *output_buffer; | 1029 | buffer = *output_buffer; |
1029 | 1030 | ||
1030 | /* The descriptor field is static */ | 1031 | /* Set the Descriptor Type field */ |
1031 | 1032 | ||
1032 | *buffer = 0x8A; | 1033 | *buffer = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE; |
1033 | buffer += 1; | 1034 | buffer += 1; |
1034 | 1035 | ||
1035 | /* Set a pointer to the Length field - to be filled in later */ | 1036 | /* Save a pointer to the Length field - to be filled in later */ |
1036 | 1037 | ||
1037 | length_field = ACPI_CAST_PTR(u16, buffer); | 1038 | length_field = ACPI_CAST_PTR(u16, buffer); |
1038 | buffer += 2; | 1039 | buffer += 2; |
1039 | 1040 | ||
1040 | /* Set the Resource Type (Memory, Io, bus_number) */ | 1041 | /* Set the Resource Type (Memory, Io, bus_number) */ |
1041 | 1042 | ||
1042 | temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); | 1043 | *buffer = (u8) (linked_list->data.address64.resource_type & 0x03); |
1043 | |||
1044 | *buffer = temp8; | ||
1045 | buffer += 1; | 1044 | buffer += 1; |
1046 | 1045 | ||
1047 | /* Set the general flags */ | 1046 | /* Set the general flags */ |
1048 | 1047 | ||
1049 | temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); | 1048 | *buffer = acpi_rs_encode_general_flags(&linked_list->data); |
1050 | temp8 |= (linked_list->data.address64.decode & 0x01) << 1; | ||
1051 | temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; | ||
1052 | temp8 |= (linked_list->data.address64.max_address_fixed & 0x01) << 3; | ||
1053 | |||
1054 | *buffer = temp8; | ||
1055 | buffer += 1; | 1049 | buffer += 1; |
1056 | 1050 | ||
1057 | /* Set the type specific flags */ | 1051 | /* Set the type specific flags */ |
1058 | 1052 | ||
1059 | temp8 = 0; | 1053 | *buffer = acpi_rs_encode_specific_flags(&linked_list->data); |
1060 | |||
1061 | if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { | ||
1062 | temp8 = (u8) | ||
1063 | (linked_list->data.address64.attribute.memory. | ||
1064 | read_write_attribute & 0x01); | ||
1065 | |||
1066 | temp8 |= | ||
1067 | (linked_list->data.address64.attribute.memory. | ||
1068 | cache_attribute & 0x03) << 1; | ||
1069 | } else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { | ||
1070 | temp8 = (u8) | ||
1071 | (linked_list->data.address64.attribute.io.range_attribute & | ||
1072 | 0x03); | ||
1073 | temp8 |= | ||
1074 | (linked_list->data.address64.attribute.io.range_attribute & | ||
1075 | 0x03) << 4; | ||
1076 | } | ||
1077 | |||
1078 | *buffer = temp8; | ||
1079 | buffer += 1; | 1054 | buffer += 1; |
1080 | 1055 | ||
1081 | /* Set the address space granularity */ | 1056 | /* Set the address space granularity */ |
@@ -1109,22 +1084,19 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list, | |||
1109 | 1084 | ||
1110 | /* Resource Source Index and Resource Source are optional */ | 1085 | /* Resource Source Index and Resource Source are optional */ |
1111 | 1086 | ||
1112 | if (0 != linked_list->data.address64.resource_source.string_length) { | 1087 | if (linked_list->data.address64.resource_source.string_length) { |
1113 | temp8 = (u8) linked_list->data.address64.resource_source.index; | 1088 | *buffer = |
1114 | 1089 | (u8) linked_list->data.address64.resource_source.index; | |
1115 | *buffer = temp8; | ||
1116 | buffer += 1; | 1090 | buffer += 1; |
1117 | 1091 | ||
1118 | temp_pointer = (char *)buffer; | 1092 | /* Copy the resource_source string */ |
1119 | |||
1120 | /* Copy the string */ | ||
1121 | 1093 | ||
1122 | ACPI_STRCPY(temp_pointer, | 1094 | ACPI_STRCPY((char *)buffer, |
1123 | linked_list->data.address64.resource_source. | 1095 | linked_list->data.address64.resource_source. |
1124 | string_ptr); | 1096 | string_ptr); |
1125 | 1097 | ||
1126 | /* | 1098 | /* |
1127 | * Buffer needs to be set to the length of the sting + one for the | 1099 | * Buffer needs to be set to the length of the string + one for the |
1128 | * terminating null | 1100 | * terminating null |
1129 | */ | 1101 | */ |
1130 | buffer += | 1102 | buffer += |
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 7179b6243f5b..56043fee96cb 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c | |||
@@ -290,7 +290,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, | |||
290 | 290 | ||
291 | ACPI_FUNCTION_TRACE("rs_extended_irq_resource"); | 291 | ACPI_FUNCTION_TRACE("rs_extended_irq_resource"); |
292 | 292 | ||
293 | /* Point past the Descriptor to get the number of bytes consumed */ | 293 | /* Get the Descriptor Length field */ |
294 | 294 | ||
295 | buffer += 1; | 295 | buffer += 1; |
296 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 296 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
@@ -398,7 +398,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, | |||
398 | /* Copy the string into the buffer */ | 398 | /* Copy the string into the buffer */ |
399 | 399 | ||
400 | index = 0; | 400 | index = 0; |
401 | while (0x00 != *buffer) { | 401 | while (*buffer) { |
402 | *temp_ptr = *buffer; | 402 | *temp_ptr = *buffer; |
403 | 403 | ||
404 | temp_ptr += 1; | 404 | temp_ptr += 1; |
@@ -408,7 +408,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, | |||
408 | 408 | ||
409 | /* Add the terminating null */ | 409 | /* Add the terminating null */ |
410 | 410 | ||
411 | *temp_ptr = 0x00; | 411 | *temp_ptr = 0; |
412 | output_struct->data.extended_irq.resource_source.string_length = | 412 | output_struct->data.extended_irq.resource_source.string_length = |
413 | index + 1; | 413 | index + 1; |
414 | 414 | ||
@@ -420,7 +420,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, | |||
420 | temp8 = (u8) (index + 1); | 420 | temp8 = (u8) (index + 1); |
421 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); | 421 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); |
422 | } else { | 422 | } else { |
423 | output_struct->data.extended_irq.resource_source.index = 0x00; | 423 | output_struct->data.extended_irq.resource_source.index = 0; |
424 | output_struct->data.extended_irq.resource_source.string_length = | 424 | output_struct->data.extended_irq.resource_source.string_length = |
425 | 0; | 425 | 0; |
426 | output_struct->data.extended_irq.resource_source.string_ptr = | 426 | output_struct->data.extended_irq.resource_source.string_ptr = |
@@ -461,16 +461,15 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, | |||
461 | u16 *length_field; | 461 | u16 *length_field; |
462 | u8 temp8 = 0; | 462 | u8 temp8 = 0; |
463 | u8 index; | 463 | u8 index; |
464 | char *temp_pointer = NULL; | ||
465 | 464 | ||
466 | ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); | 465 | ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); |
467 | 466 | ||
468 | /* The descriptor field is static */ | 467 | /* Set the Descriptor Type field */ |
469 | 468 | ||
470 | *buffer = 0x89; | 469 | *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT; |
471 | buffer += 1; | 470 | buffer += 1; |
472 | 471 | ||
473 | /* Set a pointer to the Length field - to be filled in later */ | 472 | /* Save a pointer to the Length field - to be filled in later */ |
474 | 473 | ||
475 | length_field = ACPI_CAST_PTR(u16, buffer); | 474 | length_field = ACPI_CAST_PTR(u16, buffer); |
476 | buffer += 2; | 475 | buffer += 2; |
@@ -524,16 +523,14 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, | |||
524 | (u8) linked_list->data.extended_irq.resource_source.index; | 523 | (u8) linked_list->data.extended_irq.resource_source.index; |
525 | buffer += 1; | 524 | buffer += 1; |
526 | 525 | ||
527 | temp_pointer = (char *)buffer; | ||
528 | |||
529 | /* Copy the string */ | 526 | /* Copy the string */ |
530 | 527 | ||
531 | ACPI_STRCPY(temp_pointer, | 528 | ACPI_STRCPY((char *)buffer, |
532 | linked_list->data.extended_irq.resource_source. | 529 | linked_list->data.extended_irq.resource_source. |
533 | string_ptr); | 530 | string_ptr); |
534 | 531 | ||
535 | /* | 532 | /* |
536 | * Buffer needs to be set to the length of the sting + one for the | 533 | * Buffer needs to be set to the length of the string + one for the |
537 | * terminating null | 534 | * terminating null |
538 | */ | 535 | */ |
539 | buffer += | 536 | buffer += |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f0275025b718..0c5abc536c7a 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -67,6 +67,14 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
67 | 67 | ||
68 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); | 68 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); |
69 | 69 | ||
70 | /* Guard against multiple allocations of ID to the same location */ | ||
71 | |||
72 | if (*owner_id) { | ||
73 | ACPI_REPORT_ERROR(("Owner ID [%2.2X] already exists\n", | ||
74 | *owner_id)); | ||
75 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | ||
76 | } | ||
77 | |||
70 | /* Mutex for the global ID mask */ | 78 | /* Mutex for the global ID mask */ |
71 | 79 | ||
72 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | 80 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); |
@@ -80,7 +88,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
80 | if (!(acpi_gbl_owner_id_mask & (1 << i))) { | 88 | if (!(acpi_gbl_owner_id_mask & (1 << i))) { |
81 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, | 89 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, |
82 | "Current owner_id mask: %8.8X New ID: %2.2X\n", | 90 | "Current owner_id mask: %8.8X New ID: %2.2X\n", |
83 | acpi_gbl_owner_id_mask, (i + 1))); | 91 | acpi_gbl_owner_id_mask, |
92 | (unsigned int)(i + 1))); | ||
84 | 93 | ||
85 | acpi_gbl_owner_id_mask |= (1 << i); | 94 | acpi_gbl_owner_id_mask |= (1 << i); |
86 | *owner_id = (acpi_owner_id) (i + 1); | 95 | *owner_id = (acpi_owner_id) (i + 1); |
@@ -143,7 +152,9 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
143 | return_VOID; | 152 | return_VOID; |
144 | } | 153 | } |
145 | 154 | ||
146 | owner_id--; /* Normalize to zero */ | 155 | /* Normalize the ID to zero */ |
156 | |||
157 | owner_id--; | ||
147 | 158 | ||
148 | /* Free the owner ID only if it is valid */ | 159 | /* Free the owner ID only if it is valid */ |
149 | 160 | ||