exdump.c 29.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7
/******************************************************************************
 *
 * Module Name: exdump - Interpreter debug output routines
 *
 *****************************************************************************/

/*
B
Bob Moore 已提交
8
 * Copyright (C) 2000 - 2006, R. Byron Moore
L
Linus Torvalds 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>

#define _COMPONENT          ACPI_EXECUTER
L
Len Brown 已提交
51
ACPI_MODULE_NAME("exdump")
L
Linus Torvalds 已提交
52

53 54 55 56
/*
 * The following routines are used for debug output only
 */
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
R
Robert Moore 已提交
57
/* Local prototypes */
L
Len Brown 已提交
58
static void acpi_ex_out_string(char *title, char *value);
R
Robert Moore 已提交
59

L
Len Brown 已提交
60
static void acpi_ex_out_pointer(char *title, void *value);
R
Robert Moore 已提交
61

L
Len Brown 已提交
62
static void acpi_ex_out_address(char *title, acpi_physical_address value);
R
Robert Moore 已提交
63

B
Bob Moore 已提交
64
static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
65 66

static void
B
Bob Moore 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
			 u32 level, u32 index);

/*******************************************************************************
 *
 * Object Descriptor info tables
 *
 * Note: The first table entry must be an INIT opcode and must contain
 * the table length (number of table entries)
 *
 ******************************************************************************/

static struct acpi_exdump_info acpi_ex_dump_integer[2] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL},
	{ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"}
};

static struct acpi_exdump_info acpi_ex_dump_string[4] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"},
	{ACPI_EXD_STRING, 0, NULL}
};

static struct acpi_exdump_info acpi_ex_dump_buffer[4] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"},
	{ACPI_EXD_BUFFER, 0, NULL}
};

static struct acpi_exdump_info acpi_ex_dump_package[5] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"},
	{ACPI_EXD_PACKAGE, 0, NULL}
};

static struct acpi_exdump_info acpi_ex_dump_device[4] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.system_notify),
	 "System Notify"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.device_notify),
	 "Device Notify"}
};

static struct acpi_exdump_info acpi_ex_dump_event[2] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"}
};

B
Bob Moore 已提交
120
static struct acpi_exdump_info acpi_ex_dump_method[8] = {
B
Bob Moore 已提交
121 122 123 124 125
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"},
B
Bob Moore 已提交
126
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"},
B
Bob Moore 已提交
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"}
};

static struct acpi_exdump_info acpi_ex_dump_mutex[5] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"},
	{ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth),
	 "Acquire Depth"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"}
};

static struct acpi_exdump_info acpi_ex_dump_region[7] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"},
	{ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.handler), "Handler"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"}
};

static struct acpi_exdump_info acpi_ex_dump_power[5] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level),
	 "System Level"},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order),
	 "Resource Order"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.system_notify),
	 "System Notify"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.device_notify),
	 "Device Notify"}
};

static struct acpi_exdump_info acpi_ex_dump_processor[7] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.length), "Length"},
	{ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify),
	 "System Notify"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.device_notify),
	 "Device Notify"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"}
};

static struct acpi_exdump_info acpi_ex_dump_thermal[4] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.system_notify),
	 "System Notify"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.device_notify),
	 "Device Notify"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"}
};

static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL},
	{ACPI_EXD_FIELD, 0, NULL},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj),
	 "Buffer Object"}
};

static struct acpi_exdump_info acpi_ex_dump_region_field[3] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL},
	{ACPI_EXD_FIELD, 0, NULL},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"}
};

static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
	{ACPI_EXD_FIELD, 0, NULL},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj),
	 "Region Object"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"}
};

static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
	{ACPI_EXD_FIELD, 0, NULL},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj),
	 "Index Object"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
};

static struct acpi_exdump_info acpi_ex_dump_reference[7] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"},
	{ACPI_EXD_REFERENCE, 0, NULL}
};

static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler),
	 NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.next), "Next"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.region_list),
	 "Region List"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.node), "Node"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"}
};

static struct acpi_exdump_info acpi_ex_dump_notify[3] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"}
};

/* Miscellaneous tables */

static struct acpi_exdump_info acpi_ex_dump_common[4] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL},
	{ACPI_EXD_TYPE, 0, NULL},
	{ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count),
	 "Reference Count"},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"}
};

static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags),
	 "Field Flags"},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width),
	 "Access Byte Width"},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length),
	 "Bit Length"},
	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset),
	 "Field Bit Offset"},
	{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset),
	 "Base Byte Offset"},
	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
};

