blob: 103aff07db18fcec617dbdea48a5a71faa08c503 [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/*
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#ifndef __AMLRESRC_H
46#define __AMLRESRC_H
47
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#define ASL_RESNAME_ADDRESS "_ADR"
49#define ASL_RESNAME_ALIGNMENT "_ALN"
50#define ASL_RESNAME_ADDRESSSPACE "_ASI"
51#define ASL_RESNAME_ACCESSSIZE "_ASZ"
52#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT"
53#define ASL_RESNAME_BASEADDRESS "_BAS"
Len Brown4be44fc2005-08-05 00:44:28 -040054#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070055#define ASL_RESNAME_DECODE "_DEC"
56#define ASL_RESNAME_DMA "_DMA"
Len Brown4be44fc2005-08-05 00:44:28 -040057#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#define ASL_RESNAME_GRANULARITY "_GRA"
59#define ASL_RESNAME_INTERRUPT "_INT"
Len Brown4be44fc2005-08-05 00:44:28 -040060#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
61#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
62#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#define ASL_RESNAME_LENGTH "_LEN"
Len Brown4be44fc2005-08-05 00:44:28 -040064#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
65#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070066#define ASL_RESNAME_MAXADDR "_MAX"
67#define ASL_RESNAME_MINADDR "_MIN"
68#define ASL_RESNAME_MAXTYPE "_MAF"
69#define ASL_RESNAME_MINTYPE "_MIF"
70#define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
71#define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
72#define ASL_RESNAME_RANGETYPE "_RNG"
Len Brown4be44fc2005-08-05 00:44:28 -040073#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074#define ASL_RESNAME_TRANSLATION "_TRA"
Len Brown4be44fc2005-08-05 00:44:28 -040075#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
76#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
77#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
79/* Default sizes for "small" resource descriptors */
80
81#define ASL_RDESC_IRQ_SIZE 0x02
82#define ASL_RDESC_DMA_SIZE 0x02
83#define ASL_RDESC_ST_DEPEND_SIZE 0x00
84#define ASL_RDESC_END_DEPEND_SIZE 0x00
85#define ASL_RDESC_IO_SIZE 0x07
86#define ASL_RDESC_FIXED_IO_SIZE 0x03
87#define ASL_RDESC_END_TAG_SIZE 0x01
88
Len Brown4be44fc2005-08-05 00:44:28 -040089struct asl_resource_node {
90 u32 buffer_length;
91 void *buffer;
92 struct asl_resource_node *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -070093};
94
Linus Torvalds1da177e2005-04-16 15:20:36 -070095/*
96 * Resource descriptors defined in the ACPI specification.
97 *
98 * Packing/alignment must be BYTE because these descriptors
Bob Moore50eca3e2005-09-30 19:03:00 -040099 * are used to overlay the raw AML byte stream.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 */
101#pragma pack(1)
102
Bob Moore50eca3e2005-09-30 19:03:00 -0400103/*
104 * SMALL descriptors
105 */
106#define AML_RESOURCE_SMALL_HEADER_COMMON \
107 u8 descriptor_type;
108
109struct aml_resource_small_header {
110AML_RESOURCE_SMALL_HEADER_COMMON};
111
112struct aml_resource_irq {
113 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
Len Brown4be44fc2005-08-05 00:44:28 -0400114 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115};
116
Bob Moore50eca3e2005-09-30 19:03:00 -0400117struct aml_resource_irq_noflags {
118 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119};
120
Bob Moore50eca3e2005-09-30 19:03:00 -0400121struct aml_resource_dma {
122 AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
Len Brown4be44fc2005-08-05 00:44:28 -0400123 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124};
125
Bob Moore50eca3e2005-09-30 19:03:00 -0400126struct aml_resource_start_dependent {
127 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128};
129
Bob Moore50eca3e2005-09-30 19:03:00 -0400130struct aml_resource_start_dependent_noprio {
131AML_RESOURCE_SMALL_HEADER_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132
Bob Moore50eca3e2005-09-30 19:03:00 -0400133struct aml_resource_end_dependent {
134AML_RESOURCE_SMALL_HEADER_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
Bob Moore50eca3e2005-09-30 19:03:00 -0400136struct aml_resource_io {
137 AML_RESOURCE_SMALL_HEADER_COMMON u8 information;
138 u16 minimum;
139 u16 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400140 u8 alignment;
Bob Moore50eca3e2005-09-30 19:03:00 -0400141 u8 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142};
143
Bob Moore50eca3e2005-09-30 19:03:00 -0400144struct aml_resource_fixed_io {
145 AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
146 u8 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147};
148
Bob Moore50eca3e2005-09-30 19:03:00 -0400149struct aml_resource_vendor_small {
150AML_RESOURCE_SMALL_HEADER_COMMON};
151
152struct aml_resource_end_tag {
153 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154};
155
Bob Moore50eca3e2005-09-30 19:03:00 -0400156/*
157 * LARGE descriptors
158 */
159#define AML_RESOURCE_LARGE_HEADER_COMMON \
Robert Moorebda663d2005-09-16 16:51:15 -0400160 u8 descriptor_type;\
Bob Moore50eca3e2005-09-30 19:03:00 -0400161 u16 resource_length;
Robert Moorebda663d2005-09-16 16:51:15 -0400162
Bob Moore50eca3e2005-09-30 19:03:00 -0400163struct aml_resource_large_header {
164AML_RESOURCE_LARGE_HEADER_COMMON};
Robert Moorebda663d2005-09-16 16:51:15 -0400165
Bob Moore50eca3e2005-09-30 19:03:00 -0400166struct aml_resource_memory24 {
167 AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
168 u16 minimum;
169 u16 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400170 u16 alignment;
Bob Moore50eca3e2005-09-30 19:03:00 -0400171 u16 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172};
173
Bob Moore50eca3e2005-09-30 19:03:00 -0400174struct aml_resource_vendor_large {
175AML_RESOURCE_LARGE_HEADER_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Bob Moore50eca3e2005-09-30 19:03:00 -0400177struct aml_resource_memory32 {
178 AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
179 u32 minimum;
180 u32 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400181 u32 alignment;
Bob Moore50eca3e2005-09-30 19:03:00 -0400182 u32 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183};
184
Bob Moore50eca3e2005-09-30 19:03:00 -0400185struct aml_resource_fixed_memory32 {
186 AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
187 u32 address;
188 u32 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189};
190
Bob Moore50eca3e2005-09-30 19:03:00 -0400191#define AML_RESOURCE_ADDRESS_COMMON \
192 u8 resource_type; \
193 u8 flags; \
194 u8 specific_flags;
195
196struct aml_resource_address {
197AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
198
199struct aml_resource_extended_address64 {
200 AML_RESOURCE_LARGE_HEADER_COMMON
201 AML_RESOURCE_ADDRESS_COMMON u8 revision_iD;
Len Brown4be44fc2005-08-05 00:44:28 -0400202 u8 reserved;
203 u64 granularity;
Bob Moore50eca3e2005-09-30 19:03:00 -0400204 u64 minimum;
205 u64 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400206 u64 translation_offset;
207 u64 address_length;
208 u64 type_specific_attributes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209};
210
Bob Moore50eca3e2005-09-30 19:03:00 -0400211#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212
Bob Moore50eca3e2005-09-30 19:03:00 -0400213struct aml_resource_address64 {
214 AML_RESOURCE_LARGE_HEADER_COMMON
215 AML_RESOURCE_ADDRESS_COMMON u64 granularity;
216 u64 minimum;
217 u64 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400218 u64 translation_offset;
219 u64 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220};
221
Bob Moore50eca3e2005-09-30 19:03:00 -0400222struct aml_resource_address32 {
223 AML_RESOURCE_LARGE_HEADER_COMMON
224 AML_RESOURCE_ADDRESS_COMMON u32 granularity;
225 u32 minimum;
226 u32 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400227 u32 translation_offset;
228 u32 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229};
230
Bob Moore50eca3e2005-09-30 19:03:00 -0400231struct aml_resource_address16 {
232 AML_RESOURCE_LARGE_HEADER_COMMON
233 AML_RESOURCE_ADDRESS_COMMON u16 granularity;
234 u16 minimum;
235 u16 maximum;
Len Brown4be44fc2005-08-05 00:44:28 -0400236 u16 translation_offset;
237 u16 address_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238};
239
Bob Moore50eca3e2005-09-30 19:03:00 -0400240struct aml_resource_extended_irq {
241 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
Len Brown4be44fc2005-08-05 00:44:28 -0400242 u8 table_length;
243 u32 interrupt_number[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 /* res_source_index, res_source optional fields follow */
245};
246
Bob Moore50eca3e2005-09-30 19:03:00 -0400247struct aml_resource_generic_register {
248 AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
Len Brown4be44fc2005-08-05 00:44:28 -0400249 u8 bit_width;
250 u8 bit_offset;
Bob Moore50eca3e2005-09-30 19:03:00 -0400251 u8 access_size; /* ACPI 3.0, was previously Reserved */
Len Brown4be44fc2005-08-05 00:44:28 -0400252 u64 address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253};
254
255/* restore default alignment */
256
257#pragma pack()
258
259/* Union of all resource descriptors, so we can allocate the worst case */
260
Bob Moore50eca3e2005-09-30 19:03:00 -0400261union aml_resource {
262 /* Descriptor headers */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263
Bob Moore50eca3e2005-09-30 19:03:00 -0400264 struct aml_resource_small_header small_header;
265 struct aml_resource_large_header large_header;
266
267 /* Small resource descriptors */
268
269 struct aml_resource_irq irq;
270 struct aml_resource_dma dma;
271 struct aml_resource_start_dependent start_dpf;
272 struct aml_resource_end_dependent end_dpf;
273 struct aml_resource_io io;
274 struct aml_resource_fixed_io fixed_io;
275 struct aml_resource_vendor_small vendor_small;
276 struct aml_resource_end_tag end_tag;
277
278 /* Large resource descriptors */
279
280 struct aml_resource_memory24 memory24;
281 struct aml_resource_generic_register generic_reg;
282 struct aml_resource_vendor_large vendor_large;
283 struct aml_resource_memory32 memory32;
284 struct aml_resource_fixed_memory32 fixed_memory32;
285 struct aml_resource_address16 address16;
286 struct aml_resource_address32 address32;
287 struct aml_resource_address64 address64;
288 struct aml_resource_extended_address64 ext_address64;
289 struct aml_resource_extended_irq extended_irq;
290
291 /* Utility overlays */
292
293 struct aml_resource_address address;
Len Brown4be44fc2005-08-05 00:44:28 -0400294 u32 u32_item;
295 u16 u16_item;
296 u8 U8item;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297};
298
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299#endif