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