static struct acpi_exdump_info acpi_ex_dump_node[6] = {
	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
	{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
	{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
	{ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count),
	 "Reference Count"},
	{ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"},
	{ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"}
};

/* Dispatch table, indexed by object type */

static struct acpi_exdump_info *acpi_ex_dump_info[] = {
	NULL,
	acpi_ex_dump_integer,
	acpi_ex_dump_string,
	acpi_ex_dump_buffer,
	acpi_ex_dump_package,
	NULL,
	acpi_ex_dump_device,
	acpi_ex_dump_event,
	acpi_ex_dump_method,
	acpi_ex_dump_mutex,
	acpi_ex_dump_region,
	acpi_ex_dump_power,
	acpi_ex_dump_processor,
	acpi_ex_dump_thermal,
	acpi_ex_dump_buffer_field,
	NULL,
	NULL,
	acpi_ex_dump_region_field,
	acpi_ex_dump_bank_field,
	acpi_ex_dump_index_field,
	acpi_ex_dump_reference,
	NULL,
	NULL,
	acpi_ex_dump_notify,
	acpi_ex_dump_address_handler,
	NULL,
	NULL,
	NULL
};

/*******************************************************************************
 *
 * FUNCTION:    acpi_ex_dump_object
 *
 * PARAMETERS:  obj_desc            - Descriptor to dump
 *              Info                - Info table corresponding to this object
 *                                    type
 *
 * RETURN:      None
 *
 * DESCRIPTION: Walk the info table for this object
 *
 ******************************************************************************/

static void
acpi_ex_dump_object(union acpi_operand_object *obj_desc,
		    struct acpi_exdump_info *info)
{
	u8 *target;
	char *name;
	u8 count;

	if (!info) {
		acpi_os_printf
		    ("ex_dump_object: Display not implemented for object type %s\n",
		     acpi_ut_get_object_type_name(obj_desc));
		return;
	}

	/* First table entry must contain the table length (# of table entries) */

	count = info->offset;

	while (count) {
B
Bob Moore 已提交
343
		target = ACPI_ADD_PTR(u8, obj_desc, info->offset);
B
Bob Moore 已提交
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
		name = info->name;

		switch (info->opcode) {
		case ACPI_EXD_INIT:
			break;

		case ACPI_EXD_TYPE:
			acpi_ex_out_string("Type",
					   acpi_ut_get_object_type_name
					   (obj_desc));
			break;

		case ACPI_EXD_UINT8:

			acpi_os_printf("%20s : %2.2X\n", name, *target);
			break;

		case ACPI_EXD_UINT16:

			acpi_os_printf("%20s : %4.4X\n", name,
B
Bob Moore 已提交
364
				       ACPI_GET16(target));
B
Bob Moore 已提交
365 366 367 368 369
			break;

		case ACPI_EXD_UINT32:

			acpi_os_printf("%20s : %8.8X\n", name,
B
Bob Moore 已提交
370
				       ACPI_GET32(target));
B
Bob Moore 已提交
371 372 373 374 375
			break;

		case ACPI_EXD_UINT64:

			acpi_os_printf("%20s : %8.8X%8.8X\n", "Value",
B
Bob Moore 已提交
376
				       ACPI_FORMAT_UINT64(ACPI_GET64(target)));
B
Bob Moore 已提交
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
			break;

		case ACPI_EXD_POINTER:

			acpi_ex_out_pointer(name,
					    *ACPI_CAST_PTR(void *, target));
			break;

		case ACPI_EXD_ADDRESS:

			acpi_ex_out_address(name,
					    *ACPI_CAST_PTR
					    (acpi_physical_address, target));
			break;

		case ACPI_EXD_STRING:

			acpi_ut_print_string(obj_desc->string.pointer,
					     ACPI_UINT8_MAX);
			acpi_os_printf("\n");
			break;

		case ACPI_EXD_BUFFER:

			ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,
					 obj_desc->buffer.length);
			break;

		case ACPI_EXD_PACKAGE:

			/* Dump the package contents */

			acpi_os_printf("\nPackage Contents:\n");
			acpi_ex_dump_package_obj(obj_desc, 0, 0);
			break;

		case ACPI_EXD_FIELD:

			acpi_ex_dump_object(obj_desc,
					    acpi_ex_dump_field_common);
			break;

		case ACPI_EXD_REFERENCE:

			acpi_ex_out_string("Opcode",
					   (acpi_ps_get_opcode_info
					    (obj_desc->reference.opcode))->
					   name);
			acpi_ex_dump_reference_obj(obj_desc);
			break;

		default:
			acpi_os_printf("**** Invalid table opcode [%X] ****\n",
				       info->opcode);
			return;
		}

		info++;
		count--;
	}
}
L
Linus Torvalds 已提交
438

R
Robert Moore 已提交
439
/*******************************************************************************
L
Linus Torvalds 已提交
440 441 442
 *
 * FUNCTION:    acpi_ex_dump_operand
 *
R
Robert Moore 已提交
443 444
 * PARAMETERS:  *obj_desc       - Pointer to entry to be dumped
 *              Depth           - Current nesting depth
L
Linus Torvalds 已提交
445 446 447 448 449
 *
 * RETURN:      None
 *
 * DESCRIPTION: Dump an operand object
 *
R
Robert Moore 已提交
450
 ******************************************************************************/
L
Linus Torvalds 已提交
451

L
Len Brown 已提交
452
void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
L
Linus Torvalds 已提交
453
{
L
Len Brown 已提交
454 455
	u32 length;
	u32 index;
L
Linus Torvalds 已提交
456

L
Len Brown 已提交
457
	ACPI_FUNCTION_NAME("ex_dump_operand")
L
Linus Torvalds 已提交
458

L
Len Brown 已提交
459 460 461
	    if (!
		((ACPI_LV_EXEC & acpi_dbg_level)
		 && (_COMPONENT & acpi_dbg_layer))) {
L
Linus Torvalds 已提交
462 463 464 465
		return;
	}

	if (!obj_desc) {
B
Bob Moore 已提交
466

R
Robert Moore 已提交
467 468
		/* This could be a null element of a package */

L
Len Brown 已提交
469
		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
L
Linus Torvalds 已提交
470 471 472
		return;
	}

L
Len Brown 已提交
473 474 475 476
	if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
				  obj_desc));
		ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
L
Linus Torvalds 已提交
477 478 479
		return;
	}

