1 /******************************************************************************
3 * Module Name: amlresrc.h - AML resource descriptors
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, 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 /* acpisrc:StructDefs -- for acpisrc conversion */
51 * Resource descriptor tags, as defined in the ACPI specification.
52 * Used to symbolically reference fields within a descriptor.
54 #define ACPI_RESTAG_ADDRESS "_ADR"
55 #define ACPI_RESTAG_ALIGNMENT "_ALN"
56 #define ACPI_RESTAG_ADDRESSSPACE "_ASI"
57 #define ACPI_RESTAG_ACCESSSIZE "_ASZ"
58 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
59 #define ACPI_RESTAG_BASEADDRESS "_BAS"
60 #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
61 #define ACPI_RESTAG_DEBOUNCETIME "_DBT"
62 #define ACPI_RESTAG_DECODE "_DEC"
63 #define ACPI_RESTAG_DEVICEPOLARITY "_DPL"
64 #define ACPI_RESTAG_DMA "_DMA"
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"
69 #define ACPI_RESTAG_GRANULARITY "_GRA"
70 #define ACPI_RESTAG_INTERRUPT "_INT"
71 #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
72 #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
73 #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
74 #define ACPI_RESTAG_IORESTRICTION "_IOR"
75 #define ACPI_RESTAG_LENGTH "_LEN"
76 #define ACPI_RESTAG_LINE "_LIN"
77 #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
78 #define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
79 #define ACPI_RESTAG_MAXADDR "_MAX"
80 #define ACPI_RESTAG_MINADDR "_MIN"
81 #define ACPI_RESTAG_MAXTYPE "_MAF"
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"
89 #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
90 #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
91 #define ACPI_RESTAG_RANGETYPE "_RNG"
92 #define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(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"
98 #define ACPI_RESTAG_TRANSLATION "_TRA"
99 #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
100 #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
101 #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
102 #define ACPI_RESTAG_VENDORDATA "_VEN"
105 /* Default sizes for "small" resource descriptors */
107 #define ASL_RDESC_IRQ_SIZE 0x02
108 #define ASL_RDESC_DMA_SIZE 0x02
109 #define ASL_RDESC_ST_DEPEND_SIZE 0x00
110 #define ASL_RDESC_END_DEPEND_SIZE 0x00
111 #define ASL_RDESC_IO_SIZE 0x07
112 #define ASL_RDESC_FIXED_IO_SIZE 0x03
113 #define ASL_RDESC_FIXED_DMA_SIZE 0x05
114 #define ASL_RDESC_END_TAG_SIZE 0x01
117 typedef struct asl_resource_node
121 struct asl_resource_node
*Next
;
126 /* Macros used to generate AML resource length fields */
128 #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
129 #define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
132 * Resource descriptors defined in the ACPI specification.
134 * Packing/alignment must be BYTE because these descriptors
135 * are used to overlay the raw AML byte stream.
142 #define AML_RESOURCE_SMALL_HEADER_COMMON \
143 UINT8 DescriptorType;
145 typedef struct aml_resource_small_header
147 AML_RESOURCE_SMALL_HEADER_COMMON
149 } AML_RESOURCE_SMALL_HEADER
;
152 typedef struct aml_resource_irq
154 AML_RESOURCE_SMALL_HEADER_COMMON
161 typedef struct aml_resource_irq_noflags
163 AML_RESOURCE_SMALL_HEADER_COMMON
166 } AML_RESOURCE_IRQ_NOFLAGS
;
169 typedef struct aml_resource_dma
171 AML_RESOURCE_SMALL_HEADER_COMMON
172 UINT8 DmaChannelMask
;
178 typedef struct aml_resource_start_dependent
180 AML_RESOURCE_SMALL_HEADER_COMMON
183 } AML_RESOURCE_START_DEPENDENT
;
186 typedef struct aml_resource_start_dependent_noprio
188 AML_RESOURCE_SMALL_HEADER_COMMON
190 } AML_RESOURCE_START_DEPENDENT_NOPRIO
;
193 typedef struct aml_resource_end_dependent
195 AML_RESOURCE_SMALL_HEADER_COMMON
197 } AML_RESOURCE_END_DEPENDENT
;
200 typedef struct aml_resource_io
202 AML_RESOURCE_SMALL_HEADER_COMMON
212 typedef struct aml_resource_fixed_io
214 AML_RESOURCE_SMALL_HEADER_COMMON
218 } AML_RESOURCE_FIXED_IO
;
221 typedef struct aml_resource_vendor_small
223 AML_RESOURCE_SMALL_HEADER_COMMON
225 } AML_RESOURCE_VENDOR_SMALL
;
228 typedef struct aml_resource_end_tag
230 AML_RESOURCE_SMALL_HEADER_COMMON
233 } AML_RESOURCE_END_TAG
;
236 typedef struct aml_resource_fixed_dma
238 AML_RESOURCE_SMALL_HEADER_COMMON
243 } AML_RESOURCE_FIXED_DMA
;
249 #define AML_RESOURCE_LARGE_HEADER_COMMON \
250 UINT8 DescriptorType;\
251 UINT16 ResourceLength;
253 typedef struct aml_resource_large_header
255 AML_RESOURCE_LARGE_HEADER_COMMON
257 } AML_RESOURCE_LARGE_HEADER
;
260 /* General Flags for address space resource descriptors */
262 #define ACPI_RESOURCE_FLAG_DEC 2
263 #define ACPI_RESOURCE_FLAG_MIF 4
264 #define ACPI_RESOURCE_FLAG_MAF 8
266 typedef struct aml_resource_memory24
268 AML_RESOURCE_LARGE_HEADER_COMMON
273 UINT16 AddressLength
;
275 } AML_RESOURCE_MEMORY24
;
278 typedef struct aml_resource_vendor_large
280 AML_RESOURCE_LARGE_HEADER_COMMON
282 } AML_RESOURCE_VENDOR_LARGE
;
285 typedef struct aml_resource_memory32
287 AML_RESOURCE_LARGE_HEADER_COMMON
292 UINT32 AddressLength
;
294 } AML_RESOURCE_MEMORY32
;
297 typedef struct aml_resource_fixed_memory32
299 AML_RESOURCE_LARGE_HEADER_COMMON
302 UINT32 AddressLength
;
304 } AML_RESOURCE_FIXED_MEMORY32
;
307 #define AML_RESOURCE_ADDRESS_COMMON \
308 UINT8 ResourceType; \
313 typedef struct aml_resource_address
315 AML_RESOURCE_LARGE_HEADER_COMMON
316 AML_RESOURCE_ADDRESS_COMMON
318 } AML_RESOURCE_ADDRESS
;
321 typedef struct aml_resource_extended_address64
323 AML_RESOURCE_LARGE_HEADER_COMMON
324 AML_RESOURCE_ADDRESS_COMMON
330 UINT64 TranslationOffset
;
331 UINT64 AddressLength
;
334 } AML_RESOURCE_EXTENDED_ADDRESS64
;
336 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
339 typedef struct aml_resource_address64
341 AML_RESOURCE_LARGE_HEADER_COMMON
342 AML_RESOURCE_ADDRESS_COMMON
346 UINT64 TranslationOffset
;
347 UINT64 AddressLength
;
349 } AML_RESOURCE_ADDRESS64
;
352 typedef struct aml_resource_address32
354 AML_RESOURCE_LARGE_HEADER_COMMON
355 AML_RESOURCE_ADDRESS_COMMON
359 UINT32 TranslationOffset
;
360 UINT32 AddressLength
;
362 } AML_RESOURCE_ADDRESS32
;
365 typedef struct aml_resource_address16
367 AML_RESOURCE_LARGE_HEADER_COMMON
368 AML_RESOURCE_ADDRESS_COMMON
372 UINT16 TranslationOffset
;
373 UINT16 AddressLength
;
375 } AML_RESOURCE_ADDRESS16
;
378 typedef struct aml_resource_extended_irq
380 AML_RESOURCE_LARGE_HEADER_COMMON
382 UINT8 InterruptCount
;
383 UINT32 Interrupts
[1];
384 /* ResSourceIndex, ResSource optional fields follow */
386 } AML_RESOURCE_EXTENDED_IRQ
;
389 typedef struct aml_resource_generic_register
391 AML_RESOURCE_LARGE_HEADER_COMMON
392 UINT8 AddressSpaceId
;
395 UINT8 AccessSize
; /* ACPI 3.0, was previously Reserved */
398 } AML_RESOURCE_GENERIC_REGISTER
;
401 /* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
403 typedef struct aml_resource_gpio
405 AML_RESOURCE_LARGE_HEADER_COMMON
407 UINT8 ConnectionType
;
411 UINT16 DriveStrength
;
412 UINT16 DebounceTimeout
;
413 UINT16 PinTableOffset
;
414 UINT8 ResSourceIndex
;
415 UINT16 ResSourceOffset
;
419 * Optional fields follow immediately:
420 * 1) PIN list (Words)
421 * 2) Resource Source String
422 * 3) Vendor Data bytes
427 #define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */
429 /* Values for ConnectionType above */
431 #define AML_RESOURCE_GPIO_TYPE_INT 0
432 #define AML_RESOURCE_GPIO_TYPE_IO 1
433 #define AML_RESOURCE_MAX_GPIOTYPE 1
436 /* Common preamble for all serial descriptors (ACPI 5.0) */
438 #define AML_RESOURCE_SERIAL_COMMON \
440 UINT8 ResSourceIndex; \
443 UINT16 TypeSpecificFlags; \
444 UINT8 TypeRevisionId; \
445 UINT16 TypeDataLength; \
447 /* Values for the type field above */
449 #define AML_RESOURCE_I2C_SERIALBUSTYPE 1
450 #define AML_RESOURCE_SPI_SERIALBUSTYPE 2
451 #define AML_RESOURCE_UART_SERIALBUSTYPE 3
452 #define AML_RESOURCE_MAX_SERIALBUSTYPE 3
453 #define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
455 typedef struct aml_resource_common_serialbus
457 AML_RESOURCE_LARGE_HEADER_COMMON
458 AML_RESOURCE_SERIAL_COMMON
460 } AML_RESOURCE_COMMON_SERIALBUS
;
462 typedef struct aml_resource_i2c_serialbus
464 AML_RESOURCE_LARGE_HEADER_COMMON
465 AML_RESOURCE_SERIAL_COMMON
466 UINT32 ConnectionSpeed
;
469 * Optional fields follow immediately:
470 * 1) Vendor Data bytes
471 * 2) Resource Source String
474 } AML_RESOURCE_I2C_SERIALBUS
;
476 #define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */
477 #define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */
478 #define AML_RESOURCE_I2C_MIN_DATA_LEN 6
480 typedef struct aml_resource_spi_serialbus
482 AML_RESOURCE_LARGE_HEADER_COMMON
483 AML_RESOURCE_SERIAL_COMMON
484 UINT32 ConnectionSpeed
;
488 UINT16 DeviceSelection
;
490 * Optional fields follow immediately:
491 * 1) Vendor Data bytes
492 * 2) Resource Source String
495 } AML_RESOURCE_SPI_SERIALBUS
;
497 #define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */
498 #define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */
499 #define AML_RESOURCE_SPI_MIN_DATA_LEN 9
502 typedef struct aml_resource_uart_serialbus
504 AML_RESOURCE_LARGE_HEADER_COMMON
505 AML_RESOURCE_SERIAL_COMMON
506 UINT32 DefaultBaudRate
;
512 * Optional fields follow immediately:
513 * 1) Vendor Data bytes
514 * 2) Resource Source String
517 } AML_RESOURCE_UART_SERIALBUS
;
519 #define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */
520 #define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */
521 #define AML_RESOURCE_UART_MIN_DATA_LEN 10
524 /* restore default alignment */
528 /* Union of all resource descriptors, so we can allocate the worst case */
530 typedef union aml_resource
532 /* Descriptor headers */
534 UINT8 DescriptorType
;
535 AML_RESOURCE_SMALL_HEADER SmallHeader
;
536 AML_RESOURCE_LARGE_HEADER LargeHeader
;
538 /* Small resource descriptors */
540 AML_RESOURCE_IRQ Irq
;
541 AML_RESOURCE_DMA Dma
;
542 AML_RESOURCE_START_DEPENDENT StartDpf
;
543 AML_RESOURCE_END_DEPENDENT EndDpf
;
545 AML_RESOURCE_FIXED_IO FixedIo
;
546 AML_RESOURCE_FIXED_DMA FixedDma
;
547 AML_RESOURCE_VENDOR_SMALL VendorSmall
;
548 AML_RESOURCE_END_TAG EndTag
;
550 /* Large resource descriptors */
552 AML_RESOURCE_MEMORY24 Memory24
;
553 AML_RESOURCE_GENERIC_REGISTER GenericReg
;
554 AML_RESOURCE_VENDOR_LARGE VendorLarge
;
555 AML_RESOURCE_MEMORY32 Memory32
;
556 AML_RESOURCE_FIXED_MEMORY32 FixedMemory32
;
557 AML_RESOURCE_ADDRESS16 Address16
;
558 AML_RESOURCE_ADDRESS32 Address32
;
559 AML_RESOURCE_ADDRESS64 Address64
;
560 AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64
;
561 AML_RESOURCE_EXTENDED_IRQ ExtendedIrq
;
562 AML_RESOURCE_GPIO Gpio
;
563 AML_RESOURCE_I2C_SERIALBUS I2cSerialBus
;
564 AML_RESOURCE_SPI_SERIALBUS SpiSerialBus
;
565 AML_RESOURCE_UART_SERIALBUS UartSerialBus
;
566 AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus
;
568 /* Utility overlays */
570 AML_RESOURCE_ADDRESS Address
;