rsserial.c 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  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.shareable),
  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_clock_input
  91. *
  92. ******************************************************************************/
  93. struct acpi_rsconvert_info acpi_rs_convert_clock_input[8] = {
  94. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_CLOCK_INPUT,
  95. ACPI_RS_SIZE(struct acpi_resource_clock_input),
  96. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_clock_input)},
  97. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_CLOCK_INPUT,
  98. sizeof(struct aml_resource_clock_input),
  99. 0}
  100. ,
  101. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.clock_input.revision_id),
  102. AML_OFFSET(clock_input.revision_id),
  103. 1}
  104. ,
  105. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.clock_input.mode),
  106. AML_OFFSET(clock_input.flags),
  107. 0}
  108. ,
  109. {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.clock_input.scale),
  110. AML_OFFSET(clock_input.flags),
  111. 1}
  112. ,
  113. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.clock_input.frequency_divisor),
  114. AML_OFFSET(clock_input.frequency_divisor),
  115. 2}
  116. ,
  117. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.clock_input.frequency_numerator),
  118. AML_OFFSET(clock_input.frequency_numerator),
  119. 4}
  120. ,
  121. /* Resource Source */
  122. {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.clock_input.resource_source),
  123. 0,
  124. sizeof(struct aml_resource_clock_input)}
  125. ,
  126. };
  127. /*******************************************************************************
  128. *
  129. * acpi_rs_convert_pinfunction
  130. *
  131. ******************************************************************************/
  132. struct acpi_rsconvert_info acpi_rs_convert_pin_function[13] = {
  133. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_FUNCTION,
  134. ACPI_RS_SIZE(struct acpi_resource_pin_function),
  135. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_function)},
  136. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_FUNCTION,
  137. sizeof(struct aml_resource_pin_function),
  138. 0},
  139. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_function.revision_id),
  140. AML_OFFSET(pin_function.revision_id),
  141. 1},
  142. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_function.shareable),
  143. AML_OFFSET(pin_function.flags),
  144. 0},
  145. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_function.pin_config),
  146. AML_OFFSET(pin_function.pin_config),
  147. 1},
  148. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.pin_function.function_number),
  149. AML_OFFSET(pin_function.function_number),
  150. 2},
  151. /* Pin Table */
  152. /*
  153. * It is OK to use GPIO operations here because none of them refer GPIO
  154. * structures directly but instead use offsets given here.
  155. */
  156. {ACPI_RSC_COUNT_GPIO_PIN,
  157. ACPI_RS_OFFSET(data.pin_function.pin_table_length),
  158. AML_OFFSET(pin_function.pin_table_offset),
  159. AML_OFFSET(pin_function.res_source_offset)},
  160. {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_function.pin_table),
  161. AML_OFFSET(pin_function.pin_table_offset),
  162. 0},
  163. /* Resource Source */
  164. {ACPI_RSC_MOVE8,
  165. ACPI_RS_OFFSET(data.pin_function.resource_source.index),
  166. AML_OFFSET(pin_function.res_source_index),
  167. 1},
  168. {ACPI_RSC_COUNT_GPIO_RES,
  169. ACPI_RS_OFFSET(data.pin_function.resource_source.string_length),
  170. AML_OFFSET(pin_function.res_source_offset),
  171. AML_OFFSET(pin_function.vendor_offset)},
  172. {ACPI_RSC_MOVE_GPIO_RES,
  173. ACPI_RS_OFFSET(data.pin_function.resource_source.string_ptr),
  174. AML_OFFSET(pin_function.res_source_offset),
  175. 0},
  176. /* Vendor Data */
  177. {ACPI_RSC_COUNT_GPIO_VEN,
  178. ACPI_RS_OFFSET(data.pin_function.vendor_length),
  179. AML_OFFSET(pin_function.vendor_length),
  180. 1},
  181. {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_function.vendor_data),
  182. AML_OFFSET(pin_function.vendor_offset),
  183. 0},
  184. };
  185. /*******************************************************************************
  186. *
  187. * acpi_rs_convert_csi2_serial_bus
  188. *
  189. ******************************************************************************/
  190. struct acpi_rsconvert_info acpi_rs_convert_csi2_serial_bus[14] = {
  191. { ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
  192. ACPI_RS_SIZE(struct acpi_resource_csi2_serialbus),
  193. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_csi2_serial_bus) },
  194. { ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
  195. sizeof(struct aml_resource_csi2_serialbus),
  196. 0 },
  197. { ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
  198. AML_OFFSET(common_serial_bus.revision_id),
  199. 1 },
  200. { ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.csi2_serial_bus.type),
  201. AML_OFFSET(csi2_serial_bus.type),
  202. 1 },
  203. { ACPI_RSC_1BITFLAG,
  204. ACPI_RS_OFFSET(data.csi2_serial_bus.producer_consumer),
  205. AML_OFFSET(csi2_serial_bus.flags),
  206. 1 },
  207. { ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.csi2_serial_bus.slave_mode),
  208. AML_OFFSET(csi2_serial_bus.flags),
  209. 0 },
  210. { ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.csi2_serial_bus.phy_type),
  211. AML_OFFSET(csi2_serial_bus.type_specific_flags),
  212. 0 },
  213. { ACPI_RSC_6BITFLAG,
  214. ACPI_RS_OFFSET(data.csi2_serial_bus.local_port_instance),
  215. AML_OFFSET(csi2_serial_bus.type_specific_flags),
  216. 2 },
  217. { ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.csi2_serial_bus.type_revision_id),
  218. AML_OFFSET(csi2_serial_bus.type_revision_id),
  219. 1 },
  220. /* Vendor data */
  221. { ACPI_RSC_COUNT_SERIAL_VEN,
  222. ACPI_RS_OFFSET(data.csi2_serial_bus.vendor_length),
  223. AML_OFFSET(csi2_serial_bus.type_data_length),
  224. AML_RESOURCE_CSI2_MIN_DATA_LEN },
  225. { ACPI_RSC_MOVE_SERIAL_VEN,
  226. ACPI_RS_OFFSET(data.csi2_serial_bus.vendor_data),
  227. 0,
  228. sizeof(struct aml_resource_csi2_serialbus) },
  229. /* Resource Source */
  230. { ACPI_RSC_MOVE8,
  231. ACPI_RS_OFFSET(data.csi2_serial_bus.resource_source.index),
  232. AML_OFFSET(csi2_serial_bus.res_source_index),
  233. 1 },
  234. { ACPI_RSC_COUNT_SERIAL_RES,
  235. ACPI_RS_OFFSET(data.csi2_serial_bus.resource_source.string_length),
  236. AML_OFFSET(csi2_serial_bus.type_data_length),
  237. sizeof(struct aml_resource_csi2_serialbus) },
  238. { ACPI_RSC_MOVE_SERIAL_RES,
  239. ACPI_RS_OFFSET(data.csi2_serial_bus.resource_source.string_ptr),
  240. AML_OFFSET(csi2_serial_bus.type_data_length),
  241. sizeof(struct aml_resource_csi2_serialbus) },
  242. };
  243. /*******************************************************************************
  244. *
  245. * acpi_rs_convert_i2c_serial_bus
  246. *
  247. ******************************************************************************/
  248. struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
  249. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
  250. ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
  251. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
  252. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
  253. sizeof(struct aml_resource_i2c_serialbus),
  254. 0},
  255. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
  256. AML_OFFSET(common_serial_bus.revision_id),
  257. 1},
  258. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
  259. AML_OFFSET(common_serial_bus.type),
  260. 1},
  261. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
  262. AML_OFFSET(common_serial_bus.flags),
  263. 0},
  264. {ACPI_RSC_1BITFLAG,
  265. ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
  266. AML_OFFSET(common_serial_bus.flags),
  267. 1},
  268. {ACPI_RSC_1BITFLAG,
  269. ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
  270. AML_OFFSET(common_serial_bus.flags),
  271. 2},
  272. {ACPI_RSC_MOVE8,
  273. ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
  274. AML_OFFSET(common_serial_bus.type_revision_id),
  275. 1},
  276. {ACPI_RSC_MOVE16,
  277. ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
  278. AML_OFFSET(common_serial_bus.type_data_length),
  279. 1},
  280. /* Vendor data */
  281. {ACPI_RSC_COUNT_SERIAL_VEN,
  282. ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
  283. AML_OFFSET(common_serial_bus.type_data_length),
  284. AML_RESOURCE_I2C_MIN_DATA_LEN},
  285. {ACPI_RSC_MOVE_SERIAL_VEN,
  286. ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
  287. 0,
  288. sizeof(struct aml_resource_i2c_serialbus)},
  289. /* Resource Source */
  290. {ACPI_RSC_MOVE8,
  291. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
  292. AML_OFFSET(common_serial_bus.res_source_index),
  293. 1},
  294. {ACPI_RSC_COUNT_SERIAL_RES,
  295. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
  296. AML_OFFSET(common_serial_bus.type_data_length),
  297. sizeof(struct aml_resource_common_serialbus)},
  298. {ACPI_RSC_MOVE_SERIAL_RES,
  299. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
  300. AML_OFFSET(common_serial_bus.type_data_length),
  301. sizeof(struct aml_resource_common_serialbus)},
  302. /* I2C bus type specific */
  303. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode),
  304. AML_OFFSET(i2c_serial_bus.type_specific_flags),
  305. 0},
  306. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed),
  307. AML_OFFSET(i2c_serial_bus.connection_speed),
  308. 1},
  309. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address),
  310. AML_OFFSET(i2c_serial_bus.slave_address),
  311. 1},
  312. };
  313. /*******************************************************************************
  314. *
  315. * acpi_rs_convert_spi_serial_bus
  316. *
  317. ******************************************************************************/
  318. struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
  319. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
  320. ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
  321. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
  322. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
  323. sizeof(struct aml_resource_spi_serialbus),
  324. 0},
  325. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
  326. AML_OFFSET(common_serial_bus.revision_id),
  327. 1},
  328. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
  329. AML_OFFSET(common_serial_bus.type),
  330. 1},
  331. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
  332. AML_OFFSET(common_serial_bus.flags),
  333. 0},
  334. {ACPI_RSC_1BITFLAG,
  335. ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
  336. AML_OFFSET(common_serial_bus.flags),
  337. 1},
  338. {ACPI_RSC_1BITFLAG,
  339. ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
  340. AML_OFFSET(common_serial_bus.flags),
  341. 2},
  342. {ACPI_RSC_MOVE8,
  343. ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
  344. AML_OFFSET(common_serial_bus.type_revision_id),
  345. 1},
  346. {ACPI_RSC_MOVE16,
  347. ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
  348. AML_OFFSET(common_serial_bus.type_data_length),
  349. 1},
  350. /* Vendor data */
  351. {ACPI_RSC_COUNT_SERIAL_VEN,
  352. ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
  353. AML_OFFSET(common_serial_bus.type_data_length),
  354. AML_RESOURCE_SPI_MIN_DATA_LEN},
  355. {ACPI_RSC_MOVE_SERIAL_VEN,
  356. ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
  357. 0,
  358. sizeof(struct aml_resource_spi_serialbus)},
  359. /* Resource Source */
  360. {ACPI_RSC_MOVE8,
  361. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
  362. AML_OFFSET(common_serial_bus.res_source_index),
  363. 1},
  364. {ACPI_RSC_COUNT_SERIAL_RES,
  365. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
  366. AML_OFFSET(common_serial_bus.type_data_length),
  367. sizeof(struct aml_resource_common_serialbus)},
  368. {ACPI_RSC_MOVE_SERIAL_RES,
  369. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
  370. AML_OFFSET(common_serial_bus.type_data_length),
  371. sizeof(struct aml_resource_common_serialbus)},
  372. /* Spi bus type specific */
  373. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode),
  374. AML_OFFSET(spi_serial_bus.type_specific_flags),
  375. 0},
  376. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity),
  377. AML_OFFSET(spi_serial_bus.type_specific_flags),
  378. 1},
  379. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length),
  380. AML_OFFSET(spi_serial_bus.data_bit_length),
  381. 1},
  382. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase),
  383. AML_OFFSET(spi_serial_bus.clock_phase),
  384. 1},
  385. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity),
  386. AML_OFFSET(spi_serial_bus.clock_polarity),
  387. 1},
  388. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection),
  389. AML_OFFSET(spi_serial_bus.device_selection),
  390. 1},
  391. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed),
  392. AML_OFFSET(spi_serial_bus.connection_speed),
  393. 1},
  394. };
  395. /*******************************************************************************
  396. *
  397. * acpi_rs_convert_uart_serial_bus
  398. *
  399. ******************************************************************************/
  400. struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
  401. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
  402. ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
  403. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
  404. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
  405. sizeof(struct aml_resource_uart_serialbus),
  406. 0},
  407. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
  408. AML_OFFSET(common_serial_bus.revision_id),
  409. 1},
  410. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
  411. AML_OFFSET(common_serial_bus.type),
  412. 1},
  413. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
  414. AML_OFFSET(common_serial_bus.flags),
  415. 0},
  416. {ACPI_RSC_1BITFLAG,
  417. ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
  418. AML_OFFSET(common_serial_bus.flags),
  419. 1},
  420. {ACPI_RSC_1BITFLAG,
  421. ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
  422. AML_OFFSET(common_serial_bus.flags),
  423. 2},
  424. {ACPI_RSC_MOVE8,
  425. ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
  426. AML_OFFSET(common_serial_bus.type_revision_id),
  427. 1},
  428. {ACPI_RSC_MOVE16,
  429. ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
  430. AML_OFFSET(common_serial_bus.type_data_length),
  431. 1},
  432. /* Vendor data */
  433. {ACPI_RSC_COUNT_SERIAL_VEN,
  434. ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
  435. AML_OFFSET(common_serial_bus.type_data_length),
  436. AML_RESOURCE_UART_MIN_DATA_LEN},
  437. {ACPI_RSC_MOVE_SERIAL_VEN,
  438. ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
  439. 0,
  440. sizeof(struct aml_resource_uart_serialbus)},
  441. /* Resource Source */
  442. {ACPI_RSC_MOVE8,
  443. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
  444. AML_OFFSET(common_serial_bus.res_source_index),
  445. 1},
  446. {ACPI_RSC_COUNT_SERIAL_RES,
  447. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
  448. AML_OFFSET(common_serial_bus.type_data_length),
  449. sizeof(struct aml_resource_common_serialbus)},
  450. {ACPI_RSC_MOVE_SERIAL_RES,
  451. ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
  452. AML_OFFSET(common_serial_bus.type_data_length),
  453. sizeof(struct aml_resource_common_serialbus)},
  454. /* Uart bus type specific */
  455. {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control),
  456. AML_OFFSET(uart_serial_bus.type_specific_flags),
  457. 0},
  458. {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits),
  459. AML_OFFSET(uart_serial_bus.type_specific_flags),
  460. 2},
  461. {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits),
  462. AML_OFFSET(uart_serial_bus.type_specific_flags),
  463. 4},
  464. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian),
  465. AML_OFFSET(uart_serial_bus.type_specific_flags),
  466. 7},
  467. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity),
  468. AML_OFFSET(uart_serial_bus.parity),
  469. 1},
  470. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled),
  471. AML_OFFSET(uart_serial_bus.lines_enabled),
  472. 1},
  473. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size),
  474. AML_OFFSET(uart_serial_bus.rx_fifo_size),
  475. 1},
  476. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size),
  477. AML_OFFSET(uart_serial_bus.tx_fifo_size),
  478. 1},
  479. {ACPI_RSC_MOVE32,
  480. ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate),
  481. AML_OFFSET(uart_serial_bus.default_baud_rate),
  482. 1},
  483. };
  484. /*******************************************************************************
  485. *
  486. * acpi_rs_convert_pin_config
  487. *
  488. ******************************************************************************/
  489. struct acpi_rsconvert_info acpi_rs_convert_pin_config[14] = {
  490. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_CONFIG,
  491. ACPI_RS_SIZE(struct acpi_resource_pin_config),
  492. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_config)},
  493. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_CONFIG,
  494. sizeof(struct aml_resource_pin_config),
  495. 0},
  496. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.revision_id),
  497. AML_OFFSET(pin_config.revision_id),
  498. 1},
  499. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.shareable),
  500. AML_OFFSET(pin_config.flags),
  501. 0},
  502. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.producer_consumer),
  503. AML_OFFSET(pin_config.flags),
  504. 1},
  505. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.pin_config_type),
  506. AML_OFFSET(pin_config.pin_config_type),
  507. 1},
  508. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.pin_config.pin_config_value),
  509. AML_OFFSET(pin_config.pin_config_value),
  510. 1},
  511. /* Pin Table */
  512. /*
  513. * It is OK to use GPIO operations here because none of them refer GPIO
  514. * structures directly but instead use offsets given here.
  515. */
  516. {ACPI_RSC_COUNT_GPIO_PIN,
  517. ACPI_RS_OFFSET(data.pin_config.pin_table_length),
  518. AML_OFFSET(pin_config.pin_table_offset),
  519. AML_OFFSET(pin_config.res_source_offset)},
  520. {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_config.pin_table),
  521. AML_OFFSET(pin_config.pin_table_offset),
  522. 0},
  523. /* Resource Source */
  524. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.resource_source.index),
  525. AML_OFFSET(pin_config.res_source_index),
  526. 1},
  527. {ACPI_RSC_COUNT_GPIO_RES,
  528. ACPI_RS_OFFSET(data.pin_config.resource_source.string_length),
  529. AML_OFFSET(pin_config.res_source_offset),
  530. AML_OFFSET(pin_config.vendor_offset)},
  531. {ACPI_RSC_MOVE_GPIO_RES,
  532. ACPI_RS_OFFSET(data.pin_config.resource_source.string_ptr),
  533. AML_OFFSET(pin_config.res_source_offset),
  534. 0},
  535. /* Vendor Data */
  536. {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_config.vendor_length),
  537. AML_OFFSET(pin_config.vendor_length),
  538. 1},
  539. {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_config.vendor_data),
  540. AML_OFFSET(pin_config.vendor_offset),
  541. 0},
  542. };
  543. /*******************************************************************************
  544. *
  545. * acpi_rs_convert_pin_group
  546. *
  547. ******************************************************************************/
  548. struct acpi_rsconvert_info acpi_rs_convert_pin_group[10] = {
  549. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP,
  550. ACPI_RS_SIZE(struct acpi_resource_pin_group),
  551. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group)},
  552. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP,
  553. sizeof(struct aml_resource_pin_group),
  554. 0},
  555. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group.revision_id),
  556. AML_OFFSET(pin_group.revision_id),
  557. 1},
  558. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group.producer_consumer),
  559. AML_OFFSET(pin_group.flags),
  560. 0},
  561. /* Pin Table */
  562. /*
  563. * It is OK to use GPIO operations here because none of them refer GPIO
  564. * structures directly but instead use offsets given here.
  565. */
  566. {ACPI_RSC_COUNT_GPIO_PIN,
  567. ACPI_RS_OFFSET(data.pin_group.pin_table_length),
  568. AML_OFFSET(pin_group.pin_table_offset),
  569. AML_OFFSET(pin_group.label_offset)},
  570. {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_group.pin_table),
  571. AML_OFFSET(pin_group.pin_table_offset),
  572. 0},
  573. /* Resource Label */
  574. {ACPI_RSC_COUNT_GPIO_RES,
  575. ACPI_RS_OFFSET(data.pin_group.resource_label.string_length),
  576. AML_OFFSET(pin_group.label_offset),
  577. AML_OFFSET(pin_group.vendor_offset)},
  578. {ACPI_RSC_MOVE_GPIO_RES,
  579. ACPI_RS_OFFSET(data.pin_group.resource_label.string_ptr),
  580. AML_OFFSET(pin_group.label_offset),
  581. 0},
  582. /* Vendor Data */
  583. {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_group.vendor_length),
  584. AML_OFFSET(pin_group.vendor_length),
  585. 1},
  586. {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_group.vendor_data),
  587. AML_OFFSET(pin_group.vendor_offset),
  588. 0},
  589. };
  590. /*******************************************************************************
  591. *
  592. * acpi_rs_convert_pin_group_function
  593. *
  594. ******************************************************************************/
  595. struct acpi_rsconvert_info acpi_rs_convert_pin_group_function[13] = {
  596. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION,
  597. ACPI_RS_SIZE(struct acpi_resource_pin_group_function),
  598. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_function)},
  599. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION,
  600. sizeof(struct aml_resource_pin_group_function),
  601. 0},
  602. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_function.revision_id),
  603. AML_OFFSET(pin_group_function.revision_id),
  604. 1},
  605. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_function.shareable),
  606. AML_OFFSET(pin_group_function.flags),
  607. 0},
  608. {ACPI_RSC_1BITFLAG,
  609. ACPI_RS_OFFSET(data.pin_group_function.producer_consumer),
  610. AML_OFFSET(pin_group_function.flags),
  611. 1},
  612. {ACPI_RSC_MOVE16,
  613. ACPI_RS_OFFSET(data.pin_group_function.function_number),
  614. AML_OFFSET(pin_group_function.function_number),
  615. 1},
  616. /* Resource Source */
  617. {ACPI_RSC_MOVE8,
  618. ACPI_RS_OFFSET(data.pin_group_function.resource_source.index),
  619. AML_OFFSET(pin_group_function.res_source_index),
  620. 1},
  621. {ACPI_RSC_COUNT_GPIO_RES,
  622. ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_length),
  623. AML_OFFSET(pin_group_function.res_source_offset),
  624. AML_OFFSET(pin_group_function.res_source_label_offset)},
  625. {ACPI_RSC_MOVE_GPIO_RES,
  626. ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_ptr),
  627. AML_OFFSET(pin_group_function.res_source_offset),
  628. 0},
  629. /* Resource Source Label */
  630. {ACPI_RSC_COUNT_GPIO_RES,
  631. ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
  632. string_length),
  633. AML_OFFSET(pin_group_function.res_source_label_offset),
  634. AML_OFFSET(pin_group_function.vendor_offset)},
  635. {ACPI_RSC_MOVE_GPIO_RES,
  636. ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
  637. string_ptr),
  638. AML_OFFSET(pin_group_function.res_source_label_offset),
  639. 0},
  640. /* Vendor Data */
  641. {ACPI_RSC_COUNT_GPIO_VEN,
  642. ACPI_RS_OFFSET(data.pin_group_function.vendor_length),
  643. AML_OFFSET(pin_group_function.vendor_length),
  644. 1},
  645. {ACPI_RSC_MOVE_GPIO_RES,
  646. ACPI_RS_OFFSET(data.pin_group_function.vendor_data),
  647. AML_OFFSET(pin_group_function.vendor_offset),
  648. 0},
  649. };
  650. /*******************************************************************************
  651. *
  652. * acpi_rs_convert_pin_group_config
  653. *
  654. ******************************************************************************/
  655. struct acpi_rsconvert_info acpi_rs_convert_pin_group_config[14] = {
  656. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG,
  657. ACPI_RS_SIZE(struct acpi_resource_pin_group_config),
  658. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_config)},
  659. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG,
  660. sizeof(struct aml_resource_pin_group_config),
  661. 0},
  662. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.revision_id),
  663. AML_OFFSET(pin_group_config.revision_id),
  664. 1},
  665. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_config.shareable),
  666. AML_OFFSET(pin_group_config.flags),
  667. 0},
  668. {ACPI_RSC_1BITFLAG,
  669. ACPI_RS_OFFSET(data.pin_group_config.producer_consumer),
  670. AML_OFFSET(pin_group_config.flags),
  671. 1},
  672. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.pin_config_type),
  673. AML_OFFSET(pin_group_config.pin_config_type),
  674. 1},
  675. {ACPI_RSC_MOVE32,
  676. ACPI_RS_OFFSET(data.pin_group_config.pin_config_value),
  677. AML_OFFSET(pin_group_config.pin_config_value),
  678. 1},
  679. /* Resource Source */
  680. {ACPI_RSC_MOVE8,
  681. ACPI_RS_OFFSET(data.pin_group_config.resource_source.index),
  682. AML_OFFSET(pin_group_config.res_source_index),
  683. 1},
  684. {ACPI_RSC_COUNT_GPIO_RES,
  685. ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_length),
  686. AML_OFFSET(pin_group_config.res_source_offset),
  687. AML_OFFSET(pin_group_config.res_source_label_offset)},
  688. {ACPI_RSC_MOVE_GPIO_RES,
  689. ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_ptr),
  690. AML_OFFSET(pin_group_config.res_source_offset),
  691. 0},
  692. /* Resource Source Label */
  693. {ACPI_RSC_COUNT_GPIO_RES,
  694. ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.
  695. string_length),
  696. AML_OFFSET(pin_group_config.res_source_label_offset),
  697. AML_OFFSET(pin_group_config.vendor_offset)},
  698. {ACPI_RSC_MOVE_GPIO_RES,
  699. ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.string_ptr),
  700. AML_OFFSET(pin_group_config.res_source_label_offset),
  701. 0},
  702. /* Vendor Data */
  703. {ACPI_RSC_COUNT_GPIO_VEN,
  704. ACPI_RS_OFFSET(data.pin_group_config.vendor_length),
  705. AML_OFFSET(pin_group_config.vendor_length),
  706. 1},
  707. {ACPI_RSC_MOVE_GPIO_RES,
  708. ACPI_RS_OFFSET(data.pin_group_config.vendor_data),
  709. AML_OFFSET(pin_group_config.vendor_offset),
  710. 0},
  711. };