1 /******************************************************************************
2  *
3  * Name: acrestyp.h - Defines, types, and structures for 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 #ifndef __ACRESTYP_H__
45 #define __ACRESTYP_H__
46 
47 
48 /*
49  * Definitions for Resource Attributes
50  */
51 typedef UINT16                          ACPI_RS_LENGTH;    /* Resource Length field is fixed at 16 bits */
52 typedef UINT32                          ACPI_RSDESC_SIZE;  /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
53 
54 /*
55  * Memory Attributes
56  */
57 #define ACPI_READ_ONLY_MEMORY           (UINT8) 0x00
58 #define ACPI_READ_WRITE_MEMORY          (UINT8) 0x01
59 
60 #define ACPI_NON_CACHEABLE_MEMORY       (UINT8) 0x00
61 #define ACPI_CACHABLE_MEMORY            (UINT8) 0x01
62 #define ACPI_WRITE_COMBINING_MEMORY     (UINT8) 0x02
63 #define ACPI_PREFETCHABLE_MEMORY        (UINT8) 0x03
64 
65 /*! [Begin] no source code translation */
66 /*
67  * IO Attributes
68  * The ISA IO ranges are:     n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
69  * The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
70  */
71 /*! [End] no source code translation !*/
72 
73 #define ACPI_NON_ISA_ONLY_RANGES        (UINT8) 0x01
74 #define ACPI_ISA_ONLY_RANGES            (UINT8) 0x02
75 #define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
76 
77 /* Type of translation - 1=Sparse, 0=Dense */
78 
79 #define ACPI_SPARSE_TRANSLATION         (UINT8) 0x01
80 
81 /*
82  * IO Port Descriptor Decode
83  */
84 #define ACPI_DECODE_10                  (UINT8) 0x00    /* 10-bit IO address decode */
85 #define ACPI_DECODE_16                  (UINT8) 0x01    /* 16-bit IO address decode */
86 
87 /*
88  * Interrupt attributes - used in multiple descriptors
89  */
90 
91 /* Triggering */
92 
93 #define ACPI_LEVEL_SENSITIVE            (UINT8) 0x00
94 #define ACPI_EDGE_SENSITIVE             (UINT8) 0x01
95 
96 /* Polarity */
97 
98 #define ACPI_ACTIVE_HIGH                (UINT8) 0x00
99 #define ACPI_ACTIVE_LOW                 (UINT8) 0x01
100 #define ACPI_ACTIVE_BOTH                (UINT8) 0x02
101 
102 /* Sharing */
103 
104 #define ACPI_EXCLUSIVE                  (UINT8) 0x00
105 #define ACPI_SHARED                     (UINT8) 0x01
106 
107 /* Wake */
108 
109 #define ACPI_NOT_WAKE_CAPABLE           (UINT8) 0x00
110 #define ACPI_WAKE_CAPABLE               (UINT8) 0x01
111 
112 /*
113  * DMA Attributes
114  */
115 #define ACPI_COMPATIBILITY              (UINT8) 0x00
116 #define ACPI_TYPE_A                     (UINT8) 0x01
117 #define ACPI_TYPE_B                     (UINT8) 0x02
118 #define ACPI_TYPE_F                     (UINT8) 0x03
119 
120 #define ACPI_NOT_BUS_MASTER             (UINT8) 0x00
121 #define ACPI_BUS_MASTER                 (UINT8) 0x01
122 
123 #define ACPI_TRANSFER_8                 (UINT8) 0x00
124 #define ACPI_TRANSFER_8_16              (UINT8) 0x01
125 #define ACPI_TRANSFER_16                (UINT8) 0x02
126 
127 /*
128  * Start Dependent Functions Priority definitions
129  */
130 #define ACPI_GOOD_CONFIGURATION         (UINT8) 0x00
131 #define ACPI_ACCEPTABLE_CONFIGURATION   (UINT8) 0x01
132 #define ACPI_SUB_OPTIMAL_CONFIGURATION  (UINT8) 0x02
133 
134 /*
135  * 16, 32 and 64-bit Address Descriptor resource types
136  */
137 #define ACPI_MEMORY_RANGE               (UINT8) 0x00
138 #define ACPI_IO_RANGE                   (UINT8) 0x01
139 #define ACPI_BUS_NUMBER_RANGE           (UINT8) 0x02
140 
141 #define ACPI_ADDRESS_NOT_FIXED          (UINT8) 0x00
142 #define ACPI_ADDRESS_FIXED              (UINT8) 0x01
143 
144 #define ACPI_POS_DECODE                 (UINT8) 0x00
145 #define ACPI_SUB_DECODE                 (UINT8) 0x01
146 
147 /* Producer/Consumer */
148 
149 #define ACPI_PRODUCER                   (UINT8) 0x00
150 #define ACPI_CONSUMER                   (UINT8) 0x01
151 
152 
153 /*
154  * If possible, pack the following structures to byte alignment
155  */
156 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
157 #pragma pack(1)
158 #endif
159 
160 /* UUID data structures for use in vendor-defined resource descriptors */
161 
162 typedef struct acpi_uuid
163 {
164     UINT8                           Data[ACPI_UUID_LENGTH];
165 } ACPI_UUID;
166 
167 typedef struct acpi_vendor_uuid
168 {
169     UINT8                           Subtype;
170     UINT8                           Data[ACPI_UUID_LENGTH];
171 
172 } ACPI_VENDOR_UUID;
173 
174 /*
175  * Structures used to describe device resources
176  */
177 typedef struct acpi_resource_irq
178 {
179     UINT8                           DescriptorLength;
180     UINT8                           Triggering;
181     UINT8                           Polarity;
182     UINT8                           Shareable;
183     UINT8                           WakeCapable;
184     UINT8                           InterruptCount;
185     UINT8                           Interrupts[1];
186 
187 } ACPI_RESOURCE_IRQ;
188 
189 typedef struct acpi_resource_dma
190 {
191     UINT8                           Type;
192     UINT8                           BusMaster;
193     UINT8                           Transfer;
194     UINT8                           ChannelCount;
195     UINT8                           Channels[1];
196 
197 } ACPI_RESOURCE_DMA;
198 
199 typedef struct acpi_resource_start_dependent
200 {
201     UINT8                           DescriptorLength;
202     UINT8                           CompatibilityPriority;
203     UINT8                           PerformanceRobustness;
204 
205 } ACPI_RESOURCE_START_DEPENDENT;
206 
207 
208 /*
209  * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
210  * needed because it has no fields
211  */
212 
213 
214 typedef struct acpi_resource_io
215 {
216     UINT8                           IoDecode;
217     UINT8                           Alignment;
218     UINT8                           AddressLength;
219     UINT16                          Minimum;
220     UINT16                          Maximum;
221 
222 } ACPI_RESOURCE_IO;
223 
224 typedef struct acpi_resource_fixed_io
225 {
226     UINT16                          Address;
227     UINT8                           AddressLength;
228 
229 } ACPI_RESOURCE_FIXED_IO;
230 
231 typedef struct acpi_resource_fixed_dma
232 {
233     UINT16                          RequestLines;
234     UINT16                          Channels;
235     UINT8                           Width;
236 
237 } ACPI_RESOURCE_FIXED_DMA;
238 
239 /* Values for Width field above */
240 
241 #define ACPI_DMA_WIDTH8                         0
242 #define ACPI_DMA_WIDTH16                        1
243 #define ACPI_DMA_WIDTH32                        2
244 #define ACPI_DMA_WIDTH64                        3
245 #define ACPI_DMA_WIDTH128                       4
246 #define ACPI_DMA_WIDTH256                       5
247 
248 
249 typedef struct acpi_resource_vendor
250 {
251     UINT16                          ByteLength;
252     UINT8                           ByteData[1];
253 
254 } ACPI_RESOURCE_VENDOR;
255 
256 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
257 
258 typedef struct acpi_resource_vendor_typed
259 {
260     UINT16                          ByteLength;
261     UINT8                           UuidSubtype;
262     UINT8                           Uuid[ACPI_UUID_LENGTH];
263     UINT8                           ByteData[1];
264 
265 } ACPI_RESOURCE_VENDOR_TYPED;
266 
267 typedef struct acpi_resource_end_tag
268 {
269     UINT8                           Checksum;
270 
271 } ACPI_RESOURCE_END_TAG;
272 
273 typedef struct acpi_resource_memory24
274 {
275     UINT8                           WriteProtect;
276     UINT16                          Minimum;
277     UINT16                          Maximum;
278     UINT16                          Alignment;
279     UINT16                          AddressLength;
280 
281 } ACPI_RESOURCE_MEMORY24;
282 
283 typedef struct acpi_resource_memory32
284 {
285     UINT8                           WriteProtect;
286     UINT32                          Minimum;
287     UINT32                          Maximum;
288     UINT32                          Alignment;
289     UINT32                          AddressLength;
290 
291 } ACPI_RESOURCE_MEMORY32;
292 
293 typedef struct acpi_resource_fixed_memory32
294 {
295     UINT8                           WriteProtect;
296     UINT32                          Address;
297     UINT32                          AddressLength;
298 
299 } ACPI_RESOURCE_FIXED_MEMORY32;
300 
301 typedef struct acpi_memory_attribute
302 {
303     UINT8                           WriteProtect;
304     UINT8                           Caching;
305     UINT8                           RangeType;
306     UINT8                           Translation;
307 
308 } ACPI_MEMORY_ATTRIBUTE;
309 
310 typedef struct acpi_io_attribute
311 {
312     UINT8                           RangeType;
313     UINT8                           Translation;
314     UINT8                           TranslationType;
315     UINT8                           Reserved1;
316 
317 } ACPI_IO_ATTRIBUTE;
318 
319 typedef union acpi_resource_attribute
320 {
321     ACPI_MEMORY_ATTRIBUTE           Mem;
322     ACPI_IO_ATTRIBUTE               Io;
323 
324     /* Used for the *WordSpace macros */
325 
326     UINT8                           TypeSpecific;
327 
328 } ACPI_RESOURCE_ATTRIBUTE;
329 
330 typedef struct acpi_resource_label
331 {
332     UINT16                          StringLength;
333     char                            *StringPtr;
334 
335 } ACPI_RESOURCE_LABEL;
336 
337 typedef struct acpi_resource_source
338 {
339     UINT8                           Index;
340     UINT16                          StringLength;
341     char                            *StringPtr;
342 
343 } ACPI_RESOURCE_SOURCE;
344 
345 /* Fields common to all address descriptors, 16/32/64 bit */
346 
347 #define ACPI_RESOURCE_ADDRESS_COMMON \
348     UINT8                           ResourceType; \
349     UINT8                           ProducerConsumer; \
350     UINT8                           Decode; \
351     UINT8                           MinAddressFixed; \
352     UINT8                           MaxAddressFixed; \
353     ACPI_RESOURCE_ATTRIBUTE         Info;
354 
355 typedef struct acpi_address16_attribute
356 {
357     UINT16                          Granularity;
358     UINT16                          Minimum;
359     UINT16                          Maximum;
360     UINT16                          TranslationOffset;
361     UINT16                          AddressLength;
362 
363 } ACPI_ADDRESS16_ATTRIBUTE;
364 
365 typedef struct acpi_address32_attribute
366 {
367     UINT32                          Granularity;
368     UINT32                          Minimum;
369     UINT32                          Maximum;
370     UINT32                          TranslationOffset;
371     UINT32                          AddressLength;
372 
373 } ACPI_ADDRESS32_ATTRIBUTE;
374 
375 typedef struct acpi_address64_attribute
376 {
377     UINT64                          Granularity;
378     UINT64                          Minimum;
379     UINT64                          Maximum;
380     UINT64                          TranslationOffset;
381     UINT64                          AddressLength;
382 
383 } ACPI_ADDRESS64_ATTRIBUTE;
384 
385 typedef struct acpi_resource_address
386 {
387     ACPI_RESOURCE_ADDRESS_COMMON
388 
389 } ACPI_RESOURCE_ADDRESS;
390 
391 typedef struct acpi_resource_address16
392 {
393     ACPI_RESOURCE_ADDRESS_COMMON
394     ACPI_ADDRESS16_ATTRIBUTE        Address;
395     ACPI_RESOURCE_SOURCE            ResourceSource;
396 
397 } ACPI_RESOURCE_ADDRESS16;
398 
399 typedef struct acpi_resource_address32
400 {
401     ACPI_RESOURCE_ADDRESS_COMMON
402     ACPI_ADDRESS32_ATTRIBUTE        Address;
403     ACPI_RESOURCE_SOURCE            ResourceSource;
404 
405 } ACPI_RESOURCE_ADDRESS32;
406 
407 typedef struct acpi_resource_address64
408 {
409     ACPI_RESOURCE_ADDRESS_COMMON
410     ACPI_ADDRESS64_ATTRIBUTE        Address;
411     ACPI_RESOURCE_SOURCE            ResourceSource;
412 
413 } ACPI_RESOURCE_ADDRESS64;
414 
415 typedef struct acpi_resource_extended_address64
416 {
417     ACPI_RESOURCE_ADDRESS_COMMON
418     UINT8                           RevisionID;
419     ACPI_ADDRESS64_ATTRIBUTE        Address;
420     UINT64                          TypeSpecific;
421 
422 } ACPI_RESOURCE_EXTENDED_ADDRESS64;
423 
424 typedef struct acpi_resource_extended_irq
425 {
426     UINT8                           ProducerConsumer;
427     UINT8                           Triggering;
428     UINT8                           Polarity;
429     UINT8                           Shareable;
430     UINT8                           WakeCapable;
431     UINT8                           InterruptCount;
432     ACPI_RESOURCE_SOURCE            ResourceSource;
433     UINT32                          Interrupts[1];
434 
435 } ACPI_RESOURCE_EXTENDED_IRQ;
436 
437 typedef struct acpi_resource_generic_register
438 {
439     UINT8                           SpaceId;
440     UINT8                           BitWidth;
441     UINT8                           BitOffset;
442     UINT8                           AccessSize;
443     UINT64                          Address;
444 
445 } ACPI_RESOURCE_GENERIC_REGISTER;
446 
447 typedef struct acpi_resource_gpio
448 {
449     UINT8                           RevisionId;
450     UINT8                           ConnectionType;
451     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
452     UINT8                           PinConfig;
453     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
454     UINT8                           WakeCapable;        /* For values, see Interrupt Attributes above */
455     UINT8                           IoRestriction;
456     UINT8                           Triggering;         /* For values, see Interrupt Attributes above */
457     UINT8                           Polarity;           /* For values, see Interrupt Attributes above */
458     UINT16                          DriveStrength;
459     UINT16                          DebounceTimeout;
460     UINT16                          PinTableLength;
461     UINT16                          VendorLength;
462     ACPI_RESOURCE_SOURCE            ResourceSource;
463     UINT16                          *PinTable;
464     UINT8                           *VendorData;
465 
466 } ACPI_RESOURCE_GPIO;
467 
468 /* Values for GPIO ConnectionType field above */
469 
470 #define ACPI_RESOURCE_GPIO_TYPE_INT             0
471 #define ACPI_RESOURCE_GPIO_TYPE_IO              1
472 
473 /* Values for PinConfig field above */
474 
475 #define ACPI_PIN_CONFIG_DEFAULT                 0
476 #define ACPI_PIN_CONFIG_PULLUP                  1
477 #define ACPI_PIN_CONFIG_PULLDOWN                2
478 #define ACPI_PIN_CONFIG_NOPULL                  3
479 
480 /* Values for IoRestriction field above */
481 
482 #define ACPI_IO_RESTRICT_NONE                   0
483 #define ACPI_IO_RESTRICT_INPUT                  1
484 #define ACPI_IO_RESTRICT_OUTPUT                 2
485 #define ACPI_IO_RESTRICT_NONE_PRESERVE          3
486 
487 
488 /* Common structure for I2C, SPI, UART, CSI2 serial descriptors */
489 
490 #define ACPI_RESOURCE_SERIAL_COMMON \
491     UINT8                           RevisionId; \
492     UINT8                           Type; \
493     UINT8                           ProducerConsumer;    /* For values, see Producer/Consumer above */\
494     UINT8                           SlaveMode; \
495     UINT8                           ConnectionSharing; \
496     UINT8                           TypeRevisionId; \
497     UINT16                          TypeDataLength; \
498     UINT16                          VendorLength; \
499     ACPI_RESOURCE_SOURCE            ResourceSource; \
500     UINT8                           *VendorData;
501 
502 typedef struct acpi_resource_common_serialbus
503 {
504     ACPI_RESOURCE_SERIAL_COMMON
505 
506 } ACPI_RESOURCE_COMMON_SERIALBUS;
507 
508 /* Values for the Type field above */
509 
510 #define ACPI_RESOURCE_SERIAL_TYPE_I2C           1
511 #define ACPI_RESOURCE_SERIAL_TYPE_SPI           2
512 #define ACPI_RESOURCE_SERIAL_TYPE_UART          3
513 #define ACPI_RESOURCE_SERIAL_TYPE_CSI2          4
514 
515 /* Values for SlaveMode field above */
516 
517 #define ACPI_CONTROLLER_INITIATED               0
518 #define ACPI_DEVICE_INITIATED                   1
519 
520 
521 typedef struct acpi_resource_i2c_serialbus
522 {
523     ACPI_RESOURCE_SERIAL_COMMON
524     UINT8                           AccessMode;
525     UINT16                          SlaveAddress;
526     UINT32                          ConnectionSpeed;
527 
528 } ACPI_RESOURCE_I2C_SERIALBUS;
529 
530 /* Values for AccessMode field above */
531 
532 #define ACPI_I2C_7BIT_MODE                      0
533 #define ACPI_I2C_10BIT_MODE                     1
534 
535 
536 typedef struct acpi_resource_spi_serialbus
537 {
538     ACPI_RESOURCE_SERIAL_COMMON
539     UINT8                           WireMode;
540     UINT8                           DevicePolarity;
541     UINT8                           DataBitLength;
542     UINT8                           ClockPhase;
543     UINT8                           ClockPolarity;
544     UINT16                          DeviceSelection;
545     UINT32                          ConnectionSpeed;
546 
547 } ACPI_RESOURCE_SPI_SERIALBUS;
548 
549 /* Values for WireMode field above */
550 
551 #define ACPI_SPI_4WIRE_MODE                     0
552 #define ACPI_SPI_3WIRE_MODE                     1
553 
554 /* Values for DevicePolarity field above */
555 
556 #define ACPI_SPI_ACTIVE_LOW                     0
557 #define ACPI_SPI_ACTIVE_HIGH                    1
558 
559 /* Values for ClockPhase field above */
560 
561 #define ACPI_SPI_FIRST_PHASE                    0
562 #define ACPI_SPI_SECOND_PHASE                   1
563 
564 /* Values for ClockPolarity field above */
565 
566 #define ACPI_SPI_START_LOW                      0
567 #define ACPI_SPI_START_HIGH                     1
568 
569 
570 typedef struct acpi_resource_uart_serialbus
571 {
572     ACPI_RESOURCE_SERIAL_COMMON
573     UINT8                           Endian;
574     UINT8                           DataBits;
575     UINT8                           StopBits;
576     UINT8                           FlowControl;
577     UINT8                           Parity;
578     UINT8                           LinesEnabled;
579     UINT16                          RxFifoSize;
580     UINT16                          TxFifoSize;
581     UINT32                          DefaultBaudRate;
582 
583 } ACPI_RESOURCE_UART_SERIALBUS;
584 
585 /* Values for Endian field above */
586 
587 #define ACPI_UART_LITTLE_ENDIAN                 0
588 #define ACPI_UART_BIG_ENDIAN                    1
589 
590 /* Values for DataBits field above */
591 
592 #define ACPI_UART_5_DATA_BITS                   0
593 #define ACPI_UART_6_DATA_BITS                   1
594 #define ACPI_UART_7_DATA_BITS                   2
595 #define ACPI_UART_8_DATA_BITS                   3
596 #define ACPI_UART_9_DATA_BITS                   4
597 
598 /* Values for StopBits field above */
599 
600 #define ACPI_UART_NO_STOP_BITS                  0
601 #define ACPI_UART_1_STOP_BIT                    1
602 #define ACPI_UART_1P5_STOP_BITS                 2
603 #define ACPI_UART_2_STOP_BITS                   3
604 
605 /* Values for FlowControl field above */
606 
607 #define ACPI_UART_FLOW_CONTROL_NONE             0
608 #define ACPI_UART_FLOW_CONTROL_HW               1
609 #define ACPI_UART_FLOW_CONTROL_XON_XOFF         2
610 
611 /* Values for Parity field above */
612 
613 #define ACPI_UART_PARITY_NONE                   0
614 #define ACPI_UART_PARITY_EVEN                   1
615 #define ACPI_UART_PARITY_ODD                    2
616 #define ACPI_UART_PARITY_MARK                   3
617 #define ACPI_UART_PARITY_SPACE                  4
618 
619 /* Values for LinesEnabled bitfield above */
620 
621 #define ACPI_UART_CARRIER_DETECT                (1<<2)
622 #define ACPI_UART_RING_INDICATOR                (1<<3)
623 #define ACPI_UART_DATA_SET_READY                (1<<4)
624 #define ACPI_UART_DATA_TERMINAL_READY           (1<<5)
625 #define ACPI_UART_CLEAR_TO_SEND                 (1<<6)
626 #define ACPI_UART_REQUEST_TO_SEND               (1<<7)
627 
628 typedef struct acpi_resource_csi2_serialbus
629 {
630     ACPI_RESOURCE_SERIAL_COMMON
631     UINT8                           LocalPortInstance;
632     UINT8                           PhyType;
633 
634 } ACPI_RESOURCE_CSI2_SERIALBUS;
635 
636 typedef struct acpi_resource_pin_function
637 {
638     UINT8                           RevisionId;
639     UINT8                           PinConfig;
640     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
641     UINT16                          FunctionNumber;
642     UINT16                          PinTableLength;
643     UINT16                          VendorLength;
644     ACPI_RESOURCE_SOURCE            ResourceSource;
645     UINT16                          *PinTable;
646     UINT8                           *VendorData;
647 
648 } ACPI_RESOURCE_PIN_FUNCTION;
649 
650 typedef struct acpi_resource_pin_config
651 {
652     UINT8                           RevisionId;
653     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
654     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
655     UINT8                           PinConfigType;
656     UINT32                          PinConfigValue;
657     UINT16                          PinTableLength;
658     UINT16                          VendorLength;
659     ACPI_RESOURCE_SOURCE            ResourceSource;
660     UINT16                          *PinTable;
661     UINT8                           *VendorData;
662 
663 } ACPI_RESOURCE_PIN_CONFIG;
664 
665 /* Values for PinConfigType field above */
666 
667 #define ACPI_PIN_CONFIG_DEFAULT                 0
668 #define ACPI_PIN_CONFIG_BIAS_PULL_UP            1
669 #define ACPI_PIN_CONFIG_BIAS_PULL_DOWN          2
670 #define ACPI_PIN_CONFIG_BIAS_DEFAULT            3
671 #define ACPI_PIN_CONFIG_BIAS_DISABLE            4
672 #define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE     5
673 #define ACPI_PIN_CONFIG_BIAS_BUS_HOLD           6
674 #define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN        7
675 #define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE       8
676 #define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL         9
677 #define ACPI_PIN_CONFIG_DRIVE_STRENGTH          10
678 #define ACPI_PIN_CONFIG_SLEW_RATE               11
679 #define ACPI_PIN_CONFIG_INPUT_DEBOUNCE          12
680 #define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER   13
681 
682 typedef struct acpi_resource_pin_group
683 {
684     UINT8                           RevisionId;
685     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
686     UINT16                          PinTableLength;
687     UINT16                          VendorLength;
688     UINT16                          *PinTable;
689     ACPI_RESOURCE_LABEL             ResourceLabel;
690     UINT8                           *VendorData;
691 
692 } ACPI_RESOURCE_PIN_GROUP;
693 
694 typedef struct acpi_resource_pin_group_function
695 {
696     UINT8                           RevisionId;
697     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
698     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
699     UINT16                          FunctionNumber;
700     UINT16                          VendorLength;
701     ACPI_RESOURCE_SOURCE            ResourceSource;
702     ACPI_RESOURCE_LABEL             ResourceSourceLabel;
703     UINT8                           *VendorData;
704 
705 } ACPI_RESOURCE_PIN_GROUP_FUNCTION;
706 
707 typedef struct acpi_resource_pin_group_config
708 {
709     UINT8                           RevisionId;
710     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
711     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
712     UINT8                           PinConfigType;      /* For values, see PinConfigType above */
713     UINT32                          PinConfigValue;
714     UINT16                          VendorLength;
715     ACPI_RESOURCE_SOURCE            ResourceSource;
716     ACPI_RESOURCE_LABEL             ResourceSourceLabel;
717     UINT8                           *VendorData;
718 
719 } ACPI_RESOURCE_PIN_GROUP_CONFIG;
720 
721 /* ACPI_RESOURCE_TYPEs */
722 
723 #define ACPI_RESOURCE_TYPE_IRQ                  0
724 #define ACPI_RESOURCE_TYPE_DMA                  1
725 #define ACPI_RESOURCE_TYPE_START_DEPENDENT      2
726 #define ACPI_RESOURCE_TYPE_END_DEPENDENT        3
727 #define ACPI_RESOURCE_TYPE_IO                   4
728 #define ACPI_RESOURCE_TYPE_FIXED_IO             5
729 #define ACPI_RESOURCE_TYPE_VENDOR               6
730 #define ACPI_RESOURCE_TYPE_END_TAG              7
731 #define ACPI_RESOURCE_TYPE_MEMORY24             8
732 #define ACPI_RESOURCE_TYPE_MEMORY32             9
733 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32       10
734 #define ACPI_RESOURCE_TYPE_ADDRESS16            11
735 #define ACPI_RESOURCE_TYPE_ADDRESS32            12
736 #define ACPI_RESOURCE_TYPE_ADDRESS64            13
737 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64   14  /* ACPI 3.0 */
738 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ         15
739 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER     16
740 #define ACPI_RESOURCE_TYPE_GPIO                 17  /* ACPI 5.0 */
741 #define ACPI_RESOURCE_TYPE_FIXED_DMA            18  /* ACPI 5.0 */
742 #define ACPI_RESOURCE_TYPE_SERIAL_BUS           19  /* ACPI 5.0 */
743 #define ACPI_RESOURCE_TYPE_PIN_FUNCTION         20  /* ACPI 6.2 */
744 #define ACPI_RESOURCE_TYPE_PIN_CONFIG           21  /* ACPI 6.2 */
745 #define ACPI_RESOURCE_TYPE_PIN_GROUP            22  /* ACPI 6.2 */
746 #define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION   23  /* ACPI 6.2 */
747 #define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG     24  /* ACPI 6.2 */
748 #define ACPI_RESOURCE_TYPE_MAX                  24
749 
750 /* Master union for resource descriptors */
751 
752 typedef union acpi_resource_data
753 {
754     ACPI_RESOURCE_IRQ                       Irq;
755     ACPI_RESOURCE_DMA                       Dma;
756     ACPI_RESOURCE_START_DEPENDENT           StartDpf;
757     ACPI_RESOURCE_IO                        Io;
758     ACPI_RESOURCE_FIXED_IO                  FixedIo;
759     ACPI_RESOURCE_FIXED_DMA                 FixedDma;
760     ACPI_RESOURCE_VENDOR                    Vendor;
761     ACPI_RESOURCE_VENDOR_TYPED              VendorTyped;
762     ACPI_RESOURCE_END_TAG                   EndTag;
763     ACPI_RESOURCE_MEMORY24                  Memory24;
764     ACPI_RESOURCE_MEMORY32                  Memory32;
765     ACPI_RESOURCE_FIXED_MEMORY32            FixedMemory32;
766     ACPI_RESOURCE_ADDRESS16                 Address16;
767     ACPI_RESOURCE_ADDRESS32                 Address32;
768     ACPI_RESOURCE_ADDRESS64                 Address64;
769     ACPI_RESOURCE_EXTENDED_ADDRESS64        ExtAddress64;
770     ACPI_RESOURCE_EXTENDED_IRQ              ExtendedIrq;
771     ACPI_RESOURCE_GENERIC_REGISTER          GenericReg;
772     ACPI_RESOURCE_GPIO                      Gpio;
773     ACPI_RESOURCE_I2C_SERIALBUS             I2cSerialBus;
774     ACPI_RESOURCE_SPI_SERIALBUS             SpiSerialBus;
775     ACPI_RESOURCE_UART_SERIALBUS            UartSerialBus;
776     ACPI_RESOURCE_CSI2_SERIALBUS            Csi2SerialBus;
777     ACPI_RESOURCE_COMMON_SERIALBUS          CommonSerialBus;
778     ACPI_RESOURCE_PIN_FUNCTION              PinFunction;
779     ACPI_RESOURCE_PIN_CONFIG                PinConfig;
780     ACPI_RESOURCE_PIN_GROUP                 PinGroup;
781     ACPI_RESOURCE_PIN_GROUP_FUNCTION        PinGroupFunction;
782     ACPI_RESOURCE_PIN_GROUP_CONFIG          PinGroupConfig;
783 
784     /* Common fields */
785 
786     ACPI_RESOURCE_ADDRESS                   Address;        /* Common 16/32/64 address fields */
787 
788 } ACPI_RESOURCE_DATA;
789 
790 
791 /* Common resource header */
792 
793 typedef struct acpi_resource
794 {
795     UINT32                          Type;
796     UINT32                          Length;
797     ACPI_RESOURCE_DATA              Data;
798 
799 } ACPI_RESOURCE;
800 
801 /* restore default alignment */
802 
803 #pragma pack()
804 
805 
806 #define ACPI_RS_SIZE_NO_DATA                8       /* Id + Length fields */
807 #define ACPI_RS_SIZE_MIN                    (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
808 #define ACPI_RS_SIZE(Type)                  (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
809 
810 /* Macro for walking resource templates with multiple descriptors */
811 
812 #define ACPI_NEXT_RESOURCE(Res) \
813     ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length)
814 
815 
816 typedef struct acpi_pci_routing_table
817 {
818     UINT32                          Length;
819     UINT32                          Pin;
820     UINT64                          Address;        /* here for 64-bit alignment */
821     UINT32                          SourceIndex;
822     char                            Source[4];      /* pad to 64 bits so sizeof() works in all cases */
823 
824 } ACPI_PCI_ROUTING_TABLE;
825 
826 #endif /* __ACRESTYP_H__ */
827