ACPICA: Cleanup debug operand dump mechanism

Eliminated unnecessary operands; eliminated use of negative index
in loop.  Operands now displayed in correct order, not backwards.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
This commit is contained in:
Bob Moore 2008-06-10 14:25:05 +08:00 committed by Andi Kleen
parent 5a1a57efeb
commit 71d993e115
8 changed files with 37 additions and 83 deletions

View file

@ -691,12 +691,6 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
status = acpi_ex_resolve_operands(op->common.aml_opcode, status = acpi_ex_resolve_operands(op->common.aml_opcode,
ACPI_WALK_OPERANDS, walk_state); ACPI_WALK_OPERANDS, walk_state);
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name(op->common.aml_opcode),
walk_state->num_operands,
"after AcpiExResolveOperands");
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)",
acpi_ps_get_opcode_name(op->common.aml_opcode), acpi_ps_get_opcode_name(op->common.aml_opcode),
@ -785,10 +779,6 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name(op->common.aml_opcode),
1, "after AcpiExResolveOperands");
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) { if (!obj_desc) {
return_ACPI_STATUS(AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST);
@ -882,10 +872,6 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name(op->common.aml_opcode),
1, "after AcpiExResolveOperands");
operand = &walk_state->operands[0]; operand = &walk_state->operands[0];
/* Find the ACPI table */ /* Find the ACPI table */
@ -1091,10 +1077,8 @@ acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
acpi_ps_get_opcode_name(op->common.aml_opcode), acpi_ps_get_opcode_name(op->common.aml_opcode), 1);
1, "after AcpiExResolveOperands");
/* /*
* Get the bank_value operand and save it * Get the bank_value operand and save it
* (at Top of stack) * (at Top of stack)

View file

@ -408,14 +408,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
[walk_state-> [walk_state->
num_operands - 1]), num_operands - 1]),
walk_state); walk_state);
if (ACPI_SUCCESS(status)) {
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name
(walk_state->opcode),
walk_state->num_operands,
"after ExResolveOperands");
}
} }
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {

View file

@ -580,25 +580,22 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
acpi_os_printf("Buffer len %X @ %p\n", acpi_os_printf("Buffer length %.2X @ %p\n",
obj_desc->buffer.length, obj_desc->buffer.length,
obj_desc->buffer.pointer); obj_desc->buffer.pointer);
length = obj_desc->buffer.length;
if (length > 64) {
length = 64;
}
/* Debug only -- dump the buffer contents */ /* Debug only -- dump the buffer contents */
if (obj_desc->buffer.pointer) { if (obj_desc->buffer.pointer) {
acpi_os_printf("Buffer Contents: "); length = obj_desc->buffer.length;
if (length > 128) {
for (index = 0; index < length; index++) { length = 128;
acpi_os_printf(" %02x",
obj_desc->buffer.pointer[index]);
} }
acpi_os_printf("\n");
acpi_os_printf
("Buffer Contents: (displaying length 0x%.2X)\n",
length);
ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, length);
} }
break; break;
@ -756,55 +753,42 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
* *
* FUNCTION: acpi_ex_dump_operands * FUNCTION: acpi_ex_dump_operands
* *
* PARAMETERS: Operands - Operand list * PARAMETERS: Operands - A list of Operand objects
* interpreter_mode - Load or Exec * opcode_name - AML opcode name
* Ident - Identification * num_operands - Operand count for this opcode
* num_levels - # of stack entries to dump above line
* Note - Output notation
* module_name - Caller's module name
* line_number - Caller's invocation line number
* *
* DESCRIPTION: Dump the object stack * DESCRIPTION: Dump the operands associated with the opcode
* *
******************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_operands(union acpi_operand_object **operands, acpi_ex_dump_operands(union acpi_operand_object **operands,
acpi_interpreter_mode interpreter_mode, const char *opcode_name, u32 num_operands)
const char *ident,
u32 num_levels,
const char *note,
const char *module_name, u32 line_number)
{ {
s32 i;
ACPI_FUNCTION_NAME(ex_dump_operands); ACPI_FUNCTION_NAME(ex_dump_operands);
if (!ident) { if (!opcode_name) {
ident = "?"; opcode_name = "UNKNOWN";
}
if (!note) {
note = "?";
} }
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"************* Operand Stack Contents (Opcode [%s], %d Operands)\n", "**** Start operand dump for opcode [%s], %d operands\n",
ident, num_levels)); opcode_name, num_operands));
if (num_levels == 0) { if (num_operands == 0) {
num_levels = 1; num_operands = 1;
} }
/* Dump the operand stack starting at the top */ /* Dump the individual operands */
for (i = 0; num_levels > 0; i--, num_levels--) { while (num_operands) {
acpi_ex_dump_operand(operands[i], 0); acpi_ex_dump_operand(*operands, 0);
operands++;
num_operands--;
} }
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"************* Operand Stack dump from %s(%d), %s\n", "**** End operand dump for [%s]\n", opcode_name));
module_name, line_number, note));
return; return;
} }

