Beispiel #1
0
void acpi_db_display_template(char *buffer_arg)
{
	struct acpi_namespace_node *node;
	acpi_status status;
	struct acpi_buffer return_buffer;

	/* Translate buffer_arg to an Named object */

	node = acpi_db_convert_to_node(buffer_arg);
	if (!node || (node == acpi_gbl_root_node)) {
		acpi_os_printf("Invalid argument: %s\n", buffer_arg);
		return;
	}

	/* We must have a buffer object */

	if (node->type != ACPI_TYPE_BUFFER) {
		acpi_os_printf
		    ("Not a Buffer object, cannot be a template: %s\n",
		     buffer_arg);
		return;
	}

	return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
	return_buffer.pointer = acpi_gbl_db_buffer;

	/* Attempt to convert the raw buffer to a resource list */

	status = acpi_rs_create_resource_list(node->object, &return_buffer);

	acpi_db_set_output_destination(ACPI_DB_REDIRECTABLE_OUTPUT);
	acpi_dbg_level |= ACPI_LV_RESOURCES;

	if (ACPI_FAILURE(status)) {
		acpi_os_printf
		    ("Could not convert Buffer to a resource list: %s, %s\n",
		     buffer_arg, acpi_format_exception(status));
		goto dump_buffer;
	}

	/* Now we can dump the resource list */

	acpi_rs_dump_resource_list(ACPI_CAST_PTR(struct acpi_resource,
						 return_buffer.pointer));

dump_buffer:
	acpi_os_printf("\nRaw data buffer:\n");
	acpi_ut_debug_dump_buffer((u8 *)node->object->buffer.pointer,
				  node->object->buffer.length,
				  DB_BYTE_DISPLAY, ACPI_UINT32_MAX);

	acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
	return;
}
Beispiel #2
0
acpi_status
acpi_rs_get_prs_method_data (
	acpi_handle             handle,
	acpi_buffer             *ret_buffer)
{
	acpi_operand_object     *ret_obj;
	acpi_status             status;
	u32                     buffer_space_needed = ret_buffer->length;


	FUNCTION_TRACE ("Rs_get_prs_method_data");


	/* already validated params, so we won't repeat here */

	/*
	 *  Execute the method, no parameters
	 */
	status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &ret_obj);
	if (ACPI_FAILURE (status)) {
		return_ACPI_STATUS (status);
	}

	if (!ret_obj) {
		/* Return object is required */

		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n"));
		return_ACPI_STATUS (AE_TYPE);
	}

	/*
	 * The return object will be a buffer, but check the
	 *  parameters.  If the return object is not a buffer,
	 *  then the underlying AML code is corrupt or improperly
	 *  written..
	 */
	if (ACPI_TYPE_BUFFER != ret_obj->common.type) {
		status = AE_AML_OPERAND_TYPE;
		goto cleanup;
	}

	/*
	 * Make the call to create a resource linked list from the
	 *  byte stream buffer that comes back from the _CRS method
	 *  execution.
	 */
	status = acpi_rs_create_resource_list (ret_obj, ret_buffer->pointer,
			 &buffer_space_needed);

	/*
	 * Tell the user how much of the buffer we have used or is needed
	 *  and return the final status.
	 */
	ret_buffer->length = buffer_space_needed;


	/* On exit, we must delete the object returned by evaluate_object */

cleanup:

	acpi_ut_remove_reference (ret_obj);
	return_ACPI_STATUS (status);
}