1
1

exdump.c 40 KB

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