void acpi_ut_dump_allocations()

in acpica/uttrack.c [540:703]


void acpi_ut_dump_allocations(u32 component, const char *module)
{
	struct acpi_debug_mem_block *element;
	union acpi_descriptor *descriptor;
	u32 num_outstanding = 0;
	u8 descriptor_type;

	ACPI_FUNCTION_TRACE(ut_dump_allocations);

	if (acpi_gbl_disable_mem_tracking) {
		return_VOID;
	}

	/*
	 * Walk the allocation list.
	 */
	if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) {
		return_VOID;
	}

	if (!acpi_gbl_global_list) {
		goto exit;
	}

	element = acpi_gbl_global_list->list_head;
	while (element) {
		if ((element->component & component) &&
		    ((module == NULL)
		     || (0 == strcmp(module, element->module)))) {
			descriptor =
			    ACPI_CAST_PTR(union acpi_descriptor,
					  &element->user_space);

			if (element->size <
			    sizeof(struct acpi_common_descriptor)) {
				acpi_os_printf("%p Length 0x%04X %9.9s-%4.4u "
					       "[Not a Descriptor - too small]\n",
					       descriptor, element->size,
					       element->module, element->line);
			} else {
				/* Ignore allocated objects that are in a cache */

				if (ACPI_GET_DESCRIPTOR_TYPE(descriptor) !=
				    ACPI_DESC_TYPE_CACHED) {
					acpi_os_printf
					    ("%p Length 0x%04X %9.9s-%4.4u [%s] ",
					     descriptor, element->size,
					     element->module, element->line,
					     acpi_ut_get_descriptor_name
					     (descriptor));

					/* Optional object hex dump */

					if (acpi_gbl_verbose_leak_dump) {
						acpi_os_printf("\n");
						acpi_ut_dump_buffer((u8 *)
								    descriptor,
								    element->
								    size,
								    DB_BYTE_DISPLAY,
								    0);
					}

					/* Validate the descriptor type using Type field and length */

					descriptor_type = 0;	/* Not a valid descriptor type */

					switch (ACPI_GET_DESCRIPTOR_TYPE
						(descriptor)) {
					case ACPI_DESC_TYPE_OPERAND:

						if (element->size ==
						    sizeof(union
							   acpi_operand_object))
						{
							descriptor_type =
							    ACPI_DESC_TYPE_OPERAND;
						}
						break;

					case ACPI_DESC_TYPE_PARSER:

						if (element->size ==
						    sizeof(union
							   acpi_parse_object)) {
							descriptor_type =
							    ACPI_DESC_TYPE_PARSER;
						}
						break;

					case ACPI_DESC_TYPE_NAMED:

						if (element->size ==
						    sizeof(struct
							   acpi_namespace_node))
						{
							descriptor_type =
							    ACPI_DESC_TYPE_NAMED;
						}
						break;

					default:

						break;
					}

					/* Display additional info for the major descriptor types */

					switch (descriptor_type) {
					case ACPI_DESC_TYPE_OPERAND:

						acpi_os_printf
						    ("%12.12s RefCount 0x%04X\n",
						     acpi_ut_get_type_name
						     (descriptor->object.common.
						      type),
						     descriptor->object.common.
						     reference_count);
						break;

					case ACPI_DESC_TYPE_PARSER:

						acpi_os_printf
						    ("AmlOpcode 0x%04X\n",
						     descriptor->op.asl.
						     aml_opcode);
						break;

					case ACPI_DESC_TYPE_NAMED:

						acpi_os_printf("%4.4s\n",
							       acpi_ut_get_node_name
							       (&descriptor->
								node));
						break;

					default:

						acpi_os_printf("\n");
						break;
					}
				}
			}

			num_outstanding++;
		}

		element = element->next;
	}

exit:
	(void)acpi_ut_release_mutex(ACPI_MTX_MEMORY);

	/* Print summary */

	if (!num_outstanding) {
		ACPI_INFO(("No outstanding allocations"));
	} else {
		ACPI_ERROR((AE_INFO, "%u (0x%X) Outstanding cache allocations",
			    num_outstanding, num_outstanding));
	}

	return_VOID;
}