View file

@ -698,5 +698,9 @@ acpi_ex_resolve_operands(u16 opcode,
} }
} }
ACPI_DUMP_OPERANDS(walk_state->operands,
acpi_ps_get_opcode_name(opcode),
walk_state->num_operands);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View file

@ -343,12 +343,6 @@ acpi_ex_store(union acpi_operand_object *source_desc,
acpi_ut_get_object_type_name(dest_desc), acpi_ut_get_object_type_name(dest_desc),
dest_desc)); dest_desc));
ACPI_DUMP_STACK_ENTRY(source_desc);
ACPI_DUMP_STACK_ENTRY(dest_desc);
ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore",
2,
"Target is not a Reference or Constant object");
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }

View file

@ -515,12 +515,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
if (obj_type > ACPI_TYPE_LOCAL_MAX) { if (obj_type > ACPI_TYPE_LOCAL_MAX) {
acpi_os_printf acpi_os_printf
("(Ptr to ACPI Object type %X [UNKNOWN])\n", ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
obj_type); obj_type);
bytes_to_dump = 32; bytes_to_dump = 32;
} else { } else {
acpi_os_printf acpi_os_printf
("(Ptr to ACPI Object type %X [%s])\n", ("(Pointer to ACPI Object type %.2X [%s])\n",
obj_type, acpi_ut_get_type_name(obj_type)); obj_type, acpi_ut_get_type_name(obj_type));
bytes_to_dump = bytes_to_dump =
sizeof(union acpi_operand_object); sizeof(union acpi_operand_object);

View file

@ -366,11 +366,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);
void void
acpi_ex_dump_operands(union acpi_operand_object **operands, acpi_ex_dump_operands(union acpi_operand_object **operands,
acpi_interpreter_mode interpreter_mode, const char *opcode_name, u32 num_opcodes);
const char *ident,
u32 num_levels,
const char *note,
const char *module_name, u32 line_number);
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
void void

View file

@ -597,7 +597,7 @@ struct acpi_integer_overlay {
/* Stack and buffer dumping */ /* Stack and buffer dumping */
#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__) #define ACPI_DUMP_OPERANDS(a,b,c) acpi_ex_dump_operands(a,b,c)
#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) #define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
@ -633,7 +633,7 @@ struct acpi_integer_overlay {
#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) #define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
#define ACPI_FUNCTION_ENTRY() do { } while(0) #define ACPI_FUNCTION_ENTRY() do { } while(0)
#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) #define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e) do { } while(0) #define ACPI_DUMP_OPERANDS(a,b,c) do { } while(0)
#define ACPI_DUMP_ENTRY(a,b) do { } while(0) #define ACPI_DUMP_ENTRY(a,b) do { } while(0)
#define ACPI_DUMP_TABLES(a,b) do { } while(0) #define ACPI_DUMP_TABLES(a,b) do { } while(0)
#define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0) #define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0)