1 /*******************************************************************************
3 * Module Name: rsserial - GPIO/serial_bus resource descriptors
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2012, 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
[17] = {
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_2BITFLAG
, ACPI_RS_OFFSET(data
.gpio
.sharable
),
79 AML_OFFSET(gpio
.int_flags
),
82 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET(data
.gpio
.io_restriction
),
83 AML_OFFSET(gpio
.int_flags
),
86 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.gpio
.triggering
),
87 AML_OFFSET(gpio
.int_flags
),
90 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET(data
.gpio
.polarity
),
91 AML_OFFSET(gpio
.int_flags
),
94 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.gpio
.pin_config
),
95 AML_OFFSET(gpio
.pin_config
),
99 * These fields are contiguous in both the source and destination:
103 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET(data
.gpio
.drive_strength
),
104 AML_OFFSET(gpio
.drive_strength
),
109 {ACPI_RSC_COUNT_GPIO_PIN
, ACPI_RS_OFFSET(data
.gpio
.pin_table_length
),
110 AML_OFFSET(gpio
.pin_table_offset
),
111 AML_OFFSET(gpio
.res_source_offset
)},
113 {ACPI_RSC_MOVE_GPIO_PIN
, ACPI_RS_OFFSET(data
.gpio
.pin_table
),
114 AML_OFFSET(gpio
.pin_table_offset
),
117 /* Resource Source */
119 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.gpio
.resource_source
.index
),
120 AML_OFFSET(gpio
.res_source_index
),
123 {ACPI_RSC_COUNT_GPIO_RES
,
124 ACPI_RS_OFFSET(data
.gpio
.resource_source
.string_length
),
125 AML_OFFSET(gpio
.res_source_offset
),
126 AML_OFFSET(gpio
.vendor_offset
)},
128 {ACPI_RSC_MOVE_GPIO_RES
,
129 ACPI_RS_OFFSET(data
.gpio
.resource_source
.string_ptr
),
130 AML_OFFSET(gpio
.res_source_offset
),
135 {ACPI_RSC_COUNT_GPIO_VEN
, ACPI_RS_OFFSET(data
.gpio
.vendor_length
),
136 AML_OFFSET(gpio
.vendor_length
),
139 {ACPI_RSC_MOVE_GPIO_RES
, ACPI_RS_OFFSET(data
.gpio
.vendor_data
),
140 AML_OFFSET(gpio
.vendor_offset
),
144 /*******************************************************************************
146 * acpi_rs_convert_i2c_serial_bus
148 ******************************************************************************/
150 struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus
[16] = {
151 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_SERIAL_BUS
,
152 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus
),
153 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus
)},
155 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_SERIAL_BUS
,
156 sizeof(struct aml_resource_i2c_serialbus
),
159 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.common_serial_bus
.revision_id
),
160 AML_OFFSET(common_serial_bus
.revision_id
),
163 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.common_serial_bus
.type
),
164 AML_OFFSET(common_serial_bus
.type
),
167 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.common_serial_bus
.slave_mode
),
168 AML_OFFSET(common_serial_bus
.flags
),
172 ACPI_RS_OFFSET(data
.common_serial_bus
.producer_consumer
),
173 AML_OFFSET(common_serial_bus
.flags
),
177 ACPI_RS_OFFSET(data
.common_serial_bus
.type_revision_id
),
178 AML_OFFSET(common_serial_bus
.type_revision_id
),
182 ACPI_RS_OFFSET(data
.common_serial_bus
.type_data_length
),
183 AML_OFFSET(common_serial_bus
.type_data_length
),
188 {ACPI_RSC_COUNT_SERIAL_VEN
,
189 ACPI_RS_OFFSET(data
.common_serial_bus
.vendor_length
),
190 AML_OFFSET(common_serial_bus
.type_data_length
),
191 AML_RESOURCE_I2C_MIN_DATA_LEN
},
193 {ACPI_RSC_MOVE_SERIAL_VEN
,
194 ACPI_RS_OFFSET(data
.common_serial_bus
.vendor_data
),
196 sizeof(struct aml_resource_i2c_serialbus
)},
198 /* Resource Source */
201 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.index
),
202 AML_OFFSET(common_serial_bus
.res_source_index
),
205 {ACPI_RSC_COUNT_SERIAL_RES
,
206 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.string_length
),
207 AML_OFFSET(common_serial_bus
.type_data_length
),
208 sizeof(struct aml_resource_common_serialbus
)},
210 {ACPI_RSC_MOVE_SERIAL_RES
,
211 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.string_ptr
),
212 AML_OFFSET(common_serial_bus
.type_data_length
),
213 sizeof(struct aml_resource_common_serialbus
)},
215 /* I2C bus type specific */
217 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.i2c_serial_bus
.access_mode
),
218 AML_OFFSET(i2c_serial_bus
.type_specific_flags
),
221 {ACPI_RSC_MOVE32
, ACPI_RS_OFFSET(data
.i2c_serial_bus
.connection_speed
),
222 AML_OFFSET(i2c_serial_bus
.connection_speed
),
225 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET(data
.i2c_serial_bus
.slave_address
),
226 AML_OFFSET(i2c_serial_bus
.slave_address
),
230 /*******************************************************************************
232 * acpi_rs_convert_spi_serial_bus
234 ******************************************************************************/
236 struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus
[20] = {
237 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_SERIAL_BUS
,
238 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus
),
239 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus
)},
241 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_SERIAL_BUS
,
242 sizeof(struct aml_resource_spi_serialbus
),
245 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.common_serial_bus
.revision_id
),
246 AML_OFFSET(common_serial_bus
.revision_id
),
249 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.common_serial_bus
.type
),
250 AML_OFFSET(common_serial_bus
.type
),
253 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.common_serial_bus
.slave_mode
),
254 AML_OFFSET(common_serial_bus
.flags
),
258 ACPI_RS_OFFSET(data
.common_serial_bus
.producer_consumer
),
259 AML_OFFSET(common_serial_bus
.flags
),
263 ACPI_RS_OFFSET(data
.common_serial_bus
.type_revision_id
),
264 AML_OFFSET(common_serial_bus
.type_revision_id
),
268 ACPI_RS_OFFSET(data
.common_serial_bus
.type_data_length
),
269 AML_OFFSET(common_serial_bus
.type_data_length
),
274 {ACPI_RSC_COUNT_SERIAL_VEN
,
275 ACPI_RS_OFFSET(data
.common_serial_bus
.vendor_length
),
276 AML_OFFSET(common_serial_bus
.type_data_length
),
277 AML_RESOURCE_SPI_MIN_DATA_LEN
},
279 {ACPI_RSC_MOVE_SERIAL_VEN
,
280 ACPI_RS_OFFSET(data
.common_serial_bus
.vendor_data
),
282 sizeof(struct aml_resource_spi_serialbus
)},
284 /* Resource Source */
287 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.index
),
288 AML_OFFSET(common_serial_bus
.res_source_index
),
291 {ACPI_RSC_COUNT_SERIAL_RES
,
292 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.string_length
),
293 AML_OFFSET(common_serial_bus
.type_data_length
),
294 sizeof(struct aml_resource_common_serialbus
)},
296 {ACPI_RSC_MOVE_SERIAL_RES
,
297 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.string_ptr
),
298 AML_OFFSET(common_serial_bus
.type_data_length
),
299 sizeof(struct aml_resource_common_serialbus
)},
301 /* Spi bus type specific */
303 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.spi_serial_bus
.wire_mode
),
304 AML_OFFSET(spi_serial_bus
.type_specific_flags
),
307 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.spi_serial_bus
.device_polarity
),
308 AML_OFFSET(spi_serial_bus
.type_specific_flags
),
311 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.spi_serial_bus
.data_bit_length
),
312 AML_OFFSET(spi_serial_bus
.data_bit_length
),
315 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.spi_serial_bus
.clock_phase
),
316 AML_OFFSET(spi_serial_bus
.clock_phase
),
319 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.spi_serial_bus
.clock_polarity
),
320 AML_OFFSET(spi_serial_bus
.clock_polarity
),
323 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET(data
.spi_serial_bus
.device_selection
),
324 AML_OFFSET(spi_serial_bus
.device_selection
),
327 {ACPI_RSC_MOVE32
, ACPI_RS_OFFSET(data
.spi_serial_bus
.connection_speed
),
328 AML_OFFSET(spi_serial_bus
.connection_speed
),
332 /*******************************************************************************
334 * acpi_rs_convert_uart_serial_bus
336 ******************************************************************************/
338 struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus
[22] = {
339 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_SERIAL_BUS
,
340 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus
),
341 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus
)},
343 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_SERIAL_BUS
,
344 sizeof(struct aml_resource_uart_serialbus
),
347 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.common_serial_bus
.revision_id
),
348 AML_OFFSET(common_serial_bus
.revision_id
),
351 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.common_serial_bus
.type
),
352 AML_OFFSET(common_serial_bus
.type
),
355 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.common_serial_bus
.slave_mode
),
356 AML_OFFSET(common_serial_bus
.flags
),
360 ACPI_RS_OFFSET(data
.common_serial_bus
.producer_consumer
),
361 AML_OFFSET(common_serial_bus
.flags
),
365 ACPI_RS_OFFSET(data
.common_serial_bus
.type_revision_id
),
366 AML_OFFSET(common_serial_bus
.type_revision_id
),
370 ACPI_RS_OFFSET(data
.common_serial_bus
.type_data_length
),
371 AML_OFFSET(common_serial_bus
.type_data_length
),
376 {ACPI_RSC_COUNT_SERIAL_VEN
,
377 ACPI_RS_OFFSET(data
.common_serial_bus
.vendor_length
),
378 AML_OFFSET(common_serial_bus
.type_data_length
),
379 AML_RESOURCE_UART_MIN_DATA_LEN
},
381 {ACPI_RSC_MOVE_SERIAL_VEN
,
382 ACPI_RS_OFFSET(data
.common_serial_bus
.vendor_data
),
384 sizeof(struct aml_resource_uart_serialbus
)},
386 /* Resource Source */
389 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.index
),
390 AML_OFFSET(common_serial_bus
.res_source_index
),
393 {ACPI_RSC_COUNT_SERIAL_RES
,
394 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.string_length
),
395 AML_OFFSET(common_serial_bus
.type_data_length
),
396 sizeof(struct aml_resource_common_serialbus
)},
398 {ACPI_RSC_MOVE_SERIAL_RES
,
399 ACPI_RS_OFFSET(data
.common_serial_bus
.resource_source
.string_ptr
),
400 AML_OFFSET(common_serial_bus
.type_data_length
),
401 sizeof(struct aml_resource_common_serialbus
)},
403 /* Uart bus type specific */
405 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET(data
.uart_serial_bus
.flow_control
),
406 AML_OFFSET(uart_serial_bus
.type_specific_flags
),
409 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET(data
.uart_serial_bus
.stop_bits
),
410 AML_OFFSET(uart_serial_bus
.type_specific_flags
),
413 {ACPI_RSC_3BITFLAG
, ACPI_RS_OFFSET(data
.uart_serial_bus
.data_bits
),
414 AML_OFFSET(uart_serial_bus
.type_specific_flags
),
417 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.uart_serial_bus
.endian
),
418 AML_OFFSET(uart_serial_bus
.type_specific_flags
),
421 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.uart_serial_bus
.parity
),
422 AML_OFFSET(uart_serial_bus
.parity
),
425 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.uart_serial_bus
.lines_enabled
),
426 AML_OFFSET(uart_serial_bus
.lines_enabled
),
429 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET(data
.uart_serial_bus
.rx_fifo_size
),
430 AML_OFFSET(uart_serial_bus
.rx_fifo_size
),
433 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET(data
.uart_serial_bus
.tx_fifo_size
),
434 AML_OFFSET(uart_serial_bus
.tx_fifo_size
),
438 ACPI_RS_OFFSET(data
.uart_serial_bus
.default_baud_rate
),
439 AML_OFFSET(uart_serial_bus
.default_baud_rate
),