Fixed compatibility of output.
[AROS.git] / arch / all-pc / acpica / source / include / amlresrc.h
blob8e68559064f2ccd10521fde1b0ac0cb191fb4883
1 /******************************************************************************
3 * Module Name: amlresrc.h - AML resource descriptors
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
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.
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.
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.
44 /* acpisrc:StructDefs -- for acpisrc conversion */
46 #ifndef __AMLRESRC_H
47 #define __AMLRESRC_H
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
119 UINT32 BufferLength;
120 void *Buffer;
121 struct asl_resource_node *Next;
123 } ASL_RESOURCE_NODE;
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.
137 #pragma pack(1)
140 * SMALL descriptors
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
155 UINT16 IrqMask;
156 UINT8 Flags;
158 } AML_RESOURCE_IRQ;
161 typedef struct aml_resource_irq_noflags
163 AML_RESOURCE_SMALL_HEADER_COMMON
164 UINT16 IrqMask;
166 } AML_RESOURCE_IRQ_NOFLAGS;
169 typedef struct aml_resource_dma
171 AML_RESOURCE_SMALL_HEADER_COMMON
172 UINT8 DmaChannelMask;
173 UINT8 Flags;
175 } AML_RESOURCE_DMA;
178 typedef struct aml_resource_start_dependent
180 AML_RESOURCE_SMALL_HEADER_COMMON
181 UINT8 Flags;
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
203 UINT8 Flags;
204 UINT16 Minimum;
205 UINT16 Maximum;
206 UINT8 Alignment;
207 UINT8 AddressLength;
209 } AML_RESOURCE_IO;
212 typedef struct aml_resource_fixed_io
214 AML_RESOURCE_SMALL_HEADER_COMMON
215 UINT16 Address;
216 UINT8 AddressLength;
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
231 UINT8 Checksum;
233 } AML_RESOURCE_END_TAG;
236 typedef struct aml_resource_fixed_dma
238 AML_RESOURCE_SMALL_HEADER_COMMON
239 UINT16 RequestLines;
240 UINT16 Channels;
241 UINT8 Width;
243 } AML_RESOURCE_FIXED_DMA;
247 * LARGE descriptors
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
269 UINT8 Flags;
270 UINT16 Minimum;
271 UINT16 Maximum;
272 UINT16 Alignment;
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
288 UINT8 Flags;
289 UINT32 Minimum;
290 UINT32 Maximum;
291 UINT32 Alignment;
292 UINT32 AddressLength;
294 } AML_RESOURCE_MEMORY32;
297 typedef struct aml_resource_fixed_memory32
299 AML_RESOURCE_LARGE_HEADER_COMMON
300 UINT8 Flags;
301 UINT32 Address;
302 UINT32 AddressLength;
304 } AML_RESOURCE_FIXED_MEMORY32;
307 #define AML_RESOURCE_ADDRESS_COMMON \
308 UINT8 ResourceType; \
309 UINT8 Flags; \
310 UINT8 SpecificFlags;
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
325 UINT8 RevisionID;
326 UINT8 Reserved;
327 UINT64 Granularity;
328 UINT64 Minimum;
329 UINT64 Maximum;
330 UINT64 TranslationOffset;
331 UINT64 AddressLength;
332 UINT64 TypeSpecific;
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
343 UINT64 Granularity;
344 UINT64 Minimum;
345 UINT64 Maximum;
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
356 UINT32 Granularity;
357 UINT32 Minimum;
358 UINT32 Maximum;
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
369 UINT16 Granularity;
370 UINT16 Minimum;
371 UINT16 Maximum;
372 UINT16 TranslationOffset;
373 UINT16 AddressLength;
375 } AML_RESOURCE_ADDRESS16;
378 typedef struct aml_resource_extended_irq
380 AML_RESOURCE_LARGE_HEADER_COMMON
381 UINT8 Flags;
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;
393 UINT8 BitWidth;
394 UINT8 BitOffset;
395 UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */
396 UINT64 Address;
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
406 UINT8 RevisionId;
407 UINT8 ConnectionType;
408 UINT16 Flags;
409 UINT16 IntFlags;
410 UINT8 PinConfig;
411 UINT16 DriveStrength;
412 UINT16 DebounceTimeout;
413 UINT16 PinTableOffset;
414 UINT8 ResSourceIndex;
415 UINT16 ResSourceOffset;
416 UINT16 VendorOffset;
417 UINT16 VendorLength;
419 * Optional fields follow immediately:
420 * 1) PIN list (Words)
421 * 2) Resource Source String
422 * 3) Vendor Data bytes
425 } AML_RESOURCE_GPIO;
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 \
439 UINT8 RevisionId; \
440 UINT8 ResSourceIndex; \
441 UINT8 Type; \
442 UINT8 Flags; \
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;
467 UINT16 SlaveAddress;
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;
485 UINT8 DataBitLength;
486 UINT8 ClockPhase;
487 UINT8 ClockPolarity;
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;
507 UINT16 RxFifoSize;
508 UINT16 TxFifoSize;
509 UINT8 Parity;
510 UINT8 LinesEnabled;
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 */
526 #pragma pack()
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;
544 AML_RESOURCE_IO Io;
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;
571 UINT32 DwordItem;
572 UINT16 WordItem;
573 UINT8 ByteItem;
575 } AML_RESOURCE;
577 #endif