exdump.c 25 KB

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