blob: 64736860bdd50a9093540397568eddbaa5f5e51a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
2/******************************************************************************
3 *
4 * Module Name: amlresrc.h - AML resource descriptors
5 *
6 *****************************************************************************/
7
8/*
Bob Moore4a90c7e2006-01-13 16:22:00 -05009 * Copyright (C) 2000 - 2006, R. Byron Moore
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * 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 Moore61686122006-03-17 16:44:00 -050045/* acpisrc:struct_defs -- for acpisrc conversion */
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#ifndef __AMLRESRC_H
48#define __AMLRESRC_H
49
Bob Moore61686122006-03-17 16:44:00 -050050/*! [Begin] no source code translation */
51
52/*
53 * Resource descriptor tags, as defined in the ACPI specification.
54 * Used to symbolically reference fields within a descriptor.
55 */
Bob Moore83135242006-10-03 00:00:00 -040056#define ACPI_RESTAG_ADDRESS "_ADR"
57#define ACPI_RESTAG_ALIGNMENT "_ALN"
58#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
59#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
60#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
61#define ACPI_RESTAG_BASEADDRESS "_BAS"
62#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
63#define ACPI_RESTAG_DECODE "_DEC"
64#define ACPI_RESTAG_DMA "_DMA"
65#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
66#define ACPI_RESTAG_GRANULARITY "_GRA"
67#define ACPI_RESTAG_INTERRUPT "_INT"
Bob Moore61686122006-03-17 16:44:00 -050068#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
69#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
Bob Moore83135242006-10-03 00:00:00 -040070#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
71#define ACPI_RESTAG_LENGTH "_LEN"
72#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
Bob Moore61686122006-03-17 16:44:00 -050073#define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
Bob Moore83135242006-10-03 00:00:00 -040074#define ACPI_RESTAG_MAXADDR "_MAX"
75#define ACPI_RESTAG_MINADDR "_MIN"
76#define ACPI_RESTAG_MAXTYPE "_MAF"
77#define ACPI_RESTAG_MINTYPE "_MIF"
78#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
79#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
80#define ACPI_RESTAG_RANGETYPE "_RNG"
Bob Moore61686122006-03-17 16:44:00 -050081#define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
Bob Moore83135242006-10-03 00:00:00 -040082#define ACPI_RESTAG_TRANSLATION "_TRA"
83#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
84#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
Bob Moore61686122006-03-17 16:44:00 -050085#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
86/*! [End] no source code translation !*/
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
88/* Default sizes for "small" resource descriptors */
89
90#define ASL_RDESC_IRQ_SIZE 0x02
91#define ASL_RDESC_DMA_SIZE 0x02
92#define ASL_RDESC_ST_DEPEND_SIZE 0x00
93#define ASL_RDESC_END_DEPEND_SIZE 0x00
94#define ASL_RDESC_IO_SIZE 0x07
95#define ASL_RDESC_FIXED_IO_SIZE 0x03
96#define ASL_RDESC_END_TAG_SIZE 0x01
97
Len Brown4be44fc2005-08-05 00:44:28 -040098struct asl_resource_node {
99 u32 buffer_length;
100 void *buffer;
101 struct asl_resource_node *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102};
103
Bob Moore96db2552005-11-02 00:00:00 -0500104/* Macros used to generate AML resource length fields */
105
106#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header))
107#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header))
108
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109/*
110 * Resource descriptors defined in the ACPI specification.
111 *
112 * Packing/alignment must be BYTE because these descriptors
Bob Moore50eca3e2005-09-30 19:03:00 -0400113 * are used to overlay the raw AML byte stream.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 */
115#pragma pack(1)
116
Bob Moore50eca3e2005-09-30 19:03:00 -0400117/*
118 * SMALL descriptors
119 */
120#define AML_RESOURCE_SMALL_HEADER_COMMON \
Bob Moore61686122006-03-17 16:44:00 -0500121 u8 descriptor_type;
Bob Moore50eca3e2005-09-30 19:03:00 -0400122
123struct aml_resource_small_header {
124AML_RESOURCE_SMALL_HEADER_COMMON};
125
126struct aml_resource_irq {
127 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
Len Brown4be44fc2005-08-05 00:44:28 -0400128 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129};
130
Bob Moore50eca3e2005-09-30 19:03:00 -0400131struct aml_resource_irq_noflags {
132 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133};
134
Bob Moore50eca3e2005-09-30 19:03:00 -0400135struct aml_resource_dma {
136 AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
Len Brown4be44fc2005-08-05 00:44:28 -0400137 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138};
139
Bob Moore50eca3e2005-09-30 19:03:00 -0400140struct aml_resource_start_dependent {
141 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142};
143
Bob Moore50eca3e2005-09-30 19:03:00 -0400144struct aml_resource_start_dependent_noprio {
145AML_RESOURCE_SMALL_HEADER_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Bob Moore50eca3e2005-09-30 19:03:00 -0400147struct aml_resource_end_dependent {
148AML_RESOURCE_SMALL_HEADER_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
Bob Moore50eca3e2005-09-30 19:03:00 -0400150struct aml_resource_io {
Bob Moore08978312005-10-21 00:00:00 -0400151 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
Bob Moore50eca3e2005-09-30 19:03:00 -0400152 u16 minimum;
153 u16 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400154 u8 alignment;
Bob Moore50eca3e2005-09-30 19:03:00 -0400155 u8 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156};
157
Bob Moore50eca3e2005-09-30 19:03:00 -0400158struct aml_resource_fixed_io {
159 AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
160 u8 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161};
162
Bob Moore50eca3e2005-09-30 19:03:00 -0400163struct aml_resource_vendor_small {
164AML_RESOURCE_SMALL_HEADER_COMMON};
165
166struct aml_resource_end_tag {
167 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168};
169
Bob Moore50eca3e2005-09-30 19:03:00 -0400170/*
171 * LARGE descriptors
172 */
173#define AML_RESOURCE_LARGE_HEADER_COMMON \
Bob Moore61686122006-03-17 16:44:00 -0500174 u8 descriptor_type;\
175 u16 resource_length;
Robert Moorebda663d2005-09-16 16:51:15 -0400176
Bob Moore50eca3e2005-09-30 19:03:00 -0400177struct aml_resource_large_header {
178AML_RESOURCE_LARGE_HEADER_COMMON};
Robert Moorebda663d2005-09-16 16:51:15 -0400179
Bob Moore50eca3e2005-09-30 19:03:00 -0400180struct aml_resource_memory24 {
Bob Moore08978312005-10-21 00:00:00 -0400181 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
Bob Moore50eca3e2005-09-30 19:03:00 -0400182 u16 minimum;
183 u16 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400184 u16 alignment;
Bob Moore50eca3e2005-09-30 19:03:00 -0400185 u16 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186};
187
Bob Moore50eca3e2005-09-30 19:03:00 -0400188struct aml_resource_vendor_large {
189AML_RESOURCE_LARGE_HEADER_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
Bob Moore50eca3e2005-09-30 19:03:00 -0400191struct aml_resource_memory32 {
Bob Moore08978312005-10-21 00:00:00 -0400192 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
Bob Moore50eca3e2005-09-30 19:03:00 -0400193 u32 minimum;
194 u32 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400195 u32 alignment;
Bob Moore50eca3e2005-09-30 19:03:00 -0400196 u32 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197};
198
Bob Moore50eca3e2005-09-30 19:03:00 -0400199struct aml_resource_fixed_memory32 {
Bob Moore08978312005-10-21 00:00:00 -0400200 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
Bob Moore50eca3e2005-09-30 19:03:00 -0400201 u32 address;
202 u32 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203};
204
Bob Moore50eca3e2005-09-30 19:03:00 -0400205#define AML_RESOURCE_ADDRESS_COMMON \
Bob Moore61686122006-03-17 16:44:00 -0500206 u8 resource_type; \
207 u8 flags; \
208 u8 specific_flags;
Bob Moore50eca3e2005-09-30 19:03:00 -0400209
210struct aml_resource_address {
211AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
212
213struct aml_resource_extended_address64 {
214 AML_RESOURCE_LARGE_HEADER_COMMON
215 AML_RESOURCE_ADDRESS_COMMON u8 revision_iD;
Len Brown4be44fc2005-08-05 00:44:28 -0400216 u8 reserved;
217 u64 granularity;
Bob Moore50eca3e2005-09-30 19:03:00 -0400218 u64 minimum;
219 u64 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400220 u64 translation_offset;
221 u64 address_length;
Bob Moore08978312005-10-21 00:00:00 -0400222 u64 type_specific;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223};
224
Bob Moore50eca3e2005-09-30 19:03:00 -0400225#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226
Bob Moore50eca3e2005-09-30 19:03:00 -0400227struct aml_resource_address64 {
228 AML_RESOURCE_LARGE_HEADER_COMMON
229 AML_RESOURCE_ADDRESS_COMMON u64 granularity;
230 u64 minimum;
231 u64 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400232 u64 translation_offset;
233 u64 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234};
235
Bob Moore50eca3e2005-09-30 19:03:00 -0400236struct aml_resource_address32 {
237 AML_RESOURCE_LARGE_HEADER_COMMON
238 AML_RESOURCE_ADDRESS_COMMON u32 granularity;
239 u32 minimum;
240 u32 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400241 u32 translation_offset;
242 u32 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243};
244
Bob Moore50eca3e2005-09-30 19:03:00 -0400245struct aml_resource_address16 {
246 AML_RESOURCE_LARGE_HEADER_COMMON
247 AML_RESOURCE_ADDRESS_COMMON u16 granularity;
248 u16 minimum;
249 u16 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400250 u16 translation_offset;
251 u16 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252};
253
Bob Moore50eca3e2005-09-30 19:03:00 -0400254struct aml_resource_extended_irq {
255 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
Bob Moore08978312005-10-21 00:00:00 -0400256 u8 interrupt_count;
257 u32 interrupts[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 /* res_source_index, res_source optional fields follow */
259};
260
Bob Moore50eca3e2005-09-30 19:03:00 -0400261struct aml_resource_generic_register {
262 AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
Len Brown4be44fc2005-08-05 00:44:28 -0400263 u8 bit_width;
264 u8 bit_offset;
Bob Moore50eca3e2005-09-30 19:03:00 -0400265 u8 access_size; /* ACPI 3.0, was previously Reserved */
Len Brown4be44fc2005-08-05 00:44:28 -0400266 u64 address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267};
268
269/* restore default alignment */
270
271#pragma pack()
272
273/* Union of all resource descriptors, so we can allocate the worst case */
274
Bob Moore50eca3e2005-09-30 19:03:00 -0400275union aml_resource {
276 /* Descriptor headers */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277
Bob Moore83135242006-10-03 00:00:00 -0400278 u8 descriptor_type;
Bob Moore50eca3e2005-09-30 19:03:00 -0400279 struct aml_resource_small_header small_header;
280 struct aml_resource_large_header large_header;
281
282 /* Small resource descriptors */
283
284 struct aml_resource_irq irq;
285 struct aml_resource_dma dma;
286 struct aml_resource_start_dependent start_dpf;
287 struct aml_resource_end_dependent end_dpf;
288 struct aml_resource_io io;
289 struct aml_resource_fixed_io fixed_io;
290 struct aml_resource_vendor_small vendor_small;
291 struct aml_resource_end_tag end_tag;
292
293 /* Large resource descriptors */
294
295 struct aml_resource_memory24 memory24;
296 struct aml_resource_generic_register generic_reg;
297 struct aml_resource_vendor_large vendor_large;
298 struct aml_resource_memory32 memory32;
299 struct aml_resource_fixed_memory32 fixed_memory32;
300 struct aml_resource_address16 address16;
301 struct aml_resource_address32 address32;
302 struct aml_resource_address64 address64;
303 struct aml_resource_extended_address64 ext_address64;
304 struct aml_resource_extended_irq extended_irq;
305
306 /* Utility overlays */
307
308 struct aml_resource_address address;
Len Brown4be44fc2005-08-05 00:44:28 -0400309 u32 u32_item;
310 u16 u16_item;
311 u8 U8item;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312};
313
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314#endif