1 /*******************************************************************************
3 * Module Name: rsserial - GPIO/serial_bus resource descriptors
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2017, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <acpi/acpi.h>
48 #define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME("rsserial")
51 /*******************************************************************************
53 * acpi_rs_convert_gpio
55 ******************************************************************************/
56 struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
57 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO,
58 ACPI_RS_SIZE(struct acpi_resource_gpio),
59 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)},
61 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO,
62 sizeof(struct aml_resource_gpio),
66 * These fields are contiguous in both the source and destination:
70 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.revision_id),
71 AML_OFFSET(gpio.revision_id),
74 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.producer_consumer),
75 AML_OFFSET(gpio.flags),
78 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable),
79 AML_OFFSET(gpio.int_flags),
82 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.wake_capable),
83 AML_OFFSET(gpio.int_flags),
86 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction),
87 AML_OFFSET(gpio.int_flags),
90 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.triggering),
91 AML_OFFSET(gpio.int_flags),
94 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.polarity),
95 AML_OFFSET(gpio.int_flags),
98 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.pin_config),
99 AML_OFFSET(gpio.pin_config),
103 * These fields are contiguous in both the source and destination:
107 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.gpio.drive_strength),
108 AML_OFFSET(gpio.drive_strength),
113 {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table_length),
114 AML_OFFSET(gpio.pin_table_offset),
115 AML_OFFSET(gpio.res_source_offset)},
117 {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table),
118 AML_OFFSET(gpio.pin_table_offset),
121 /* Resource Source */
123 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.resource_source.index),
124 AML_OFFSET(gpio.res_source_index),
127 {ACPI_RSC_COUNT_GPIO_RES,
128 ACPI_RS_OFFSET(data.gpio.resource_source.string_length),
129 AML_OFFSET(gpio.res_source_offset),
130 AML_OFFSET(gpio.vendor_offset)},
132 {ACPI_RSC_MOVE_GPIO_RES,
133 ACPI_RS_OFFSET(data.gpio.resource_source.string_ptr),
134 AML_OFFSET(gpio.res_source_offset),
139 {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.gpio.vendor_length),
140 AML_OFFSET(gpio.vendor_length),
143 {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.gpio.vendor_data),
144 AML_OFFSET(gpio.vendor_offset),
148 /*******************************************************************************
150 * acpi_rs_convert_i2c_serial_bus
152 ******************************************************************************/
154 struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
155 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
156 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
157 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
159 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
160 sizeof(struct aml_resource_i2c_serialbus),
163 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
164 AML_OFFSET(common_serial_bus.revision_id),
167 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
168 AML_OFFSET(common_serial_bus.type),
171 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
172 AML_OFFSET(common_serial_bus.flags),
176 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
177 AML_OFFSET(common_serial_bus.flags),
181 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
182 AML_OFFSET(common_serial_bus.flags),
186 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
187 AML_OFFSET(common_serial_bus.type_revision_id),
191 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
192 AML_OFFSET(common_serial_bus.type_data_length),
197 {ACPI_RSC_COUNT_SERIAL_VEN,
198 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
199 AML_OFFSET(common_serial_bus.type_data_length),
200 AML_RESOURCE_I2C_MIN_DATA_LEN},
202 {ACPI_RSC_MOVE_SERIAL_VEN,
203 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
205 sizeof(struct aml_resource_i2c_serialbus)},
207 /* Resource Source */
210 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
211 AML_OFFSET(common_serial_bus.res_source_index),
214 {ACPI_RSC_COUNT_SERIAL_RES,
215 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
216 AML_OFFSET(common_serial_bus.type_data_length),
217 sizeof(struct aml_resource_common_serialbus)},
219 {ACPI_RSC_MOVE_SERIAL_RES,
220 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
221 AML_OFFSET(common_serial_bus.type_data_length),
222 sizeof(struct aml_resource_common_serialbus)},
224 /* I2C bus type specific */
226 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode),
227 AML_OFFSET(i2c_serial_bus.type_specific_flags),
230 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed),
231 AML_OFFSET(i2c_serial_bus.connection_speed),
234 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address),
235 AML_OFFSET(i2c_serial_bus.slave_address),
239 /*******************************************************************************
241 * acpi_rs_convert_spi_serial_bus
243 ******************************************************************************/
245 struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
246 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
247 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
248 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
250 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
251 sizeof(struct aml_resource_spi_serialbus),
254 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
255 AML_OFFSET(common_serial_bus.revision_id),
258 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
259 AML_OFFSET(common_serial_bus.type),
262 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
263 AML_OFFSET(common_serial_bus.flags),
267 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
268 AML_OFFSET(common_serial_bus.flags),
272 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
273 AML_OFFSET(common_serial_bus.flags),
277 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
278 AML_OFFSET(common_serial_bus.type_revision_id),
282 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
283 AML_OFFSET(common_serial_bus.type_data_length),
288 {ACPI_RSC_COUNT_SERIAL_VEN,
289 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
290 AML_OFFSET(common_serial_bus.type_data_length),
291 AML_RESOURCE_SPI_MIN_DATA_LEN},
293 {ACPI_RSC_MOVE_SERIAL_VEN,
294 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
296 sizeof(struct aml_resource_spi_serialbus)},
298 /* Resource Source */
301 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
302 AML_OFFSET(common_serial_bus.res_source_index),
305 {ACPI_RSC_COUNT_SERIAL_RES,
306 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
307 AML_OFFSET(common_serial_bus.type_data_length),
308 sizeof(struct aml_resource_common_serialbus)},
310 {ACPI_RSC_MOVE_SERIAL_RES,
311 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
312 AML_OFFSET(common_serial_bus.type_data_length),
313 sizeof(struct aml_resource_common_serialbus)},
315 /* Spi bus type specific */
317 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode),
318 AML_OFFSET(spi_serial_bus.type_specific_flags),
321 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity),
322 AML_OFFSET(spi_serial_bus.type_specific_flags),
325 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length),
326 AML_OFFSET(spi_serial_bus.data_bit_length),
329 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase),
330 AML_OFFSET(spi_serial_bus.clock_phase),
333 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity),
334 AML_OFFSET(spi_serial_bus.clock_polarity),
337 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection),
338 AML_OFFSET(spi_serial_bus.device_selection),
341 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed),
342 AML_OFFSET(spi_serial_bus.connection_speed),
346 /*******************************************************************************
348 * acpi_rs_convert_uart_serial_bus
350 ******************************************************************************/
352 struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
353 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
354 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
355 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
357 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
358 sizeof(struct aml_resource_uart_serialbus),
361 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
362 AML_OFFSET(common_serial_bus.revision_id),
365 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
366 AML_OFFSET(common_serial_bus.type),
369 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
370 AML_OFFSET(common_serial_bus.flags),
374 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
375 AML_OFFSET(common_serial_bus.flags),
379 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
380 AML_OFFSET(common_serial_bus.flags),
384 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
385 AML_OFFSET(common_serial_bus.type_revision_id),
389 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
390 AML_OFFSET(common_serial_bus.type_data_length),
395 {ACPI_RSC_COUNT_SERIAL_VEN,
396 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
397 AML_OFFSET(common_serial_bus.type_data_length),
398 AML_RESOURCE_UART_MIN_DATA_LEN},
400 {ACPI_RSC_MOVE_SERIAL_VEN,
401 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
403 sizeof(struct aml_resource_uart_serialbus)},
405 /* Resource Source */
408 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
409 AML_OFFSET(common_serial_bus.res_source_index),
412 {ACPI_RSC_COUNT_SERIAL_RES,
413 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
414 AML_OFFSET(common_serial_bus.type_data_length),
415 sizeof(struct aml_resource_common_serialbus)},
417 {ACPI_RSC_MOVE_SERIAL_RES,
418 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
419 AML_OFFSET(common_serial_bus.type_data_length),
420 sizeof(struct aml_resource_common_serialbus)},
422 /* Uart bus type specific */
424 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control),
425 AML_OFFSET(uart_serial_bus.type_specific_flags),
428 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits),
429 AML_OFFSET(uart_serial_bus.type_specific_flags),
432 {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits),
433 AML_OFFSET(uart_serial_bus.type_specific_flags),
436 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian),
437 AML_OFFSET(uart_serial_bus.type_specific_flags),
440 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity),
441 AML_OFFSET(uart_serial_bus.parity),
444 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled),
445 AML_OFFSET(uart_serial_bus.lines_enabled),
448 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size),
449 AML_OFFSET(uart_serial_bus.rx_fifo_size),
452 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size),
453 AML_OFFSET(uart_serial_bus.tx_fifo_size),
457 ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate),
458 AML_OFFSET(uart_serial_bus.default_baud_rate),