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 
8 #include <acpi/acpi.h>
9 #include "accommon.h"
10 #include "acresrc.h"
11 
12 #define _COMPONENT          ACPI_RESOURCES
13 ACPI_MODULE_NAME("rsserial")
14 
15 /*******************************************************************************
16  *
17  * acpi_rs_convert_gpio
18  *
19  ******************************************************************************/
20 struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
21 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO,
22 	 ACPI_RS_SIZE(struct acpi_resource_gpio),
23 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)},
24 
25 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO,
26 	 sizeof(struct aml_resource_gpio),
27 	 0},
28 
29 	/*
30 	 * These fields are contiguous in both the source and destination:
31 	 * revision_id
32 	 * connection_type
33 	 */
34 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.revision_id),
35 	 AML_OFFSET(gpio.revision_id),
36 	 2},
37 
38 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.producer_consumer),
39 	 AML_OFFSET(gpio.flags),
40 	 0},
41 
42 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.shareable),
43 	 AML_OFFSET(gpio.int_flags),
44 	 3},
45 
46 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.wake_capable),
47 	 AML_OFFSET(gpio.int_flags),
48 	 4},
49 
50 	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction),
51 	 AML_OFFSET(gpio.int_flags),
52 	 0},
53 
54 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.triggering),
55 	 AML_OFFSET(gpio.int_flags),
56 	 0},
57 
58 	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.polarity),
59 	 AML_OFFSET(gpio.int_flags),
60 	 1},
61 
62 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.pin_config),
63 	 AML_OFFSET(gpio.pin_config),
64 	 1},
65 
66 	/*
67 	 * These fields are contiguous in both the source and destination:
68 	 * drive_strength
69 	 * debounce_timeout
70 	 */
71 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.gpio.drive_strength),
72 	 AML_OFFSET(gpio.drive_strength),
73 	 2},
74 
75 	/* Pin Table */
76 
77 	{ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table_length),
78 	 AML_OFFSET(gpio.pin_table_offset),
79 	 AML_OFFSET(gpio.res_source_offset)},
80 
81 	{ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table),
82 	 AML_OFFSET(gpio.pin_table_offset),
83 	 0},
84 
85 	/* Resource Source */
86 
87 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.resource_source.index),
88 	 AML_OFFSET(gpio.res_source_index),
89 	 1},
90 
91 	{ACPI_RSC_COUNT_GPIO_RES,
92 	 ACPI_RS_OFFSET(data.gpio.resource_source.string_length),
93 	 AML_OFFSET(gpio.res_source_offset),
94 	 AML_OFFSET(gpio.vendor_offset)},
95 
96 	{ACPI_RSC_MOVE_GPIO_RES,
97 	 ACPI_RS_OFFSET(data.gpio.resource_source.string_ptr),
98 	 AML_OFFSET(gpio.res_source_offset),
99 	 0},
100 
101 	/* Vendor Data */
102 
103 	{ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.gpio.vendor_length),
104 	 AML_OFFSET(gpio.vendor_length),
105 	 1},
106 
107 	{ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.gpio.vendor_data),
108 	 AML_OFFSET(gpio.vendor_offset),
109 	 0},
110 };
111 
112 /*******************************************************************************
113  *
114  * acpi_rs_convert_pinfunction
115  *
116  ******************************************************************************/
117 
118 struct acpi_rsconvert_info acpi_rs_convert_pin_function[13] = {
119 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_FUNCTION,
120 	 ACPI_RS_SIZE(struct acpi_resource_pin_function),
121 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_function)},
122 
123 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_FUNCTION,
124 	 sizeof(struct aml_resource_pin_function),
125 	 0},
126 
127 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_function.revision_id),
128 	 AML_OFFSET(pin_function.revision_id),
129 	 1},
130 
131 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_function.shareable),
132 	 AML_OFFSET(pin_function.flags),
133 	 0},
134 
135 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_function.pin_config),
136 	 AML_OFFSET(pin_function.pin_config),
137 	 1},
138 
139 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.pin_function.function_number),
140 	 AML_OFFSET(pin_function.function_number),
141 	 2},
142 
143 	/* Pin Table */
144 
145 	/*
146 	 * It is OK to use GPIO operations here because none of them refer GPIO
147 	 * structures directly but instead use offsets given here.
148 	 */
149 
150 	{ACPI_RSC_COUNT_GPIO_PIN,
151 	 ACPI_RS_OFFSET(data.pin_function.pin_table_length),
152 	 AML_OFFSET(pin_function.pin_table_offset),
153 	 AML_OFFSET(pin_function.res_source_offset)},
154 
155 	{ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_function.pin_table),
156 	 AML_OFFSET(pin_function.pin_table_offset),
157 	 0},
158 
159 	/* Resource Source */
160 
161 	{ACPI_RSC_MOVE8,
162 	 ACPI_RS_OFFSET(data.pin_function.resource_source.index),
163 	 AML_OFFSET(pin_function.res_source_index),
164 	 1},
165 
166 	{ACPI_RSC_COUNT_GPIO_RES,
167 	 ACPI_RS_OFFSET(data.pin_function.resource_source.string_length),
168 	 AML_OFFSET(pin_function.res_source_offset),
169 	 AML_OFFSET(pin_function.vendor_offset)},
170 
171 	{ACPI_RSC_MOVE_GPIO_RES,
172 	 ACPI_RS_OFFSET(data.pin_function.resource_source.string_ptr),
173 	 AML_OFFSET(pin_function.res_source_offset),
174 	 0},
175 
176 	/* Vendor Data */
177 
178 	{ACPI_RSC_COUNT_GPIO_VEN,
179 	 ACPI_RS_OFFSET(data.pin_function.vendor_length),
180 	 AML_OFFSET(pin_function.vendor_length),
181 	 1},
182 
183 	{ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_function.vendor_data),
184 	 AML_OFFSET(pin_function.vendor_offset),
185 	 0},
186 };
187 
188 /*******************************************************************************
189  *
190  * acpi_rs_convert_csi2_serial_bus
191  *
192  ******************************************************************************/
193 
194 struct acpi_rsconvert_info acpi_rs_convert_csi2_serial_bus[14] = {
195 	{ ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
196 	 ACPI_RS_SIZE(struct acpi_resource_csi2_serialbus),
197 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_csi2_serial_bus) },
198 
199 	{ ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
200 	 sizeof(struct aml_resource_csi2_serialbus),
201 	 0 },
202 
203 	{ ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
204 	 AML_OFFSET(common_serial_bus.revision_id),
205 	 1 },
206 
207 	{ ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.csi2_serial_bus.type),
208 	 AML_OFFSET(csi2_serial_bus.type),
209 	 1 },
210 
211 	{ ACPI_RSC_1BITFLAG,
212 	 ACPI_RS_OFFSET(data.csi2_serial_bus.producer_consumer),
213 	 AML_OFFSET(csi2_serial_bus.flags),
214 	 1 },
215 
216 	{ ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.csi2_serial_bus.slave_mode),
217 	 AML_OFFSET(csi2_serial_bus.flags),
218 	 0 },
219 
220 	{ ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.csi2_serial_bus.phy_type),
221 	 AML_OFFSET(csi2_serial_bus.type_specific_flags),
222 	 0 },
223 
224 	{ ACPI_RSC_6BITFLAG,
225 	 ACPI_RS_OFFSET(data.csi2_serial_bus.local_port_instance),
226 	 AML_OFFSET(csi2_serial_bus.type_specific_flags),
227 	 2 },
228 
229 	{ ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.csi2_serial_bus.type_revision_id),
230 	 AML_OFFSET(csi2_serial_bus.type_revision_id),
231 	 1 },
232 
233 	/* Vendor data */
234 
235 	{ ACPI_RSC_COUNT_SERIAL_VEN,
236 	 ACPI_RS_OFFSET(data.csi2_serial_bus.vendor_length),
237 	 AML_OFFSET(csi2_serial_bus.type_data_length),
238 	 AML_RESOURCE_CSI2_MIN_DATA_LEN },
239 
240 	{ ACPI_RSC_MOVE_SERIAL_VEN,
241 	 ACPI_RS_OFFSET(data.csi2_serial_bus.vendor_data),
242 	 0,
243 	 sizeof(struct aml_resource_csi2_serialbus) },
244 
245 	/* Resource Source */
246 
247 	{ ACPI_RSC_MOVE8,
248 	 ACPI_RS_OFFSET(data.csi2_serial_bus.resource_source.index),
249 	 AML_OFFSET(csi2_serial_bus.res_source_index),
250 	 1 },
251 
252 	{ ACPI_RSC_COUNT_SERIAL_RES,
253 	 ACPI_RS_OFFSET(data.csi2_serial_bus.resource_source.string_length),
254 	 AML_OFFSET(csi2_serial_bus.type_data_length),
255 	 sizeof(struct aml_resource_csi2_serialbus) },
256 
257 	{ ACPI_RSC_MOVE_SERIAL_RES,
258 	 ACPI_RS_OFFSET(data.csi2_serial_bus.resource_source.string_ptr),
259 	 AML_OFFSET(csi2_serial_bus.type_data_length),
260 	 sizeof(struct aml_resource_csi2_serialbus) },
261 };
262 
263 /*******************************************************************************
264  *
265  * acpi_rs_convert_i2c_serial_bus
266  *
267  ******************************************************************************/
268 
269 struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
270 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
271 	 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
272 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
273 
274 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
275 	 sizeof(struct aml_resource_i2c_serialbus),
276 	 0},
277 
278 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
279 	 AML_OFFSET(common_serial_bus.revision_id),
280 	 1},
281 
282 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
283 	 AML_OFFSET(common_serial_bus.type),
284 	 1},
285 
286 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
287 	 AML_OFFSET(common_serial_bus.flags),
288 	 0},
289 
290 	{ACPI_RSC_1BITFLAG,
291 	 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
292 	 AML_OFFSET(common_serial_bus.flags),
293 	 1},
294 
295 	{ACPI_RSC_1BITFLAG,
296 	 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
297 	 AML_OFFSET(common_serial_bus.flags),
298 	 2},
299 
300 	{ACPI_RSC_MOVE8,
301 	 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
302 	 AML_OFFSET(common_serial_bus.type_revision_id),
303 	 1},
304 
305 	{ACPI_RSC_MOVE16,
306 	 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
307 	 AML_OFFSET(common_serial_bus.type_data_length),
308 	 1},
309 
310 	/* Vendor data */
311 
312 	{ACPI_RSC_COUNT_SERIAL_VEN,
313 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
314 	 AML_OFFSET(common_serial_bus.type_data_length),
315 	 AML_RESOURCE_I2C_MIN_DATA_LEN},
316 
317 	{ACPI_RSC_MOVE_SERIAL_VEN,
318 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
319 	 0,
320 	 sizeof(struct aml_resource_i2c_serialbus)},
321 
322 	/* Resource Source */
323 
324 	{ACPI_RSC_MOVE8,
325 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
326 	 AML_OFFSET(common_serial_bus.res_source_index),
327 	 1},
328 
329 	{ACPI_RSC_COUNT_SERIAL_RES,
330 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
331 	 AML_OFFSET(common_serial_bus.type_data_length),
332 	 sizeof(struct aml_resource_common_serialbus)},
333 
334 	{ACPI_RSC_MOVE_SERIAL_RES,
335 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
336 	 AML_OFFSET(common_serial_bus.type_data_length),
337 	 sizeof(struct aml_resource_common_serialbus)},
338 
339 	/* I2C bus type specific */
340 
341 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode),
342 	 AML_OFFSET(i2c_serial_bus.type_specific_flags),
343 	 0},
344 
345 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed),
346 	 AML_OFFSET(i2c_serial_bus.connection_speed),
347 	 1},
348 
349 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address),
350 	 AML_OFFSET(i2c_serial_bus.slave_address),
351 	 1},
352 };
353 
354 /*******************************************************************************
355  *
356  * acpi_rs_convert_spi_serial_bus
357  *
358  ******************************************************************************/
359 
360 struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
361 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
362 	 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
363 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
364 
365 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
366 	 sizeof(struct aml_resource_spi_serialbus),
367 	 0},
368 
369 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
370 	 AML_OFFSET(common_serial_bus.revision_id),
371 	 1},
372 
373 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
374 	 AML_OFFSET(common_serial_bus.type),
375 	 1},
376 
377 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
378 	 AML_OFFSET(common_serial_bus.flags),
379 	 0},
380 
381 	{ACPI_RSC_1BITFLAG,
382 	 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
383 	 AML_OFFSET(common_serial_bus.flags),
384 	 1},
385 
386 	{ACPI_RSC_1BITFLAG,
387 	 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
388 	 AML_OFFSET(common_serial_bus.flags),
389 	 2},
390 
391 	{ACPI_RSC_MOVE8,
392 	 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
393 	 AML_OFFSET(common_serial_bus.type_revision_id),
394 	 1},
395 
396 	{ACPI_RSC_MOVE16,
397 	 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
398 	 AML_OFFSET(common_serial_bus.type_data_length),
399 	 1},
400 
401 	/* Vendor data */
402 
403 	{ACPI_RSC_COUNT_SERIAL_VEN,
404 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
405 	 AML_OFFSET(common_serial_bus.type_data_length),
406 	 AML_RESOURCE_SPI_MIN_DATA_LEN},
407 
408 	{ACPI_RSC_MOVE_SERIAL_VEN,
409 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
410 	 0,
411 	 sizeof(struct aml_resource_spi_serialbus)},
412 
413 	/* Resource Source */
414 
415 	{ACPI_RSC_MOVE8,
416 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
417 	 AML_OFFSET(common_serial_bus.res_source_index),
418 	 1},
419 
420 	{ACPI_RSC_COUNT_SERIAL_RES,
421 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
422 	 AML_OFFSET(common_serial_bus.type_data_length),
423 	 sizeof(struct aml_resource_common_serialbus)},
424 
425 	{ACPI_RSC_MOVE_SERIAL_RES,
426 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
427 	 AML_OFFSET(common_serial_bus.type_data_length),
428 	 sizeof(struct aml_resource_common_serialbus)},
429 
430 	/* Spi bus type specific  */
431 
432 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode),
433 	 AML_OFFSET(spi_serial_bus.type_specific_flags),
434 	 0},
435 
436 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity),
437 	 AML_OFFSET(spi_serial_bus.type_specific_flags),
438 	 1},
439 
440 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length),
441 	 AML_OFFSET(spi_serial_bus.data_bit_length),
442 	 1},
443 
444 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase),
445 	 AML_OFFSET(spi_serial_bus.clock_phase),
446 	 1},
447 
448 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity),
449 	 AML_OFFSET(spi_serial_bus.clock_polarity),
450 	 1},
451 
452 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection),
453 	 AML_OFFSET(spi_serial_bus.device_selection),
454 	 1},
455 
456 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed),
457 	 AML_OFFSET(spi_serial_bus.connection_speed),
458 	 1},
459 };
460 
461 /*******************************************************************************
462  *
463  * acpi_rs_convert_uart_serial_bus
464  *
465  ******************************************************************************/
466 
467 struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
468 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
469 	 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
470 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
471 
472 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
473 	 sizeof(struct aml_resource_uart_serialbus),
474 	 0},
475 
476 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
477 	 AML_OFFSET(common_serial_bus.revision_id),
478 	 1},
479 
480 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
481 	 AML_OFFSET(common_serial_bus.type),
482 	 1},
483 
484 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
485 	 AML_OFFSET(common_serial_bus.flags),
486 	 0},
487 
488 	{ACPI_RSC_1BITFLAG,
489 	 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
490 	 AML_OFFSET(common_serial_bus.flags),
491 	 1},
492 
493 	{ACPI_RSC_1BITFLAG,
494 	 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
495 	 AML_OFFSET(common_serial_bus.flags),
496 	 2},
497 
498 	{ACPI_RSC_MOVE8,
499 	 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
500 	 AML_OFFSET(common_serial_bus.type_revision_id),
501 	 1},
502 
503 	{ACPI_RSC_MOVE16,
504 	 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
505 	 AML_OFFSET(common_serial_bus.type_data_length),
506 	 1},
507 
508 	/* Vendor data */
509 
510 	{ACPI_RSC_COUNT_SERIAL_VEN,
511 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
512 	 AML_OFFSET(common_serial_bus.type_data_length),
513 	 AML_RESOURCE_UART_MIN_DATA_LEN},
514 
515 	{ACPI_RSC_MOVE_SERIAL_VEN,
516 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
517 	 0,
518 	 sizeof(struct aml_resource_uart_serialbus)},
519 
520 	/* Resource Source */
521 
522 	{ACPI_RSC_MOVE8,
523 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
524 	 AML_OFFSET(common_serial_bus.res_source_index),
525 	 1},
526 
527 	{ACPI_RSC_COUNT_SERIAL_RES,
528 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
529 	 AML_OFFSET(common_serial_bus.type_data_length),
530 	 sizeof(struct aml_resource_common_serialbus)},
531 
532 	{ACPI_RSC_MOVE_SERIAL_RES,
533 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
534 	 AML_OFFSET(common_serial_bus.type_data_length),
535 	 sizeof(struct aml_resource_common_serialbus)},
536 
537 	/* Uart bus type specific  */
538 
539 	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control),
540 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
541 	 0},
542 
543 	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits),
544 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
545 	 2},
546 
547 	{ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits),
548 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
549 	 4},
550 
551 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian),
552 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
553 	 7},
554 
555 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity),
556 	 AML_OFFSET(uart_serial_bus.parity),
557 	 1},
558 
559 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled),
560 	 AML_OFFSET(uart_serial_bus.lines_enabled),
561 	 1},
562 
563 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size),
564 	 AML_OFFSET(uart_serial_bus.rx_fifo_size),
565 	 1},
566 
567 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size),
568 	 AML_OFFSET(uart_serial_bus.tx_fifo_size),
569 	 1},
570 
571 	{ACPI_RSC_MOVE32,
572 	 ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate),
573 	 AML_OFFSET(uart_serial_bus.default_baud_rate),
574 	 1},
575 };
576 
577 /*******************************************************************************
578  *
579  * acpi_rs_convert_pin_config
580  *
581  ******************************************************************************/
582 
583 struct acpi_rsconvert_info acpi_rs_convert_pin_config[14] = {
584 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_CONFIG,
585 	 ACPI_RS_SIZE(struct acpi_resource_pin_config),
586 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_config)},
587 
588 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_CONFIG,
589 	 sizeof(struct aml_resource_pin_config),
590 	 0},
591 
592 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.revision_id),
593 	 AML_OFFSET(pin_config.revision_id),
594 	 1},
595 
596 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.shareable),
597 	 AML_OFFSET(pin_config.flags),
598 	 0},
599 
600 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.producer_consumer),
601 	 AML_OFFSET(pin_config.flags),
602 	 1},
603 
604 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.pin_config_type),
605 	 AML_OFFSET(pin_config.pin_config_type),
606 	 1},
607 
608 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.pin_config.pin_config_value),
609 	 AML_OFFSET(pin_config.pin_config_value),
610 	 1},
611 
612 	/* Pin Table */
613 
614 	/*
615 	 * It is OK to use GPIO operations here because none of them refer GPIO
616 	 * structures directly but instead use offsets given here.
617 	 */
618 
619 	{ACPI_RSC_COUNT_GPIO_PIN,
620 	 ACPI_RS_OFFSET(data.pin_config.pin_table_length),
621 	 AML_OFFSET(pin_config.pin_table_offset),
622 	 AML_OFFSET(pin_config.res_source_offset)},
623 
624 	{ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_config.pin_table),
625 	 AML_OFFSET(pin_config.pin_table_offset),
626 	 0},
627 
628 	/* Resource Source */
629 
630 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.resource_source.index),
631 	 AML_OFFSET(pin_config.res_source_index),
632 	 1},
633 
634 	{ACPI_RSC_COUNT_GPIO_RES,
635 	 ACPI_RS_OFFSET(data.pin_config.resource_source.string_length),
636 	 AML_OFFSET(pin_config.res_source_offset),
637 	 AML_OFFSET(pin_config.vendor_offset)},
638 
639 	{ACPI_RSC_MOVE_GPIO_RES,
640 	 ACPI_RS_OFFSET(data.pin_config.resource_source.string_ptr),
641 	 AML_OFFSET(pin_config.res_source_offset),
642 	 0},
643 
644 	/* Vendor Data */
645 
646 	{ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_config.vendor_length),
647 	 AML_OFFSET(pin_config.vendor_length),
648 	 1},
649 
650 	{ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_config.vendor_data),
651 	 AML_OFFSET(pin_config.vendor_offset),
652 	 0},
653 };
654 
655 /*******************************************************************************
656  *
657  * acpi_rs_convert_pin_group
658  *
659  ******************************************************************************/
660 
661 struct acpi_rsconvert_info acpi_rs_convert_pin_group[10] = {
662 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP,
663 	 ACPI_RS_SIZE(struct acpi_resource_pin_group),
664 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group)},
665 
666 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP,
667 	 sizeof(struct aml_resource_pin_group),
668 	 0},
669 
670 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group.revision_id),
671 	 AML_OFFSET(pin_group.revision_id),
672 	 1},
673 
674 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group.producer_consumer),
675 	 AML_OFFSET(pin_group.flags),
676 	 0},
677 
678 	/* Pin Table */
679 
680 	/*
681 	 * It is OK to use GPIO operations here because none of them refer GPIO
682 	 * structures directly but instead use offsets given here.
683 	 */
684 
685 	{ACPI_RSC_COUNT_GPIO_PIN,
686 	 ACPI_RS_OFFSET(data.pin_group.pin_table_length),
687 	 AML_OFFSET(pin_group.pin_table_offset),
688 	 AML_OFFSET(pin_group.label_offset)},
689 
690 	{ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_group.pin_table),
691 	 AML_OFFSET(pin_group.pin_table_offset),
692 	 0},
693 
694 	/* Resource Label */
695 
696 	{ACPI_RSC_COUNT_GPIO_RES,
697 	 ACPI_RS_OFFSET(data.pin_group.resource_label.string_length),
698 	 AML_OFFSET(pin_group.label_offset),
699 	 AML_OFFSET(pin_group.vendor_offset)},
700 
701 	{ACPI_RSC_MOVE_GPIO_RES,
702 	 ACPI_RS_OFFSET(data.pin_group.resource_label.string_ptr),
703 	 AML_OFFSET(pin_group.label_offset),
704 	 0},
705 
706 	/* Vendor Data */
707 
708 	{ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_group.vendor_length),
709 	 AML_OFFSET(pin_group.vendor_length),
710 	 1},
711 
712 	{ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_group.vendor_data),
713 	 AML_OFFSET(pin_group.vendor_offset),
714 	 0},
715 };
716 
717 /*******************************************************************************
718  *
719  * acpi_rs_convert_pin_group_function
720  *
721  ******************************************************************************/
722 
723 struct acpi_rsconvert_info acpi_rs_convert_pin_group_function[13] = {
724 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION,
725 	 ACPI_RS_SIZE(struct acpi_resource_pin_group_function),
726 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_function)},
727 
728 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION,
729 	 sizeof(struct aml_resource_pin_group_function),
730 	 0},
731 
732 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_function.revision_id),
733 	 AML_OFFSET(pin_group_function.revision_id),
734 	 1},
735 
736 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_function.shareable),
737 	 AML_OFFSET(pin_group_function.flags),
738 	 0},
739 
740 	{ACPI_RSC_1BITFLAG,
741 	 ACPI_RS_OFFSET(data.pin_group_function.producer_consumer),
742 	 AML_OFFSET(pin_group_function.flags),
743 	 1},
744 
745 	{ACPI_RSC_MOVE16,
746 	 ACPI_RS_OFFSET(data.pin_group_function.function_number),
747 	 AML_OFFSET(pin_group_function.function_number),
748 	 1},
749 
750 	/* Resource Source */
751 
752 	{ACPI_RSC_MOVE8,
753 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source.index),
754 	 AML_OFFSET(pin_group_function.res_source_index),
755 	 1},
756 
757 	{ACPI_RSC_COUNT_GPIO_RES,
758 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_length),
759 	 AML_OFFSET(pin_group_function.res_source_offset),
760 	 AML_OFFSET(pin_group_function.res_source_label_offset)},
761 
762 	{ACPI_RSC_MOVE_GPIO_RES,
763 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_ptr),
764 	 AML_OFFSET(pin_group_function.res_source_offset),
765 	 0},
766 
767 	/* Resource Source Label */
768 
769 	{ACPI_RSC_COUNT_GPIO_RES,
770 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
771 			string_length),
772 	 AML_OFFSET(pin_group_function.res_source_label_offset),
773 	 AML_OFFSET(pin_group_function.vendor_offset)},
774 
775 	{ACPI_RSC_MOVE_GPIO_RES,
776 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
777 			string_ptr),
778 	 AML_OFFSET(pin_group_function.res_source_label_offset),
779 	 0},
780 
781 	/* Vendor Data */
782 
783 	{ACPI_RSC_COUNT_GPIO_VEN,
784 	 ACPI_RS_OFFSET(data.pin_group_function.vendor_length),
785 	 AML_OFFSET(pin_group_function.vendor_length),
786 	 1},
787 
788 	{ACPI_RSC_MOVE_GPIO_RES,
789 	 ACPI_RS_OFFSET(data.pin_group_function.vendor_data),
790 	 AML_OFFSET(pin_group_function.vendor_offset),
791 	 0},
792 };
793 
794 /*******************************************************************************
795  *
796  * acpi_rs_convert_pin_group_config
797  *
798  ******************************************************************************/
799 
800 struct acpi_rsconvert_info acpi_rs_convert_pin_group_config[14] = {
801 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG,
802 	 ACPI_RS_SIZE(struct acpi_resource_pin_group_config),
803 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_config)},
804 
805 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG,
806 	 sizeof(struct aml_resource_pin_group_config),
807 	 0},
808 
809 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.revision_id),
810 	 AML_OFFSET(pin_group_config.revision_id),
811 	 1},
812 
813 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_config.shareable),
814 	 AML_OFFSET(pin_group_config.flags),
815 	 0},
816 
817 	{ACPI_RSC_1BITFLAG,
818 	 ACPI_RS_OFFSET(data.pin_group_config.producer_consumer),
819 	 AML_OFFSET(pin_group_config.flags),
820 	 1},
821 
822 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.pin_config_type),
823 	 AML_OFFSET(pin_group_config.pin_config_type),
824 	 1},
825 
826 	{ACPI_RSC_MOVE32,
827 	 ACPI_RS_OFFSET(data.pin_group_config.pin_config_value),
828 	 AML_OFFSET(pin_group_config.pin_config_value),
829 	 1},
830 
831 	/* Resource Source */
832 
833 	{ACPI_RSC_MOVE8,
834 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source.index),
835 	 AML_OFFSET(pin_group_config.res_source_index),
836 	 1},
837 
838 	{ACPI_RSC_COUNT_GPIO_RES,
839 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_length),
840 	 AML_OFFSET(pin_group_config.res_source_offset),
841 	 AML_OFFSET(pin_group_config.res_source_label_offset)},
842 
843 	{ACPI_RSC_MOVE_GPIO_RES,
844 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_ptr),
845 	 AML_OFFSET(pin_group_config.res_source_offset),
846 	 0},
847 
848 	/* Resource Source Label */
849 
850 	{ACPI_RSC_COUNT_GPIO_RES,
851 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.
852 			string_length),
853 	 AML_OFFSET(pin_group_config.res_source_label_offset),
854 	 AML_OFFSET(pin_group_config.vendor_offset)},
855 
856 	{ACPI_RSC_MOVE_GPIO_RES,
857 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.string_ptr),
858 	 AML_OFFSET(pin_group_config.res_source_label_offset),
859 	 0},
860 
861 	/* Vendor Data */
862 
863 	{ACPI_RSC_COUNT_GPIO_VEN,
864 	 ACPI_RS_OFFSET(data.pin_group_config.vendor_length),
865 	 AML_OFFSET(pin_group_config.vendor_length),
866 	 1},
867 
868 	{ACPI_RSC_MOVE_GPIO_RES,
869 	 ACPI_RS_OFFSET(data.pin_group_config.vendor_data),
870 	 AML_OFFSET(pin_group_config.vendor_offset),
871 	 0},
872 };
873