acresrc.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. /******************************************************************************
  2. *
  3. * Name: acresrc.h - Resource Manager function prototypes
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, 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. #ifndef __ACRESRC_H__
  43. #define __ACRESRC_H__
  44. /* Need the AML resource descriptor structs */
  45. #include "amlresrc.h"
  46. /*
  47. * If possible, pack the following structures to byte alignment, since we
  48. * don't care about performance for debug output. Two cases where we cannot
  49. * pack the structures:
  50. *
  51. * 1) Hardware does not support misaligned memory transfers
  52. * 2) Compiler does not support pointers within packed structures
  53. */
  54. #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
  55. #pragma pack(1)
  56. #endif
  57. /*
  58. * Individual entry for the resource conversion tables
  59. */
  60. typedef const struct acpi_rsconvert_info
  61. {
  62. UINT8 Opcode;
  63. UINT8 ResourceOffset;
  64. UINT8 AmlOffset;
  65. UINT8 Value;
  66. } ACPI_RSCONVERT_INFO;
  67. /* Resource conversion opcodes */
  68. typedef enum
  69. {
  70. ACPI_RSC_INITGET = 0,
  71. ACPI_RSC_INITSET,
  72. ACPI_RSC_FLAGINIT,
  73. ACPI_RSC_1BITFLAG,
  74. ACPI_RSC_2BITFLAG,
  75. ACPI_RSC_3BITFLAG,
  76. ACPI_RSC_ADDRESS,
  77. ACPI_RSC_BITMASK,
  78. ACPI_RSC_BITMASK16,
  79. ACPI_RSC_COUNT,
  80. ACPI_RSC_COUNT16,
  81. ACPI_RSC_COUNT_GPIO_PIN,
  82. ACPI_RSC_COUNT_GPIO_RES,
  83. ACPI_RSC_COUNT_GPIO_VEN,
  84. ACPI_RSC_COUNT_SERIAL_RES,
  85. ACPI_RSC_COUNT_SERIAL_VEN,
  86. ACPI_RSC_DATA8,
  87. ACPI_RSC_EXIT_EQ,
  88. ACPI_RSC_EXIT_LE,
  89. ACPI_RSC_EXIT_NE,
  90. ACPI_RSC_LENGTH,
  91. ACPI_RSC_MOVE_GPIO_PIN,
  92. ACPI_RSC_MOVE_GPIO_RES,
  93. ACPI_RSC_MOVE_SERIAL_RES,
  94. ACPI_RSC_MOVE_SERIAL_VEN,
  95. ACPI_RSC_MOVE8,
  96. ACPI_RSC_MOVE16,
  97. ACPI_RSC_MOVE32,
  98. ACPI_RSC_MOVE64,
  99. ACPI_RSC_SET8,
  100. ACPI_RSC_SOURCE,
  101. ACPI_RSC_SOURCEX
  102. } ACPI_RSCONVERT_OPCODES;
  103. /* Resource Conversion sub-opcodes */
  104. #define ACPI_RSC_COMPARE_AML_LENGTH 0
  105. #define ACPI_RSC_COMPARE_VALUE 1
  106. #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (ACPI_RSCONVERT_INFO))
  107. #define ACPI_RS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE,f)
  108. #define AML_OFFSET(f) (UINT8) ACPI_OFFSET (AML_RESOURCE,f)
  109. /*
  110. * Individual entry for the resource dump tables
  111. */
  112. typedef const struct acpi_rsdump_info
  113. {
  114. UINT8 Opcode;
  115. UINT8 Offset;
  116. char *Name;
  117. const char **Pointer;
  118. } ACPI_RSDUMP_INFO;
  119. /* Values for the Opcode field above */
  120. typedef enum
  121. {
  122. ACPI_RSD_TITLE = 0,
  123. ACPI_RSD_1BITFLAG,
  124. ACPI_RSD_2BITFLAG,
  125. ACPI_RSD_3BITFLAG,
  126. ACPI_RSD_ADDRESS,
  127. ACPI_RSD_DWORDLIST,
  128. ACPI_RSD_LITERAL,
  129. ACPI_RSD_LONGLIST,
  130. ACPI_RSD_SHORTLIST,
  131. ACPI_RSD_SHORTLISTX,
  132. ACPI_RSD_SOURCE,
  133. ACPI_RSD_STRING,
  134. ACPI_RSD_UINT8,
  135. ACPI_RSD_UINT16,
  136. ACPI_RSD_UINT32,
  137. ACPI_RSD_UINT64,
  138. ACPI_RSD_WORDLIST
  139. } ACPI_RSDUMP_OPCODES;
  140. /* restore default alignment */
  141. #pragma pack()
  142. /* Resource tables indexed by internal resource type */
  143. extern const UINT8 AcpiGbl_AmlResourceSizes[];
  144. extern const UINT8 AcpiGbl_AmlResourceSerialBusSizes[];
  145. extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[];
  146. /* Resource tables indexed by raw AML resource descriptor type */
  147. extern const UINT8 AcpiGbl_ResourceStructSizes[];
  148. extern const UINT8 AcpiGbl_ResourceStructSerialBusSizes[];
  149. extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[];
  150. extern ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[];
  151. typedef struct acpi_vendor_walk_info
  152. {
  153. ACPI_VENDOR_UUID *Uuid;
  154. ACPI_BUFFER *Buffer;
  155. ACPI_STATUS Status;
  156. } ACPI_VENDOR_WALK_INFO;
  157. /*
  158. * rscreate
  159. */
  160. ACPI_STATUS
  161. AcpiRsCreateResourceList (
  162. ACPI_OPERAND_OBJECT *AmlBuffer,
  163. ACPI_BUFFER *OutputBuffer);
  164. ACPI_STATUS
  165. AcpiRsCreateAmlResources (
  166. ACPI_BUFFER *ResourceList,
  167. ACPI_BUFFER *OutputBuffer);
  168. ACPI_STATUS
  169. AcpiRsCreatePciRoutingTable (
  170. ACPI_OPERAND_OBJECT *PackageObject,
  171. ACPI_BUFFER *OutputBuffer);
  172. /*
  173. * rsutils
  174. */
  175. ACPI_STATUS
  176. AcpiRsGetPrtMethodData (
  177. ACPI_NAMESPACE_NODE *Node,
  178. ACPI_BUFFER *RetBuffer);
  179. ACPI_STATUS
  180. AcpiRsGetCrsMethodData (
  181. ACPI_NAMESPACE_NODE *Node,
  182. ACPI_BUFFER *RetBuffer);
  183. ACPI_STATUS
  184. AcpiRsGetPrsMethodData (
  185. ACPI_NAMESPACE_NODE *Node,
  186. ACPI_BUFFER *RetBuffer);
  187. ACPI_STATUS
  188. AcpiRsGetMethodData (
  189. ACPI_HANDLE Handle,
  190. char *Path,
  191. ACPI_BUFFER *RetBuffer);
  192. ACPI_STATUS
  193. AcpiRsSetSrsMethodData (
  194. ACPI_NAMESPACE_NODE *Node,
  195. ACPI_BUFFER *RetBuffer);
  196. ACPI_STATUS
  197. AcpiRsGetAeiMethodData (
  198. ACPI_NAMESPACE_NODE *Node,
  199. ACPI_BUFFER *RetBuffer);
  200. /*
  201. * rscalc
  202. */
  203. ACPI_STATUS
  204. AcpiRsGetListLength (
  205. UINT8 *AmlBuffer,
  206. UINT32 AmlBufferLength,
  207. ACPI_SIZE *SizeNeeded);
  208. ACPI_STATUS
  209. AcpiRsGetAmlLength (
  210. ACPI_RESOURCE *ResourceList,
  211. ACPI_SIZE ResourceListSize,
  212. ACPI_SIZE *SizeNeeded);
  213. ACPI_STATUS
  214. AcpiRsGetPciRoutingTableLength (
  215. ACPI_OPERAND_OBJECT *PackageObject,
  216. ACPI_SIZE *BufferSizeNeeded);
  217. ACPI_STATUS
  218. AcpiRsConvertAmlToResources (
  219. UINT8 *Aml,
  220. UINT32 Length,
  221. UINT32 Offset,
  222. UINT8 ResourceIndex,
  223. void **Context);
  224. ACPI_STATUS
  225. AcpiRsConvertResourcesToAml (
  226. ACPI_RESOURCE *Resource,
  227. ACPI_SIZE AmlSizeNeeded,
  228. UINT8 *OutputBuffer);
  229. /*
  230. * rsaddr
  231. */
  232. void
  233. AcpiRsSetAddressCommon (
  234. AML_RESOURCE *Aml,
  235. ACPI_RESOURCE *Resource);
  236. BOOLEAN
  237. AcpiRsGetAddressCommon (
  238. ACPI_RESOURCE *Resource,
  239. AML_RESOURCE *Aml);
  240. /*
  241. * rsmisc
  242. */
  243. ACPI_STATUS
  244. AcpiRsConvertAmlToResource (
  245. ACPI_RESOURCE *Resource,
  246. AML_RESOURCE *Aml,
  247. ACPI_RSCONVERT_INFO *Info);
  248. ACPI_STATUS
  249. AcpiRsConvertResourceToAml (
  250. ACPI_RESOURCE *Resource,
  251. AML_RESOURCE *Aml,
  252. ACPI_RSCONVERT_INFO *Info);
  253. /*
  254. * rsutils
  255. */
  256. void
  257. AcpiRsMoveData (
  258. void *Destination,
  259. void *Source,
  260. UINT16 ItemCount,
  261. UINT8 MoveType);
  262. UINT8
  263. AcpiRsDecodeBitmask (
  264. UINT16 Mask,
  265. UINT8 *List);
  266. UINT16
  267. AcpiRsEncodeBitmask (
  268. UINT8 *List,
  269. UINT8 Count);
  270. ACPI_RS_LENGTH
  271. AcpiRsGetResourceSource (
  272. ACPI_RS_LENGTH ResourceLength,
  273. ACPI_RS_LENGTH MinimumLength,
  274. ACPI_RESOURCE_SOURCE *ResourceSource,
  275. AML_RESOURCE *Aml,
  276. char *StringPtr);
  277. ACPI_RSDESC_SIZE
  278. AcpiRsSetResourceSource (
  279. AML_RESOURCE *Aml,
  280. ACPI_RS_LENGTH MinimumLength,
  281. ACPI_RESOURCE_SOURCE *ResourceSource);
  282. void
  283. AcpiRsSetResourceHeader (
  284. UINT8 DescriptorType,
  285. ACPI_RSDESC_SIZE TotalLength,
  286. AML_RESOURCE *Aml);
  287. void
  288. AcpiRsSetResourceLength (
  289. ACPI_RSDESC_SIZE TotalLength,
  290. AML_RESOURCE *Aml);
  291. /*
  292. * rsdump - Debugger support
  293. */
  294. #ifdef ACPI_DEBUGGER
  295. void
  296. AcpiRsDumpResourceList (
  297. ACPI_RESOURCE *Resource);
  298. void
  299. AcpiRsDumpIrqList (
  300. UINT8 *RouteTable);
  301. #endif
  302. /*
  303. * Resource conversion tables
  304. */
  305. extern ACPI_RSCONVERT_INFO AcpiRsConvertDma[];
  306. extern ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[];
  307. extern ACPI_RSCONVERT_INFO AcpiRsConvertIo[];
  308. extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[];
  309. extern ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[];
  310. extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[];
  311. extern ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[];
  312. extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[];
  313. extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[];
  314. extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[];
  315. extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[];
  316. extern ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[];
  317. extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[];
  318. extern ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[];
  319. extern ACPI_RSCONVERT_INFO AcpiRsConvertGpio[];
  320. extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[];
  321. extern ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[];
  322. extern ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[];
  323. extern ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[];
  324. /* These resources require separate get/set tables */
  325. extern ACPI_RSCONVERT_INFO AcpiRsGetIrq[];
  326. extern ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[];
  327. extern ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[];
  328. extern ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[];
  329. extern ACPI_RSCONVERT_INFO AcpiRsSetIrq[];
  330. extern ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[];
  331. extern ACPI_RSCONVERT_INFO AcpiRsSetVendor[];
  332. #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
  333. /*
  334. * rsinfo
  335. */
  336. extern ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[];
  337. extern ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[];
  338. /*
  339. * rsdumpinfo
  340. */
  341. extern ACPI_RSDUMP_INFO AcpiRsDumpIrq[];
  342. extern ACPI_RSDUMP_INFO AcpiRsDumpPrt[];
  343. extern ACPI_RSDUMP_INFO AcpiRsDumpDma[];
  344. extern ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[];
  345. extern ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[];
  346. extern ACPI_RSDUMP_INFO AcpiRsDumpIo[];
  347. extern ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[];
  348. extern ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[];
  349. extern ACPI_RSDUMP_INFO AcpiRsDumpVendor[];
  350. extern ACPI_RSDUMP_INFO AcpiRsDumpEndTag[];
  351. extern ACPI_RSDUMP_INFO AcpiRsDumpMemory24[];
  352. extern ACPI_RSDUMP_INFO AcpiRsDumpMemory32[];
  353. extern ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[];
  354. extern ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[];
  355. extern ACPI_RSDUMP_INFO AcpiRsDumpAddress16[];
  356. extern ACPI_RSDUMP_INFO AcpiRsDumpAddress32[];
  357. extern ACPI_RSDUMP_INFO AcpiRsDumpAddress64[];
  358. extern ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[];
  359. extern ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[];
  360. extern ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[];
  361. extern ACPI_RSDUMP_INFO AcpiRsDumpGpio[];
  362. extern ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[];
  363. extern ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[];
  364. extern ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[];
  365. extern ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[];
  366. extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[];
  367. extern ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[];
  368. #endif
  369. #endif /* __ACRESRC_H__ */