1 /******************************************************************************
2  *
3  * Module Name: amlresrc.h - AML resource descriptors
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2018, Intel Corp.
9  * All rights reserved.
10  *
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.
25  *
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.
29  *
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.
42  */
43 
44 /* acpisrc:StructDefs -- for acpisrc conversion */
45 
46 #ifndef __AMLRESRC_H
47 #define __AMLRESRC_H
48 
49 
50 /*
51  * Resource descriptor tags, as defined in the ACPI specification.
52  * Used to symbolically reference fields within a descriptor.
53  */
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_FUNCTION                    "_FUN"
70 #define ACPI_RESTAG_GRANULARITY                 "_GRA"
71 #define ACPI_RESTAG_INTERRUPT                   "_INT"
72 #define ACPI_RESTAG_INTERRUPTLEVEL              "_LL_"  /* ActiveLo(1), ActiveHi(0) */
73 #define ACPI_RESTAG_INTERRUPTSHARE              "_SHR"  /* Shareable(1), NoShare(0) */
74 #define ACPI_RESTAG_INTERRUPTTYPE               "_HE_"  /* Edge(1), Level(0) */
75 #define ACPI_RESTAG_IORESTRICTION               "_IOR"
76 #define ACPI_RESTAG_LENGTH                      "_LEN"
77 #define ACPI_RESTAG_LINE                        "_LIN"
78 #define ACPI_RESTAG_MEMATTRIBUTES               "_MTP"  /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
79 #define ACPI_RESTAG_MEMTYPE                     "_MEM"  /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
80 #define ACPI_RESTAG_MAXADDR                     "_MAX"
81 #define ACPI_RESTAG_MINADDR                     "_MIN"
82 #define ACPI_RESTAG_MAXTYPE                     "_MAF"
83 #define ACPI_RESTAG_MINTYPE                     "_MIF"
84 #define ACPI_RESTAG_MODE                        "_MOD"
85 #define ACPI_RESTAG_PARITY                      "_PAR"
86 #define ACPI_RESTAG_PHASE                       "_PHA"
87 #define ACPI_RESTAG_PIN                         "_PIN"
88 #define ACPI_RESTAG_PINCONFIG                   "_PPI"
89 #define ACPI_RESTAG_PINCONFIG_TYPE              "_TYP"
90 #define ACPI_RESTAG_PINCONFIG_VALUE             "_VAL"
91 #define ACPI_RESTAG_POLARITY                    "_POL"
92 #define ACPI_RESTAG_REGISTERBITOFFSET           "_RBO"
93 #define ACPI_RESTAG_REGISTERBITWIDTH            "_RBW"
94 #define ACPI_RESTAG_RANGETYPE                   "_RNG"
95 #define ACPI_RESTAG_READWRITETYPE               "_RW_"  /* ReadOnly(0), Writeable (1) */
96 #define ACPI_RESTAG_LENGTH_RX                   "_RXL"
97 #define ACPI_RESTAG_LENGTH_TX                   "_TXL"
98 #define ACPI_RESTAG_SLAVEMODE                   "_SLV"
99 #define ACPI_RESTAG_SPEED                       "_SPE"
100 #define ACPI_RESTAG_STOPBITS                    "_STB"
101 #define ACPI_RESTAG_TRANSLATION                 "_TRA"
102 #define ACPI_RESTAG_TRANSTYPE                   "_TRS"  /* Sparse(1), Dense(0) */
103 #define ACPI_RESTAG_TYPE                        "_TTP"  /* Translation(1), Static (0) */
104 #define ACPI_RESTAG_XFERTYPE                    "_SIZ"  /* 8(0), 8And16(1), 16(2) */
105 #define ACPI_RESTAG_VENDORDATA                  "_VEN"
106 
107 
108 /* Default sizes for "small" resource descriptors */
109 
110 #define ASL_RDESC_IRQ_SIZE                      0x02
111 #define ASL_RDESC_DMA_SIZE                      0x02
112 #define ASL_RDESC_ST_DEPEND_SIZE                0x00
113 #define ASL_RDESC_END_DEPEND_SIZE               0x00
114 #define ASL_RDESC_IO_SIZE                       0x07
115 #define ASL_RDESC_FIXED_IO_SIZE                 0x03
116 #define ASL_RDESC_FIXED_DMA_SIZE                0x05
117 #define ASL_RDESC_END_TAG_SIZE                  0x01
118 
119 
120 typedef struct asl_resource_node
121 {
122     UINT32                          BufferLength;
123     void                            *Buffer;
124     struct asl_resource_node        *Next;
125 
126 } ASL_RESOURCE_NODE;
127 
128 typedef struct asl_resource_info
129 {
130     ACPI_PARSE_OBJECT               *DescriptorTypeOp;  /* Resource descriptor parse node */
131     ACPI_PARSE_OBJECT               *MappingOp;         /* Used for mapfile support */
132     UINT32                          CurrentByteOffset;  /* Offset in resource template */
133 
134 } ASL_RESOURCE_INFO;
135 
136 
137 /* Macros used to generate AML resource length fields */
138 
139 #define ACPI_AML_SIZE_LARGE(r)      (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
140 #define ACPI_AML_SIZE_SMALL(r)      (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
141 
142 /*
143  * Resource descriptors defined in the ACPI specification.
144  *
145  * Packing/alignment must be BYTE because these descriptors
146  * are used to overlay the raw AML byte stream.
147  */
148 #pragma pack(1)
149 
150 /*
151  * SMALL descriptors
152  */
153 #define AML_RESOURCE_SMALL_HEADER_COMMON \
154     UINT8                           DescriptorType;
155 
156 typedef struct aml_resource_small_header
157 {
158     AML_RESOURCE_SMALL_HEADER_COMMON
159 
160 } AML_RESOURCE_SMALL_HEADER;
161 
162 
163 typedef struct aml_resource_irq
164 {
165     AML_RESOURCE_SMALL_HEADER_COMMON
166     UINT16                          IrqMask;
167     UINT8                           Flags;
168 
169 } AML_RESOURCE_IRQ;
170 
171 
172 typedef struct aml_resource_irq_noflags
173 {
174     AML_RESOURCE_SMALL_HEADER_COMMON
175     UINT16                          IrqMask;
176 
177 } AML_RESOURCE_IRQ_NOFLAGS;
178 
179 
180 typedef struct aml_resource_dma
181 {
182     AML_RESOURCE_SMALL_HEADER_COMMON
183     UINT8                           DmaChannelMask;
184     UINT8                           Flags;
185 
186 } AML_RESOURCE_DMA;
187 
188 
189 typedef struct aml_resource_start_dependent
190 {
191     AML_RESOURCE_SMALL_HEADER_COMMON
192     UINT8                           Flags;
193 
194 } AML_RESOURCE_START_DEPENDENT;
195 
196 
197 typedef struct aml_resource_start_dependent_noprio
198 {
199     AML_RESOURCE_SMALL_HEADER_COMMON
200 
201 } AML_RESOURCE_START_DEPENDENT_NOPRIO;
202 
203 
204 typedef struct aml_resource_end_dependent
205 {
206     AML_RESOURCE_SMALL_HEADER_COMMON
207 
208 } AML_RESOURCE_END_DEPENDENT;
209 
210 
211 typedef struct aml_resource_io
212 {
213     AML_RESOURCE_SMALL_HEADER_COMMON
214     UINT8                           Flags;
215     UINT16                          Minimum;
216     UINT16                          Maximum;
217     UINT8                           Alignment;
218     UINT8                           AddressLength;
219 
220 } AML_RESOURCE_IO;
221 
222 
223 typedef struct aml_resource_fixed_io
224 {
225     AML_RESOURCE_SMALL_HEADER_COMMON
226     UINT16                          Address;
227     UINT8                           AddressLength;
228 
229 } AML_RESOURCE_FIXED_IO;
230 
231 
232 typedef struct aml_resource_vendor_small
233 {
234     AML_RESOURCE_SMALL_HEADER_COMMON
235 
236 } AML_RESOURCE_VENDOR_SMALL;
237 
238 
239 typedef struct aml_resource_end_tag
240 {
241     AML_RESOURCE_SMALL_HEADER_COMMON
242     UINT8                           Checksum;
243 
244 } AML_RESOURCE_END_TAG;
245 
246 
247 typedef struct aml_resource_fixed_dma
248 {
249     AML_RESOURCE_SMALL_HEADER_COMMON
250     UINT16                          RequestLines;
251     UINT16                          Channels;
252     UINT8                           Width;
253 
254 } AML_RESOURCE_FIXED_DMA;
255 
256 
257 /*
258  * LARGE descriptors
259  */
260 #define AML_RESOURCE_LARGE_HEADER_COMMON \
261     UINT8                           DescriptorType;\
262     UINT16                          ResourceLength;
263 
264 typedef struct aml_resource_large_header
265 {
266     AML_RESOURCE_LARGE_HEADER_COMMON
267 
268 } AML_RESOURCE_LARGE_HEADER;
269 
270 
271 /* General Flags for address space resource descriptors */
272 
273 #define ACPI_RESOURCE_FLAG_DEC      2
274 #define ACPI_RESOURCE_FLAG_MIF      4
275 #define ACPI_RESOURCE_FLAG_MAF      8
276 
277 typedef struct aml_resource_memory24
278 {
279     AML_RESOURCE_LARGE_HEADER_COMMON
280     UINT8                           Flags;
281     UINT16                          Minimum;
282     UINT16                          Maximum;
283     UINT16                          Alignment;
284     UINT16                          AddressLength;
285 
286 } AML_RESOURCE_MEMORY24;
287 
288 
289 typedef struct aml_resource_vendor_large
290 {
291     AML_RESOURCE_LARGE_HEADER_COMMON
292 
293 } AML_RESOURCE_VENDOR_LARGE;
294 
295 
296 typedef struct aml_resource_memory32
297 {
298     AML_RESOURCE_LARGE_HEADER_COMMON
299     UINT8                           Flags;
300     UINT32                          Minimum;
301     UINT32                          Maximum;
302     UINT32                          Alignment;
303     UINT32                          AddressLength;
304 
305 } AML_RESOURCE_MEMORY32;
306 
307 
308 typedef struct aml_resource_fixed_memory32
309 {
310     AML_RESOURCE_LARGE_HEADER_COMMON
311     UINT8                           Flags;
312     UINT32                          Address;
313     UINT32                          AddressLength;
314 
315 } AML_RESOURCE_FIXED_MEMORY32;
316 
317 
318 #define AML_RESOURCE_ADDRESS_COMMON \
319     UINT8                           ResourceType; \
320     UINT8                           Flags; \
321     UINT8                           SpecificFlags;
322 
323 
324 typedef struct aml_resource_address
325 {
326     AML_RESOURCE_LARGE_HEADER_COMMON
327     AML_RESOURCE_ADDRESS_COMMON
328 
329 } AML_RESOURCE_ADDRESS;
330 
331 
332 typedef struct aml_resource_extended_address64
333 {
334     AML_RESOURCE_LARGE_HEADER_COMMON
335     AML_RESOURCE_ADDRESS_COMMON
336     UINT8                           RevisionID;
337     UINT8                           Reserved;
338     UINT64                          Granularity;
339     UINT64                          Minimum;
340     UINT64                          Maximum;
341     UINT64                          TranslationOffset;
342     UINT64                          AddressLength;
343     UINT64                          TypeSpecific;
344 
345 } AML_RESOURCE_EXTENDED_ADDRESS64;
346 
347 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION          1       /* ACPI 3.0 */
348 
349 
350 typedef struct aml_resource_address64
351 {
352     AML_RESOURCE_LARGE_HEADER_COMMON
353     AML_RESOURCE_ADDRESS_COMMON
354     UINT64                          Granularity;
355     UINT64                          Minimum;
356     UINT64                          Maximum;
357     UINT64                          TranslationOffset;
358     UINT64                          AddressLength;
359 
360 } AML_RESOURCE_ADDRESS64;
361 
362 
363 typedef struct aml_resource_address32
364 {
365     AML_RESOURCE_LARGE_HEADER_COMMON
366     AML_RESOURCE_ADDRESS_COMMON
367     UINT32                          Granularity;
368     UINT32                          Minimum;
369     UINT32                          Maximum;
370     UINT32                          TranslationOffset;
371     UINT32                          AddressLength;
372 
373 } AML_RESOURCE_ADDRESS32;
374 
375 
376 typedef struct aml_resource_address16
377 {
378     AML_RESOURCE_LARGE_HEADER_COMMON
379     AML_RESOURCE_ADDRESS_COMMON
380     UINT16                          Granularity;
381     UINT16                          Minimum;
382     UINT16                          Maximum;
383     UINT16                          TranslationOffset;
384     UINT16                          AddressLength;
385 
386 } AML_RESOURCE_ADDRESS16;
387 
388 
389 typedef struct aml_resource_extended_irq
390 {
391     AML_RESOURCE_LARGE_HEADER_COMMON
392     UINT8                           Flags;
393     UINT8                           InterruptCount;
394     UINT32                          Interrupts[1];
395     /* ResSourceIndex, ResSource optional fields follow */
396 
397 } AML_RESOURCE_EXTENDED_IRQ;
398 
399 
400 typedef struct aml_resource_generic_register
401 {
402     AML_RESOURCE_LARGE_HEADER_COMMON
403     UINT8                           AddressSpaceId;
404     UINT8                           BitWidth;
405     UINT8                           BitOffset;
406     UINT8                           AccessSize; /* ACPI 3.0, was previously Reserved */
407     UINT64                          Address;
408 
409 } AML_RESOURCE_GENERIC_REGISTER;
410 
411 
412 /* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
413 
414 typedef struct aml_resource_gpio
415 {
416     AML_RESOURCE_LARGE_HEADER_COMMON
417     UINT8                           RevisionId;
418     UINT8                           ConnectionType;
419     UINT16                          Flags;
420     UINT16                          IntFlags;
421     UINT8                           PinConfig;
422     UINT16                          DriveStrength;
423     UINT16                          DebounceTimeout;
424     UINT16                          PinTableOffset;
425     UINT8                           ResSourceIndex;
426     UINT16                          ResSourceOffset;
427     UINT16                          VendorOffset;
428     UINT16                          VendorLength;
429     /*
430      * Optional fields follow immediately:
431      * 1) PIN list (Words)
432      * 2) Resource Source String
433      * 3) Vendor Data bytes
434      */
435 
436 } AML_RESOURCE_GPIO;
437 
438 #define AML_RESOURCE_GPIO_REVISION              1       /* ACPI 5.0 */
439 
440 /* Values for ConnectionType above */
441 
442 #define AML_RESOURCE_GPIO_TYPE_INT              0
443 #define AML_RESOURCE_GPIO_TYPE_IO               1
444 #define AML_RESOURCE_MAX_GPIOTYPE               1
445 
446 
447 /* Common preamble for all serial descriptors (ACPI 5.0) */
448 
449 #define AML_RESOURCE_SERIAL_COMMON \
450     UINT8                           RevisionId; \
451     UINT8                           ResSourceIndex; \
452     UINT8                           Type; \
453     UINT8                           Flags; \
454     UINT16                          TypeSpecificFlags; \
455     UINT8                           TypeRevisionId; \
456     UINT16                          TypeDataLength; \
457 
458 /* Values for the type field above */
459 
460 #define AML_RESOURCE_I2C_SERIALBUSTYPE          1
461 #define AML_RESOURCE_SPI_SERIALBUSTYPE          2
462 #define AML_RESOURCE_UART_SERIALBUSTYPE         3
463 #define AML_RESOURCE_MAX_SERIALBUSTYPE          3
464 #define AML_RESOURCE_VENDOR_SERIALBUSTYPE       192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
465 
466 typedef struct aml_resource_common_serialbus
467 {
468     AML_RESOURCE_LARGE_HEADER_COMMON
469     AML_RESOURCE_SERIAL_COMMON
470 
471 } AML_RESOURCE_COMMON_SERIALBUS;
472 
473 typedef struct aml_resource_i2c_serialbus
474 {
475     AML_RESOURCE_LARGE_HEADER_COMMON
476     AML_RESOURCE_SERIAL_COMMON
477     UINT32                          ConnectionSpeed;
478     UINT16                          SlaveAddress;
479     /*
480      * Optional fields follow immediately:
481      * 1) Vendor Data bytes
482      * 2) Resource Source String
483      */
484 
485 } AML_RESOURCE_I2C_SERIALBUS;
486 
487 #define AML_RESOURCE_I2C_REVISION               1       /* ACPI 5.0 */
488 #define AML_RESOURCE_I2C_TYPE_REVISION          1       /* ACPI 5.0 */
489 #define AML_RESOURCE_I2C_MIN_DATA_LEN           6
490 
491 typedef struct aml_resource_spi_serialbus
492 {
493     AML_RESOURCE_LARGE_HEADER_COMMON
494     AML_RESOURCE_SERIAL_COMMON
495     UINT32                          ConnectionSpeed;
496     UINT8                           DataBitLength;
497     UINT8                           ClockPhase;
498     UINT8                           ClockPolarity;
499     UINT16                          DeviceSelection;
500     /*
501      * Optional fields follow immediately:
502      * 1) Vendor Data bytes
503      * 2) Resource Source String
504      */
505 
506 } AML_RESOURCE_SPI_SERIALBUS;
507 
508 #define AML_RESOURCE_SPI_REVISION               1       /* ACPI 5.0 */
509 #define AML_RESOURCE_SPI_TYPE_REVISION          1       /* ACPI 5.0 */
510 #define AML_RESOURCE_SPI_MIN_DATA_LEN           9
511 
512 
513 typedef struct aml_resource_uart_serialbus
514 {
515     AML_RESOURCE_LARGE_HEADER_COMMON
516     AML_RESOURCE_SERIAL_COMMON
517     UINT32                          DefaultBaudRate;
518     UINT16                          RxFifoSize;
519     UINT16                          TxFifoSize;
520     UINT8                           Parity;
521     UINT8                           LinesEnabled;
522     /*
523      * Optional fields follow immediately:
524      * 1) Vendor Data bytes
525      * 2) Resource Source String
526      */
527 
528 } AML_RESOURCE_UART_SERIALBUS;
529 
530 #define AML_RESOURCE_UART_REVISION              1       /* ACPI 5.0 */
531 #define AML_RESOURCE_UART_TYPE_REVISION         1       /* ACPI 5.0 */
532 #define AML_RESOURCE_UART_MIN_DATA_LEN          10
533 
534 typedef struct aml_resource_pin_function
535 {
536     AML_RESOURCE_LARGE_HEADER_COMMON
537     UINT8                           RevisionId;
538     UINT16                          Flags;
539     UINT8                           PinConfig;
540     UINT16                          FunctionNumber;
541     UINT16                          PinTableOffset;
542     UINT8                           ResSourceIndex;
543     UINT16                          ResSourceOffset;
544     UINT16                          VendorOffset;
545     UINT16                          VendorLength;
546     /*
547      * Optional fields follow immediately:
548      * 1) PIN list (Words)
549      * 2) Resource Source String
550      * 3) Vendor Data bytes
551      */
552 
553 } AML_RESOURCE_PIN_FUNCTION;
554 
555 #define AML_RESOURCE_PIN_FUNCTION_REVISION      1       /* ACPI 6.2 */
556 
557 typedef struct aml_resource_pin_config
558 {
559     AML_RESOURCE_LARGE_HEADER_COMMON
560     UINT8                           RevisionId;
561     UINT16                          Flags;
562     UINT8                           PinConfigType;
563     UINT32                          PinConfigValue;
564     UINT16                          PinTableOffset;
565     UINT8                           ResSourceIndex;
566     UINT16                          ResSourceOffset;
567     UINT16                          VendorOffset;
568     UINT16                          VendorLength;
569     /*
570      * Optional fields follow immediately:
571      * 1) PIN list (Words)
572      * 2) Resource Source String
573      * 3) Vendor Data bytes
574      */
575 
576 } AML_RESOURCE_PIN_CONFIG;
577 
578 #define AML_RESOURCE_PIN_CONFIG_REVISION      1       /* ACPI 6.2 */
579 
580 typedef struct aml_resource_pin_group
581 {
582     AML_RESOURCE_LARGE_HEADER_COMMON
583     UINT8                           RevisionId;
584     UINT16                          Flags;
585     UINT16                          PinTableOffset;
586     UINT16                          LabelOffset;
587     UINT16                          VendorOffset;
588     UINT16                          VendorLength;
589     /*
590      * Optional fields follow immediately:
591      * 1) PIN list (Words)
592      * 2) Resource Label String
593      * 3) Vendor Data bytes
594      */
595 
596 } AML_RESOURCE_PIN_GROUP;
597 
598 #define AML_RESOURCE_PIN_GROUP_REVISION      1       /* ACPI 6.2 */
599 
600 typedef struct aml_resource_pin_group_function
601 {
602     AML_RESOURCE_LARGE_HEADER_COMMON
603     UINT8                           RevisionId;
604     UINT16                          Flags;
605     UINT16                          FunctionNumber;
606     UINT8                           ResSourceIndex;
607     UINT16                          ResSourceOffset;
608     UINT16                          ResSourceLabelOffset;
609     UINT16                          VendorOffset;
610     UINT16                          VendorLength;
611     /*
612      * Optional fields follow immediately:
613      * 1) Resource Source String
614      * 2) Resource Source Label String
615      * 3) Vendor Data bytes
616      */
617 
618 } AML_RESOURCE_PIN_GROUP_FUNCTION;
619 
620 #define AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION    1       /* ACPI 6.2 */
621 
622 typedef struct aml_resource_pin_group_config
623 {
624     AML_RESOURCE_LARGE_HEADER_COMMON
625     UINT8                           RevisionId;
626     UINT16                          Flags;
627     UINT8                           PinConfigType;
628     UINT32                          PinConfigValue;
629     UINT8                           ResSourceIndex;
630     UINT16                          ResSourceOffset;
631     UINT16                          ResSourceLabelOffset;
632     UINT16                          VendorOffset;
633     UINT16                          VendorLength;
634     /*
635      * Optional fields follow immediately:
636      * 1) Resource Source String
637      * 2) Resource Source Label String
638      * 3) Vendor Data bytes
639      */
640 
641 } AML_RESOURCE_PIN_GROUP_CONFIG;
642 
643 #define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION    1       /* ACPI 6.2 */
644 
645 /* restore default alignment */
646 
647 #pragma pack()
648 
649 /* Union of all resource descriptors, so we can allocate the worst case */
650 
651 typedef union aml_resource
652 {
653     /* Descriptor headers */
654 
655     UINT8                                   DescriptorType;
656     AML_RESOURCE_SMALL_HEADER               SmallHeader;
657     AML_RESOURCE_LARGE_HEADER               LargeHeader;
658 
659     /* Small resource descriptors */
660 
661     AML_RESOURCE_IRQ                        Irq;
662     AML_RESOURCE_DMA                        Dma;
663     AML_RESOURCE_START_DEPENDENT            StartDpf;
664     AML_RESOURCE_END_DEPENDENT              EndDpf;
665     AML_RESOURCE_IO                         Io;
666     AML_RESOURCE_FIXED_IO                   FixedIo;
667     AML_RESOURCE_FIXED_DMA                  FixedDma;
668     AML_RESOURCE_VENDOR_SMALL               VendorSmall;
669     AML_RESOURCE_END_TAG                    EndTag;
670 
671     /* Large resource descriptors */
672 
673     AML_RESOURCE_MEMORY24                   Memory24;
674     AML_RESOURCE_GENERIC_REGISTER           GenericReg;
675     AML_RESOURCE_VENDOR_LARGE               VendorLarge;
676     AML_RESOURCE_MEMORY32                   Memory32;
677     AML_RESOURCE_FIXED_MEMORY32             FixedMemory32;
678     AML_RESOURCE_ADDRESS16                  Address16;
679     AML_RESOURCE_ADDRESS32                  Address32;
680     AML_RESOURCE_ADDRESS64                  Address64;
681     AML_RESOURCE_EXTENDED_ADDRESS64         ExtAddress64;
682     AML_RESOURCE_EXTENDED_IRQ               ExtendedIrq;
683     AML_RESOURCE_GPIO                       Gpio;
684     AML_RESOURCE_I2C_SERIALBUS              I2cSerialBus;
685     AML_RESOURCE_SPI_SERIALBUS              SpiSerialBus;
686     AML_RESOURCE_UART_SERIALBUS             UartSerialBus;
687     AML_RESOURCE_COMMON_SERIALBUS           CommonSerialBus;
688     AML_RESOURCE_PIN_FUNCTION               PinFunction;
689     AML_RESOURCE_PIN_CONFIG                 PinConfig;
690     AML_RESOURCE_PIN_GROUP                  PinGroup;
691     AML_RESOURCE_PIN_GROUP_FUNCTION         PinGroupFunction;
692     AML_RESOURCE_PIN_GROUP_CONFIG           PinGroupConfig;
693 
694     /* Utility overlays */
695 
696     AML_RESOURCE_ADDRESS                    Address;
697     UINT32                                  DwordItem;
698     UINT16                                  WordItem;
699     UINT8                                   ByteItem;
700 
701 } AML_RESOURCE;
702 
703 
704 /* Interfaces used by both the disassembler and compiler */
705 
706 void
707 MpSaveGpioInfo (
708     ACPI_PARSE_OBJECT       *Op,
709     AML_RESOURCE            *Resource,
710     UINT32                  PinCount,
711     UINT16                  *PinList,
712     char                    *DeviceName);
713 
714 void
715 MpSaveSerialInfo (
716     ACPI_PARSE_OBJECT       *Op,
717     AML_RESOURCE            *Resource,
718     char                    *DeviceName);
719 
720 char *
721 MpGetHidFromParseTree (
722     ACPI_NAMESPACE_NODE     *HidNode);
723 
724 char *
725 MpGetHidViaNamestring (
726     char                    *DeviceName);
727 
728 char *
729 MpGetConnectionInfo (
730     ACPI_PARSE_OBJECT       *Op,
731     UINT32                  PinIndex,
732     ACPI_NAMESPACE_NODE     **TargetNode,
733     char                    **TargetName);
734 
735 char *
736 MpGetParentDeviceHid (
737     ACPI_PARSE_OBJECT       *Op,
738     ACPI_NAMESPACE_NODE     **TargetNode,
739     char                    **ParentDeviceName);
740 
741 char *
742 MpGetDdnValue (
743     char                    *DeviceName);
744 
745 char *
746 MpGetHidValue (
747     ACPI_NAMESPACE_NODE     *DeviceNode);
748 
749 #endif
750