blob: eef5bd7a59faf3fd426e8602c9bc0240fd9a8a99 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Name: acresrc.h - Resource Manager function prototypes
4 *
5 *****************************************************************************/
6
7/*
Len Brown75a44ce2008-04-23 23:00:13 -04008 * Copyright (C) 2000 - 2008, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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
Bob Mooref6dd9222006-07-07 20:44:38 -040053 * 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
Bob Moore08978312005-10-21 00:00:00 -040058 */
Bob Mooref6dd9222006-07-07 20:44:38 -040059#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
Bob Moore08978312005-10-21 00:00:00 -040060#pragma pack(1)
61#endif
62
63/*
64 * Individual entry for the resource conversion tables
65 */
66typedef const struct acpi_rsconvert_info {
67 u8 opcode;
68 u8 resource_offset;
69 u8 aml_offset;
70 u8 value;
71
72} acpi_rsconvert_info;
73
74/* Resource conversion opcodes */
75
76#define ACPI_RSC_INITGET 0
77#define ACPI_RSC_INITSET 1
78#define ACPI_RSC_FLAGINIT 2
79#define ACPI_RSC_1BITFLAG 3
80#define ACPI_RSC_2BITFLAG 4
81#define ACPI_RSC_COUNT 5
82#define ACPI_RSC_COUNT16 6
83#define ACPI_RSC_LENGTH 7
84#define ACPI_RSC_MOVE8 8
85#define ACPI_RSC_MOVE16 9
86#define ACPI_RSC_MOVE32 10
87#define ACPI_RSC_MOVE64 11
88#define ACPI_RSC_SET8 12
89#define ACPI_RSC_DATA8 13
90#define ACPI_RSC_ADDRESS 14
91#define ACPI_RSC_SOURCE 15
92#define ACPI_RSC_SOURCEX 16
93#define ACPI_RSC_BITMASK 17
94#define ACPI_RSC_BITMASK16 18
95#define ACPI_RSC_EXIT_NE 19
96#define ACPI_RSC_EXIT_LE 20
Bob Moore1d5b2852008-04-10 19:06:43 +040097#define ACPI_RSC_EXIT_EQ 21
Bob Moore08978312005-10-21 00:00:00 -040098
99/* Resource Conversion sub-opcodes */
100
101#define ACPI_RSC_COMPARE_AML_LENGTH 0
102#define ACPI_RSC_COMPARE_VALUE 1
103
104#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
105
106#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
107#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
108
Bob Moore08978312005-10-21 00:00:00 -0400109typedef const struct acpi_rsdump_info {
110 u8 opcode;
111 u8 offset;
112 char *name;
Bob Moore96db2552005-11-02 00:00:00 -0500113 const char **pointer;
Bob Moore50eca3e2005-09-30 19:03:00 -0400114
Bob Moore08978312005-10-21 00:00:00 -0400115} acpi_rsdump_info;
Bob Moore50eca3e2005-09-30 19:03:00 -0400116
Bob Moore08978312005-10-21 00:00:00 -0400117/* Values for the Opcode field above */
Bob Moore50eca3e2005-09-30 19:03:00 -0400118
Bob Moore08978312005-10-21 00:00:00 -0400119#define ACPI_RSD_TITLE 0
120#define ACPI_RSD_LITERAL 1
121#define ACPI_RSD_STRING 2
122#define ACPI_RSD_UINT8 3
123#define ACPI_RSD_UINT16 4
124#define ACPI_RSD_UINT32 5
125#define ACPI_RSD_UINT64 6
126#define ACPI_RSD_1BITFLAG 7
127#define ACPI_RSD_2BITFLAG 8
128#define ACPI_RSD_SHORTLIST 9
129#define ACPI_RSD_LONGLIST 10
130#define ACPI_RSD_DWORDLIST 11
131#define ACPI_RSD_ADDRESS 12
132#define ACPI_RSD_SOURCE 13
Bob Moore50eca3e2005-09-30 19:03:00 -0400133
Bob Moore08978312005-10-21 00:00:00 -0400134/* restore default alignment */
Bob Moore50eca3e2005-09-30 19:03:00 -0400135
Bob Moore08978312005-10-21 00:00:00 -0400136#pragma pack()
Bob Moore50eca3e2005-09-30 19:03:00 -0400137
Bob Moore08978312005-10-21 00:00:00 -0400138/* Resource tables indexed by internal resource type */
139
140extern const u8 acpi_gbl_aml_resource_sizes[];
141extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
142
143/* Resource tables indexed by raw AML resource descriptor type */
Bob Moore50eca3e2005-09-30 19:03:00 -0400144
Bob Moorec51a4de2005-11-17 13:07:00 -0500145extern const u8 acpi_gbl_resource_struct_sizes[];
Bob Moore96db2552005-11-02 00:00:00 -0500146extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
147
Bob Moorec51a4de2005-11-17 13:07:00 -0500148struct acpi_vendor_walk_info {
149 struct acpi_vendor_uuid *uuid;
150 struct acpi_buffer *buffer;
151 acpi_status status;
152};
Bob Moore50eca3e2005-09-30 19:03:00 -0400153
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154/*
Bob Moore08978312005-10-21 00:00:00 -0400155 * rscreate
156 */
157acpi_status
158acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
159 struct acpi_buffer *output_buffer);
160
161acpi_status
162acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
163 struct acpi_buffer *output_buffer);
164
165acpi_status
166acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
167 struct acpi_buffer *output_buffer);
168
169/*
170 * rsutils
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
173acpi_status
Bob Moore41195322006-05-26 16:36:00 -0400174acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
175 struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177acpi_status
Bob Moore41195322006-05-26 16:36:00 -0400178acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
179 struct acpi_buffer *ret_buffer);
180
181acpi_status
182acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
183 struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184
185acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400186acpi_rs_get_method_data(acpi_handle handle,
187 char *path, struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188
189acpi_status
Bob Moore41195322006-05-26 16:36:00 -0400190acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
191 struct acpi_buffer *ret_buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
Robert Moore44f6c012005-04-18 22:49:35 -0400193/*
194 * rscalc
195 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196acpi_status
Bob Moore50eca3e2005-09-30 19:03:00 -0400197acpi_rs_get_list_length(u8 * aml_buffer,
198 u32 aml_buffer_length, acpi_size * size_needed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
200acpi_status
Bob Moore50eca3e2005-09-30 19:03:00 -0400201acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
202 acpi_size * size_needed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203
204acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400205acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
206 acpi_size * buffer_size_needed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207
208acpi_status
Bob Moore61686122006-03-17 16:44:00 -0500209acpi_rs_convert_aml_to_resources(u8 * aml,
210 u32 length,
211 u32 offset, u8 resource_index, void **context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212
213acpi_status
Bob Moore50eca3e2005-09-30 19:03:00 -0400214acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
215 acpi_size aml_size_needed, u8 * output_buffer);
216
217/*
Bob Moore50eca3e2005-09-30 19:03:00 -0400218 * rsaddr
219 */
Bob Moore08978312005-10-21 00:00:00 -0400220void
221acpi_rs_set_address_common(union aml_resource *aml,
Bob Moore50eca3e2005-09-30 19:03:00 -0400222 struct acpi_resource *resource);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223
Bob Moore08978312005-10-21 00:00:00 -0400224u8
225acpi_rs_get_address_common(struct acpi_resource *resource,
Bob Moore50eca3e2005-09-30 19:03:00 -0400226 union aml_resource *aml);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
Robert Moorebda663d2005-09-16 16:51:15 -0400228/*
229 * rsmisc
230 */
231acpi_status
Bob Moore08978312005-10-21 00:00:00 -0400232acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
233 union aml_resource *aml,
234 struct acpi_rsconvert_info *info);
Robert Moorebda663d2005-09-16 16:51:15 -0400235
236acpi_status
Bob Moore08978312005-10-21 00:00:00 -0400237acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
238 union aml_resource *aml,
239 struct acpi_rsconvert_info *info);
Bob Moore50eca3e2005-09-30 19:03:00 -0400240
241/*
242 * rsutils
243 */
244void
245acpi_rs_move_data(void *destination,
246 void *source, u16 item_count, u8 move_type);
247
Bob Moore08978312005-10-21 00:00:00 -0400248u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
Bob Moore50eca3e2005-09-30 19:03:00 -0400249
Bob Moore08978312005-10-21 00:00:00 -0400250u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
Bob Moore50eca3e2005-09-30 19:03:00 -0400251
Bob Moore08978312005-10-21 00:00:00 -0400252acpi_rs_length
253acpi_rs_get_resource_source(acpi_rs_length resource_length,
254 acpi_rs_length minimum_length,
Bob Moore50eca3e2005-09-30 19:03:00 -0400255 struct acpi_resource_source *resource_source,
256 union aml_resource *aml, char *string_ptr);
257
Bob Moore08978312005-10-21 00:00:00 -0400258acpi_rsdesc_size
Bob Moore50eca3e2005-09-30 19:03:00 -0400259acpi_rs_set_resource_source(union aml_resource *aml,
Bob Moore08978312005-10-21 00:00:00 -0400260 acpi_rs_length minimum_length,
Bob Moore50eca3e2005-09-30 19:03:00 -0400261 struct acpi_resource_source *resource_source);
262
Bob Moore50eca3e2005-09-30 19:03:00 -0400263void
264acpi_rs_set_resource_header(u8 descriptor_type,
Bob Moore08978312005-10-21 00:00:00 -0400265 acpi_rsdesc_size total_length,
266 union aml_resource *aml);
267
268void
269acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
270 union aml_resource *aml);
Bob Moore50eca3e2005-09-30 19:03:00 -0400271
Bob Moore50eca3e2005-09-30 19:03:00 -0400272/*
273 * rsdump
274 */
Bob Moore08978312005-10-21 00:00:00 -0400275void acpi_rs_dump_resource_list(struct acpi_resource *resource);
Bob Moore50eca3e2005-09-30 19:03:00 -0400276
Bob Moore08978312005-10-21 00:00:00 -0400277void acpi_rs_dump_irq_list(u8 * route_table);
Bob Moore50eca3e2005-09-30 19:03:00 -0400278
Bob Moore08978312005-10-21 00:00:00 -0400279/*
280 * Resource conversion tables
281 */
282extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
283extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
284extern struct acpi_rsconvert_info acpi_rs_convert_io[];
285extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
286extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
287extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
288extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
289extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
290extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
291extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
292extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
293extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
294extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
295extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400296
Bob Moore08978312005-10-21 00:00:00 -0400297/* These resources require separate get/set tables */
Bob Moore50eca3e2005-09-30 19:03:00 -0400298
Bob Moore08978312005-10-21 00:00:00 -0400299extern struct acpi_rsconvert_info acpi_rs_get_irq[];
300extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
301extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
302extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400303
Bob Moore08978312005-10-21 00:00:00 -0400304extern struct acpi_rsconvert_info acpi_rs_set_irq[];
305extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
306extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400307
Bob Moore08978312005-10-21 00:00:00 -0400308#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
309/*
310 * rsinfo
311 */
312extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400313
Bob Moore08978312005-10-21 00:00:00 -0400314/*
315 * rsdump
316 */
317extern struct acpi_rsdump_info acpi_rs_dump_irq[];
318extern struct acpi_rsdump_info acpi_rs_dump_dma[];
319extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
320extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
321extern struct acpi_rsdump_info acpi_rs_dump_io[];
322extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
323extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
324extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
325extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
326extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
327extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
328extern struct acpi_rsdump_info acpi_rs_dump_address16[];
329extern struct acpi_rsdump_info acpi_rs_dump_address32[];
330extern struct acpi_rsdump_info acpi_rs_dump_address64[];
331extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
332extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
333extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
Bob Moore50eca3e2005-09-30 19:03:00 -0400334#endif
Robert Moorebda663d2005-09-16 16:51:15 -0400335
Len Brown4be44fc2005-08-05 00:44:28 -0400336#endif /* __ACRESRC_H__ */