xref: /freebsd/sys/contrib/dev/acpica/include/acrestyp.h (revision dd41de95a84d979615a2ef11df6850622bf6184e)
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 - 2021, 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                           Shareable;
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                           Shareable;
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                           Shareable;           /* 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, UART, CSI2 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 #define ACPI_RESOURCE_SERIAL_TYPE_CSI2          4
622 
623 /* Values for SlaveMode field above */
624 
625 #define ACPI_CONTROLLER_INITIATED               0
626 #define ACPI_DEVICE_INITIATED                   1
627 
628 
629 typedef struct acpi_resource_i2c_serialbus
630 {
631     ACPI_RESOURCE_SERIAL_COMMON
632     UINT8                           AccessMode;
633     UINT16                          SlaveAddress;
634     UINT32                          ConnectionSpeed;
635 
636 } ACPI_RESOURCE_I2C_SERIALBUS;
637 
638 /* Values for AccessMode field above */
639 
640 #define ACPI_I2C_7BIT_MODE                      0
641 #define ACPI_I2C_10BIT_MODE                     1
642 
643 
644 typedef struct acpi_resource_spi_serialbus
645 {
646     ACPI_RESOURCE_SERIAL_COMMON
647     UINT8                           WireMode;
648     UINT8                           DevicePolarity;
649     UINT8                           DataBitLength;
650     UINT8                           ClockPhase;
651     UINT8                           ClockPolarity;
652     UINT16                          DeviceSelection;
653     UINT32                          ConnectionSpeed;
654 
655 } ACPI_RESOURCE_SPI_SERIALBUS;
656 
657 /* Values for WireMode field above */
658 
659 #define ACPI_SPI_4WIRE_MODE                     0
660 #define ACPI_SPI_3WIRE_MODE                     1
661 
662 /* Values for DevicePolarity field above */
663 
664 #define ACPI_SPI_ACTIVE_LOW                     0
665 #define ACPI_SPI_ACTIVE_HIGH                    1
666 
667 /* Values for ClockPhase field above */
668 
669 #define ACPI_SPI_FIRST_PHASE                    0
670 #define ACPI_SPI_SECOND_PHASE                   1
671 
672 /* Values for ClockPolarity field above */
673 
674 #define ACPI_SPI_START_LOW                      0
675 #define ACPI_SPI_START_HIGH                     1
676 
677 
678 typedef struct acpi_resource_uart_serialbus
679 {
680     ACPI_RESOURCE_SERIAL_COMMON
681     UINT8                           Endian;
682     UINT8                           DataBits;
683     UINT8                           StopBits;
684     UINT8                           FlowControl;
685     UINT8                           Parity;
686     UINT8                           LinesEnabled;
687     UINT16                          RxFifoSize;
688     UINT16                          TxFifoSize;
689     UINT32                          DefaultBaudRate;
690 
691 } ACPI_RESOURCE_UART_SERIALBUS;
692 
693 /* Values for Endian field above */
694 
695 #define ACPI_UART_LITTLE_ENDIAN                 0
696 #define ACPI_UART_BIG_ENDIAN                    1
697 
698 /* Values for DataBits field above */
699 
700 #define ACPI_UART_5_DATA_BITS                   0
701 #define ACPI_UART_6_DATA_BITS                   1
702 #define ACPI_UART_7_DATA_BITS                   2
703 #define ACPI_UART_8_DATA_BITS                   3
704 #define ACPI_UART_9_DATA_BITS                   4
705 
706 /* Values for StopBits field above */
707 
708 #define ACPI_UART_NO_STOP_BITS                  0
709 #define ACPI_UART_1_STOP_BIT                    1
710 #define ACPI_UART_1P5_STOP_BITS                 2
711 #define ACPI_UART_2_STOP_BITS                   3
712 
713 /* Values for FlowControl field above */
714 
715 #define ACPI_UART_FLOW_CONTROL_NONE             0
716 #define ACPI_UART_FLOW_CONTROL_HW               1
717 #define ACPI_UART_FLOW_CONTROL_XON_XOFF         2
718 
719 /* Values for Parity field above */
720 
721 #define ACPI_UART_PARITY_NONE                   0
722 #define ACPI_UART_PARITY_EVEN                   1
723 #define ACPI_UART_PARITY_ODD                    2
724 #define ACPI_UART_PARITY_MARK                   3
725 #define ACPI_UART_PARITY_SPACE                  4
726 
727 /* Values for LinesEnabled bitfield above */
728 
729 #define ACPI_UART_CARRIER_DETECT                (1<<2)
730 #define ACPI_UART_RING_INDICATOR                (1<<3)
731 #define ACPI_UART_DATA_SET_READY                (1<<4)
732 #define ACPI_UART_DATA_TERMINAL_READY           (1<<5)
733 #define ACPI_UART_CLEAR_TO_SEND                 (1<<6)
734 #define ACPI_UART_REQUEST_TO_SEND               (1<<7)
735 
736 typedef struct acpi_resource_csi2_serialbus
737 {
738     ACPI_RESOURCE_SERIAL_COMMON
739     UINT8                           LocalPortInstance;
740     UINT8                           PhyType;
741 
742 } ACPI_RESOURCE_CSI2_SERIALBUS;
743 
744 typedef struct acpi_resource_pin_function
745 {
746     UINT8                           RevisionId;
747     UINT8                           PinConfig;
748     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
749     UINT16                          FunctionNumber;
750     UINT16                          PinTableLength;
751     UINT16                          VendorLength;
752     ACPI_RESOURCE_SOURCE            ResourceSource;
753     UINT16                          *PinTable;
754     UINT8                           *VendorData;
755 
756 } ACPI_RESOURCE_PIN_FUNCTION;
757 
758 typedef struct acpi_resource_pin_config
759 {
760     UINT8                           RevisionId;
761     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
762     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
763     UINT8                           PinConfigType;
764     UINT32                          PinConfigValue;
765     UINT16                          PinTableLength;
766     UINT16                          VendorLength;
767     ACPI_RESOURCE_SOURCE            ResourceSource;
768     UINT16                          *PinTable;
769     UINT8                           *VendorData;
770 
771 } ACPI_RESOURCE_PIN_CONFIG;
772 
773 /* Values for PinConfigType field above */
774 
775 #define ACPI_PIN_CONFIG_DEFAULT                 0
776 #define ACPI_PIN_CONFIG_BIAS_PULL_UP            1
777 #define ACPI_PIN_CONFIG_BIAS_PULL_DOWN          2
778 #define ACPI_PIN_CONFIG_BIAS_DEFAULT            3
779 #define ACPI_PIN_CONFIG_BIAS_DISABLE            4
780 #define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE     5
781 #define ACPI_PIN_CONFIG_BIAS_BUS_HOLD           6
782 #define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN        7
783 #define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE       8
784 #define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL         9
785 #define ACPI_PIN_CONFIG_DRIVE_STRENGTH          10
786 #define ACPI_PIN_CONFIG_SLEW_RATE               11
787 #define ACPI_PIN_CONFIG_INPUT_DEBOUNCE          12
788 #define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER   13
789 
790 typedef struct acpi_resource_pin_group
791 {
792     UINT8                           RevisionId;
793     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
794     UINT16                          PinTableLength;
795     UINT16                          VendorLength;
796     UINT16                          *PinTable;
797     ACPI_RESOURCE_LABEL             ResourceLabel;
798     UINT8                           *VendorData;
799 
800 } ACPI_RESOURCE_PIN_GROUP;
801 
802 typedef struct acpi_resource_pin_group_function
803 {
804     UINT8                           RevisionId;
805     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
806     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
807     UINT16                          FunctionNumber;
808     UINT16                          VendorLength;
809     ACPI_RESOURCE_SOURCE            ResourceSource;
810     ACPI_RESOURCE_LABEL             ResourceSourceLabel;
811     UINT8                           *VendorData;
812 
813 } ACPI_RESOURCE_PIN_GROUP_FUNCTION;
814 
815 typedef struct acpi_resource_pin_group_config
816 {
817     UINT8                           RevisionId;
818     UINT8                           ProducerConsumer;   /* For values, see Producer/Consumer above */
819     UINT8                           Shareable;           /* For values, see Interrupt Attributes above */
820     UINT8                           PinConfigType;      /* For values, see PinConfigType above */
821     UINT32                          PinConfigValue;
822     UINT16                          VendorLength;
823     ACPI_RESOURCE_SOURCE            ResourceSource;
824     ACPI_RESOURCE_LABEL             ResourceSourceLabel;
825     UINT8                           *VendorData;
826 
827 } ACPI_RESOURCE_PIN_GROUP_CONFIG;
828 
829 /* ACPI_RESOURCE_TYPEs */
830 
831 #define ACPI_RESOURCE_TYPE_IRQ                  0
832 #define ACPI_RESOURCE_TYPE_DMA                  1
833 #define ACPI_RESOURCE_TYPE_START_DEPENDENT      2
834 #define ACPI_RESOURCE_TYPE_END_DEPENDENT        3
835 #define ACPI_RESOURCE_TYPE_IO                   4
836 #define ACPI_RESOURCE_TYPE_FIXED_IO             5
837 #define ACPI_RESOURCE_TYPE_VENDOR               6
838 #define ACPI_RESOURCE_TYPE_END_TAG              7
839 #define ACPI_RESOURCE_TYPE_MEMORY24             8
840 #define ACPI_RESOURCE_TYPE_MEMORY32             9
841 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32       10
842 #define ACPI_RESOURCE_TYPE_ADDRESS16            11
843 #define ACPI_RESOURCE_TYPE_ADDRESS32            12
844 #define ACPI_RESOURCE_TYPE_ADDRESS64            13
845 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64   14  /* ACPI 3.0 */
846 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ         15
847 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER     16
848 #define ACPI_RESOURCE_TYPE_GPIO                 17  /* ACPI 5.0 */
849 #define ACPI_RESOURCE_TYPE_FIXED_DMA            18  /* ACPI 5.0 */
850 #define ACPI_RESOURCE_TYPE_SERIAL_BUS           19  /* ACPI 5.0 */
851 #define ACPI_RESOURCE_TYPE_PIN_FUNCTION         20  /* ACPI 6.2 */
852 #define ACPI_RESOURCE_TYPE_PIN_CONFIG           21  /* ACPI 6.2 */
853 #define ACPI_RESOURCE_TYPE_PIN_GROUP            22  /* ACPI 6.2 */
854 #define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION   23  /* ACPI 6.2 */
855 #define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG     24  /* ACPI 6.2 */
856 #define ACPI_RESOURCE_TYPE_MAX                  24
857 
858 /* Master union for resource descriptors */
859 
860 typedef union acpi_resource_data
861 {
862     ACPI_RESOURCE_IRQ                       Irq;
863     ACPI_RESOURCE_DMA                       Dma;
864     ACPI_RESOURCE_START_DEPENDENT           StartDpf;
865     ACPI_RESOURCE_IO                        Io;
866     ACPI_RESOURCE_FIXED_IO                  FixedIo;
867     ACPI_RESOURCE_FIXED_DMA                 FixedDma;
868     ACPI_RESOURCE_VENDOR                    Vendor;
869     ACPI_RESOURCE_VENDOR_TYPED              VendorTyped;
870     ACPI_RESOURCE_END_TAG                   EndTag;
871     ACPI_RESOURCE_MEMORY24                  Memory24;
872     ACPI_RESOURCE_MEMORY32                  Memory32;
873     ACPI_RESOURCE_FIXED_MEMORY32            FixedMemory32;
874     ACPI_RESOURCE_ADDRESS16                 Address16;
875     ACPI_RESOURCE_ADDRESS32                 Address32;
876     ACPI_RESOURCE_ADDRESS64                 Address64;
877     ACPI_RESOURCE_EXTENDED_ADDRESS64        ExtAddress64;
878     ACPI_RESOURCE_EXTENDED_IRQ              ExtendedIrq;
879     ACPI_RESOURCE_GENERIC_REGISTER          GenericReg;
880     ACPI_RESOURCE_GPIO                      Gpio;
881     ACPI_RESOURCE_I2C_SERIALBUS             I2cSerialBus;
882     ACPI_RESOURCE_SPI_SERIALBUS             SpiSerialBus;
883     ACPI_RESOURCE_UART_SERIALBUS            UartSerialBus;
884     ACPI_RESOURCE_CSI2_SERIALBUS            Csi2SerialBus;
885     ACPI_RESOURCE_COMMON_SERIALBUS          CommonSerialBus;
886     ACPI_RESOURCE_PIN_FUNCTION              PinFunction;
887     ACPI_RESOURCE_PIN_CONFIG                PinConfig;
888     ACPI_RESOURCE_PIN_GROUP                 PinGroup;
889     ACPI_RESOURCE_PIN_GROUP_FUNCTION        PinGroupFunction;
890     ACPI_RESOURCE_PIN_GROUP_CONFIG          PinGroupConfig;
891 
892     /* Common fields */
893 
894     ACPI_RESOURCE_ADDRESS                   Address;        /* Common 16/32/64 address fields */
895 
896 } ACPI_RESOURCE_DATA;
897 
898 
899 /* Common resource header */
900 
901 typedef struct acpi_resource
902 {
903     UINT32                          Type;
904     UINT32                          Length;
905     ACPI_RESOURCE_DATA              Data;
906 
907 } ACPI_RESOURCE;
908 
909 /* restore default alignment */
910 
911 #pragma pack()
912 
913 
914 #define ACPI_RS_SIZE_NO_DATA                8       /* Id + Length fields */
915 #define ACPI_RS_SIZE_MIN                    (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
916 #define ACPI_RS_SIZE(Type)                  (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
917 
918 /* Macro for walking resource templates with multiple descriptors */
919 
920 #define ACPI_NEXT_RESOURCE(Res) \
921     ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length)
922 
923 
924 typedef struct acpi_pci_routing_table
925 {
926     UINT32                          Length;
927     UINT32                          Pin;
928     UINT64                          Address;        /* here for 64-bit alignment */
929     UINT32                          SourceIndex;
930     char                            Source[4];      /* pad to 64 bits so sizeof() works in all cases */
931 
932 } ACPI_PCI_ROUTING_TABLE;
933 
934 #endif /* __ACRESTYP_H__ */
935