xref: /linux/drivers/acpi/acpica/rsserial.c (revision b8d312aa075f33282565467662c4628dae0a2aff)
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_i2c_serial_bus
191  *
192  ******************************************************************************/
193 
194 struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
195 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
196 	 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
197 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
198 
199 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
200 	 sizeof(struct aml_resource_i2c_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.common_serial_bus.type),
208 	 AML_OFFSET(common_serial_bus.type),
209 	 1},
210 
211 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
212 	 AML_OFFSET(common_serial_bus.flags),
213 	 0},
214 
215 	{ACPI_RSC_1BITFLAG,
216 	 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
217 	 AML_OFFSET(common_serial_bus.flags),
218 	 1},
219 
220 	{ACPI_RSC_1BITFLAG,
221 	 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
222 	 AML_OFFSET(common_serial_bus.flags),
223 	 2},
224 
225 	{ACPI_RSC_MOVE8,
226 	 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
227 	 AML_OFFSET(common_serial_bus.type_revision_id),
228 	 1},
229 
230 	{ACPI_RSC_MOVE16,
231 	 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
232 	 AML_OFFSET(common_serial_bus.type_data_length),
233 	 1},
234 
235 	/* Vendor data */
236 
237 	{ACPI_RSC_COUNT_SERIAL_VEN,
238 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
239 	 AML_OFFSET(common_serial_bus.type_data_length),
240 	 AML_RESOURCE_I2C_MIN_DATA_LEN},
241 
242 	{ACPI_RSC_MOVE_SERIAL_VEN,
243 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
244 	 0,
245 	 sizeof(struct aml_resource_i2c_serialbus)},
246 
247 	/* Resource Source */
248 
249 	{ACPI_RSC_MOVE8,
250 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
251 	 AML_OFFSET(common_serial_bus.res_source_index),
252 	 1},
253 
254 	{ACPI_RSC_COUNT_SERIAL_RES,
255 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
256 	 AML_OFFSET(common_serial_bus.type_data_length),
257 	 sizeof(struct aml_resource_common_serialbus)},
258 
259 	{ACPI_RSC_MOVE_SERIAL_RES,
260 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
261 	 AML_OFFSET(common_serial_bus.type_data_length),
262 	 sizeof(struct aml_resource_common_serialbus)},
263 
264 	/* I2C bus type specific */
265 
266 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode),
267 	 AML_OFFSET(i2c_serial_bus.type_specific_flags),
268 	 0},
269 
270 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed),
271 	 AML_OFFSET(i2c_serial_bus.connection_speed),
272 	 1},
273 
274 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address),
275 	 AML_OFFSET(i2c_serial_bus.slave_address),
276 	 1},
277 };
278 
279 /*******************************************************************************
280  *
281  * acpi_rs_convert_spi_serial_bus
282  *
283  ******************************************************************************/
284 
285 struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
286 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
287 	 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
288 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
289 
290 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
291 	 sizeof(struct aml_resource_spi_serialbus),
292 	 0},
293 
294 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
295 	 AML_OFFSET(common_serial_bus.revision_id),
296 	 1},
297 
298 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
299 	 AML_OFFSET(common_serial_bus.type),
300 	 1},
301 
302 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
303 	 AML_OFFSET(common_serial_bus.flags),
304 	 0},
305 
306 	{ACPI_RSC_1BITFLAG,
307 	 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
308 	 AML_OFFSET(common_serial_bus.flags),
309 	 1},
310 
311 	{ACPI_RSC_1BITFLAG,
312 	 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
313 	 AML_OFFSET(common_serial_bus.flags),
314 	 2},
315 
316 	{ACPI_RSC_MOVE8,
317 	 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
318 	 AML_OFFSET(common_serial_bus.type_revision_id),
319 	 1},
320 
321 	{ACPI_RSC_MOVE16,
322 	 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
323 	 AML_OFFSET(common_serial_bus.type_data_length),
324 	 1},
325 
326 	/* Vendor data */
327 
328 	{ACPI_RSC_COUNT_SERIAL_VEN,
329 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
330 	 AML_OFFSET(common_serial_bus.type_data_length),
331 	 AML_RESOURCE_SPI_MIN_DATA_LEN},
332 
333 	{ACPI_RSC_MOVE_SERIAL_VEN,
334 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
335 	 0,
336 	 sizeof(struct aml_resource_spi_serialbus)},
337 
338 	/* Resource Source */
339 
340 	{ACPI_RSC_MOVE8,
341 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
342 	 AML_OFFSET(common_serial_bus.res_source_index),
343 	 1},
344 
345 	{ACPI_RSC_COUNT_SERIAL_RES,
346 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
347 	 AML_OFFSET(common_serial_bus.type_data_length),
348 	 sizeof(struct aml_resource_common_serialbus)},
349 
350 	{ACPI_RSC_MOVE_SERIAL_RES,
351 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
352 	 AML_OFFSET(common_serial_bus.type_data_length),
353 	 sizeof(struct aml_resource_common_serialbus)},
354 
355 	/* Spi bus type specific  */
356 
357 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode),
358 	 AML_OFFSET(spi_serial_bus.type_specific_flags),
359 	 0},
360 
361 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity),
362 	 AML_OFFSET(spi_serial_bus.type_specific_flags),
363 	 1},
364 
365 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length),
366 	 AML_OFFSET(spi_serial_bus.data_bit_length),
367 	 1},
368 
369 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase),
370 	 AML_OFFSET(spi_serial_bus.clock_phase),
371 	 1},
372 
373 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity),
374 	 AML_OFFSET(spi_serial_bus.clock_polarity),
375 	 1},
376 
377 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection),
378 	 AML_OFFSET(spi_serial_bus.device_selection),
379 	 1},
380 
381 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed),
382 	 AML_OFFSET(spi_serial_bus.connection_speed),
383 	 1},
384 };
385 
386 /*******************************************************************************
387  *
388  * acpi_rs_convert_uart_serial_bus
389  *
390  ******************************************************************************/
391 
392 struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
393 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
394 	 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
395 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
396 
397 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
398 	 sizeof(struct aml_resource_uart_serialbus),
399 	 0},
400 
401 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
402 	 AML_OFFSET(common_serial_bus.revision_id),
403 	 1},
404 
405 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
406 	 AML_OFFSET(common_serial_bus.type),
407 	 1},
408 
409 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
410 	 AML_OFFSET(common_serial_bus.flags),
411 	 0},
412 
413 	{ACPI_RSC_1BITFLAG,
414 	 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
415 	 AML_OFFSET(common_serial_bus.flags),
416 	 1},
417 
418 	{ACPI_RSC_1BITFLAG,
419 	 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
420 	 AML_OFFSET(common_serial_bus.flags),
421 	 2},
422 
423 	{ACPI_RSC_MOVE8,
424 	 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
425 	 AML_OFFSET(common_serial_bus.type_revision_id),
426 	 1},
427 
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 
433 	/* Vendor data */
434 
435 	{ACPI_RSC_COUNT_SERIAL_VEN,
436 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
437 	 AML_OFFSET(common_serial_bus.type_data_length),
438 	 AML_RESOURCE_UART_MIN_DATA_LEN},
439 
440 	{ACPI_RSC_MOVE_SERIAL_VEN,
441 	 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
442 	 0,
443 	 sizeof(struct aml_resource_uart_serialbus)},
444 
445 	/* Resource Source */
446 
447 	{ACPI_RSC_MOVE8,
448 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
449 	 AML_OFFSET(common_serial_bus.res_source_index),
450 	 1},
451 
452 	{ACPI_RSC_COUNT_SERIAL_RES,
453 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
454 	 AML_OFFSET(common_serial_bus.type_data_length),
455 	 sizeof(struct aml_resource_common_serialbus)},
456 
457 	{ACPI_RSC_MOVE_SERIAL_RES,
458 	 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
459 	 AML_OFFSET(common_serial_bus.type_data_length),
460 	 sizeof(struct aml_resource_common_serialbus)},
461 
462 	/* Uart bus type specific  */
463 
464 	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control),
465 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
466 	 0},
467 
468 	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits),
469 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
470 	 2},
471 
472 	{ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits),
473 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
474 	 4},
475 
476 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian),
477 	 AML_OFFSET(uart_serial_bus.type_specific_flags),
478 	 7},
479 
480 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity),
481 	 AML_OFFSET(uart_serial_bus.parity),
482 	 1},
483 
484 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled),
485 	 AML_OFFSET(uart_serial_bus.lines_enabled),
486 	 1},
487 
488 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size),
489 	 AML_OFFSET(uart_serial_bus.rx_fifo_size),
490 	 1},
491 
492 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size),
493 	 AML_OFFSET(uart_serial_bus.tx_fifo_size),
494 	 1},
495 
496 	{ACPI_RSC_MOVE32,
497 	 ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate),
498 	 AML_OFFSET(uart_serial_bus.default_baud_rate),
499 	 1},
500 };
501 
502 /*******************************************************************************
503  *
504  * acpi_rs_convert_pin_config
505  *
506  ******************************************************************************/
507 
508 struct acpi_rsconvert_info acpi_rs_convert_pin_config[14] = {
509 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_CONFIG,
510 	 ACPI_RS_SIZE(struct acpi_resource_pin_config),
511 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_config)},
512 
513 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_CONFIG,
514 	 sizeof(struct aml_resource_pin_config),
515 	 0},
516 
517 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.revision_id),
518 	 AML_OFFSET(pin_config.revision_id),
519 	 1},
520 
521 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.shareable),
522 	 AML_OFFSET(pin_config.flags),
523 	 0},
524 
525 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_config.producer_consumer),
526 	 AML_OFFSET(pin_config.flags),
527 	 1},
528 
529 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.pin_config_type),
530 	 AML_OFFSET(pin_config.pin_config_type),
531 	 1},
532 
533 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.pin_config.pin_config_value),
534 	 AML_OFFSET(pin_config.pin_config_value),
535 	 1},
536 
537 	/* Pin Table */
538 
539 	/*
540 	 * It is OK to use GPIO operations here because none of them refer GPIO
541 	 * structures directly but instead use offsets given here.
542 	 */
543 
544 	{ACPI_RSC_COUNT_GPIO_PIN,
545 	 ACPI_RS_OFFSET(data.pin_config.pin_table_length),
546 	 AML_OFFSET(pin_config.pin_table_offset),
547 	 AML_OFFSET(pin_config.res_source_offset)},
548 
549 	{ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_config.pin_table),
550 	 AML_OFFSET(pin_config.pin_table_offset),
551 	 0},
552 
553 	/* Resource Source */
554 
555 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_config.resource_source.index),
556 	 AML_OFFSET(pin_config.res_source_index),
557 	 1},
558 
559 	{ACPI_RSC_COUNT_GPIO_RES,
560 	 ACPI_RS_OFFSET(data.pin_config.resource_source.string_length),
561 	 AML_OFFSET(pin_config.res_source_offset),
562 	 AML_OFFSET(pin_config.vendor_offset)},
563 
564 	{ACPI_RSC_MOVE_GPIO_RES,
565 	 ACPI_RS_OFFSET(data.pin_config.resource_source.string_ptr),
566 	 AML_OFFSET(pin_config.res_source_offset),
567 	 0},
568 
569 	/* Vendor Data */
570 
571 	{ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_config.vendor_length),
572 	 AML_OFFSET(pin_config.vendor_length),
573 	 1},
574 
575 	{ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_config.vendor_data),
576 	 AML_OFFSET(pin_config.vendor_offset),
577 	 0},
578 };
579 
580 /*******************************************************************************
581  *
582  * acpi_rs_convert_pin_group
583  *
584  ******************************************************************************/
585 
586 struct acpi_rsconvert_info acpi_rs_convert_pin_group[10] = {
587 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP,
588 	 ACPI_RS_SIZE(struct acpi_resource_pin_group),
589 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group)},
590 
591 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP,
592 	 sizeof(struct aml_resource_pin_group),
593 	 0},
594 
595 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group.revision_id),
596 	 AML_OFFSET(pin_group.revision_id),
597 	 1},
598 
599 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group.producer_consumer),
600 	 AML_OFFSET(pin_group.flags),
601 	 0},
602 
603 	/* Pin Table */
604 
605 	/*
606 	 * It is OK to use GPIO operations here because none of them refer GPIO
607 	 * structures directly but instead use offsets given here.
608 	 */
609 
610 	{ACPI_RSC_COUNT_GPIO_PIN,
611 	 ACPI_RS_OFFSET(data.pin_group.pin_table_length),
612 	 AML_OFFSET(pin_group.pin_table_offset),
613 	 AML_OFFSET(pin_group.label_offset)},
614 
615 	{ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.pin_group.pin_table),
616 	 AML_OFFSET(pin_group.pin_table_offset),
617 	 0},
618 
619 	/* Resource Label */
620 
621 	{ACPI_RSC_COUNT_GPIO_RES,
622 	 ACPI_RS_OFFSET(data.pin_group.resource_label.string_length),
623 	 AML_OFFSET(pin_group.label_offset),
624 	 AML_OFFSET(pin_group.vendor_offset)},
625 
626 	{ACPI_RSC_MOVE_GPIO_RES,
627 	 ACPI_RS_OFFSET(data.pin_group.resource_label.string_ptr),
628 	 AML_OFFSET(pin_group.label_offset),
629 	 0},
630 
631 	/* Vendor Data */
632 
633 	{ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.pin_group.vendor_length),
634 	 AML_OFFSET(pin_group.vendor_length),
635 	 1},
636 
637 	{ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.pin_group.vendor_data),
638 	 AML_OFFSET(pin_group.vendor_offset),
639 	 0},
640 };
641 
642 /*******************************************************************************
643  *
644  * acpi_rs_convert_pin_group_function
645  *
646  ******************************************************************************/
647 
648 struct acpi_rsconvert_info acpi_rs_convert_pin_group_function[13] = {
649 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION,
650 	 ACPI_RS_SIZE(struct acpi_resource_pin_group_function),
651 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_function)},
652 
653 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION,
654 	 sizeof(struct aml_resource_pin_group_function),
655 	 0},
656 
657 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_function.revision_id),
658 	 AML_OFFSET(pin_group_function.revision_id),
659 	 1},
660 
661 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_function.shareable),
662 	 AML_OFFSET(pin_group_function.flags),
663 	 0},
664 
665 	{ACPI_RSC_1BITFLAG,
666 	 ACPI_RS_OFFSET(data.pin_group_function.producer_consumer),
667 	 AML_OFFSET(pin_group_function.flags),
668 	 1},
669 
670 	{ACPI_RSC_MOVE16,
671 	 ACPI_RS_OFFSET(data.pin_group_function.function_number),
672 	 AML_OFFSET(pin_group_function.function_number),
673 	 1},
674 
675 	/* Resource Source */
676 
677 	{ACPI_RSC_MOVE8,
678 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source.index),
679 	 AML_OFFSET(pin_group_function.res_source_index),
680 	 1},
681 
682 	{ACPI_RSC_COUNT_GPIO_RES,
683 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_length),
684 	 AML_OFFSET(pin_group_function.res_source_offset),
685 	 AML_OFFSET(pin_group_function.res_source_label_offset)},
686 
687 	{ACPI_RSC_MOVE_GPIO_RES,
688 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source.string_ptr),
689 	 AML_OFFSET(pin_group_function.res_source_offset),
690 	 0},
691 
692 	/* Resource Source Label */
693 
694 	{ACPI_RSC_COUNT_GPIO_RES,
695 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
696 			string_length),
697 	 AML_OFFSET(pin_group_function.res_source_label_offset),
698 	 AML_OFFSET(pin_group_function.vendor_offset)},
699 
700 	{ACPI_RSC_MOVE_GPIO_RES,
701 	 ACPI_RS_OFFSET(data.pin_group_function.resource_source_label.
702 			string_ptr),
703 	 AML_OFFSET(pin_group_function.res_source_label_offset),
704 	 0},
705 
706 	/* Vendor Data */
707 
708 	{ACPI_RSC_COUNT_GPIO_VEN,
709 	 ACPI_RS_OFFSET(data.pin_group_function.vendor_length),
710 	 AML_OFFSET(pin_group_function.vendor_length),
711 	 1},
712 
713 	{ACPI_RSC_MOVE_GPIO_RES,
714 	 ACPI_RS_OFFSET(data.pin_group_function.vendor_data),
715 	 AML_OFFSET(pin_group_function.vendor_offset),
716 	 0},
717 };
718 
719 /*******************************************************************************
720  *
721  * acpi_rs_convert_pin_group_config
722  *
723  ******************************************************************************/
724 
725 struct acpi_rsconvert_info acpi_rs_convert_pin_group_config[14] = {
726 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG,
727 	 ACPI_RS_SIZE(struct acpi_resource_pin_group_config),
728 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_pin_group_config)},
729 
730 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG,
731 	 sizeof(struct aml_resource_pin_group_config),
732 	 0},
733 
734 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.revision_id),
735 	 AML_OFFSET(pin_group_config.revision_id),
736 	 1},
737 
738 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.pin_group_config.shareable),
739 	 AML_OFFSET(pin_group_config.flags),
740 	 0},
741 
742 	{ACPI_RSC_1BITFLAG,
743 	 ACPI_RS_OFFSET(data.pin_group_config.producer_consumer),
744 	 AML_OFFSET(pin_group_config.flags),
745 	 1},
746 
747 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.pin_group_config.pin_config_type),
748 	 AML_OFFSET(pin_group_config.pin_config_type),
749 	 1},
750 
751 	{ACPI_RSC_MOVE32,
752 	 ACPI_RS_OFFSET(data.pin_group_config.pin_config_value),
753 	 AML_OFFSET(pin_group_config.pin_config_value),
754 	 1},
755 
756 	/* Resource Source */
757 
758 	{ACPI_RSC_MOVE8,
759 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source.index),
760 	 AML_OFFSET(pin_group_config.res_source_index),
761 	 1},
762 
763 	{ACPI_RSC_COUNT_GPIO_RES,
764 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_length),
765 	 AML_OFFSET(pin_group_config.res_source_offset),
766 	 AML_OFFSET(pin_group_config.res_source_label_offset)},
767 
768 	{ACPI_RSC_MOVE_GPIO_RES,
769 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source.string_ptr),
770 	 AML_OFFSET(pin_group_config.res_source_offset),
771 	 0},
772 
773 	/* Resource Source Label */
774 
775 	{ACPI_RSC_COUNT_GPIO_RES,
776 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.
777 			string_length),
778 	 AML_OFFSET(pin_group_config.res_source_label_offset),
779 	 AML_OFFSET(pin_group_config.vendor_offset)},
780 
781 	{ACPI_RSC_MOVE_GPIO_RES,
782 	 ACPI_RS_OFFSET(data.pin_group_config.resource_source_label.string_ptr),
783 	 AML_OFFSET(pin_group_config.res_source_label_offset),
784 	 0},
785 
786 	/* Vendor Data */
787 
788 	{ACPI_RSC_COUNT_GPIO_VEN,
789 	 ACPI_RS_OFFSET(data.pin_group_config.vendor_length),
790 	 AML_OFFSET(pin_group_config.vendor_length),
791 	 1},
792 
793 	{ACPI_RSC_MOVE_GPIO_RES,
794 	 ACPI_RS_OFFSET(data.pin_group_config.vendor_data),
795 	 AML_OFFSET(pin_group_config.vendor_offset),
796 	 0},
797 };
798