L
Len Brown 已提交
480 481 482 483 484 485
	if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
				  "%p is not a node or operand object: [%s]\n",
				  obj_desc,
				  acpi_ut_get_descriptor_name(obj_desc)));
		ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
L
Linus Torvalds 已提交
486 487 488 489 490 491
		return;
	}

	/* obj_desc is a valid object */

	if (depth > 0) {
L
Len Brown 已提交
492 493 494 495
		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ",
				  depth, " ", depth, obj_desc));
	} else {
		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc));
L
Linus Torvalds 已提交
496 497
	}

R
Robert Moore 已提交
498 499
	/* Decode object type */

L
Len Brown 已提交
500
	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
L
Linus Torvalds 已提交
501 502 503 504 505
	case ACPI_TYPE_LOCAL_REFERENCE:

		switch (obj_desc->reference.opcode) {
		case AML_DEBUG_OP:

L
Len Brown 已提交
506
			acpi_os_printf("Reference: Debug\n");
L
Linus Torvalds 已提交
507 508 509 510
			break;

		case AML_NAME_OP:

L
Len Brown 已提交
511 512 513 514 515
			ACPI_DUMP_PATHNAME(obj_desc->reference.object,
					   "Reference: Name: ", ACPI_LV_INFO,
					   _COMPONENT);
			ACPI_DUMP_ENTRY(obj_desc->reference.object,
					ACPI_LV_INFO);
L
Linus Torvalds 已提交
516 517 518 519
			break;

		case AML_INDEX_OP:

L
Len Brown 已提交
520 521
			acpi_os_printf("Reference: Index %p\n",
				       obj_desc->reference.object);
L
Linus Torvalds 已提交
522 523 524 525
			break;

		case AML_REF_OF_OP:

L
Len Brown 已提交
526 527
			acpi_os_printf("Reference: (ref_of) %p\n",
				       obj_desc->reference.object);
L
Linus Torvalds 已提交
528 529 530 531
			break;

		case AML_ARG_OP:

L
Len Brown 已提交
532 533
			acpi_os_printf("Reference: Arg%d",
				       obj_desc->reference.offset);
L
Linus Torvalds 已提交
534

L
Len Brown 已提交
535
			if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
B
Bob Moore 已提交
536

L
Linus Torvalds 已提交
537 538
				/* Value is an Integer */

L
Len Brown 已提交
539 540 541 542
				acpi_os_printf(" value is [%8.8X%8.8x]",
					       ACPI_FORMAT_UINT64(obj_desc->
								  integer.
								  value));
L
Linus Torvalds 已提交
543 544
			}

