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 - 2017, 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  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 /* acpisrc:StructDefs -- for acpisrc conversion */
153 
154 #ifndef __AMLRESRC_H
155 #define __AMLRESRC_H
156 
157 
158 /*
159  * Resource descriptor tags, as defined in the ACPI specification.
160  * Used to symbolically reference fields within a descriptor.
161  */
162 #define ACPI_RESTAG_ADDRESS                     "_ADR"
163 #define ACPI_RESTAG_ALIGNMENT                   "_ALN"
164 #define ACPI_RESTAG_ADDRESSSPACE                "_ASI"
165 #define ACPI_RESTAG_ACCESSSIZE                  "_ASZ"
166 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES      "_ATT"
167 #define ACPI_RESTAG_BASEADDRESS                 "_BAS"
168 #define ACPI_RESTAG_BUSMASTER                   "_BM_"  /* Master(1), Slave(0) */
169 #define ACPI_RESTAG_DEBOUNCETIME                "_DBT"
170 #define ACPI_RESTAG_DECODE                      "_DEC"
171 #define ACPI_RESTAG_DEVICEPOLARITY              "_DPL"
172 #define ACPI_RESTAG_DMA                         "_DMA"
173 #define ACPI_RESTAG_DMATYPE                     "_TYP"  /* Compatible(0), A(1), B(2), F(3) */
174 #define ACPI_RESTAG_DRIVESTRENGTH               "_DRS"
175 #define ACPI_RESTAG_ENDIANNESS                  "_END"
176 #define ACPI_RESTAG_FLOWCONTROL                 "_FLC"
177 #define ACPI_RESTAG_GRANULARITY                 "_GRA"
178 #define ACPI_RESTAG_INTERRUPT                   "_INT"
179 #define ACPI_RESTAG_INTERRUPTLEVEL              "_LL_"  /* ActiveLo(1), ActiveHi(0) */
180 #define ACPI_RESTAG_INTERRUPTSHARE              "_SHR"  /* Shareable(1), NoShare(0) */
181 #define ACPI_RESTAG_INTERRUPTTYPE               "_HE_"  /* Edge(1), Level(0) */
182 #define ACPI_RESTAG_IORESTRICTION               "_IOR"
183 #define ACPI_RESTAG_LENGTH                      "_LEN"
184 #define ACPI_RESTAG_LINE                        "_LIN"
185 #define ACPI_RESTAG_MEMATTRIBUTES               "_MTP"  /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
186 #define ACPI_RESTAG_MEMTYPE                     "_MEM"  /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
187 #define ACPI_RESTAG_MAXADDR                     "_MAX"
188 #define ACPI_RESTAG_MINADDR                     "_MIN"
189 #define ACPI_RESTAG_MAXTYPE                     "_MAF"
190 #define ACPI_RESTAG_MINTYPE                     "_MIF"
191 #define ACPI_RESTAG_MODE                        "_MOD"
192 #define ACPI_RESTAG_PARITY                      "_PAR"
193 #define ACPI_RESTAG_PHASE                       "_PHA"
194 #define ACPI_RESTAG_PIN                         "_PIN"
195 #define ACPI_RESTAG_PINCONFIG                   "_PPI"
196 #define ACPI_RESTAG_POLARITY                    "_POL"
197 #define ACPI_RESTAG_REGISTERBITOFFSET           "_RBO"
198 #define ACPI_RESTAG_REGISTERBITWIDTH            "_RBW"
199 #define ACPI_RESTAG_RANGETYPE                   "_RNG"
200 #define ACPI_RESTAG_READWRITETYPE               "_RW_"  /* ReadOnly(0), Writeable (1) */
201 #define ACPI_RESTAG_LENGTH_RX                   "_RXL"
202 #define ACPI_RESTAG_LENGTH_TX                   "_TXL"
203 #define ACPI_RESTAG_SLAVEMODE                   "_SLV"
204 #define ACPI_RESTAG_SPEED                       "_SPE"
205 #define ACPI_RESTAG_STOPBITS                    "_STB"
206 #define ACPI_RESTAG_TRANSLATION                 "_TRA"
207 #define ACPI_RESTAG_TRANSTYPE                   "_TRS"  /* Sparse(1), Dense(0) */
208 #define ACPI_RESTAG_TYPE                        "_TTP"  /* Translation(1), Static (0) */
209 #define ACPI_RESTAG_XFERTYPE                    "_SIZ"  /* 8(0), 8And16(1), 16(2) */
210 #define ACPI_RESTAG_VENDORDATA                  "_VEN"
211 
212 
213 /* Default sizes for "small" resource descriptors */
214 
215 #define ASL_RDESC_IRQ_SIZE                      0x02
216 #define ASL_RDESC_DMA_SIZE                      0x02
217 #define ASL_RDESC_ST_DEPEND_SIZE                0x00
218 #define ASL_RDESC_END_DEPEND_SIZE               0x00
219 #define ASL_RDESC_IO_SIZE                       0x07
220 #define ASL_RDESC_FIXED_IO_SIZE                 0x03
221 #define ASL_RDESC_FIXED_DMA_SIZE                0x05
222 #define ASL_RDESC_END_TAG_SIZE                  0x01
223 
224 
225 typedef struct asl_resource_node
226 {
227     UINT32                          BufferLength;
228     void                            *Buffer;
229     struct asl_resource_node        *Next;
230 
231 } ASL_RESOURCE_NODE;
232 
233 typedef struct asl_resource_info
234 {
235     ACPI_PARSE_OBJECT               *DescriptorTypeOp;  /* Resource descriptor parse node */
236     ACPI_PARSE_OBJECT               *MappingOp;         /* Used for mapfile support */
237     UINT32                          CurrentByteOffset;  /* Offset in resource template */
238 
239 } ASL_RESOURCE_INFO;
240 
241 
242 /* Macros used to generate AML resource length fields */
243 
244 #define ACPI_AML_SIZE_LARGE(r)      (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
245 #define ACPI_AML_SIZE_SMALL(r)      (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
246 
247 /*
248  * Resource descriptors defined in the ACPI specification.
249  *
250  * Packing/alignment must be BYTE because these descriptors
251  * are used to overlay the raw AML byte stream.
252  */
253 #pragma pack(1)
254 
255 /*
256  * SMALL descriptors
257  */
258 #define AML_RESOURCE_SMALL_HEADER_COMMON \
259     UINT8                           DescriptorType;
260 
261 typedef struct aml_resource_small_header
262 {
263     AML_RESOURCE_SMALL_HEADER_COMMON
264 
265 } AML_RESOURCE_SMALL_HEADER;
266 
267 
268 typedef struct aml_resource_irq
269 {
270     AML_RESOURCE_SMALL_HEADER_COMMON
271     UINT16                          IrqMask;
272     UINT8                           Flags;
273 
274 } AML_RESOURCE_IRQ;
275 
276 
277 typedef struct aml_resource_irq_noflags
278 {
279     AML_RESOURCE_SMALL_HEADER_COMMON
280     UINT16                          IrqMask;
281 
282 } AML_RESOURCE_IRQ_NOFLAGS;
283 
284 
285 typedef struct aml_resource_dma
286 {
287     AML_RESOURCE_SMALL_HEADER_COMMON
288     UINT8                           DmaChannelMask;
289     UINT8                           Flags;
290 
291 } AML_RESOURCE_DMA;
292 
293 
294 typedef struct aml_resource_start_dependent
295 {
296     AML_RESOURCE_SMALL_HEADER_COMMON
297     UINT8                           Flags;
298 
299 } AML_RESOURCE_START_DEPENDENT;
300 
301 
302 typedef struct aml_resource_start_dependent_noprio
303 {
304     AML_RESOURCE_SMALL_HEADER_COMMON
305 
306 } AML_RESOURCE_START_DEPENDENT_NOPRIO;
307 
308 
309 typedef struct aml_resource_end_dependent
310 {
311     AML_RESOURCE_SMALL_HEADER_COMMON
312 
313 } AML_RESOURCE_END_DEPENDENT;
314 
315 
316 typedef struct aml_resource_io
317 {
318     AML_RESOURCE_SMALL_HEADER_COMMON
319     UINT8                           Flags;
320     UINT16                          Minimum;
321     UINT16                          Maximum;
322     UINT8                           Alignment;
323     UINT8                           AddressLength;
324 
325 } AML_RESOURCE_IO;
326 
327 
328 typedef struct aml_resource_fixed_io
329 {
330     AML_RESOURCE_SMALL_HEADER_COMMON
331     UINT16                          Address;
332     UINT8                           AddressLength;
333 
334 } AML_RESOURCE_FIXED_IO;
335 
336 
337 typedef struct aml_resource_vendor_small
338 {
339     AML_RESOURCE_SMALL_HEADER_COMMON
340 
341 } AML_RESOURCE_VENDOR_SMALL;
342 
343 
344 typedef struct aml_resource_end_tag
345 {
346     AML_RESOURCE_SMALL_HEADER_COMMON
347     UINT8                           Checksum;
348 
349 } AML_RESOURCE_END_TAG;
350 
351 
352 typedef struct aml_resource_fixed_dma
353 {
354     AML_RESOURCE_SMALL_HEADER_COMMON
355     UINT16                          RequestLines;
356     UINT16                          Channels;
357     UINT8                           Width;
358 
359 } AML_RESOURCE_FIXED_DMA;
360 
361 
362 /*
363  * LARGE descriptors
364  */
365 #define AML_RESOURCE_LARGE_HEADER_COMMON \
366     UINT8                           DescriptorType;\
367     UINT16                          ResourceLength;
368 
369 typedef struct aml_resource_large_header
370 {
371     AML_RESOURCE_LARGE_HEADER_COMMON
372 
373 } AML_RESOURCE_LARGE_HEADER;
374 
375 
376 /* General Flags for address space resource descriptors */
377 
378 #define ACPI_RESOURCE_FLAG_DEC      2
379 #define ACPI_RESOURCE_FLAG_MIF      4
380 #define ACPI_RESOURCE_FLAG_MAF      8
381 
382 typedef struct aml_resource_memory24
383 {
384     AML_RESOURCE_LARGE_HEADER_COMMON
385     UINT8                           Flags;
386     UINT16                          Minimum;
387     UINT16                          Maximum;
388     UINT16                          Alignment;
389     UINT16                          AddressLength;
390 
391 } AML_RESOURCE_MEMORY24;
392 
393 
394 typedef struct aml_resource_vendor_large
395 {
396     AML_RESOURCE_LARGE_HEADER_COMMON
397 
398 } AML_RESOURCE_VENDOR_LARGE;
399 
400 
401 typedef struct aml_resource_memory32
402 {
403     AML_RESOURCE_LARGE_HEADER_COMMON
404     UINT8                           Flags;
405     UINT32                          Minimum;
406     UINT32                          Maximum;
407     UINT32                          Alignment;
408     UINT32                          AddressLength;
409 
410 } AML_RESOURCE_MEMORY32;
411 
412 
413 typedef struct aml_resource_fixed_memory32
414 {
415     AML_RESOURCE_LARGE_HEADER_COMMON
416     UINT8                           Flags;
417     UINT32                          Address;
418     UINT32                          AddressLength;
419 
420 } AML_RESOURCE_FIXED_MEMORY32;
421 
422 
423 #define AML_RESOURCE_ADDRESS_COMMON \
424     UINT8                           ResourceType; \
425     UINT8                           Flags; \
426     UINT8                           SpecificFlags;
427 
428 
429 typedef struct aml_resource_address
430 {
431     AML_RESOURCE_LARGE_HEADER_COMMON
432     AML_RESOURCE_ADDRESS_COMMON
433 
434 } AML_RESOURCE_ADDRESS;
435 
436 
437 typedef struct aml_resource_extended_address64
438 {
439     AML_RESOURCE_LARGE_HEADER_COMMON
440     AML_RESOURCE_ADDRESS_COMMON
441     UINT8                           RevisionID;
442     UINT8                           Reserved;
443     UINT64                          Granularity;
444     UINT64                          Minimum;
445     UINT64                          Maximum;
446     UINT64                          TranslationOffset;
447     UINT64                          AddressLength;
448     UINT64                          TypeSpecific;
449 
450 } AML_RESOURCE_EXTENDED_ADDRESS64;
451 
452 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION          1       /* ACPI 3.0 */
453 
454 
455 typedef struct aml_resource_address64
456 {
457     AML_RESOURCE_LARGE_HEADER_COMMON
458     AML_RESOURCE_ADDRESS_COMMON
459     UINT64                          Granularity;
460     UINT64                          Minimum;
461     UINT64                          Maximum;
462     UINT64                          TranslationOffset;
463     UINT64                          AddressLength;
464 
465 } AML_RESOURCE_ADDRESS64;
466 
467 
468 typedef struct aml_resource_address32
469 {
470     AML_RESOURCE_LARGE_HEADER_COMMON
471     AML_RESOURCE_ADDRESS_COMMON
472     UINT32                          Granularity;
473     UINT32                          Minimum;
474     UINT32                          Maximum;
475     UINT32                          TranslationOffset;
476     UINT32                          AddressLength;
477 
478 } AML_RESOURCE_ADDRESS32;
479 
480 
481 typedef struct aml_resource_address16
482 {
483     AML_RESOURCE_LARGE_HEADER_COMMON
484     AML_RESOURCE_ADDRESS_COMMON
485     UINT16                          Granularity;
486     UINT16                          Minimum;
487     UINT16                          Maximum;
488     UINT16                          TranslationOffset;
489     UINT16                          AddressLength;
490 
491 } AML_RESOURCE_ADDRESS16;
492 
493 
494 typedef struct aml_resource_extended_irq
495 {
496     AML_RESOURCE_LARGE_HEADER_COMMON
497     UINT8                           Flags;
498     UINT8                           InterruptCount;
499     UINT32                          Interrupts[1];
500     /* ResSourceIndex, ResSource optional fields follow */
501 
502 } AML_RESOURCE_EXTENDED_IRQ;
503 
504 
505 typedef struct aml_resource_generic_register
506 {
507     AML_RESOURCE_LARGE_HEADER_COMMON
508     UINT8                           AddressSpaceId;
509     UINT8                           BitWidth;
510     UINT8                           BitOffset;
511     UINT8                           AccessSize; /* ACPI 3.0, was previously Reserved */
512     UINT64                          Address;
513 
514 } AML_RESOURCE_GENERIC_REGISTER;
515 
516 
517 /* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
518 
519 typedef struct aml_resource_gpio
520 {
521     AML_RESOURCE_LARGE_HEADER_COMMON
522     UINT8                           RevisionId;
523     UINT8                           ConnectionType;
524     UINT16                          Flags;
525     UINT16                          IntFlags;
526     UINT8                           PinConfig;
527     UINT16                          DriveStrength;
528     UINT16                          DebounceTimeout;
529     UINT16                          PinTableOffset;
530     UINT8                           ResSourceIndex;
531     UINT16                          ResSourceOffset;
532     UINT16                          VendorOffset;
533     UINT16                          VendorLength;
534     /*
535      * Optional fields follow immediately:
536      * 1) PIN list (Words)
537      * 2) Resource Source String
538      * 3) Vendor Data bytes
539      */
540 
541 } AML_RESOURCE_GPIO;
542 
543 #define AML_RESOURCE_GPIO_REVISION              1       /* ACPI 5.0 */
544 
545 /* Values for ConnectionType above */
546 
547 #define AML_RESOURCE_GPIO_TYPE_INT              0
548 #define AML_RESOURCE_GPIO_TYPE_IO               1
549 #define AML_RESOURCE_MAX_GPIOTYPE               1
550 
551 
552 /* Common preamble for all serial descriptors (ACPI 5.0) */
553 
554 #define AML_RESOURCE_SERIAL_COMMON \
555     UINT8                           RevisionId; \
556     UINT8                           ResSourceIndex; \
557     UINT8                           Type; \
558     UINT8                           Flags; \
559     UINT16                          TypeSpecificFlags; \
560     UINT8                           TypeRevisionId; \
561     UINT16                          TypeDataLength; \
562 
563 /* Values for the type field above */
564 
565 #define AML_RESOURCE_I2C_SERIALBUSTYPE          1
566 #define AML_RESOURCE_SPI_SERIALBUSTYPE          2
567 #define AML_RESOURCE_UART_SERIALBUSTYPE         3
568 #define AML_RESOURCE_MAX_SERIALBUSTYPE          3
569 #define AML_RESOURCE_VENDOR_SERIALBUSTYPE       192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
570 
571 typedef struct aml_resource_common_serialbus
572 {
573     AML_RESOURCE_LARGE_HEADER_COMMON
574     AML_RESOURCE_SERIAL_COMMON
575 
576 } AML_RESOURCE_COMMON_SERIALBUS;
577 
578 typedef struct aml_resource_i2c_serialbus
579 {
580     AML_RESOURCE_LARGE_HEADER_COMMON
581     AML_RESOURCE_SERIAL_COMMON
582     UINT32                          ConnectionSpeed;
583     UINT16                          SlaveAddress;
584     /*
585      * Optional fields follow immediately:
586      * 1) Vendor Data bytes
587      * 2) Resource Source String
588      */
589 
590 } AML_RESOURCE_I2C_SERIALBUS;
591 
592 #define AML_RESOURCE_I2C_REVISION               1       /* ACPI 5.0 */
593 #define AML_RESOURCE_I2C_TYPE_REVISION          1       /* ACPI 5.0 */
594 #define AML_RESOURCE_I2C_MIN_DATA_LEN           6
595 
596 typedef struct aml_resource_spi_serialbus
597 {
598     AML_RESOURCE_LARGE_HEADER_COMMON
599     AML_RESOURCE_SERIAL_COMMON
600     UINT32                          ConnectionSpeed;
601     UINT8                           DataBitLength;
602     UINT8                           ClockPhase;
603     UINT8                           ClockPolarity;
604     UINT16                          DeviceSelection;
605     /*
606      * Optional fields follow immediately:
607      * 1) Vendor Data bytes
608      * 2) Resource Source String
609      */
610 
611 } AML_RESOURCE_SPI_SERIALBUS;
612 
613 #define AML_RESOURCE_SPI_REVISION               1       /* ACPI 5.0 */
614 #define AML_RESOURCE_SPI_TYPE_REVISION          1       /* ACPI 5.0 */
615 #define AML_RESOURCE_SPI_MIN_DATA_LEN           9
616 
617 
618 typedef struct aml_resource_uart_serialbus
619 {
620     AML_RESOURCE_LARGE_HEADER_COMMON
621     AML_RESOURCE_SERIAL_COMMON
622     UINT32                          DefaultBaudRate;
623     UINT16                          RxFifoSize;
624     UINT16                          TxFifoSize;
625     UINT8                           Parity;
626     UINT8                           LinesEnabled;
627     /*
628      * Optional fields follow immediately:
629      * 1) Vendor Data bytes
630      * 2) Resource Source String
631      */
632 
633 } AML_RESOURCE_UART_SERIALBUS;
634 
635 #define AML_RESOURCE_UART_REVISION              1       /* ACPI 5.0 */
636 #define AML_RESOURCE_UART_TYPE_REVISION         1       /* ACPI 5.0 */
637 #define AML_RESOURCE_UART_MIN_DATA_LEN          10
638 
639 
640 /* restore default alignment */
641 
642 #pragma pack()
643 
644 /* Union of all resource descriptors, so we can allocate the worst case */
645 
646 typedef union aml_resource
647 {
648     /* Descriptor headers */
649 
650     UINT8                                   DescriptorType;
651     AML_RESOURCE_SMALL_HEADER               SmallHeader;
652     AML_RESOURCE_LARGE_HEADER               LargeHeader;
653 
654     /* Small resource descriptors */
655 
656     AML_RESOURCE_IRQ                        Irq;
657     AML_RESOURCE_DMA                        Dma;
658     AML_RESOURCE_START_DEPENDENT            StartDpf;
659     AML_RESOURCE_END_DEPENDENT              EndDpf;
660     AML_RESOURCE_IO                         Io;
661     AML_RESOURCE_FIXED_IO                   FixedIo;
662     AML_RESOURCE_FIXED_DMA                  FixedDma;
663     AML_RESOURCE_VENDOR_SMALL               VendorSmall;
664     AML_RESOURCE_END_TAG                    EndTag;
665 
666     /* Large resource descriptors */
667 
668     AML_RESOURCE_MEMORY24                   Memory24;
669     AML_RESOURCE_GENERIC_REGISTER           GenericReg;
670     AML_RESOURCE_VENDOR_LARGE               VendorLarge;
671     AML_RESOURCE_MEMORY32                   Memory32;
672     AML_RESOURCE_FIXED_MEMORY32             FixedMemory32;
673     AML_RESOURCE_ADDRESS16                  Address16;
674     AML_RESOURCE_ADDRESS32                  Address32;
675     AML_RESOURCE_ADDRESS64                  Address64;
676     AML_RESOURCE_EXTENDED_ADDRESS64         ExtAddress64;
677     AML_RESOURCE_EXTENDED_IRQ               ExtendedIrq;
678     AML_RESOURCE_GPIO                       Gpio;
679     AML_RESOURCE_I2C_SERIALBUS              I2cSerialBus;
680     AML_RESOURCE_SPI_SERIALBUS              SpiSerialBus;
681     AML_RESOURCE_UART_SERIALBUS             UartSerialBus;
682     AML_RESOURCE_COMMON_SERIALBUS           CommonSerialBus;
683 
684     /* Utility overlays */
685 
686     AML_RESOURCE_ADDRESS                    Address;
687     UINT32                                  DwordItem;
688     UINT16                                  WordItem;
689     UINT8                                   ByteItem;
690 
691 } AML_RESOURCE;
692 
693 
694 /* Interfaces used by both the disassembler and compiler */
695 
696 void
697 MpSaveGpioInfo (
698     ACPI_PARSE_OBJECT       *Op,
699     AML_RESOURCE            *Resource,
700     UINT32                  PinCount,
701     UINT16                  *PinList,
702     char                    *DeviceName);
703 
704 void
705 MpSaveSerialInfo (
706     ACPI_PARSE_OBJECT       *Op,
707     AML_RESOURCE            *Resource,
708     char                    *DeviceName);
709 
710 char *
711 MpGetHidFromParseTree (
712     ACPI_NAMESPACE_NODE     *HidNode);
713 
714 char *
715 MpGetHidViaNamestring (
716     char                    *DeviceName);
717 
718 char *
719 MpGetConnectionInfo (
720     ACPI_PARSE_OBJECT       *Op,
721     UINT32                  PinIndex,
722     ACPI_NAMESPACE_NODE     **TargetNode,
723     char                    **TargetName);
724 
725 char *
726 MpGetParentDeviceHid (
727     ACPI_PARSE_OBJECT       *Op,
728     ACPI_NAMESPACE_NODE     **TargetNode,
729     char                    **ParentDeviceName);
730 
731 char *
732 MpGetDdnValue (
733     char                    *DeviceName);
734 
735 char *
736 MpGetHidValue (
737     ACPI_NAMESPACE_NODE     *DeviceNode);
738 
739 #endif
740