1 /******************************************************************************
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2016, 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__
49 * Definitions for Resource Attributes
51 typedef UINT16 ACPI_RS_LENGTH
; /* Resource Length field is fixed at 16 bits */
52 typedef UINT32 ACPI_RSDESC_SIZE
; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
57 #define ACPI_READ_ONLY_MEMORY (UINT8) 0x00
58 #define ACPI_READ_WRITE_MEMORY (UINT8) 0x01
60 #define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00
61 #define ACPI_CACHABLE_MEMORY (UINT8) 0x01
62 #define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02
63 #define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03
65 /*! [Begin] no source code translation */
68 * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
69 * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
71 /*! [End] no source code translation !*/
73 #define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01
74 #define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
75 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
77 /* Type of translation - 1=Sparse, 0=Dense */
79 #define ACPI_SPARSE_TRANSLATION (UINT8) 0x01
82 * IO Port Descriptor Decode
84 #define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
85 #define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
88 * Interrupt attributes - used in multiple descriptors
93 #define ACPI_LEVEL_SENSITIVE (UINT8) 0x00
94 #define ACPI_EDGE_SENSITIVE (UINT8) 0x01
98 #define ACPI_ACTIVE_HIGH (UINT8) 0x00
99 #define ACPI_ACTIVE_LOW (UINT8) 0x01
100 #define ACPI_ACTIVE_BOTH (UINT8) 0x02
104 #define ACPI_EXCLUSIVE (UINT8) 0x00
105 #define ACPI_SHARED (UINT8) 0x01
109 #define ACPI_NOT_WAKE_CAPABLE (UINT8) 0x00
110 #define ACPI_WAKE_CAPABLE (UINT8) 0x01
115 #define ACPI_COMPATIBILITY (UINT8) 0x00
116 #define ACPI_TYPE_A (UINT8) 0x01
117 #define ACPI_TYPE_B (UINT8) 0x02
118 #define ACPI_TYPE_F (UINT8) 0x03
120 #define ACPI_NOT_BUS_MASTER (UINT8) 0x00
121 #define ACPI_BUS_MASTER (UINT8) 0x01
123 #define ACPI_TRANSFER_8 (UINT8) 0x00
124 #define ACPI_TRANSFER_8_16 (UINT8) 0x01
125 #define ACPI_TRANSFER_16 (UINT8) 0x02
128 * Start Dependent Functions Priority definitions
130 #define ACPI_GOOD_CONFIGURATION (UINT8) 0x00
131 #define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01
132 #define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
135 * 16, 32 and 64-bit Address Descriptor resource types
137 #define ACPI_MEMORY_RANGE (UINT8) 0x00
138 #define ACPI_IO_RANGE (UINT8) 0x01
139 #define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02
141 #define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00
142 #define ACPI_ADDRESS_FIXED (UINT8) 0x01
144 #define ACPI_POS_DECODE (UINT8) 0x00
145 #define ACPI_SUB_DECODE (UINT8) 0x01
147 /* Producer/Consumer */
149 #define ACPI_PRODUCER (UINT8) 0x00
150 #define ACPI_CONSUMER (UINT8) 0x01
154 * If possible, pack the following structures to byte alignment
156 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
160 /* UUID data structures for use in vendor-defined resource descriptors */
162 typedef struct acpi_uuid
164 UINT8 Data
[ACPI_UUID_LENGTH
];
167 typedef struct acpi_vendor_uuid
170 UINT8 Data
[ACPI_UUID_LENGTH
];
175 * Structures used to describe device resources
177 typedef struct acpi_resource_irq
179 UINT8 DescriptorLength
;
184 UINT8 InterruptCount
;
189 typedef struct acpi_resource_dma
199 typedef struct acpi_resource_start_dependent
201 UINT8 DescriptorLength
;
202 UINT8 CompatibilityPriority
;
203 UINT8 PerformanceRobustness
;
205 } ACPI_RESOURCE_START_DEPENDENT
;
209 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
210 * needed because it has no fields
214 typedef struct acpi_resource_io
224 typedef struct acpi_resource_fixed_io
229 } ACPI_RESOURCE_FIXED_IO
;
231 typedef struct acpi_resource_fixed_dma
237 } ACPI_RESOURCE_FIXED_DMA
;
239 /* Values for Width field above */
241 #define ACPI_DMA_WIDTH8 0
242 #define ACPI_DMA_WIDTH16 1
243 #define ACPI_DMA_WIDTH32 2
244 #define ACPI_DMA_WIDTH64 3
245 #define ACPI_DMA_WIDTH128 4
246 #define ACPI_DMA_WIDTH256 5
249 typedef struct acpi_resource_vendor
254 } ACPI_RESOURCE_VENDOR
;
256 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
258 typedef struct acpi_resource_vendor_typed
262 UINT8 Uuid
[ACPI_UUID_LENGTH
];
265 } ACPI_RESOURCE_VENDOR_TYPED
;
267 typedef struct acpi_resource_end_tag
271 } ACPI_RESOURCE_END_TAG
;
273 typedef struct acpi_resource_memory24
279 UINT16 AddressLength
;
281 } ACPI_RESOURCE_MEMORY24
;
283 typedef struct acpi_resource_memory32
289 UINT32 AddressLength
;
291 } ACPI_RESOURCE_MEMORY32
;
293 typedef struct acpi_resource_fixed_memory32
297 UINT32 AddressLength
;
299 } ACPI_RESOURCE_FIXED_MEMORY32
;
301 typedef struct acpi_memory_attribute
308 } ACPI_MEMORY_ATTRIBUTE
;
310 typedef struct acpi_io_attribute
314 UINT8 TranslationType
;
319 typedef union acpi_resource_attribute
321 ACPI_MEMORY_ATTRIBUTE Mem
;
322 ACPI_IO_ATTRIBUTE Io
;
324 /* Used for the *WordSpace macros */
328 } ACPI_RESOURCE_ATTRIBUTE
;
330 typedef struct acpi_resource_source
336 } ACPI_RESOURCE_SOURCE
;
338 /* Fields common to all address descriptors, 16/32/64 bit */
340 #define ACPI_RESOURCE_ADDRESS_COMMON \
341 UINT8 ResourceType; \
342 UINT8 ProducerConsumer; \
344 UINT8 MinAddressFixed; \
345 UINT8 MaxAddressFixed; \
346 ACPI_RESOURCE_ATTRIBUTE Info;
348 typedef struct acpi_address16_attribute
353 UINT16 TranslationOffset
;
354 UINT16 AddressLength
;
356 } ACPI_ADDRESS16_ATTRIBUTE
;
358 typedef struct acpi_address32_attribute
363 UINT32 TranslationOffset
;
364 UINT32 AddressLength
;
366 } ACPI_ADDRESS32_ATTRIBUTE
;
368 typedef struct acpi_address64_attribute
373 UINT64 TranslationOffset
;
374 UINT64 AddressLength
;
376 } ACPI_ADDRESS64_ATTRIBUTE
;
378 typedef struct acpi_resource_address
380 ACPI_RESOURCE_ADDRESS_COMMON
382 } ACPI_RESOURCE_ADDRESS
;
384 typedef struct acpi_resource_address16
386 ACPI_RESOURCE_ADDRESS_COMMON
387 ACPI_ADDRESS16_ATTRIBUTE Address
;
388 ACPI_RESOURCE_SOURCE ResourceSource
;
390 } ACPI_RESOURCE_ADDRESS16
;
392 typedef struct acpi_resource_address32
394 ACPI_RESOURCE_ADDRESS_COMMON
395 ACPI_ADDRESS32_ATTRIBUTE Address
;
396 ACPI_RESOURCE_SOURCE ResourceSource
;
398 } ACPI_RESOURCE_ADDRESS32
;
400 typedef struct acpi_resource_address64
402 ACPI_RESOURCE_ADDRESS_COMMON
403 ACPI_ADDRESS64_ATTRIBUTE Address
;
404 ACPI_RESOURCE_SOURCE ResourceSource
;
406 } ACPI_RESOURCE_ADDRESS64
;
408 typedef struct acpi_resource_extended_address64
410 ACPI_RESOURCE_ADDRESS_COMMON
412 ACPI_ADDRESS64_ATTRIBUTE Address
;
415 } ACPI_RESOURCE_EXTENDED_ADDRESS64
;
417 typedef struct acpi_resource_extended_irq
419 UINT8 ProducerConsumer
;
424 UINT8 InterruptCount
;
425 ACPI_RESOURCE_SOURCE ResourceSource
;
426 UINT32 Interrupts
[1];
428 } ACPI_RESOURCE_EXTENDED_IRQ
;
430 typedef struct acpi_resource_generic_register
438 } ACPI_RESOURCE_GENERIC_REGISTER
;
440 typedef struct acpi_resource_gpio
443 UINT8 ConnectionType
;
444 UINT8 ProducerConsumer
; /* For values, see Producer/Consumer above */
446 UINT8 Sharable
; /* For values, see Interrupt Attributes above */
447 UINT8 WakeCapable
; /* For values, see Interrupt Attributes above */
449 UINT8 Triggering
; /* For values, see Interrupt Attributes above */
450 UINT8 Polarity
; /* For values, see Interrupt Attributes above */
451 UINT16 DriveStrength
;
452 UINT16 DebounceTimeout
;
453 UINT16 PinTableLength
;
455 ACPI_RESOURCE_SOURCE ResourceSource
;
459 } ACPI_RESOURCE_GPIO
;
461 /* Values for GPIO ConnectionType field above */
463 #define ACPI_RESOURCE_GPIO_TYPE_INT 0
464 #define ACPI_RESOURCE_GPIO_TYPE_IO 1
466 /* Values for PinConfig field above */
468 #define ACPI_PIN_CONFIG_DEFAULT 0
469 #define ACPI_PIN_CONFIG_PULLUP 1
470 #define ACPI_PIN_CONFIG_PULLDOWN 2
471 #define ACPI_PIN_CONFIG_NOPULL 3
473 /* Values for IoRestriction field above */
475 #define ACPI_IO_RESTRICT_NONE 0
476 #define ACPI_IO_RESTRICT_INPUT 1
477 #define ACPI_IO_RESTRICT_OUTPUT 2
478 #define ACPI_IO_RESTRICT_NONE_PRESERVE 3
481 /* Common structure for I2C, SPI, and UART serial descriptors */
483 #define ACPI_RESOURCE_SERIAL_COMMON \
486 UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */\
488 UINT8 ConnectionSharing; \
489 UINT8 TypeRevisionId; \
490 UINT16 TypeDataLength; \
491 UINT16 VendorLength; \
492 ACPI_RESOURCE_SOURCE ResourceSource; \
495 typedef struct acpi_resource_common_serialbus
497 ACPI_RESOURCE_SERIAL_COMMON
499 } ACPI_RESOURCE_COMMON_SERIALBUS
;
501 /* Values for the Type field above */
503 #define ACPI_RESOURCE_SERIAL_TYPE_I2C 1
504 #define ACPI_RESOURCE_SERIAL_TYPE_SPI 2
505 #define ACPI_RESOURCE_SERIAL_TYPE_UART 3
507 /* Values for SlaveMode field above */
509 #define ACPI_CONTROLLER_INITIATED 0
510 #define ACPI_DEVICE_INITIATED 1
513 typedef struct acpi_resource_i2c_serialbus
515 ACPI_RESOURCE_SERIAL_COMMON
518 UINT32 ConnectionSpeed
;
520 } ACPI_RESOURCE_I2C_SERIALBUS
;
522 /* Values for AccessMode field above */
524 #define ACPI_I2C_7BIT_MODE 0
525 #define ACPI_I2C_10BIT_MODE 1
528 typedef struct acpi_resource_spi_serialbus
530 ACPI_RESOURCE_SERIAL_COMMON
532 UINT8 DevicePolarity
;
536 UINT16 DeviceSelection
;
537 UINT32 ConnectionSpeed
;
539 } ACPI_RESOURCE_SPI_SERIALBUS
;
541 /* Values for WireMode field above */
543 #define ACPI_SPI_4WIRE_MODE 0
544 #define ACPI_SPI_3WIRE_MODE 1
546 /* Values for DevicePolarity field above */
548 #define ACPI_SPI_ACTIVE_LOW 0
549 #define ACPI_SPI_ACTIVE_HIGH 1
551 /* Values for ClockPhase field above */
553 #define ACPI_SPI_FIRST_PHASE 0
554 #define ACPI_SPI_SECOND_PHASE 1
556 /* Values for ClockPolarity field above */
558 #define ACPI_SPI_START_LOW 0
559 #define ACPI_SPI_START_HIGH 1
562 typedef struct acpi_resource_uart_serialbus
564 ACPI_RESOURCE_SERIAL_COMMON
573 UINT32 DefaultBaudRate
;
575 } ACPI_RESOURCE_UART_SERIALBUS
;
577 /* Values for Endian field above */
579 #define ACPI_UART_LITTLE_ENDIAN 0
580 #define ACPI_UART_BIG_ENDIAN 1
582 /* Values for DataBits field above */
584 #define ACPI_UART_5_DATA_BITS 0
585 #define ACPI_UART_6_DATA_BITS 1
586 #define ACPI_UART_7_DATA_BITS 2
587 #define ACPI_UART_8_DATA_BITS 3
588 #define ACPI_UART_9_DATA_BITS 4
590 /* Values for StopBits field above */
592 #define ACPI_UART_NO_STOP_BITS 0
593 #define ACPI_UART_1_STOP_BIT 1
594 #define ACPI_UART_1P5_STOP_BITS 2
595 #define ACPI_UART_2_STOP_BITS 3
597 /* Values for FlowControl field above */
599 #define ACPI_UART_FLOW_CONTROL_NONE 0
600 #define ACPI_UART_FLOW_CONTROL_HW 1
601 #define ACPI_UART_FLOW_CONTROL_XON_XOFF 2
603 /* Values for Parity field above */
605 #define ACPI_UART_PARITY_NONE 0
606 #define ACPI_UART_PARITY_EVEN 1
607 #define ACPI_UART_PARITY_ODD 2
608 #define ACPI_UART_PARITY_MARK 3
609 #define ACPI_UART_PARITY_SPACE 4
611 /* Values for LinesEnabled bitfield above */
613 #define ACPI_UART_CARRIER_DETECT (1<<2)
614 #define ACPI_UART_RING_INDICATOR (1<<3)
615 #define ACPI_UART_DATA_SET_READY (1<<4)
616 #define ACPI_UART_DATA_TERMINAL_READY (1<<5)
617 #define ACPI_UART_CLEAR_TO_SEND (1<<6)
618 #define ACPI_UART_REQUEST_TO_SEND (1<<7)
621 /* ACPI_RESOURCE_TYPEs */
623 #define ACPI_RESOURCE_TYPE_IRQ 0
624 #define ACPI_RESOURCE_TYPE_DMA 1
625 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
626 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
627 #define ACPI_RESOURCE_TYPE_IO 4
628 #define ACPI_RESOURCE_TYPE_FIXED_IO 5
629 #define ACPI_RESOURCE_TYPE_VENDOR 6
630 #define ACPI_RESOURCE_TYPE_END_TAG 7
631 #define ACPI_RESOURCE_TYPE_MEMORY24 8
632 #define ACPI_RESOURCE_TYPE_MEMORY32 9
633 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
634 #define ACPI_RESOURCE_TYPE_ADDRESS16 11
635 #define ACPI_RESOURCE_TYPE_ADDRESS32 12
636 #define ACPI_RESOURCE_TYPE_ADDRESS64 13
637 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
638 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
639 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
640 #define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */
641 #define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */
642 #define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */
643 #define ACPI_RESOURCE_TYPE_MAX 19
645 /* Master union for resource descriptors */
647 typedef union acpi_resource_data
649 ACPI_RESOURCE_IRQ Irq
;
650 ACPI_RESOURCE_DMA Dma
;
651 ACPI_RESOURCE_START_DEPENDENT StartDpf
;
653 ACPI_RESOURCE_FIXED_IO FixedIo
;
654 ACPI_RESOURCE_FIXED_DMA FixedDma
;
655 ACPI_RESOURCE_VENDOR Vendor
;
656 ACPI_RESOURCE_VENDOR_TYPED VendorTyped
;
657 ACPI_RESOURCE_END_TAG EndTag
;
658 ACPI_RESOURCE_MEMORY24 Memory24
;
659 ACPI_RESOURCE_MEMORY32 Memory32
;
660 ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32
;
661 ACPI_RESOURCE_ADDRESS16 Address16
;
662 ACPI_RESOURCE_ADDRESS32 Address32
;
663 ACPI_RESOURCE_ADDRESS64 Address64
;
664 ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64
;
665 ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq
;
666 ACPI_RESOURCE_GENERIC_REGISTER GenericReg
;
667 ACPI_RESOURCE_GPIO Gpio
;
668 ACPI_RESOURCE_I2C_SERIALBUS I2cSerialBus
;
669 ACPI_RESOURCE_SPI_SERIALBUS SpiSerialBus
;
670 ACPI_RESOURCE_UART_SERIALBUS UartSerialBus
;
671 ACPI_RESOURCE_COMMON_SERIALBUS CommonSerialBus
;
675 ACPI_RESOURCE_ADDRESS Address
; /* Common 16/32/64 address fields */
677 } ACPI_RESOURCE_DATA
;
680 /* Common resource header */
682 typedef struct acpi_resource
686 ACPI_RESOURCE_DATA Data
;
690 /* restore default alignment */
695 #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
696 #define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
697 #define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
699 /* Macro for walking resource templates with multiple descriptors */
701 #define ACPI_NEXT_RESOURCE(Res) \
702 ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length)
705 typedef struct acpi_pci_routing_table
709 UINT64 Address
; /* here for 64-bit alignment */
711 char Source
[4]; /* pad to 64 bits so sizeof() works in all cases */
713 } ACPI_PCI_ROUTING_TABLE
;
715 #endif /* __ACRESTYP_H__ */