]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/acpi/acresrc.h
Linux 2.6.18-rc1
[mirror_ubuntu-artful-kernel.git] / include / acpi / acresrc.h
CommitLineData
1da177e4
LT
1/******************************************************************************
2 *
3 * Name: acresrc.h - Resource Manager function prototypes
4 *
5 *****************************************************************************/
6
7/*
4a90c7e8 8 * Copyright (C) 2000 - 2006, R. Byron Moore
1da177e4
LT
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
44#ifndef __ACRESRC_H__
45#define __ACRESRC_H__
46
50eca3eb
BM
47/* Need the AML resource descriptor structs */
48
49#include "amlresrc.h"
50
0897831b
BM
51/*
52 * If possible, pack the following structures to byte alignment, since we
53 * don't care about performance for debug output
54 */
55#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
56#pragma pack(1)
57#endif
58
59/*
60 * Individual entry for the resource conversion tables
61 */
62typedef const struct acpi_rsconvert_info {
63 u8 opcode;
64 u8 resource_offset;
65 u8 aml_offset;
66 u8 value;
67
68} acpi_rsconvert_info;
69
70/* Resource conversion opcodes */
71
72#define ACPI_RSC_INITGET 0
73#define ACPI_RSC_INITSET 1
74#define ACPI_RSC_FLAGINIT 2
75#define ACPI_RSC_1BITFLAG 3
76#define ACPI_RSC_2BITFLAG 4
77#define ACPI_RSC_COUNT 5
78#define ACPI_RSC_COUNT16 6
79#define ACPI_RSC_LENGTH 7
80#define ACPI_RSC_MOVE8 8
81#define ACPI_RSC_MOVE16 9
82#define ACPI_RSC_MOVE32 10
83#define ACPI_RSC_MOVE64 11
84#define ACPI_RSC_SET8 12
85#define ACPI_RSC_DATA8 13
86#define ACPI_RSC_ADDRESS 14
87#define ACPI_RSC_SOURCE 15
88#define ACPI_RSC_SOURCEX 16
89#define ACPI_RSC_BITMASK 17
90#define ACPI_RSC_BITMASK16 18
91#define ACPI_RSC_EXIT_NE 19
92#define ACPI_RSC_EXIT_LE 20
93
94/* Resource Conversion sub-opcodes */
95
96#define ACPI_RSC_COMPARE_AML_LENGTH 0
97#define ACPI_RSC_COMPARE_VALUE 1
98
99#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
100
101#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
102#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
103
0897831b
BM
104typedef const struct acpi_rsdump_info {
105 u8 opcode;
106 u8 offset;
107 char *name;
96db255c 108 const char **pointer;
50eca3eb 109
0897831b 110} acpi_rsdump_info;
50eca3eb 111
0897831b 112/* Values for the Opcode field above */
50eca3eb 113
0897831b
BM
114#define ACPI_RSD_TITLE 0
115#define ACPI_RSD_LITERAL 1
116#define ACPI_RSD_STRING 2
117#define ACPI_RSD_UINT8 3
118#define ACPI_RSD_UINT16 4
119#define ACPI_RSD_UINT32 5
120#define ACPI_RSD_UINT64 6
121#define ACPI_RSD_1BITFLAG 7
122#define ACPI_RSD_2BITFLAG 8
123#define ACPI_RSD_SHORTLIST 9
124#define ACPI_RSD_LONGLIST 10
125#define ACPI_RSD_DWORDLIST 11
126#define ACPI_RSD_ADDRESS 12
127#define ACPI_RSD_SOURCE 13
50eca3eb 128
0897831b 129/* restore default alignment */
50eca3eb 130
0897831b 131#pragma pack()
50eca3eb 132
0897831b 133/* Resource tables indexed by internal resource type */
50eca3eb 134
0897831b
BM
135extern const u8 acpi_gbl_aml_resource_sizes[];
136extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
137
138/* Resource tables indexed by raw AML resource descriptor type */
50eca3eb 139
c51a4de8 140extern const u8 acpi_gbl_resource_struct_sizes[];
96db255c
BM
141extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
142
c51a4de8
BM
143struct acpi_vendor_walk_info {
144 struct acpi_vendor_uuid *uuid;
145 struct acpi_buffer *buffer;
146 acpi_status status;
147};
0897831b
BM
148
149/*
150 * rscreate
151 */
152acpi_status
153acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
154 struct acpi_buffer *output_buffer);
155
156acpi_status
157acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
158 struct acpi_buffer *output_buffer);
159
160acpi_status
161acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
162 struct acpi_buffer *output_buffer);
50eca3eb 163
1da177e4 164/*
0897831b 165 * rsutils
1da177e4 166 */
4119532c 167
1da177e4 168acpi_status
4119532c
BM
169acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
170 struct acpi_buffer *ret_buffer);
1da177e4
LT
171
172acpi_status
4119532c
BM
173acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
174 struct acpi_buffer *ret_buffer);
1da177e4 175
1da177e4 176acpi_status
4119532c
BM
177acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
178 struct acpi_buffer *ret_buffer);
1da177e4
LT
179
180acpi_status
4be44fcd
LB
181acpi_rs_get_method_data(acpi_handle handle,
182 char *path, struct acpi_buffer *ret_buffer);
1da177e4
LT
183
184acpi_status
4119532c
BM
185acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
186 struct acpi_buffer *ret_buffer);
1da177e4 187
44f6c012
RM
188/*
189 * rscalc
190 */
1da177e4 191acpi_status
50eca3eb
BM
192acpi_rs_get_list_length(u8 * aml_buffer,
193 u32 aml_buffer_length, acpi_size * size_needed);
1da177e4
LT
194
195acpi_status
50eca3eb
BM
196acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
197 acpi_size * size_needed);
1da177e4
LT
198
199acpi_status
4be44fcd
LB
200acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
201 acpi_size * buffer_size_needed);
1da177e4
LT
202
203acpi_status
61686124
BM
204acpi_rs_convert_aml_to_resources(u8 * aml,
205 u32 length,
206 u32 offset, u8 resource_index, void **context);
1da177e4
LT
207
208acpi_status
50eca3eb
BM
209acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
210 acpi_size aml_size_needed, u8 * output_buffer);
1da177e4 211
50eca3eb
BM
212/*
213 * rsaddr
214 */
0897831b
BM
215void
216acpi_rs_set_address_common(union aml_resource *aml,
50eca3eb 217 struct acpi_resource *resource);
1da177e4 218
0897831b
BM
219u8
220acpi_rs_get_address_common(struct acpi_resource *resource,
50eca3eb 221 union aml_resource *aml);
1da177e4 222
50eca3eb
BM
223/*
224 * rsmisc
225 */
1da177e4 226acpi_status
0897831b
BM
227acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
228 union aml_resource *aml,
229 struct acpi_rsconvert_info *info);
1da177e4
LT
230
231acpi_status
0897831b
BM
232acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
233 union aml_resource *aml,
234 struct acpi_rsconvert_info *info);
50eca3eb
BM
235
236/*
237 * rsutils
238 */
239void
240acpi_rs_move_data(void *destination,
241 void *source, u16 item_count, u8 move_type);
242
0897831b 243u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
50eca3eb 244
0897831b 245u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
50eca3eb 246
0897831b
BM
247acpi_rs_length
248acpi_rs_get_resource_source(acpi_rs_length resource_length,
249 acpi_rs_length minimum_length,
50eca3eb
BM
250 struct acpi_resource_source *resource_source,
251 union aml_resource *aml, char *string_ptr);
252
0897831b 253acpi_rsdesc_size
50eca3eb 254acpi_rs_set_resource_source(union aml_resource *aml,
0897831b 255 acpi_rs_length minimum_length,
50eca3eb 256 struct acpi_resource_source *resource_source);
1da177e4 257
50eca3eb
BM
258void
259acpi_rs_set_resource_header(u8 descriptor_type,
0897831b
BM
260 acpi_rsdesc_size total_length,
261 union aml_resource *aml);
262
263void
264acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
265 union aml_resource *aml);
50eca3eb 266
bda663d3 267/*
50eca3eb 268 * rsdump
bda663d3 269 */
0897831b 270void acpi_rs_dump_resource_list(struct acpi_resource *resource);
50eca3eb 271
0897831b 272void acpi_rs_dump_irq_list(u8 * route_table);
50eca3eb 273
0897831b
BM
274/*
275 * Resource conversion tables
276 */
277extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
278extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
279extern struct acpi_rsconvert_info acpi_rs_convert_io[];
280extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
281extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
282extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
283extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
284extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
285extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
286extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
287extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
288extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
289extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
290extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
291
292/* These resources require separate get/set tables */
293
294extern struct acpi_rsconvert_info acpi_rs_get_irq[];
295extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
296extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
297extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
298
299extern struct acpi_rsconvert_info acpi_rs_set_irq[];
300extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
301extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
50eca3eb 302
0897831b
BM
303#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
304/*
305 * rsinfo
306 */
307extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
50eca3eb 308
0897831b
BM
309/*
310 * rsdump
311 */
312extern struct acpi_rsdump_info acpi_rs_dump_irq[];
313extern struct acpi_rsdump_info acpi_rs_dump_dma[];
314extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
315extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
316extern struct acpi_rsdump_info acpi_rs_dump_io[];
317extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
318extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
319extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
320extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
321extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
322extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
323extern struct acpi_rsdump_info acpi_rs_dump_address16[];
324extern struct acpi_rsdump_info acpi_rs_dump_address32[];
325extern struct acpi_rsdump_info acpi_rs_dump_address64[];
326extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
327extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
328extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
50eca3eb 329#endif
bda663d3 330
4be44fcd 331#endif /* __ACRESRC_H__ */