Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Name: acrestyp.h - Defines, types, and structures for resource descriptors |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | 7735ca0 | 2017-02-08 11:00:08 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2017, Intel Corp. |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 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 | #ifndef __ACRESTYP_H__ |
| 45 | #define __ACRESTYP_H__ |
| 46 | |
| 47 | /* |
| 48 | * Definitions for Resource Attributes |
| 49 | */ |
| 50 | typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 51 | typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */ |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 52 | |
| 53 | /* |
| 54 | * Memory Attributes |
| 55 | */ |
| 56 | #define ACPI_READ_ONLY_MEMORY (u8) 0x00 |
| 57 | #define ACPI_READ_WRITE_MEMORY (u8) 0x01 |
| 58 | |
| 59 | #define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00 |
| 60 | #define ACPI_CACHABLE_MEMORY (u8) 0x01 |
| 61 | #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 |
| 62 | #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 |
| 63 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 64 | /*! [Begin] no source code translation */ |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 65 | /* |
| 66 | * IO Attributes |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 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. |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 69 | */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 70 | /*! [End] no source code translation !*/ |
| 71 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 72 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 |
| 73 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 |
| 74 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) |
| 75 | |
| 76 | /* Type of translation - 1=Sparse, 0=Dense */ |
| 77 | |
| 78 | #define ACPI_SPARSE_TRANSLATION (u8) 0x01 |
| 79 | |
| 80 | /* |
| 81 | * IO Port Descriptor Decode |
| 82 | */ |
| 83 | #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ |
| 84 | #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ |
| 85 | |
| 86 | /* |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 87 | * Interrupt attributes - used in multiple descriptors |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 88 | */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 89 | |
| 90 | /* Triggering */ |
| 91 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 92 | #define ACPI_LEVEL_SENSITIVE (u8) 0x00 |
| 93 | #define ACPI_EDGE_SENSITIVE (u8) 0x01 |
| 94 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 95 | /* Polarity */ |
| 96 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 97 | #define ACPI_ACTIVE_HIGH (u8) 0x00 |
| 98 | #define ACPI_ACTIVE_LOW (u8) 0x01 |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 99 | #define ACPI_ACTIVE_BOTH (u8) 0x02 |
| 100 | |
| 101 | /* Sharing */ |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 102 | |
| 103 | #define ACPI_EXCLUSIVE (u8) 0x00 |
| 104 | #define ACPI_SHARED (u8) 0x01 |
Bob Moore | 9cea624 | 2012-12-31 00:07:31 +0000 | [diff] [blame] | 105 | |
| 106 | /* Wake */ |
| 107 | |
| 108 | #define ACPI_NOT_WAKE_CAPABLE (u8) 0x00 |
| 109 | #define ACPI_WAKE_CAPABLE (u8) 0x01 |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 110 | |
| 111 | /* |
| 112 | * DMA Attributes |
| 113 | */ |
| 114 | #define ACPI_COMPATIBILITY (u8) 0x00 |
| 115 | #define ACPI_TYPE_A (u8) 0x01 |
| 116 | #define ACPI_TYPE_B (u8) 0x02 |
| 117 | #define ACPI_TYPE_F (u8) 0x03 |
| 118 | |
| 119 | #define ACPI_NOT_BUS_MASTER (u8) 0x00 |
| 120 | #define ACPI_BUS_MASTER (u8) 0x01 |
| 121 | |
| 122 | #define ACPI_TRANSFER_8 (u8) 0x00 |
| 123 | #define ACPI_TRANSFER_8_16 (u8) 0x01 |
| 124 | #define ACPI_TRANSFER_16 (u8) 0x02 |
| 125 | |
| 126 | /* |
| 127 | * Start Dependent Functions Priority definitions |
| 128 | */ |
| 129 | #define ACPI_GOOD_CONFIGURATION (u8) 0x00 |
| 130 | #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01 |
| 131 | #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02 |
| 132 | |
| 133 | /* |
| 134 | * 16, 32 and 64-bit Address Descriptor resource types |
| 135 | */ |
| 136 | #define ACPI_MEMORY_RANGE (u8) 0x00 |
| 137 | #define ACPI_IO_RANGE (u8) 0x01 |
| 138 | #define ACPI_BUS_NUMBER_RANGE (u8) 0x02 |
| 139 | |
| 140 | #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00 |
| 141 | #define ACPI_ADDRESS_FIXED (u8) 0x01 |
| 142 | |
| 143 | #define ACPI_POS_DECODE (u8) 0x00 |
| 144 | #define ACPI_SUB_DECODE (u8) 0x01 |
| 145 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 146 | /* Producer/Consumer */ |
| 147 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 148 | #define ACPI_PRODUCER (u8) 0x00 |
| 149 | #define ACPI_CONSUMER (u8) 0x01 |
| 150 | |
| 151 | /* |
| 152 | * If possible, pack the following structures to byte alignment |
| 153 | */ |
| 154 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
| 155 | #pragma pack(1) |
| 156 | #endif |
| 157 | |
| 158 | /* UUID data structures for use in vendor-defined resource descriptors */ |
| 159 | |
| 160 | struct acpi_uuid { |
| 161 | u8 data[ACPI_UUID_LENGTH]; |
| 162 | }; |
| 163 | |
| 164 | struct acpi_vendor_uuid { |
| 165 | u8 subtype; |
| 166 | u8 data[ACPI_UUID_LENGTH]; |
| 167 | }; |
| 168 | |
| 169 | /* |
| 170 | * Structures used to describe device resources |
| 171 | */ |
| 172 | struct acpi_resource_irq { |
| 173 | u8 descriptor_length; |
| 174 | u8 triggering; |
| 175 | u8 polarity; |
| 176 | u8 sharable; |
Bob Moore | 9cea624 | 2012-12-31 00:07:31 +0000 | [diff] [blame] | 177 | u8 wake_capable; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 178 | u8 interrupt_count; |
| 179 | u8 interrupts[1]; |
| 180 | }; |
| 181 | |
| 182 | struct acpi_resource_dma { |
| 183 | u8 type; |
| 184 | u8 bus_master; |
| 185 | u8 transfer; |
| 186 | u8 channel_count; |
| 187 | u8 channels[1]; |
| 188 | }; |
| 189 | |
| 190 | struct acpi_resource_start_dependent { |
| 191 | u8 descriptor_length; |
| 192 | u8 compatibility_priority; |
| 193 | u8 performance_robustness; |
| 194 | }; |
| 195 | |
| 196 | /* |
| 197 | * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not |
| 198 | * needed because it has no fields |
| 199 | */ |
| 200 | |
| 201 | struct acpi_resource_io { |
| 202 | u8 io_decode; |
| 203 | u8 alignment; |
| 204 | u8 address_length; |
| 205 | u16 minimum; |
| 206 | u16 maximum; |
| 207 | }; |
| 208 | |
| 209 | struct acpi_resource_fixed_io { |
| 210 | u16 address; |
| 211 | u8 address_length; |
| 212 | }; |
| 213 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 214 | struct acpi_resource_fixed_dma { |
| 215 | u16 request_lines; |
| 216 | u16 channels; |
| 217 | u8 width; |
| 218 | }; |
| 219 | |
| 220 | /* Values for Width field above */ |
| 221 | |
| 222 | #define ACPI_DMA_WIDTH8 0 |
| 223 | #define ACPI_DMA_WIDTH16 1 |
| 224 | #define ACPI_DMA_WIDTH32 2 |
| 225 | #define ACPI_DMA_WIDTH64 3 |
| 226 | #define ACPI_DMA_WIDTH128 4 |
| 227 | #define ACPI_DMA_WIDTH256 5 |
| 228 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 229 | struct acpi_resource_vendor { |
| 230 | u16 byte_length; |
| 231 | u8 byte_data[1]; |
| 232 | }; |
| 233 | |
| 234 | /* Vendor resource with UUID info (introduced in ACPI 3.0) */ |
| 235 | |
| 236 | struct acpi_resource_vendor_typed { |
| 237 | u16 byte_length; |
| 238 | u8 uuid_subtype; |
| 239 | u8 uuid[ACPI_UUID_LENGTH]; |
| 240 | u8 byte_data[1]; |
| 241 | }; |
| 242 | |
| 243 | struct acpi_resource_end_tag { |
| 244 | u8 checksum; |
| 245 | }; |
| 246 | |
| 247 | struct acpi_resource_memory24 { |
| 248 | u8 write_protect; |
| 249 | u16 minimum; |
| 250 | u16 maximum; |
| 251 | u16 alignment; |
| 252 | u16 address_length; |
| 253 | }; |
| 254 | |
| 255 | struct acpi_resource_memory32 { |
| 256 | u8 write_protect; |
| 257 | u32 minimum; |
| 258 | u32 maximum; |
| 259 | u32 alignment; |
| 260 | u32 address_length; |
| 261 | }; |
| 262 | |
| 263 | struct acpi_resource_fixed_memory32 { |
| 264 | u8 write_protect; |
| 265 | u32 address; |
| 266 | u32 address_length; |
| 267 | }; |
| 268 | |
| 269 | struct acpi_memory_attribute { |
| 270 | u8 write_protect; |
| 271 | u8 caching; |
| 272 | u8 range_type; |
| 273 | u8 translation; |
| 274 | }; |
| 275 | |
| 276 | struct acpi_io_attribute { |
| 277 | u8 range_type; |
| 278 | u8 translation; |
| 279 | u8 translation_type; |
| 280 | u8 reserved1; |
| 281 | }; |
| 282 | |
| 283 | union acpi_resource_attribute { |
| 284 | struct acpi_memory_attribute mem; |
| 285 | struct acpi_io_attribute io; |
| 286 | |
| 287 | /* Used for the *word_space macros */ |
| 288 | |
| 289 | u8 type_specific; |
| 290 | }; |
| 291 | |
Mika Westerberg | fdaa098 | 2017-06-05 16:39:25 +0800 | [diff] [blame] | 292 | struct acpi_resource_label { |
| 293 | u16 string_length; |
| 294 | char *string_ptr; |
| 295 | }; |
| 296 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 297 | struct acpi_resource_source { |
| 298 | u8 index; |
| 299 | u16 string_length; |
| 300 | char *string_ptr; |
| 301 | }; |
| 302 | |
| 303 | /* Fields common to all address descriptors, 16/32/64 bit */ |
| 304 | |
| 305 | #define ACPI_RESOURCE_ADDRESS_COMMON \ |
| 306 | u8 resource_type; \ |
| 307 | u8 producer_consumer; \ |
| 308 | u8 decode; \ |
| 309 | u8 min_address_fixed; \ |
| 310 | u8 max_address_fixed; \ |
| 311 | union acpi_resource_attribute info; |
| 312 | |
Lv Zheng | a45de93 | 2015-01-26 16:58:56 +0800 | [diff] [blame] | 313 | struct acpi_address16_attribute { |
| 314 | u16 granularity; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 315 | u16 minimum; |
| 316 | u16 maximum; |
| 317 | u16 translation_offset; |
| 318 | u16 address_length; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 319 | }; |
| 320 | |
Lv Zheng | a45de93 | 2015-01-26 16:58:56 +0800 | [diff] [blame] | 321 | struct acpi_address32_attribute { |
| 322 | u32 granularity; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 323 | u32 minimum; |
| 324 | u32 maximum; |
| 325 | u32 translation_offset; |
| 326 | u32 address_length; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 327 | }; |
| 328 | |
Lv Zheng | a45de93 | 2015-01-26 16:58:56 +0800 | [diff] [blame] | 329 | struct acpi_address64_attribute { |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 330 | u64 granularity; |
| 331 | u64 minimum; |
| 332 | u64 maximum; |
| 333 | u64 translation_offset; |
| 334 | u64 address_length; |
Lv Zheng | a45de93 | 2015-01-26 16:58:56 +0800 | [diff] [blame] | 335 | }; |
| 336 | |
| 337 | struct acpi_resource_address { |
| 338 | ACPI_RESOURCE_ADDRESS_COMMON}; |
| 339 | |
| 340 | struct acpi_resource_address16 { |
| 341 | ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address16_attribute address; |
| 342 | struct acpi_resource_source resource_source; |
| 343 | }; |
| 344 | |
| 345 | struct acpi_resource_address32 { |
| 346 | ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address32_attribute address; |
| 347 | struct acpi_resource_source resource_source; |
| 348 | }; |
| 349 | |
| 350 | struct acpi_resource_address64 { |
| 351 | ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address64_attribute address; |
| 352 | struct acpi_resource_source resource_source; |
| 353 | }; |
| 354 | |
| 355 | struct acpi_resource_extended_address64 { |
| 356 | ACPI_RESOURCE_ADDRESS_COMMON u8 revision_ID; |
| 357 | struct acpi_address64_attribute address; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 358 | u64 type_specific; |
| 359 | }; |
| 360 | |
| 361 | struct acpi_resource_extended_irq { |
| 362 | u8 producer_consumer; |
| 363 | u8 triggering; |
| 364 | u8 polarity; |
| 365 | u8 sharable; |
Bob Moore | 9cea624 | 2012-12-31 00:07:31 +0000 | [diff] [blame] | 366 | u8 wake_capable; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 367 | u8 interrupt_count; |
| 368 | struct acpi_resource_source resource_source; |
| 369 | u32 interrupts[1]; |
| 370 | }; |
| 371 | |
| 372 | struct acpi_resource_generic_register { |
| 373 | u8 space_id; |
| 374 | u8 bit_width; |
| 375 | u8 bit_offset; |
| 376 | u8 access_size; |
| 377 | u64 address; |
| 378 | }; |
| 379 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 380 | struct acpi_resource_gpio { |
| 381 | u8 revision_id; |
| 382 | u8 connection_type; |
| 383 | u8 producer_consumer; /* For values, see Producer/Consumer above */ |
| 384 | u8 pin_config; |
| 385 | u8 sharable; /* For values, see Interrupt Attributes above */ |
Bob Moore | 9cea624 | 2012-12-31 00:07:31 +0000 | [diff] [blame] | 386 | u8 wake_capable; /* For values, see Interrupt Attributes above */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 387 | u8 io_restriction; |
| 388 | u8 triggering; /* For values, see Interrupt Attributes above */ |
| 389 | u8 polarity; /* For values, see Interrupt Attributes above */ |
| 390 | u16 drive_strength; |
| 391 | u16 debounce_timeout; |
| 392 | u16 pin_table_length; |
| 393 | u16 vendor_length; |
| 394 | struct acpi_resource_source resource_source; |
| 395 | u16 *pin_table; |
| 396 | u8 *vendor_data; |
| 397 | }; |
| 398 | |
| 399 | /* Values for GPIO connection_type field above */ |
| 400 | |
| 401 | #define ACPI_RESOURCE_GPIO_TYPE_INT 0 |
| 402 | #define ACPI_RESOURCE_GPIO_TYPE_IO 1 |
| 403 | |
| 404 | /* Values for pin_config field above */ |
| 405 | |
| 406 | #define ACPI_PIN_CONFIG_DEFAULT 0 |
| 407 | #define ACPI_PIN_CONFIG_PULLUP 1 |
| 408 | #define ACPI_PIN_CONFIG_PULLDOWN 2 |
| 409 | #define ACPI_PIN_CONFIG_NOPULL 3 |
| 410 | |
| 411 | /* Values for io_restriction field above */ |
| 412 | |
| 413 | #define ACPI_IO_RESTRICT_NONE 0 |
| 414 | #define ACPI_IO_RESTRICT_INPUT 1 |
| 415 | #define ACPI_IO_RESTRICT_OUTPUT 2 |
| 416 | #define ACPI_IO_RESTRICT_NONE_PRESERVE 3 |
| 417 | |
| 418 | /* Common structure for I2C, SPI, and UART serial descriptors */ |
| 419 | |
| 420 | #define ACPI_RESOURCE_SERIAL_COMMON \ |
| 421 | u8 revision_id; \ |
| 422 | u8 type; \ |
| 423 | u8 producer_consumer; /* For values, see Producer/Consumer above */\ |
| 424 | u8 slave_mode; \ |
Bob Moore | 14f9857 | 2016-05-05 12:58:19 +0800 | [diff] [blame] | 425 | u8 connection_sharing; \ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 426 | u8 type_revision_id; \ |
| 427 | u16 type_data_length; \ |
| 428 | u16 vendor_length; \ |
| 429 | struct acpi_resource_source resource_source; \ |
| 430 | u8 *vendor_data; |
| 431 | |
| 432 | struct acpi_resource_common_serialbus { |
| 433 | ACPI_RESOURCE_SERIAL_COMMON}; |
| 434 | |
| 435 | /* Values for the Type field above */ |
| 436 | |
| 437 | #define ACPI_RESOURCE_SERIAL_TYPE_I2C 1 |
| 438 | #define ACPI_RESOURCE_SERIAL_TYPE_SPI 2 |
| 439 | #define ACPI_RESOURCE_SERIAL_TYPE_UART 3 |
| 440 | |
| 441 | /* Values for slave_mode field above */ |
| 442 | |
| 443 | #define ACPI_CONTROLLER_INITIATED 0 |
| 444 | #define ACPI_DEVICE_INITIATED 1 |
| 445 | |
| 446 | struct acpi_resource_i2c_serialbus { |
| 447 | ACPI_RESOURCE_SERIAL_COMMON u8 access_mode; |
| 448 | u16 slave_address; |
| 449 | u32 connection_speed; |
| 450 | }; |
| 451 | |
| 452 | /* Values for access_mode field above */ |
| 453 | |
| 454 | #define ACPI_I2C_7BIT_MODE 0 |
| 455 | #define ACPI_I2C_10BIT_MODE 1 |
| 456 | |
| 457 | struct acpi_resource_spi_serialbus { |
| 458 | ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode; |
| 459 | u8 device_polarity; |
| 460 | u8 data_bit_length; |
| 461 | u8 clock_phase; |
| 462 | u8 clock_polarity; |
| 463 | u16 device_selection; |
| 464 | u32 connection_speed; |
| 465 | }; |
| 466 | |
| 467 | /* Values for wire_mode field above */ |
| 468 | |
| 469 | #define ACPI_SPI_4WIRE_MODE 0 |
| 470 | #define ACPI_SPI_3WIRE_MODE 1 |
| 471 | |
| 472 | /* Values for device_polarity field above */ |
| 473 | |
| 474 | #define ACPI_SPI_ACTIVE_LOW 0 |
| 475 | #define ACPI_SPI_ACTIVE_HIGH 1 |
| 476 | |
| 477 | /* Values for clock_phase field above */ |
| 478 | |
| 479 | #define ACPI_SPI_FIRST_PHASE 0 |
| 480 | #define ACPI_SPI_SECOND_PHASE 1 |
| 481 | |
| 482 | /* Values for clock_polarity field above */ |
| 483 | |
| 484 | #define ACPI_SPI_START_LOW 0 |
| 485 | #define ACPI_SPI_START_HIGH 1 |
| 486 | |
| 487 | struct acpi_resource_uart_serialbus { |
| 488 | ACPI_RESOURCE_SERIAL_COMMON u8 endian; |
| 489 | u8 data_bits; |
| 490 | u8 stop_bits; |
| 491 | u8 flow_control; |
| 492 | u8 parity; |
| 493 | u8 lines_enabled; |
| 494 | u16 rx_fifo_size; |
| 495 | u16 tx_fifo_size; |
| 496 | u32 default_baud_rate; |
| 497 | }; |
| 498 | |
| 499 | /* Values for Endian field above */ |
| 500 | |
| 501 | #define ACPI_UART_LITTLE_ENDIAN 0 |
| 502 | #define ACPI_UART_BIG_ENDIAN 1 |
| 503 | |
| 504 | /* Values for data_bits field above */ |
| 505 | |
| 506 | #define ACPI_UART_5_DATA_BITS 0 |
| 507 | #define ACPI_UART_6_DATA_BITS 1 |
| 508 | #define ACPI_UART_7_DATA_BITS 2 |
| 509 | #define ACPI_UART_8_DATA_BITS 3 |
| 510 | #define ACPI_UART_9_DATA_BITS 4 |
| 511 | |
| 512 | /* Values for stop_bits field above */ |
| 513 | |
| 514 | #define ACPI_UART_NO_STOP_BITS 0 |
| 515 | #define ACPI_UART_1_STOP_BIT 1 |
| 516 | #define ACPI_UART_1P5_STOP_BITS 2 |
| 517 | #define ACPI_UART_2_STOP_BITS 3 |
| 518 | |
| 519 | /* Values for flow_control field above */ |
| 520 | |
| 521 | #define ACPI_UART_FLOW_CONTROL_NONE 0 |
| 522 | #define ACPI_UART_FLOW_CONTROL_HW 1 |
| 523 | #define ACPI_UART_FLOW_CONTROL_XON_XOFF 2 |
| 524 | |
| 525 | /* Values for Parity field above */ |
| 526 | |
| 527 | #define ACPI_UART_PARITY_NONE 0 |
| 528 | #define ACPI_UART_PARITY_EVEN 1 |
| 529 | #define ACPI_UART_PARITY_ODD 2 |
| 530 | #define ACPI_UART_PARITY_MARK 3 |
| 531 | #define ACPI_UART_PARITY_SPACE 4 |
| 532 | |
| 533 | /* Values for lines_enabled bitfield above */ |
| 534 | |
| 535 | #define ACPI_UART_CARRIER_DETECT (1<<2) |
| 536 | #define ACPI_UART_RING_INDICATOR (1<<3) |
| 537 | #define ACPI_UART_DATA_SET_READY (1<<4) |
| 538 | #define ACPI_UART_DATA_TERMINAL_READY (1<<5) |
| 539 | #define ACPI_UART_CLEAR_TO_SEND (1<<6) |
| 540 | #define ACPI_UART_REQUEST_TO_SEND (1<<7) |
| 541 | |
Mika Westerberg | 2b72693 | 2017-06-05 16:39:14 +0800 | [diff] [blame] | 542 | struct acpi_resource_pin_function { |
| 543 | u8 revision_id; |
| 544 | u8 pin_config; |
| 545 | u8 sharable; /* For values, see Interrupt Attributes above */ |
| 546 | u16 function_number; |
| 547 | u16 pin_table_length; |
| 548 | u16 vendor_length; |
| 549 | struct acpi_resource_source resource_source; |
| 550 | u16 *pin_table; |
| 551 | u8 *vendor_data; |
| 552 | }; |
| 553 | |
Mika Westerberg | 97028ce | 2017-06-05 16:39:19 +0800 | [diff] [blame] | 554 | struct acpi_resource_pin_config { |
| 555 | u8 revision_id; |
| 556 | u8 producer_consumer; /* For values, see Producer/Consumer above */ |
| 557 | u8 sharable; /* For values, see Interrupt Attributes above */ |
| 558 | u8 pin_config_type; |
| 559 | u32 pin_config_value; |
| 560 | u16 pin_table_length; |
| 561 | u16 vendor_length; |
| 562 | struct acpi_resource_source resource_source; |
| 563 | u16 *pin_table; |
| 564 | u8 *vendor_data; |
| 565 | }; |
| 566 | |
| 567 | /* Values for pin_config_type field above */ |
| 568 | |
| 569 | #define ACPI_PIN_CONFIG_DEFAULT 0 |
| 570 | #define ACPI_PIN_CONFIG_BIAS_PULL_UP 1 |
| 571 | #define ACPI_PIN_CONFIG_BIAS_PULL_DOWN 2 |
| 572 | #define ACPI_PIN_CONFIG_BIAS_DEFAULT 3 |
| 573 | #define ACPI_PIN_CONFIG_BIAS_DISABLE 4 |
| 574 | #define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE 5 |
| 575 | #define ACPI_PIN_CONFIG_BIAS_BUS_HOLD 6 |
| 576 | #define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN 7 |
| 577 | #define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE 8 |
| 578 | #define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL 9 |
| 579 | #define ACPI_PIN_CONFIG_DRIVE_STRENGTH 10 |
| 580 | #define ACPI_PIN_CONFIG_SLEW_RATE 11 |
| 581 | #define ACPI_PIN_CONFIG_INPUT_DEBOUNCE 12 |
| 582 | #define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER 13 |
| 583 | |
Mika Westerberg | fdaa098 | 2017-06-05 16:39:25 +0800 | [diff] [blame] | 584 | struct acpi_resource_pin_group { |
| 585 | u8 revision_id; |
| 586 | u8 producer_consumer; /* For values, see Producer/Consumer above */ |
| 587 | u16 pin_table_length; |
| 588 | u16 vendor_length; |
| 589 | u16 *pin_table; |
| 590 | struct acpi_resource_label resource_label; |
| 591 | u8 *vendor_data; |
| 592 | }; |
| 593 | |
Mika Westerberg | f8a6c86 | 2017-06-05 16:39:31 +0800 | [diff] [blame] | 594 | struct acpi_resource_pin_group_function { |
| 595 | u8 revision_id; |
| 596 | u8 producer_consumer; /* For values, see Producer/Consumer above */ |
| 597 | u8 sharable; /* For values, see Interrupt Attributes above */ |
| 598 | u16 function_number; |
| 599 | u16 vendor_length; |
| 600 | struct acpi_resource_source resource_source; |
| 601 | struct acpi_resource_label resource_source_label; |
| 602 | u8 *vendor_data; |
| 603 | }; |
| 604 | |
Mika Westerberg | 044b723 | 2017-06-05 16:39:37 +0800 | [diff] [blame] | 605 | struct acpi_resource_pin_group_config { |
| 606 | u8 revision_id; |
| 607 | u8 producer_consumer; /* For values, see Producer/Consumer above */ |
| 608 | u8 sharable; /* For values, see Interrupt Attributes above */ |
| 609 | u8 pin_config_type; /* For values, see pin_config_type above */ |
| 610 | u32 pin_config_value; |
| 611 | u16 vendor_length; |
| 612 | struct acpi_resource_source resource_source; |
| 613 | struct acpi_resource_label resource_source_label; |
| 614 | u8 *vendor_data; |
| 615 | }; |
| 616 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 617 | /* ACPI_RESOURCE_TYPEs */ |
| 618 | |
| 619 | #define ACPI_RESOURCE_TYPE_IRQ 0 |
| 620 | #define ACPI_RESOURCE_TYPE_DMA 1 |
| 621 | #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 |
| 622 | #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 |
| 623 | #define ACPI_RESOURCE_TYPE_IO 4 |
| 624 | #define ACPI_RESOURCE_TYPE_FIXED_IO 5 |
| 625 | #define ACPI_RESOURCE_TYPE_VENDOR 6 |
| 626 | #define ACPI_RESOURCE_TYPE_END_TAG 7 |
| 627 | #define ACPI_RESOURCE_TYPE_MEMORY24 8 |
| 628 | #define ACPI_RESOURCE_TYPE_MEMORY32 9 |
| 629 | #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 |
| 630 | #define ACPI_RESOURCE_TYPE_ADDRESS16 11 |
| 631 | #define ACPI_RESOURCE_TYPE_ADDRESS32 12 |
| 632 | #define ACPI_RESOURCE_TYPE_ADDRESS64 13 |
| 633 | #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ |
| 634 | #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 |
| 635 | #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 636 | #define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */ |
| 637 | #define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */ |
| 638 | #define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */ |
Mika Westerberg | 2b72693 | 2017-06-05 16:39:14 +0800 | [diff] [blame] | 639 | #define ACPI_RESOURCE_TYPE_PIN_FUNCTION 20 /* ACPI 6.2 */ |
Mika Westerberg | 97028ce | 2017-06-05 16:39:19 +0800 | [diff] [blame] | 640 | #define ACPI_RESOURCE_TYPE_PIN_CONFIG 21 /* ACPI 6.2 */ |
Mika Westerberg | fdaa098 | 2017-06-05 16:39:25 +0800 | [diff] [blame] | 641 | #define ACPI_RESOURCE_TYPE_PIN_GROUP 22 /* ACPI 6.2 */ |
Mika Westerberg | f8a6c86 | 2017-06-05 16:39:31 +0800 | [diff] [blame] | 642 | #define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION 23 /* ACPI 6.2 */ |
Mika Westerberg | 044b723 | 2017-06-05 16:39:37 +0800 | [diff] [blame] | 643 | #define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG 24 /* ACPI 6.2 */ |
| 644 | #define ACPI_RESOURCE_TYPE_MAX 24 |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 645 | |
| 646 | /* Master union for resource descriptors */ |
| 647 | |
| 648 | union acpi_resource_data { |
| 649 | struct acpi_resource_irq irq; |
| 650 | struct acpi_resource_dma dma; |
| 651 | struct acpi_resource_start_dependent start_dpf; |
| 652 | struct acpi_resource_io io; |
| 653 | struct acpi_resource_fixed_io fixed_io; |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 654 | struct acpi_resource_fixed_dma fixed_dma; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 655 | struct acpi_resource_vendor vendor; |
| 656 | struct acpi_resource_vendor_typed vendor_typed; |
| 657 | struct acpi_resource_end_tag end_tag; |
| 658 | struct acpi_resource_memory24 memory24; |
| 659 | struct acpi_resource_memory32 memory32; |
| 660 | struct acpi_resource_fixed_memory32 fixed_memory32; |
| 661 | struct acpi_resource_address16 address16; |
| 662 | struct acpi_resource_address32 address32; |
| 663 | struct acpi_resource_address64 address64; |
| 664 | struct acpi_resource_extended_address64 ext_address64; |
| 665 | struct acpi_resource_extended_irq extended_irq; |
| 666 | struct acpi_resource_generic_register generic_reg; |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 667 | struct acpi_resource_gpio gpio; |
| 668 | struct acpi_resource_i2c_serialbus i2c_serial_bus; |
| 669 | struct acpi_resource_spi_serialbus spi_serial_bus; |
| 670 | struct acpi_resource_uart_serialbus uart_serial_bus; |
| 671 | struct acpi_resource_common_serialbus common_serial_bus; |
Mika Westerberg | 2b72693 | 2017-06-05 16:39:14 +0800 | [diff] [blame] | 672 | struct acpi_resource_pin_function pin_function; |
Mika Westerberg | 97028ce | 2017-06-05 16:39:19 +0800 | [diff] [blame] | 673 | struct acpi_resource_pin_config pin_config; |
Mika Westerberg | fdaa098 | 2017-06-05 16:39:25 +0800 | [diff] [blame] | 674 | struct acpi_resource_pin_group pin_group; |
Mika Westerberg | f8a6c86 | 2017-06-05 16:39:31 +0800 | [diff] [blame] | 675 | struct acpi_resource_pin_group_function pin_group_function; |
Mika Westerberg | 044b723 | 2017-06-05 16:39:37 +0800 | [diff] [blame] | 676 | struct acpi_resource_pin_group_config pin_group_config; |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 677 | |
| 678 | /* Common fields */ |
| 679 | |
| 680 | struct acpi_resource_address address; /* Common 16/32/64 address fields */ |
| 681 | }; |
| 682 | |
| 683 | /* Common resource header */ |
| 684 | |
| 685 | struct acpi_resource { |
| 686 | u32 type; |
| 687 | u32 length; |
| 688 | union acpi_resource_data data; |
| 689 | }; |
| 690 | |
| 691 | /* restore default alignment */ |
| 692 | |
| 693 | #pragma pack() |
| 694 | |
| 695 | #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ |
| 696 | #define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) |
| 697 | #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) |
| 698 | |
Lv Zheng | fb4e502 | 2012-12-19 05:38:31 +0000 | [diff] [blame] | 699 | /* Macro for walking resource templates with multiple descriptors */ |
| 700 | |
| 701 | #define ACPI_NEXT_RESOURCE(res) \ |
| 702 | ACPI_ADD_PTR (struct acpi_resource, (res), (res)->length) |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 703 | |
| 704 | struct acpi_pci_routing_table { |
| 705 | u32 length; |
| 706 | u32 pin; |
Bob Moore | 5df7e6c | 2010-01-21 10:06:32 +0800 | [diff] [blame] | 707 | u64 address; /* here for 64-bit alignment */ |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 708 | u32 source_index; |
| 709 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ |
| 710 | }; |
| 711 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 712 | #endif /* __ACRESTYP_H__ */ |