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