vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / bus_managers / acpi / acpica / include / acrestyp.h
blob7df5a63f61d13164132fcfdae45cd9f294eecba6
1 /******************************************************************************
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12 * All rights reserved.
14 * 2. License
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.
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
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;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
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.
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.
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.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
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.
80 * 4. Disclaimer and Export Compliance
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.
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.
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.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
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.
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.
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.
150 *****************************************************************************/
152 #ifndef __ACRESTYP_H__
153 #define __ACRESTYP_H__
157 * Definitions for Resource Attributes
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 */
163 * Memory Attributes
165 #define ACPI_READ_ONLY_MEMORY (UINT8) 0x00
166 #define ACPI_READ_WRITE_MEMORY (UINT8) 0x01
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
173 /*! [Begin] no source code translation */
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.
179 /*! [End] no source code translation !*/
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)
185 /* Type of translation - 1=Sparse, 0=Dense */
187 #define ACPI_SPARSE_TRANSLATION (UINT8) 0x01
190 * IO Port Descriptor Decode
192 #define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
193 #define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
196 * Interrupt attributes - used in multiple descriptors
199 /* Triggering */
201 #define ACPI_LEVEL_SENSITIVE (UINT8) 0x00
202 #define ACPI_EDGE_SENSITIVE (UINT8) 0x01
204 /* Polarity */
206 #define ACPI_ACTIVE_HIGH (UINT8) 0x00
207 #define ACPI_ACTIVE_LOW (UINT8) 0x01
208 #define ACPI_ACTIVE_BOTH (UINT8) 0x02
210 /* Sharing */
212 #define ACPI_EXCLUSIVE (UINT8) 0x00
213 #define ACPI_SHARED (UINT8) 0x01
215 /* Wake */
217 #define ACPI_NOT_WAKE_CAPABLE (UINT8) 0x00
218 #define ACPI_WAKE_CAPABLE (UINT8) 0x01
221 * DMA Attributes
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
228 #define ACPI_NOT_BUS_MASTER (UINT8) 0x00
229 #define ACPI_BUS_MASTER (UINT8) 0x01
231 #define ACPI_TRANSFER_8 (UINT8) 0x00
232 #define ACPI_TRANSFER_8_16 (UINT8) 0x01
233 #define ACPI_TRANSFER_16 (UINT8) 0x02
236 * Start Dependent Functions Priority definitions
238 #define ACPI_GOOD_CONFIGURATION (UINT8) 0x00
239 #define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01
240 #define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
243 * 16, 32 and 64-bit Address Descriptor resource types
245 #define ACPI_MEMORY_RANGE (UINT8) 0x00
246 #define ACPI_IO_RANGE (UINT8) 0x01
247 #define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02
249 #define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00
250 #define ACPI_ADDRESS_FIXED (UINT8) 0x01
252 #define ACPI_POS_DECODE (UINT8) 0x00
253 #define ACPI_SUB_DECODE (UINT8) 0x01
255 /* Producer/Consumer */
257 #define ACPI_PRODUCER (UINT8) 0x00
258 #define ACPI_CONSUMER (UINT8) 0x01
262 * If possible, pack the following structures to byte alignment
264 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
265 #pragma pack(1)
266 #endif
268 /* UUID data structures for use in vendor-defined resource descriptors */
270 typedef struct acpi_uuid
272 UINT8 Data[ACPI_UUID_LENGTH];
273 } ACPI_UUID;
275 typedef struct acpi_vendor_uuid
277 UINT8 Subtype;
278 UINT8 Data[ACPI_UUID_LENGTH];
280 } ACPI_VENDOR_UUID;
283 * Structures used to describe device resources
285 typedef struct acpi_resource_irq
287 UINT8 DescriptorLength;
288 UINT8 Triggering;
289 UINT8 Polarity;
290 UINT8 Sharable;
291 UINT8 WakeCapable;
292 UINT8 InterruptCount;
293 UINT8 Interrupts[1];
295 } ACPI_RESOURCE_IRQ;
297 typedef struct acpi_resource_dma
299 UINT8 Type;
300 UINT8 BusMaster;
301 UINT8 Transfer;
302 UINT8 ChannelCount;
303 UINT8 Channels[1];
305 } ACPI_RESOURCE_DMA;
307 typedef struct acpi_resource_start_dependent
309 UINT8 DescriptorLength;
310 UINT8 CompatibilityPriority;
311 UINT8 PerformanceRobustness;
313 } ACPI_RESOURCE_START_DEPENDENT;
317 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
318 * needed because it has no fields
322 typedef struct acpi_resource_io
324 UINT8 IoDecode;
325 UINT8 Alignment;
326 UINT8 AddressLength;
327 UINT16 Minimum;
328 UINT16 Maximum;
330 } ACPI_RESOURCE_IO;
332 typedef struct acpi_resource_fixed_io
334 UINT16 Address;
335 UINT8 AddressLength;
337 } ACPI_RESOURCE_FIXED_IO;
339 typedef struct acpi_resource_fixed_dma
341 UINT16 RequestLines;
342 UINT16 Channels;
343 UINT8 Width;
345 } ACPI_RESOURCE_FIXED_DMA;
347 /* Values for Width field above */
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
357 typedef struct acpi_resource_vendor
359 UINT16 ByteLength;
360 UINT8 ByteData[1];
362 } ACPI_RESOURCE_VENDOR;
364 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
366 typedef struct acpi_resource_vendor_typed
368 UINT16 ByteLength;
369 UINT8 UuidSubtype;
370 UINT8 Uuid[ACPI_UUID_LENGTH];
371 UINT8 ByteData[1];
373 } ACPI_RESOURCE_VENDOR_TYPED;
375 typedef struct acpi_resource_end_tag
377 UINT8 Checksum;
379 } ACPI_RESOURCE_END_TAG;
381 typedef struct acpi_resource_memory24
383 UINT8 WriteProtect;
384 UINT16 Minimum;
385 UINT16 Maximum;
386 UINT16 Alignment;
387 UINT16 AddressLength;
389 } ACPI_RESOURCE_MEMORY24;
391 typedef struct acpi_resource_memory32
393 UINT8 WriteProtect;
394 UINT32 Minimum;
395 UINT32 Maximum;
396 UINT32 Alignment;
397 UINT32 AddressLength;
399 } ACPI_RESOURCE_MEMORY32;
401 typedef struct acpi_resource_fixed_memory32
403 UINT8 WriteProtect;
404 UINT32 Address;
405 UINT32 AddressLength;
407 } ACPI_RESOURCE_FIXED_MEMORY32;
409 typedef struct acpi_memory_attribute
411 UINT8 WriteProtect;
412 UINT8 Caching;
413 UINT8 RangeType;
414 UINT8 Translation;
416 } ACPI_MEMORY_ATTRIBUTE;
418 typedef struct acpi_io_attribute
420 UINT8 RangeType;
421 UINT8 Translation;
422 UINT8 TranslationType;
423 UINT8 Reserved1;
425 } ACPI_IO_ATTRIBUTE;
427 typedef union acpi_resource_attribute
429 ACPI_MEMORY_ATTRIBUTE Mem;
430 ACPI_IO_ATTRIBUTE Io;
432 /* Used for the *WordSpace macros */
434 UINT8 TypeSpecific;
436 } ACPI_RESOURCE_ATTRIBUTE;
438 typedef struct acpi_resource_source
440 UINT8 Index;
441 UINT16 StringLength;
442 char *StringPtr;
444 } ACPI_RESOURCE_SOURCE;
446 /* Fields common to all address descriptors, 16/32/64 bit */
448 #define ACPI_RESOURCE_ADDRESS_COMMON \
449 UINT8 ResourceType; \
450 UINT8 ProducerConsumer; \
451 UINT8 Decode; \
452 UINT8 MinAddressFixed; \
453 UINT8 MaxAddressFixed; \
454 ACPI_RESOURCE_ATTRIBUTE Info;
456 typedef struct acpi_address16_attribute
458 UINT16 Granularity;
459 UINT16 Minimum;
460 UINT16 Maximum;
461 UINT16 TranslationOffset;
462 UINT16 AddressLength;
464 } ACPI_ADDRESS16_ATTRIBUTE;
466 typedef struct acpi_address32_attribute
468 UINT32 Granularity;
469 UINT32 Minimum;
470 UINT32 Maximum;
471 UINT32 TranslationOffset;
472 UINT32 AddressLength;
474 } ACPI_ADDRESS32_ATTRIBUTE;
476 typedef struct acpi_address64_attribute
478 UINT64 Granularity;
479 UINT64 Minimum;
480 UINT64 Maximum;
481 UINT64 TranslationOffset;
482 UINT64 AddressLength;
484 } ACPI_ADDRESS64_ATTRIBUTE;
486 typedef struct acpi_resource_address
488 ACPI_RESOURCE_ADDRESS_COMMON
490 } ACPI_RESOURCE_ADDRESS;
492 typedef struct acpi_resource_address16
494 ACPI_RESOURCE_ADDRESS_COMMON
495 ACPI_ADDRESS16_ATTRIBUTE Address;
496 ACPI_RESOURCE_SOURCE ResourceSource;
498 } ACPI_RESOURCE_ADDRESS16;
500 typedef struct acpi_resource_address32
502 ACPI_RESOURCE_ADDRESS_COMMON
503 ACPI_ADDRESS32_ATTRIBUTE Address;
504 ACPI_RESOURCE_SOURCE ResourceSource;
506 } ACPI_RESOURCE_ADDRESS32;
508 typedef struct acpi_resource_address64
510 ACPI_RESOURCE_ADDRESS_COMMON
511 ACPI_ADDRESS64_ATTRIBUTE Address;
512 ACPI_RESOURCE_SOURCE ResourceSource;
514 } ACPI_RESOURCE_ADDRESS64;
516 typedef struct acpi_resource_extended_address64
518 ACPI_RESOURCE_ADDRESS_COMMON
519 UINT8 RevisionID;
520 ACPI_ADDRESS64_ATTRIBUTE Address;
521 UINT64 TypeSpecific;
523 } ACPI_RESOURCE_EXTENDED_ADDRESS64;
525 typedef struct acpi_resource_extended_irq
527 UINT8 ProducerConsumer;
528 UINT8 Triggering;
529 UINT8 Polarity;
530 UINT8 Sharable;
531 UINT8 WakeCapable;
532 UINT8 InterruptCount;
533 ACPI_RESOURCE_SOURCE ResourceSource;
534 UINT32 Interrupts[1];
536 } ACPI_RESOURCE_EXTENDED_IRQ;
538 typedef struct acpi_resource_generic_register
540 UINT8 SpaceId;
541 UINT8 BitWidth;
542 UINT8 BitOffset;
543 UINT8 AccessSize;
544 UINT64 Address;
546 } ACPI_RESOURCE_GENERIC_REGISTER;
548 typedef struct acpi_resource_gpio
550 UINT8 RevisionId;
551 UINT8 ConnectionType;
552 UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */
553 UINT8 PinConfig;
554 UINT8 Sharable; /* For values, see Interrupt Attributes above */
555 UINT8 WakeCapable; /* For values, see Interrupt Attributes above */
556 UINT8 IoRestriction;
557 UINT8 Triggering; /* For values, see Interrupt Attributes above */
558 UINT8 Polarity; /* For values, see Interrupt Attributes above */
559 UINT16 DriveStrength;
560 UINT16 DebounceTimeout;
561 UINT16 PinTableLength;
562 UINT16 VendorLength;
563 ACPI_RESOURCE_SOURCE ResourceSource;
564 UINT16 *PinTable;
565 UINT8 *VendorData;
567 } ACPI_RESOURCE_GPIO;
569 /* Values for GPIO ConnectionType field above */
571 #define ACPI_RESOURCE_GPIO_TYPE_INT 0
572 #define ACPI_RESOURCE_GPIO_TYPE_IO 1
574 /* Values for PinConfig field above */
576 #define ACPI_PIN_CONFIG_DEFAULT 0
577 #define ACPI_PIN_CONFIG_PULLUP 1
578 #define ACPI_PIN_CONFIG_PULLDOWN 2
579 #define ACPI_PIN_CONFIG_NOPULL 3
581 /* Values for IoRestriction field above */
583 #define ACPI_IO_RESTRICT_NONE 0
584 #define ACPI_IO_RESTRICT_INPUT 1
585 #define ACPI_IO_RESTRICT_OUTPUT 2
586 #define ACPI_IO_RESTRICT_NONE_PRESERVE 3
589 /* Common structure for I2C, SPI, and UART serial descriptors */
591 #define ACPI_RESOURCE_SERIAL_COMMON \
592 UINT8 RevisionId; \
593 UINT8 Type; \
594 UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */\
595 UINT8 SlaveMode; \
596 UINT8 ConnectionSharing; \
597 UINT8 TypeRevisionId; \
598 UINT16 TypeDataLength; \
599 UINT16 VendorLength; \
600 ACPI_RESOURCE_SOURCE ResourceSource; \
601 UINT8 *VendorData;
603 typedef struct acpi_resource_common_serialbus
605 ACPI_RESOURCE_SERIAL_COMMON
607 } ACPI_RESOURCE_COMMON_SERIALBUS;
609 /* Values for the Type field above */
611 #define ACPI_RESOURCE_SERIAL_TYPE_I2C 1
612 #define ACPI_RESOURCE_SERIAL_TYPE_SPI 2
613 #define ACPI_RESOURCE_SERIAL_TYPE_UART 3
615 /* Values for SlaveMode field above */
617 #define ACPI_CONTROLLER_INITIATED 0
618 #define ACPI_DEVICE_INITIATED 1
621 typedef struct acpi_resource_i2c_serialbus
623 ACPI_RESOURCE_SERIAL_COMMON
624 UINT8 AccessMode;
625 UINT16 SlaveAddress;
626 UINT32 ConnectionSpeed;
628 } ACPI_RESOURCE_I2C_SERIALBUS;
630 /* Values for AccessMode field above */
632 #define ACPI_I2C_7BIT_MODE 0
633 #define ACPI_I2C_10BIT_MODE 1
636 typedef struct acpi_resource_spi_serialbus
638 ACPI_RESOURCE_SERIAL_COMMON
639 UINT8 WireMode;
640 UINT8 DevicePolarity;
641 UINT8 DataBitLength;
642 UINT8 ClockPhase;
643 UINT8 ClockPolarity;
644 UINT16 DeviceSelection;
645 UINT32 ConnectionSpeed;
647 } ACPI_RESOURCE_SPI_SERIALBUS;
649 /* Values for WireMode field above */
651 #define ACPI_SPI_4WIRE_MODE 0
652 #define ACPI_SPI_3WIRE_MODE 1
654 /* Values for DevicePolarity field above */
656 #define ACPI_SPI_ACTIVE_LOW 0
657 #define ACPI_SPI_ACTIVE_HIGH 1
659 /* Values for ClockPhase field above */
661 #define ACPI_SPI_FIRST_PHASE 0
662 #define ACPI_SPI_SECOND_PHASE 1
664 /* Values for ClockPolarity field above */
666 #define ACPI_SPI_START_LOW 0
667 #define ACPI_SPI_START_HIGH 1
670 typedef struct acpi_resource_uart_serialbus
672 ACPI_RESOURCE_SERIAL_COMMON
673 UINT8 Endian;
674 UINT8 DataBits;
675 UINT8 StopBits;
676 UINT8 FlowControl;
677 UINT8 Parity;
678 UINT8 LinesEnabled;
679 UINT16 RxFifoSize;
680 UINT16 TxFifoSize;
681 UINT32 DefaultBaudRate;
683 } ACPI_RESOURCE_UART_SERIALBUS;
685 /* Values for Endian field above */
687 #define ACPI_UART_LITTLE_ENDIAN 0
688 #define ACPI_UART_BIG_ENDIAN 1
690 /* Values for DataBits field above */
692 #define ACPI_UART_5_DATA_BITS 0
693 #define ACPI_UART_6_DATA_BITS 1
694 #define ACPI_UART_7_DATA_BITS 2
695 #define ACPI_UART_8_DATA_BITS 3
696 #define ACPI_UART_9_DATA_BITS 4
698 /* Values for StopBits field above */
700 #define ACPI_UART_NO_STOP_BITS 0
701 #define ACPI_UART_1_STOP_BIT 1
702 #define ACPI_UART_1P5_STOP_BITS 2
703 #define ACPI_UART_2_STOP_BITS 3
705 /* Values for FlowControl field above */
707 #define ACPI_UART_FLOW_CONTROL_NONE 0
708 #define ACPI_UART_FLOW_CONTROL_HW 1
709 #define ACPI_UART_FLOW_CONTROL_XON_XOFF 2
711 /* Values for Parity field above */
713 #define ACPI_UART_PARITY_NONE 0
714 #define ACPI_UART_PARITY_EVEN 1
715 #define ACPI_UART_PARITY_ODD 2
716 #define ACPI_UART_PARITY_MARK 3
717 #define ACPI_UART_PARITY_SPACE 4
719 /* Values for LinesEnabled bitfield above */
721 #define ACPI_UART_CARRIER_DETECT (1<<2)
722 #define ACPI_UART_RING_INDICATOR (1<<3)
723 #define ACPI_UART_DATA_SET_READY (1<<4)
724 #define ACPI_UART_DATA_TERMINAL_READY (1<<5)
725 #define ACPI_UART_CLEAR_TO_SEND (1<<6)
726 #define ACPI_UART_REQUEST_TO_SEND (1<<7)
729 /* ACPI_RESOURCE_TYPEs */
731 #define ACPI_RESOURCE_TYPE_IRQ 0
732 #define ACPI_RESOURCE_TYPE_DMA 1
733 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
734 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
735 #define ACPI_RESOURCE_TYPE_IO 4
736 #define ACPI_RESOURCE_TYPE_FIXED_IO 5
737 #define ACPI_RESOURCE_TYPE_VENDOR 6
738 #define ACPI_RESOURCE_TYPE_END_TAG 7
739 #define ACPI_RESOURCE_TYPE_MEMORY24 8
740 #define ACPI_RESOURCE_TYPE_MEMORY32 9
741 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
742 #define ACPI_RESOURCE_TYPE_ADDRESS16 11
743 #define ACPI_RESOURCE_TYPE_ADDRESS32 12
744 #define ACPI_RESOURCE_TYPE_ADDRESS64 13
745 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
746 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
747 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
748 #define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */
749 #define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */
750 #define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */
751 #define ACPI_RESOURCE_TYPE_MAX 19
753 /* Master union for resource descriptors */
755 typedef union acpi_resource_data
757 ACPI_RESOURCE_IRQ Irq;
758 ACPI_RESOURCE_DMA Dma;
759 ACPI_RESOURCE_START_DEPENDENT StartDpf;
760 ACPI_RESOURCE_IO Io;
761 ACPI_RESOURCE_FIXED_IO FixedIo;
762 ACPI_RESOURCE_FIXED_DMA FixedDma;
763 ACPI_RESOURCE_VENDOR Vendor;
764 ACPI_RESOURCE_VENDOR_TYPED VendorTyped;
765 ACPI_RESOURCE_END_TAG EndTag;
766 ACPI_RESOURCE_MEMORY24 Memory24;
767 ACPI_RESOURCE_MEMORY32 Memory32;
768 ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32;
769 ACPI_RESOURCE_ADDRESS16 Address16;
770 ACPI_RESOURCE_ADDRESS32 Address32;
771 ACPI_RESOURCE_ADDRESS64 Address64;
772 ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
773 ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq;
774 ACPI_RESOURCE_GENERIC_REGISTER GenericReg;
775 ACPI_RESOURCE_GPIO Gpio;
776 ACPI_RESOURCE_I2C_SERIALBUS I2cSerialBus;
777 ACPI_RESOURCE_SPI_SERIALBUS SpiSerialBus;
778 ACPI_RESOURCE_UART_SERIALBUS UartSerialBus;
779 ACPI_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
781 /* Common fields */
783 ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */
785 } ACPI_RESOURCE_DATA;
788 /* Common resource header */
790 typedef struct acpi_resource
792 UINT32 Type;
793 UINT32 Length;
794 ACPI_RESOURCE_DATA Data;
796 } ACPI_RESOURCE;
798 /* restore default alignment */
800 #pragma pack()
803 #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
804 #define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
805 #define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
807 /* Macro for walking resource templates with multiple descriptors */
809 #define ACPI_NEXT_RESOURCE(Res) \
810 ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length)
813 typedef struct acpi_pci_routing_table
815 UINT32 Length;
816 UINT32 Pin;
817 UINT64 Address; /* here for 64-bit alignment */
818 UINT32 SourceIndex;
819 char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
821 } ACPI_PCI_ROUTING_TABLE;
823 #endif /* __ACRESTYP_H__ */