xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlresrc.h (revision 97dfeb96704e5dbc5bec32ad7b21379d0125e031)
1 /******************************************************************************
2  *
3  * Module Name: amlresrc.h - AML resource descriptors
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115 
116 /* acpisrc:StructDefs -- for acpisrc conversion */
117 
118 #ifndef __AMLRESRC_H
119 #define __AMLRESRC_H
120 
121 
122 /*
123  * Resource descriptor tags, as defined in the ACPI specification.
124  * Used to symbolically reference fields within a descriptor.
125  */
126 #define ACPI_RESTAG_ADDRESS                     "_ADR"
127 #define ACPI_RESTAG_ALIGNMENT                   "_ALN"
128 #define ACPI_RESTAG_ADDRESSSPACE                "_ASI"
129 #define ACPI_RESTAG_ACCESSSIZE                  "_ASZ"
130 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES      "_ATT"
131 #define ACPI_RESTAG_BASEADDRESS                 "_BAS"
132 #define ACPI_RESTAG_BUSMASTER                   "_BM_"  /* Master(1), Slave(0) */
133 #define ACPI_RESTAG_DEBOUNCETIME                "_DBT"
134 #define ACPI_RESTAG_DECODE                      "_DEC"
135 #define ACPI_RESTAG_DEVICEPOLARITY              "_DPL"
136 #define ACPI_RESTAG_DMA                         "_DMA"
137 #define ACPI_RESTAG_DMATYPE                     "_TYP"  /* Compatible(0), A(1), B(2), F(3) */
138 #define ACPI_RESTAG_DRIVESTRENGTH               "_DRS"
139 #define ACPI_RESTAG_ENDIANNESS                  "_END"
140 #define ACPI_RESTAG_FLOWCONTROL                 "_FLC"
141 #define ACPI_RESTAG_GRANULARITY                 "_GRA"
142 #define ACPI_RESTAG_INTERRUPT                   "_INT"
143 #define ACPI_RESTAG_INTERRUPTLEVEL              "_LL_"  /* ActiveLo(1), ActiveHi(0) */
144 #define ACPI_RESTAG_INTERRUPTSHARE              "_SHR"  /* Shareable(1), NoShare(0) */
145 #define ACPI_RESTAG_INTERRUPTTYPE               "_HE_"  /* Edge(1), Level(0) */
146 #define ACPI_RESTAG_IORESTRICTION               "_IOR"
147 #define ACPI_RESTAG_LENGTH                      "_LEN"
148 #define ACPI_RESTAG_LINE                        "_LIN"
149 #define ACPI_RESTAG_MEMATTRIBUTES               "_MTP"  /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
150 #define ACPI_RESTAG_MEMTYPE                     "_MEM"  /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
151 #define ACPI_RESTAG_MAXADDR                     "_MAX"
152 #define ACPI_RESTAG_MINADDR                     "_MIN"
153 #define ACPI_RESTAG_MAXTYPE                     "_MAF"
154 #define ACPI_RESTAG_MINTYPE                     "_MIF"
155 #define ACPI_RESTAG_MODE                        "_MOD"
156 #define ACPI_RESTAG_PARITY                      "_PAR"
157 #define ACPI_RESTAG_PHASE                       "_PHA"
158 #define ACPI_RESTAG_PIN                         "_PIN"
159 #define ACPI_RESTAG_PINCONFIG                   "_PPI"
160 #define ACPI_RESTAG_POLARITY                    "_POL"
161 #define ACPI_RESTAG_REGISTERBITOFFSET           "_RBO"
162 #define ACPI_RESTAG_REGISTERBITWIDTH            "_RBW"
163 #define ACPI_RESTAG_RANGETYPE                   "_RNG"
164 #define ACPI_RESTAG_READWRITETYPE               "_RW_"  /* ReadOnly(0), Writeable (1) */
165 #define ACPI_RESTAG_LENGTH_RX                   "_RXL"
166 #define ACPI_RESTAG_LENGTH_TX                   "_TXL"
167 #define ACPI_RESTAG_SLAVEMODE                   "_SLV"
168 #define ACPI_RESTAG_SPEED                       "_SPE"
169 #define ACPI_RESTAG_STOPBITS                    "_STB"
170 #define ACPI_RESTAG_TRANSLATION                 "_TRA"
171 #define ACPI_RESTAG_TRANSTYPE                   "_TRS"  /* Sparse(1), Dense(0) */
172 #define ACPI_RESTAG_TYPE                        "_TTP"  /* Translation(1), Static (0) */
173 #define ACPI_RESTAG_XFERTYPE                    "_SIZ"  /* 8(0), 8And16(1), 16(2) */
174 #define ACPI_RESTAG_VENDORDATA                  "_VEN"
175 
176 
177 /* Default sizes for "small" resource descriptors */
178 
179 #define ASL_RDESC_IRQ_SIZE                      0x02
180 #define ASL_RDESC_DMA_SIZE                      0x02
181 #define ASL_RDESC_ST_DEPEND_SIZE                0x00
182 #define ASL_RDESC_END_DEPEND_SIZE               0x00
183 #define ASL_RDESC_IO_SIZE                       0x07
184 #define ASL_RDESC_FIXED_IO_SIZE                 0x03
185 #define ASL_RDESC_FIXED_DMA_SIZE                0x05
186 #define ASL_RDESC_END_TAG_SIZE                  0x01
187 
188 
189 typedef struct asl_resource_node
190 {
191     UINT32                          BufferLength;
192     void                            *Buffer;
193     struct asl_resource_node        *Next;
194 
195 } ASL_RESOURCE_NODE;
196 
197 typedef struct asl_resource_info
198 {
199     ACPI_PARSE_OBJECT               *DescriptorTypeOp;  /* Resource descriptor parse node */
200     ACPI_PARSE_OBJECT               *MappingOp;         /* Used for mapfile support */
201     UINT32                          CurrentByteOffset;  /* Offset in resource template */
202 
203 } ASL_RESOURCE_INFO;
204 
205 
206 /* Macros used to generate AML resource length fields */
207 
208 #define ACPI_AML_SIZE_LARGE(r)      (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
209 #define ACPI_AML_SIZE_SMALL(r)      (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
210 
211 /*
212  * Resource descriptors defined in the ACPI specification.
213  *
214  * Packing/alignment must be BYTE because these descriptors
215  * are used to overlay the raw AML byte stream.
216  */
217 #pragma pack(1)
218 
219 /*
220  * SMALL descriptors
221  */
222 #define AML_RESOURCE_SMALL_HEADER_COMMON \
223     UINT8                           DescriptorType;
224 
225 typedef struct aml_resource_small_header
226 {
227     AML_RESOURCE_SMALL_HEADER_COMMON
228 
229 } AML_RESOURCE_SMALL_HEADER;
230 
231 
232 typedef struct aml_resource_irq
233 {
234     AML_RESOURCE_SMALL_HEADER_COMMON
235     UINT16                          IrqMask;
236     UINT8                           Flags;
237 
238 } AML_RESOURCE_IRQ;
239 
240 
241 typedef struct aml_resource_irq_noflags
242 {
243     AML_RESOURCE_SMALL_HEADER_COMMON
244     UINT16                          IrqMask;
245 
246 } AML_RESOURCE_IRQ_NOFLAGS;
247 
248 
249 typedef struct aml_resource_dma
250 {
251     AML_RESOURCE_SMALL_HEADER_COMMON
252     UINT8                           DmaChannelMask;
253     UINT8                           Flags;
254 
255 } AML_RESOURCE_DMA;
256 
257 
258 typedef struct aml_resource_start_dependent
259 {
260     AML_RESOURCE_SMALL_HEADER_COMMON
261     UINT8                           Flags;
262 
263 } AML_RESOURCE_START_DEPENDENT;
264 
265 
266 typedef struct aml_resource_start_dependent_noprio
267 {
268     AML_RESOURCE_SMALL_HEADER_COMMON
269 
270 } AML_RESOURCE_START_DEPENDENT_NOPRIO;
271 
272 
273 typedef struct aml_resource_end_dependent
274 {
275     AML_RESOURCE_SMALL_HEADER_COMMON
276 
277 } AML_RESOURCE_END_DEPENDENT;
278 
279 
280 typedef struct aml_resource_io
281 {
282     AML_RESOURCE_SMALL_HEADER_COMMON
283     UINT8                           Flags;
284     UINT16                          Minimum;
285     UINT16                          Maximum;
286     UINT8                           Alignment;
287     UINT8                           AddressLength;
288 
289 } AML_RESOURCE_IO;
290 
291 
292 typedef struct aml_resource_fixed_io
293 {
294     AML_RESOURCE_SMALL_HEADER_COMMON
295     UINT16                          Address;
296     UINT8                           AddressLength;
297 
298 } AML_RESOURCE_FIXED_IO;
299 
300 
301 typedef struct aml_resource_vendor_small
302 {
303     AML_RESOURCE_SMALL_HEADER_COMMON
304 
305 } AML_RESOURCE_VENDOR_SMALL;
306 
307 
308 typedef struct aml_resource_end_tag
309 {
310     AML_RESOURCE_SMALL_HEADER_COMMON
311     UINT8                           Checksum;
312 
313 } AML_RESOURCE_END_TAG;
314 
315 
316 typedef struct aml_resource_fixed_dma
317 {
318     AML_RESOURCE_SMALL_HEADER_COMMON
319     UINT16                          RequestLines;
320     UINT16                          Channels;
321     UINT8                           Width;
322 
323 } AML_RESOURCE_FIXED_DMA;
324 
325 
326 /*
327  * LARGE descriptors
328  */
329 #define AML_RESOURCE_LARGE_HEADER_COMMON \
330     UINT8                           DescriptorType;\
331     UINT16                          ResourceLength;
332 
333 typedef struct aml_resource_large_header
334 {
335     AML_RESOURCE_LARGE_HEADER_COMMON
336 
337 } AML_RESOURCE_LARGE_HEADER;
338 
339 
340 /* General Flags for address space resource descriptors */
341 
342 #define ACPI_RESOURCE_FLAG_DEC      2
343 #define ACPI_RESOURCE_FLAG_MIF      4
344 #define ACPI_RESOURCE_FLAG_MAF      8
345 
346 typedef struct aml_resource_memory24
347 {
348     AML_RESOURCE_LARGE_HEADER_COMMON
349     UINT8                           Flags;
350     UINT16                          Minimum;
351     UINT16                          Maximum;
352     UINT16                          Alignment;
353     UINT16                          AddressLength;
354 
355 } AML_RESOURCE_MEMORY24;
356 
357 
358 typedef struct aml_resource_vendor_large
359 {
360     AML_RESOURCE_LARGE_HEADER_COMMON
361 
362 } AML_RESOURCE_VENDOR_LARGE;
363 
364 
365 typedef struct aml_resource_memory32
366 {
367     AML_RESOURCE_LARGE_HEADER_COMMON
368     UINT8                           Flags;
369     UINT32                          Minimum;
370     UINT32                          Maximum;
371     UINT32                          Alignment;
372     UINT32                          AddressLength;
373 
374 } AML_RESOURCE_MEMORY32;
375 
376 
377 typedef struct aml_resource_fixed_memory32
378 {
379     AML_RESOURCE_LARGE_HEADER_COMMON
380     UINT8                           Flags;
381     UINT32                          Address;
382     UINT32                          AddressLength;
383 
384 } AML_RESOURCE_FIXED_MEMORY32;
385 
386 
387 #define AML_RESOURCE_ADDRESS_COMMON \
388     UINT8                           ResourceType; \
389     UINT8                           Flags; \
390     UINT8                           SpecificFlags;
391 
392 
393 typedef struct aml_resource_address
394 {
395     AML_RESOURCE_LARGE_HEADER_COMMON
396     AML_RESOURCE_ADDRESS_COMMON
397 
398 } AML_RESOURCE_ADDRESS;
399 
400 
401 typedef struct aml_resource_extended_address64
402 {
403     AML_RESOURCE_LARGE_HEADER_COMMON
404     AML_RESOURCE_ADDRESS_COMMON
405     UINT8                           RevisionID;
406     UINT8                           Reserved;
407     UINT64                          Granularity;
408     UINT64                          Minimum;
409     UINT64                          Maximum;
410     UINT64                          TranslationOffset;
411     UINT64                          AddressLength;
412     UINT64                          TypeSpecific;
413 
414 } AML_RESOURCE_EXTENDED_ADDRESS64;
415 
416 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION          1       /* ACPI 3.0 */
417 
418 
419 typedef struct aml_resource_address64
420 {
421     AML_RESOURCE_LARGE_HEADER_COMMON
422     AML_RESOURCE_ADDRESS_COMMON
423     UINT64                          Granularity;
424     UINT64                          Minimum;
425     UINT64                          Maximum;
426     UINT64                          TranslationOffset;
427     UINT64                          AddressLength;
428 
429 } AML_RESOURCE_ADDRESS64;
430 
431 
432 typedef struct aml_resource_address32
433 {
434     AML_RESOURCE_LARGE_HEADER_COMMON
435     AML_RESOURCE_ADDRESS_COMMON
436     UINT32                          Granularity;
437     UINT32                          Minimum;
438     UINT32                          Maximum;
439     UINT32                          TranslationOffset;
440     UINT32                          AddressLength;
441 
442 } AML_RESOURCE_ADDRESS32;
443 
444 
445 typedef struct aml_resource_address16
446 {
447     AML_RESOURCE_LARGE_HEADER_COMMON
448     AML_RESOURCE_ADDRESS_COMMON
449     UINT16                          Granularity;
450     UINT16                          Minimum;
451     UINT16                          Maximum;
452     UINT16                          TranslationOffset;
453     UINT16                          AddressLength;
454 
455 } AML_RESOURCE_ADDRESS16;
456 
457 
458 typedef struct aml_resource_extended_irq
459 {
460     AML_RESOURCE_LARGE_HEADER_COMMON
461     UINT8                           Flags;
462     UINT8                           InterruptCount;
463     UINT32                          Interrupts[1];
464     /* ResSourceIndex, ResSource optional fields follow */
465 
466 } AML_RESOURCE_EXTENDED_IRQ;
467 
468 
469 typedef struct aml_resource_generic_register
470 {
471     AML_RESOURCE_LARGE_HEADER_COMMON
472     UINT8                           AddressSpaceId;
473     UINT8                           BitWidth;
474     UINT8                           BitOffset;
475     UINT8                           AccessSize; /* ACPI 3.0, was previously Reserved */
476     UINT64                          Address;
477 
478 } AML_RESOURCE_GENERIC_REGISTER;
479 
480 
481 /* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
482 
483 typedef struct aml_resource_gpio
484 {
485     AML_RESOURCE_LARGE_HEADER_COMMON
486     UINT8                           RevisionId;
487     UINT8                           ConnectionType;
488     UINT16                          Flags;
489     UINT16                          IntFlags;
490     UINT8                           PinConfig;
491     UINT16                          DriveStrength;
492     UINT16                          DebounceTimeout;
493     UINT16                          PinTableOffset;
494     UINT8                           ResSourceIndex;
495     UINT16                          ResSourceOffset;
496     UINT16                          VendorOffset;
497     UINT16                          VendorLength;
498     /*
499      * Optional fields follow immediately:
500      * 1) PIN list (Words)
501      * 2) Resource Source String
502      * 3) Vendor Data bytes
503      */
504 
505 } AML_RESOURCE_GPIO;
506 
507 #define AML_RESOURCE_GPIO_REVISION              1       /* ACPI 5.0 */
508 
509 /* Values for ConnectionType above */
510 
511 #define AML_RESOURCE_GPIO_TYPE_INT              0
512 #define AML_RESOURCE_GPIO_TYPE_IO               1
513 #define AML_RESOURCE_MAX_GPIOTYPE               1
514 
515 
516 /* Common preamble for all serial descriptors (ACPI 5.0) */
517 
518 #define AML_RESOURCE_SERIAL_COMMON \
519     UINT8                           RevisionId; \
520     UINT8                           ResSourceIndex; \
521     UINT8                           Type; \
522     UINT8                           Flags; \
523     UINT16                          TypeSpecificFlags; \
524     UINT8                           TypeRevisionId; \
525     UINT16                          TypeDataLength; \
526 
527 /* Values for the type field above */
528 
529 #define AML_RESOURCE_I2C_SERIALBUSTYPE          1
530 #define AML_RESOURCE_SPI_SERIALBUSTYPE          2
531 #define AML_RESOURCE_UART_SERIALBUSTYPE         3
532 #define AML_RESOURCE_MAX_SERIALBUSTYPE          3
533 #define AML_RESOURCE_VENDOR_SERIALBUSTYPE       192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
534 
535 typedef struct aml_resource_common_serialbus
536 {
537     AML_RESOURCE_LARGE_HEADER_COMMON
538     AML_RESOURCE_SERIAL_COMMON
539 
540 } AML_RESOURCE_COMMON_SERIALBUS;
541 
542 typedef struct aml_resource_i2c_serialbus
543 {
544     AML_RESOURCE_LARGE_HEADER_COMMON
545     AML_RESOURCE_SERIAL_COMMON
546     UINT32                          ConnectionSpeed;
547     UINT16                          SlaveAddress;
548     /*
549      * Optional fields follow immediately:
550      * 1) Vendor Data bytes
551      * 2) Resource Source String
552      */
553 
554 } AML_RESOURCE_I2C_SERIALBUS;
555 
556 #define AML_RESOURCE_I2C_REVISION               1       /* ACPI 5.0 */
557 #define AML_RESOURCE_I2C_TYPE_REVISION          1       /* ACPI 5.0 */
558 #define AML_RESOURCE_I2C_MIN_DATA_LEN           6
559 
560 typedef struct aml_resource_spi_serialbus
561 {
562     AML_RESOURCE_LARGE_HEADER_COMMON
563     AML_RESOURCE_SERIAL_COMMON
564     UINT32                          ConnectionSpeed;
565     UINT8                           DataBitLength;
566     UINT8                           ClockPhase;
567     UINT8                           ClockPolarity;
568     UINT16                          DeviceSelection;
569     /*
570      * Optional fields follow immediately:
571      * 1) Vendor Data bytes
572      * 2) Resource Source String
573      */
574 
575 } AML_RESOURCE_SPI_SERIALBUS;
576 
577 #define AML_RESOURCE_SPI_REVISION               1       /* ACPI 5.0 */
578 #define AML_RESOURCE_SPI_TYPE_REVISION          1       /* ACPI 5.0 */
579 #define AML_RESOURCE_SPI_MIN_DATA_LEN           9
580 
581 
582 typedef struct aml_resource_uart_serialbus
583 {
584     AML_RESOURCE_LARGE_HEADER_COMMON
585     AML_RESOURCE_SERIAL_COMMON
586     UINT32                          DefaultBaudRate;
587     UINT16                          RxFifoSize;
588     UINT16                          TxFifoSize;
589     UINT8                           Parity;
590     UINT8                           LinesEnabled;
591     /*
592      * Optional fields follow immediately:
593      * 1) Vendor Data bytes
594      * 2) Resource Source String
595      */
596 
597 } AML_RESOURCE_UART_SERIALBUS;
598 
599 #define AML_RESOURCE_UART_REVISION              1       /* ACPI 5.0 */
600 #define AML_RESOURCE_UART_TYPE_REVISION         1       /* ACPI 5.0 */
601 #define AML_RESOURCE_UART_MIN_DATA_LEN          10
602 
603 
604 /* restore default alignment */
605 
606 #pragma pack()
607 
608 /* Union of all resource descriptors, so we can allocate the worst case */
609 
610 typedef union aml_resource
611 {
612     /* Descriptor headers */
613 
614     UINT8                                   DescriptorType;
615     AML_RESOURCE_SMALL_HEADER               SmallHeader;
616     AML_RESOURCE_LARGE_HEADER               LargeHeader;
617 
618     /* Small resource descriptors */
619 
620     AML_RESOURCE_IRQ                        Irq;
621     AML_RESOURCE_DMA                        Dma;
622     AML_RESOURCE_START_DEPENDENT            StartDpf;
623     AML_RESOURCE_END_DEPENDENT              EndDpf;
624     AML_RESOURCE_IO                         Io;
625     AML_RESOURCE_FIXED_IO                   FixedIo;
626     AML_RESOURCE_FIXED_DMA                  FixedDma;
627     AML_RESOURCE_VENDOR_SMALL               VendorSmall;
628     AML_RESOURCE_END_TAG                    EndTag;
629 
630     /* Large resource descriptors */
631 
632     AML_RESOURCE_MEMORY24                   Memory24;
633     AML_RESOURCE_GENERIC_REGISTER           GenericReg;
634     AML_RESOURCE_VENDOR_LARGE               VendorLarge;
635     AML_RESOURCE_MEMORY32                   Memory32;
636     AML_RESOURCE_FIXED_MEMORY32             FixedMemory32;
637     AML_RESOURCE_ADDRESS16                  Address16;
638     AML_RESOURCE_ADDRESS32                  Address32;
639     AML_RESOURCE_ADDRESS64                  Address64;
640     AML_RESOURCE_EXTENDED_ADDRESS64         ExtAddress64;
641     AML_RESOURCE_EXTENDED_IRQ               ExtendedIrq;
642     AML_RESOURCE_GPIO                       Gpio;
643     AML_RESOURCE_I2C_SERIALBUS              I2cSerialBus;
644     AML_RESOURCE_SPI_SERIALBUS              SpiSerialBus;
645     AML_RESOURCE_UART_SERIALBUS             UartSerialBus;
646     AML_RESOURCE_COMMON_SERIALBUS           CommonSerialBus;
647 
648     /* Utility overlays */
649 
650     AML_RESOURCE_ADDRESS                    Address;
651     UINT32                                  DwordItem;
652     UINT16                                  WordItem;
653     UINT8                                   ByteItem;
654 
655 } AML_RESOURCE;
656 
657 
658 /* Interfaces used by both the disassembler and compiler */
659 
660 void
661 MpSaveGpioInfo (
662     ACPI_PARSE_OBJECT       *Op,
663     AML_RESOURCE            *Resource,
664     UINT32                  PinCount,
665     UINT16                  *PinList,
666     char                    *DeviceName);
667 
668 void
669 MpSaveSerialInfo (
670     ACPI_PARSE_OBJECT       *Op,
671     AML_RESOURCE            *Resource,
672     char                    *DeviceName);
673 
674 char *
675 MpGetHidFromParseTree (
676     ACPI_NAMESPACE_NODE     *HidNode);
677 
678 char *
679 MpGetHidViaNamestring (
680     char                    *DeviceName);
681 
682 char *
683 MpGetConnectionInfo (
684     ACPI_PARSE_OBJECT       *Op,
685     UINT32                  PinIndex,
686     ACPI_NAMESPACE_NODE     **TargetNode,
687     char                    **TargetName);
688 
689 char *
690 MpGetParentDeviceHid (
691     ACPI_PARSE_OBJECT       *Op,
692     ACPI_NAMESPACE_NODE     **TargetNode,
693     char                    **ParentDeviceName);
694 
695 char *
696 MpGetDdnValue (
697     char                    *DeviceName);
698 
699 char *
700 MpGetHidValue (
701     ACPI_NAMESPACE_NODE     *DeviceNode);
702 
703 #endif
704