Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
| 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Module Name: amlresrc.h - AML resource descriptors |
| 5 | * |
| 6 | *****************************************************************************/ |
| 7 | |
| 8 | /* |
Bob Moore | 7784813 | 2012-01-12 13:27:23 +0800 | [diff] [blame] | 9 | * Copyright (C) 2000 - 2012, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * All rights reserved. |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without |
| 13 | * modification, are permitted provided that the following conditions |
| 14 | * are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright |
| 16 | * notice, this list of conditions, and the following disclaimer, |
| 17 | * without modification. |
| 18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 19 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 20 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 21 | * including a substantially similar Disclaimer requirement for further |
| 22 | * binary redistribution. |
| 23 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 24 | * of any contributors may be used to endorse or promote products derived |
| 25 | * from this software without specific prior written permission. |
| 26 | * |
| 27 | * Alternatively, this software may be distributed under the terms of the |
| 28 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 29 | * Software Foundation. |
| 30 | * |
| 31 | * NO WARRANTY |
| 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 42 | * POSSIBILITY OF SUCH DAMAGES. |
| 43 | */ |
| 44 | |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 45 | /* acpisrc:struct_defs -- for acpisrc conversion */ |
| 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #ifndef __AMLRESRC_H |
| 48 | #define __AMLRESRC_H |
| 49 | |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 50 | /* |
| 51 | * Resource descriptor tags, as defined in the ACPI specification. |
| 52 | * Used to symbolically reference fields within a descriptor. |
| 53 | */ |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 54 | #define ACPI_RESTAG_ADDRESS "_ADR" |
| 55 | #define ACPI_RESTAG_ALIGNMENT "_ALN" |
| 56 | #define ACPI_RESTAG_ADDRESSSPACE "_ASI" |
| 57 | #define ACPI_RESTAG_ACCESSSIZE "_ASZ" |
| 58 | #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" |
| 59 | #define ACPI_RESTAG_BASEADDRESS "_BAS" |
| 60 | #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 61 | #define ACPI_RESTAG_DEBOUNCETIME "_DBT" |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 62 | #define ACPI_RESTAG_DECODE "_DEC" |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 63 | #define ACPI_RESTAG_DEVICEPOLARITY "_DPL" |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 64 | #define ACPI_RESTAG_DMA "_DMA" |
| 65 | #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 66 | #define ACPI_RESTAG_DRIVESTRENGTH "_DRS" |
| 67 | #define ACPI_RESTAG_ENDIANNESS "_END" |
| 68 | #define ACPI_RESTAG_FLOWCONTROL "_FLC" |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 69 | #define ACPI_RESTAG_GRANULARITY "_GRA" |
| 70 | #define ACPI_RESTAG_INTERRUPT "_INT" |
Bob Moore | 958dd24 | 2006-05-12 17:12:00 -0400 | [diff] [blame] | 71 | #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ |
| 72 | #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 73 | #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 74 | #define ACPI_RESTAG_IORESTRICTION "_IOR" |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 75 | #define ACPI_RESTAG_LENGTH "_LEN" |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 76 | #define ACPI_RESTAG_LINE "_LIN" |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 77 | #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ |
Bob Moore | 958dd24 | 2006-05-12 17:12:00 -0400 | [diff] [blame] | 78 | #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 79 | #define ACPI_RESTAG_MAXADDR "_MAX" |
| 80 | #define ACPI_RESTAG_MINADDR "_MIN" |
| 81 | #define ACPI_RESTAG_MAXTYPE "_MAF" |
| 82 | #define ACPI_RESTAG_MINTYPE "_MIF" |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 83 | #define ACPI_RESTAG_MODE "_MOD" |
| 84 | #define ACPI_RESTAG_PARITY "_PAR" |
| 85 | #define ACPI_RESTAG_PHASE "_PHA" |
| 86 | #define ACPI_RESTAG_PIN "_PIN" |
| 87 | #define ACPI_RESTAG_PINCONFIG "_PPI" |
| 88 | #define ACPI_RESTAG_POLARITY "_POL" |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 89 | #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" |
| 90 | #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" |
| 91 | #define ACPI_RESTAG_RANGETYPE "_RNG" |
Bob Moore | 958dd24 | 2006-05-12 17:12:00 -0400 | [diff] [blame] | 92 | #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 93 | #define ACPI_RESTAG_LENGTH_RX "_RXL" |
| 94 | #define ACPI_RESTAG_LENGTH_TX "_TXL" |
| 95 | #define ACPI_RESTAG_SLAVEMODE "_SLV" |
| 96 | #define ACPI_RESTAG_SPEED "_SPE" |
| 97 | #define ACPI_RESTAG_STOPBITS "_STB" |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 98 | #define ACPI_RESTAG_TRANSLATION "_TRA" |
| 99 | #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ |
| 100 | #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 101 | #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */ |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 102 | #define ACPI_RESTAG_VENDORDATA "_VEN" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | |
| 104 | /* Default sizes for "small" resource descriptors */ |
| 105 | |
| 106 | #define ASL_RDESC_IRQ_SIZE 0x02 |
| 107 | #define ASL_RDESC_DMA_SIZE 0x02 |
| 108 | #define ASL_RDESC_ST_DEPEND_SIZE 0x00 |
| 109 | #define ASL_RDESC_END_DEPEND_SIZE 0x00 |
| 110 | #define ASL_RDESC_IO_SIZE 0x07 |
| 111 | #define ASL_RDESC_FIXED_IO_SIZE 0x03 |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 112 | #define ASL_RDESC_FIXED_DMA_SIZE 0x05 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | #define ASL_RDESC_END_TAG_SIZE 0x01 |
| 114 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 115 | struct asl_resource_node { |
| 116 | u32 buffer_length; |
| 117 | void *buffer; |
| 118 | struct asl_resource_node *next; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | }; |
| 120 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 121 | /* Macros used to generate AML resource length fields */ |
| 122 | |
| 123 | #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) |
| 124 | #define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) |
| 125 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | /* |
| 127 | * Resource descriptors defined in the ACPI specification. |
| 128 | * |
| 129 | * Packing/alignment must be BYTE because these descriptors |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 130 | * are used to overlay the raw AML byte stream. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | */ |
| 132 | #pragma pack(1) |
| 133 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 134 | /* |
| 135 | * SMALL descriptors |
| 136 | */ |
| 137 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 138 | u8 descriptor_type; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 139 | |
| 140 | struct aml_resource_small_header { |
| 141 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
| 142 | |
| 143 | struct aml_resource_irq { |
| 144 | AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 145 | u8 flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | }; |
| 147 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 148 | struct aml_resource_irq_noflags { |
| 149 | AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | }; |
| 151 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 152 | struct aml_resource_dma { |
| 153 | AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 154 | u8 flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | }; |
| 156 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 157 | struct aml_resource_start_dependent { |
| 158 | AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | }; |
| 160 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 161 | struct aml_resource_start_dependent_noprio { |
| 162 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 164 | struct aml_resource_end_dependent { |
| 165 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 167 | struct aml_resource_io { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 168 | AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 169 | u16 minimum; |
| 170 | u16 maximum; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 171 | u8 alignment; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 172 | u8 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | }; |
| 174 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 175 | struct aml_resource_fixed_io { |
| 176 | AML_RESOURCE_SMALL_HEADER_COMMON u16 address; |
| 177 | u8 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | }; |
| 179 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 180 | struct aml_resource_vendor_small { |
| 181 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
| 182 | |
| 183 | struct aml_resource_end_tag { |
| 184 | AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | }; |
| 186 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 187 | struct aml_resource_fixed_dma { |
| 188 | AML_RESOURCE_SMALL_HEADER_COMMON u16 request_lines; |
| 189 | u16 channels; |
| 190 | u8 width; |
| 191 | }; |
| 192 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 193 | /* |
| 194 | * LARGE descriptors |
| 195 | */ |
| 196 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 197 | u8 descriptor_type;\ |
| 198 | u16 resource_length; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 199 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 200 | struct aml_resource_large_header { |
| 201 | AML_RESOURCE_LARGE_HEADER_COMMON}; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 202 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 203 | struct aml_resource_memory24 { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 204 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 205 | u16 minimum; |
| 206 | u16 maximum; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 207 | u16 alignment; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 208 | u16 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | }; |
| 210 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 211 | struct aml_resource_vendor_large { |
| 212 | AML_RESOURCE_LARGE_HEADER_COMMON}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 214 | struct aml_resource_memory32 { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 215 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 216 | u32 minimum; |
| 217 | u32 maximum; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 218 | u32 alignment; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 219 | u32 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | }; |
| 221 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 222 | struct aml_resource_fixed_memory32 { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 223 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 224 | u32 address; |
| 225 | u32 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | }; |
| 227 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 228 | #define AML_RESOURCE_ADDRESS_COMMON \ |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 229 | u8 resource_type; \ |
| 230 | u8 flags; \ |
| 231 | u8 specific_flags; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 232 | |
| 233 | struct aml_resource_address { |
| 234 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; |
| 235 | |
| 236 | struct aml_resource_extended_address64 { |
| 237 | AML_RESOURCE_LARGE_HEADER_COMMON |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 238 | AML_RESOURCE_ADDRESS_COMMON u8 revision_ID; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 239 | u8 reserved; |
| 240 | u64 granularity; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 241 | u64 minimum; |
| 242 | u64 maximum; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 243 | u64 translation_offset; |
| 244 | u64 address_length; |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 245 | u64 type_specific; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | }; |
| 247 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 248 | #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 250 | struct aml_resource_address64 { |
| 251 | AML_RESOURCE_LARGE_HEADER_COMMON |
| 252 | AML_RESOURCE_ADDRESS_COMMON u64 granularity; |
| 253 | u64 minimum; |
| 254 | u64 maximum; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 255 | u64 translation_offset; |
| 256 | u64 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | }; |
| 258 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 259 | struct aml_resource_address32 { |
| 260 | AML_RESOURCE_LARGE_HEADER_COMMON |
| 261 | AML_RESOURCE_ADDRESS_COMMON u32 granularity; |
| 262 | u32 minimum; |
| 263 | u32 maximum; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 264 | u32 translation_offset; |
| 265 | u32 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | }; |
| 267 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 268 | struct aml_resource_address16 { |
| 269 | AML_RESOURCE_LARGE_HEADER_COMMON |
| 270 | AML_RESOURCE_ADDRESS_COMMON u16 granularity; |
| 271 | u16 minimum; |
| 272 | u16 maximum; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 273 | u16 translation_offset; |
| 274 | u16 address_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | }; |
| 276 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 277 | struct aml_resource_extended_irq { |
| 278 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 279 | u8 interrupt_count; |
| 280 | u32 interrupts[1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | /* res_source_index, res_source optional fields follow */ |
| 282 | }; |
| 283 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 284 | struct aml_resource_generic_register { |
| 285 | AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 286 | u8 bit_width; |
| 287 | u8 bit_offset; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 288 | u8 access_size; /* ACPI 3.0, was previously Reserved */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 289 | u64 address; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | }; |
| 291 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 292 | /* Common descriptor for gpio_int and gpio_io (ACPI 5.0) */ |
| 293 | |
| 294 | struct aml_resource_gpio { |
| 295 | AML_RESOURCE_LARGE_HEADER_COMMON u8 revision_id; |
| 296 | u8 connection_type; |
| 297 | u16 flags; |
| 298 | u16 int_flags; |
| 299 | u8 pin_config; |
| 300 | u16 drive_strength; |
| 301 | u16 debounce_timeout; |
| 302 | u16 pin_table_offset; |
| 303 | u8 res_source_index; |
| 304 | u16 res_source_offset; |
| 305 | u16 vendor_offset; |
| 306 | u16 vendor_length; |
| 307 | /* |
| 308 | * Optional fields follow immediately: |
| 309 | * 1) PIN list (Words) |
| 310 | * 2) Resource Source String |
| 311 | * 3) Vendor Data bytes |
| 312 | */ |
| 313 | }; |
| 314 | |
| 315 | #define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */ |
| 316 | |
| 317 | /* Values for connection_type above */ |
| 318 | |
| 319 | #define AML_RESOURCE_GPIO_TYPE_INT 0 |
| 320 | #define AML_RESOURCE_GPIO_TYPE_IO 1 |
| 321 | #define AML_RESOURCE_MAX_GPIOTYPE 1 |
| 322 | |
| 323 | /* Common preamble for all serial descriptors (ACPI 5.0) */ |
| 324 | |
| 325 | #define AML_RESOURCE_SERIAL_COMMON \ |
| 326 | u8 revision_id; \ |
| 327 | u8 res_source_index; \ |
| 328 | u8 type; \ |
| 329 | u8 flags; \ |
| 330 | u16 type_specific_flags; \ |
| 331 | u8 type_revision_id; \ |
| 332 | u16 type_data_length; \ |
| 333 | |
| 334 | /* Values for the type field above */ |
| 335 | |
| 336 | #define AML_RESOURCE_I2C_SERIALBUSTYPE 1 |
| 337 | #define AML_RESOURCE_SPI_SERIALBUSTYPE 2 |
| 338 | #define AML_RESOURCE_UART_SERIALBUSTYPE 3 |
| 339 | #define AML_RESOURCE_MAX_SERIALBUSTYPE 3 |
| 340 | #define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */ |
| 341 | |
| 342 | struct aml_resource_common_serialbus { |
| 343 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_SERIAL_COMMON}; |
| 344 | |
| 345 | struct aml_resource_i2c_serialbus { |
| 346 | AML_RESOURCE_LARGE_HEADER_COMMON |
| 347 | AML_RESOURCE_SERIAL_COMMON u32 connection_speed; |
| 348 | u16 slave_address; |
| 349 | /* |
| 350 | * Optional fields follow immediately: |
| 351 | * 1) Vendor Data bytes |
| 352 | * 2) Resource Source String |
| 353 | */ |
| 354 | }; |
| 355 | |
| 356 | #define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */ |
| 357 | #define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */ |
| 358 | #define AML_RESOURCE_I2C_MIN_DATA_LEN 6 |
| 359 | |
| 360 | struct aml_resource_spi_serialbus { |
| 361 | AML_RESOURCE_LARGE_HEADER_COMMON |
| 362 | AML_RESOURCE_SERIAL_COMMON u32 connection_speed; |
| 363 | u8 data_bit_length; |
| 364 | u8 clock_phase; |
| 365 | u8 clock_polarity; |
| 366 | u16 device_selection; |
| 367 | /* |
| 368 | * Optional fields follow immediately: |
| 369 | * 1) Vendor Data bytes |
| 370 | * 2) Resource Source String |
| 371 | */ |
| 372 | }; |
| 373 | |
| 374 | #define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */ |
| 375 | #define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */ |
| 376 | #define AML_RESOURCE_SPI_MIN_DATA_LEN 9 |
| 377 | |
| 378 | struct aml_resource_uart_serialbus { |
| 379 | AML_RESOURCE_LARGE_HEADER_COMMON |
| 380 | AML_RESOURCE_SERIAL_COMMON u32 default_baud_rate; |
| 381 | u16 rx_fifo_size; |
| 382 | u16 tx_fifo_size; |
| 383 | u8 parity; |
| 384 | u8 lines_enabled; |
| 385 | /* |
| 386 | * Optional fields follow immediately: |
| 387 | * 1) Vendor Data bytes |
| 388 | * 2) Resource Source String |
| 389 | */ |
| 390 | }; |
| 391 | |
| 392 | #define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */ |
| 393 | #define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */ |
| 394 | #define AML_RESOURCE_UART_MIN_DATA_LEN 10 |
| 395 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | /* restore default alignment */ |
| 397 | |
| 398 | #pragma pack() |
| 399 | |
| 400 | /* Union of all resource descriptors, so we can allocate the worst case */ |
| 401 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 402 | union aml_resource { |
| 403 | /* Descriptor headers */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 405 | u8 descriptor_type; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 406 | struct aml_resource_small_header small_header; |
| 407 | struct aml_resource_large_header large_header; |
| 408 | |
| 409 | /* Small resource descriptors */ |
| 410 | |
| 411 | struct aml_resource_irq irq; |
| 412 | struct aml_resource_dma dma; |
| 413 | struct aml_resource_start_dependent start_dpf; |
| 414 | struct aml_resource_end_dependent end_dpf; |
| 415 | struct aml_resource_io io; |
| 416 | struct aml_resource_fixed_io fixed_io; |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 417 | struct aml_resource_fixed_dma fixed_dma; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 418 | struct aml_resource_vendor_small vendor_small; |
| 419 | struct aml_resource_end_tag end_tag; |
| 420 | |
| 421 | /* Large resource descriptors */ |
| 422 | |
| 423 | struct aml_resource_memory24 memory24; |
| 424 | struct aml_resource_generic_register generic_reg; |
| 425 | struct aml_resource_vendor_large vendor_large; |
| 426 | struct aml_resource_memory32 memory32; |
| 427 | struct aml_resource_fixed_memory32 fixed_memory32; |
| 428 | struct aml_resource_address16 address16; |
| 429 | struct aml_resource_address32 address32; |
| 430 | struct aml_resource_address64 address64; |
| 431 | struct aml_resource_extended_address64 ext_address64; |
| 432 | struct aml_resource_extended_irq extended_irq; |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 433 | struct aml_resource_gpio gpio; |
| 434 | struct aml_resource_i2c_serialbus i2c_serial_bus; |
| 435 | struct aml_resource_spi_serialbus spi_serial_bus; |
| 436 | struct aml_resource_uart_serialbus uart_serial_bus; |
| 437 | struct aml_resource_common_serialbus common_serial_bus; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 438 | |
| 439 | /* Utility overlays */ |
| 440 | |
| 441 | struct aml_resource_address address; |
Bob Moore | 958dd24 | 2006-05-12 17:12:00 -0400 | [diff] [blame] | 442 | u32 dword_item; |
| 443 | u16 word_item; |
| 444 | u8 byte_item; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | }; |
| 446 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | #endif |