rsserial.c 24 KB

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