aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/******************************************************************************
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * Name: acrestyp.h - Defines, types, and structures for resource descriptors
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers *****************************************************************************/
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp.
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * All rights reserved.
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * Redistribution and use in source and binary forms, with or without
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * modification, are permitted provided that the following conditions
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * 1. Redistributions of source code must retain the above copyright
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * notice, this list of conditions, and the following disclaimer,
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * without modification.
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * substantially similar to the "NO WARRANTY" disclaimer below
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * ("Disclaimer") and any redistribution must be conditioned upon
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * including a substantially similar Disclaimer requirement for further
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * binary redistribution.
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * of any contributors may be used to endorse or promote products derived
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * from this software without specific prior written permission.
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * Alternatively, this software may be distributed under the terms of the
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * GNU General Public License ("GPL") version 2 as published by the Free
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * Software Foundation.
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * NO WARRANTY
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0Gordon Ross * POSSIBILITY OF SUCH DAMAGES.
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * Definitions for Resource Attributes
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myerstypedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myerstypedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * Memory Attributes
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/*! [Begin] no source code translation */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * IO Attributes
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/*! [End] no source code translation !*/
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* Type of translation - 1=Sparse, 0=Dense */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * IO Port Descriptor Decode
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek * Interrupt attributes - used in multiple descriptors
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Triggering */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Polarity */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * DMA Attributes
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * Start Dependent Functions Priority definitions
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * 16, 32 and 64-bit Address Descriptor resource types
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * If possible, pack the following structures to byte alignment
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* UUID data structures for use in vendor-defined resource descriptors */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * Structures used to describe device resources
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers * needed because it has no fields
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for Width field above */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* Vendor resource with UUID info (introduced in ACPI 3.0) */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers /* Used for the *WordSpace macros */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* Fields common to all address descriptors, 16/32/64 bit */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek UINT8 Sharable; /* For values, see Interrupt Attributes above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek UINT8 WakeCapable; /* For values, see Interrupt Attributes above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek UINT8 Triggering; /* For values, see Interrupt Attributes above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek UINT8 Polarity; /* For values, see Interrupt Attributes above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for GPIO ConnectionType field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for PinConfig field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for IoRestriction field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Common structure for I2C, SPI, and UART serial descriptors */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */\
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for the Type field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for SlaveMode field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for AccessMode field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for WireMode field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for DevicePolarity field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for ClockPhase field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for ClockPolarity field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for Endian field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for DataBits field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for StopBits field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for FlowControl field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for Parity field above */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Values for LinesEnabled bitfield above */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* ACPI_RESOURCE_TYPEs */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* Master union for resource descriptors */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek ACPI_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers /* Common fields */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* Common resource header */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers/* restore default alignment */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek/* Macro for walking resource templates with multiple descriptors */
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length)
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
aa2aa9a662539940ddbc8610da5a3a874ebd7503Dana Myers#endif /* __ACRESTYP_H__ */