blob: 9e7ae2f8a1d3993a03ad9576e6126c3a171de63f [file] [log] [blame]
Len Brown9115a6c2005-12-06 16:27:40 -05001/*******************************************************************************
2 *
3 * Module Name: rsinfo - Dispatch and Info tables
4 *
5 ******************************************************************************/
6
7/*
Bob Moore4a90c7e2006-01-13 16:22:00 -05008 * Copyright (C) 2000 - 2006, R. Byron Moore
Len Brown9115a6c2005-12-06 16:27:40 -05009 * 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#include <acpi/acpi.h>
45#include <acpi/acresrc.h>
46
47#define _COMPONENT ACPI_RESOURCES
48ACPI_MODULE_NAME("rsinfo")
49
50/*
51 * Resource dispatch and information tables. Any new resource types (either
52 * Large or Small) must be reflected in each of these tables, so they are here
53 * in one place.
54 *
55 * The tables for Large descriptors are indexed by bits 6:0 of the AML
56 * descriptor type byte. The tables for Small descriptors are indexed by
57 * bits 6:3 of the descriptor byte. The tables for internal resource
58 * descriptors are indexed by the acpi_resource_type field.
59 */
60/* Dispatch table for resource-to-AML (Set Resource) conversion functions */
Bob Moore08978312005-10-21 00:00:00 -040061struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = {
Len Brown9115a6c2005-12-06 16:27:40 -050062 acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */
Bob Moore08978312005-10-21 00:00:00 -040063 acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */
Len Brown9115a6c2005-12-06 16:27:40 -050064 acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */
Bob Moore08978312005-10-21 00:00:00 -040065 acpi_rs_convert_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */
66 acpi_rs_convert_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */
67 acpi_rs_convert_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */
Len Brown9115a6c2005-12-06 16:27:40 -050068 acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */
Bob Moore08978312005-10-21 00:00:00 -040069 acpi_rs_convert_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */
70 acpi_rs_convert_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */
71 acpi_rs_convert_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */
72 acpi_rs_convert_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
73 acpi_rs_convert_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */
74 acpi_rs_convert_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */
75 acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
76 acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
77 acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
78 acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
Len Brown9115a6c2005-12-06 16:27:40 -050079};
80
81/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
82
Bob Moore96db2552005-11-02 00:00:00 -050083struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = {
84 /* Small descriptors */
85
Len Brown9115a6c2005-12-06 16:27:40 -050086 NULL, /* 0x00, Reserved */
87 NULL, /* 0x01, Reserved */
88 NULL, /* 0x02, Reserved */
89 NULL, /* 0x03, Reserved */
90 acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */
Bob Moore08978312005-10-21 00:00:00 -040091 acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */
Len Brown9115a6c2005-12-06 16:27:40 -050092 acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
Bob Moore08978312005-10-21 00:00:00 -040093 acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
94 acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */
95 acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
Len Brown9115a6c2005-12-06 16:27:40 -050096 NULL, /* 0x0A, Reserved */
97 NULL, /* 0x0B, Reserved */
98 NULL, /* 0x0C, Reserved */
99 NULL, /* 0x0D, Reserved */
Bob Moore08978312005-10-21 00:00:00 -0400100 acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
Bob Moore96db2552005-11-02 00:00:00 -0500101 acpi_rs_convert_end_tag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
Len Brown9115a6c2005-12-06 16:27:40 -0500102
Bob Moore96db2552005-11-02 00:00:00 -0500103 /* Large descriptors */
104
Len Brown9115a6c2005-12-06 16:27:40 -0500105 NULL, /* 0x00, Reserved */
Bob Moore08978312005-10-21 00:00:00 -0400106 acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
107 acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
Len Brown9115a6c2005-12-06 16:27:40 -0500108 NULL, /* 0x03, Reserved */
Bob Moore08978312005-10-21 00:00:00 -0400109 acpi_rs_get_vendor_large, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */
110 acpi_rs_convert_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */
111 acpi_rs_convert_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */
112 acpi_rs_convert_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */
113 acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
114 acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
115 acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
116 acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
Len Brown9115a6c2005-12-06 16:27:40 -0500117};
118
119#ifdef ACPI_FUTURE_USAGE
120#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
121
122/* Dispatch table for resource dump functions */
123
Bob Moore08978312005-10-21 00:00:00 -0400124struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = {
Len Brown9115a6c2005-12-06 16:27:40 -0500125 acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */
126 acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */
127 acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */
128 acpi_rs_dump_end_dpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
129 acpi_rs_dump_io, /* ACPI_RESOURCE_TYPE_IO */
130 acpi_rs_dump_fixed_io, /* ACPI_RESOURCE_TYPE_FIXED_IO */
131 acpi_rs_dump_vendor, /* ACPI_RESOURCE_TYPE_VENDOR */
132 acpi_rs_dump_end_tag, /* ACPI_RESOURCE_TYPE_END_TAG */
133 acpi_rs_dump_memory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */
134 acpi_rs_dump_memory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */
135 acpi_rs_dump_fixed_memory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
136 acpi_rs_dump_address16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */
137 acpi_rs_dump_address32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */
138 acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */
139 acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
140 acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
Bob Moore08978312005-10-21 00:00:00 -0400141 acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
Len Brown9115a6c2005-12-06 16:27:40 -0500142};
143#endif
Bob Moore83135242006-10-03 00:00:00 -0400144
Len Brown9115a6c2005-12-06 16:27:40 -0500145#endif /* ACPI_FUTURE_USAGE */
Len Brown9115a6c2005-12-06 16:27:40 -0500146/*
147 * Base sizes for external AML resource descriptors, indexed by internal type.
148 * Includes size of the descriptor header (1 byte for small descriptors,
149 * 3 bytes for large descriptors)
150 */
Bob Moore08978312005-10-21 00:00:00 -0400151const u8 acpi_gbl_aml_resource_sizes[] = {
Len Brown9115a6c2005-12-06 16:27:40 -0500152 sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */
153 sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */
154 sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */
155 sizeof(struct aml_resource_end_dependent), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
156 sizeof(struct aml_resource_io), /* ACPI_RESOURCE_TYPE_IO */
157 sizeof(struct aml_resource_fixed_io), /* ACPI_RESOURCE_TYPE_FIXED_IO */
158 sizeof(struct aml_resource_vendor_small), /* ACPI_RESOURCE_TYPE_VENDOR */
159 sizeof(struct aml_resource_end_tag), /* ACPI_RESOURCE_TYPE_END_TAG */
160 sizeof(struct aml_resource_memory24), /* ACPI_RESOURCE_TYPE_MEMORY24 */
161 sizeof(struct aml_resource_memory32), /* ACPI_RESOURCE_TYPE_MEMORY32 */
162 sizeof(struct aml_resource_fixed_memory32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
163 sizeof(struct aml_resource_address16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */
164 sizeof(struct aml_resource_address32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */
165 sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */
166 sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
167 sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
168 sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
169};
170
Bob Moore96db2552005-11-02 00:00:00 -0500171const u8 acpi_gbl_resource_struct_sizes[] = {
172 /* Small descriptors */
Len Brown9115a6c2005-12-06 16:27:40 -0500173
Bob Moore96db2552005-11-02 00:00:00 -0500174 0,
175 0,
176 0,
177 0,
178 ACPI_RS_SIZE(struct acpi_resource_irq),
179 ACPI_RS_SIZE(struct acpi_resource_dma),
180 ACPI_RS_SIZE(struct acpi_resource_start_dependent),
181 ACPI_RS_SIZE_MIN,
182 ACPI_RS_SIZE(struct acpi_resource_io),
183 ACPI_RS_SIZE(struct acpi_resource_fixed_io),
184 0,
185 0,
186 0,
187 0,
188 ACPI_RS_SIZE(struct acpi_resource_vendor),
189 ACPI_RS_SIZE_MIN,
Len Brown9115a6c2005-12-06 16:27:40 -0500190
Bob Moore96db2552005-11-02 00:00:00 -0500191 /* Large descriptors */
Len Brown9115a6c2005-12-06 16:27:40 -0500192
Bob Moore96db2552005-11-02 00:00:00 -0500193 0,
194 ACPI_RS_SIZE(struct acpi_resource_memory24),
195 ACPI_RS_SIZE(struct acpi_resource_generic_register),
196 0,
197 ACPI_RS_SIZE(struct acpi_resource_vendor),
198 ACPI_RS_SIZE(struct acpi_resource_memory32),
199 ACPI_RS_SIZE(struct acpi_resource_fixed_memory32),
200 ACPI_RS_SIZE(struct acpi_resource_address32),
201 ACPI_RS_SIZE(struct acpi_resource_address16),
202 ACPI_RS_SIZE(struct acpi_resource_extended_irq),
203 ACPI_RS_SIZE(struct acpi_resource_address64),
204 ACPI_RS_SIZE(struct acpi_resource_extended_address64)
Len Brown9115a6c2005-12-06 16:27:40 -0500205};