aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2012-12-19 00:38:07 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-10 06:36:18 -0500
commit886308ecea88236e88fba2a7f50d8ce22a40c4fe (patch)
tree74109d1b4466cc70a9a3e9a662165fd84aa90985 /drivers
parent0e770b3263816b4445e2c855f641b172aa26291a (diff)
ACPICA: Debugger: Major update for the Disassemble<method> command.
This command was downreved and did not properly disassemble control methods with any reasonable complexity. This fix brings the command up to the same level as the rest of the disassembler. Adds one new file, dmdeferred.c, which is existing code that is now common with the main disassembler and the debugger disassembl command. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/acutils.h7
-rw-r--r--drivers/acpi/acpica/rscalc.c4
-rw-r--r--drivers/acpi/acpica/rscreate.c4
-rw-r--r--drivers/acpi/acpica/rslist.c7
-rw-r--r--drivers/acpi/acpica/utresrc.c74
5 files changed, 52 insertions, 44 deletions
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index b0f5f92b674a..6e51d193c3eb 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -535,12 +535,15 @@ acpi_ut_display_init_pathname(u8 type,
535 * utresrc 535 * utresrc
536 */ 536 */
537acpi_status 537acpi_status
538acpi_ut_walk_aml_resources(u8 *aml, 538acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
539 u8 *aml,
539 acpi_size aml_length, 540 acpi_size aml_length,
540 acpi_walk_aml_callback user_function, 541 acpi_walk_aml_callback user_function,
541 void **context); 542 void **context);
542 543
543acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index); 544acpi_status
545acpi_ut_validate_resource(struct acpi_walk_state *walk_state,
546 void *aml, u8 *return_index);
544 547
545u32 acpi_ut_get_descriptor_length(void *aml); 548u32 acpi_ut_get_descriptor_length(void *aml);
546 549
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 4f39bd663099..da178b4d0521 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -407,7 +407,9 @@ acpi_rs_get_list_length(u8 * aml_buffer,
407 407
408 /* Validate the Resource Type and Resource Length */ 408 /* Validate the Resource Type and Resource Length */
409 409
410 status = acpi_ut_validate_resource(aml_buffer, &resource_index); 410 status =
411 acpi_ut_validate_resource(NULL, aml_buffer,
412 &resource_index);
411 if (ACPI_FAILURE(status)) { 413 if (ACPI_FAILURE(status)) {
412 /* 414 /*
413 * Exit on failure. Cannot continue because the descriptor length 415 * Exit on failure. Cannot continue because the descriptor length
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 81333264e992..55e0908f1b35 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -98,7 +98,7 @@ acpi_buffer_to_resource(u8 *aml_buffer,
98 98
99 /* Perform the AML-to-Resource conversion */ 99 /* Perform the AML-to-Resource conversion */
100 100
101 status = acpi_ut_walk_aml_resources(aml_buffer, aml_buffer_length, 101 status = acpi_ut_walk_aml_resources(NULL, aml_buffer, aml_buffer_length,
102 acpi_rs_convert_aml_to_resources, 102 acpi_rs_convert_aml_to_resources,
103 &current_resource_ptr); 103 &current_resource_ptr);
104 if (status == AE_AML_NO_RESOURCE_END_TAG) { 104 if (status == AE_AML_NO_RESOURCE_END_TAG) {
@@ -174,7 +174,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
174 /* Do the conversion */ 174 /* Do the conversion */
175 175
176 resource = output_buffer->pointer; 176 resource = output_buffer->pointer;
177 status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length, 177 status = acpi_ut_walk_aml_resources(NULL, aml_start, aml_buffer_length,
178 acpi_rs_convert_aml_to_resources, 178 acpi_rs_convert_aml_to_resources,
179 &resource); 179 &resource);
180 if (ACPI_FAILURE(status)) { 180 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 8b64db9a3fd2..83e615834a1c 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -217,9 +217,10 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
217 217
218 /* Perform final sanity check on the new AML resource descriptor */ 218 /* Perform final sanity check on the new AML resource descriptor */
219 219
220 status = 220 status = acpi_ut_validate_resource(NULL,
221 acpi_ut_validate_resource(ACPI_CAST_PTR 221 ACPI_CAST_PTR(union
222 (union aml_resource, aml), NULL); 222 aml_resource,
223 aml), NULL);
223 if (ACPI_FAILURE(status)) { 224 if (ACPI_FAILURE(status)) {
224 return_ACPI_STATUS(status); 225 return_ACPI_STATUS(status);
225 } 226 }
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 7d0a1b5dedff..546ea735fedd 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -383,26 +383,16 @@ static const u8 acpi_gbl_resource_types[] = {
383 ACPI_VARIABLE_LENGTH /* 0E *serial_bus */ 383 ACPI_VARIABLE_LENGTH /* 0E *serial_bus */
384}; 384};
385 385
386/*
387 * For the iASL compiler/disassembler, we don't want any error messages
388 * because the disassembler uses the resource validation code to determine
389 * if Buffer objects are actually Resource Templates.
390 */
391#ifdef ACPI_ASL_COMPILER
392#define ACPI_RESOURCE_ERROR(plist)
393#else
394#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist)
395#endif
396
397/******************************************************************************* 386/*******************************************************************************
398 * 387 *
399 * FUNCTION: acpi_ut_walk_aml_resources 388 * FUNCTION: acpi_ut_walk_aml_resources
400 * 389 *
401 * PARAMETERS: aml - Pointer to the raw AML resource template 390 * PARAMETERS: walk_state - Current walk info
402 * aml_length - Length of the entire template 391 * PARAMETERS: aml - Pointer to the raw AML resource template
403 * user_function - Called once for each descriptor found. If 392 * aml_length - Length of the entire template
404 * NULL, a pointer to the end_tag is returned 393 * user_function - Called once for each descriptor found. If
405 * context - Passed to user_function 394 * NULL, a pointer to the end_tag is returned
395 * context - Passed to user_function
406 * 396 *
407 * RETURN: Status 397 * RETURN: Status
408 * 398 *
@@ -412,7 +402,8 @@ static const u8 acpi_gbl_resource_types[] = {
412 ******************************************************************************/ 402 ******************************************************************************/
413 403
414acpi_status 404acpi_status
415acpi_ut_walk_aml_resources(u8 *aml, 405acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
406 u8 *aml,
416 acpi_size aml_length, 407 acpi_size aml_length,
417 acpi_walk_aml_callback user_function, void **context) 408 acpi_walk_aml_callback user_function, void **context)
418{ 409{
@@ -441,7 +432,8 @@ acpi_ut_walk_aml_resources(u8 *aml,
441 432
442 /* Validate the Resource Type and Resource Length */ 433 /* Validate the Resource Type and Resource Length */
443 434
444 status = acpi_ut_validate_resource(aml, &resource_index); 435 status =
436 acpi_ut_validate_resource(walk_state, aml, &resource_index);
445 if (ACPI_FAILURE(status)) { 437 if (ACPI_FAILURE(status)) {
446 /* 438 /*
447 * Exit on failure. Cannot continue because the descriptor length 439 * Exit on failure. Cannot continue because the descriptor length
@@ -498,7 +490,8 @@ acpi_ut_walk_aml_resources(u8 *aml,
498 490
499 /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */ 491 /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */
500 492
501 (void)acpi_ut_validate_resource(end_tag, &resource_index); 493 (void)acpi_ut_validate_resource(walk_state, end_tag,
494 &resource_index);
502 status = 495 status =
503 user_function(end_tag, 2, offset, resource_index, context); 496 user_function(end_tag, 2, offset, resource_index, context);
504 if (ACPI_FAILURE(status)) { 497 if (ACPI_FAILURE(status)) {
@@ -513,9 +506,10 @@ acpi_ut_walk_aml_resources(u8 *aml,
513 * 506 *
514 * FUNCTION: acpi_ut_validate_resource 507 * FUNCTION: acpi_ut_validate_resource
515 * 508 *
516 * PARAMETERS: aml - Pointer to the raw AML resource descriptor 509 * PARAMETERS: walk_state - Current walk info
517 * return_index - Where the resource index is returned. NULL 510 * aml - Pointer to the raw AML resource descriptor
518 * if the index is not required. 511 * return_index - Where the resource index is returned. NULL
512 * if the index is not required.
519 * 513 *
520 * RETURN: Status, and optionally the Index into the global resource tables 514 * RETURN: Status, and optionally the Index into the global resource tables
521 * 515 *
@@ -525,7 +519,9 @@ acpi_ut_walk_aml_resources(u8 *aml,
525 * 519 *
526 ******************************************************************************/ 520 ******************************************************************************/
527 521
528acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index) 522acpi_status
523acpi_ut_validate_resource(struct acpi_walk_state *walk_state,
524 void *aml, u8 *return_index)
529{ 525{
530 union aml_resource *aml_resource; 526 union aml_resource *aml_resource;
531 u8 resource_type; 527 u8 resource_type;
@@ -627,10 +623,12 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index)
627 if ((aml_resource->common_serial_bus.type == 0) || 623 if ((aml_resource->common_serial_bus.type == 0) ||
628 (aml_resource->common_serial_bus.type > 624 (aml_resource->common_serial_bus.type >
629 AML_RESOURCE_MAX_SERIALBUSTYPE)) { 625 AML_RESOURCE_MAX_SERIALBUSTYPE)) {
630 ACPI_RESOURCE_ERROR((AE_INFO, 626 if (walk_state) {
631 "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", 627 ACPI_ERROR((AE_INFO,
632 aml_resource->common_serial_bus. 628 "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X",
633 type)); 629 aml_resource->common_serial_bus.
630 type));
631 }
634 return (AE_AML_INVALID_RESOURCE_TYPE); 632 return (AE_AML_INVALID_RESOURCE_TYPE);
635 } 633 }
636 } 634 }
@@ -645,18 +643,22 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index)
645 643
646 invalid_resource: 644 invalid_resource:
647 645
648 ACPI_RESOURCE_ERROR((AE_INFO, 646 if (walk_state) {
649 "Invalid/unsupported resource descriptor: Type 0x%2.2X", 647 ACPI_ERROR((AE_INFO,
650 resource_type)); 648 "Invalid/unsupported resource descriptor: Type 0x%2.2X",
649 resource_type));
650 }
651 return (AE_AML_INVALID_RESOURCE_TYPE); 651 return (AE_AML_INVALID_RESOURCE_TYPE);
652 652
653 bad_resource_length: 653 bad_resource_length:
654 654
655 ACPI_RESOURCE_ERROR((AE_INFO, 655 if (walk_state) {
656 "Invalid resource descriptor length: Type " 656 ACPI_ERROR((AE_INFO,
657 "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", 657 "Invalid resource descriptor length: Type "
658 resource_type, resource_length, 658 "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X",
659 minimum_resource_length)); 659 resource_type, resource_length,
660 minimum_resource_length));
661 }
660 return (AE_AML_BAD_RESOURCE_LENGTH); 662 return (AE_AML_BAD_RESOURCE_LENGTH);
661} 663}
662 664
@@ -815,7 +817,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag)
815 817
816 /* Validate the template and get a pointer to the end_tag */ 818 /* Validate the template and get a pointer to the end_tag */
817 819
818 status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, 820 status = acpi_ut_walk_aml_resources(NULL, obj_desc->buffer.pointer,
819 obj_desc->buffer.length, NULL, 821 obj_desc->buffer.length, NULL,
820 (void **)end_tag); 822 (void **)end_tag);
821 823