L
Len Brown 已提交
545
			acpi_os_printf("\n");
L
Linus Torvalds 已提交
546 547 548 549
			break;

		case AML_LOCAL_OP:

L
Len Brown 已提交
550 551
			acpi_os_printf("Reference: Local%d",
				       obj_desc->reference.offset);
L
Linus Torvalds 已提交
552

L
Len Brown 已提交
553
			if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
L
Linus Torvalds 已提交
554 555 556

				/* Value is an Integer */

L
Len Brown 已提交
557 558 559 560
				acpi_os_printf(" value is [%8.8X%8.8x]",
					       ACPI_FORMAT_UINT64(obj_desc->
								  integer.
								  value));
L
Linus Torvalds 已提交
561 562
			}

L
Len Brown 已提交
563
			acpi_os_printf("\n");
L
Linus Torvalds 已提交
564 565 566 567
			break;

		case AML_INT_NAMEPATH_OP:

L
Len Brown 已提交
568 569
			acpi_os_printf("Reference.Node->Name %X\n",
				       obj_desc->reference.node->name.integer);
L
Linus Torvalds 已提交
570 571 572 573 574 575
			break;

		default:

			/* Unknown opcode */

L
Len Brown 已提交
576 577
			acpi_os_printf("Unknown Reference opcode=%X\n",
				       obj_desc->reference.opcode);
L
Linus Torvalds 已提交
578 579 580 581 582 583 584
			break;

		}
		break;

	case ACPI_TYPE_BUFFER:

B
Bob Moore 已提交
585
		acpi_os_printf("Buffer len %X @ %p\n",
L
Len Brown 已提交
586 587
			       obj_desc->buffer.length,
			       obj_desc->buffer.pointer);
L
Linus Torvalds 已提交
588 589 590 591 592 593 594 595 596

		length = obj_desc->buffer.length;
		if (length > 64) {
			length = 64;
		}

		/* Debug only -- dump the buffer contents */

		if (obj_desc->buffer.pointer) {
L
Len Brown 已提交
597
			acpi_os_printf("Buffer Contents: ");
L
Linus Torvalds 已提交
598 599

			for (index = 0; index < length; index++) {
L
Len Brown 已提交
600 601
				acpi_os_printf(" %02x",
					       obj_desc->buffer.pointer[index]);
L
Linus Torvalds 已提交
602
			}
L
Len Brown 已提交
603
			acpi_os_printf("\n");
L
Linus Torvalds 已提交
604 605 606 607 608
		}
		break;

	case ACPI_TYPE_INTEGER:

L
Len Brown 已提交
609 610
		acpi_os_printf("Integer %8.8X%8.8X\n",
			       ACPI_FORMAT_UINT64(obj_desc->integer.value));
L
Linus Torvalds 已提交
611 612 613 614
		break;

	case ACPI_TYPE_PACKAGE:

L
Len Brown 已提交
615 616 617
		acpi_os_printf("Package [Len %X] element_array %p\n",
			       obj_desc->package.count,
			       obj_desc->package.elements);
L
Linus Torvalds 已提交
618 619 620 621 622 623

		/*
		 * If elements exist, package element pointer is valid,
		 * and debug_level exceeds 1, dump package's elements.
		 */
		if (obj_desc->package.count &&
L
Len Brown 已提交
624 625 626 627 628 629
		    obj_desc->package.elements && acpi_dbg_level > 1) {
			for (index = 0; index < obj_desc->package.count;
			     index++) {
				acpi_ex_dump_operand(obj_desc->package.
						     elements[index],
						     depth + 1);
L
Linus Torvalds 已提交
630 631 632 633 634 635
			}
		}
		break;

	case ACPI_TYPE_REGION:

L
Len Brown 已提交
636 637 638 639
		acpi_os_printf("Region %s (%X)",
			       acpi_ut_get_region_name(obj_desc->region.
						       space_id),
			       obj_desc->region.space_id);
L
Linus Torvalds 已提交
640 641 642 643 644 645

		/*
		 * If the address and length have not been evaluated,
		 * don't print them.
		 */
		if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
