1 /******************************************************************************
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2017, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #ifndef __ACRESTYP_H__
45 #define __ACRESTYP_H__
48 * Definitions for Resource Attributes
50 typedef u16 acpi_rs_length
; /* Resource Length field is fixed at 16 bits */
51 typedef u32 acpi_rsdesc_size
; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
56 #define ACPI_READ_ONLY_MEMORY (u8) 0x00
57 #define ACPI_READ_WRITE_MEMORY (u8) 0x01
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
64 /*! [Begin] no source code translation */
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.
70 /*! [End] no source code translation !*/
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)
76 /* Type of translation - 1=Sparse, 0=Dense */
78 #define ACPI_SPARSE_TRANSLATION (u8) 0x01
81 * IO Port Descriptor Decode
83 #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
84 #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
87 * Interrupt attributes - used in multiple descriptors
92 #define ACPI_LEVEL_SENSITIVE (u8) 0x00
93 #define ACPI_EDGE_SENSITIVE (u8) 0x01
97 #define ACPI_ACTIVE_HIGH (u8) 0x00
98 #define ACPI_ACTIVE_LOW (u8) 0x01
99 #define ACPI_ACTIVE_BOTH (u8) 0x02
103 #define ACPI_EXCLUSIVE (u8) 0x00
104 #define ACPI_SHARED (u8) 0x01
108 #define ACPI_NOT_WAKE_CAPABLE (u8) 0x00
109 #define ACPI_WAKE_CAPABLE (u8) 0x01
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
119 #define ACPI_NOT_BUS_MASTER (u8) 0x00
120 #define ACPI_BUS_MASTER (u8) 0x01
122 #define ACPI_TRANSFER_8 (u8) 0x00
123 #define ACPI_TRANSFER_8_16 (u8) 0x01
124 #define ACPI_TRANSFER_16 (u8) 0x02
127 * Start Dependent Functions Priority definitions
129 #define ACPI_GOOD_CONFIGURATION (u8) 0x00
130 #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
131 #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
134 * 16, 32 and 64-bit Address Descriptor resource types
136 #define ACPI_MEMORY_RANGE (u8) 0x00
137 #define ACPI_IO_RANGE (u8) 0x01
138 #define ACPI_BUS_NUMBER_RANGE (u8) 0x02
140 #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
141 #define ACPI_ADDRESS_FIXED (u8) 0x01
143 #define ACPI_POS_DECODE (u8) 0x00
144 #define ACPI_SUB_DECODE (u8) 0x01
146 /* Producer/Consumer */
148 #define ACPI_PRODUCER (u8) 0x00
149 #define ACPI_CONSUMER (u8) 0x01
152 * If possible, pack the following structures to byte alignment
154 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
158 /* UUID data structures for use in vendor-defined resource descriptors */
161 u8 data
[ACPI_UUID_LENGTH
];
164 struct acpi_vendor_uuid
{
166 u8 data
[ACPI_UUID_LENGTH
];
170 * Structures used to describe device resources
172 struct acpi_resource_irq
{
173 u8 descriptor_length
;
182 struct acpi_resource_dma
{
190 struct acpi_resource_start_dependent
{
191 u8 descriptor_length
;
192 u8 compatibility_priority
;
193 u8 performance_robustness
;
197 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
198 * needed because it has no fields
201 struct acpi_resource_io
{
209 struct acpi_resource_fixed_io
{
214 struct acpi_resource_fixed_dma
{
220 /* Values for Width field above */
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
229 struct acpi_resource_vendor
{
234 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
236 struct acpi_resource_vendor_typed
{
239 u8 uuid
[ACPI_UUID_LENGTH
];
243 struct acpi_resource_end_tag
{
247 struct acpi_resource_memory24
{
255 struct acpi_resource_memory32
{
263 struct acpi_resource_fixed_memory32
{
269 struct acpi_memory_attribute
{
276 struct acpi_io_attribute
{
283 union acpi_resource_attribute
{
284 struct acpi_memory_attribute mem
;
285 struct acpi_io_attribute io
;
287 /* Used for the *word_space macros */
292 struct acpi_resource_label
{
297 struct acpi_resource_source
{
303 /* Fields common to all address descriptors, 16/32/64 bit */
305 #define ACPI_RESOURCE_ADDRESS_COMMON \
307 u8 producer_consumer; \
309 u8 min_address_fixed; \
310 u8 max_address_fixed; \
311 union acpi_resource_attribute info;
313 struct acpi_address16_attribute
{
317 u16 translation_offset
;
321 struct acpi_address32_attribute
{
325 u32 translation_offset
;
329 struct acpi_address64_attribute
{
333 u64 translation_offset
;
337 struct acpi_resource_address
{
338 ACPI_RESOURCE_ADDRESS_COMMON
};
340 struct acpi_resource_address16
{
341 ACPI_RESOURCE_ADDRESS_COMMON
struct acpi_address16_attribute address
;
342 struct acpi_resource_source resource_source
;
345 struct acpi_resource_address32
{
346 ACPI_RESOURCE_ADDRESS_COMMON
struct acpi_address32_attribute address
;
347 struct acpi_resource_source resource_source
;
350 struct acpi_resource_address64
{
351 ACPI_RESOURCE_ADDRESS_COMMON
struct acpi_address64_attribute address
;
352 struct acpi_resource_source resource_source
;
355 struct acpi_resource_extended_address64
{
356 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_ID
;
357 struct acpi_address64_attribute address
;
361 struct acpi_resource_extended_irq
{
362 u8 producer_consumer
;
368 struct acpi_resource_source resource_source
;
372 struct acpi_resource_generic_register
{
380 /* Generic Address Space Access Sizes */
381 #define ACPI_ACCESS_SIZE_UNDEFINED 0
382 #define ACPI_ACCESS_SIZE_BYTE 1
383 #define ACPI_ACCESS_SIZE_WORD 2
384 #define ACPI_ACCESS_SIZE_DWORD 3
385 #define ACPI_ACCESS_SIZE_QWORD 4
387 struct acpi_resource_gpio
{
390 u8 producer_consumer
; /* For values, see Producer/Consumer above */
392 u8 sharable
; /* For values, see Interrupt Attributes above */
393 u8 wake_capable
; /* For values, see Interrupt Attributes above */
395 u8 triggering
; /* For values, see Interrupt Attributes above */
396 u8 polarity
; /* For values, see Interrupt Attributes above */
398 u16 debounce_timeout
;
399 u16 pin_table_length
;
401 struct acpi_resource_source resource_source
;
406 /* Values for GPIO connection_type field above */
408 #define ACPI_RESOURCE_GPIO_TYPE_INT 0
409 #define ACPI_RESOURCE_GPIO_TYPE_IO 1
411 /* Values for pin_config field above */
413 #define ACPI_PIN_CONFIG_DEFAULT 0
414 #define ACPI_PIN_CONFIG_PULLUP 1
415 #define ACPI_PIN_CONFIG_PULLDOWN 2
416 #define ACPI_PIN_CONFIG_NOPULL 3
418 /* Values for io_restriction field above */
420 #define ACPI_IO_RESTRICT_NONE 0
421 #define ACPI_IO_RESTRICT_INPUT 1
422 #define ACPI_IO_RESTRICT_OUTPUT 2
423 #define ACPI_IO_RESTRICT_NONE_PRESERVE 3
425 /* Common structure for I2C, SPI, and UART serial descriptors */
427 #define ACPI_RESOURCE_SERIAL_COMMON \
430 u8 producer_consumer; /* For values, see Producer/Consumer above */\
432 u8 connection_sharing; \
433 u8 type_revision_id; \
434 u16 type_data_length; \
436 struct acpi_resource_source resource_source; \
439 struct acpi_resource_common_serialbus
{
440 ACPI_RESOURCE_SERIAL_COMMON
};
442 /* Values for the Type field above */
444 #define ACPI_RESOURCE_SERIAL_TYPE_I2C 1
445 #define ACPI_RESOURCE_SERIAL_TYPE_SPI 2
446 #define ACPI_RESOURCE_SERIAL_TYPE_UART 3
448 /* Values for slave_mode field above */
450 #define ACPI_CONTROLLER_INITIATED 0
451 #define ACPI_DEVICE_INITIATED 1
453 struct acpi_resource_i2c_serialbus
{
454 ACPI_RESOURCE_SERIAL_COMMON u8 access_mode
;
456 u32 connection_speed
;
459 /* Values for access_mode field above */
461 #define ACPI_I2C_7BIT_MODE 0
462 #define ACPI_I2C_10BIT_MODE 1
464 struct acpi_resource_spi_serialbus
{
465 ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode
;
470 u16 device_selection
;
471 u32 connection_speed
;
474 /* Values for wire_mode field above */
476 #define ACPI_SPI_4WIRE_MODE 0
477 #define ACPI_SPI_3WIRE_MODE 1
479 /* Values for device_polarity field above */
481 #define ACPI_SPI_ACTIVE_LOW 0
482 #define ACPI_SPI_ACTIVE_HIGH 1
484 /* Values for clock_phase field above */
486 #define ACPI_SPI_FIRST_PHASE 0
487 #define ACPI_SPI_SECOND_PHASE 1
489 /* Values for clock_polarity field above */
491 #define ACPI_SPI_START_LOW 0
492 #define ACPI_SPI_START_HIGH 1
494 struct acpi_resource_uart_serialbus
{
495 ACPI_RESOURCE_SERIAL_COMMON u8 endian
;
503 u32 default_baud_rate
;
506 /* Values for Endian field above */
508 #define ACPI_UART_LITTLE_ENDIAN 0
509 #define ACPI_UART_BIG_ENDIAN 1
511 /* Values for data_bits field above */
513 #define ACPI_UART_5_DATA_BITS 0
514 #define ACPI_UART_6_DATA_BITS 1
515 #define ACPI_UART_7_DATA_BITS 2
516 #define ACPI_UART_8_DATA_BITS 3
517 #define ACPI_UART_9_DATA_BITS 4
519 /* Values for stop_bits field above */
521 #define ACPI_UART_NO_STOP_BITS 0
522 #define ACPI_UART_1_STOP_BIT 1
523 #define ACPI_UART_1P5_STOP_BITS 2
524 #define ACPI_UART_2_STOP_BITS 3
526 /* Values for flow_control field above */
528 #define ACPI_UART_FLOW_CONTROL_NONE 0
529 #define ACPI_UART_FLOW_CONTROL_HW 1
530 #define ACPI_UART_FLOW_CONTROL_XON_XOFF 2
532 /* Values for Parity field above */
534 #define ACPI_UART_PARITY_NONE 0
535 #define ACPI_UART_PARITY_EVEN 1
536 #define ACPI_UART_PARITY_ODD 2
537 #define ACPI_UART_PARITY_MARK 3
538 #define ACPI_UART_PARITY_SPACE 4
540 /* Values for lines_enabled bitfield above */
542 #define ACPI_UART_CARRIER_DETECT (1<<2)
543 #define ACPI_UART_RING_INDICATOR (1<<3)
544 #define ACPI_UART_DATA_SET_READY (1<<4)
545 #define ACPI_UART_DATA_TERMINAL_READY (1<<5)
546 #define ACPI_UART_CLEAR_TO_SEND (1<<6)
547 #define ACPI_UART_REQUEST_TO_SEND (1<<7)
549 struct acpi_resource_pin_function
{
552 u8 sharable
; /* For values, see Interrupt Attributes above */
554 u16 pin_table_length
;
556 struct acpi_resource_source resource_source
;
561 struct acpi_resource_pin_config
{
563 u8 producer_consumer
; /* For values, see Producer/Consumer above */
564 u8 sharable
; /* For values, see Interrupt Attributes above */
566 u32 pin_config_value
;
567 u16 pin_table_length
;
569 struct acpi_resource_source resource_source
;
574 /* Values for pin_config_type field above */
576 #define ACPI_PIN_CONFIG_DEFAULT 0
577 #define ACPI_PIN_CONFIG_BIAS_PULL_UP 1
578 #define ACPI_PIN_CONFIG_BIAS_PULL_DOWN 2
579 #define ACPI_PIN_CONFIG_BIAS_DEFAULT 3
580 #define ACPI_PIN_CONFIG_BIAS_DISABLE 4
581 #define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE 5
582 #define ACPI_PIN_CONFIG_BIAS_BUS_HOLD 6
583 #define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN 7
584 #define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE 8
585 #define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL 9
586 #define ACPI_PIN_CONFIG_DRIVE_STRENGTH 10
587 #define ACPI_PIN_CONFIG_SLEW_RATE 11
588 #define ACPI_PIN_CONFIG_INPUT_DEBOUNCE 12
589 #define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER 13
591 struct acpi_resource_pin_group
{
593 u8 producer_consumer
; /* For values, see Producer/Consumer above */
594 u16 pin_table_length
;
597 struct acpi_resource_label resource_label
;
601 struct acpi_resource_pin_group_function
{
603 u8 producer_consumer
; /* For values, see Producer/Consumer above */
604 u8 sharable
; /* For values, see Interrupt Attributes above */
607 struct acpi_resource_source resource_source
;
608 struct acpi_resource_label resource_source_label
;
612 struct acpi_resource_pin_group_config
{
614 u8 producer_consumer
; /* For values, see Producer/Consumer above */
615 u8 sharable
; /* For values, see Interrupt Attributes above */
616 u8 pin_config_type
; /* For values, see pin_config_type above */
617 u32 pin_config_value
;
619 struct acpi_resource_source resource_source
;
620 struct acpi_resource_label resource_source_label
;
624 /* ACPI_RESOURCE_TYPEs */
626 #define ACPI_RESOURCE_TYPE_IRQ 0
627 #define ACPI_RESOURCE_TYPE_DMA 1
628 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
629 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
630 #define ACPI_RESOURCE_TYPE_IO 4
631 #define ACPI_RESOURCE_TYPE_FIXED_IO 5
632 #define ACPI_RESOURCE_TYPE_VENDOR 6
633 #define ACPI_RESOURCE_TYPE_END_TAG 7
634 #define ACPI_RESOURCE_TYPE_MEMORY24 8
635 #define ACPI_RESOURCE_TYPE_MEMORY32 9
636 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
637 #define ACPI_RESOURCE_TYPE_ADDRESS16 11
638 #define ACPI_RESOURCE_TYPE_ADDRESS32 12
639 #define ACPI_RESOURCE_TYPE_ADDRESS64 13
640 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
641 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
642 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
643 #define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */
644 #define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */
645 #define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */
646 #define ACPI_RESOURCE_TYPE_PIN_FUNCTION 20 /* ACPI 6.2 */
647 #define ACPI_RESOURCE_TYPE_PIN_CONFIG 21 /* ACPI 6.2 */
648 #define ACPI_RESOURCE_TYPE_PIN_GROUP 22 /* ACPI 6.2 */
649 #define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION 23 /* ACPI 6.2 */
650 #define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG 24 /* ACPI 6.2 */
651 #define ACPI_RESOURCE_TYPE_MAX 24
653 /* Master union for resource descriptors */
655 union acpi_resource_data
{
656 struct acpi_resource_irq irq
;
657 struct acpi_resource_dma dma
;
658 struct acpi_resource_start_dependent start_dpf
;
659 struct acpi_resource_io io
;
660 struct acpi_resource_fixed_io fixed_io
;
661 struct acpi_resource_fixed_dma fixed_dma
;
662 struct acpi_resource_vendor vendor
;
663 struct acpi_resource_vendor_typed vendor_typed
;
664 struct acpi_resource_end_tag end_tag
;
665 struct acpi_resource_memory24 memory24
;
666 struct acpi_resource_memory32 memory32
;
667 struct acpi_resource_fixed_memory32 fixed_memory32
;
668 struct acpi_resource_address16 address16
;
669 struct acpi_resource_address32 address32
;
670 struct acpi_resource_address64 address64
;
671 struct acpi_resource_extended_address64 ext_address64
;
672 struct acpi_resource_extended_irq extended_irq
;
673 struct acpi_resource_generic_register generic_reg
;
674 struct acpi_resource_gpio gpio
;
675 struct acpi_resource_i2c_serialbus i2c_serial_bus
;
676 struct acpi_resource_spi_serialbus spi_serial_bus
;
677 struct acpi_resource_uart_serialbus uart_serial_bus
;
678 struct acpi_resource_common_serialbus common_serial_bus
;
679 struct acpi_resource_pin_function pin_function
;
680 struct acpi_resource_pin_config pin_config
;
681 struct acpi_resource_pin_group pin_group
;
682 struct acpi_resource_pin_group_function pin_group_function
;
683 struct acpi_resource_pin_group_config pin_group_config
;
687 struct acpi_resource_address address
; /* Common 16/32/64 address fields */
690 /* Common resource header */
692 struct acpi_resource
{
695 union acpi_resource_data data
;
698 /* restore default alignment */
702 #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
703 #define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
704 #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
706 /* Macro for walking resource templates with multiple descriptors */
708 #define ACPI_NEXT_RESOURCE(res) \
709 ACPI_ADD_PTR (struct acpi_resource, (res), (res)->length)
711 struct acpi_pci_routing_table
{
714 u64 address
; /* here for 64-bit alignment */
716 char source
[4]; /* pad to 64 bits so sizeof() works in all cases */
719 #endif /* __ACRESTYP_H__ */