示例#1
0
文件: dbobject.c 项目: 020gzh/linux
void acpi_db_decode_arguments(struct acpi_walk_state *walk_state)
{
	u32 i;
	union acpi_operand_object *obj_desc;
	struct acpi_namespace_node *node;
	u8 display_args = FALSE;

	node = walk_state->method_node;
	obj_desc = walk_state->method_desc;

	if (!node) {
		acpi_os_printf
		    ("No method node (Executing subtree for buffer or opregion)\n");
		return;
	}

	if (node->type != ACPI_TYPE_METHOD) {
		acpi_os_printf("Executing subtree for Buffer/Package/Region\n");
		return;
	}

	/* Are any arguments actually set? */

	for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
		obj_desc = walk_state->arguments[i].object;
		if (obj_desc) {
			display_args = TRUE;
			break;
		}
	}

	/* If any are set, only display the ones that are set */

	if (display_args) {
		acpi_os_printf("Initialized Arguments for Method [%4.4s]:  "
			       "(%X arguments defined for method invocation)\n",
			       acpi_ut_get_node_name(node),
			       obj_desc->method.param_count);

		for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
			obj_desc = walk_state->arguments[i].object;
			if (obj_desc) {
				acpi_os_printf("  Arg%u:   ", i);
				acpi_db_display_internal_object(obj_desc,
								walk_state);
			}
		}
	} else {
		acpi_os_printf
		    ("No Arguments are initialized for method [%4.4s]\n",
		     acpi_ut_get_node_name(node));
	}
}
示例#2
0
文件: dbobject.c 项目: 020gzh/linux
void acpi_db_decode_locals(struct acpi_walk_state *walk_state)
{
	u32 i;
	union acpi_operand_object *obj_desc;
	struct acpi_namespace_node *node;
	u8 display_locals = FALSE;

	obj_desc = walk_state->method_desc;
	node = walk_state->method_node;

	if (!node) {
		acpi_os_printf
		    ("No method node (Executing subtree for buffer or opregion)\n");
		return;
	}

	if (node->type != ACPI_TYPE_METHOD) {
		acpi_os_printf("Executing subtree for Buffer/Package/Region\n");
		return;
	}

	/* Are any locals actually set? */

	for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
		obj_desc = walk_state->local_variables[i].object;
		if (obj_desc) {
			display_locals = TRUE;
			break;
		}
	}

	/* If any are set, only display the ones that are set */

	if (display_locals) {
		acpi_os_printf
		    ("\nInitialized Local Variables for method [%4.4s]:\n",
		     acpi_ut_get_node_name(node));

		for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
			obj_desc = walk_state->local_variables[i].object;
			if (obj_desc) {
				acpi_os_printf("  Local%X: ", i);
				acpi_db_display_internal_object(obj_desc,
								walk_state);
			}
		}
	} else {
		acpi_os_printf
		    ("No Local Variables are initialized for method [%4.4s]\n",
		     acpi_ut_get_node_name(node));
	}
}
示例#3
0
void
acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
				struct acpi_walk_state *walk_state)
{

#ifndef ACPI_APPLICATION
	if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
		return;
	}
