blob: ba281f7740a054a256c2bacc77ce0b4d6486baa8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Name: acresrc.h - Resource Manager function prototypes
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
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
Bob Moore50eca3e2005-09-30 19:03:00 -040047/* Need the AML resource descriptor structs */
48
49#include "amlresrc.h"
50
51/*
Bob Moore08978312005-10-21 00:00:00 -040052 * 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
Bob Moore08978312005-10-21 00:00:00 -0400104typedef const struct acpi_rsdump_info {
105 u8 opcode;
106 u8 offset;
107 char *name;
Bob Moore96db2552005-11-02 00:00:00 -0500108 const char **pointer;
Bob Moore50eca3e2005-09-30 19:03:00 -0400109
Bob Moore08978312005-10-21 00:00:00 -0400110} acpi_rsdump_info;
Bob Moore50eca3e2005-09-30 19:03:00 -0400111
Bob Moore08978312005-10-21 00:00:00 -0400112/* Values for the Opcode field above */
Bob Moore50eca3e2005-09-30 19:03:00 -0400113
Bob Moore08978312005-10-21 00:00:00 -0400114#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
Bob Moore50eca3e2005-09-30 19:03:00 -0400128
Bob Moore08978312005-10-21 00:00:00 -0400129/* restore default alignment */
Bob Moore50eca3e2005-09-30 19:03:00 -0400130
Bob Moore08978312005-10-21 00:00:00 -0400131#pragma pack()
Bob Moore50eca3e2005-09-30 19:03:00 -0400132
Bob Moore08978312005-10-21 00:00:00 -0400133/* Resource tables indexed by internal resource type */
134
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 */
Bob Moore50eca3e2005-09-30 19:03:00 -0400139
Bob Moorec51a4de2005-11-17 13:07:00 -0500140extern const u8 acpi_gbl_resource_struct_sizes[];
Bob Moore96db2552005-11-02 00:00:00 -0500141extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
142
Bob Moorec51a4de2005-11-17 13:07:00 -0500143struct acpi_vendor_walk_info {
144 struct acpi_vendor_uuid *uuid;
145 struct acpi_buffer *buffer;
146 acpi_status status;
147};
Bob Moore50eca3e2005-09-30 19:03:00 -0400148
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149/*
Bob Moore08978312005-10-21 00:00:00 -0400150 * 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);
163
164/*
165 * rsutils
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400168acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
170acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400171acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
Robert Moore44f6c012005-04-18 22:49:35 -0400173#ifdef ACPI_FUTURE_USAGE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400175acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
176#endif /* ACPI_FUTURE_USAGE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177
178acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400179acpi_rs_get_method_data(acpi_handle handle,
180 char *path, struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181
182acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400183acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184
Robert Moore44f6c012005-04-18 22:49:35 -0400185/*
186 * rscalc
187 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188acpi_status
Bob Moore50eca3e2005-09-30 19:03:00 -0400189acpi_rs_get_list_length(u8 * aml_buffer,
190 u32 aml_buffer_length, acpi_size * size_needed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191
192acpi_status
Bob Moore50eca3e2005-09-30 19:03:00 -0400193acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
194 acpi_size * size_needed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
196acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400197acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
198 acpi_size * buffer_size_needed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
200acpi_status
Bob Moore50eca3e2005-09-30 19:03:00 -0400201acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
202 u32 aml_buffer_length, u8 * output_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203
204acpi_status
Bob Moore50eca3e2005-09-30 19:03:00 -0400205acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
206 acpi_size aml_size_needed, u8 * output_buffer);
207
208/*
Bob Moore50eca3e2005-09-30 19:03:00 -0400209 * rsaddr
210 */
Bob Moore08978312005-10-21 00:00:00 -0400211void
212acpi_rs_set_address_common(union aml_resource *aml,
Bob Moore50eca3e2005-09-30 19:03:00 -0400213 struct acpi_resource *resource);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214
Bob Moore08978312005-10-21 00:00:00 -0400215u8
216acpi_rs_get_address_common(struct acpi_resource *resource,
Bob Moore50eca3e2005-09-30 19:03:00 -0400217 union aml_resource *aml);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218
Robert Moorebda663d2005-09-16 16:51:15 -0400219/*
220 * rsmisc
221 */
222acpi_status
Bob Moore08978312005-10-21 00:00:00 -0400223acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
224 union aml_resource *aml,
225 struct acpi_rsconvert_info *info);
Robert Moorebda663d2005-09-16 16:51:15 -0400226
227acpi_status
Bob Moore08978312005-10-21 00:00:00 -0400228acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
229 union aml_resource *aml,
230 struct acpi_rsconvert_info *info);
Bob Moore50eca3e2005-09-30 19:03:00 -0400231
232/*
233 * rsutils
234 */
235void
236acpi_rs_move_data(void *destination,
237 void *source, u16 item_count, u8 move_type);
238
Bob Moore08978312005-10-21 00:00:00 -0400239u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
Bob Moore50eca3e2005-09-30 19:03:00 -0400240
Bob Moore08978312005-10-21 00:00:00 -0400241u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
Bob Moore50eca3e2005-09-30 19:03:00 -0400242
Bob Moore08978312005-10-21 00:00:00 -0400243acpi_rs_length
244acpi_rs_get_resource_source(acpi_rs_length resource_length,
245 acpi_rs_length minimum_length,
Bob Moore50eca3e2005-09-30 19:03:00 -0400246 struct acpi_resource_source *resource_source,
247 union aml_resource *aml, char *string_ptr);
248
Bob Moore08978312005-10-21 00:00:00 -0400249acpi_rsdesc_size
Bob Moore50eca3e2005-09-30 19:03:00 -0400250acpi_rs_set_resource_source(union aml_resource *aml,
Bob Moore08978312005-10-21 00:00:00 -0400251 acpi_rs_length minimum_length,
Bob Moore50eca3e2005-09-30 19:03:00 -0400252 struct acpi_resource_source *resource_source);
253
Bob Moore50eca3e2005-09-30 19:03:00 -0400254void
255acpi_rs_set_resource_header(u8 descriptor_type,
Bob Moore08978312005-10-21 00:00:00 -0400256 acpi_rsdesc_size total_length,
257 union aml_resource *aml);
258
259void
260acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
261 union aml_resource *aml);
Bob Moore50eca3e2005-09-30 19:03:00 -0400262
Bob Moore50eca3e2005-09-30 19:03:00 -0400263/*
264 * rsdump
265 */
Bob Moore08978312005-10-21 00:00:00 -0400266void acpi_rs_dump_resource_list(struct acpi_resource *resource);
Bob Moore50eca3e2005-09-30 19:03:00 -0400267
Bob Moore08978312005-10-21 00:00:00 -0400268void acpi_rs_dump_irq_list(u8 * route_table);
Bob Moore50eca3e2005-09-30 19:03:00 -0400269
Bob Moore08978312005-10-21 00:00:00 -0400270/*
271 * Resource conversion tables
272 */
273extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
274extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
275extern struct acpi_rsconvert_info acpi_rs_convert_io[];
276extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
277extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
278extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
279extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
280extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
281extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
282extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
283extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
284extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
285extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
286extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400287
Bob Moore08978312005-10-21 00:00:00 -0400288/* These resources require separate get/set tables */
Bob Moore50eca3e2005-09-30 19:03:00 -0400289
Bob Moore08978312005-10-21 00:00:00 -0400290extern struct acpi_rsconvert_info acpi_rs_get_irq[];
291extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
292extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
293extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400294
Bob Moore08978312005-10-21 00:00:00 -0400295extern struct acpi_rsconvert_info acpi_rs_set_irq[];
296extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
297extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400298
Bob Moore08978312005-10-21 00:00:00 -0400299#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
300/*
301 * rsinfo
302 */
303extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400304
Bob Moore08978312005-10-21 00:00:00 -0400305/*
306 * rsdump
307 */
308extern struct acpi_rsdump_info acpi_rs_dump_irq[];
309extern struct acpi_rsdump_info acpi_rs_dump_dma[];
310extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
311extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
312extern struct acpi_rsdump_info acpi_rs_dump_io[];
313extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
314extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
315extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
316extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
317extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
318extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
319extern struct acpi_rsdump_info acpi_rs_dump_address16[];
320extern struct acpi_rsdump_info acpi_rs_dump_address32[];
321extern struct acpi_rsdump_info acpi_rs_dump_address64[];
322extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
323extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
324extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400325#endif
Robert Moorebda663d2005-09-16 16:51:15 -0400326
Len Brown4be44fc2005-08-05 00:44:28 -0400327#endif /* __ACRESRC_H__ */