exdump.c 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  1. /******************************************************************************
  2. *
  3. * Module Name: exdump - Interpreter debug output routines
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, R. Byron Moore
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #include <acpi/acpi.h>
  43. #include <acpi/acinterp.h>
  44. #include <acpi/amlcode.h>
  45. #include <acpi/acnamesp.h>
  46. #include <acpi/acparser.h>
  47. #define _COMPONENT ACPI_EXECUTER
  48. ACPI_MODULE_NAME("exdump")
  49. /*
  50. * The following routines are used for debug output only
  51. */
  52. #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
  53. /* Local prototypes */
  54. #ifdef ACPI_FUTURE_USAGE
  55. static void acpi_ex_out_string(char *title, char *value);
  56. static void acpi_ex_out_pointer(char *title, void *value);
  57. static void acpi_ex_out_integer(char *title, u32 value);
  58. static void acpi_ex_out_address(char *title, acpi_physical_address value);
  59. static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc);
  60. static void
  61. acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index);
  62. #endif /* ACPI_FUTURE_USAGE */
  63. /*******************************************************************************
  64. *
  65. * FUNCTION: acpi_ex_dump_operand
  66. *
  67. * PARAMETERS: *obj_desc - Pointer to entry to be dumped
  68. * Depth - Current nesting depth
  69. *
  70. * RETURN: None
  71. *
  72. * DESCRIPTION: Dump an operand object
  73. *
  74. ******************************************************************************/
  75. void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
  76. {
  77. u32 length;
  78. u32 index;
  79. ACPI_FUNCTION_NAME("ex_dump_operand")
  80. if (!
  81. ((ACPI_LV_EXEC & acpi_dbg_level)
  82. && (_COMPONENT & acpi_dbg_layer))) {
  83. return;
  84. }
  85. if (!obj_desc) {
  86. /* This could be a null element of a package */
  87. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
  88. return;
  89. }
  90. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
  91. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
  92. obj_desc));
  93. ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
  94. return;
  95. }
  96. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
  97. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  98. "%p is not a node or operand object: [%s]\n",
  99. obj_desc,
  100. acpi_ut_get_descriptor_name(obj_desc)));
  101. ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
  102. return;
  103. }
  104. /* obj_desc is a valid object */
  105. if (depth > 0) {
  106. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ",
  107. depth, " ", depth, obj_desc));
  108. } else {
  109. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc));
  110. }
  111. /* Decode object type */
  112. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  113. case ACPI_TYPE_LOCAL_REFERENCE:
  114. switch (obj_desc->reference.opcode) {
  115. case AML_DEBUG_OP:
  116. acpi_os_printf("Reference: Debug\n");
  117. break;
  118. case AML_NAME_OP:
  119. ACPI_DUMP_PATHNAME(obj_desc->reference.object,
  120. "Reference: Name: ", ACPI_LV_INFO,
  121. _COMPONENT);
  122. ACPI_DUMP_ENTRY(obj_desc->reference.object,
  123. ACPI_LV_INFO);
  124. break;
  125. case AML_INDEX_OP:
  126. acpi_os_printf("Reference: Index %p\n",
  127. obj_desc->reference.object);
  128. break;
  129. case AML_REF_OF_OP:
  130. acpi_os_printf("Reference: (ref_of) %p\n",
  131. obj_desc->reference.object);
  132. break;
  133. case AML_ARG_OP:
  134. acpi_os_printf("Reference: Arg%d",
  135. obj_desc->reference.offset);
  136. if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
  137. /* Value is an Integer */
  138. acpi_os_printf(" value is [%8.8X%8.8x]",
  139. ACPI_FORMAT_UINT64(obj_desc->
  140. integer.
  141. value));
  142. }
  143. acpi_os_printf("\n");
  144. break;
  145. case AML_LOCAL_OP:
  146. acpi_os_printf("Reference: Local%d",
  147. obj_desc->reference.offset);
  148. if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
  149. /* Value is an Integer */
  150. acpi_os_printf(" value is [%8.8X%8.8x]",
  151. ACPI_FORMAT_UINT64(obj_desc->
  152. integer.
  153. value));
  154. }
  155. acpi_os_printf("\n");
  156. break;
  157. case AML_INT_NAMEPATH_OP:
  158. acpi_os_printf("Reference.Node->Name %X\n",
  159. obj_desc->reference.node->name.integer);
  160. break;
  161. default:
  162. /* Unknown opcode */
  163. acpi_os_printf("Unknown Reference opcode=%X\n",
  164. obj_desc->reference.opcode);
  165. break;
  166. }
  167. break;
  168. case ACPI_TYPE_BUFFER:
  169. acpi_os_printf("Buffer len %X @ %p \n",
  170. obj_desc->buffer.length,
  171. obj_desc->buffer.pointer);
  172. length = obj_desc->buffer.length;
  173. if (length > 64) {
  174. length = 64;
  175. }
  176. /* Debug only -- dump the buffer contents */
  177. if (obj_desc->buffer.pointer) {
  178. acpi_os_printf("Buffer Contents: ");
  179. for (index = 0; index < length; index++) {
  180. acpi_os_printf(" %02x",
  181. obj_desc->buffer.pointer[index]);
  182. }
  183. acpi_os_printf("\n");
  184. }
  185. break;
  186. case ACPI_TYPE_INTEGER:
  187. acpi_os_printf("Integer %8.8X%8.8X\n",
  188. ACPI_FORMAT_UINT64(obj_desc->integer.value));
  189. break;
  190. case ACPI_TYPE_PACKAGE:
  191. acpi_os_printf("Package [Len %X] element_array %p\n",
  192. obj_desc->package.count,
  193. obj_desc->package.elements);
  194. /*
  195. * If elements exist, package element pointer is valid,
  196. * and debug_level exceeds 1, dump package's elements.
  197. */
  198. if (obj_desc->package.count &&
  199. obj_desc->package.elements && acpi_dbg_level > 1) {
  200. for (index = 0; index < obj_desc->package.count;
  201. index++) {
  202. acpi_ex_dump_operand(obj_desc->package.
  203. elements[index],
  204. depth + 1);
  205. }
  206. }
  207. break;
  208. case ACPI_TYPE_REGION:
  209. acpi_os_printf("Region %s (%X)",
  210. acpi_ut_get_region_name(obj_desc->region.
  211. space_id),
  212. obj_desc->region.space_id);
  213. /*
  214. * If the address and length have not been evaluated,
  215. * don't print them.
  216. */
  217. if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
  218. acpi_os_printf("\n");
  219. } else {
  220. acpi_os_printf(" base %8.8X%8.8X Length %X\n",
  221. ACPI_FORMAT_UINT64(obj_desc->region.
  222. address),
  223. obj_desc->region.length);
  224. }
  225. break;
  226. case ACPI_TYPE_STRING:
  227. acpi_os_printf("String length %X @ %p ",
  228. obj_desc->string.length,
  229. obj_desc->string.pointer);
  230. acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
  231. acpi_os_printf("\n");
  232. break;
  233. case ACPI_TYPE_LOCAL_BANK_FIELD:
  234. acpi_os_printf("bank_field\n");
  235. break;
  236. case ACPI_TYPE_LOCAL_REGION_FIELD:
  237. acpi_os_printf
  238. ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
  239. obj_desc->field.bit_length,
  240. obj_desc->field.access_byte_width,
  241. obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
  242. obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
  243. obj_desc->field.base_byte_offset,
  244. obj_desc->field.start_field_bit_offset);
  245. acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1);
  246. break;
  247. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  248. acpi_os_printf("index_field\n");
  249. break;
  250. case ACPI_TYPE_BUFFER_FIELD:
  251. acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n",
  252. obj_desc->buffer_field.bit_length,
  253. obj_desc->buffer_field.base_byte_offset,
  254. obj_desc->buffer_field.start_field_bit_offset);
  255. if (!obj_desc->buffer_field.buffer_obj) {
  256. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n"));
  257. } else
  258. if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
  259. != ACPI_TYPE_BUFFER) {
  260. acpi_os_printf("*not a Buffer* \n");
  261. } else {
  262. acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
  263. depth + 1);
  264. }
  265. break;
  266. case ACPI_TYPE_EVENT:
  267. acpi_os_printf("Event\n");
  268. break;
  269. case ACPI_TYPE_METHOD:
  270. acpi_os_printf("Method(%X) @ %p:%X\n",
  271. obj_desc->method.param_count,
  272. obj_desc->method.aml_start,
  273. obj_desc->method.aml_length);
  274. break;
  275. case ACPI_TYPE_MUTEX:
  276. acpi_os_printf("Mutex\n");
  277. break;
  278. case ACPI_TYPE_DEVICE:
  279. acpi_os_printf("Device\n");
  280. break;
  281. case ACPI_TYPE_POWER:
  282. acpi_os_printf("Power\n");
  283. break;
  284. case ACPI_TYPE_PROCESSOR:
  285. acpi_os_printf("Processor\n");
  286. break;
  287. case ACPI_TYPE_THERMAL:
  288. acpi_os_printf("Thermal\n");
  289. break;
  290. default:
  291. /* Unknown Type */
  292. acpi_os_printf("Unknown Type %X\n",
  293. ACPI_GET_OBJECT_TYPE(obj_desc));
  294. break;
  295. }
  296. return;
  297. }
  298. /*******************************************************************************
  299. *
  300. * FUNCTION: acpi_ex_dump_operands
  301. *
  302. * PARAMETERS: Operands - Operand list
  303. * interpreter_mode - Load or Exec
  304. * Ident - Identification
  305. * num_levels - # of stack entries to dump above line
  306. * Note - Output notation
  307. * module_name - Caller's module name
  308. * line_number - Caller's invocation line number
  309. *
  310. * DESCRIPTION: Dump the object stack
  311. *
  312. ******************************************************************************/
  313. void
  314. acpi_ex_dump_operands(union acpi_operand_object **operands,
  315. acpi_interpreter_mode interpreter_mode,
  316. char *ident,
  317. u32 num_levels,
  318. char *note, char *module_name, u32 line_number)
  319. {
  320. acpi_native_uint i;
  321. ACPI_FUNCTION_NAME("ex_dump_operands");
  322. if (!ident) {
  323. ident = "?";
  324. }
  325. if (!note) {
  326. note = "?";
  327. }
  328. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  329. "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
  330. ident, num_levels));
  331. if (num_levels == 0) {
  332. num_levels = 1;
  333. }
  334. /* Dump the operand stack starting at the top */
  335. for (i = 0; num_levels > 0; i--, num_levels--) {
  336. acpi_ex_dump_operand(operands[i], 0);
  337. }
  338. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  339. "************* Operand Stack dump from %s(%d), %s\n",
  340. module_name, line_number, note));
  341. return;
  342. }
  343. #ifdef ACPI_FUTURE_USAGE
  344. /*******************************************************************************
  345. *
  346. * FUNCTION: acpi_ex_out* functions
  347. *
  348. * PARAMETERS: Title - Descriptive text
  349. * Value - Value to be displayed
  350. *
  351. * DESCRIPTION: Object dump output formatting functions. These functions
  352. * reduce the number of format strings required and keeps them
  353. * all in one place for easy modification.
  354. *
  355. ******************************************************************************/
  356. static void acpi_ex_out_string(char *title, char *value)
  357. {
  358. acpi_os_printf("%20s : %s\n", title, value);
  359. }
  360. static void acpi_ex_out_pointer(char *title, void *value)
  361. {
  362. acpi_os_printf("%20s : %p\n", title, value);
  363. }
  364. static void acpi_ex_out_integer(char *title, u32 value)
  365. {
  366. acpi_os_printf("%20s : %.2X\n", title, value);
  367. }
  368. static void acpi_ex_out_address(char *title, acpi_physical_address value)
  369. {
  370. #if ACPI_MACHINE_WIDTH == 16
  371. acpi_os_printf("%20s : %p\n", title, value);
  372. #else
  373. acpi_os_printf("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
  374. #endif
  375. }
  376. /*******************************************************************************
  377. *
  378. * FUNCTION: acpi_ex_dump_node
  379. *
  380. * PARAMETERS: *Node - Descriptor to dump
  381. * Flags - Force display if TRUE
  382. *
  383. * DESCRIPTION: Dumps the members of the given.Node
  384. *
  385. ******************************************************************************/
  386. void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags)
  387. {
  388. ACPI_FUNCTION_ENTRY();
  389. if (!flags) {
  390. if (!
  391. ((ACPI_LV_OBJECTS & acpi_dbg_level)
  392. && (_COMPONENT & acpi_dbg_layer))) {
  393. return;
  394. }
  395. }
  396. acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node));
  397. acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type));
  398. acpi_ex_out_integer("Flags", node->flags);
  399. acpi_ex_out_integer("Owner Id", node->owner_id);
  400. acpi_ex_out_integer("Reference Count", node->reference_count);
  401. acpi_ex_out_pointer("Attached Object",
  402. acpi_ns_get_attached_object(node));
  403. acpi_ex_out_pointer("child_list", node->child);
  404. acpi_ex_out_pointer("next_peer", node->peer);
  405. acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node));
  406. }
  407. /*******************************************************************************
  408. *
  409. * FUNCTION: acpi_ex_dump_reference
  410. *
  411. * PARAMETERS: Object - Descriptor to dump
  412. *
  413. * DESCRIPTION: Dumps a reference object
  414. *
  415. ******************************************************************************/
  416. static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
  417. {
  418. struct acpi_buffer ret_buf;
  419. acpi_status status;
  420. if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
  421. acpi_os_printf("Named Object %p ", obj_desc->reference.node);
  422. ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
  423. status =
  424. acpi_ns_handle_to_pathname(obj_desc->reference.node,
  425. &ret_buf);
  426. if (ACPI_FAILURE(status)) {
  427. acpi_os_printf("Could not convert name to pathname\n");
  428. } else {
  429. acpi_os_printf("%s\n", (char *)ret_buf.pointer);
  430. ACPI_MEM_FREE(ret_buf.pointer);
  431. }
  432. } else if (obj_desc->reference.object) {
  433. acpi_os_printf("\nReferenced Object: %p\n",
  434. obj_desc->reference.object);
  435. }
  436. }
  437. /*******************************************************************************
  438. *
  439. * FUNCTION: acpi_ex_dump_package
  440. *
  441. * PARAMETERS: Object - Descriptor to dump
  442. * Level - Indentation Level
  443. * Index - Package index for this object
  444. *
  445. * DESCRIPTION: Dumps the elements of the package
  446. *
  447. ******************************************************************************/
  448. static void
  449. acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
  450. {
  451. u32 i;
  452. /* Indentation and index output */
  453. if (level > 0) {
  454. for (i = 0; i < level; i++) {
  455. acpi_os_printf(" ");
  456. }
  457. acpi_os_printf("[%.2d] ", index);
  458. }
  459. acpi_os_printf("%p ", obj_desc);
  460. /* Null package elements are allowed */
  461. if (!obj_desc) {
  462. acpi_os_printf("[Null Object]\n");
  463. return;
  464. }
  465. /* Packages may only contain a few object types */
  466. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  467. case ACPI_TYPE_INTEGER:
  468. acpi_os_printf("[Integer] = %8.8X%8.8X\n",
  469. ACPI_FORMAT_UINT64(obj_desc->integer.value));
  470. break;
  471. case ACPI_TYPE_STRING:
  472. acpi_os_printf("[String] Value: ");
  473. for (i = 0; i < obj_desc->string.length; i++) {
  474. acpi_os_printf("%c", obj_desc->string.pointer[i]);
  475. }
  476. acpi_os_printf("\n");
  477. break;
  478. case ACPI_TYPE_BUFFER:
  479. acpi_os_printf("[Buffer] Length %.2X = ",
  480. obj_desc->buffer.length);
  481. if (obj_desc->buffer.length) {
  482. acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer,
  483. obj_desc->buffer.length,
  484. DB_DWORD_DISPLAY, _COMPONENT);
  485. } else {
  486. acpi_os_printf("\n");
  487. }
  488. break;
  489. case ACPI_TYPE_PACKAGE:
  490. acpi_os_printf("[Package] Contains %d Elements: \n",
  491. obj_desc->package.count);
  492. for (i = 0; i < obj_desc->package.count; i++) {
  493. acpi_ex_dump_package(obj_desc->package.elements[i],
  494. level + 1, i);
  495. }
  496. break;
  497. case ACPI_TYPE_LOCAL_REFERENCE:
  498. acpi_os_printf("[Object Reference] ");
  499. acpi_ex_dump_reference(obj_desc);
  500. break;
  501. default:
  502. acpi_os_printf("[Unknown Type] %X\n",
  503. ACPI_GET_OBJECT_TYPE(obj_desc));
  504. break;
  505. }
  506. }
  507. /*******************************************************************************
  508. *
  509. * FUNCTION: acpi_ex_dump_object_descriptor
  510. *
  511. * PARAMETERS: Object - Descriptor to dump
  512. * Flags - Force display if TRUE
  513. *
  514. * DESCRIPTION: Dumps the members of the object descriptor given.
  515. *
  516. ******************************************************************************/
  517. void
  518. acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
  519. {
  520. ACPI_FUNCTION_TRACE("ex_dump_object_descriptor");
  521. if (!obj_desc) {
  522. return_VOID;
  523. }
  524. if (!flags) {
  525. if (!
  526. ((ACPI_LV_OBJECTS & acpi_dbg_level)
  527. && (_COMPONENT & acpi_dbg_layer))) {
  528. return_VOID;
  529. }
  530. }
  531. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
  532. acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc,
  533. flags);
  534. acpi_os_printf("\nAttached Object (%p):\n",
  535. ((struct acpi_namespace_node *)obj_desc)->
  536. object);
  537. acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *)
  538. obj_desc)->object, flags);
  539. return_VOID;
  540. }
  541. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
  542. acpi_os_printf
  543. ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
  544. obj_desc, acpi_ut_get_descriptor_name(obj_desc));
  545. return_VOID;
  546. }
  547. /* Common Fields */
  548. acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc));
  549. acpi_ex_out_integer("Reference Count",
  550. obj_desc->common.reference_count);
  551. acpi_ex_out_integer("Flags", obj_desc->common.flags);
  552. /* Object-specific Fields */
  553. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  554. case ACPI_TYPE_INTEGER:
  555. acpi_os_printf("%20s : %8.8X%8.8X\n", "Value",
  556. ACPI_FORMAT_UINT64(obj_desc->integer.value));
  557. break;
  558. case ACPI_TYPE_STRING:
  559. acpi_ex_out_integer("Length", obj_desc->string.length);
  560. acpi_os_printf("%20s : %p ", "Pointer",
  561. obj_desc->string.pointer);
  562. acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
  563. acpi_os_printf("\n");
  564. break;
  565. case ACPI_TYPE_BUFFER:
  566. acpi_ex_out_integer("Length", obj_desc->buffer.length);
  567. acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer);
  568. ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,
  569. obj_desc->buffer.length);
  570. break;
  571. case ACPI_TYPE_PACKAGE:
  572. acpi_ex_out_integer("Flags", obj_desc->package.flags);
  573. acpi_ex_out_integer("Elements", obj_desc->package.count);
  574. acpi_ex_out_pointer("Element List", obj_desc->package.elements);
  575. /* Dump the package contents */
  576. acpi_os_printf("\nPackage Contents:\n");
  577. acpi_ex_dump_package(obj_desc, 0, 0);
  578. break;
  579. case ACPI_TYPE_DEVICE:
  580. acpi_ex_out_pointer("Handler", obj_desc->device.handler);
  581. acpi_ex_out_pointer("system_notify",
  582. obj_desc->device.system_notify);
  583. acpi_ex_out_pointer("device_notify",
  584. obj_desc->device.device_notify);
  585. break;
  586. case ACPI_TYPE_EVENT:
  587. acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore);
  588. break;
  589. case ACPI_TYPE_METHOD:
  590. acpi_ex_out_integer("param_count",
  591. obj_desc->method.param_count);
  592. acpi_ex_out_integer("Concurrency",
  593. obj_desc->method.concurrency);
  594. acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore);
  595. acpi_ex_out_integer("owner_id", obj_desc->method.owner_id);
  596. acpi_ex_out_integer("aml_length", obj_desc->method.aml_length);
  597. acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start);
  598. break;
  599. case ACPI_TYPE_MUTEX:
  600. acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level);
  601. acpi_ex_out_pointer("owner_thread",
  602. obj_desc->mutex.owner_thread);
  603. acpi_ex_out_integer("acquire_depth",
  604. obj_desc->mutex.acquisition_depth);
  605. acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore);
  606. break;
  607. case ACPI_TYPE_REGION:
  608. acpi_ex_out_integer("space_id", obj_desc->region.space_id);
  609. acpi_ex_out_integer("Flags", obj_desc->region.flags);
  610. acpi_ex_out_address("Address", obj_desc->region.address);
  611. acpi_ex_out_integer("Length", obj_desc->region.length);
  612. acpi_ex_out_pointer("Handler", obj_desc->region.handler);
  613. acpi_ex_out_pointer("Next", obj_desc->region.next);
  614. break;
  615. case ACPI_TYPE_POWER:
  616. acpi_ex_out_integer("system_level",
  617. obj_desc->power_resource.system_level);
  618. acpi_ex_out_integer("resource_order",
  619. obj_desc->power_resource.resource_order);
  620. acpi_ex_out_pointer("system_notify",
  621. obj_desc->power_resource.system_notify);
  622. acpi_ex_out_pointer("device_notify",
  623. obj_desc->power_resource.device_notify);
  624. break;
  625. case ACPI_TYPE_PROCESSOR:
  626. acpi_ex_out_integer("Processor ID",
  627. obj_desc->processor.proc_id);
  628. acpi_ex_out_integer("Length", obj_desc->processor.length);
  629. acpi_ex_out_address("Address",
  630. (acpi_physical_address) obj_desc->processor.
  631. address);
  632. acpi_ex_out_pointer("system_notify",
  633. obj_desc->processor.system_notify);
  634. acpi_ex_out_pointer("device_notify",
  635. obj_desc->processor.device_notify);
  636. acpi_ex_out_pointer("Handler", obj_desc->processor.handler);
  637. break;
  638. case ACPI_TYPE_THERMAL:
  639. acpi_ex_out_pointer("system_notify",
  640. obj_desc->thermal_zone.system_notify);
  641. acpi_ex_out_pointer("device_notify",
  642. obj_desc->thermal_zone.device_notify);
  643. acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler);
  644. break;
  645. case ACPI_TYPE_BUFFER_FIELD:
  646. case ACPI_TYPE_LOCAL_REGION_FIELD:
  647. case ACPI_TYPE_LOCAL_BANK_FIELD:
  648. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  649. acpi_ex_out_integer("field_flags",
  650. obj_desc->common_field.field_flags);
  651. acpi_ex_out_integer("access_byte_width",
  652. obj_desc->common_field.access_byte_width);
  653. acpi_ex_out_integer("bit_length",
  654. obj_desc->common_field.bit_length);
  655. acpi_ex_out_integer("fld_bit_offset",
  656. obj_desc->common_field.
  657. start_field_bit_offset);
  658. acpi_ex_out_integer("base_byte_offset",
  659. obj_desc->common_field.base_byte_offset);
  660. acpi_ex_out_pointer("parent_node", obj_desc->common_field.node);
  661. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  662. case ACPI_TYPE_BUFFER_FIELD:
  663. acpi_ex_out_pointer("buffer_obj",
  664. obj_desc->buffer_field.buffer_obj);
  665. break;
  666. case ACPI_TYPE_LOCAL_REGION_FIELD:
  667. acpi_ex_out_pointer("region_obj",
  668. obj_desc->field.region_obj);
  669. break;
  670. case ACPI_TYPE_LOCAL_BANK_FIELD:
  671. acpi_ex_out_integer("Value",
  672. obj_desc->bank_field.value);
  673. acpi_ex_out_pointer("region_obj",
  674. obj_desc->bank_field.region_obj);
  675. acpi_ex_out_pointer("bank_obj",
  676. obj_desc->bank_field.bank_obj);
  677. break;
  678. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  679. acpi_ex_out_integer("Value",
  680. obj_desc->index_field.value);
  681. acpi_ex_out_pointer("Index",
  682. obj_desc->index_field.index_obj);
  683. acpi_ex_out_pointer("Data",
  684. obj_desc->index_field.data_obj);
  685. break;
  686. default:
  687. /* All object types covered above */
  688. break;
  689. }
  690. break;
  691. case ACPI_TYPE_LOCAL_REFERENCE:
  692. acpi_ex_out_integer("target_type",
  693. obj_desc->reference.target_type);
  694. acpi_ex_out_string("Opcode",
  695. (acpi_ps_get_opcode_info
  696. (obj_desc->reference.opcode))->name);
  697. acpi_ex_out_integer("Offset", obj_desc->reference.offset);
  698. acpi_ex_out_pointer("obj_desc", obj_desc->reference.object);
  699. acpi_ex_out_pointer("Node", obj_desc->reference.node);
  700. acpi_ex_out_pointer("Where", obj_desc->reference.where);
  701. acpi_ex_dump_reference(obj_desc);
  702. break;
  703. case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
  704. acpi_ex_out_integer("space_id",
  705. obj_desc->address_space.space_id);
  706. acpi_ex_out_pointer("Next", obj_desc->address_space.next);
  707. acpi_ex_out_pointer("region_list",
  708. obj_desc->address_space.region_list);
  709. acpi_ex_out_pointer("Node", obj_desc->address_space.node);
  710. acpi_ex_out_pointer("Context", obj_desc->address_space.context);
  711. break;
  712. case ACPI_TYPE_LOCAL_NOTIFY:
  713. acpi_ex_out_pointer("Node", obj_desc->notify.node);
  714. acpi_ex_out_pointer("Context", obj_desc->notify.context);
  715. break;
  716. case ACPI_TYPE_LOCAL_ALIAS:
  717. case ACPI_TYPE_LOCAL_METHOD_ALIAS:
  718. case ACPI_TYPE_LOCAL_EXTRA:
  719. case ACPI_TYPE_LOCAL_DATA:
  720. default:
  721. acpi_os_printf
  722. ("ex_dump_object_descriptor: Display not implemented for object type %s\n",
  723. acpi_ut_get_object_type_name(obj_desc));
  724. break;
  725. }
  726. return_VOID;
  727. }
  728. #endif /* ACPI_FUTURE_USAGE */
  729. #endif