amlresrc.h revision 1.1.1.3 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: amlresrc.h - AML resource descriptors
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1.1.2 jruoho /*
8 1.1.1.3 christos * Copyright (C) 2000 - 2013, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2 jruoho * are met:
14 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2 jruoho * without modification.
17 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2 jruoho * binary redistribution.
22 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2 jruoho *
26 1.1.1.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2 jruoho * Software Foundation.
29 1.1.1.2 jruoho *
30 1.1.1.2 jruoho * NO WARRANTY
31 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2 jruoho */
43 1.1 jruoho
44 1.1 jruoho /* acpisrc:StructDefs -- for acpisrc conversion */
45 1.1 jruoho
46 1.1 jruoho #ifndef __AMLRESRC_H
47 1.1 jruoho #define __AMLRESRC_H
48 1.1 jruoho
49 1.1 jruoho
50 1.1 jruoho /*
51 1.1 jruoho * Resource descriptor tags, as defined in the ACPI specification.
52 1.1 jruoho * Used to symbolically reference fields within a descriptor.
53 1.1 jruoho */
54 1.1 jruoho #define ACPI_RESTAG_ADDRESS "_ADR"
55 1.1 jruoho #define ACPI_RESTAG_ALIGNMENT "_ALN"
56 1.1 jruoho #define ACPI_RESTAG_ADDRESSSPACE "_ASI"
57 1.1 jruoho #define ACPI_RESTAG_ACCESSSIZE "_ASZ"
58 1.1 jruoho #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
59 1.1 jruoho #define ACPI_RESTAG_BASEADDRESS "_BAS"
60 1.1 jruoho #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
61 1.1.1.3 christos #define ACPI_RESTAG_DEBOUNCETIME "_DBT"
62 1.1 jruoho #define ACPI_RESTAG_DECODE "_DEC"
63 1.1.1.3 christos #define ACPI_RESTAG_DEVICEPOLARITY "_DPL"
64 1.1 jruoho #define ACPI_RESTAG_DMA "_DMA"
65 1.1 jruoho #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
66 1.1.1.3 christos #define ACPI_RESTAG_DRIVESTRENGTH "_DRS"
67 1.1.1.3 christos #define ACPI_RESTAG_ENDIANNESS "_END"
68 1.1.1.3 christos #define ACPI_RESTAG_FLOWCONTROL "_FLC"
69 1.1 jruoho #define ACPI_RESTAG_GRANULARITY "_GRA"
70 1.1 jruoho #define ACPI_RESTAG_INTERRUPT "_INT"
71 1.1 jruoho #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
72 1.1 jruoho #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
73 1.1 jruoho #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
74 1.1.1.3 christos #define ACPI_RESTAG_IORESTRICTION "_IOR"
75 1.1 jruoho #define ACPI_RESTAG_LENGTH "_LEN"
76 1.1.1.3 christos #define ACPI_RESTAG_LINE "_LIN"
77 1.1 jruoho #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
78 1.1 jruoho #define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
79 1.1 jruoho #define ACPI_RESTAG_MAXADDR "_MAX"
80 1.1 jruoho #define ACPI_RESTAG_MINADDR "_MIN"
81 1.1 jruoho #define ACPI_RESTAG_MAXTYPE "_MAF"
82 1.1 jruoho #define ACPI_RESTAG_MINTYPE "_MIF"
83 1.1.1.3 christos #define ACPI_RESTAG_MODE "_MOD"
84 1.1.1.3 christos #define ACPI_RESTAG_PARITY "_PAR"
85 1.1.1.3 christos #define ACPI_RESTAG_PHASE "_PHA"
86 1.1.1.3 christos #define ACPI_RESTAG_PIN "_PIN"
87 1.1.1.3 christos #define ACPI_RESTAG_PINCONFIG "_PPI"
88 1.1.1.3 christos #define ACPI_RESTAG_POLARITY "_POL"
89 1.1 jruoho #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
90 1.1 jruoho #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
91 1.1 jruoho #define ACPI_RESTAG_RANGETYPE "_RNG"
92 1.1 jruoho #define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
93 1.1.1.3 christos #define ACPI_RESTAG_LENGTH_RX "_RXL"
94 1.1.1.3 christos #define ACPI_RESTAG_LENGTH_TX "_TXL"
95 1.1.1.3 christos #define ACPI_RESTAG_SLAVEMODE "_SLV"
96 1.1.1.3 christos #define ACPI_RESTAG_SPEED "_SPE"
97 1.1.1.3 christos #define ACPI_RESTAG_STOPBITS "_STB"
98 1.1 jruoho #define ACPI_RESTAG_TRANSLATION "_TRA"
99 1.1 jruoho #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
100 1.1 jruoho #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
101 1.1 jruoho #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
102 1.1.1.3 christos #define ACPI_RESTAG_VENDORDATA "_VEN"
103 1.1 jruoho
104 1.1 jruoho
105 1.1 jruoho /* Default sizes for "small" resource descriptors */
106 1.1 jruoho
107 1.1 jruoho #define ASL_RDESC_IRQ_SIZE 0x02
108 1.1 jruoho #define ASL_RDESC_DMA_SIZE 0x02
109 1.1 jruoho #define ASL_RDESC_ST_DEPEND_SIZE 0x00
110 1.1 jruoho #define ASL_RDESC_END_DEPEND_SIZE 0x00
111 1.1 jruoho #define ASL_RDESC_IO_SIZE 0x07
112 1.1 jruoho #define ASL_RDESC_FIXED_IO_SIZE 0x03
113 1.1.1.3 christos #define ASL_RDESC_FIXED_DMA_SIZE 0x05
114 1.1 jruoho #define ASL_RDESC_END_TAG_SIZE 0x01
115 1.1 jruoho
116 1.1 jruoho
117 1.1 jruoho typedef struct asl_resource_node
118 1.1 jruoho {
119 1.1 jruoho UINT32 BufferLength;
120 1.1 jruoho void *Buffer;
121 1.1 jruoho struct asl_resource_node *Next;
122 1.1 jruoho
123 1.1 jruoho } ASL_RESOURCE_NODE;
124 1.1 jruoho
125 1.1 jruoho
126 1.1 jruoho /* Macros used to generate AML resource length fields */
127 1.1 jruoho
128 1.1 jruoho #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
129 1.1 jruoho #define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
130 1.1 jruoho
131 1.1 jruoho /*
132 1.1 jruoho * Resource descriptors defined in the ACPI specification.
133 1.1 jruoho *
134 1.1 jruoho * Packing/alignment must be BYTE because these descriptors
135 1.1 jruoho * are used to overlay the raw AML byte stream.
136 1.1 jruoho */
137 1.1 jruoho #pragma pack(1)
138 1.1 jruoho
139 1.1 jruoho /*
140 1.1 jruoho * SMALL descriptors
141 1.1 jruoho */
142 1.1 jruoho #define AML_RESOURCE_SMALL_HEADER_COMMON \
143 1.1 jruoho UINT8 DescriptorType;
144 1.1 jruoho
145 1.1 jruoho typedef struct aml_resource_small_header
146 1.1 jruoho {
147 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
148 1.1 jruoho
149 1.1 jruoho } AML_RESOURCE_SMALL_HEADER;
150 1.1 jruoho
151 1.1 jruoho
152 1.1 jruoho typedef struct aml_resource_irq
153 1.1 jruoho {
154 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
155 1.1 jruoho UINT16 IrqMask;
156 1.1 jruoho UINT8 Flags;
157 1.1 jruoho
158 1.1 jruoho } AML_RESOURCE_IRQ;
159 1.1 jruoho
160 1.1 jruoho
161 1.1 jruoho typedef struct aml_resource_irq_noflags
162 1.1 jruoho {
163 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
164 1.1 jruoho UINT16 IrqMask;
165 1.1 jruoho
166 1.1 jruoho } AML_RESOURCE_IRQ_NOFLAGS;
167 1.1 jruoho
168 1.1 jruoho
169 1.1 jruoho typedef struct aml_resource_dma
170 1.1 jruoho {
171 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
172 1.1 jruoho UINT8 DmaChannelMask;
173 1.1 jruoho UINT8 Flags;
174 1.1 jruoho
175 1.1 jruoho } AML_RESOURCE_DMA;
176 1.1 jruoho
177 1.1 jruoho
178 1.1 jruoho typedef struct aml_resource_start_dependent
179 1.1 jruoho {
180 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
181 1.1 jruoho UINT8 Flags;
182 1.1 jruoho
183 1.1 jruoho } AML_RESOURCE_START_DEPENDENT;
184 1.1 jruoho
185 1.1 jruoho
186 1.1 jruoho typedef struct aml_resource_start_dependent_noprio
187 1.1 jruoho {
188 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
189 1.1 jruoho
190 1.1 jruoho } AML_RESOURCE_START_DEPENDENT_NOPRIO;
191 1.1 jruoho
192 1.1 jruoho
193 1.1 jruoho typedef struct aml_resource_end_dependent
194 1.1 jruoho {
195 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
196 1.1 jruoho
197 1.1 jruoho } AML_RESOURCE_END_DEPENDENT;
198 1.1 jruoho
199 1.1 jruoho
200 1.1 jruoho typedef struct aml_resource_io
201 1.1 jruoho {
202 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
203 1.1 jruoho UINT8 Flags;
204 1.1 jruoho UINT16 Minimum;
205 1.1 jruoho UINT16 Maximum;
206 1.1 jruoho UINT8 Alignment;
207 1.1 jruoho UINT8 AddressLength;
208 1.1 jruoho
209 1.1 jruoho } AML_RESOURCE_IO;
210 1.1 jruoho
211 1.1 jruoho
212 1.1 jruoho typedef struct aml_resource_fixed_io
213 1.1 jruoho {
214 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
215 1.1 jruoho UINT16 Address;
216 1.1 jruoho UINT8 AddressLength;
217 1.1 jruoho
218 1.1 jruoho } AML_RESOURCE_FIXED_IO;
219 1.1 jruoho
220 1.1 jruoho
221 1.1 jruoho typedef struct aml_resource_vendor_small
222 1.1 jruoho {
223 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
224 1.1 jruoho
225 1.1 jruoho } AML_RESOURCE_VENDOR_SMALL;
226 1.1 jruoho
227 1.1 jruoho
228 1.1 jruoho typedef struct aml_resource_end_tag
229 1.1 jruoho {
230 1.1 jruoho AML_RESOURCE_SMALL_HEADER_COMMON
231 1.1 jruoho UINT8 Checksum;
232 1.1 jruoho
233 1.1 jruoho } AML_RESOURCE_END_TAG;
234 1.1 jruoho
235 1.1 jruoho
236 1.1.1.3 christos typedef struct aml_resource_fixed_dma
237 1.1.1.3 christos {
238 1.1.1.3 christos AML_RESOURCE_SMALL_HEADER_COMMON
239 1.1.1.3 christos UINT16 RequestLines;
240 1.1.1.3 christos UINT16 Channels;
241 1.1.1.3 christos UINT8 Width;
242 1.1.1.3 christos
243 1.1.1.3 christos } AML_RESOURCE_FIXED_DMA;
244 1.1.1.3 christos
245 1.1.1.3 christos
246 1.1 jruoho /*
247 1.1 jruoho * LARGE descriptors
248 1.1 jruoho */
249 1.1 jruoho #define AML_RESOURCE_LARGE_HEADER_COMMON \
250 1.1 jruoho UINT8 DescriptorType;\
251 1.1 jruoho UINT16 ResourceLength;
252 1.1 jruoho
253 1.1 jruoho typedef struct aml_resource_large_header
254 1.1 jruoho {
255 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
256 1.1 jruoho
257 1.1 jruoho } AML_RESOURCE_LARGE_HEADER;
258 1.1 jruoho
259 1.1 jruoho
260 1.1 jruoho /* General Flags for address space resource descriptors */
261 1.1 jruoho
262 1.1 jruoho #define ACPI_RESOURCE_FLAG_DEC 2
263 1.1 jruoho #define ACPI_RESOURCE_FLAG_MIF 4
264 1.1 jruoho #define ACPI_RESOURCE_FLAG_MAF 8
265 1.1 jruoho
266 1.1 jruoho typedef struct aml_resource_memory24
267 1.1 jruoho {
268 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
269 1.1 jruoho UINT8 Flags;
270 1.1 jruoho UINT16 Minimum;
271 1.1 jruoho UINT16 Maximum;
272 1.1 jruoho UINT16 Alignment;
273 1.1 jruoho UINT16 AddressLength;
274 1.1 jruoho
275 1.1 jruoho } AML_RESOURCE_MEMORY24;
276 1.1 jruoho
277 1.1 jruoho
278 1.1 jruoho typedef struct aml_resource_vendor_large
279 1.1 jruoho {
280 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
281 1.1 jruoho
282 1.1 jruoho } AML_RESOURCE_VENDOR_LARGE;
283 1.1 jruoho
284 1.1 jruoho
285 1.1 jruoho typedef struct aml_resource_memory32
286 1.1 jruoho {
287 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
288 1.1 jruoho UINT8 Flags;
289 1.1 jruoho UINT32 Minimum;
290 1.1 jruoho UINT32 Maximum;
291 1.1 jruoho UINT32 Alignment;
292 1.1 jruoho UINT32 AddressLength;
293 1.1 jruoho
294 1.1 jruoho } AML_RESOURCE_MEMORY32;
295 1.1 jruoho
296 1.1 jruoho
297 1.1 jruoho typedef struct aml_resource_fixed_memory32
298 1.1 jruoho {
299 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
300 1.1 jruoho UINT8 Flags;
301 1.1 jruoho UINT32 Address;
302 1.1 jruoho UINT32 AddressLength;
303 1.1 jruoho
304 1.1 jruoho } AML_RESOURCE_FIXED_MEMORY32;
305 1.1 jruoho
306 1.1 jruoho
307 1.1 jruoho #define AML_RESOURCE_ADDRESS_COMMON \
308 1.1 jruoho UINT8 ResourceType; \
309 1.1 jruoho UINT8 Flags; \
310 1.1 jruoho UINT8 SpecificFlags;
311 1.1 jruoho
312 1.1 jruoho
313 1.1 jruoho typedef struct aml_resource_address
314 1.1 jruoho {
315 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
316 1.1 jruoho AML_RESOURCE_ADDRESS_COMMON
317 1.1 jruoho
318 1.1 jruoho } AML_RESOURCE_ADDRESS;
319 1.1 jruoho
320 1.1 jruoho
321 1.1 jruoho typedef struct aml_resource_extended_address64
322 1.1 jruoho {
323 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
324 1.1 jruoho AML_RESOURCE_ADDRESS_COMMON
325 1.1 jruoho UINT8 RevisionID;
326 1.1 jruoho UINT8 Reserved;
327 1.1 jruoho UINT64 Granularity;
328 1.1 jruoho UINT64 Minimum;
329 1.1 jruoho UINT64 Maximum;
330 1.1 jruoho UINT64 TranslationOffset;
331 1.1 jruoho UINT64 AddressLength;
332 1.1 jruoho UINT64 TypeSpecific;
333 1.1 jruoho
334 1.1 jruoho } AML_RESOURCE_EXTENDED_ADDRESS64;
335 1.1 jruoho
336 1.1 jruoho #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
337 1.1 jruoho
338 1.1 jruoho
339 1.1 jruoho typedef struct aml_resource_address64
340 1.1 jruoho {
341 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
342 1.1 jruoho AML_RESOURCE_ADDRESS_COMMON
343 1.1 jruoho UINT64 Granularity;
344 1.1 jruoho UINT64 Minimum;
345 1.1 jruoho UINT64 Maximum;
346 1.1 jruoho UINT64 TranslationOffset;
347 1.1 jruoho UINT64 AddressLength;
348 1.1 jruoho
349 1.1 jruoho } AML_RESOURCE_ADDRESS64;
350 1.1 jruoho
351 1.1 jruoho
352 1.1 jruoho typedef struct aml_resource_address32
353 1.1 jruoho {
354 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
355 1.1 jruoho AML_RESOURCE_ADDRESS_COMMON
356 1.1 jruoho UINT32 Granularity;
357 1.1 jruoho UINT32 Minimum;
358 1.1 jruoho UINT32 Maximum;
359 1.1 jruoho UINT32 TranslationOffset;
360 1.1 jruoho UINT32 AddressLength;
361 1.1 jruoho
362 1.1 jruoho } AML_RESOURCE_ADDRESS32;
363 1.1 jruoho
364 1.1 jruoho
365 1.1 jruoho typedef struct aml_resource_address16
366 1.1 jruoho {
367 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
368 1.1 jruoho AML_RESOURCE_ADDRESS_COMMON
369 1.1 jruoho UINT16 Granularity;
370 1.1 jruoho UINT16 Minimum;
371 1.1 jruoho UINT16 Maximum;
372 1.1 jruoho UINT16 TranslationOffset;
373 1.1 jruoho UINT16 AddressLength;
374 1.1 jruoho
375 1.1 jruoho } AML_RESOURCE_ADDRESS16;
376 1.1 jruoho
377 1.1 jruoho
378 1.1 jruoho typedef struct aml_resource_extended_irq
379 1.1 jruoho {
380 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
381 1.1 jruoho UINT8 Flags;
382 1.1 jruoho UINT8 InterruptCount;
383 1.1 jruoho UINT32 Interrupts[1];
384 1.1 jruoho /* ResSourceIndex, ResSource optional fields follow */
385 1.1 jruoho
386 1.1 jruoho } AML_RESOURCE_EXTENDED_IRQ;
387 1.1 jruoho
388 1.1 jruoho
389 1.1 jruoho typedef struct aml_resource_generic_register
390 1.1 jruoho {
391 1.1 jruoho AML_RESOURCE_LARGE_HEADER_COMMON
392 1.1 jruoho UINT8 AddressSpaceId;
393 1.1 jruoho UINT8 BitWidth;
394 1.1 jruoho UINT8 BitOffset;
395 1.1 jruoho UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */
396 1.1 jruoho UINT64 Address;
397 1.1 jruoho
398 1.1 jruoho } AML_RESOURCE_GENERIC_REGISTER;
399 1.1 jruoho
400 1.1.1.3 christos
401 1.1.1.3 christos /* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
402 1.1.1.3 christos
403 1.1.1.3 christos typedef struct aml_resource_gpio
404 1.1.1.3 christos {
405 1.1.1.3 christos AML_RESOURCE_LARGE_HEADER_COMMON
406 1.1.1.3 christos UINT8 RevisionId;
407 1.1.1.3 christos UINT8 ConnectionType;
408 1.1.1.3 christos UINT16 Flags;
409 1.1.1.3 christos UINT16 IntFlags;
410 1.1.1.3 christos UINT8 PinConfig;
411 1.1.1.3 christos UINT16 DriveStrength;
412 1.1.1.3 christos UINT16 DebounceTimeout;
413 1.1.1.3 christos UINT16 PinTableOffset;
414 1.1.1.3 christos UINT8 ResSourceIndex;
415 1.1.1.3 christos UINT16 ResSourceOffset;
416 1.1.1.3 christos UINT16 VendorOffset;
417 1.1.1.3 christos UINT16 VendorLength;
418 1.1.1.3 christos /*
419 1.1.1.3 christos * Optional fields follow immediately:
420 1.1.1.3 christos * 1) PIN list (Words)
421 1.1.1.3 christos * 2) Resource Source String
422 1.1.1.3 christos * 3) Vendor Data bytes
423 1.1.1.3 christos */
424 1.1.1.3 christos
425 1.1.1.3 christos } AML_RESOURCE_GPIO;
426 1.1.1.3 christos
427 1.1.1.3 christos #define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */
428 1.1.1.3 christos
429 1.1.1.3 christos /* Values for ConnectionType above */
430 1.1.1.3 christos
431 1.1.1.3 christos #define AML_RESOURCE_GPIO_TYPE_INT 0
432 1.1.1.3 christos #define AML_RESOURCE_GPIO_TYPE_IO 1
433 1.1.1.3 christos #define AML_RESOURCE_MAX_GPIOTYPE 1
434 1.1.1.3 christos
435 1.1.1.3 christos
436 1.1.1.3 christos /* Common preamble for all serial descriptors (ACPI 5.0) */
437 1.1.1.3 christos
438 1.1.1.3 christos #define AML_RESOURCE_SERIAL_COMMON \
439 1.1.1.3 christos UINT8 RevisionId; \
440 1.1.1.3 christos UINT8 ResSourceIndex; \
441 1.1.1.3 christos UINT8 Type; \
442 1.1.1.3 christos UINT8 Flags; \
443 1.1.1.3 christos UINT16 TypeSpecificFlags; \
444 1.1.1.3 christos UINT8 TypeRevisionId; \
445 1.1.1.3 christos UINT16 TypeDataLength; \
446 1.1.1.3 christos
447 1.1.1.3 christos /* Values for the type field above */
448 1.1.1.3 christos
449 1.1.1.3 christos #define AML_RESOURCE_I2C_SERIALBUSTYPE 1
450 1.1.1.3 christos #define AML_RESOURCE_SPI_SERIALBUSTYPE 2
451 1.1.1.3 christos #define AML_RESOURCE_UART_SERIALBUSTYPE 3
452 1.1.1.3 christos #define AML_RESOURCE_MAX_SERIALBUSTYPE 3
453 1.1.1.3 christos #define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
454 1.1.1.3 christos
455 1.1.1.3 christos typedef struct aml_resource_common_serialbus
456 1.1.1.3 christos {
457 1.1.1.3 christos AML_RESOURCE_LARGE_HEADER_COMMON
458 1.1.1.3 christos AML_RESOURCE_SERIAL_COMMON
459 1.1.1.3 christos
460 1.1.1.3 christos } AML_RESOURCE_COMMON_SERIALBUS;
461 1.1.1.3 christos
462 1.1.1.3 christos typedef struct aml_resource_i2c_serialbus
463 1.1.1.3 christos {
464 1.1.1.3 christos AML_RESOURCE_LARGE_HEADER_COMMON
465 1.1.1.3 christos AML_RESOURCE_SERIAL_COMMON
466 1.1.1.3 christos UINT32 ConnectionSpeed;
467 1.1.1.3 christos UINT16 SlaveAddress;
468 1.1.1.3 christos /*
469 1.1.1.3 christos * Optional fields follow immediately:
470 1.1.1.3 christos * 1) Vendor Data bytes
471 1.1.1.3 christos * 2) Resource Source String
472 1.1.1.3 christos */
473 1.1.1.3 christos
474 1.1.1.3 christos } AML_RESOURCE_I2C_SERIALBUS;
475 1.1.1.3 christos
476 1.1.1.3 christos #define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */
477 1.1.1.3 christos #define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */
478 1.1.1.3 christos #define AML_RESOURCE_I2C_MIN_DATA_LEN 6
479 1.1.1.3 christos
480 1.1.1.3 christos typedef struct aml_resource_spi_serialbus
481 1.1.1.3 christos {
482 1.1.1.3 christos AML_RESOURCE_LARGE_HEADER_COMMON
483 1.1.1.3 christos AML_RESOURCE_SERIAL_COMMON
484 1.1.1.3 christos UINT32 ConnectionSpeed;
485 1.1.1.3 christos UINT8 DataBitLength;
486 1.1.1.3 christos UINT8 ClockPhase;
487 1.1.1.3 christos UINT8 ClockPolarity;
488 1.1.1.3 christos UINT16 DeviceSelection;
489 1.1.1.3 christos /*
490 1.1.1.3 christos * Optional fields follow immediately:
491 1.1.1.3 christos * 1) Vendor Data bytes
492 1.1.1.3 christos * 2) Resource Source String
493 1.1.1.3 christos */
494 1.1.1.3 christos
495 1.1.1.3 christos } AML_RESOURCE_SPI_SERIALBUS;
496 1.1.1.3 christos
497 1.1.1.3 christos #define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */
498 1.1.1.3 christos #define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */
499 1.1.1.3 christos #define AML_RESOURCE_SPI_MIN_DATA_LEN 9
500 1.1.1.3 christos
501 1.1.1.3 christos
502 1.1.1.3 christos typedef struct aml_resource_uart_serialbus
503 1.1.1.3 christos {
504 1.1.1.3 christos AML_RESOURCE_LARGE_HEADER_COMMON
505 1.1.1.3 christos AML_RESOURCE_SERIAL_COMMON
506 1.1.1.3 christos UINT32 DefaultBaudRate;
507 1.1.1.3 christos UINT16 RxFifoSize;
508 1.1.1.3 christos UINT16 TxFifoSize;
509 1.1.1.3 christos UINT8 Parity;
510 1.1.1.3 christos UINT8 LinesEnabled;
511 1.1.1.3 christos /*
512 1.1.1.3 christos * Optional fields follow immediately:
513 1.1.1.3 christos * 1) Vendor Data bytes
514 1.1.1.3 christos * 2) Resource Source String
515 1.1.1.3 christos */
516 1.1.1.3 christos
517 1.1.1.3 christos } AML_RESOURCE_UART_SERIALBUS;
518 1.1.1.3 christos
519 1.1.1.3 christos #define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */
520 1.1.1.3 christos #define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */
521 1.1.1.3 christos #define AML_RESOURCE_UART_MIN_DATA_LEN 10
522 1.1.1.3 christos
523 1.1.1.3 christos
524 1.1 jruoho /* restore default alignment */
525 1.1 jruoho
526 1.1 jruoho #pragma pack()
527 1.1 jruoho
528 1.1 jruoho /* Union of all resource descriptors, so we can allocate the worst case */
529 1.1 jruoho
530 1.1 jruoho typedef union aml_resource
531 1.1 jruoho {
532 1.1 jruoho /* Descriptor headers */
533 1.1 jruoho
534 1.1 jruoho UINT8 DescriptorType;
535 1.1 jruoho AML_RESOURCE_SMALL_HEADER SmallHeader;
536 1.1 jruoho AML_RESOURCE_LARGE_HEADER LargeHeader;
537 1.1 jruoho
538 1.1 jruoho /* Small resource descriptors */
539 1.1 jruoho
540 1.1 jruoho AML_RESOURCE_IRQ Irq;
541 1.1 jruoho AML_RESOURCE_DMA Dma;
542 1.1 jruoho AML_RESOURCE_START_DEPENDENT StartDpf;
543 1.1 jruoho AML_RESOURCE_END_DEPENDENT EndDpf;
544 1.1 jruoho AML_RESOURCE_IO Io;
545 1.1 jruoho AML_RESOURCE_FIXED_IO FixedIo;
546 1.1.1.3 christos AML_RESOURCE_FIXED_DMA FixedDma;
547 1.1 jruoho AML_RESOURCE_VENDOR_SMALL VendorSmall;
548 1.1 jruoho AML_RESOURCE_END_TAG EndTag;
549 1.1 jruoho
550 1.1 jruoho /* Large resource descriptors */
551 1.1 jruoho
552 1.1 jruoho AML_RESOURCE_MEMORY24 Memory24;
553 1.1 jruoho AML_RESOURCE_GENERIC_REGISTER GenericReg;
554 1.1 jruoho AML_RESOURCE_VENDOR_LARGE VendorLarge;
555 1.1 jruoho AML_RESOURCE_MEMORY32 Memory32;
556 1.1 jruoho AML_RESOURCE_FIXED_MEMORY32 FixedMemory32;
557 1.1 jruoho AML_RESOURCE_ADDRESS16 Address16;
558 1.1 jruoho AML_RESOURCE_ADDRESS32 Address32;
559 1.1 jruoho AML_RESOURCE_ADDRESS64 Address64;
560 1.1 jruoho AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
561 1.1 jruoho AML_RESOURCE_EXTENDED_IRQ ExtendedIrq;
562 1.1.1.3 christos AML_RESOURCE_GPIO Gpio;
563 1.1.1.3 christos AML_RESOURCE_I2C_SERIALBUS I2cSerialBus;
564 1.1.1.3 christos AML_RESOURCE_SPI_SERIALBUS SpiSerialBus;
565 1.1.1.3 christos AML_RESOURCE_UART_SERIALBUS UartSerialBus;
566 1.1.1.3 christos AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
567 1.1 jruoho
568 1.1 jruoho /* Utility overlays */
569 1.1 jruoho
570 1.1 jruoho AML_RESOURCE_ADDRESS Address;
571 1.1 jruoho UINT32 DwordItem;
572 1.1 jruoho UINT16 WordItem;
573 1.1 jruoho UINT8 ByteItem;
574 1.1 jruoho
575 1.1 jruoho } AML_RESOURCE;
576 1.1 jruoho
577 1.1 jruoho #endif
578