#endif

	if (!acpi_gbl_cm_single_step) {
		return;
	}

	acpi_os_printf("ArgObj:  ");
	acpi_db_display_internal_object(obj_desc, walk_state);
}
示例#4
0
void acpi_db_display_results(void)
{
	u32 i;
	struct acpi_walk_state *walk_state;
	union acpi_operand_object *obj_desc;
	u32 result_count = 0;
	struct acpi_namespace_node *node;
	union acpi_generic_state *frame;
	u32 index;		/* Index onto current frame */

	walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
	if (!walk_state) {
		acpi_os_printf("There is no method currently executing\n");
		return;
	}

	obj_desc = walk_state->method_desc;
	node = walk_state->method_node;

	if (walk_state->results) {
		result_count = walk_state->result_count;
	}

	acpi_os_printf("Method [%4.4s] has %X stacked result objects\n",
		       acpi_ut_get_node_name(node), result_count);

	/* From the top element of result stack */

	frame = walk_state->results;
	index = (result_count - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;

	for (i = 0; i < result_count; i++) {
		obj_desc = frame->results.obj_desc[index];
		acpi_os_printf("Result%u: ", i);
		acpi_db_display_internal_object(obj_desc, walk_state);

		if (index == 0) {
			frame = frame->results.next;
			index = ACPI_RESULTS_FRAME_OBJ_NUM;
		}

		index--;
	}
}
示例#5
0
void
acpi_db_display_result_object(union acpi_operand_object *obj_desc,
			      struct acpi_walk_state *walk_state)
{

#ifndef ACPI_APPLICATION
	if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
		return;
	}
#endif

	/* Only display if single stepping */

	if (!acpi_gbl_cm_single_step) {
		return;
	}

	acpi_os_printf("ResultObj: ");
	acpi_db_display_internal_object(obj_desc, walk_state);
	acpi_os_printf("\n");
}
示例#6
0
void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level)
{
	u32 i;

	if (!obj_desc) {
		acpi_os_printf("[Null Object]\n");
		return;
	}

	for (i = 0; i < level; i++) {
		acpi_os_printf(" ");
	}

	switch (obj_desc->type) {
	case ACPI_TYPE_ANY:

		acpi_os_printf("[Null Object] (Type=0)\n");
		break;

	case ACPI_TYPE_INTEGER:

		acpi_os_printf("[Integer] = %8.8X%8.8X\n",
			       ACPI_FORMAT_UINT64(obj_desc->integer.value));
		break;

	case ACPI_TYPE_STRING:

		acpi_os_printf("[String] Length %.2X = ",
			       obj_desc->string.length);
		acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
		acpi_os_printf("\n");
		break;

	case ACPI_TYPE_BUFFER:

		acpi_os_printf("[Buffer] Length %.2X = ",
			       obj_desc->buffer.length);
		if (obj_desc->buffer.length) {
			if (obj_desc->buffer.length > 16) {
				acpi_os_printf("\n");
			}

			acpi_ut_debug_dump_buffer(ACPI_CAST_PTR
						  (u8,
						   obj_desc->buffer.pointer),
						  obj_desc->buffer.length,
						  DB_BYTE_DISPLAY, _COMPONENT);
		} else {
			acpi_os_printf("\n");
		}
		break;

	case ACPI_TYPE_PACKAGE:

		acpi_os_printf("[Package] Contains %u Elements:\n",
			       obj_desc->package.count);

		for (i = 0; i < obj_desc->package.count; i++) {
			acpi_db_dump_external_object(&obj_desc->package.
						     elements[i], level + 1);
		}
		break;

	case ACPI_TYPE_LOCAL_REFERENCE:

		acpi_os_printf("[Object Reference] = ");
		acpi_db_display_internal_object(obj_desc->reference.handle,
						NULL);
		break;

	case ACPI_TYPE_PROCESSOR:

		acpi_os_printf("[Processor]\n");
		break;

	case ACPI_TYPE_POWER:

		acpi_os_printf("[Power Resource]\n");
		break;

	default:

		acpi_os_printf("[Unknown Type] %X\n", obj_desc->type);
		break;
	}
}
示例#7
0
void
acpi_db_set_method_data (
	NATIVE_CHAR             *type_arg,
	NATIVE_CHAR             *index_arg,
	NATIVE_CHAR             *value_arg)
{
	NATIVE_CHAR             type;
	u32                     index;
	u32                     value;
	acpi_walk_state         *walk_state;
	acpi_operand_object     *obj_desc;


	/* Validate Type_arg */

	STRUPR (type_arg);
	type = type_arg[0];
	if ((type != 'L') &&
		(type != 'A')) {
		acpi_os_printf ("Invalid SET operand: %s\n", type_arg);
		return;
	}

	/* Get the index and value */

	index = STRTOUL (index_arg, NULL, 16);
	value = STRTOUL (value_arg, NULL, 16);

	walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
	if (!walk_state) {
		acpi_os_printf ("There is no method currently executing\n");
		return;
	}


	/* Create and initialize the new object */

	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
	if (!obj_desc) {
		acpi_os_printf ("Could not create an internal object\n");
		return;
	}

	obj_desc->integer.value = value;


	/* Store the new object into the target */

	switch (type) {
	case 'A':

		/* Set a method argument */

		if (index > MTH_NUM_ARGS) {
			acpi_os_printf ("Arg%d - Invalid argument name\n", index);
			return;
		}

		acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
		obj_desc = walk_state->arguments[index].object;

		acpi_os_printf ("Arg%d: ", index);
		acpi_db_display_internal_object (obj_desc, walk_state);
		break;

	case 'L':

		/* Set a method local */

		if (index > MTH_NUM_LOCALS) {
			acpi_os_printf ("Local%d - Invalid local variable name\n", index);
			return;
		}

		acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
		obj_desc = walk_state->local_variables[index].object;

		acpi_os_printf ("Local%d: ", index);
		acpi_db_display_internal_object (obj_desc, walk_state);
		break;

	default:
		break;
	}
}