rsserial.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2. /*******************************************************************************
  3. *
  4. * Module Name: rsserial - GPIO/serial_bus resource descriptors
  5. *
  6. ******************************************************************************/
  7. #include <acpi/acpi.h>
  8. #include "accommon.h"
  9. #include "acresrc.h"
  10. #define _COMPONENT ACPI_RESOURCES
  11. ACPI_MODULE_NAME("rsserial")
  12. /*******************************************************************************
  13. *
  14. * acpi_rs_convert_gpio
  15. *
  16. ******************************************************************************/
  17. struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
  18. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO,
  19. ACPI_RS_SIZE(struct acpi_resource_gpio),
  20. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)},
  21. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO,
  22. sizeof(struct aml_resource_gpio),
  23. 0},
  24. /*
  25. * These fields are contiguous in both the source and destination:
  26. * revision_id
  27. * connection_type
  28. */
  29. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.revision_id),
  30. AML_OFFSET(gpio.revision_id),
  31. 2},
  32. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.producer_consumer),
  33. AML_OFFSET(gpio.flags),
  34. 0},
  35. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable),
  36. AML_OFFSET(gpio.int_flags),
  37. 3},
  38. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.wake_capable),
  39. AML_OFFSET(gpio.int_flags),
  40. 4},
  41. {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction),
  42. AML_OFFSET(gpio.int_flags),
  43. 0},
  44. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.triggering),
  45. AML_OFFSET(gpio.int_flags),
  46. 0},
  47. {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.polarity),
  48. AML_OFFSET(gpio.int_flags),
  49. 1},
  50. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.pin_config),
  51. AML_OFFSET(gpio.pin_config),
  52. 1},
  53. /*
  54. * These fields are contiguous in both the source and destination:
  55. * drive_strength
  56. * debounce_timeout
  57. */
  58. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.gpio.drive_strength),
  59. AML_OFFSET(gpio.drive_strength),
  60. 2},
  61. /* Pin Table */
  62. {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table_length),
  63. AML_OFFSET(gpio.pin_table_offset),
  64. AML_OFFSET(gpio.res_source_offset)},
  65. {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table),
  66. AML_OFFSET(gpio.pin_table_offset),
  67. 0},
  68. /* Resource Source */
  69. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.resource_source.index),
  70. AML_OFFSET(gpio.res_source_index),
  71. 1},
  72. {ACPI_RSC_COUNT_GPIO_RES,
  73. ACPI_RS_OFFSET(data.gpio.resource_source.string_length),
  74. AML_OFFSET(gpio.res_source_offset),
  75. AML_OFFSET(gpio.vendor_offset)},
  76. {ACPI_RSC_MOVE_GPIO_RES,
  77. ACPI_RS_OFFSET(data.gpio.resource_source.string_ptr),
  78. AML_OFFSET(gpio.res_source_offset),
  79. 0},
  80. /* Vendor Data */
  81. {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.gpio.vendor_length),
  82. AML_OFFSET(gpio.vendor_length),
  83. 1},
  84. {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.gpio.vendor_data),
  85. AML_OFFSET(gpio.vendor_offset),
  86. 0},
  87. };
  88. /*******************************************************************************
  89. *
  90. * acpi_rs_convert_pinfunction
  91. *
  92. ******************************************************************************/
  93. struct acpi_rsconvert_info acpi_rs_convert_pin_function[13] = {
  94. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_FUNCTION,
  95. ACPI_RS_SIZE(struct acpi_resource_pin_function),
  96. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_function)},
  97. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_FUNCTION,
  98. sizeof(struct aml_resource_pin_function),
  99. 0},
  100. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_function.revision_id),
  101. AML_OFFSET(pin_function.revision_id),
  102. 1},
  103. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_function.sharable),
  104. AML_OFFSET(pin_function.flags),
  105. 0},
  106. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_function.pin_config),
  107. AML_OFFSET(pin_function.pin_config),
  108. 1},
  109. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.pin_function.function_number),
  110. AML_OFFSET(pin_function.function_number),
  111. 2},
  112. /* Pin Table */
  113. /*
  114. * It is OK to use GPIO operations here because none of them refer GPIO
  115. * structures directly but instead use offsets given here.
  116. */
  117. {ACPI_RSC_COUNT_GPIO_PIN,
  118. ACPI_RS_OFFSET(data.pin_function.pin_table_length),
  119. AML_OFFSET(pin_function.pin_table_offset),
  120. AML_OFFSET(pin_function.res_source_offset)},
  121. {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_function.pin_table),
  122. AML_OFFSET(pin_function.pin_table_offset),
  123. 0},
  124. /* Resource Source */
  125. {ACPI_RSC_MOVE8,
  126. ACPI_RS_OFFSET(data.pin_function.resource_source.index),
  127. AML_OFFSET(pin_function.res_source_index),
  128. 1},
  129. {ACPI_RSC_COUNT_GPIO_RES,
  130. ACPI_RS_OFFSET(data.pin_function.resource_source.string_length),
  131. AML_OFFSET(pin_function.res_source_offset),
  132. AML_OFFSET(pin_function.vendor_offset)},
  133. {ACPI_RSC_MOVE_GPIO_RES,
  134. ACPI_RS_OFFSET(data.pin_function.resource_source.string_ptr),
  135. AML_OFFSET(pin_function.res_source_offset),
  136. 0},
  137. /* Vendor Data */
  138. {ACPI_RSC_COUNT_GPIO_VEN,
  139. ACPI_RS_OFFSET(data.pin_function.vendor_length),
  140. AML_OFFSET(pin_function.vendor_length),
  141. 1},
  142. {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_function.vendor_data),
  143. AML_OFFSET(pin_function.vendor_offset),
  144. 0},
  145. };
  146. /*******************************************************************************
  147. *
  148. * acpi_rs_convert_i2c_serial_bus
  149. *
  150. ******************************************************************************/
  151. struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
  152. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
  153. ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
  154. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
  155. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
  156. sizeof(struct aml_resource_i2c_serialbus),
  157. 0},
  158. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
  159. AML_OFFSET(common_serial_bus.revision_id),
  160. 1},
  161. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
  162. AML_OFFSET(common_serial_bus.type),
  163. 1},
  164. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
  165. AML_OFFSET(common_serial_bus.flags),
  166. 0},
  167. {ACPI_RSC_1BITFLAG,
  168. ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
  169. AML_OFFSET(common_serial_bus.flags),
  170. 1},
  171. {ACPI_RSC_1BITFLAG,
  172. ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
  173. AML_OFFSET(common_serial_bus.flags),
  174. 2},
  175. {ACPI_RSC_MOVE8,
  176. ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
  177. AML_OFFSET(common_serial_bus.type_revision_id),
  178. 1},
  179. {ACPI_RSC_MOVE16,
  180. ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
  181. AML_OFFSET(common_serial_bus.type_data_length),
  182. 1},
  183. /* Vendor data */
  184. {ACPI_RSC_COUNT_SERIAL_VEN,
  185. ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
  186. AML_OFFSET(common_serial_bus.type_data_length),
  187. AML_RESOURCE_I2C_MIN_DATA_LEN},
  188. {ACPI_RSC_MOVE_SERIAL_VEN,
  189. ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
  190. 0,
  191. sizeof(struct aml_resource_i2c_serialbus)},
  192. /* Resource Source */
  193. {ACPI_RSC_MOVE8,
  194. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
  195. AML_OFFSET(common_serial_bus.res_source_index),
  196. 1},
  197. {ACPI_RSC_COUNT_SERIAL_RES,
  198. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
  199. AML_OFFSET(common_serial_bus.type_data_length),
  200. sizeof(struct aml_resource_common_serialbus)},
  201. {ACPI_RSC_MOVE_SERIAL_RES,
  202. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
  203. AML_OFFSET(common_serial_bus.type_data_length),
  204. sizeof(struct aml_resource_common_serialbus)},
  205. /* I2C bus type specific */
  206. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode),
  207. AML_OFFSET(i2c_serial_bus.type_specific_flags),
  208. 0},
  209. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed),
  210. AML_OFFSET(i2c_serial_bus.connection_speed),
  211. 1},
  212. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address),
  213. AML_OFFSET(i2c_serial_bus.slave_address),
  214. 1},
  215. };
  216. /*******************************************************************************
  217. *
  218. * acpi_rs_convert_spi_serial_bus
  219. *
  220. ******************************************************************************/
  221. struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
  222. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
  223. ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
  224. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
  225. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
  226. sizeof(struct aml_resource_spi_serialbus),
  227. 0},
  228. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
  229. AML_OFFSET(common_serial_bus.revision_id),
  230. 1},
  231. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
  232. AML_OFFSET(common_serial_bus.type),
  233. 1},
  234. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
  235. AML_OFFSET(common_serial_bus.flags),
  236. 0},
  237. {ACPI_RSC_1BITFLAG,
  238. ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
  239. AML_OFFSET(common_serial_bus.flags),
  240. 1},
  241. {ACPI_RSC_1BITFLAG,
  242. ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
  243. AML_OFFSET(common_serial_bus.flags),
  244. 2},
  245. {ACPI_RSC_MOVE8,
  246. ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
  247. AML_OFFSET(common_serial_bus.type_revision_id),
  248. 1},
  249. {ACPI_RSC_MOVE16,
  250. ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
  251. AML_OFFSET(common_serial_bus.type_data_length),
  252. 1},
  253. /* Vendor data */
  254. {ACPI_RSC_COUNT_SERIAL_VEN,
  255. ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
  256. AML_OFFSET(common_serial_bus.type_data_length),
  257. AML_RESOURCE_SPI_MIN_DATA_LEN},
  258. {ACPI_RSC_MOVE_SERIAL_VEN,
  259. ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
  260. 0,
  261. sizeof(struct aml_resource_spi_serialbus)},
  262. /* Resource Source */
  263. {ACPI_RSC_MOVE8,
  264. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
  265. AML_OFFSET(common_serial_bus.res_source_index),
  266. 1},
  267. {ACPI_RSC_COUNT_SERIAL_RES,
  268. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
  269. AML_OFFSET(common_serial_bus.type_data_length),
  270. sizeof(struct aml_resource_common_serialbus)},
  271. {ACPI_RSC_MOVE_SERIAL_RES,
  272. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
  273. AML_OFFSET(common_serial_bus.type_data_length),
  274. sizeof(struct aml_resource_common_serialbus)},
  275. /* Spi bus type specific */
  276. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode),
  277. AML_OFFSET(spi_serial_bus.type_specific_flags),
  278. 0},
  279. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity),
  280. AML_OFFSET(spi_serial_bus.type_specific_flags),
  281. 1},
  282. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length),
  283. AML_OFFSET(spi_serial_bus.data_bit_length),
  284. 1},
  285. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase),
  286. AML_OFFSET(spi_serial_bus.clock_phase),
  287. 1},
  288. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity),
  289. AML_OFFSET(spi_serial_bus.clock_polarity),
  290. 1},
  291. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection),
  292. AML_OFFSET(spi_serial_bus.device_selection),
  293. 1},
  294. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed),
  295. AML_OFFSET(spi_serial_bus.connection_speed),
  296. 1},
  297. };
  298. /*******************************************************************************
  299. *
  300. * acpi_rs_convert_uart_serial_bus
  301. *
  302. ******************************************************************************/
  303. struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
  304. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
  305. ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
  306. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
  307. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
  308. sizeof(struct aml_resource_uart_serialbus),
  309. 0},
  310. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
  311. AML_OFFSET(common_serial_bus.revision_id),
  312. 1},
  313. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
  314. AML_OFFSET(common_serial_bus.type),
  315. 1},
  316. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
  317. AML_OFFSET(common_serial_bus.flags),
  318. 0},
  319. {ACPI_RSC_1BITFLAG,
  320. ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
  321. AML_OFFSET(common_serial_bus.flags),
  322. 1},
  323. {ACPI_RSC_1BITFLAG,
  324. ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
  325. AML_OFFSET(common_serial_bus.flags),
  326. 2},
  327. {ACPI_RSC_MOVE8,
  328. ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
  329. AML_OFFSET(common_serial_bus.type_revision_id),
  330. 1},
  331. {ACPI_RSC_MOVE16,
  332. ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
  333. AML_OFFSET(common_serial_bus.type_data_length),
  334. 1},
  335. /* Vendor data */
  336. {ACPI_RSC_COUNT_SERIAL_VEN,
  337. ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
  338. AML_OFFSET(common_serial_bus.type_data_length),
  339. AML_RESOURCE_UART_MIN_DATA_LEN},
  340. {ACPI_RSC_MOVE_SERIAL_VEN,
  341. ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
  342. 0,
  343. sizeof(struct aml_resource_uart_serialbus)},
  344. /* Resource Source */
  345. {ACPI_RSC_MOVE8,
  346. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
  347. AML_OFFSET(common_serial_bus.res_source_index),
  348. 1},
  349. {ACPI_RSC_COUNT_SERIAL_RES,
  350. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
  351. AML_OFFSET(common_serial_bus.type_data_length),
  352. sizeof(struct aml_resource_common_serialbus)},
  353. {ACPI_RSC_MOVE_SERIAL_RES,
  354. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
  355. AML_OFFSET(common_serial_bus.type_data_length),
  356. sizeof(struct aml_resource_common_serialbus)},
  357. /* Uart bus type specific */
  358. {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control),
  359. AML_OFFSET(uart_serial_bus.type_specific_flags),
  360. 0},
  361. {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits),
  362. AML_OFFSET(uart_serial_bus.type_specific_flags),
  363. 2},
  364. {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits),
  365. AML_OFFSET(uart_serial_bus.type_specific_flags),
  366. 4},
  367. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian),
  368. AML_OFFSET(uart_serial_bus.type_specific_flags),
  369. 7},
  370. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity),
  371. AML_OFFSET(uart_serial_bus.parity),
  372. 1},
  373. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled),
  374. AML_OFFSET(uart_serial_bus.lines_enabled),
  375. 1},
  376. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size),
  377. AML_OFFSET(uart_serial_bus.rx_fifo_size),
  378. 1},
  379. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size),
  380. AML_OFFSET(uart_serial_bus.tx_fifo_size),
  381. 1},
  382. {ACPI_RSC_MOVE32,
  383. ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate),
  384. AML_OFFSET(uart_serial_bus.default_baud_rate),
  385. 1},
  386. };
  387. /*******************************************************************************
  388. *
  389. * acpi_rs_convert_pin_config
  390. *
  391. ******************************************************************************/
  392. struct acpi_rsconvert_info acpi_rs_convert_pin_config[14] = {
  393. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_CONFIG,
  394. ACPI_RS_SIZE(struct acpi_resource_pin_config),
  395. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_config)},
  396. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_CONFIG,
  397. sizeof(struct aml_resource_pin_config),
  398. 0},
  399. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.revision_id),
  400. AML_OFFSET(pin_config.revision_id),
  401. 1},
  402. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.sharable),
  403. AML_OFFSET(pin_config.flags),
  404. 0},
  405. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.producer_consumer),
  406. AML_OFFSET(pin_config.flags),
  407. 1},
  408. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.pin_config_type),
  409. AML_OFFSET(pin_config.pin_config_type),
  410. 1},
  411. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.pin_config.pin_config_value),
  412. AML_OFFSET(pin_config.pin_config_value),
  413. 1},
  414. /* Pin Table */
  415. /*
  416. * It is OK to use GPIO operations here because none of them refer GPIO
  417. * structures directly but instead use offsets given here.
  418. */
  419. {ACPI_RSC_COUNT_GPIO_PIN,
  420. ACPI_RS_OFFSET(data.pin_config.pin_table_length),
  421. AML_OFFSET(pin_config.pin_table_offset),
  422. AML_OFFSET(pin_config.res_source_offset)},
  423. {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_config.pin_table),
  424. AML_OFFSET(pin_config.pin_table_offset),
  425. 0},
  426. /* Resource Source */
  427. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.resource_source.index),
  428. AML_OFFSET(pin_config.res_source_index),
  429. 1},
  430. {ACPI_RSC_COUNT_GPIO_RES,
  431. ACPI_RS_OFFSET(data.pin_config.resource_source.string_length),
  432. AML_OFFSET(pin_config.res_source_offset),
  433. AML_OFFSET(pin_config.vendor_offset)},
  434. {ACPI_RSC_MOVE_GPIO_RES,
  435. ACPI_RS_OFFSET(data.pin_config.resource_source.string_ptr),
  436. AML_OFFSET(pin_config.res_source_offset),
  437. 0},
  438. /* Vendor Data */
  439. {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_config.vendor_length),
  440. AML_OFFSET(pin_config.vendor_length),
  441. 1},
  442. {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_config.vendor_data),
  443. AML_OFFSET(pin_config.vendor_offset),
  444. 0},
  445. };
  446. /*******************************************************************************
  447. *
  448. * acpi_rs_convert_pin_group
  449. *
  450. ******************************************************************************/
  451. struct acpi_rsconvert_info acpi_rs_convert_pin_group[10] = {
  452. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP,
  453. ACPI_RS_SIZE(struct acpi_resource_pin_group),
  454. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group)},
  455. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP,
  456. sizeof(struct aml_resource_pin_group),
  457. 0},
  458. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group.revision_id),
  459. AML_OFFSET(pin_group.revision_id),
  460. 1},
  461. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group.producer_consumer),
  462. AML_OFFSET(pin_group.flags),
  463. 0},
  464. /* Pin Table */
  465. /*
  466. * It is OK to use GPIO operations here because none of them refer GPIO
  467. * structures directly but instead use offsets given here.
  468. */
  469. {ACPI_RSC_COUNT_GPIO_PIN,
  470. ACPI_RS_OFFSET(data.pin_group.pin_table_length),
  471. AML_OFFSET(pin_group.pin_table_offset),
  472. AML_OFFSET(pin_group.label_offset)},
  473. {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_group.pin_table),
  474. AML_OFFSET(pin_group.pin_table_offset),
  475. 0},
  476. /* Resource Label */
  477. {ACPI_RSC_COUNT_GPIO_RES,
  478. ACPI_RS_OFFSET(data.pin_group.resource_label.string_length),
  479. AML_OFFSET(pin_group.label_offset),
  480. AML_OFFSET(pin_group.vendor_offset)},
  481. {ACPI_RSC_MOVE_GPIO_RES,
  482. ACPI_RS_OFFSET(data.pin_group.resource_label.string_ptr),
  483. AML_OFFSET(pin_group.label_offset),
  484. 0},
  485. /* Vendor Data */
  486. {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_group.vendor_length),
  487. AML_OFFSET(pin_group.vendor_length),
  488. 1},
  489. {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_group.vendor_data),
  490. AML_OFFSET(pin_group.vendor_offset),
  491. 0},
  492. };
  493. /*******************************************************************************
  494. *
  495. * acpi_rs_convert_pin_group_function
  496. *
  497. ******************************************************************************/
  498. struct acpi_rsconvert_info acpi_rs_convert_pin_group_function[13] = {
  499. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION,
  500. ACPI_RS_SIZE(struct acpi_resource_pin_group_function),
  501. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_function)},
  502. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION,
  503. sizeof(struct aml_resource_pin_group_function),
  504. 0},
  505. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_function.revision_id),
  506. AML_OFFSET(pin_group_function.revision_id),
  507. 1},
  508. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_function.sharable),
  509. AML_OFFSET(pin_group_function.flags),
  510. 0},
  511. {ACPI_RSC_1BITFLAG,
  512. ACPI_RS_OFFSET(data.pin_group_function.producer_consumer),
  513. AML_OFFSET(pin_group_function.flags),
  514. 1},
  515. {ACPI_RSC_MOVE16,
  516. ACPI_RS_OFFSET(data.pin_group_function.function_number),
  517. AML_OFFSET(pin_group_function.function_number),
  518. 1},
  519. /* Resource Source */
  520. {ACPI_RSC_MOVE8,
  521. ACPI_RS_OFFSET(data.pin_group_function.resource_source.index),
  522. AML_OFFSET(pin_group_function.res_source_index),
  523. 1},
  524. {ACPI_RSC_COUNT_GPIO_RES,
  525. ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_length),
  526. AML_OFFSET(pin_group_function.res_source_offset),
  527. AML_OFFSET(pin_group_function.res_source_label_offset)},
  528. {ACPI_RSC_MOVE_GPIO_RES,
  529. ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_ptr),
  530. AML_OFFSET(pin_group_function.res_source_offset),
  531. 0},
  532. /* Resource Source Label */
  533. {ACPI_RSC_COUNT_GPIO_RES,
  534. ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
  535. string_length),
  536. AML_OFFSET(pin_group_function.res_source_label_offset),
  537. AML_OFFSET(pin_group_function.vendor_offset)},
  538. {ACPI_RSC_MOVE_GPIO_RES,
  539. ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
  540. string_ptr),
  541. AML_OFFSET(pin_group_function.res_source_label_offset),
  542. 0},
  543. /* Vendor Data */
  544. {ACPI_RSC_COUNT_GPIO_VEN,
  545. ACPI_RS_OFFSET(data.pin_group_function.vendor_length),
  546. AML_OFFSET(pin_group_function.vendor_length),
  547. 1},
  548. {ACPI_RSC_MOVE_GPIO_RES,
  549. ACPI_RS_OFFSET(data.pin_group_function.vendor_data),
  550. AML_OFFSET(pin_group_function.vendor_offset),
  551. 0},
  552. };
  553. /*******************************************************************************
  554. *
  555. * acpi_rs_convert_pin_group_config
  556. *
  557. ******************************************************************************/
  558. struct acpi_rsconvert_info acpi_rs_convert_pin_group_config[14] = {
  559. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG,
  560. ACPI_RS_SIZE(struct acpi_resource_pin_group_config),
  561. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_config)},
  562. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG,
  563. sizeof(struct aml_resource_pin_group_config),
  564. 0},
  565. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.revision_id),
  566. AML_OFFSET(pin_group_config.revision_id),
  567. 1},
  568. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_config.sharable),
  569. AML_OFFSET(pin_group_config.flags),
  570. 0},
  571. {ACPI_RSC_1BITFLAG,
  572. ACPI_RS_OFFSET(data.pin_group_config.producer_consumer),
  573. AML_OFFSET(pin_group_config.flags),
  574. 1},
  575. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.pin_config_type),
  576. AML_OFFSET(pin_group_config.pin_config_type),
  577. 1},
  578. {ACPI_RSC_MOVE32,
  579. ACPI_RS_OFFSET(data.pin_group_config.pin_config_value),
  580. AML_OFFSET(pin_group_config.pin_config_value),
  581. 1},
  582. /* Resource Source */
  583. {ACPI_RSC_MOVE8,
  584. ACPI_RS_OFFSET(data.pin_group_config.resource_source.index),
  585. AML_OFFSET(pin_group_config.res_source_index),
  586. 1},
  587. {ACPI_RSC_COUNT_GPIO_RES,
  588. ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_length),
  589. AML_OFFSET(pin_group_config.res_source_offset),
  590. AML_OFFSET(pin_group_config.res_source_label_offset)},
  591. {ACPI_RSC_MOVE_GPIO_RES,
  592. ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_ptr),
  593. AML_OFFSET(pin_group_config.res_source_offset),
  594. 0},
  595. /* Resource Source Label */
  596. {ACPI_RSC_COUNT_GPIO_RES,
  597. ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.
  598. string_length),
  599. AML_OFFSET(pin_group_config.res_source_label_offset),
  600. AML_OFFSET(pin_group_config.vendor_offset)},
  601. {ACPI_RSC_MOVE_GPIO_RES,
  602. ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.string_ptr),
  603. AML_OFFSET(pin_group_config.res_source_label_offset),
  604. 0},
  605. /* Vendor Data */
  606. {ACPI_RSC_COUNT_GPIO_VEN,
  607. ACPI_RS_OFFSET(data.pin_group_config.vendor_length),
  608. AML_OFFSET(pin_group_config.vendor_length),
  609. 1},
  610. {ACPI_RSC_MOVE_GPIO_RES,
  611. ACPI_RS_OFFSET(data.pin_group_config.vendor_data),
  612. AML_OFFSET(pin_group_config.vendor_offset),
  613. 0},
  614. };