dmrestag.c 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. /******************************************************************************
  2. *
  3. * Module Name: dmrestag - Add tags to resource descriptors (Application-level)
  4. *
  5. *****************************************************************************/
  6. /******************************************************************************
  7. *
  8. * 1. Copyright Notice
  9. *
  10. * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
  11. * All rights reserved.
  12. *
  13. * 2. License
  14. *
  15. * 2.1. This is your license from Intel Corp. under its intellectual property
  16. * rights. You may have additional license terms from the party that provided
  17. * you this software, covering your right to use that party's intellectual
  18. * property rights.
  19. *
  20. * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
  21. * copy of the source code appearing in this file ("Covered Code") an
  22. * irrevocable, perpetual, worldwide license under Intel's copyrights in the
  23. * base code distributed originally by Intel ("Original Intel Code") to copy,
  24. * make derivatives, distribute, use and display any portion of the Covered
  25. * Code in any form, with the right to sublicense such rights; and
  26. *
  27. * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
  28. * license (with the right to sublicense), under only those claims of Intel
  29. * patents that are infringed by the Original Intel Code, to make, use, sell,
  30. * offer to sell, and import the Covered Code and derivative works thereof
  31. * solely to the minimum extent necessary to exercise the above copyright
  32. * license, and in no event shall the patent license extend to any additions
  33. * to or modifications of the Original Intel Code. No other license or right
  34. * is granted directly or by implication, estoppel or otherwise;
  35. *
  36. * The above copyright and patent license is granted only if the following
  37. * conditions are met:
  38. *
  39. * 3. Conditions
  40. *
  41. * 3.1. Redistribution of Source with Rights to Further Distribute Source.
  42. * Redistribution of source code of any substantial portion of the Covered
  43. * Code or modification with rights to further distribute source must include
  44. * the above Copyright Notice, the above License, this list of Conditions,
  45. * and the following Disclaimer and Export Compliance provision. In addition,
  46. * Licensee must cause all Covered Code to which Licensee contributes to
  47. * contain a file documenting the changes Licensee made to create that Covered
  48. * Code and the date of any change. Licensee must include in that file the
  49. * documentation of any changes made by any predecessor Licensee. Licensee
  50. * must include a prominent statement that the modification is derived,
  51. * directly or indirectly, from Original Intel Code.
  52. *
  53. * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
  54. * Redistribution of source code of any substantial portion of the Covered
  55. * Code or modification without rights to further distribute source must
  56. * include the following Disclaimer and Export Compliance provision in the
  57. * documentation and/or other materials provided with distribution. In
  58. * addition, Licensee may not authorize further sublicense of source of any
  59. * portion of the Covered Code, and must include terms to the effect that the
  60. * license from Licensee to its licensee is limited to the intellectual
  61. * property embodied in the software Licensee provides to its licensee, and
  62. * not to intellectual property embodied in modifications its licensee may
  63. * make.
  64. *
  65. * 3.3. Redistribution of Executable. Redistribution in executable form of any
  66. * substantial portion of the Covered Code or modification must reproduce the
  67. * above Copyright Notice, and the following Disclaimer and Export Compliance
  68. * provision in the documentation and/or other materials provided with the
  69. * distribution.
  70. *
  71. * 3.4. Intel retains all right, title, and interest in and to the Original
  72. * Intel Code.
  73. *
  74. * 3.5. Neither the name Intel nor any other trademark owned or controlled by
  75. * Intel shall be used in advertising or otherwise to promote the sale, use or
  76. * other dealings in products derived from or relating to the Covered Code
  77. * without prior written authorization from Intel.
  78. *
  79. * 4. Disclaimer and Export Compliance
  80. *
  81. * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
  82. * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
  83. * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
  84. * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
  85. * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
  86. * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
  87. * PARTICULAR PURPOSE.
  88. *
  89. * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
  90. * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
  91. * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
  92. * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
  93. * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
  94. * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
  95. * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
  96. * LIMITED REMEDY.
  97. *
  98. * 4.3. Licensee shall not export, either directly or indirectly, any of this
  99. * software or system incorporating such software without first obtaining any
  100. * required license or other approval from the U. S. Department of Commerce or
  101. * any other agency or department of the United States Government. In the
  102. * event Licensee exports any such software from the United States or
  103. * re-exports any such software from a foreign destination, Licensee shall
  104. * ensure that the distribution and export/re-export of the software is in
  105. * compliance with all laws, regulations, orders, or other restrictions of the
  106. * U.S. Export Administration Regulations. Licensee agrees that neither it nor
  107. * any of its subsidiaries will export/re-export any technical data, process,
  108. * software, or service, directly or indirectly, to any country for which the
  109. * United States government or any agency thereof requires an export license,
  110. * other governmental approval, or letter of assurance, without first obtaining
  111. * such license, approval or letter.
  112. *
  113. *****************************************************************************/
  114. #include "acpi.h"
  115. #include "accommon.h"
  116. #include "acparser.h"
  117. #include "acdisasm.h"
  118. #include "acnamesp.h"
  119. #include "amlcode.h"
  120. /* This module used for application-level code only */
  121. #define _COMPONENT ACPI_CA_DISASSEMBLER
  122. ACPI_MODULE_NAME ("dmrestag")
  123. /* Local prototypes */
  124. static void
  125. AcpiDmUpdateResourceName (
  126. ACPI_NAMESPACE_NODE *ResourceNode);
  127. static char *
  128. AcpiDmSearchTagList (
  129. UINT32 BitIndex,
  130. const ACPI_RESOURCE_TAG *TagList);
  131. static char *
  132. AcpiDmGetResourceTag (
  133. UINT32 BitIndex,
  134. AML_RESOURCE *Resource,
  135. UINT8 ResourceIndex);
  136. static char *
  137. AcpiGetTagPathname (
  138. ACPI_PARSE_OBJECT *Op,
  139. ACPI_NAMESPACE_NODE *BufferNode,
  140. ACPI_NAMESPACE_NODE *ResourceNode,
  141. UINT32 BitIndex);
  142. static ACPI_NAMESPACE_NODE *
  143. AcpiDmGetResourceNode (
  144. ACPI_NAMESPACE_NODE *BufferNode,
  145. UINT32 BitIndex);
  146. static ACPI_STATUS
  147. AcpiDmAddResourceToNamespace (
  148. UINT8 *Aml,
  149. UINT32 Length,
  150. UINT32 Offset,
  151. UINT8 ResourceIndex,
  152. void **Context);
  153. static void
  154. AcpiDmAddResourcesToNamespace (
  155. ACPI_NAMESPACE_NODE *BufferNode,
  156. ACPI_PARSE_OBJECT *Op);
  157. /******************************************************************************
  158. *
  159. * Resource Tag tables
  160. *
  161. * These are the predefined tags that refer to elements of a resource
  162. * descriptor. Each name and offset is defined in the ACPI specification.
  163. *
  164. * Each table entry contains the bit offset of the field and the associated
  165. * name.
  166. *
  167. ******************************************************************************/
  168. static const ACPI_RESOURCE_TAG AcpiDmIrqTags[] =
  169. {
  170. {( 1 * 8), ACPI_RESTAG_INTERRUPT},
  171. {( 3 * 8) + 0, ACPI_RESTAG_INTERRUPTTYPE},
  172. {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTLEVEL},
  173. {( 3 * 8) + 4, ACPI_RESTAG_INTERRUPTSHARE},
  174. {0, NULL}
  175. };
  176. static const ACPI_RESOURCE_TAG AcpiDmDmaTags[] =
  177. {
  178. {( 1 * 8), ACPI_RESTAG_DMA},
  179. {( 2 * 8) + 0, ACPI_RESTAG_XFERTYPE},
  180. {( 2 * 8) + 2, ACPI_RESTAG_BUSMASTER},
  181. {( 2 * 8) + 5, ACPI_RESTAG_DMATYPE},
  182. {0, NULL}
  183. };
  184. static const ACPI_RESOURCE_TAG AcpiDmIoTags[] =
  185. {
  186. {( 1 * 8) + 0, ACPI_RESTAG_DECODE},
  187. {( 2 * 8), ACPI_RESTAG_MINADDR},
  188. {( 4 * 8), ACPI_RESTAG_MAXADDR},
  189. {( 6 * 8), ACPI_RESTAG_ALIGNMENT},
  190. {( 7 * 8), ACPI_RESTAG_LENGTH},
  191. {0, NULL}
  192. };
  193. static const ACPI_RESOURCE_TAG AcpiDmFixedIoTags[] =
  194. {
  195. {( 1 * 8), ACPI_RESTAG_BASEADDRESS},
  196. {( 3 * 8), ACPI_RESTAG_LENGTH},
  197. {0, NULL}
  198. };
  199. static const ACPI_RESOURCE_TAG AcpiDmFixedDmaTags[] =
  200. {
  201. {( 1 * 8), ACPI_RESTAG_DMA},
  202. {( 3 * 8), ACPI_RESTAG_DMATYPE},
  203. {( 5 * 8), ACPI_RESTAG_XFERTYPE},
  204. {0, NULL}
  205. };
  206. static const ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] =
  207. {
  208. {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
  209. {( 4 * 8), ACPI_RESTAG_MINADDR},
  210. {( 6 * 8), ACPI_RESTAG_MAXADDR},
  211. {( 8 * 8), ACPI_RESTAG_ALIGNMENT},
  212. {(10 * 8), ACPI_RESTAG_LENGTH},
  213. {0, NULL}
  214. };
  215. static const ACPI_RESOURCE_TAG AcpiDmRegisterTags[] =
  216. {
  217. {( 3 * 8), ACPI_RESTAG_ADDRESSSPACE},
  218. {( 4 * 8), ACPI_RESTAG_REGISTERBITWIDTH},
  219. {( 5 * 8), ACPI_RESTAG_REGISTERBITOFFSET},
  220. {( 6 * 8), ACPI_RESTAG_ACCESSSIZE},
  221. {( 7 * 8), ACPI_RESTAG_ADDRESS},
  222. {0, NULL}
  223. };
  224. static const ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] =
  225. {
  226. {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
  227. {( 4 * 8), ACPI_RESTAG_MINADDR},
  228. {( 8 * 8), ACPI_RESTAG_MAXADDR},
  229. {(12 * 8), ACPI_RESTAG_ALIGNMENT},
  230. {(16 * 8), ACPI_RESTAG_LENGTH},
  231. {0, NULL}
  232. };
  233. static const ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] =
  234. {
  235. {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
  236. {( 4 * 8), ACPI_RESTAG_BASEADDRESS},
  237. {( 8 * 8), ACPI_RESTAG_LENGTH},
  238. {0, NULL}
  239. };
  240. static const ACPI_RESOURCE_TAG AcpiDmInterruptTags[] =
  241. {
  242. {( 3 * 8) + 1, ACPI_RESTAG_INTERRUPTTYPE},
  243. {( 3 * 8) + 2, ACPI_RESTAG_INTERRUPTLEVEL},
  244. {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE},
  245. {( 5 * 8), ACPI_RESTAG_INTERRUPT},
  246. {0, NULL}
  247. };
  248. static const ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] =
  249. {
  250. {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
  251. {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
  252. {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
  253. {( 6 * 8), ACPI_RESTAG_GRANULARITY},
  254. {( 8 * 8), ACPI_RESTAG_MINADDR},
  255. {(10 * 8), ACPI_RESTAG_MAXADDR},
  256. {(12 * 8), ACPI_RESTAG_TRANSLATION},
  257. {(14 * 8), ACPI_RESTAG_LENGTH},
  258. {0, NULL}
  259. };
  260. static const ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] =
  261. {
  262. {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
  263. {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
  264. {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
  265. {( 6 * 8), ACPI_RESTAG_GRANULARITY},
  266. {(10 * 8), ACPI_RESTAG_MINADDR},
  267. {(14 * 8), ACPI_RESTAG_MAXADDR},
  268. {(18 * 8), ACPI_RESTAG_TRANSLATION},
  269. {(22 * 8), ACPI_RESTAG_LENGTH},
  270. {0, NULL}
  271. };
  272. static const ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] =
  273. {
  274. {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
  275. {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
  276. {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
  277. {( 6 * 8), ACPI_RESTAG_GRANULARITY},
  278. {(14 * 8), ACPI_RESTAG_MINADDR},
  279. {(22 * 8), ACPI_RESTAG_MAXADDR},
  280. {(30 * 8), ACPI_RESTAG_TRANSLATION},
  281. {(38 * 8), ACPI_RESTAG_LENGTH},
  282. {0, NULL}
  283. };
  284. static const ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] =
  285. {
  286. {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
  287. {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
  288. {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
  289. {( 8 * 8), ACPI_RESTAG_GRANULARITY},
  290. {(16 * 8), ACPI_RESTAG_MINADDR},
  291. {(24 * 8), ACPI_RESTAG_MAXADDR},
  292. {(32 * 8), ACPI_RESTAG_TRANSLATION},
  293. {(40 * 8), ACPI_RESTAG_LENGTH},
  294. {(48 * 8), ACPI_RESTAG_TYPESPECIFICATTRIBUTES},
  295. {0, NULL}
  296. };
  297. /* Subtype tables for GPIO descriptors */
  298. static const ACPI_RESOURCE_TAG AcpiDmGpioIntTags[] =
  299. {
  300. {( 7 * 8) + 0, ACPI_RESTAG_MODE},
  301. {( 7 * 8) + 1, ACPI_RESTAG_POLARITY},
  302. {( 7 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE},
  303. {( 9 * 8), ACPI_RESTAG_PINCONFIG},
  304. {(10 * 8), ACPI_RESTAG_DRIVESTRENGTH},
  305. {(12 * 8), ACPI_RESTAG_DEBOUNCETIME},
  306. {0, NULL}
  307. };
  308. static const ACPI_RESOURCE_TAG AcpiDmGpioIoTags[] =
  309. {
  310. {( 7 * 8) + 0, ACPI_RESTAG_IORESTRICTION},
  311. {( 7 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE},
  312. {( 9 * 8), ACPI_RESTAG_PINCONFIG},
  313. {(10 * 8), ACPI_RESTAG_DRIVESTRENGTH},
  314. {(12 * 8), ACPI_RESTAG_DEBOUNCETIME},
  315. {0, NULL}
  316. };
  317. /* Subtype tables for SerialBus descriptors */
  318. static const ACPI_RESOURCE_TAG AcpiDmI2cSerialBusTags[] =
  319. {
  320. {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE},
  321. {( 6 * 8) + 2, ACPI_RESTAG_INTERRUPTSHARE}, /* V2 - ACPI 6.0 */
  322. {( 7 * 8) + 0, ACPI_RESTAG_MODE},
  323. {(12 * 8), ACPI_RESTAG_SPEED},
  324. {(16 * 8), ACPI_RESTAG_ADDRESS},
  325. {0, NULL}
  326. };
  327. static const ACPI_RESOURCE_TAG AcpiDmSpiSerialBusTags[] =
  328. {
  329. {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE},
  330. {( 6 * 8) + 2, ACPI_RESTAG_INTERRUPTSHARE}, /* V2 - ACPI 6.0 */
  331. {( 7 * 8) + 0, ACPI_RESTAG_MODE},
  332. {( 7 * 8) + 1, ACPI_RESTAG_DEVICEPOLARITY},
  333. {(12 * 8), ACPI_RESTAG_SPEED},
  334. {(16 * 8), ACPI_RESTAG_LENGTH},
  335. {(17 * 8), ACPI_RESTAG_PHASE},
  336. {(18 * 8), ACPI_RESTAG_POLARITY},
  337. {(19 * 8), ACPI_RESTAG_ADDRESS},
  338. {0, NULL}
  339. };
  340. static const ACPI_RESOURCE_TAG AcpiDmUartSerialBusTags[] =
  341. {
  342. {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, /* Note: not part of original macro */
  343. {( 6 * 8) + 2, ACPI_RESTAG_INTERRUPTSHARE}, /* V2 - ACPI 6.0 */
  344. {( 7 * 8) + 0, ACPI_RESTAG_FLOWCONTROL},
  345. {( 7 * 8) + 2, ACPI_RESTAG_STOPBITS},
  346. {( 7 * 8) + 4, ACPI_RESTAG_LENGTH},
  347. {( 7 * 8) + 7, ACPI_RESTAG_ENDIANNESS},
  348. {(12 * 8), ACPI_RESTAG_SPEED},
  349. {(16 * 8), ACPI_RESTAG_LENGTH_RX},
  350. {(18 * 8), ACPI_RESTAG_LENGTH_TX},
  351. {(20 * 8), ACPI_RESTAG_PARITY},
  352. {(21 * 8), ACPI_RESTAG_LINE},
  353. {0, NULL}
  354. };
  355. /* Subtype tables for Address descriptor type-specific flags */
  356. static const ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] =
  357. {
  358. {( 5 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
  359. {( 5 * 8) + 1, ACPI_RESTAG_MEMTYPE},
  360. {( 5 * 8) + 3, ACPI_RESTAG_MEMATTRIBUTES},
  361. {( 5 * 8) + 5, ACPI_RESTAG_TYPE},
  362. {0, NULL}
  363. };
  364. static const ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] =
  365. {
  366. {( 5 * 8) + 0, ACPI_RESTAG_RANGETYPE},
  367. {( 5 * 8) + 4, ACPI_RESTAG_TYPE},
  368. {( 5 * 8) + 5, ACPI_RESTAG_TRANSTYPE},
  369. {0, NULL}
  370. };
  371. /*
  372. * Dispatch table used to obtain the correct tag table for a descriptor.
  373. *
  374. * A NULL in this table means one of three things:
  375. * 1) The descriptor ID is reserved and invalid
  376. * 2) The descriptor has no tags associated with it
  377. * 3) The descriptor has subtypes and a separate table will be used.
  378. */
  379. static const ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags[] =
  380. {
  381. /* Small descriptors */
  382. NULL, /* 0x00, Reserved */
  383. NULL, /* 0x01, Reserved */
  384. NULL, /* 0x02, Reserved */
  385. NULL, /* 0x03, Reserved */
  386. AcpiDmIrqTags, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */
  387. AcpiDmDmaTags, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */
  388. NULL, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
  389. NULL, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
  390. AcpiDmIoTags, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
  391. AcpiDmFixedIoTags, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
  392. AcpiDmFixedDmaTags, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */
  393. NULL, /* 0x0B, Reserved */
  394. NULL, /* 0x0C, Reserved */
  395. NULL, /* 0x0D, Reserved */
  396. NULL, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
  397. NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
  398. /* Large descriptors */
  399. NULL, /* 0x00, Reserved */
  400. AcpiDmMemory24Tags, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
  401. AcpiDmRegisterTags, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
  402. NULL, /* 0x03, Reserved */
  403. NULL, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */
  404. AcpiDmMemory32Tags, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */
  405. AcpiDmFixedMemory32Tags, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */
  406. AcpiDmAddress32Tags, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */
  407. AcpiDmAddress16Tags, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
  408. AcpiDmInterruptTags, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
  409. AcpiDmAddress64Tags, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
  410. AcpiDmExtendedAddressTags, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
  411. NULL, /* 0x0C, ACPI_RESOURCE_NAME_GPIO - Use Subtype table below */
  412. NULL, /* 0x0D, Reserved */
  413. NULL /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use Subtype table below */
  414. };
  415. /* GPIO Subtypes */
  416. static const ACPI_RESOURCE_TAG *AcpiGbl_GpioResourceTags[] =
  417. {
  418. AcpiDmGpioIntTags, /* 0x00 Interrupt Connection */
  419. AcpiDmGpioIoTags /* 0x01 I/O Connection */
  420. };
  421. /* Serial Bus Subtypes */
  422. static const ACPI_RESOURCE_TAG *AcpiGbl_SerialResourceTags[] =
  423. {
  424. NULL, /* 0x00 Reserved */
  425. AcpiDmI2cSerialBusTags, /* 0x01 I2C SerialBus */
  426. AcpiDmSpiSerialBusTags, /* 0x02 SPI SerialBus */
  427. AcpiDmUartSerialBusTags /* 0x03 UART SerialBus */
  428. };
  429. /*
  430. * Globals used to generate unique resource descriptor names. We use names that
  431. * start with underscore and a prefix letter that is not used by other ACPI
  432. * reserved names. To this, we append hex 0x00 through 0xFF. These 5 prefixes
  433. * allow for 5*256 = 1280 unique names, probably sufficient for any single ASL
  434. * file. If this becomes too small, we can use alpha+numerals for a total
  435. * of 5*36*36 = 6480.
  436. */
  437. #define ACPI_NUM_RES_PREFIX 5
  438. static UINT32 AcpiGbl_NextResourceId = 0;
  439. static UINT8 AcpiGbl_NextPrefix = 0;
  440. static char AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
  441. {'Y','Z','J','K','X'};
  442. /*******************************************************************************
  443. *
  444. * FUNCTION: AcpiDmCheckResourceReference
  445. *
  446. * PARAMETERS: Op - Parse Op for the AML opcode
  447. * WalkState - Current walk state (with valid scope)
  448. *
  449. * RETURN: None
  450. *
  451. * DESCRIPTION: Convert a reference to a resource descriptor to a symbolic
  452. * reference if possible
  453. *
  454. * NOTE: Bit index is used to transparently handle both resource bit
  455. * fields and byte fields.
  456. *
  457. ******************************************************************************/
  458. void
  459. AcpiDmCheckResourceReference (
  460. ACPI_PARSE_OBJECT *Op,
  461. ACPI_WALK_STATE *WalkState)
  462. {
  463. ACPI_STATUS Status;
  464. ACPI_PARSE_OBJECT *BufferNameOp;
  465. ACPI_PARSE_OBJECT *IndexOp;
  466. ACPI_NAMESPACE_NODE *BufferNode;
  467. ACPI_NAMESPACE_NODE *ResourceNode;
  468. const ACPI_OPCODE_INFO *OpInfo;
  469. UINT32 BitIndex;
  470. /* We are only interested in the CreateXxxxField opcodes */
  471. OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
  472. if (OpInfo->Type != AML_TYPE_CREATE_FIELD)
  473. {
  474. return;
  475. }
  476. /* Get the buffer term operand */
  477. BufferNameOp = AcpiPsGetDepthNext (NULL, Op);
  478. /* Must be a named buffer, not an arg or local or method call */
  479. if (BufferNameOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)
  480. {
  481. return;
  482. }
  483. /* Get the Index term, must be an integer constant to convert */
  484. IndexOp = BufferNameOp->Common.Next;
  485. /* Major cheat: The Node field is also used for the Tag ptr. Clear it now */
  486. IndexOp->Common.Node = NULL;
  487. OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode);
  488. if (OpInfo->ObjectType != ACPI_TYPE_INTEGER)
  489. {
  490. return;
  491. }
  492. /* Get the bit offset of the descriptor within the buffer */
  493. if ((Op->Common.AmlOpcode == AML_CREATE_BIT_FIELD_OP) ||
  494. (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP))
  495. {
  496. /* Index operand is a bit offset */
  497. BitIndex = (UINT32) IndexOp->Common.Value.Integer;
  498. }
  499. else
  500. {
  501. /* Index operand is a byte offset, convert to bits */
  502. BitIndex = (UINT32) ACPI_MUL_8 (IndexOp->Common.Value.Integer);
  503. }
  504. /* Lookup the buffer in the namespace */
  505. Status = AcpiNsLookup (WalkState->ScopeInfo,
  506. BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
  507. ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
  508. &BufferNode);
  509. if (ACPI_FAILURE (Status))
  510. {
  511. return;
  512. }
  513. /* Validate object type, we must have a buffer */
  514. if (BufferNode->Type != ACPI_TYPE_BUFFER)
  515. {
  516. return;
  517. }
  518. /* Find the resource descriptor node corresponding to the index */
  519. ResourceNode = AcpiDmGetResourceNode (BufferNode, BitIndex);
  520. if (!ResourceNode)
  521. {
  522. return;
  523. }
  524. /* Translate the Index to a resource tag pathname */
  525. AcpiGetTagPathname (IndexOp, BufferNode, ResourceNode, BitIndex);
  526. }
  527. /*******************************************************************************
  528. *
  529. * FUNCTION: AcpiDmGetResourceNode
  530. *
  531. * PARAMETERS: BufferNode - Node for the parent buffer
  532. * BitIndex - Index into the resource descriptor
  533. *
  534. * RETURN: Namespace node for the resource descriptor. NULL if not found
  535. *
  536. * DESCRIPTION: Find a resource descriptor that corresponds to the bit index
  537. *
  538. ******************************************************************************/
  539. static ACPI_NAMESPACE_NODE *
  540. AcpiDmGetResourceNode (
  541. ACPI_NAMESPACE_NODE *BufferNode,
  542. UINT32 BitIndex)
  543. {
  544. ACPI_NAMESPACE_NODE *Node;
  545. UINT32 ByteIndex = ACPI_DIV_8 (BitIndex);
  546. /*
  547. * Child list contains an entry for each resource descriptor. Find
  548. * the descriptor that corresponds to the Index.
  549. *
  550. * If there are no children, this is not a resource template
  551. */
  552. Node = BufferNode->Child;
  553. while (Node)
  554. {
  555. /*
  556. * Check if the Index falls within this resource.
  557. *
  558. * Value contains the resource offset, Object contains the resource
  559. * length (both in bytes)
  560. */
  561. if ((ByteIndex >= Node->Value) &&
  562. (ByteIndex < (Node->Value + Node->Length)))
  563. {
  564. return (Node);
  565. }
  566. Node = Node->Peer;
  567. }
  568. return (NULL);
  569. }
  570. /*******************************************************************************
  571. *
  572. * FUNCTION: AcpiGetTagPathname
  573. *
  574. * PARAMETERS: BufferNode - Node for the parent buffer
  575. * ResourceNode - Node for a resource descriptor
  576. * BitIndex - Index into the resource descriptor
  577. *
  578. * RETURN: Full pathname for a resource tag. NULL if no match.
  579. * Path is returned in AML (packed) format.
  580. *
  581. * DESCRIPTION: Convert a BitIndex into a symbolic resource tag (full pathname)
  582. *
  583. ******************************************************************************/
  584. static char *
  585. AcpiGetTagPathname (
  586. ACPI_PARSE_OBJECT *IndexOp,
  587. ACPI_NAMESPACE_NODE *BufferNode,
  588. ACPI_NAMESPACE_NODE *ResourceNode,
  589. UINT32 BitIndex)
  590. {
  591. ACPI_STATUS Status;
  592. UINT32 ResourceBitIndex;
  593. UINT8 ResourceTableIndex;
  594. ACPI_SIZE RequiredSize;
  595. char *Pathname;
  596. AML_RESOURCE *Aml;
  597. ACPI_PARSE_OBJECT *Op;
  598. char *InternalPath;
  599. char *Tag;
  600. /* Get the Op that contains the actual buffer data */
  601. Op = BufferNode->Op->Common.Value.Arg;
  602. Op = Op->Common.Next;
  603. if (!Op)
  604. {
  605. return (NULL);
  606. }
  607. /* Get the individual resource descriptor and validate it */
  608. Aml = ACPI_CAST_PTR (
  609. AML_RESOURCE, &Op->Named.Data[ResourceNode->Value]);
  610. Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex);
  611. if (ACPI_FAILURE (Status))
  612. {
  613. return (NULL);
  614. }
  615. /* Get offset into this descriptor (from offset into entire buffer) */
  616. ResourceBitIndex = BitIndex - ACPI_MUL_8 (ResourceNode->Value);
  617. /* Get the tag associated with this resource descriptor and offset */
  618. Tag = AcpiDmGetResourceTag (ResourceBitIndex, Aml, ResourceTableIndex);
  619. if (!Tag)
  620. {
  621. return (NULL);
  622. }
  623. /*
  624. * Now that we know that we have a reference that can be converted to a
  625. * symbol, change the name of the resource to a unique name.
  626. */
  627. AcpiDmUpdateResourceName (ResourceNode);
  628. /* Get the full pathname to the parent buffer */
  629. RequiredSize = AcpiNsBuildNormalizedPath (BufferNode, NULL, 0, FALSE);
  630. if (!RequiredSize)
  631. {
  632. return (NULL);
  633. }
  634. Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH);
  635. if (!Pathname)
  636. {
  637. return (NULL);
  638. }
  639. (void) AcpiNsBuildNormalizedPath (BufferNode, Pathname,
  640. RequiredSize, FALSE);
  641. /*
  642. * Create the full path to the resource and tag by: remove the buffer name,
  643. * append the resource descriptor name, append a dot, append the tag name.
  644. *
  645. * TBD: Always using the full path is a bit brute force, the path can be
  646. * often be optimized with carats (if the original buffer namepath is a
  647. * single nameseg). This doesn't really matter, because these paths do not
  648. * end up in the final compiled AML, it's just an appearance issue for the
  649. * disassembled code.
  650. */
  651. Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0;
  652. strncat (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
  653. strcat (Pathname, ".");
  654. strncat (Pathname, Tag, ACPI_NAME_SIZE);
  655. /* Internalize the namepath to AML format */
  656. AcpiNsInternalizeName (Pathname, &InternalPath);
  657. ACPI_FREE (Pathname);
  658. /* Update the Op with the symbol */
  659. AcpiPsInitOp (IndexOp, AML_INT_NAMEPATH_OP);
  660. IndexOp->Common.Value.String = InternalPath;
  661. /* We will need the tag later. Cheat by putting it in the Node field */
  662. IndexOp->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Tag);
  663. return (InternalPath);
  664. }
  665. /*******************************************************************************
  666. *
  667. * FUNCTION: AcpiDmUpdateResourceName
  668. *
  669. * PARAMETERS: ResourceNode - Node for a resource descriptor
  670. *
  671. * RETURN: Stores new name in the ResourceNode
  672. *
  673. * DESCRIPTION: Create a new, unique name for a resource descriptor. Used by
  674. * both the disassembly of the descriptor itself and any symbolic
  675. * references to the descriptor. Ignored if a unique name has
  676. * already been assigned to the resource.
  677. *
  678. * NOTE: Single threaded, suitable for applications only!
  679. *
  680. ******************************************************************************/
  681. static void
  682. AcpiDmUpdateResourceName (
  683. ACPI_NAMESPACE_NODE *ResourceNode)
  684. {
  685. char Name[ACPI_NAME_SIZE];
  686. /* Ignore if a unique name has already been assigned */
  687. if (ResourceNode->Name.Integer != ACPI_DEFAULT_RESNAME)
  688. {
  689. return;
  690. }
  691. /* Generate a new ACPI name for the descriptor */
  692. Name[0] = '_';
  693. Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix];
  694. Name[2] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 4);
  695. Name[3] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 0);
  696. /* Update globals for next name */
  697. AcpiGbl_NextResourceId++;
  698. if (AcpiGbl_NextResourceId >= 256)
  699. {
  700. AcpiGbl_NextResourceId = 0;
  701. AcpiGbl_NextPrefix++;
  702. if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX)
  703. {
  704. AcpiGbl_NextPrefix = 0;
  705. }
  706. }
  707. /* Change the resource descriptor name */
  708. ResourceNode->Name.Integer = *ACPI_CAST_PTR (UINT32, &Name[0]);
  709. }
  710. /*******************************************************************************
  711. *
  712. * FUNCTION: AcpiDmGetResourceTag
  713. *
  714. * PARAMETERS: BitIndex - Index into the resource descriptor
  715. * Resource - Pointer to the raw resource data
  716. * ResourceIndex - Index correspoinding to the resource type
  717. *
  718. * RETURN: Pointer to the resource tag (ACPI_NAME). NULL if no match.
  719. *
  720. * DESCRIPTION: Convert a BitIndex into a symbolic resource tag.
  721. *
  722. * Note: ResourceIndex should be previously validated and guaranteed to ve
  723. * valid.
  724. *
  725. ******************************************************************************/
  726. static char *
  727. AcpiDmGetResourceTag (
  728. UINT32 BitIndex,
  729. AML_RESOURCE *Resource,
  730. UINT8 ResourceIndex)
  731. {
  732. const ACPI_RESOURCE_TAG *TagList;
  733. char *Tag = NULL;
  734. /* Get the tag list for this resource descriptor type */
  735. TagList = AcpiGbl_ResourceTags[ResourceIndex];
  736. /*
  737. * Handle descriptors that have multiple subtypes
  738. */
  739. switch (Resource->DescriptorType)
  740. {
  741. case ACPI_RESOURCE_NAME_ADDRESS16:
  742. case ACPI_RESOURCE_NAME_ADDRESS32:
  743. case ACPI_RESOURCE_NAME_ADDRESS64:
  744. case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64:
  745. /*
  746. * Subtype differentiation is the flags.
  747. * Kindof brute force, but just blindly search for an index match
  748. */
  749. if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE)
  750. {
  751. Tag = AcpiDmSearchTagList (BitIndex, AcpiDmMemoryFlagTags);
  752. }
  753. else if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_IO_RANGE)
  754. {
  755. Tag = AcpiDmSearchTagList (BitIndex, AcpiDmIoFlagTags);
  756. }
  757. /* If we found a match, all done. Else, drop to normal search below */
  758. if (Tag)
  759. {
  760. return (Tag);
  761. }
  762. break;
  763. case ACPI_RESOURCE_NAME_GPIO:
  764. /* GPIO connection has 2 subtypes: Interrupt and I/O */
  765. if (Resource->Gpio.ConnectionType > AML_RESOURCE_MAX_GPIOTYPE)
  766. {
  767. return (NULL);
  768. }
  769. TagList = AcpiGbl_GpioResourceTags[Resource->Gpio.ConnectionType];
  770. break;
  771. case ACPI_RESOURCE_NAME_SERIAL_BUS:
  772. /* SerialBus has 3 subtypes: I2C, SPI, and UART */
  773. if ((Resource->CommonSerialBus.Type == 0) ||
  774. (Resource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE))
  775. {
  776. return (NULL);
  777. }
  778. TagList = AcpiGbl_SerialResourceTags[Resource->CommonSerialBus.Type];
  779. break;
  780. default:
  781. break;
  782. }
  783. /* Search for a match against the BitIndex */
  784. if (TagList)
  785. {
  786. Tag = AcpiDmSearchTagList (BitIndex, TagList);
  787. }
  788. return (Tag);
  789. }
  790. /*******************************************************************************
  791. *
  792. * FUNCTION: AcpiDmSearchTagList
  793. *
  794. * PARAMETERS: BitIndex - Index into the resource descriptor
  795. * TagList - List to search
  796. *
  797. * RETURN: Pointer to a tag (ACPI_NAME). NULL if no match found.
  798. *
  799. * DESCRIPTION: Search a tag list for a match to the input BitIndex. Matches
  800. * a fixed offset to a symbolic resource tag name.
  801. *
  802. ******************************************************************************/
  803. static char *
  804. AcpiDmSearchTagList (
  805. UINT32 BitIndex,
  806. const ACPI_RESOURCE_TAG *TagList)
  807. {
  808. /*
  809. * Walk the null-terminated tag list to find a matching bit offset.
  810. * We are looking for an exact match.
  811. */
  812. for ( ; TagList->Tag; TagList++)
  813. {
  814. if (BitIndex == TagList->BitIndex)
  815. {
  816. return (TagList->Tag);
  817. }
  818. }
  819. /* A matching offset was not found */
  820. return (NULL);
  821. }
  822. /*******************************************************************************
  823. *
  824. * FUNCTION: AcpiDmFindResources
  825. *
  826. * PARAMETERS: Root - Root of the parse tree
  827. *
  828. * RETURN: None
  829. *
  830. * DESCRIPTION: Add all ResourceTemplate declarations to the namespace. Each
  831. * resource descriptor in each template is given a node -- used
  832. * for later conversion of resource references to symbolic refs.
  833. *
  834. ******************************************************************************/
  835. void
  836. AcpiDmFindResources (
  837. ACPI_PARSE_OBJECT *Root)
  838. {
  839. ACPI_PARSE_OBJECT *Op = Root;
  840. ACPI_PARSE_OBJECT *Parent;
  841. /* Walk the entire parse tree */
  842. while (Op)
  843. {
  844. /* We are interested in Buffer() declarations */
  845. if (Op->Common.AmlOpcode == AML_BUFFER_OP)
  846. {
  847. /* And only declarations of the form Name (XXXX, Buffer()... ) */
  848. Parent = Op->Common.Parent;
  849. if (Parent->Common.AmlOpcode == AML_NAME_OP)
  850. {
  851. /*
  852. * If the buffer is a resource template, add the individual
  853. * resource descriptors to the namespace, as children of the
  854. * buffer node.
  855. */
  856. if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (NULL, Op)))
  857. {
  858. Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
  859. AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op);
  860. }
  861. }
  862. }
  863. Op = AcpiPsGetDepthNext (Root, Op);
  864. }
  865. }
  866. /*******************************************************************************
  867. *
  868. * FUNCTION: AcpiDmAddResourcesToNamespace
  869. *
  870. * PARAMETERS: BufferNode - Node for the parent buffer
  871. * Op - Parse op for the buffer
  872. *
  873. * RETURN: None
  874. *
  875. * DESCRIPTION: Add an entire resource template to the namespace. Each
  876. * resource descriptor is added as a namespace node.
  877. *
  878. ******************************************************************************/
  879. static void
  880. AcpiDmAddResourcesToNamespace (
  881. ACPI_NAMESPACE_NODE *BufferNode,
  882. ACPI_PARSE_OBJECT *Op)
  883. {
  884. ACPI_PARSE_OBJECT *NextOp;
  885. /* Get to the ByteData list */
  886. NextOp = Op->Common.Value.Arg;
  887. NextOp = NextOp->Common.Next;
  888. if (!NextOp)
  889. {
  890. return;
  891. }
  892. /* Set Node and Op to point to each other */
  893. BufferNode->Op = Op;
  894. Op->Common.Node = BufferNode;
  895. /*
  896. * Insert each resource into the namespace
  897. * NextOp contains the Aml pointer and the Aml length
  898. */
  899. AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data,
  900. (ACPI_SIZE) NextOp->Common.Value.Integer,
  901. AcpiDmAddResourceToNamespace, (void **) BufferNode);
  902. }
  903. /*******************************************************************************
  904. *
  905. * FUNCTION: AcpiDmAddResourceToNamespace
  906. *
  907. * PARAMETERS: ACPI_WALK_AML_CALLBACK
  908. * BufferNode - Node for the parent buffer
  909. *
  910. * RETURN: Status
  911. *
  912. * DESCRIPTION: Add one resource descriptor to the namespace as a child of the
  913. * parent buffer. The same name is used for each descriptor. This
  914. * is changed later to a unique name if the resource is actually
  915. * referenced by an AML operator.
  916. *
  917. ******************************************************************************/
  918. static ACPI_STATUS
  919. AcpiDmAddResourceToNamespace (
  920. UINT8 *Aml,
  921. UINT32 Length,
  922. UINT32 Offset,
  923. UINT8 ResourceIndex,
  924. void **Context)
  925. {
  926. ACPI_STATUS Status;
  927. ACPI_GENERIC_STATE ScopeInfo;
  928. ACPI_NAMESPACE_NODE *Node;
  929. /* TBD: Don't need to add descriptors that have no tags defined? */
  930. /* Add the resource to the namespace, as child of the buffer */
  931. ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context);
  932. Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE,
  933. ACPI_IMODE_LOAD_PASS2,
  934. ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
  935. NULL, &Node);
  936. if (ACPI_FAILURE (Status))
  937. {
  938. return (AE_OK);
  939. }
  940. /* Set the name to the default, changed later if resource is referenced */
  941. Node->Name.Integer = ACPI_DEFAULT_RESNAME;
  942. /* Save the offset of the descriptor (within the original buffer) */
  943. Node->Value = Offset;
  944. Node->Length = Length;
  945. return (AE_OK);
  946. }