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 | /* |
| 9 | * Copyright (C) 2000 - 2005, R. Byron Moore |
| 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 | |
| 45 | |
| 46 | #ifndef __AMLRESRC_H |
| 47 | #define __AMLRESRC_H |
| 48 | |
| 49 | |
| 50 | #define ASL_RESNAME_ADDRESS "_ADR" |
| 51 | #define ASL_RESNAME_ALIGNMENT "_ALN" |
| 52 | #define ASL_RESNAME_ADDRESSSPACE "_ASI" |
| 53 | #define ASL_RESNAME_ACCESSSIZE "_ASZ" |
| 54 | #define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" |
| 55 | #define ASL_RESNAME_BASEADDRESS "_BAS" |
| 56 | #define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ |
| 57 | #define ASL_RESNAME_DECODE "_DEC" |
| 58 | #define ASL_RESNAME_DMA "_DMA" |
| 59 | #define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ |
| 60 | #define ASL_RESNAME_GRANULARITY "_GRA" |
| 61 | #define ASL_RESNAME_INTERRUPT "_INT" |
| 62 | #define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ |
| 63 | #define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ |
| 64 | #define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ |
| 65 | #define ASL_RESNAME_LENGTH "_LEN" |
| 66 | #define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ |
| 67 | #define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ |
| 68 | #define ASL_RESNAME_MAXADDR "_MAX" |
| 69 | #define ASL_RESNAME_MINADDR "_MIN" |
| 70 | #define ASL_RESNAME_MAXTYPE "_MAF" |
| 71 | #define ASL_RESNAME_MINTYPE "_MIF" |
| 72 | #define ASL_RESNAME_REGISTERBITOFFSET "_RBO" |
| 73 | #define ASL_RESNAME_REGISTERBITWIDTH "_RBW" |
| 74 | #define ASL_RESNAME_RANGETYPE "_RNG" |
| 75 | #define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ |
| 76 | #define ASL_RESNAME_TRANSLATION "_TRA" |
| 77 | #define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ |
| 78 | #define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ |
| 79 | #define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ |
| 80 | |
| 81 | |
| 82 | /* Default sizes for "small" resource descriptors */ |
| 83 | |
| 84 | #define ASL_RDESC_IRQ_SIZE 0x02 |
| 85 | #define ASL_RDESC_DMA_SIZE 0x02 |
| 86 | #define ASL_RDESC_ST_DEPEND_SIZE 0x00 |
| 87 | #define ASL_RDESC_END_DEPEND_SIZE 0x00 |
| 88 | #define ASL_RDESC_IO_SIZE 0x07 |
| 89 | #define ASL_RDESC_FIXED_IO_SIZE 0x03 |
| 90 | #define ASL_RDESC_END_TAG_SIZE 0x01 |
| 91 | |
| 92 | |
| 93 | struct asl_resource_node |
| 94 | { |
| 95 | u32 buffer_length; |
| 96 | void *buffer; |
| 97 | struct asl_resource_node *next; |
| 98 | }; |
| 99 | |
| 100 | |
| 101 | /* |
| 102 | * Resource descriptors defined in the ACPI specification. |
| 103 | * |
| 104 | * Packing/alignment must be BYTE because these descriptors |
| 105 | * are used to overlay the AML byte stream. |
| 106 | */ |
| 107 | #pragma pack(1) |
| 108 | |
| 109 | struct asl_irq_format_desc |
| 110 | { |
| 111 | u8 descriptor_type; |
| 112 | u16 irq_mask; |
| 113 | u8 flags; |
| 114 | }; |
| 115 | |
| 116 | |
| 117 | struct asl_irq_noflags_desc |
| 118 | { |
| 119 | u8 descriptor_type; |
| 120 | u16 irq_mask; |
| 121 | }; |
| 122 | |
| 123 | |
| 124 | struct asl_dma_format_desc |
| 125 | { |
| 126 | u8 descriptor_type; |
| 127 | u8 dma_channel_mask; |
| 128 | u8 flags; |
| 129 | }; |
| 130 | |
| 131 | |
| 132 | struct asl_start_dependent_desc |
| 133 | { |
| 134 | u8 descriptor_type; |
| 135 | u8 flags; |
| 136 | }; |
| 137 | |
| 138 | |
| 139 | struct asl_start_dependent_noprio_desc |
| 140 | { |
| 141 | u8 descriptor_type; |
| 142 | }; |
| 143 | |
| 144 | |
| 145 | struct asl_end_dependent_desc |
| 146 | { |
| 147 | u8 descriptor_type; |
| 148 | }; |
| 149 | |
| 150 | |
| 151 | struct asl_io_port_desc |
| 152 | { |
| 153 | u8 descriptor_type; |
| 154 | u8 information; |
| 155 | u16 address_min; |
| 156 | u16 address_max; |
| 157 | u8 alignment; |
| 158 | u8 length; |
| 159 | }; |
| 160 | |
| 161 | |
| 162 | struct asl_fixed_io_port_desc |
| 163 | { |
| 164 | u8 descriptor_type; |
| 165 | u16 base_address; |
| 166 | u8 length; |
| 167 | }; |
| 168 | |
| 169 | |
| 170 | struct asl_small_vendor_desc |
| 171 | { |
| 172 | u8 descriptor_type; |
| 173 | u8 vendor_defined[7]; |
| 174 | }; |
| 175 | |
| 176 | |
| 177 | struct asl_end_tag_desc |
| 178 | { |
| 179 | u8 descriptor_type; |
| 180 | u8 checksum; |
| 181 | }; |
| 182 | |
| 183 | |
| 184 | /* LARGE descriptors */ |
| 185 | |
| 186 | struct asl_memory_24_desc |
| 187 | { |
| 188 | u8 descriptor_type; |
| 189 | u16 length; |
| 190 | u8 information; |
| 191 | u16 address_min; |
| 192 | u16 address_max; |
| 193 | u16 alignment; |
| 194 | u16 range_length; |
| 195 | }; |
| 196 | |
| 197 | |
| 198 | struct asl_large_vendor_desc |
| 199 | { |
| 200 | u8 descriptor_type; |
| 201 | u16 length; |
| 202 | u8 vendor_defined[1]; |
| 203 | }; |
| 204 | |
| 205 | |
| 206 | struct asl_memory_32_desc |
| 207 | { |
| 208 | u8 descriptor_type; |
| 209 | u16 length; |
| 210 | u8 information; |
| 211 | u32 address_min; |
| 212 | u32 address_max; |
| 213 | u32 alignment; |
| 214 | u32 range_length; |
| 215 | }; |
| 216 | |
| 217 | |
| 218 | struct asl_fixed_memory_32_desc |
| 219 | { |
| 220 | u8 descriptor_type; |
| 221 | u16 length; |
| 222 | u8 information; |
| 223 | u32 base_address; |
| 224 | u32 range_length; |
| 225 | }; |
| 226 | |
| 227 | |
| 228 | struct asl_extended_address_desc |
| 229 | { |
| 230 | u8 descriptor_type; |
| 231 | u16 length; |
| 232 | u8 resource_type; |
| 233 | u8 flags; |
| 234 | u8 specific_flags; |
| 235 | u8 revision_iD; |
| 236 | u8 reserved; |
| 237 | u64 granularity; |
| 238 | u64 address_min; |
| 239 | u64 address_max; |
| 240 | u64 translation_offset; |
| 241 | u64 address_length; |
| 242 | u64 type_specific_attributes; |
| 243 | u8 optional_fields[2]; /* Used for length calculation only */ |
| 244 | }; |
| 245 | |
| 246 | #define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ |
| 247 | |
| 248 | |
| 249 | struct asl_qword_address_desc |
| 250 | { |
| 251 | u8 descriptor_type; |
| 252 | u16 length; |
| 253 | u8 resource_type; |
| 254 | u8 flags; |
| 255 | u8 specific_flags; |
| 256 | u64 granularity; |
| 257 | u64 address_min; |
| 258 | u64 address_max; |
| 259 | u64 translation_offset; |
| 260 | u64 address_length; |
| 261 | u8 optional_fields[2]; |
| 262 | }; |
| 263 | |
| 264 | |
| 265 | struct asl_dword_address_desc |
| 266 | { |
| 267 | u8 descriptor_type; |
| 268 | u16 length; |
| 269 | u8 resource_type; |
| 270 | u8 flags; |
| 271 | u8 specific_flags; |
| 272 | u32 granularity; |
| 273 | u32 address_min; |
| 274 | u32 address_max; |
| 275 | u32 translation_offset; |
| 276 | u32 address_length; |
| 277 | u8 optional_fields[2]; |
| 278 | }; |
| 279 | |
| 280 | |
| 281 | struct asl_word_address_desc |
| 282 | { |
| 283 | u8 descriptor_type; |
| 284 | u16 length; |
| 285 | u8 resource_type; |
| 286 | u8 flags; |
| 287 | u8 specific_flags; |
| 288 | u16 granularity; |
| 289 | u16 address_min; |
| 290 | u16 address_max; |
| 291 | u16 translation_offset; |
| 292 | u16 address_length; |
| 293 | u8 optional_fields[2]; |
| 294 | }; |
| 295 | |
| 296 | |
| 297 | struct asl_extended_xrupt_desc |
| 298 | { |
| 299 | u8 descriptor_type; |
| 300 | u16 length; |
| 301 | u8 flags; |
| 302 | u8 table_length; |
| 303 | u32 interrupt_number[1]; |
| 304 | /* res_source_index, res_source optional fields follow */ |
| 305 | }; |
| 306 | |
| 307 | |
| 308 | struct asl_general_register_desc |
| 309 | { |
| 310 | u8 descriptor_type; |
| 311 | u16 length; |
| 312 | u8 address_space_id; |
| 313 | u8 bit_width; |
| 314 | u8 bit_offset; |
| 315 | u8 access_size; /* ACPI 3.0, was Reserved */ |
| 316 | u64 address; |
| 317 | }; |
| 318 | |
| 319 | /* restore default alignment */ |
| 320 | |
| 321 | #pragma pack() |
| 322 | |
| 323 | /* Union of all resource descriptors, so we can allocate the worst case */ |
| 324 | |
| 325 | union asl_resource_desc |
| 326 | { |
| 327 | struct asl_irq_format_desc irq; |
| 328 | struct asl_dma_format_desc dma; |
| 329 | struct asl_start_dependent_desc std; |
| 330 | struct asl_end_dependent_desc end; |
| 331 | struct asl_io_port_desc iop; |
| 332 | struct asl_fixed_io_port_desc fio; |
| 333 | struct asl_small_vendor_desc smv; |
| 334 | struct asl_end_tag_desc et; |
| 335 | |
| 336 | struct asl_memory_24_desc M24; |
| 337 | struct asl_large_vendor_desc lgv; |
| 338 | struct asl_memory_32_desc M32; |
| 339 | struct asl_fixed_memory_32_desc F32; |
| 340 | struct asl_qword_address_desc qas; |
| 341 | struct asl_dword_address_desc das; |
| 342 | struct asl_word_address_desc was; |
| 343 | struct asl_extended_address_desc eas; |
| 344 | struct asl_extended_xrupt_desc exx; |
| 345 | struct asl_general_register_desc grg; |
| 346 | u32 u32_item; |
| 347 | u16 u16_item; |
| 348 | u8 U8item; |
| 349 | }; |
| 350 | |
| 351 | |
| 352 | #endif |
| 353 | |