L
Len Brown 已提交
646 647 648 649 650 651
			acpi_os_printf("\n");
		} else {
			acpi_os_printf(" base %8.8X%8.8X Length %X\n",
				       ACPI_FORMAT_UINT64(obj_desc->region.
							  address),
				       obj_desc->region.length);
L
Linus Torvalds 已提交
652 653 654 655 656
		}
		break;

	case ACPI_TYPE_STRING:

L
Len Brown 已提交
657 658 659
		acpi_os_printf("String length %X @ %p ",
			       obj_desc->string.length,
			       obj_desc->string.pointer);
R
Robert Moore 已提交
660

L
Len Brown 已提交
661 662
		acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
		acpi_os_printf("\n");
L
Linus Torvalds 已提交
663 664 665 666
		break;

	case ACPI_TYPE_LOCAL_BANK_FIELD:

L
Len Brown 已提交
667
		acpi_os_printf("bank_field\n");
L
Linus Torvalds 已提交
668 669 670 671
		break;

	case ACPI_TYPE_LOCAL_REGION_FIELD:

L
Len Brown 已提交
672 673 674 675 676 677 678 679
		acpi_os_printf
		    ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
		     obj_desc->field.bit_length,
		     obj_desc->field.access_byte_width,
		     obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
		     obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
		     obj_desc->field.base_byte_offset,
		     obj_desc->field.start_field_bit_offset);
R
Robert Moore 已提交
680

L
Len Brown 已提交
681
		acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1);
L
Linus Torvalds 已提交
682 683 684 685
		break;

	case ACPI_TYPE_LOCAL_INDEX_FIELD:

L
Len Brown 已提交
686
		acpi_os_printf("index_field\n");
L
Linus Torvalds 已提交
687 688 689 690
		break;

	case ACPI_TYPE_BUFFER_FIELD:

B
Bob Moore 已提交
691
		acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n",
L
Len Brown 已提交
692 693 694
			       obj_desc->buffer_field.bit_length,
			       obj_desc->buffer_field.base_byte_offset,
			       obj_desc->buffer_field.start_field_bit_offset);
L
Linus Torvalds 已提交
695 696

		if (!obj_desc->buffer_field.buffer_obj) {
B
Bob Moore 已提交
697
			ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
L
Len Brown 已提交
698 699 700
		} else
		    if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
			!= ACPI_TYPE_BUFFER) {
B
Bob Moore 已提交
701
			acpi_os_printf("*not a Buffer*\n");
L
Len Brown 已提交
702 703 704
		} else {
			acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
					     depth + 1);
L
Linus Torvalds 已提交
705 706 707 708 709
		}
		break;

	case ACPI_TYPE_EVENT:

L
Len Brown 已提交
710
		acpi_os_printf("Event\n");
L
Linus Torvalds 已提交
711 712 713 714
		break;

	case ACPI_TYPE_METHOD:

L
Len Brown 已提交
715 716 717 718
		acpi_os_printf("Method(%X) @ %p:%X\n",
			       obj_desc->method.param_count,
			       obj_desc->method.aml_start,
			       obj_desc->method.aml_length);
L
Linus Torvalds 已提交
719 720 721 722
		break;

	case ACPI_TYPE_MUTEX:

L
Len Brown 已提交
723
		acpi_os_printf("Mutex\n");
L
Linus Torvalds 已提交
724 725 726 727
		break;

	case ACPI_TYPE_DEVICE:

L
Len Brown 已提交
728
		acpi_os_printf("Device\n");
L
Linus Torvalds 已提交
729 730 731 732
		break;

	case ACPI_TYPE_POWER:

L
Len Brown 已提交
733
		acpi_os_printf("Power\n");
L
Linus Torvalds 已提交
734 735 736 737
		break;

	case ACPI_TYPE_PROCESSOR:

L
Len Brown 已提交
738
		acpi_os_printf("Processor\n");
L
Linus Torvalds 已提交
739 740 741 742
		break;

	case ACPI_TYPE_THERMAL:

L
Len Brown 已提交
743
		acpi_os_printf("Thermal\n");
L
Linus Torvalds 已提交
744 745 746 747 748
		break;

	default:
		/* Unknown Type */

L
Len Brown 已提交
749 750
		acpi_os_printf("Unknown Type %X\n",
			       ACPI_GET_OBJECT_TYPE(obj_desc));
L
Linus Torvalds 已提交
751 752 753 754 755 756
		break;
	}

	return;
}

