Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI 5.0: Support for all new resource descriptors

FixedDMA, GPIO descriptors, SerialBus descriptors

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Lin Ming and committed by
Len Brown
e0fe0a8d 2da120b6

+1776 -119
+1 -1
drivers/acpi/acpica/Makefile
··· 36 36 psopcode.o psscope.o psutils.o psxface.o 37 37 38 38 acpi-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ 39 - rscalc.o rsirq.o rsmemory.o rsutils.o 39 + rscalc.o rsirq.o rsmemory.o rsutils.o rsserial.o 40 40 41 41 acpi-$(ACPI_FUTURE_USAGE) += rsdump.o 42 42
+4 -2
drivers/acpi/acpica/aclocal.h
··· 955 955 #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 956 956 #define ACPI_RESOURCE_NAME_IO 0x40 957 957 #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 958 - #define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 958 + #define ACPI_RESOURCE_NAME_FIXED_DMA 0x50 959 959 #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 960 960 #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 961 961 #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 ··· 977 977 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 978 978 #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A 979 979 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B 980 - #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B 980 + #define ACPI_RESOURCE_NAME_GPIO 0x8C 981 + #define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E 982 + #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E 981 983 982 984 /***************************************************************************** 983 985 *
+73 -36
drivers/acpi/acpica/acresrc.h
··· 73 73 74 74 /* Resource conversion opcodes */ 75 75 76 - #define ACPI_RSC_INITGET 0 77 - #define ACPI_RSC_INITSET 1 78 - #define ACPI_RSC_FLAGINIT 2 79 - #define ACPI_RSC_1BITFLAG 3 80 - #define ACPI_RSC_2BITFLAG 4 81 - #define ACPI_RSC_COUNT 5 82 - #define ACPI_RSC_COUNT16 6 83 - #define ACPI_RSC_LENGTH 7 84 - #define ACPI_RSC_MOVE8 8 85 - #define ACPI_RSC_MOVE16 9 86 - #define ACPI_RSC_MOVE32 10 87 - #define ACPI_RSC_MOVE64 11 88 - #define ACPI_RSC_SET8 12 89 - #define ACPI_RSC_DATA8 13 90 - #define ACPI_RSC_ADDRESS 14 91 - #define ACPI_RSC_SOURCE 15 92 - #define ACPI_RSC_SOURCEX 16 93 - #define ACPI_RSC_BITMASK 17 94 - #define ACPI_RSC_BITMASK16 18 95 - #define ACPI_RSC_EXIT_NE 19 96 - #define ACPI_RSC_EXIT_LE 20 97 - #define ACPI_RSC_EXIT_EQ 21 76 + typedef enum { 77 + ACPI_RSC_INITGET = 0, 78 + ACPI_RSC_INITSET, 79 + ACPI_RSC_FLAGINIT, 80 + ACPI_RSC_1BITFLAG, 81 + ACPI_RSC_2BITFLAG, 82 + ACPI_RSC_3BITFLAG, 83 + ACPI_RSC_ADDRESS, 84 + ACPI_RSC_BITMASK, 85 + ACPI_RSC_BITMASK16, 86 + ACPI_RSC_COUNT, 87 + ACPI_RSC_COUNT16, 88 + ACPI_RSC_COUNT_GPIO_PIN, 89 + ACPI_RSC_COUNT_GPIO_RES, 90 + ACPI_RSC_COUNT_GPIO_VEN, 91 + ACPI_RSC_COUNT_SERIAL_RES, 92 + ACPI_RSC_COUNT_SERIAL_VEN, 93 + ACPI_RSC_DATA8, 94 + ACPI_RSC_EXIT_EQ, 95 + ACPI_RSC_EXIT_LE, 96 + ACPI_RSC_EXIT_NE, 97 + ACPI_RSC_LENGTH, 98 + ACPI_RSC_MOVE_GPIO_PIN, 99 + ACPI_RSC_MOVE_GPIO_RES, 100 + ACPI_RSC_MOVE_SERIAL_RES, 101 + ACPI_RSC_MOVE_SERIAL_VEN, 102 + ACPI_RSC_MOVE8, 103 + ACPI_RSC_MOVE16, 104 + ACPI_RSC_MOVE32, 105 + ACPI_RSC_MOVE64, 106 + ACPI_RSC_SET8, 107 + ACPI_RSC_SOURCE, 108 + ACPI_RSC_SOURCEX 109 + } ACPI_RSCONVERT_OPCODES; 98 110 99 111 /* Resource Conversion sub-opcodes */ 100 112 ··· 118 106 #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) 119 107 #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) 120 108 109 + /* 110 + * Individual entry for the resource dump tables 111 + */ 121 112 typedef const struct acpi_rsdump_info { 122 113 u8 opcode; 123 114 u8 offset; ··· 131 116 132 117 /* Values for the Opcode field above */ 133 118 134 - #define ACPI_RSD_TITLE 0 135 - #define ACPI_RSD_LITERAL 1 136 - #define ACPI_RSD_STRING 2 137 - #define ACPI_RSD_UINT8 3 138 - #define ACPI_RSD_UINT16 4 139 - #define ACPI_RSD_UINT32 5 140 - #define ACPI_RSD_UINT64 6 141 - #define ACPI_RSD_1BITFLAG 7 142 - #define ACPI_RSD_2BITFLAG 8 143 - #define ACPI_RSD_SHORTLIST 9 144 - #define ACPI_RSD_LONGLIST 10 145 - #define ACPI_RSD_DWORDLIST 11 146 - #define ACPI_RSD_ADDRESS 12 147 - #define ACPI_RSD_SOURCE 13 119 + typedef enum { 120 + ACPI_RSD_TITLE = 0, 121 + ACPI_RSD_1BITFLAG, 122 + ACPI_RSD_2BITFLAG, 123 + ACPI_RSD_3BITFLAG, 124 + ACPI_RSD_ADDRESS, 125 + ACPI_RSD_DWORDLIST, 126 + ACPI_RSD_LITERAL, 127 + ACPI_RSD_LONGLIST, 128 + ACPI_RSD_SHORTLIST, 129 + ACPI_RSD_SHORTLISTX, 130 + ACPI_RSD_SOURCE, 131 + ACPI_RSD_STRING, 132 + ACPI_RSD_UINT8, 133 + ACPI_RSD_UINT16, 134 + ACPI_RSD_UINT32, 135 + ACPI_RSD_UINT64, 136 + ACPI_RSD_WORDLIST 137 + } ACPI_RSDUMP_OPCODES; 148 138 149 139 /* restore default alignment */ 150 140 ··· 158 138 /* Resource tables indexed by internal resource type */ 159 139 160 140 extern const u8 acpi_gbl_aml_resource_sizes[]; 141 + extern const u8 acpi_gbl_aml_resource_serial_bus_sizes[]; 161 142 extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; 162 143 163 144 /* Resource tables indexed by raw AML resource descriptor type */ 164 145 165 146 extern const u8 acpi_gbl_resource_struct_sizes[]; 147 + extern const u8 acpi_gbl_resource_struct_serial_bus_sizes[]; 166 148 extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; 149 + 150 + extern struct acpi_rsconvert_info 151 + *acpi_gbl_convert_resource_serial_bus_dispatch[]; 167 152 168 153 struct acpi_vendor_walk_info { 169 154 struct acpi_vendor_uuid *uuid; ··· 318 293 extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; 319 294 extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; 320 295 extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; 296 + extern struct acpi_rsconvert_info acpi_rs_convert_gpio[]; 297 + extern struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[]; 298 + extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[]; 299 + extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[]; 300 + extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[]; 321 301 322 302 /* These resources require separate get/set tables */ 323 303 ··· 340 310 * rsinfo 341 311 */ 342 312 extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; 313 + extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[]; 343 314 344 315 /* 345 316 * rsdump ··· 362 331 extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; 363 332 extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; 364 333 extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; 334 + extern struct acpi_rsdump_info acpi_rs_dump_gpio[]; 335 + extern struct acpi_rsdump_info acpi_rs_dump_fixed_dma[]; 336 + extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[]; 337 + extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[]; 338 + extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[]; 339 + extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[]; 365 340 #endif 366 341 367 342 #endif /* __ACRESRC_H__ */
+1
drivers/acpi/acpica/acutils.h
··· 45 45 #define _ACUTILS_H 46 46 47 47 extern const u8 acpi_gbl_resource_aml_sizes[]; 48 + extern const u8 acpi_gbl_resource_aml_serial_bus_sizes[]; 48 49 49 50 /* Strings used by the disassembler and debugger resource dump routines */ 50 51
+136
drivers/acpi/acpica/amlresrc.h
··· 58 58 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" 59 59 #define ACPI_RESTAG_BASEADDRESS "_BAS" 60 60 #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ 61 + #define ACPI_RESTAG_DEBOUNCETIME "_DBT" 61 62 #define ACPI_RESTAG_DECODE "_DEC" 63 + #define ACPI_RESTAG_DEVICEPOLARITY "_DPL" 62 64 #define ACPI_RESTAG_DMA "_DMA" 63 65 #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ 66 + #define ACPI_RESTAG_DRIVESTRENGTH "_DRS" 67 + #define ACPI_RESTAG_ENDIANNESS "_END" 68 + #define ACPI_RESTAG_FLOWCONTROL "_FLC" 64 69 #define ACPI_RESTAG_GRANULARITY "_GRA" 65 70 #define ACPI_RESTAG_INTERRUPT "_INT" 66 71 #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ 67 72 #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ 68 73 #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ 74 + #define ACPI_RESTAG_IORESTRICTION "_IOR" 69 75 #define ACPI_RESTAG_LENGTH "_LEN" 76 + #define ACPI_RESTAG_LINE "_LIN" 70 77 #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ 71 78 #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ 72 79 #define ACPI_RESTAG_MAXADDR "_MAX" 73 80 #define ACPI_RESTAG_MINADDR "_MIN" 74 81 #define ACPI_RESTAG_MAXTYPE "_MAF" 75 82 #define ACPI_RESTAG_MINTYPE "_MIF" 83 + #define ACPI_RESTAG_MODE "_MOD" 84 + #define ACPI_RESTAG_PARITY "_PAR" 85 + #define ACPI_RESTAG_PHASE "_PHA" 86 + #define ACPI_RESTAG_PIN "_PIN" 87 + #define ACPI_RESTAG_PINCONFIG "_PPI" 88 + #define ACPI_RESTAG_POLARITY "_POL" 76 89 #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" 77 90 #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" 78 91 #define ACPI_RESTAG_RANGETYPE "_RNG" 79 92 #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ 93 + #define ACPI_RESTAG_LENGTH_RX "_RXL" 94 + #define ACPI_RESTAG_LENGTH_TX "_TXL" 95 + #define ACPI_RESTAG_SLAVEMODE "_SLV" 96 + #define ACPI_RESTAG_SPEED "_SPE" 97 + #define ACPI_RESTAG_STOPBITS "_STB" 80 98 #define ACPI_RESTAG_TRANSLATION "_TRA" 81 99 #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ 82 100 #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ 83 101 #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ 102 + #define ACPI_RESTAG_VENDORDATA "_VEN" 84 103 85 104 /* Default sizes for "small" resource descriptors */ 86 105 ··· 109 90 #define ASL_RDESC_END_DEPEND_SIZE 0x00 110 91 #define ASL_RDESC_IO_SIZE 0x07 111 92 #define ASL_RDESC_FIXED_IO_SIZE 0x03 93 + #define ASL_RDESC_FIXED_DMA_SIZE 0x05 112 94 #define ASL_RDESC_END_TAG_SIZE 0x01 113 95 114 96 struct asl_resource_node { ··· 182 162 183 163 struct aml_resource_end_tag { 184 164 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; 165 + }; 166 + 167 + struct aml_resource_fixed_dma { 168 + AML_RESOURCE_SMALL_HEADER_COMMON u16 request_lines; 169 + u16 channels; 170 + u8 width; 185 171 }; 186 172 187 173 /* ··· 289 263 u64 address; 290 264 }; 291 265 266 + /* Common descriptor for gpio_int and gpio_io (ACPI 5.0) */ 267 + 268 + struct aml_resource_gpio { 269 + AML_RESOURCE_LARGE_HEADER_COMMON u8 revision_id; 270 + u8 connection_type; 271 + u16 flags; 272 + u16 int_flags; 273 + u8 pin_config; 274 + u16 drive_strength; 275 + u16 debounce_timeout; 276 + u16 pin_table_offset; 277 + u8 res_source_index; 278 + u16 res_source_offset; 279 + u16 vendor_offset; 280 + u16 vendor_length; 281 + /* 282 + * Optional fields follow immediately: 283 + * 1) PIN list (Words) 284 + * 2) Resource Source String 285 + * 3) Vendor Data bytes 286 + */ 287 + }; 288 + 289 + #define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */ 290 + 291 + /* Values for connection_type above */ 292 + 293 + #define AML_RESOURCE_GPIO_TYPE_INT 0 294 + #define AML_RESOURCE_GPIO_TYPE_IO 1 295 + #define AML_RESOURCE_MAX_GPIOTYPE 1 296 + 297 + /* Common preamble for all serial descriptors (ACPI 5.0) */ 298 + 299 + #define AML_RESOURCE_SERIAL_COMMON \ 300 + u8 revision_id; \ 301 + u8 res_source_index; \ 302 + u8 type; \ 303 + u8 flags; \ 304 + u16 type_specific_flags; \ 305 + u8 type_revision_id; \ 306 + u16 type_data_length; \ 307 + 308 + /* Values for the type field above */ 309 + 310 + #define AML_RESOURCE_I2C_SERIALBUSTYPE 1 311 + #define AML_RESOURCE_SPI_SERIALBUSTYPE 2 312 + #define AML_RESOURCE_UART_SERIALBUSTYPE 3 313 + #define AML_RESOURCE_MAX_SERIALBUSTYPE 3 314 + #define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */ 315 + 316 + struct aml_resource_common_serialbus { 317 + AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_SERIAL_COMMON}; 318 + 319 + struct aml_resource_i2c_serialbus { 320 + AML_RESOURCE_LARGE_HEADER_COMMON 321 + AML_RESOURCE_SERIAL_COMMON u32 connection_speed; 322 + u16 slave_address; 323 + /* 324 + * Optional fields follow immediately: 325 + * 1) Vendor Data bytes 326 + * 2) Resource Source String 327 + */ 328 + }; 329 + 330 + #define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */ 331 + #define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */ 332 + #define AML_RESOURCE_I2C_MIN_DATA_LEN 6 333 + 334 + struct aml_resource_spi_serialbus { 335 + AML_RESOURCE_LARGE_HEADER_COMMON 336 + AML_RESOURCE_SERIAL_COMMON u32 connection_speed; 337 + u8 data_bit_length; 338 + u8 clock_phase; 339 + u8 clock_polarity; 340 + u16 device_selection; 341 + /* 342 + * Optional fields follow immediately: 343 + * 1) Vendor Data bytes 344 + * 2) Resource Source String 345 + */ 346 + }; 347 + 348 + #define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */ 349 + #define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */ 350 + #define AML_RESOURCE_SPI_MIN_DATA_LEN 9 351 + 352 + struct aml_resource_uart_serialbus { 353 + AML_RESOURCE_LARGE_HEADER_COMMON 354 + AML_RESOURCE_SERIAL_COMMON u32 default_baud_rate; 355 + u16 rx_fifo_size; 356 + u16 tx_fifo_size; 357 + u8 parity; 358 + u8 lines_enabled; 359 + /* 360 + * Optional fields follow immediately: 361 + * 1) Vendor Data bytes 362 + * 2) Resource Source String 363 + */ 364 + }; 365 + 366 + #define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */ 367 + #define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */ 368 + #define AML_RESOURCE_UART_MIN_DATA_LEN 10 369 + 292 370 /* restore default alignment */ 293 371 294 372 #pragma pack() ··· 414 284 struct aml_resource_end_dependent end_dpf; 415 285 struct aml_resource_io io; 416 286 struct aml_resource_fixed_io fixed_io; 287 + struct aml_resource_fixed_dma fixed_dma; 417 288 struct aml_resource_vendor_small vendor_small; 418 289 struct aml_resource_end_tag end_tag; 419 290 ··· 430 299 struct aml_resource_address64 address64; 431 300 struct aml_resource_extended_address64 ext_address64; 432 301 struct aml_resource_extended_irq extended_irq; 302 + struct aml_resource_gpio gpio; 303 + struct aml_resource_i2c_serialbus i2c_serial_bus; 304 + struct aml_resource_spi_serialbus spi_serial_bus; 305 + struct aml_resource_uart_serialbus uart_serial_bus; 306 + struct aml_resource_common_serialbus common_serial_bus; 433 307 434 308 /* Utility overlays */ 435 309
+80 -7
drivers/acpi/acpica/rscalc.c
··· 313 313 resource_source)); 314 314 break; 315 315 316 + case ACPI_RESOURCE_TYPE_GPIO: 317 + 318 + total_size = 319 + (acpi_rs_length) (total_size + 320 + (resource->data.gpio. 321 + pin_table_length * 2) + 322 + resource->data.gpio. 323 + resource_source.string_length + 324 + resource->data.gpio. 325 + vendor_length); 326 + 327 + break; 328 + 329 + case ACPI_RESOURCE_TYPE_SERIAL_BUS: 330 + 331 + total_size = 332 + acpi_gbl_aml_resource_serial_bus_sizes[resource-> 333 + data. 334 + common_serial_bus. 335 + type]; 336 + 337 + total_size = (acpi_rs_length) (total_size + 338 + resource->data. 339 + i2c_serial_bus. 340 + resource_source. 341 + string_length + 342 + resource->data. 343 + i2c_serial_bus. 344 + vendor_length); 345 + 346 + break; 347 + 316 348 default: 317 349 break; 318 350 } ··· 394 362 u32 extra_struct_bytes; 395 363 u8 resource_index; 396 364 u8 minimum_aml_resource_length; 365 + union aml_resource *aml_resource; 397 366 398 367 ACPI_FUNCTION_TRACE(rs_get_list_length); 399 368 400 - *size_needed = 0; 369 + *size_needed = ACPI_RS_SIZE_MIN; /* Minimum size is one end_tag */ 401 370 end_aml = aml_buffer + aml_buffer_length; 402 371 403 372 /* Walk the list of AML resource descriptors */ ··· 409 376 410 377 status = acpi_ut_validate_resource(aml_buffer, &resource_index); 411 378 if (ACPI_FAILURE(status)) { 379 + /* 380 + * Exit on failure. Cannot continue because the descriptor length 381 + * may be bogus also. 382 + */ 412 383 return_ACPI_STATUS(status); 413 384 } 385 + 386 + aml_resource = (void *)aml_buffer; 414 387 415 388 /* Get the resource length and base (minimum) AML size */ 416 389 ··· 461 422 462 423 case ACPI_RESOURCE_NAME_END_TAG: 463 424 /* 464 - * End Tag: 465 - * This is the normal exit, add size of end_tag 425 + * End Tag: This is the normal exit 466 426 */ 467 - *size_needed += ACPI_RS_SIZE_MIN; 468 427 return_ACPI_STATUS(AE_OK); 469 428 470 429 case ACPI_RESOURCE_NAME_ADDRESS32: ··· 494 457 minimum_aml_resource_length); 495 458 break; 496 459 460 + case ACPI_RESOURCE_NAME_GPIO: 461 + 462 + /* Vendor data is optional */ 463 + 464 + if (aml_resource->gpio.vendor_length) { 465 + extra_struct_bytes += 466 + aml_resource->gpio.vendor_offset - 467 + aml_resource->gpio.pin_table_offset + 468 + aml_resource->gpio.vendor_length; 469 + } else { 470 + extra_struct_bytes += 471 + aml_resource->large_header.resource_length + 472 + sizeof(struct aml_resource_large_header) - 473 + aml_resource->gpio.pin_table_offset; 474 + } 475 + break; 476 + 477 + case ACPI_RESOURCE_NAME_SERIAL_BUS: 478 + 479 + minimum_aml_resource_length = 480 + acpi_gbl_resource_aml_serial_bus_sizes 481 + [aml_resource->common_serial_bus.type]; 482 + extra_struct_bytes += 483 + aml_resource->common_serial_bus.resource_length - 484 + minimum_aml_resource_length; 485 + break; 486 + 497 487 default: 498 488 break; 499 489 } ··· 531 467 * Important: Round the size up for the appropriate alignment. This 532 468 * is a requirement on IA64. 533 469 */ 534 - buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + 535 - extra_struct_bytes; 536 - buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); 470 + if (acpi_ut_get_resource_type(aml_buffer) == 471 + ACPI_RESOURCE_NAME_SERIAL_BUS) { 472 + buffer_size = 473 + acpi_gbl_resource_struct_serial_bus_sizes 474 + [aml_resource->common_serial_bus.type] + 475 + extra_struct_bytes; 476 + } else { 477 + buffer_size = 478 + acpi_gbl_resource_struct_sizes[resource_index] + 479 + extra_struct_bytes; 480 + } 481 + buffer_size = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); 537 482 538 483 *size_needed += buffer_size; 539 484
+2 -1
drivers/acpi/acpica/rscreate.c
··· 66 66 * of device resources. 67 67 * 68 68 ******************************************************************************/ 69 + 69 70 acpi_status 70 71 acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, 71 - struct acpi_buffer *output_buffer) 72 + struct acpi_buffer * output_buffer) 72 73 { 73 74 74 75 acpi_status status;
+185 -9
drivers/acpi/acpica/rsdump.c
··· 61 61 62 62 static void acpi_rs_out_title(char *title); 63 63 64 - static void acpi_rs_dump_byte_list(u16 length, u8 * data); 64 + static void acpi_rs_dump_byte_list(u16 length, u8 *data); 65 65 66 - static void acpi_rs_dump_dword_list(u8 length, u32 * data); 66 + static void acpi_rs_dump_word_list(u16 length, u16 *data); 67 67 68 - static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); 68 + static void acpi_rs_dump_dword_list(u8 length, u32 *data); 69 + 70 + static void acpi_rs_dump_short_byte_list(u8 length, u8 *data); 69 71 70 72 static void 71 73 acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); ··· 311 309 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} 312 310 }; 313 311 312 + struct acpi_rsdump_info acpi_rs_dump_gpio[16] = { 313 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL}, 314 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL}, 315 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type), 316 + "ConnectionType", acpi_gbl_ct_decode}, 317 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer), 318 + "ProducerConsumer", acpi_gbl_consume_decode}, 319 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig", 320 + acpi_gbl_ppc_decode}, 321 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharable", 322 + acpi_gbl_shr_decode}, 323 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction), 324 + "IoRestriction", acpi_gbl_ior_decode}, 325 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering", 326 + acpi_gbl_he_decode}, 327 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity", 328 + acpi_gbl_ll_decode}, 329 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength", 330 + NULL}, 331 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout), 332 + "DebounceTimeout", NULL}, 333 + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source), 334 + "ResourceSource", NULL}, 335 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length), 336 + "PinTableLength", NULL}, 337 + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL}, 338 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength", 339 + NULL}, 340 + {ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData", 341 + NULL}, 342 + }; 343 + 344 + struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = { 345 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma), 346 + "FixedDma", NULL}, 347 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines), 348 + "RequestLines", NULL}, 349 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels", 350 + NULL}, 351 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth", 352 + acpi_gbl_dts_decode}, 353 + }; 354 + 355 + #define ACPI_RS_DUMP_COMMON_SERIAL_BUS \ 356 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \ 357 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \ 358 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \ 359 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \ 360 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \ 361 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \ 362 + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \ 363 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \ 364 + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL}, 365 + 366 + struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = { 367 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus), 368 + "Common Serial Bus", NULL}, 369 + ACPI_RS_DUMP_COMMON_SERIAL_BUS 370 + }; 371 + 372 + struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = { 373 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus), 374 + "I2C Serial Bus", NULL}, 375 + ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, 376 + ACPI_RSD_OFFSET(i2c_serial_bus. 377 + access_mode), 378 + "AccessMode", acpi_gbl_am_decode}, 379 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed), 380 + "ConnectionSpeed", NULL}, 381 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address), 382 + "SlaveAddress", NULL}, 383 + }; 384 + 385 + struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = { 386 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus), 387 + "Spi Serial Bus", NULL}, 388 + ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, 389 + ACPI_RSD_OFFSET(spi_serial_bus. 390 + wire_mode), "WireMode", 391 + acpi_gbl_wm_decode}, 392 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity), 393 + "DevicePolarity", acpi_gbl_dp_decode}, 394 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length), 395 + "DataBitLength", NULL}, 396 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase), 397 + "ClockPhase", acpi_gbl_cph_decode}, 398 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity), 399 + "ClockPolarity", acpi_gbl_cpo_decode}, 400 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection), 401 + "DeviceSelection", NULL}, 402 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed), 403 + "ConnectionSpeed", NULL}, 404 + }; 405 + 406 + struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = { 407 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus), 408 + "Uart Serial Bus", NULL}, 409 + ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG, 410 + ACPI_RSD_OFFSET(uart_serial_bus. 411 + flow_control), 412 + "FlowControl", acpi_gbl_fc_decode}, 413 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits), 414 + "StopBits", acpi_gbl_sb_decode}, 415 + {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits), 416 + "DataBits", acpi_gbl_bpb_decode}, 417 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian", 418 + acpi_gbl_ed_decode}, 419 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity", 420 + acpi_gbl_pt_decode}, 421 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled), 422 + "LinesEnabled", NULL}, 423 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size), 424 + "RxFifoSize", NULL}, 425 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size), 426 + "TxFifoSize", NULL}, 427 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate), 428 + "ConnectionSpeed", NULL}, 429 + }; 430 + 314 431 /* 315 432 * Tables used for common address descriptor flag fields 316 433 */ ··· 534 413 /* Data items, 8/16/32/64 bit */ 535 414 536 415 case ACPI_RSD_UINT8: 537 - acpi_rs_out_integer8(name, ACPI_GET8(target)); 416 + if (table->pointer) { 417 + acpi_rs_out_string(name, ACPI_CAST_PTR(char, 418 + table-> 419 + pointer 420 + [*target])); 421 + } else { 422 + acpi_rs_out_integer8(name, ACPI_GET8(target)); 423 + } 538 424 break; 539 425 540 426 case ACPI_RSD_UINT16: ··· 572 444 0x03])); 573 445 break; 574 446 447 + case ACPI_RSD_3BITFLAG: 448 + acpi_rs_out_string(name, ACPI_CAST_PTR(char, 449 + table-> 450 + pointer[*target & 451 + 0x07])); 452 + break; 453 + 575 454 case ACPI_RSD_SHORTLIST: 576 455 /* 577 456 * Short byte list (single line output) for DMA and IRQ resources ··· 588 453 acpi_rs_out_title(name); 589 454 acpi_rs_dump_short_byte_list(*previous_target, 590 455 target); 456 + } 457 + break; 458 + 459 + case ACPI_RSD_SHORTLISTX: 460 + /* 461 + * Short byte list (single line output) for GPIO vendor data 462 + * Note: The list length is obtained from the previous table entry 463 + */ 464 + if (previous_target) { 465 + acpi_rs_out_title(name); 466 + acpi_rs_dump_short_byte_list(*previous_target, 467 + * 468 + (ACPI_CAST_INDIRECT_PTR 469 + (u8, target))); 591 470 } 592 471 break; 593 472 ··· 626 477 acpi_rs_dump_dword_list(*previous_target, 627 478 ACPI_CAST_PTR(u32, 628 479 target)); 480 + } 481 + break; 482 + 483 + case ACPI_RSD_WORDLIST: 484 + /* 485 + * Word list for GPIO Pin Table 486 + * Note: The list length is obtained from the previous table entry 487 + */ 488 + if (previous_target) { 489 + acpi_rs_dump_word_list(*previous_target, 490 + *(ACPI_CAST_INDIRECT_PTR 491 + (u16, target))); 629 492 } 630 493 break; 631 494 ··· 788 627 789 628 /* Dump the resource descriptor */ 790 629 791 - acpi_rs_dump_descriptor(&resource_list->data, 792 - acpi_gbl_dump_resource_dispatch[type]); 630 + if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { 631 + acpi_rs_dump_descriptor(&resource_list->data, 632 + acpi_gbl_dump_serial_bus_dispatch 633 + [resource_list->data. 634 + common_serial_bus.type]); 635 + } else { 636 + acpi_rs_dump_descriptor(&resource_list->data, 637 + acpi_gbl_dump_resource_dispatch 638 + [type]); 639 + } 793 640 794 641 /* Point to the next resource structure */ 795 642 796 - resource_list = 797 - ACPI_ADD_PTR(struct acpi_resource, resource_list, 798 - resource_list->length); 643 + resource_list = ACPI_NEXT_RESOURCE(resource_list); 799 644 800 645 /* Exit when END_TAG descriptor is reached */ 801 646 ··· 932 765 933 766 for (i = 0; i < length; i++) { 934 767 acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); 768 + } 769 + } 770 + 771 + static void acpi_rs_dump_word_list(u16 length, u16 *data) 772 + { 773 + u16 i; 774 + 775 + for (i = 0; i < length; i++) { 776 + acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]); 935 777 } 936 778 } 937 779
+50 -6
drivers/acpi/acpica/rsinfo.c
··· 76 76 acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ 77 77 acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 78 78 acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 79 - acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 79 + acpi_rs_convert_generic_reg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 80 + acpi_rs_convert_gpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */ 81 + acpi_rs_convert_fixed_dma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */ 82 + NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */ 80 83 }; 81 84 82 85 /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ ··· 97 94 acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ 98 95 acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ 99 96 acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ 100 - NULL, /* 0x0A, Reserved */ 97 + acpi_rs_convert_fixed_dma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */ 101 98 NULL, /* 0x0B, Reserved */ 102 99 NULL, /* 0x0C, Reserved */ 103 100 NULL, /* 0x0D, Reserved */ ··· 117 114 acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ 118 115 acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ 119 116 acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ 120 - acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ 117 + acpi_rs_convert_ext_address64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ 118 + acpi_rs_convert_gpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ 119 + NULL, /* 0x0D, Reserved */ 120 + NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */ 121 + }; 122 + 123 + /* Subtype table for serial_bus -- I2C, SPI, and UART */ 124 + 125 + struct acpi_rsconvert_info *acpi_gbl_convert_resource_serial_bus_dispatch[] = { 126 + NULL, 127 + acpi_rs_convert_i2c_serial_bus, 128 + acpi_rs_convert_spi_serial_bus, 129 + acpi_rs_convert_uart_serial_bus, 121 130 }; 122 131 123 132 #ifdef ACPI_FUTURE_USAGE ··· 155 140 acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 156 141 acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 157 142 acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 143 + acpi_rs_dump_gpio, /* ACPI_RESOURCE_TYPE_GPIO */ 144 + acpi_rs_dump_fixed_dma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ 145 + NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ 146 + }; 147 + 148 + struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[] = { 149 + NULL, 150 + acpi_rs_dump_i2c_serial_bus, /* AML_RESOURCE_I2C_BUS_TYPE */ 151 + acpi_rs_dump_spi_serial_bus, /* AML_RESOURCE_SPI_BUS_TYPE */ 152 + acpi_rs_dump_uart_serial_bus, /* AML_RESOURCE_UART_BUS_TYPE */ 158 153 }; 159 154 #endif 160 155 ··· 191 166 sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ 192 167 sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 193 168 sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 194 - sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 169 + sizeof(struct aml_resource_generic_register), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 170 + sizeof(struct aml_resource_gpio), /* ACPI_RESOURCE_TYPE_GPIO */ 171 + sizeof(struct aml_resource_fixed_dma), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ 172 + sizeof(struct aml_resource_common_serialbus), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ 195 173 }; 196 174 197 175 const u8 acpi_gbl_resource_struct_sizes[] = { ··· 210 182 ACPI_RS_SIZE_MIN, 211 183 ACPI_RS_SIZE(struct acpi_resource_io), 212 184 ACPI_RS_SIZE(struct acpi_resource_fixed_io), 213 - 0, 185 + ACPI_RS_SIZE(struct acpi_resource_fixed_dma), 214 186 0, 215 187 0, 216 188 0, ··· 230 202 ACPI_RS_SIZE(struct acpi_resource_address16), 231 203 ACPI_RS_SIZE(struct acpi_resource_extended_irq), 232 204 ACPI_RS_SIZE(struct acpi_resource_address64), 233 - ACPI_RS_SIZE(struct acpi_resource_extended_address64) 205 + ACPI_RS_SIZE(struct acpi_resource_extended_address64), 206 + ACPI_RS_SIZE(struct acpi_resource_gpio), 207 + ACPI_RS_SIZE(struct acpi_resource_common_serialbus) 208 + }; 209 + 210 + const u8 acpi_gbl_aml_resource_serial_bus_sizes[] = { 211 + 0, 212 + sizeof(struct aml_resource_i2c_serialbus), 213 + sizeof(struct aml_resource_spi_serialbus), 214 + sizeof(struct aml_resource_uart_serialbus), 215 + }; 216 + 217 + const u8 acpi_gbl_resource_struct_serial_bus_sizes[] = { 218 + 0, 219 + ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus), 220 + ACPI_RS_SIZE(struct acpi_resource_spi_serialbus), 221 + ACPI_RS_SIZE(struct acpi_resource_uart_serialbus), 234 222 };
+31
drivers/acpi/acpica/rsirq.c
··· 264 264 AML_OFFSET(dma.dma_channel_mask), 265 265 ACPI_RS_OFFSET(data.dma.channel_count)} 266 266 }; 267 + 268 + /******************************************************************************* 269 + * 270 + * acpi_rs_convert_fixed_dma 271 + * 272 + ******************************************************************************/ 273 + 274 + struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = { 275 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_DMA, 276 + ACPI_RS_SIZE(struct acpi_resource_fixed_dma), 277 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_dma)}, 278 + 279 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_DMA, 280 + sizeof(struct aml_resource_fixed_dma), 281 + 0}, 282 + 283 + /* 284 + * These fields are contiguous in both the source and destination: 285 + * request_lines 286 + * Channels 287 + */ 288 + 289 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines), 290 + AML_OFFSET(fixed_dma.request_lines), 291 + 2}, 292 + 293 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width), 294 + AML_OFFSET(fixed_dma.width), 295 + 1}, 296 + 297 + };
+61 -14
drivers/acpi/acpica/rslist.c
··· 70 70 struct acpi_resource **resource_ptr = 71 71 ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context); 72 72 struct acpi_resource *resource; 73 + union aml_resource *aml_resource; 74 + struct acpi_rsconvert_info *conversion_table; 73 75 acpi_status status; 74 76 75 77 ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources); ··· 86 84 "Misaligned resource pointer %p", resource)); 87 85 } 88 86 87 + /* Get the appropriate conversion info table */ 88 + 89 + aml_resource = ACPI_CAST_PTR(union aml_resource, aml); 90 + if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) { 91 + if (aml_resource->common_serial_bus.type > 92 + AML_RESOURCE_MAX_SERIALBUSTYPE) { 93 + conversion_table = NULL; 94 + } else { 95 + /* This is an I2C, SPI, or UART serial_bus descriptor */ 96 + 97 + conversion_table = 98 + acpi_gbl_convert_resource_serial_bus_dispatch 99 + [aml_resource->common_serial_bus.type]; 100 + } 101 + } else { 102 + conversion_table = 103 + acpi_gbl_get_resource_dispatch[resource_index]; 104 + } 105 + 106 + if (!conversion_table) { 107 + ACPI_ERROR((AE_INFO, 108 + "Invalid/unsupported resource descriptor: Type 0x%2.2X", 109 + resource_index)); 110 + return (AE_AML_INVALID_RESOURCE_TYPE); 111 + } 112 + 89 113 /* Convert the AML byte stream resource to a local resource struct */ 90 114 91 115 status = 92 - acpi_rs_convert_aml_to_resource(resource, 93 - ACPI_CAST_PTR(union aml_resource, 94 - aml), 95 - acpi_gbl_get_resource_dispatch 96 - [resource_index]); 116 + acpi_rs_convert_aml_to_resource(resource, aml_resource, 117 + conversion_table); 97 118 if (ACPI_FAILURE(status)) { 98 119 ACPI_EXCEPTION((AE_INFO, status, 99 120 "Could not convert AML resource (Type 0x%X)", ··· 131 106 132 107 /* Point to the next structure in the output buffer */ 133 108 134 - *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); 109 + *resource_ptr = ACPI_NEXT_RESOURCE(resource); 135 110 return_ACPI_STATUS(AE_OK); 136 111 } 137 112 ··· 160 135 { 161 136 u8 *aml = output_buffer; 162 137 u8 *end_aml = output_buffer + aml_size_needed; 138 + struct acpi_rsconvert_info *conversion_table; 163 139 acpi_status status; 164 140 165 141 ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml); ··· 180 154 181 155 /* Perform the conversion */ 182 156 183 - status = acpi_rs_convert_resource_to_aml(resource, ACPI_CAST_PTR(union 184 - aml_resource, 185 - aml), 186 - acpi_gbl_set_resource_dispatch 187 - [resource->type]); 157 + if (resource->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { 158 + if (resource->data.common_serial_bus.type > 159 + AML_RESOURCE_MAX_SERIALBUSTYPE) { 160 + conversion_table = NULL; 161 + } else { 162 + /* This is an I2C, SPI, or UART serial_bus descriptor */ 163 + 164 + conversion_table = 165 + acpi_gbl_convert_resource_serial_bus_dispatch 166 + [resource->data.common_serial_bus.type]; 167 + } 168 + } else { 169 + conversion_table = 170 + acpi_gbl_set_resource_dispatch[resource->type]; 171 + } 172 + 173 + if (!conversion_table) { 174 + ACPI_ERROR((AE_INFO, 175 + "Invalid/unsupported resource descriptor: Type 0x%2.2X", 176 + resource->type)); 177 + return (AE_AML_INVALID_RESOURCE_TYPE); 178 + } 179 + 180 + status = acpi_rs_convert_resource_to_aml(resource, 181 + ACPI_CAST_PTR(union 182 + aml_resource, 183 + aml), 184 + conversion_table); 188 185 if (ACPI_FAILURE(status)) { 189 186 ACPI_EXCEPTION((AE_INFO, status, 190 187 "Could not convert resource (type 0x%X) to AML", ··· 241 192 242 193 /* Point to the next input resource descriptor */ 243 194 244 - resource = 245 - ACPI_ADD_PTR(struct acpi_resource, resource, 246 - resource->length); 195 + resource = ACPI_NEXT_RESOURCE(resource); 247 196 } 248 197 249 198 /* Completed buffer, but did not find an end_tag resource descriptor */
+262 -5
drivers/acpi/acpica/rsmisc.c
··· 83 83 84 84 ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); 85 85 86 + if (!info) { 87 + return_ACPI_STATUS(AE_BAD_PARAMETER); 88 + } 89 + 86 90 if (((acpi_size) resource) & 0x3) { 87 91 88 92 /* Each internal resource struct is expected to be 32-bit aligned */ ··· 105 101 * table length (# of table entries) 106 102 */ 107 103 count = INIT_TABLE_LENGTH(info); 108 - 109 104 while (count) { 110 105 /* 111 106 * Source is the external AML byte stream buffer, ··· 148 145 ((ACPI_GET8(source) >> info->value) & 0x03); 149 146 break; 150 147 148 + case ACPI_RSC_3BITFLAG: 149 + /* 150 + * Mask and shift the flag bits 151 + */ 152 + ACPI_SET8(destination) = (u8) 153 + ((ACPI_GET8(source) >> info->value) & 0x07); 154 + break; 155 + 151 156 case ACPI_RSC_COUNT: 152 157 153 158 item_count = ACPI_GET8(source); ··· 172 161 173 162 resource->length = resource->length + 174 163 (info->value * (item_count - 1)); 164 + break; 165 + 166 + case ACPI_RSC_COUNT_GPIO_PIN: 167 + 168 + target = ACPI_ADD_PTR(void, aml, info->value); 169 + item_count = ACPI_GET16(target) - ACPI_GET16(source); 170 + 171 + resource->length = resource->length + item_count; 172 + item_count = item_count / 2; 173 + ACPI_SET16(destination) = item_count; 174 + break; 175 + 176 + case ACPI_RSC_COUNT_GPIO_VEN: 177 + 178 + item_count = ACPI_GET8(source); 179 + ACPI_SET8(destination) = (u8)item_count; 180 + 181 + resource->length = resource->length + 182 + (info->value * item_count); 183 + break; 184 + 185 + case ACPI_RSC_COUNT_GPIO_RES: 186 + 187 + /* 188 + * Vendor data is optional (length/offset may both be zero) 189 + * Examine vendor data length field first 190 + */ 191 + target = ACPI_ADD_PTR(void, aml, (info->value + 2)); 192 + if (ACPI_GET16(target)) { 193 + 194 + /* Use vendor offset to get resource source length */ 195 + 196 + target = ACPI_ADD_PTR(void, aml, info->value); 197 + item_count = 198 + ACPI_GET16(target) - ACPI_GET16(source); 199 + } else { 200 + /* No vendor data to worry about */ 201 + 202 + item_count = aml->large_header.resource_length + 203 + sizeof(struct aml_resource_large_header) - 204 + ACPI_GET16(source); 205 + } 206 + 207 + resource->length = resource->length + item_count; 208 + ACPI_SET16(destination) = item_count; 209 + break; 210 + 211 + case ACPI_RSC_COUNT_SERIAL_VEN: 212 + 213 + item_count = ACPI_GET16(source) - info->value; 214 + 215 + resource->length = resource->length + item_count; 216 + ACPI_SET16(destination) = item_count; 217 + break; 218 + 219 + case ACPI_RSC_COUNT_SERIAL_RES: 220 + 221 + item_count = (aml_resource_length + 222 + sizeof(struct aml_resource_large_header)) 223 + - ACPI_GET16(source) - info->value; 224 + 225 + resource->length = resource->length + item_count; 226 + ACPI_SET16(destination) = item_count; 175 227 break; 176 228 177 229 case ACPI_RSC_LENGTH: ··· 254 180 item_count = info->value; 255 181 } 256 182 acpi_rs_move_data(destination, source, item_count, 183 + info->opcode); 184 + break; 185 + 186 + case ACPI_RSC_MOVE_GPIO_PIN: 187 + 188 + /* Generate and set the PIN data pointer */ 189 + 190 + target = (char *)ACPI_ADD_PTR(void, resource, 191 + (resource->length - 192 + item_count * 2)); 193 + *(u16 **)destination = ACPI_CAST_PTR(u16, target); 194 + 195 + /* Copy the PIN data */ 196 + 197 + source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source)); 198 + acpi_rs_move_data(target, source, item_count, 199 + info->opcode); 200 + break; 201 + 202 + case ACPI_RSC_MOVE_GPIO_RES: 203 + 204 + /* Generate and set the resource_source string pointer */ 205 + 206 + target = (char *)ACPI_ADD_PTR(void, resource, 207 + (resource->length - 208 + item_count)); 209 + *(u8 **)destination = ACPI_CAST_PTR(u8, target); 210 + 211 + /* Copy the resource_source string */ 212 + 213 + source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source)); 214 + acpi_rs_move_data(target, source, item_count, 215 + info->opcode); 216 + break; 217 + 218 + case ACPI_RSC_MOVE_SERIAL_VEN: 219 + 220 + /* Generate and set the Vendor Data pointer */ 221 + 222 + target = (char *)ACPI_ADD_PTR(void, resource, 223 + (resource->length - 224 + item_count)); 225 + *(u8 **)destination = ACPI_CAST_PTR(u8, target); 226 + 227 + /* Copy the Vendor Data */ 228 + 229 + source = ACPI_ADD_PTR(void, aml, info->value); 230 + acpi_rs_move_data(target, source, item_count, 231 + info->opcode); 232 + break; 233 + 234 + case ACPI_RSC_MOVE_SERIAL_RES: 235 + 236 + /* Generate and set the resource_source string pointer */ 237 + 238 + target = (char *)ACPI_ADD_PTR(void, resource, 239 + (resource->length - 240 + item_count)); 241 + *(u8 **)destination = ACPI_CAST_PTR(u8, target); 242 + 243 + /* Copy the resource_source string */ 244 + 245 + source = 246 + ACPI_ADD_PTR(void, aml, 247 + (ACPI_GET16(source) + info->value)); 248 + acpi_rs_move_data(target, source, item_count, 257 249 info->opcode); 258 250 break; 259 251 ··· 359 219 * Optional resource_source (Index and String). This is the more 360 220 * complicated case used by the Interrupt() macro 361 221 */ 362 - target = 363 - ACPI_ADD_PTR(char, resource, 364 - info->aml_offset + (item_count * 4)); 222 + target = ACPI_ADD_PTR(char, resource, 223 + info->aml_offset + 224 + (item_count * 4)); 365 225 366 226 resource->length += 367 227 acpi_rs_get_resource_source(aml_resource_length, 368 - (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target); 228 + (acpi_rs_length) 229 + (((item_count - 230 + 1) * sizeof(u32)) + 231 + info->value), 232 + destination, aml, 233 + target); 369 234 break; 370 235 371 236 case ACPI_RSC_BITMASK: ··· 472 327 { 473 328 void *source = NULL; 474 329 void *destination; 330 + char *target; 475 331 acpi_rsdesc_size aml_length = 0; 476 332 u8 count; 477 333 u16 temp16 = 0; 478 334 u16 item_count = 0; 479 335 480 336 ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml); 337 + 338 + if (!info) { 339 + return_ACPI_STATUS(AE_BAD_PARAMETER); 340 + } 481 341 482 342 /* 483 343 * First table entry must be ACPI_RSC_INITxxx and must contain the ··· 533 383 ((ACPI_GET8(source) & 0x03) << info->value); 534 384 break; 535 385 386 + case ACPI_RSC_3BITFLAG: 387 + /* 388 + * Mask and shift the flag bits 389 + */ 390 + ACPI_SET8(destination) |= (u8) 391 + ((ACPI_GET8(source) & 0x07) << info->value); 392 + break; 393 + 536 394 case ACPI_RSC_COUNT: 537 395 538 396 item_count = ACPI_GET8(source); ··· 558 400 acpi_rs_set_resource_length(aml_length, aml); 559 401 break; 560 402 403 + case ACPI_RSC_COUNT_GPIO_PIN: 404 + 405 + item_count = ACPI_GET16(source); 406 + ACPI_SET16(destination) = (u16)aml_length; 407 + 408 + aml_length = (u16)(aml_length + item_count * 2); 409 + target = ACPI_ADD_PTR(void, aml, info->value); 410 + ACPI_SET16(target) = (u16)aml_length; 411 + acpi_rs_set_resource_length(aml_length, aml); 412 + break; 413 + 414 + case ACPI_RSC_COUNT_GPIO_VEN: 415 + 416 + item_count = ACPI_GET16(source); 417 + ACPI_SET16(destination) = (u16)item_count; 418 + 419 + aml_length = 420 + (u16)(aml_length + (info->value * item_count)); 421 + acpi_rs_set_resource_length(aml_length, aml); 422 + break; 423 + 424 + case ACPI_RSC_COUNT_GPIO_RES: 425 + 426 + /* Set resource source string length */ 427 + 428 + item_count = ACPI_GET16(source); 429 + ACPI_SET16(destination) = (u16)aml_length; 430 + 431 + /* Compute offset for the Vendor Data */ 432 + 433 + aml_length = (u16)(aml_length + item_count); 434 + target = ACPI_ADD_PTR(void, aml, info->value); 435 + 436 + /* Set vendor offset only if there is vendor data */ 437 + 438 + if (resource->data.gpio.vendor_length) { 439 + ACPI_SET16(target) = (u16)aml_length; 440 + } 441 + 442 + acpi_rs_set_resource_length(aml_length, aml); 443 + break; 444 + 445 + case ACPI_RSC_COUNT_SERIAL_VEN: 446 + 447 + item_count = ACPI_GET16(source); 448 + ACPI_SET16(destination) = item_count + info->value; 449 + aml_length = (u16)(aml_length + item_count); 450 + acpi_rs_set_resource_length(aml_length, aml); 451 + break; 452 + 453 + case ACPI_RSC_COUNT_SERIAL_RES: 454 + 455 + item_count = ACPI_GET16(source); 456 + aml_length = (u16)(aml_length + item_count); 457 + acpi_rs_set_resource_length(aml_length, aml); 458 + break; 459 + 561 460 case ACPI_RSC_LENGTH: 562 461 563 462 acpi_rs_set_resource_length(info->value, aml); ··· 628 413 if (info->value) { 629 414 item_count = info->value; 630 415 } 416 + acpi_rs_move_data(destination, source, item_count, 417 + info->opcode); 418 + break; 419 + 420 + case ACPI_RSC_MOVE_GPIO_PIN: 421 + 422 + destination = (char *)ACPI_ADD_PTR(void, aml, 423 + ACPI_GET16 424 + (destination)); 425 + source = *(u16 **)source; 426 + acpi_rs_move_data(destination, source, item_count, 427 + info->opcode); 428 + break; 429 + 430 + case ACPI_RSC_MOVE_GPIO_RES: 431 + 432 + /* Used for both resource_source string and vendor_data */ 433 + 434 + destination = (char *)ACPI_ADD_PTR(void, aml, 435 + ACPI_GET16 436 + (destination)); 437 + source = *(u8 **)source; 438 + acpi_rs_move_data(destination, source, item_count, 439 + info->opcode); 440 + break; 441 + 442 + case ACPI_RSC_MOVE_SERIAL_VEN: 443 + 444 + destination = (char *)ACPI_ADD_PTR(void, aml, 445 + (aml_length - 446 + item_count)); 447 + source = *(u8 **)source; 448 + acpi_rs_move_data(destination, source, item_count, 449 + info->opcode); 450 + break; 451 + 452 + case ACPI_RSC_MOVE_SERIAL_RES: 453 + 454 + destination = (char *)ACPI_ADD_PTR(void, aml, 455 + (aml_length - 456 + item_count)); 457 + source = *(u8 **)source; 631 458 acpi_rs_move_data(destination, source, item_count, 632 459 info->opcode); 633 460 break;
+441
drivers/acpi/acpica/rsserial.c
··· 1 + /******************************************************************************* 2 + * 3 + * Module Name: rsserial - GPIO/serial_bus resource descriptors 4 + * 5 + ******************************************************************************/ 6 + 7 + /* 8 + * Copyright (C) 2000 - 2011, 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[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)}, 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_2BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable), 79 + AML_OFFSET(gpio.int_flags), 80 + 3}, 81 + 82 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction), 83 + AML_OFFSET(gpio.int_flags), 84 + 0}, 85 + 86 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.triggering), 87 + AML_OFFSET(gpio.int_flags), 88 + 0}, 89 + 90 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.polarity), 91 + AML_OFFSET(gpio.int_flags), 92 + 1}, 93 + 94 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.pin_config), 95 + AML_OFFSET(gpio.pin_config), 96 + 1}, 97 + 98 + /* 99 + * These fields are contiguous in both the source and destination: 100 + * drive_strength 101 + * debounce_timeout 102 + */ 103 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.gpio.drive_strength), 104 + AML_OFFSET(gpio.drive_strength), 105 + 2}, 106 + 107 + /* Pin Table */ 108 + 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)}, 112 + 113 + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table), 114 + AML_OFFSET(gpio.pin_table_offset), 115 + 0}, 116 + 117 + /* Resource Source */ 118 + 119 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.resource_source.index), 120 + AML_OFFSET(gpio.res_source_index), 121 + 1}, 122 + 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)}, 127 + 128 + {ACPI_RSC_MOVE_GPIO_RES, 129 + ACPI_RS_OFFSET(data.gpio.resource_source.string_ptr), 130 + AML_OFFSET(gpio.res_source_offset), 131 + 0}, 132 + 133 + /* Vendor Data */ 134 + 135 + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.gpio.vendor_length), 136 + AML_OFFSET(gpio.vendor_length), 137 + 1}, 138 + 139 + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.gpio.vendor_data), 140 + AML_OFFSET(gpio.vendor_offset), 141 + 0}, 142 + }; 143 + 144 + /******************************************************************************* 145 + * 146 + * acpi_rs_convert_i2c_serial_bus 147 + * 148 + ******************************************************************************/ 149 + 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)}, 154 + 155 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, 156 + sizeof(struct aml_resource_i2c_serialbus), 157 + 0}, 158 + 159 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id), 160 + AML_OFFSET(common_serial_bus.revision_id), 161 + 1}, 162 + 163 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type), 164 + AML_OFFSET(common_serial_bus.type), 165 + 1}, 166 + 167 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode), 168 + AML_OFFSET(common_serial_bus.flags), 169 + 0}, 170 + 171 + {ACPI_RSC_1BITFLAG, 172 + ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer), 173 + AML_OFFSET(common_serial_bus.flags), 174 + 1}, 175 + 176 + {ACPI_RSC_MOVE8, 177 + ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), 178 + AML_OFFSET(common_serial_bus.type_revision_id), 179 + 1}, 180 + 181 + {ACPI_RSC_MOVE16, 182 + ACPI_RS_OFFSET(data.common_serial_bus.type_data_length), 183 + AML_OFFSET(common_serial_bus.type_data_length), 184 + 1}, 185 + 186 + /* Vendor data */ 187 + 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}, 192 + 193 + {ACPI_RSC_MOVE_SERIAL_VEN, 194 + ACPI_RS_OFFSET(data.common_serial_bus.vendor_data), 195 + 0, 196 + sizeof(struct aml_resource_i2c_serialbus)}, 197 + 198 + /* Resource Source */ 199 + 200 + {ACPI_RSC_MOVE8, 201 + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index), 202 + AML_OFFSET(common_serial_bus.res_source_index), 203 + 1}, 204 + 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)}, 209 + 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)}, 214 + 215 + /* I2C bus type specific */ 216 + 217 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode), 218 + AML_OFFSET(i2c_serial_bus.type_specific_flags), 219 + 0}, 220 + 221 + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed), 222 + AML_OFFSET(i2c_serial_bus.connection_speed), 223 + 1}, 224 + 225 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address), 226 + AML_OFFSET(i2c_serial_bus.slave_address), 227 + 1}, 228 + }; 229 + 230 + /******************************************************************************* 231 + * 232 + * acpi_rs_convert_spi_serial_bus 233 + * 234 + ******************************************************************************/ 235 + 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)}, 240 + 241 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, 242 + sizeof(struct aml_resource_spi_serialbus), 243 + 0}, 244 + 245 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id), 246 + AML_OFFSET(common_serial_bus.revision_id), 247 + 1}, 248 + 249 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type), 250 + AML_OFFSET(common_serial_bus.type), 251 + 1}, 252 + 253 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode), 254 + AML_OFFSET(common_serial_bus.flags), 255 + 0}, 256 + 257 + {ACPI_RSC_1BITFLAG, 258 + ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer), 259 + AML_OFFSET(common_serial_bus.flags), 260 + 1}, 261 + 262 + {ACPI_RSC_MOVE8, 263 + ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), 264 + AML_OFFSET(common_serial_bus.type_revision_id), 265 + 1}, 266 + 267 + {ACPI_RSC_MOVE16, 268 + ACPI_RS_OFFSET(data.common_serial_bus.type_data_length), 269 + AML_OFFSET(common_serial_bus.type_data_length), 270 + 1}, 271 + 272 + /* Vendor data */ 273 + 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}, 278 + 279 + {ACPI_RSC_MOVE_SERIAL_VEN, 280 + ACPI_RS_OFFSET(data.common_serial_bus.vendor_data), 281 + 0, 282 + sizeof(struct aml_resource_spi_serialbus)}, 283 + 284 + /* Resource Source */ 285 + 286 + {ACPI_RSC_MOVE8, 287 + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index), 288 + AML_OFFSET(common_serial_bus.res_source_index), 289 + 1}, 290 + 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)}, 295 + 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)}, 300 + 301 + /* Spi bus type specific */ 302 + 303 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode), 304 + AML_OFFSET(spi_serial_bus.type_specific_flags), 305 + 0}, 306 + 307 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity), 308 + AML_OFFSET(spi_serial_bus.type_specific_flags), 309 + 1}, 310 + 311 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length), 312 + AML_OFFSET(spi_serial_bus.data_bit_length), 313 + 1}, 314 + 315 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase), 316 + AML_OFFSET(spi_serial_bus.clock_phase), 317 + 1}, 318 + 319 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity), 320 + AML_OFFSET(spi_serial_bus.clock_polarity), 321 + 1}, 322 + 323 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection), 324 + AML_OFFSET(spi_serial_bus.device_selection), 325 + 1}, 326 + 327 + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed), 328 + AML_OFFSET(spi_serial_bus.connection_speed), 329 + 1}, 330 + }; 331 + 332 + /******************************************************************************* 333 + * 334 + * acpi_rs_convert_uart_serial_bus 335 + * 336 + ******************************************************************************/ 337 + 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)}, 342 + 343 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, 344 + sizeof(struct aml_resource_uart_serialbus), 345 + 0}, 346 + 347 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id), 348 + AML_OFFSET(common_serial_bus.revision_id), 349 + 1}, 350 + 351 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type), 352 + AML_OFFSET(common_serial_bus.type), 353 + 1}, 354 + 355 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode), 356 + AML_OFFSET(common_serial_bus.flags), 357 + 0}, 358 + 359 + {ACPI_RSC_1BITFLAG, 360 + ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer), 361 + AML_OFFSET(common_serial_bus.flags), 362 + 1}, 363 + 364 + {ACPI_RSC_MOVE8, 365 + ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), 366 + AML_OFFSET(common_serial_bus.type_revision_id), 367 + 1}, 368 + 369 + {ACPI_RSC_MOVE16, 370 + ACPI_RS_OFFSET(data.common_serial_bus.type_data_length), 371 + AML_OFFSET(common_serial_bus.type_data_length), 372 + 1}, 373 + 374 + /* Vendor data */ 375 + 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}, 380 + 381 + {ACPI_RSC_MOVE_SERIAL_VEN, 382 + ACPI_RS_OFFSET(data.common_serial_bus.vendor_data), 383 + 0, 384 + sizeof(struct aml_resource_uart_serialbus)}, 385 + 386 + /* Resource Source */ 387 + 388 + {ACPI_RSC_MOVE8, 389 + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index), 390 + AML_OFFSET(common_serial_bus.res_source_index), 391 + 1}, 392 + 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)}, 397 + 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)}, 402 + 403 + /* Uart bus type specific */ 404 + 405 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control), 406 + AML_OFFSET(uart_serial_bus.type_specific_flags), 407 + 0}, 408 + 409 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits), 410 + AML_OFFSET(uart_serial_bus.type_specific_flags), 411 + 2}, 412 + 413 + {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits), 414 + AML_OFFSET(uart_serial_bus.type_specific_flags), 415 + 4}, 416 + 417 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian), 418 + AML_OFFSET(uart_serial_bus.type_specific_flags), 419 + 7}, 420 + 421 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity), 422 + AML_OFFSET(uart_serial_bus.parity), 423 + 1}, 424 + 425 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled), 426 + AML_OFFSET(uart_serial_bus.lines_enabled), 427 + 1}, 428 + 429 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size), 430 + AML_OFFSET(uart_serial_bus.rx_fifo_size), 431 + 1}, 432 + 433 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size), 434 + AML_OFFSET(uart_serial_bus.tx_fifo_size), 435 + 1}, 436 + 437 + {ACPI_RSC_MOVE32, 438 + ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate), 439 + AML_OFFSET(uart_serial_bus.default_baud_rate), 440 + 1}, 441 + };
+4
drivers/acpi/acpica/rsutils.c
··· 144 144 * since there are no alignment or endian issues 145 145 */ 146 146 case ACPI_RSC_MOVE8: 147 + case ACPI_RSC_MOVE_GPIO_RES: 148 + case ACPI_RSC_MOVE_SERIAL_VEN: 149 + case ACPI_RSC_MOVE_SERIAL_RES: 147 150 ACPI_MEMCPY(destination, source, item_count); 148 151 return; 149 152 ··· 156 153 * misaligned memory transfers 157 154 */ 158 155 case ACPI_RSC_MOVE16: 156 + case ACPI_RSC_MOVE_GPIO_PIN: 159 157 ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i], 160 158 &ACPI_CAST_PTR(u16, source)[i]); 161 159 break;
+242 -34
drivers/acpi/acpica/utresrc.c
··· 43 43 44 44 #include <acpi/acpi.h> 45 45 #include "accommon.h" 46 - #include "amlresrc.h" 46 + #include "acresrc.h" 47 47 48 48 #define _COMPONENT ACPI_UTILITIES 49 49 ACPI_MODULE_NAME("utresrc") ··· 154 154 "TypeF" 155 155 }; 156 156 157 + const char *acpi_gbl_ppc_decode[] = { 158 + "PullDefault", 159 + "PullUp", 160 + "PullDown", 161 + "PullNone" 162 + }; 163 + 164 + const char *acpi_gbl_ior_decode[] = { 165 + "IoRestrictionNone", 166 + "IoRestrictionInputOnly", 167 + "IoRestrictionOutputOnly", 168 + "IoRestrictionNoneAndPreserve" 169 + }; 170 + 171 + const char *acpi_gbl_dts_decode[] = { 172 + "Width8bit", 173 + "Width16bit", 174 + "Width32bit", 175 + "Width64bit", 176 + "Width128bit", 177 + "Width256bit", 178 + }; 179 + 180 + /* GPIO connection type */ 181 + 182 + const char *acpi_gbl_ct_decode[] = { 183 + "Interrupt", 184 + "I/O" 185 + }; 186 + 187 + /* Serial bus type */ 188 + 189 + const char *acpi_gbl_sbt_decode[] = { 190 + "/* UNKNOWN serial bus type */", 191 + "I2C", 192 + "SPI", 193 + "UART" 194 + }; 195 + 196 + /* I2C serial bus access mode */ 197 + 198 + const char *acpi_gbl_am_decode[] = { 199 + "AddressingMode7Bit", 200 + "AddressingMode10Bit" 201 + }; 202 + 203 + /* I2C serial bus slave mode */ 204 + 205 + const char *acpi_gbl_sm_decode[] = { 206 + "ControllerInitiated", 207 + "DeviceInitiated" 208 + }; 209 + 210 + /* SPI serial bus wire mode */ 211 + 212 + const char *acpi_gbl_wm_decode[] = { 213 + "FourWireMode", 214 + "ThreeWireMode" 215 + }; 216 + 217 + /* SPI serial clock phase */ 218 + 219 + const char *acpi_gbl_cph_decode[] = { 220 + "ClockPhaseFirst", 221 + "ClockPhaseSecond" 222 + }; 223 + 224 + /* SPI serial bus clock polarity */ 225 + 226 + const char *acpi_gbl_cpo_decode[] = { 227 + "ClockPolarityLow", 228 + "ClockPolarityHigh" 229 + }; 230 + 231 + /* SPI serial bus device polarity */ 232 + 233 + const char *acpi_gbl_dp_decode[] = { 234 + "PolarityLow", 235 + "PolarityHigh" 236 + }; 237 + 238 + /* UART serial bus endian */ 239 + 240 + const char *acpi_gbl_ed_decode[] = { 241 + "LittleEndian", 242 + "BigEndian" 243 + }; 244 + 245 + /* UART serial bus bits per byte */ 246 + 247 + const char *acpi_gbl_bpb_decode[] = { 248 + "DataBitsFive", 249 + "DataBitsSix", 250 + "DataBitsSeven", 251 + "DataBitsEight", 252 + "DataBitsNine", 253 + "/* UNKNOWN Bits per byte */", 254 + "/* UNKNOWN Bits per byte */", 255 + "/* UNKNOWN Bits per byte */" 256 + }; 257 + 258 + /* UART serial bus stop bits */ 259 + 260 + const char *acpi_gbl_sb_decode[] = { 261 + "StopBitsNone", 262 + "StopBitsOne", 263 + "StopBitsOnePlusHalf", 264 + "StopBitsTwo" 265 + }; 266 + 267 + /* UART serial bus flow control */ 268 + 269 + const char *acpi_gbl_fc_decode[] = { 270 + "FlowControlNone", 271 + "FlowControlHardware", 272 + "FlowControlXON", 273 + "/* UNKNOWN flow control keyword */" 274 + }; 275 + 276 + /* UART serial bus parity type */ 277 + 278 + const char *acpi_gbl_pt_decode[] = { 279 + "ParityTypeNone", 280 + "ParityTypeEven", 281 + "ParityTypeOdd", 282 + "ParityTypeMark", 283 + "ParityTypeSpace", 284 + "/* UNKNOWN parity keyword */", 285 + "/* UNKNOWN parity keyword */", 286 + "/* UNKNOWN parity keyword */" 287 + }; 288 + 157 289 #endif 158 290 159 291 /* ··· 305 173 ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent), 306 174 ACPI_AML_SIZE_SMALL(struct aml_resource_io), 307 175 ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io), 308 - 0, 176 + ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_dma), 309 177 0, 310 178 0, 311 179 0, ··· 325 193 ACPI_AML_SIZE_LARGE(struct aml_resource_address16), 326 194 ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq), 327 195 ACPI_AML_SIZE_LARGE(struct aml_resource_address64), 328 - ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64) 196 + ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64), 197 + ACPI_AML_SIZE_LARGE(struct aml_resource_gpio), 198 + 0, 199 + ACPI_AML_SIZE_LARGE(struct aml_resource_common_serialbus), 200 + }; 201 + 202 + const u8 acpi_gbl_resource_aml_serial_bus_sizes[] = { 203 + 0, 204 + ACPI_AML_SIZE_LARGE(struct aml_resource_i2c_serialbus), 205 + ACPI_AML_SIZE_LARGE(struct aml_resource_spi_serialbus), 206 + ACPI_AML_SIZE_LARGE(struct aml_resource_uart_serialbus), 329 207 }; 330 208 331 209 /* ··· 351 209 0, 352 210 0, 353 211 0, 354 - ACPI_SMALL_VARIABLE_LENGTH, 355 - ACPI_FIXED_LENGTH, 356 - ACPI_SMALL_VARIABLE_LENGTH, 357 - ACPI_FIXED_LENGTH, 358 - ACPI_FIXED_LENGTH, 359 - ACPI_FIXED_LENGTH, 212 + ACPI_SMALL_VARIABLE_LENGTH, /* 04 IRQ */ 213 + ACPI_FIXED_LENGTH, /* 05 DMA */ 214 + ACPI_SMALL_VARIABLE_LENGTH, /* 06 start_dependent_functions */ 215 + ACPI_FIXED_LENGTH, /* 07 end_dependent_functions */ 216 + ACPI_FIXED_LENGTH, /* 08 IO */ 217 + ACPI_FIXED_LENGTH, /* 09 fixed_iO */ 218 + ACPI_FIXED_LENGTH, /* 0_a fixed_dMA */ 360 219 0, 361 220 0, 362 221 0, 363 - 0, 364 - ACPI_VARIABLE_LENGTH, 365 - ACPI_FIXED_LENGTH, 222 + ACPI_VARIABLE_LENGTH, /* 0_e vendor_short */ 223 + ACPI_FIXED_LENGTH, /* 0_f end_tag */ 366 224 367 225 /* Large descriptors */ 368 226 369 227 0, 370 - ACPI_FIXED_LENGTH, 371 - ACPI_FIXED_LENGTH, 228 + ACPI_FIXED_LENGTH, /* 01 Memory24 */ 229 + ACPI_FIXED_LENGTH, /* 02 generic_register */ 372 230 0, 373 - ACPI_VARIABLE_LENGTH, 374 - ACPI_FIXED_LENGTH, 375 - ACPI_FIXED_LENGTH, 376 - ACPI_VARIABLE_LENGTH, 377 - ACPI_VARIABLE_LENGTH, 378 - ACPI_VARIABLE_LENGTH, 379 - ACPI_VARIABLE_LENGTH, 380 - ACPI_FIXED_LENGTH 231 + ACPI_VARIABLE_LENGTH, /* 04 vendor_long */ 232 + ACPI_FIXED_LENGTH, /* 05 Memory32 */ 233 + ACPI_FIXED_LENGTH, /* 06 memory32_fixed */ 234 + ACPI_VARIABLE_LENGTH, /* 07 Dword* address */ 235 + ACPI_VARIABLE_LENGTH, /* 08 Word* address */ 236 + ACPI_VARIABLE_LENGTH, /* 09 extended_iRQ */ 237 + ACPI_VARIABLE_LENGTH, /* 0_a Qword* address */ 238 + ACPI_FIXED_LENGTH, /* 0_b Extended* address */ 239 + ACPI_VARIABLE_LENGTH, /* 0_c Gpio* */ 240 + 0, 241 + ACPI_VARIABLE_LENGTH /* 0_e *serial_bus */ 381 242 }; 243 + 244 + /* 245 + * For the i_aSL compiler/disassembler, we don't want any error messages 246 + * because the disassembler uses the resource validation code to determine 247 + * if Buffer objects are actually Resource Templates. 248 + */ 249 + #ifdef ACPI_ASL_COMPILER 250 + #define ACPI_RESOURCE_ERROR(plist) 251 + #else 252 + #define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist) 253 + #endif 382 254 383 255 /******************************************************************************* 384 256 * ··· 421 265 u8 resource_index; 422 266 u32 length; 423 267 u32 offset = 0; 268 + u8 end_tag[2] = { 0x79, 0x00 }; 424 269 425 270 ACPI_FUNCTION_TRACE(ut_walk_aml_resources); 426 271 ··· 443 286 444 287 status = acpi_ut_validate_resource(aml, &resource_index); 445 288 if (ACPI_FAILURE(status)) { 289 + /* 290 + * Exit on failure. Cannot continue because the descriptor length 291 + * may be bogus also. 292 + */ 446 293 return_ACPI_STATUS(status); 447 294 } 448 295 ··· 461 300 user_function(aml, length, offset, resource_index, 462 301 context); 463 302 if (ACPI_FAILURE(status)) { 464 - return (status); 303 + return_ACPI_STATUS(status); 465 304 } 466 305 } 467 306 ··· 494 333 495 334 /* Did not find an end_tag descriptor */ 496 335 497 - return (AE_AML_NO_RESOURCE_END_TAG); 336 + if (user_function) { 337 + 338 + /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */ 339 + 340 + (void)acpi_ut_validate_resource(end_tag, &resource_index); 341 + status = 342 + user_function(end_tag, 2, offset, resource_index, context); 343 + if (ACPI_FAILURE(status)) { 344 + return_ACPI_STATUS(status); 345 + } 346 + } 347 + 348 + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); 498 349 } 499 350 500 351 /******************************************************************************* ··· 527 354 528 355 acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) 529 356 { 357 + union aml_resource *aml_resource; 530 358 u8 resource_type; 531 359 u8 resource_index; 532 360 acpi_rs_length resource_length; ··· 549 375 /* Verify the large resource type (name) against the max */ 550 376 551 377 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { 552 - return (AE_AML_INVALID_RESOURCE_TYPE); 378 + goto invalid_resource; 553 379 } 554 380 555 381 /* ··· 566 392 ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); 567 393 } 568 394 569 - /* Check validity of the resource type, zero indicates name is invalid */ 570 - 395 + /* 396 + * Check validity of the resource type, via acpi_gbl_resource_types. Zero 397 + * indicates an invalid resource. 398 + */ 571 399 if (!acpi_gbl_resource_types[resource_index]) { 572 - return (AE_AML_INVALID_RESOURCE_TYPE); 400 + goto invalid_resource; 573 401 } 574 402 575 403 /* 576 - * 2) Validate the resource_length field. This ensures that the length 577 - * is at least reasonable, and guarantees that it is non-zero. 404 + * Validate the resource_length field. This ensures that the length 405 + * is at least reasonable, and guarantees that it is non-zero. 578 406 */ 579 407 resource_length = acpi_ut_get_resource_length(aml); 580 408 minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index]; ··· 589 413 /* Fixed length resource, length must match exactly */ 590 414 591 415 if (resource_length != minimum_resource_length) { 592 - return (AE_AML_BAD_RESOURCE_LENGTH); 416 + goto bad_resource_length; 593 417 } 594 418 break; 595 419 ··· 598 422 /* Variable length resource, length must be at least the minimum */ 599 423 600 424 if (resource_length < minimum_resource_length) { 601 - return (AE_AML_BAD_RESOURCE_LENGTH); 425 + goto bad_resource_length; 602 426 } 603 427 break; 604 428 ··· 608 432 609 433 if ((resource_length > minimum_resource_length) || 610 434 (resource_length < (minimum_resource_length - 1))) { 611 - return (AE_AML_BAD_RESOURCE_LENGTH); 435 + goto bad_resource_length; 612 436 } 613 437 break; 614 438 ··· 616 440 617 441 /* Shouldn't happen (because of validation earlier), but be sure */ 618 442 619 - return (AE_AML_INVALID_RESOURCE_TYPE); 443 + goto invalid_resource; 444 + } 445 + 446 + aml_resource = ACPI_CAST_PTR(union aml_resource, aml); 447 + if (resource_type == ACPI_RESOURCE_NAME_SERIAL_BUS) { 448 + 449 + /* Validate the bus_type field */ 450 + 451 + if ((aml_resource->common_serial_bus.type == 0) || 452 + (aml_resource->common_serial_bus.type > 453 + AML_RESOURCE_MAX_SERIALBUSTYPE)) { 454 + ACPI_RESOURCE_ERROR((AE_INFO, 455 + "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", 456 + aml_resource->common_serial_bus. 457 + type)); 458 + return (AE_AML_INVALID_RESOURCE_TYPE); 459 + } 620 460 } 621 461 622 462 /* Optionally return the resource table index */ ··· 642 450 } 643 451 644 452 return (AE_OK); 453 + 454 + invalid_resource: 455 + 456 + ACPI_RESOURCE_ERROR((AE_INFO, 457 + "Invalid/unsupported resource descriptor: Type 0x%2.2X", 458 + resource_type)); 459 + return (AE_AML_INVALID_RESOURCE_TYPE); 460 + 461 + bad_resource_length: 462 + 463 + ACPI_RESOURCE_ERROR((AE_INFO, 464 + "Invalid resource descriptor length: Type " 465 + "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", 466 + resource_type, resource_length, 467 + minimum_resource_length)); 468 + return (AE_AML_BAD_RESOURCE_LENGTH); 645 469 } 646 470 647 471 /*******************************************************************************
+203 -4
include/acpi/acrestyp.h
··· 61 61 #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 62 62 #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 63 63 64 + /*! [Begin] no source code translation */ 64 65 /* 65 66 * IO Attributes 66 - * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. 67 - * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. 67 + * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. 68 + * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. 68 69 */ 70 + /*! [End] no source code translation !*/ 71 + 69 72 #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 70 73 #define ACPI_ISA_ONLY_RANGES (u8) 0x02 71 74 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) ··· 84 81 #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ 85 82 86 83 /* 87 - * IRQ Attributes 84 + * Interrupt attributes - used in multiple descriptors 88 85 */ 86 + 87 + /* Triggering */ 88 + 89 89 #define ACPI_LEVEL_SENSITIVE (u8) 0x00 90 90 #define ACPI_EDGE_SENSITIVE (u8) 0x01 91 91 92 + /* Polarity */ 93 + 92 94 #define ACPI_ACTIVE_HIGH (u8) 0x00 93 95 #define ACPI_ACTIVE_LOW (u8) 0x01 96 + #define ACPI_ACTIVE_BOTH (u8) 0x02 97 + 98 + /* Sharing */ 94 99 95 100 #define ACPI_EXCLUSIVE (u8) 0x00 96 101 #define ACPI_SHARED (u8) 0x01 102 + #define ACPI_EXCLUSIVE_AND_WAKE (u8) 0x02 103 + #define ACPI_SHARED_AND_WAKE (u8) 0x03 97 104 98 105 /* 99 106 * DMA Attributes ··· 139 126 140 127 #define ACPI_POS_DECODE (u8) 0x00 141 128 #define ACPI_SUB_DECODE (u8) 0x01 129 + 130 + /* Producer/Consumer */ 142 131 143 132 #define ACPI_PRODUCER (u8) 0x00 144 133 #define ACPI_CONSUMER (u8) 0x01 ··· 206 191 u16 address; 207 192 u8 address_length; 208 193 }; 194 + 195 + struct acpi_resource_fixed_dma { 196 + u16 request_lines; 197 + u16 channels; 198 + u8 width; 199 + }; 200 + 201 + /* Values for Width field above */ 202 + 203 + #define ACPI_DMA_WIDTH8 0 204 + #define ACPI_DMA_WIDTH16 1 205 + #define ACPI_DMA_WIDTH32 2 206 + #define ACPI_DMA_WIDTH64 3 207 + #define ACPI_DMA_WIDTH128 4 208 + #define ACPI_DMA_WIDTH256 5 209 209 210 210 struct acpi_resource_vendor { 211 211 u16 byte_length; ··· 359 329 u64 address; 360 330 }; 361 331 332 + struct acpi_resource_gpio { 333 + u8 revision_id; 334 + u8 connection_type; 335 + u8 producer_consumer; /* For values, see Producer/Consumer above */ 336 + u8 pin_config; 337 + u8 sharable; /* For values, see Interrupt Attributes above */ 338 + u8 io_restriction; 339 + u8 triggering; /* For values, see Interrupt Attributes above */ 340 + u8 polarity; /* For values, see Interrupt Attributes above */ 341 + u16 drive_strength; 342 + u16 debounce_timeout; 343 + u16 pin_table_length; 344 + u16 vendor_length; 345 + struct acpi_resource_source resource_source; 346 + u16 *pin_table; 347 + u8 *vendor_data; 348 + }; 349 + 350 + /* Values for GPIO connection_type field above */ 351 + 352 + #define ACPI_RESOURCE_GPIO_TYPE_INT 0 353 + #define ACPI_RESOURCE_GPIO_TYPE_IO 1 354 + 355 + /* Values for pin_config field above */ 356 + 357 + #define ACPI_PIN_CONFIG_DEFAULT 0 358 + #define ACPI_PIN_CONFIG_PULLUP 1 359 + #define ACPI_PIN_CONFIG_PULLDOWN 2 360 + #define ACPI_PIN_CONFIG_NOPULL 3 361 + 362 + /* Values for io_restriction field above */ 363 + 364 + #define ACPI_IO_RESTRICT_NONE 0 365 + #define ACPI_IO_RESTRICT_INPUT 1 366 + #define ACPI_IO_RESTRICT_OUTPUT 2 367 + #define ACPI_IO_RESTRICT_NONE_PRESERVE 3 368 + 369 + /* Common structure for I2C, SPI, and UART serial descriptors */ 370 + 371 + #define ACPI_RESOURCE_SERIAL_COMMON \ 372 + u8 revision_id; \ 373 + u8 type; \ 374 + u8 producer_consumer; /* For values, see Producer/Consumer above */\ 375 + u8 slave_mode; \ 376 + u8 type_revision_id; \ 377 + u16 type_data_length; \ 378 + u16 vendor_length; \ 379 + struct acpi_resource_source resource_source; \ 380 + u8 *vendor_data; 381 + 382 + struct acpi_resource_common_serialbus { 383 + ACPI_RESOURCE_SERIAL_COMMON}; 384 + 385 + /* Values for the Type field above */ 386 + 387 + #define ACPI_RESOURCE_SERIAL_TYPE_I2C 1 388 + #define ACPI_RESOURCE_SERIAL_TYPE_SPI 2 389 + #define ACPI_RESOURCE_SERIAL_TYPE_UART 3 390 + 391 + /* Values for slave_mode field above */ 392 + 393 + #define ACPI_CONTROLLER_INITIATED 0 394 + #define ACPI_DEVICE_INITIATED 1 395 + 396 + struct acpi_resource_i2c_serialbus { 397 + ACPI_RESOURCE_SERIAL_COMMON u8 access_mode; 398 + u16 slave_address; 399 + u32 connection_speed; 400 + }; 401 + 402 + /* Values for access_mode field above */ 403 + 404 + #define ACPI_I2C_7BIT_MODE 0 405 + #define ACPI_I2C_10BIT_MODE 1 406 + 407 + struct acpi_resource_spi_serialbus { 408 + ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode; 409 + u8 device_polarity; 410 + u8 data_bit_length; 411 + u8 clock_phase; 412 + u8 clock_polarity; 413 + u16 device_selection; 414 + u32 connection_speed; 415 + }; 416 + 417 + /* Values for wire_mode field above */ 418 + 419 + #define ACPI_SPI_4WIRE_MODE 0 420 + #define ACPI_SPI_3WIRE_MODE 1 421 + 422 + /* Values for device_polarity field above */ 423 + 424 + #define ACPI_SPI_ACTIVE_LOW 0 425 + #define ACPI_SPI_ACTIVE_HIGH 1 426 + 427 + /* Values for clock_phase field above */ 428 + 429 + #define ACPI_SPI_FIRST_PHASE 0 430 + #define ACPI_SPI_SECOND_PHASE 1 431 + 432 + /* Values for clock_polarity field above */ 433 + 434 + #define ACPI_SPI_START_LOW 0 435 + #define ACPI_SPI_START_HIGH 1 436 + 437 + struct acpi_resource_uart_serialbus { 438 + ACPI_RESOURCE_SERIAL_COMMON u8 endian; 439 + u8 data_bits; 440 + u8 stop_bits; 441 + u8 flow_control; 442 + u8 parity; 443 + u8 lines_enabled; 444 + u16 rx_fifo_size; 445 + u16 tx_fifo_size; 446 + u32 default_baud_rate; 447 + }; 448 + 449 + /* Values for Endian field above */ 450 + 451 + #define ACPI_UART_LITTLE_ENDIAN 0 452 + #define ACPI_UART_BIG_ENDIAN 1 453 + 454 + /* Values for data_bits field above */ 455 + 456 + #define ACPI_UART_5_DATA_BITS 0 457 + #define ACPI_UART_6_DATA_BITS 1 458 + #define ACPI_UART_7_DATA_BITS 2 459 + #define ACPI_UART_8_DATA_BITS 3 460 + #define ACPI_UART_9_DATA_BITS 4 461 + 462 + /* Values for stop_bits field above */ 463 + 464 + #define ACPI_UART_NO_STOP_BITS 0 465 + #define ACPI_UART_1_STOP_BIT 1 466 + #define ACPI_UART_1P5_STOP_BITS 2 467 + #define ACPI_UART_2_STOP_BITS 3 468 + 469 + /* Values for flow_control field above */ 470 + 471 + #define ACPI_UART_FLOW_CONTROL_NONE 0 472 + #define ACPI_UART_FLOW_CONTROL_HW 1 473 + #define ACPI_UART_FLOW_CONTROL_XON_XOFF 2 474 + 475 + /* Values for Parity field above */ 476 + 477 + #define ACPI_UART_PARITY_NONE 0 478 + #define ACPI_UART_PARITY_EVEN 1 479 + #define ACPI_UART_PARITY_ODD 2 480 + #define ACPI_UART_PARITY_MARK 3 481 + #define ACPI_UART_PARITY_SPACE 4 482 + 483 + /* Values for lines_enabled bitfield above */ 484 + 485 + #define ACPI_UART_CARRIER_DETECT (1<<2) 486 + #define ACPI_UART_RING_INDICATOR (1<<3) 487 + #define ACPI_UART_DATA_SET_READY (1<<4) 488 + #define ACPI_UART_DATA_TERMINAL_READY (1<<5) 489 + #define ACPI_UART_CLEAR_TO_SEND (1<<6) 490 + #define ACPI_UART_REQUEST_TO_SEND (1<<7) 491 + 362 492 /* ACPI_RESOURCE_TYPEs */ 363 493 364 494 #define ACPI_RESOURCE_TYPE_IRQ 0 ··· 538 348 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ 539 349 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 540 350 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 541 - #define ACPI_RESOURCE_TYPE_MAX 16 351 + #define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */ 352 + #define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */ 353 + #define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */ 354 + #define ACPI_RESOURCE_TYPE_MAX 19 542 355 543 356 /* Master union for resource descriptors */ 544 357 ··· 551 358 struct acpi_resource_start_dependent start_dpf; 552 359 struct acpi_resource_io io; 553 360 struct acpi_resource_fixed_io fixed_io; 361 + struct acpi_resource_fixed_dma fixed_dma; 554 362 struct acpi_resource_vendor vendor; 555 363 struct acpi_resource_vendor_typed vendor_typed; 556 364 struct acpi_resource_end_tag end_tag; ··· 564 370 struct acpi_resource_extended_address64 ext_address64; 565 371 struct acpi_resource_extended_irq extended_irq; 566 372 struct acpi_resource_generic_register generic_reg; 373 + struct acpi_resource_gpio gpio; 374 + struct acpi_resource_i2c_serialbus i2c_serial_bus; 375 + struct acpi_resource_spi_serialbus spi_serial_bus; 376 + struct acpi_resource_uart_serialbus uart_serial_bus; 377 + struct acpi_resource_common_serialbus common_serial_bus; 567 378 568 379 /* Common fields */ 569 380