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