R
Robert Moore 已提交
757
/*******************************************************************************
L
Linus Torvalds 已提交
758 759 760 761 762 763 764 765 766 767 768 769 770
 *
 * FUNCTION:    acpi_ex_dump_operands
 *
 * PARAMETERS:  Operands            - Operand list
 *              interpreter_mode    - Load or Exec
 *              Ident               - Identification
 *              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
 *
R
Robert Moore 已提交
771
 ******************************************************************************/
L
Linus Torvalds 已提交
772 773

void
L
Len Brown 已提交
774 775 776 777 778
acpi_ex_dump_operands(union acpi_operand_object **operands,
		      acpi_interpreter_mode interpreter_mode,
		      char *ident,
		      u32 num_levels,
		      char *note, char *module_name, u32 line_number)
L
Linus Torvalds 已提交
779
{
L
Len Brown 已提交
780
	acpi_native_uint i;
L
Linus Torvalds 已提交
781

L
Len Brown 已提交
782
	ACPI_FUNCTION_NAME("ex_dump_operands");
L
Linus Torvalds 已提交
783 784 785 786 787 788 789 790 791

	if (!ident) {
		ident = "?";
	}

	if (!note) {
		note = "?";
	}

L
Len Brown 已提交
792 793 794
	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
			  "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
			  ident, num_levels));
L
Linus Torvalds 已提交
795 796 797 798 799 800 801 802

	if (num_levels == 0) {
		num_levels = 1;
	}

	/* Dump the operand stack starting at the top */

	for (i = 0; num_levels > 0; i--, num_levels--) {
L
Len Brown 已提交
803
		acpi_ex_dump_operand(operands[i], 0);
L
Linus Torvalds 已提交
804 805
	}

L
Len Brown 已提交
806 807 808
	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
			  "************* Operand Stack dump from %s(%d), %s\n",
			  module_name, line_number, note));
L
Linus Torvalds 已提交
809 810 811
	return;
}

R
Robert Moore 已提交
812
/*******************************************************************************
L
Linus Torvalds 已提交
813
 *
R
Robert Moore 已提交
814
 * FUNCTION:    acpi_ex_out* functions
L
Linus Torvalds 已提交
815 816 817 818 819 820 821 822
 *
 * PARAMETERS:  Title               - Descriptive text
 *              Value               - Value to be displayed
 *
 * DESCRIPTION: Object dump output formatting functions.  These functions
 *              reduce the number of format strings required and keeps them
 *              all in one place for easy modification.
 *
R
Robert Moore 已提交
823
 ******************************************************************************/
L
Linus Torvalds 已提交
824

L
Len Brown 已提交
825
static void acpi_ex_out_string(char *title, char *value)
L
Linus Torvalds 已提交
826
{
L
Len Brown 已提交
827
	acpi_os_printf("%20s : %s\n", title, value);
L
Linus Torvalds 已提交
828 829
}

L
Len Brown 已提交
830
static void acpi_ex_out_pointer(char *title, void *value)
L
Linus Torvalds 已提交
831
{
L
Len Brown 已提交
832
	acpi_os_printf("%20s : %p\n", title, value);
L
Linus Torvalds 已提交
833 834
}

L
Len Brown 已提交
835
static void acpi_ex_out_address(char *title, acpi_physical_address value)
L
Linus Torvalds 已提交
836 837 838
{

#if ACPI_MACHINE_WIDTH == 16
L
Len Brown 已提交
839
	acpi_os_printf("%20s : %p\n", title, value);
L
Linus Torvalds 已提交
840
#else
L
Len Brown 已提交
841
	acpi_os_printf("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
L
Linus Torvalds 已提交
842 843 844
#endif
}

R
Robert Moore 已提交
845
/*******************************************************************************
L
Linus Torvalds 已提交
846
 *
B
Bob Moore 已提交
847
 * FUNCTION:    acpi_ex_dump_namespace_node
L
Linus Torvalds 已提交
848
 *
B
Bob Moore 已提交
849
 * PARAMETERS:  Node                - Descriptor to dump
R
Robert Moore 已提交
850
 *              Flags               - Force display if TRUE
L
Linus Torvalds 已提交
851 852 853
 *
 * DESCRIPTION: Dumps the members of the given.Node
 *
R
Robert Moore 已提交
854
 ******************************************************************************/
L
Linus Torvalds 已提交
855

B
Bob Moore 已提交
856
void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
L
Linus Torvalds 已提交
857 858
{

L
Len Brown 已提交
859
	ACPI_FUNCTION_ENTRY();
L
Linus Torvalds 已提交
860 861

	if (!flags) {
L
Len Brown 已提交
862 863 864
		if (!
		    ((ACPI_LV_OBJECTS & acpi_dbg_level)
		     && (_COMPONENT & acpi_dbg_layer))) {
L
Linus Torvalds 已提交
865 866 867 868
			return;
		}
	}

L
Len Brown 已提交
869 870 871 872 873
	acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node));
	acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type));
	acpi_ex_out_pointer("Attached Object",
			    acpi_ns_get_attached_object(node));
	acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node));
