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