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