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