exdump.c 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239
  1. /******************************************************************************
  2. *
  3. * Module Name: exdump - Interpreter debug output routines
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2018, Intel Corp.
  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 "accommon.h"
  44. #include "acinterp.h"
  45. #include "amlcode.h"
  46. #include "acnamesp.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. static void acpi_ex_out_string(const char *title, const char *value);
  55. static void acpi_ex_out_pointer(const char *title, const void *value);
  56. static void
  57. acpi_ex_dump_object(union acpi_operand_object *obj_desc,
  58. struct acpi_exdump_info *info);
  59. static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
  60. static void
  61. acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
  62. u32 level, u32 index);
  63. /*******************************************************************************
  64. *
  65. * Object Descriptor info tables
  66. *
  67. * Note: The first table entry must be an INIT opcode and must contain
  68. * the table length (number of table entries)
  69. *
  70. ******************************************************************************/
  71. static struct acpi_exdump_info acpi_ex_dump_integer[2] = {
  72. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL},
  73. {ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"}
  74. };
  75. static struct acpi_exdump_info acpi_ex_dump_string[4] = {
  76. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL},
  77. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"},
  78. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"},
  79. {ACPI_EXD_STRING, 0, NULL}
  80. };
  81. static struct acpi_exdump_info acpi_ex_dump_buffer[5] = {
  82. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL},
  83. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"},
  84. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"},
  85. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(buffer.node), "Parent Node"},
  86. {ACPI_EXD_BUFFER, 0, NULL}
  87. };
  88. static struct acpi_exdump_info acpi_ex_dump_package[6] = {
  89. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL},
  90. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(package.node), "Parent Node"},
  91. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"},
  92. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Element Count"},
  93. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"},
  94. {ACPI_EXD_PACKAGE, 0, NULL}
  95. };
  96. static struct acpi_exdump_info acpi_ex_dump_device[4] = {
  97. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL},
  98. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[0]),
  99. "System Notify"},
  100. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[1]),
  101. "Device Notify"},
  102. {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(device.handler), "Handler"}
  103. };
  104. static struct acpi_exdump_info acpi_ex_dump_event[2] = {
  105. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL},
  106. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.os_semaphore), "OsSemaphore"}
  107. };
  108. static struct acpi_exdump_info acpi_ex_dump_method[9] = {
  109. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL},
  110. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.info_flags), "Info Flags"},
  111. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count),
  112. "Parameter Count"},
  113. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"},
  114. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.mutex), "Mutex"},
  115. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"},
  116. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"},
  117. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"},
  118. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"}
  119. };
  120. static struct acpi_exdump_info acpi_ex_dump_mutex[6] = {
  121. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL},
  122. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"},
  123. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.original_sync_level),
  124. "Original Sync Level"},
  125. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"},
  126. {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth),
  127. "Acquire Depth"},
  128. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"}
  129. };
  130. static struct acpi_exdump_info acpi_ex_dump_region[8] = {
  131. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL},
  132. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"},
  133. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"},
  134. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(region.node), "Parent Node"},
  135. {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"},
  136. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"},
  137. {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(region.handler), "Handler"},
  138. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"}
  139. };
  140. static struct acpi_exdump_info acpi_ex_dump_power[6] = {
  141. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL},
  142. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level),
  143. "System Level"},
  144. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order),
  145. "Resource Order"},
  146. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[0]),
  147. "System Notify"},
  148. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[1]),
  149. "Device Notify"},
  150. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.handler), "Handler"}
  151. };
  152. static struct acpi_exdump_info acpi_ex_dump_processor[7] = {
  153. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL},
  154. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"},
  155. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.length), "Length"},
  156. {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"},
  157. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.notify_list[0]),
  158. "System Notify"},
  159. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.notify_list[1]),
  160. "Device Notify"},
  161. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"}
  162. };
  163. static struct acpi_exdump_info acpi_ex_dump_thermal[4] = {
  164. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL},
  165. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.notify_list[0]),
  166. "System Notify"},
  167. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.notify_list[1]),
  168. "Device Notify"},
  169. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"}
  170. };
  171. static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = {
  172. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL},
  173. {ACPI_EXD_FIELD, 0, NULL},
  174. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj),
  175. "Buffer Object"}
  176. };
  177. static struct acpi_exdump_info acpi_ex_dump_region_field[5] = {
  178. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL},
  179. {ACPI_EXD_FIELD, 0, NULL},
  180. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(field.access_length), "AccessLength"},
  181. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"},
  182. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.resource_buffer),
  183. "ResourceBuffer"}
  184. };
  185. static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = {
  186. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
  187. {ACPI_EXD_FIELD, 0, NULL},
  188. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"},
  189. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj),
  190. "Region Object"},
  191. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"}
  192. };
  193. static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
  194. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
  195. {ACPI_EXD_FIELD, 0, NULL},
  196. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"},
  197. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj),
  198. "Index Object"},
  199. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
  200. };
  201. static struct acpi_exdump_info acpi_ex_dump_reference[9] = {
  202. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
  203. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"},
  204. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
  205. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"},
  206. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
  207. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(reference.node), "Node"},
  208. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"},
  209. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.index_pointer),
  210. "Index Pointer"},
  211. {ACPI_EXD_REFERENCE, 0, NULL}
  212. };
  213. static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = {
  214. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler),
  215. NULL},
  216. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"},
  217. {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(address_space.next), "Next"},
  218. {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET(address_space.region_list),
  219. "Region List"},
  220. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(address_space.node), "Node"},
  221. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"}
  222. };
  223. static struct acpi_exdump_info acpi_ex_dump_notify[7] = {
  224. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL},
  225. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(notify.node), "Node"},
  226. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(notify.handler_type), "Handler Type"},
  227. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.handler), "Handler"},
  228. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"},
  229. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[0]),
  230. "Next System Notify"},
  231. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[1]), "Next Device Notify"}
  232. };
  233. static struct acpi_exdump_info acpi_ex_dump_extra[6] = {
  234. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_extra), NULL},
  235. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.method_REG), "_REG Method"},
  236. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(extra.scope_node), "Scope Node"},
  237. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.region_context),
  238. "Region Context"},
  239. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.aml_start), "Aml Start"},
  240. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(extra.aml_length), "Aml Length"}
  241. };
  242. static struct acpi_exdump_info acpi_ex_dump_data[3] = {
  243. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_data), NULL},
  244. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(data.handler), "Handler"},
  245. {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(data.pointer), "Raw Data"}
  246. };
  247. /* Miscellaneous tables */
  248. static struct acpi_exdump_info acpi_ex_dump_common[5] = {
  249. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL},
  250. {ACPI_EXD_TYPE, 0, NULL},
  251. {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count),
  252. "Reference Count"},
  253. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"},
  254. {ACPI_EXD_LIST, ACPI_EXD_OFFSET(common.next_object), "Object List"}
  255. };
  256. static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
  257. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL},
  258. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags),
  259. "Field Flags"},
  260. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width),
  261. "Access Byte Width"},
  262. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length),
  263. "Bit Length"},
  264. {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset),
  265. "Field Bit Offset"},
  266. {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset),
  267. "Base Byte Offset"},
  268. {ACPI_EXD_NODE, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
  269. };
  270. static struct acpi_exdump_info acpi_ex_dump_node[7] = {
  271. {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
  272. {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
  273. {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
  274. {ACPI_EXD_LIST, ACPI_EXD_NSOFFSET(object), "Object List"},
  275. {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(parent), "Parent"},
  276. {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(child), "Child"},
  277. {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(peer), "Peer"}
  278. };
  279. /* Dispatch table, indexed by object type */
  280. static struct acpi_exdump_info *acpi_ex_dump_info[] = {
  281. NULL,
  282. acpi_ex_dump_integer,
  283. acpi_ex_dump_string,
  284. acpi_ex_dump_buffer,
  285. acpi_ex_dump_package,
  286. NULL,
  287. acpi_ex_dump_device,
  288. acpi_ex_dump_event,
  289. acpi_ex_dump_method,
  290. acpi_ex_dump_mutex,
  291. acpi_ex_dump_region,
  292. acpi_ex_dump_power,
  293. acpi_ex_dump_processor,
  294. acpi_ex_dump_thermal,
  295. acpi_ex_dump_buffer_field,
  296. NULL,
  297. NULL,
  298. acpi_ex_dump_region_field,
  299. acpi_ex_dump_bank_field,
  300. acpi_ex_dump_index_field,
  301. acpi_ex_dump_reference,
  302. NULL,
  303. NULL,
  304. acpi_ex_dump_notify,
  305. acpi_ex_dump_address_handler,
  306. NULL,
  307. NULL,
  308. NULL,
  309. acpi_ex_dump_extra,
  310. acpi_ex_dump_data
  311. };
  312. /*******************************************************************************
  313. *
  314. * FUNCTION: acpi_ex_dump_object
  315. *
  316. * PARAMETERS: obj_desc - Descriptor to dump
  317. * info - Info table corresponding to this object
  318. * type
  319. *
  320. * RETURN: None
  321. *
  322. * DESCRIPTION: Walk the info table for this object
  323. *
  324. ******************************************************************************/
  325. static void
  326. acpi_ex_dump_object(union acpi_operand_object *obj_desc,
  327. struct acpi_exdump_info *info)
  328. {
  329. u8 *target;
  330. const char *name;
  331. u8 count;
  332. union acpi_operand_object *start;
  333. union acpi_operand_object *data = NULL;
  334. union acpi_operand_object *next;
  335. struct acpi_namespace_node *node;
  336. if (!info) {
  337. acpi_os_printf
  338. ("ExDumpObject: Display not implemented for object type %s\n",
  339. acpi_ut_get_object_type_name(obj_desc));
  340. return;
  341. }
  342. /* First table entry must contain the table length (# of table entries) */
  343. count = info->offset;
  344. while (count) {
  345. if (!obj_desc) {
  346. return;
  347. }
  348. target = ACPI_ADD_PTR(u8, obj_desc, info->offset);
  349. name = info->name;
  350. switch (info->opcode) {
  351. case ACPI_EXD_INIT:
  352. break;
  353. case ACPI_EXD_TYPE:
  354. acpi_os_printf("%20s : %2.2X [%s]\n", "Type",
  355. obj_desc->common.type,
  356. acpi_ut_get_object_type_name(obj_desc));
  357. break;
  358. case ACPI_EXD_UINT8:
  359. acpi_os_printf("%20s : %2.2X\n", name, *target);
  360. break;
  361. case ACPI_EXD_UINT16:
  362. acpi_os_printf("%20s : %4.4X\n", name,
  363. ACPI_GET16(target));
  364. break;
  365. case ACPI_EXD_UINT32:
  366. acpi_os_printf("%20s : %8.8X\n", name,
  367. ACPI_GET32(target));
  368. break;
  369. case ACPI_EXD_UINT64:
  370. acpi_os_printf("%20s : %8.8X%8.8X\n", "Value",
  371. ACPI_FORMAT_UINT64(ACPI_GET64(target)));
  372. break;
  373. case ACPI_EXD_POINTER:
  374. case ACPI_EXD_ADDRESS:
  375. acpi_ex_out_pointer(name,
  376. *ACPI_CAST_PTR(void *, target));
  377. break;
  378. case ACPI_EXD_STRING:
  379. acpi_ut_print_string(obj_desc->string.pointer,
  380. ACPI_UINT8_MAX);
  381. acpi_os_printf("\n");
  382. break;
  383. case ACPI_EXD_BUFFER:
  384. ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,
  385. obj_desc->buffer.length);
  386. break;
  387. case ACPI_EXD_PACKAGE:
  388. /* Dump the package contents */
  389. acpi_os_printf("\nPackage Contents:\n");
  390. acpi_ex_dump_package_obj(obj_desc, 0, 0);
  391. break;
  392. case ACPI_EXD_FIELD:
  393. acpi_ex_dump_object(obj_desc,
  394. acpi_ex_dump_field_common);
  395. break;
  396. case ACPI_EXD_REFERENCE:
  397. acpi_ex_out_string("Class Name",
  398. acpi_ut_get_reference_name
  399. (obj_desc));
  400. acpi_ex_dump_reference_obj(obj_desc);
  401. break;
  402. case ACPI_EXD_LIST:
  403. start = *ACPI_CAST_PTR(void *, target);
  404. next = start;
  405. acpi_os_printf("%20s : %p ", name, next);
  406. if (next) {
  407. acpi_os_printf("%s (Type %2.2X)",
  408. acpi_ut_get_object_type_name
  409. (next), next->common.type);
  410. while (next->common.next_object) {
  411. if ((next->common.type ==
  412. ACPI_TYPE_LOCAL_DATA) && !data) {
  413. data = next;
  414. }
  415. next = next->common.next_object;
  416. acpi_os_printf("->%p(%s %2.2X)", next,
  417. acpi_ut_get_object_type_name
  418. (next),
  419. next->common.type);
  420. if ((next == start) || (next == data)) {
  421. acpi_os_printf
  422. ("\n**** Error: Object list appears to be circular linked");
  423. break;
  424. }
  425. }
  426. } else {
  427. acpi_os_printf("- No attached objects");
  428. }
  429. acpi_os_printf("\n");
  430. break;
  431. case ACPI_EXD_HDLR_LIST:
  432. start = *ACPI_CAST_PTR(void *, target);
  433. next = start;
  434. acpi_os_printf("%20s : %p", name, next);
  435. if (next) {
  436. acpi_os_printf("(%s %2.2X)",
  437. acpi_ut_get_object_type_name
  438. (next),
  439. next->address_space.space_id);
  440. while (next->address_space.next) {
  441. if ((next->common.type ==
  442. ACPI_TYPE_LOCAL_DATA) && !data) {
  443. data = next;
  444. }
  445. next = next->address_space.next;
  446. acpi_os_printf("->%p(%s %2.2X)", next,
  447. acpi_ut_get_object_type_name
  448. (next),
  449. next->address_space.
  450. space_id);
  451. if ((next == start) || (next == data)) {
  452. acpi_os_printf
  453. ("\n**** Error: Handler list appears to be circular linked");
  454. break;
  455. }
  456. }
  457. }
  458. acpi_os_printf("\n");
  459. break;
  460. case ACPI_EXD_RGN_LIST:
  461. start = *ACPI_CAST_PTR(void *, target);
  462. next = start;
  463. acpi_os_printf("%20s : %p", name, next);
  464. if (next) {
  465. acpi_os_printf("(%s %2.2X)",
  466. acpi_ut_get_object_type_name
  467. (next), next->common.type);
  468. while (next->region.next) {
  469. if ((next->common.type ==
  470. ACPI_TYPE_LOCAL_DATA) && !data) {
  471. data = next;
  472. }
  473. next = next->region.next;
  474. acpi_os_printf("->%p(%s %2.2X)", next,
  475. acpi_ut_get_object_type_name
  476. (next),
  477. next->common.type);
  478. if ((next == start) || (next == data)) {
  479. acpi_os_printf
  480. ("\n**** Error: Region list appears to be circular linked");
  481. break;
  482. }
  483. }
  484. }
  485. acpi_os_printf("\n");
  486. break;
  487. case ACPI_EXD_NODE:
  488. node =
  489. *ACPI_CAST_PTR(struct acpi_namespace_node *,
  490. target);
  491. acpi_os_printf("%20s : %p", name, node);
  492. if (node) {
  493. acpi_os_printf(" [%4.4s]", node->name.ascii);
  494. }
  495. acpi_os_printf("\n");
  496. break;
  497. default:
  498. acpi_os_printf("**** Invalid table opcode [%X] ****\n",
  499. info->opcode);
  500. return;
  501. }
  502. info++;
  503. count--;
  504. }
  505. }
  506. /*******************************************************************************
  507. *
  508. * FUNCTION: acpi_ex_dump_operand
  509. *
  510. * PARAMETERS: *obj_desc - Pointer to entry to be dumped
  511. * depth - Current nesting depth
  512. *
  513. * RETURN: None
  514. *
  515. * DESCRIPTION: Dump an operand object
  516. *
  517. ******************************************************************************/
  518. void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
  519. {
  520. u32 length;
  521. u32 index;
  522. ACPI_FUNCTION_NAME(ex_dump_operand);
  523. /* Check if debug output enabled */
  524. if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
  525. return;
  526. }
  527. if (!obj_desc) {
  528. /* This could be a null element of a package */
  529. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
  530. return;
  531. }
  532. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
  533. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
  534. obj_desc));
  535. ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
  536. return;
  537. }
  538. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
  539. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  540. "%p is not a node or operand object: [%s]\n",
  541. obj_desc,
  542. acpi_ut_get_descriptor_name(obj_desc)));
  543. ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
  544. return;
  545. }
  546. /* obj_desc is a valid object */
  547. if (depth > 0) {
  548. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p Refs=%u ",
  549. depth, " ", depth, obj_desc,
  550. obj_desc->common.reference_count));
  551. } else {
  552. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Refs=%u ",
  553. obj_desc, obj_desc->common.reference_count));
  554. }
  555. /* Decode object type */
  556. switch (obj_desc->common.type) {
  557. case ACPI_TYPE_LOCAL_REFERENCE:
  558. acpi_os_printf("Reference: [%s] ",
  559. acpi_ut_get_reference_name(obj_desc));
  560. switch (obj_desc->reference.class) {
  561. case ACPI_REFCLASS_DEBUG:
  562. acpi_os_printf("\n");
  563. break;
  564. case ACPI_REFCLASS_INDEX:
  565. acpi_os_printf("%p\n", obj_desc->reference.object);
  566. break;
  567. case ACPI_REFCLASS_TABLE:
  568. acpi_os_printf("Table Index %X\n",
  569. obj_desc->reference.value);
  570. break;
  571. case ACPI_REFCLASS_REFOF:
  572. acpi_os_printf("%p [%s]\n", obj_desc->reference.object,
  573. acpi_ut_get_type_name(((union
  574. acpi_operand_object
  575. *)
  576. obj_desc->
  577. reference.
  578. object)->common.
  579. type));
  580. break;
  581. case ACPI_REFCLASS_NAME:
  582. acpi_ut_repair_name(obj_desc->reference.node->name.
  583. ascii);
  584. acpi_os_printf("- [%4.4s] (Node %p)\n",
  585. obj_desc->reference.node->name.ascii,
  586. obj_desc->reference.node);
  587. break;
  588. case ACPI_REFCLASS_ARG:
  589. case ACPI_REFCLASS_LOCAL:
  590. acpi_os_printf("%X\n", obj_desc->reference.value);
  591. break;
  592. default: /* Unknown reference class */
  593. acpi_os_printf("%2.2X\n", obj_desc->reference.class);
  594. break;
  595. }
  596. break;
  597. case ACPI_TYPE_BUFFER:
  598. acpi_os_printf("Buffer length %.2X @ %p\n",
  599. obj_desc->buffer.length,
  600. obj_desc->buffer.pointer);
  601. /* Debug only -- dump the buffer contents */
  602. if (obj_desc->buffer.pointer) {
  603. length = obj_desc->buffer.length;
  604. if (length > 128) {
  605. length = 128;
  606. }
  607. acpi_os_printf
  608. ("Buffer Contents: (displaying length 0x%.2X)\n",
  609. length);
  610. ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, length);
  611. }
  612. break;
  613. case ACPI_TYPE_INTEGER:
  614. acpi_os_printf("Integer %8.8X%8.8X\n",
  615. ACPI_FORMAT_UINT64(obj_desc->integer.value));
  616. break;
  617. case ACPI_TYPE_PACKAGE:
  618. acpi_os_printf("Package [Len %X] ElementArray %p\n",
  619. obj_desc->package.count,
  620. obj_desc->package.elements);
  621. /*
  622. * If elements exist, package element pointer is valid,
  623. * and debug_level exceeds 1, dump package's elements.
  624. */
  625. if (obj_desc->package.count &&
  626. obj_desc->package.elements && acpi_dbg_level > 1) {
  627. for (index = 0; index < obj_desc->package.count;
  628. index++) {
  629. acpi_ex_dump_operand(obj_desc->package.
  630. elements[index],
  631. depth + 1);
  632. }
  633. }
  634. break;
  635. case ACPI_TYPE_REGION:
  636. acpi_os_printf("Region %s (%X)",
  637. acpi_ut_get_region_name(obj_desc->region.
  638. space_id),
  639. obj_desc->region.space_id);
  640. /*
  641. * If the address and length have not been evaluated,
  642. * don't print them.
  643. */
  644. if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
  645. acpi_os_printf("\n");
  646. } else {
  647. acpi_os_printf(" base %8.8X%8.8X Length %X\n",
  648. ACPI_FORMAT_UINT64(obj_desc->region.
  649. address),
  650. obj_desc->region.length);
  651. }
  652. break;
  653. case ACPI_TYPE_STRING:
  654. acpi_os_printf("String length %X @ %p ",
  655. obj_desc->string.length,
  656. obj_desc->string.pointer);
  657. acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
  658. acpi_os_printf("\n");
  659. break;
  660. case ACPI_TYPE_LOCAL_BANK_FIELD:
  661. acpi_os_printf("BankField\n");
  662. break;
  663. case ACPI_TYPE_LOCAL_REGION_FIELD:
  664. acpi_os_printf
  665. ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
  666. "byte=%X bit=%X of below:\n", obj_desc->field.bit_length,
  667. obj_desc->field.access_byte_width,
  668. obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
  669. obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
  670. obj_desc->field.base_byte_offset,
  671. obj_desc->field.start_field_bit_offset);
  672. acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1);
  673. break;
  674. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  675. acpi_os_printf("IndexField\n");
  676. break;
  677. case ACPI_TYPE_BUFFER_FIELD:
  678. acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n",
  679. obj_desc->buffer_field.bit_length,
  680. obj_desc->buffer_field.base_byte_offset,
  681. obj_desc->buffer_field.start_field_bit_offset);
  682. if (!obj_desc->buffer_field.buffer_obj) {
  683. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
  684. } else if ((obj_desc->buffer_field.buffer_obj)->common.type !=
  685. ACPI_TYPE_BUFFER) {
  686. acpi_os_printf("*not a Buffer*\n");
  687. } else {
  688. acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
  689. depth + 1);
  690. }
  691. break;
  692. case ACPI_TYPE_EVENT:
  693. acpi_os_printf("Event\n");
  694. break;
  695. case ACPI_TYPE_METHOD:
  696. acpi_os_printf("Method(%X) @ %p:%X\n",
  697. obj_desc->method.param_count,
  698. obj_desc->method.aml_start,
  699. obj_desc->method.aml_length);
  700. break;
  701. case ACPI_TYPE_MUTEX:
  702. acpi_os_printf("Mutex\n");
  703. break;
  704. case ACPI_TYPE_DEVICE:
  705. acpi_os_printf("Device\n");
  706. break;
  707. case ACPI_TYPE_POWER:
  708. acpi_os_printf("Power\n");
  709. break;
  710. case ACPI_TYPE_PROCESSOR:
  711. acpi_os_printf("Processor\n");
  712. break;
  713. case ACPI_TYPE_THERMAL:
  714. acpi_os_printf("Thermal\n");
  715. break;
  716. default:
  717. /* Unknown Type */
  718. acpi_os_printf("Unknown Type %X\n", obj_desc->common.type);
  719. break;
  720. }
  721. return;
  722. }
  723. /*******************************************************************************
  724. *
  725. * FUNCTION: acpi_ex_dump_operands
  726. *
  727. * PARAMETERS: operands - A list of Operand objects
  728. * opcode_name - AML opcode name
  729. * num_operands - Operand count for this opcode
  730. *
  731. * DESCRIPTION: Dump the operands associated with the opcode
  732. *
  733. ******************************************************************************/
  734. void
  735. acpi_ex_dump_operands(union acpi_operand_object **operands,
  736. const char *opcode_name, u32 num_operands)
  737. {
  738. ACPI_FUNCTION_TRACE(ex_dump_operands);
  739. if (!opcode_name) {
  740. opcode_name = "UNKNOWN";
  741. }
  742. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  743. "**** Start operand dump for opcode [%s], %u operands\n",
  744. opcode_name, num_operands));
  745. if (num_operands == 0) {
  746. num_operands = 1;
  747. }
  748. /* Dump the individual operands */
  749. while (num_operands) {
  750. acpi_ex_dump_operand(*operands, 0);
  751. operands++;
  752. num_operands--;
  753. }
  754. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  755. "**** End operand dump for [%s]\n", opcode_name));
  756. return_VOID;
  757. }
  758. /*******************************************************************************
  759. *
  760. * FUNCTION: acpi_ex_out* functions
  761. *
  762. * PARAMETERS: title - Descriptive text
  763. * value - Value to be displayed
  764. *
  765. * DESCRIPTION: Object dump output formatting functions. These functions
  766. * reduce the number of format strings required and keeps them
  767. * all in one place for easy modification.
  768. *
  769. ******************************************************************************/
  770. static void acpi_ex_out_string(const char *title, const char *value)
  771. {
  772. acpi_os_printf("%20s : %s\n", title, value);
  773. }
  774. static void acpi_ex_out_pointer(const char *title, const void *value)
  775. {
  776. acpi_os_printf("%20s : %p\n", title, value);
  777. }
  778. /*******************************************************************************
  779. *
  780. * FUNCTION: acpi_ex_dump_namespace_node
  781. *
  782. * PARAMETERS: node - Descriptor to dump
  783. * flags - Force display if TRUE
  784. *
  785. * DESCRIPTION: Dumps the members of the given.Node
  786. *
  787. ******************************************************************************/
  788. void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
  789. {
  790. ACPI_FUNCTION_ENTRY();
  791. if (!flags) {
  792. /* Check if debug output enabled */
  793. if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
  794. return;
  795. }
  796. }
  797. acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node));
  798. acpi_os_printf("%20s : %2.2X [%s]\n", "Type",
  799. node->type, acpi_ut_get_type_name(node->type));
  800. acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node),
  801. acpi_ex_dump_node);
  802. }
  803. /*******************************************************************************
  804. *
  805. * FUNCTION: acpi_ex_dump_reference_obj
  806. *
  807. * PARAMETERS: object - Descriptor to dump
  808. *
  809. * DESCRIPTION: Dumps a reference object
  810. *
  811. ******************************************************************************/
  812. static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
  813. {
  814. struct acpi_buffer ret_buf;
  815. acpi_status status;
  816. ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
  817. if (obj_desc->reference.class == ACPI_REFCLASS_NAME) {
  818. acpi_os_printf(" %p ", obj_desc->reference.node);
  819. status = acpi_ns_handle_to_pathname(obj_desc->reference.node,
  820. &ret_buf, TRUE);
  821. if (ACPI_FAILURE(status)) {
  822. acpi_os_printf
  823. (" Could not convert name to pathname: %s\n",
  824. acpi_format_exception(status));
  825. } else {
  826. acpi_os_printf("%s: %s\n",
  827. acpi_ut_get_type_name(obj_desc->
  828. reference.node->
  829. type),
  830. (char *)ret_buf.pointer);
  831. ACPI_FREE(ret_buf.pointer);
  832. }
  833. } else if (obj_desc->reference.object) {
  834. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
  835. ACPI_DESC_TYPE_OPERAND) {
  836. acpi_os_printf("%22s %p", "Target :",
  837. obj_desc->reference.object);
  838. if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) {
  839. acpi_os_printf(" Table Index: %X\n",
  840. obj_desc->reference.value);
  841. } else {
  842. acpi_os_printf(" [%s]\n",
  843. acpi_ut_get_type_name(((union
  844. acpi_operand_object
  845. *)
  846. obj_desc->
  847. reference.
  848. object)->
  849. common.
  850. type));
  851. }
  852. } else {
  853. acpi_os_printf(" Target: %p\n",
  854. obj_desc->reference.object);
  855. }
  856. }
  857. }
  858. /*******************************************************************************
  859. *
  860. * FUNCTION: acpi_ex_dump_package_obj
  861. *
  862. * PARAMETERS: obj_desc - Descriptor to dump
  863. * level - Indentation Level
  864. * index - Package index for this object
  865. *
  866. * DESCRIPTION: Dumps the elements of the package
  867. *
  868. ******************************************************************************/
  869. static void
  870. acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
  871. u32 level, u32 index)
  872. {
  873. u32 i;
  874. /* Indentation and index output */
  875. if (level > 0) {
  876. for (i = 0; i < level; i++) {
  877. acpi_os_printf(" ");
  878. }
  879. acpi_os_printf("[%.2d] ", index);
  880. }
  881. acpi_os_printf("%p ", obj_desc);
  882. /* Null package elements are allowed */
  883. if (!obj_desc) {
  884. acpi_os_printf("[Null Object]\n");
  885. return;
  886. }
  887. /* Packages may only contain a few object types */
  888. switch (obj_desc->common.type) {
  889. case ACPI_TYPE_INTEGER:
  890. acpi_os_printf("[Integer] = %8.8X%8.8X\n",
  891. ACPI_FORMAT_UINT64(obj_desc->integer.value));
  892. break;
  893. case ACPI_TYPE_STRING:
  894. acpi_os_printf("[String] Value: ");
  895. acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
  896. acpi_os_printf("\n");
  897. break;
  898. case ACPI_TYPE_BUFFER:
  899. acpi_os_printf("[Buffer] Length %.2X = ",
  900. obj_desc->buffer.length);
  901. if (obj_desc->buffer.length) {
  902. acpi_ut_debug_dump_buffer(ACPI_CAST_PTR
  903. (u8,
  904. obj_desc->buffer.pointer),
  905. obj_desc->buffer.length,
  906. DB_DWORD_DISPLAY, _COMPONENT);
  907. } else {
  908. acpi_os_printf("\n");
  909. }
  910. break;
  911. case ACPI_TYPE_PACKAGE:
  912. acpi_os_printf("[Package] Contains %u Elements:\n",
  913. obj_desc->package.count);
  914. for (i = 0; i < obj_desc->package.count; i++) {
  915. acpi_ex_dump_package_obj(obj_desc->package.elements[i],
  916. level + 1, i);
  917. }
  918. break;
  919. case ACPI_TYPE_LOCAL_REFERENCE:
  920. acpi_os_printf("[Object Reference] Class [%s]",
  921. acpi_ut_get_reference_name(obj_desc));
  922. acpi_ex_dump_reference_obj(obj_desc);
  923. break;
  924. default:
  925. acpi_os_printf("[%s] Type: %2.2X\n",
  926. acpi_ut_get_type_name(obj_desc->common.type),
  927. obj_desc->common.type);
  928. break;
  929. }
  930. }
  931. /*******************************************************************************
  932. *
  933. * FUNCTION: acpi_ex_dump_object_descriptor
  934. *
  935. * PARAMETERS: obj_desc - Descriptor to dump
  936. * flags - Force display if TRUE
  937. *
  938. * DESCRIPTION: Dumps the members of the object descriptor given.
  939. *
  940. ******************************************************************************/
  941. void
  942. acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
  943. {
  944. ACPI_FUNCTION_TRACE(ex_dump_object_descriptor);
  945. if (!obj_desc) {
  946. return_VOID;
  947. }
  948. if (!flags) {
  949. /* Check if debug output enabled */
  950. if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
  951. return_VOID;
  952. }
  953. }
  954. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
  955. acpi_ex_dump_namespace_node((struct acpi_namespace_node *)
  956. obj_desc, flags);
  957. obj_desc = ((struct acpi_namespace_node *)obj_desc)->object;
  958. if (!obj_desc) {
  959. return_VOID;
  960. }
  961. acpi_os_printf("\nAttached Object %p", obj_desc);
  962. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
  963. acpi_os_printf(" - Namespace Node");
  964. }
  965. acpi_os_printf(":\n");
  966. goto dump_object;
  967. }
  968. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
  969. acpi_os_printf("%p is not an ACPI operand object: [%s]\n",
  970. obj_desc, acpi_ut_get_descriptor_name(obj_desc));
  971. return_VOID;
  972. }
  973. /* Validate the object type */
  974. if (obj_desc->common.type > ACPI_TYPE_LOCAL_MAX) {
  975. acpi_os_printf("Not a known object type: %2.2X\n",
  976. obj_desc->common.type);
  977. return_VOID;
  978. }
  979. dump_object:
  980. if (!obj_desc) {
  981. return_VOID;
  982. }
  983. /* Common Fields */
  984. acpi_ex_dump_object(obj_desc, acpi_ex_dump_common);
  985. /* Object-specific fields */
  986. acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]);
  987. if (obj_desc->common.type == ACPI_TYPE_REGION) {
  988. obj_desc = obj_desc->common.next_object;
  989. if (obj_desc->common.type > ACPI_TYPE_LOCAL_MAX) {
  990. acpi_os_printf
  991. ("Secondary object is not a known object type: %2.2X\n",
  992. obj_desc->common.type);
  993. return_VOID;
  994. }
  995. acpi_os_printf("\nExtra attached Object (%p):\n", obj_desc);
  996. acpi_ex_dump_object(obj_desc,
  997. acpi_ex_dump_info[obj_desc->common.type]);
  998. }
  999. return_VOID;
  1000. }
  1001. #endif