B
Bob Moore 已提交
874 875 876

	acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node),
			    acpi_ex_dump_node);
L
Linus Torvalds 已提交
877 878
}

879 880
/*******************************************************************************
 *
B
Bob Moore 已提交
881
 * FUNCTION:    acpi_ex_dump_reference_obj
882 883 884 885 886 887 888
 *
 * PARAMETERS:  Object              - Descriptor to dump
 *
 * DESCRIPTION: Dumps a reference object
 *
 ******************************************************************************/

B
Bob Moore 已提交
889
static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
890
{
L
Len Brown 已提交
891 892
	struct acpi_buffer ret_buf;
	acpi_status status;
893

B
Bob Moore 已提交
894 895
	ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;

896
	if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
L
Len Brown 已提交
897
		acpi_os_printf("Named Object %p ", obj_desc->reference.node);
B
Bob Moore 已提交
898

L
Len Brown 已提交
899 900 901 902 903 904 905 906
		status =
		    acpi_ns_handle_to_pathname(obj_desc->reference.node,
					       &ret_buf);
		if (ACPI_FAILURE(status)) {
			acpi_os_printf("Could not convert name to pathname\n");
		} else {
			acpi_os_printf("%s\n", (char *)ret_buf.pointer);
			ACPI_MEM_FREE(ret_buf.pointer);
907
		}
L
Len Brown 已提交
908 909 910
	} else if (obj_desc->reference.object) {
		acpi_os_printf("\nReferenced Object: %p\n",
			       obj_desc->reference.object);
911 912 913 914 915
	}
}

/*******************************************************************************
 *
B
Bob Moore 已提交
916
 * FUNCTION:    acpi_ex_dump_package_obj
917
 *
B
Bob Moore 已提交
918
 * PARAMETERS:  obj_desc            - Descriptor to dump
919 920 921 922 923 924 925 926
 *              Level               - Indentation Level
 *              Index               - Package index for this object
 *
 * DESCRIPTION: Dumps the elements of the package
 *
 ******************************************************************************/

static void
B
Bob Moore 已提交
927 928
acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
			 u32 level, u32 index)
929
{
L
Len Brown 已提交
930
	u32 i;
931 932 933 934 935

	/* Indentation and index output */

	if (level > 0) {
		for (i = 0; i < level; i++) {
L
Len Brown 已提交
936
			acpi_os_printf(" ");
937 938
		}

L
Len Brown 已提交
939
		acpi_os_printf("[%.2d] ", index);
940 941
	}

L
Len Brown 已提交
942
	acpi_os_printf("%p ", obj_desc);
943 944 945 946

	/* Null package elements are allowed */

	if (!obj_desc) {
L
Len Brown 已提交
947
		acpi_os_printf("[Null Object]\n");
948 949 950 951 952
		return;
	}

	/* Packages may only contain a few object types */

L
Len Brown 已提交
953
	switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
954 955
	case ACPI_TYPE_INTEGER:

L
Len Brown 已提交
956 957
		acpi_os_printf("[Integer] = %8.8X%8.8X\n",
			       ACPI_FORMAT_UINT64(obj_desc->integer.value));
958 959 960 961
		break;

	case ACPI_TYPE_STRING:

L
Len Brown 已提交
962
		acpi_os_printf("[String] Value: ");
963
		for (i = 0; i < obj_desc->string.length; i++) {
L
Len Brown 已提交
964
			acpi_os_printf("%c", obj_desc->string.pointer[i]);
965
		}
L
Len Brown 已提交
966
		acpi_os_printf("\n");
967 968 969 970
		break;

	case ACPI_TYPE_BUFFER:

L
Len Brown 已提交
971 972
		acpi_os_printf("[Buffer] Length %.2X = ",
			       obj_desc->buffer.length);
973
		if (obj_desc->buffer.length) {
B
Bob Moore 已提交
974 975
			acpi_ut_dump_buffer(ACPI_CAST_PTR
					    (u8, obj_desc->buffer.pointer),
L
Len Brown 已提交
976 977 978 979
					    obj_desc->buffer.length,
					    DB_DWORD_DISPLAY, _COMPONENT);
		} else {
			acpi_os_printf("\n");
980 981 982 983 984
		}
		break;

	case ACPI_TYPE_PACKAGE:

B
Bob Moore 已提交
985
		acpi_os_printf("[Package] Contains %d Elements:\n",
L
Len Brown 已提交
986
			       obj_desc->package.count);
987 988

		for (i = 0; i < obj_desc->package.count; i++) {
B
Bob Moore 已提交
989 990
			acpi_ex_dump_package_obj(obj_desc->package.elements[i],
						 level + 1, i);
991 992 993 994 995
		}
		break;

	case ACPI_TYPE_LOCAL_REFERENCE:

L
Len Brown 已提交
996
		acpi_os_printf("[Object Reference] ");
B
Bob Moore 已提交
997
		acpi_ex_dump_reference_obj(obj_desc);
998 999 1000 1001
		break;

	default:

L
Len Brown 已提交
1002 1003
		acpi_os_printf("[Unknown Type] %X\n",
			       ACPI_GET_OBJECT_TYPE(obj_desc));
1004 1005 1006 1007
		break;
	}
}

R
Robert Moore 已提交
1008
/*******************************************************************************
L
Linus Torvalds 已提交
1009 1010 1011
 *
 * FUNCTION:    acpi_ex_dump_object_descriptor
 *
B
Bob Moore 已提交
1012
 * PARAMETERS:  obj_desc            - Descriptor to dump
R
Robert Moore 已提交
1013
 *              Flags               - Force display if TRUE
L
Linus Torvalds 已提交
1014 1015 1016
 *
 * DESCRIPTION: Dumps the members of the object descriptor given.
 *
R
Robert Moore 已提交
1017
 ******************************************************************************/
L
Linus Torvalds 已提交
1018 1019

void
L
Len Brown 已提交
1020
acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
L
Linus Torvalds 已提交
1021
{
L
Len Brown 已提交
1022
	ACPI_FUNCTION_TRACE("ex_dump_object_descriptor");
L
Linus Torvalds 已提交
1023

R
Robert Moore 已提交
1024 1025 1026 1027
	if (!obj_desc) {
		return_VOID;
	}

L
Linus Torvalds 已提交
1028
	if (!flags) {
L
Len Brown 已提交
1029 1030 1031
		if (!
		    ((ACPI_LV_OBJECTS & acpi_dbg_level)
		     && (_COMPONENT & acpi_dbg_layer))) {
L
Linus Torvalds 已提交
1032 1033 1034 1035
			return_VOID;
		}
	}

L
Len Brown 已提交
1036
	if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
B
Bob Moore 已提交
1037 1038 1039
		acpi_ex_dump_namespace_node((struct acpi_namespace_node *)
					    obj_desc, flags);

L
Len Brown 已提交
1040 1041 1042
		acpi_os_printf("\nAttached Object (%p):\n",
			       ((struct acpi_namespace_node *)obj_desc)->
			       object);
B
Bob Moore 已提交
1043

L
Len Brown 已提交
1044 1045
		acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *)
						obj_desc)->object, flags);
L
Linus Torvalds 已提交
1046 1047 1048
		return_VOID;
	}

L
Len Brown 已提交
1049 1050 1051 1052
	if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
		acpi_os_printf
		    ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
		     obj_desc, acpi_ut_get_descriptor_name(obj_desc));
L
Linus Torvalds 已提交
1053 1054 1055
		return_VOID;
	}

B
Bob Moore 已提交
1056 1057 1058
	if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) {
		return_VOID;
	}
L
Linus Torvalds 已提交
1059

B
Bob Moore 已提交
1060
	/* Common Fields */
L
Linus Torvalds 已提交
1061

B
Bob Moore 已提交
1062
	acpi_ex_dump_object(obj_desc, acpi_ex_dump_common);
L
Linus Torvalds 已提交
1063

B
Bob Moore 已提交
1064
	/* Object-specific fields */
L
Linus Torvalds 已提交
1065

B
Bob Moore 已提交
1066
	acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]);
L
Linus Torvalds 已提交
1067 1068 1069 1070
	return_VOID;
}

#endif