ReactOS  0.4.14-dev-552-g2fad488
rsinfo.c
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Module Name: rsinfo - Dispatch and Info tables
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2019, 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 #include "acpi.h"
45 #include "accommon.h"
46 #include "acresrc.h"
47 
48 #define _COMPONENT ACPI_RESOURCES
49  ACPI_MODULE_NAME ("rsinfo")
50 
51 /*
52  * Resource dispatch and information tables. Any new resource types (either
53  * Large or Small) must be reflected in each of these tables, so they are here
54  * in one place.
55  *
56  * The tables for Large descriptors are indexed by bits 6:0 of the AML
57  * descriptor type byte. The tables for Small descriptors are indexed by
58  * bits 6:3 of the descriptor byte. The tables for internal resource
59  * descriptors are indexed by the ACPI_RESOURCE_TYPE field.
60  */
61 
62 
63 /* Dispatch table for resource-to-AML (Set Resource) conversion functions */
64 
66 {
67  AcpiRsSetIrq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */
68  AcpiRsConvertDma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */
69  AcpiRsSetStartDpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */
70  AcpiRsConvertEndDpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */
71  AcpiRsConvertIo, /* 0x04, ACPI_RESOURCE_TYPE_IO */
72  AcpiRsConvertFixedIo, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */
73  AcpiRsSetVendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */
74  AcpiRsConvertEndTag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */
75  AcpiRsConvertMemory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */
76  AcpiRsConvertMemory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */
77  AcpiRsConvertFixedMemory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
78  AcpiRsConvertAddress16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */
79  AcpiRsConvertAddress32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */
80  AcpiRsConvertAddress64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
81  AcpiRsConvertExtAddress64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
82  AcpiRsConvertExtIrq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
83  AcpiRsConvertGenericReg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
84  AcpiRsConvertGpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */
85  AcpiRsConvertFixedDma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */
86  NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */
87  AcpiRsConvertPinFunction, /* 0x14, ACPI_RESOURCE_TYPE_PIN_FUNCTION */
88  AcpiRsConvertPinConfig, /* 0x15, ACPI_RESOURCE_TYPE_PIN_CONFIG */
89  AcpiRsConvertPinGroup, /* 0x16, ACPI_RESOURCE_TYPE_PIN_GROUP */
90  AcpiRsConvertPinGroupFunction, /* 0x17, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */
91  AcpiRsConvertPinGroupConfig, /* 0x18, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */
92 };
93 
94 /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
95 
97 {
98  /* Small descriptors */
99 
100  NULL, /* 0x00, Reserved */
101  NULL, /* 0x01, Reserved */
102  NULL, /* 0x02, Reserved */
103  NULL, /* 0x03, Reserved */
104  AcpiRsGetIrq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */
105  AcpiRsConvertDma, /* 0x05, ACPI_RESOURCE_NAME_DMA */
106  AcpiRsGetStartDpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
107  AcpiRsConvertEndDpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
108  AcpiRsConvertIo, /* 0x08, ACPI_RESOURCE_NAME_IO */
109  AcpiRsConvertFixedIo, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
110  AcpiRsConvertFixedDma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */
111  NULL, /* 0x0B, Reserved */
112  NULL, /* 0x0C, Reserved */
113  NULL, /* 0x0D, Reserved */
114  AcpiRsGetVendorSmall, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
115  AcpiRsConvertEndTag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
116 
117  /* Large descriptors */
118 
119  NULL, /* 0x00, Reserved */
120  AcpiRsConvertMemory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
121  AcpiRsConvertGenericReg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
122  NULL, /* 0x03, Reserved */
123  AcpiRsGetVendorLarge, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */
124  AcpiRsConvertMemory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */
125  AcpiRsConvertFixedMemory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */
126  AcpiRsConvertAddress32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */
127  AcpiRsConvertAddress16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
128  AcpiRsConvertExtIrq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
129  AcpiRsConvertAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
130  AcpiRsConvertExtAddress64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
131  AcpiRsConvertGpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */
132  AcpiRsConvertPinFunction, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */
133  NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */
134  AcpiRsConvertPinConfig, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */
135  AcpiRsConvertPinGroup, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */
136  AcpiRsConvertPinGroupFunction, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */
137  AcpiRsConvertPinGroupConfig, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG */
138 };
139 
140 /* Subtype table for SerialBus -- I2C, SPI, and UART */
141 
143 {
144  NULL,
148 };
149 
150 
151 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER)
152 
153 /* Dispatch table for resource dump functions */
154 
155 ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] =
156 {
157  AcpiRsDumpIrq, /* ACPI_RESOURCE_TYPE_IRQ */
158  AcpiRsDumpDma, /* ACPI_RESOURCE_TYPE_DMA */
159  AcpiRsDumpStartDpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */
160  AcpiRsDumpEndDpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
161  AcpiRsDumpIo, /* ACPI_RESOURCE_TYPE_IO */
162  AcpiRsDumpFixedIo, /* ACPI_RESOURCE_TYPE_FIXED_IO */
163  AcpiRsDumpVendor, /* ACPI_RESOURCE_TYPE_VENDOR */
164  AcpiRsDumpEndTag, /* ACPI_RESOURCE_TYPE_END_TAG */
165  AcpiRsDumpMemory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */
166  AcpiRsDumpMemory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */
167  AcpiRsDumpFixedMemory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
168  AcpiRsDumpAddress16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */
169  AcpiRsDumpAddress32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */
170  AcpiRsDumpAddress64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */
171  AcpiRsDumpExtAddress64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
172  AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
173  AcpiRsDumpGenericReg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
174  AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */
175  AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */
176  NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */
177  AcpiRsDumpPinFunction, /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */
178  AcpiRsDumpPinConfig, /* ACPI_RESOURCE_TYPE_PIN_CONFIG */
179  AcpiRsDumpPinGroup, /* ACPI_RESOURCE_TYPE_PIN_GROUP */
180  AcpiRsDumpPinGroupFunction, /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */
181  AcpiRsDumpPinGroupConfig, /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */
182 };
183 
184 ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] =
185 {
186  NULL,
187  AcpiRsDumpI2cSerialBus, /* AML_RESOURCE_I2C_BUS_TYPE */
188  AcpiRsDumpSpiSerialBus, /* AML_RESOURCE_SPI_BUS_TYPE */
189  AcpiRsDumpUartSerialBus, /* AML_RESOURCE_UART_BUS_TYPE */
190 };
191 #endif
192 
193 
194 /*
195  * Base sizes for external AML resource descriptors, indexed by internal type.
196  * Includes size of the descriptor header (1 byte for small descriptors,
197  * 3 bytes for large descriptors)
198  */
200 {
201  sizeof (AML_RESOURCE_IRQ), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */
202  sizeof (AML_RESOURCE_DMA), /* ACPI_RESOURCE_TYPE_DMA */
203  sizeof (AML_RESOURCE_START_DEPENDENT), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */
204  sizeof (AML_RESOURCE_END_DEPENDENT), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
205  sizeof (AML_RESOURCE_IO), /* ACPI_RESOURCE_TYPE_IO */
206  sizeof (AML_RESOURCE_FIXED_IO), /* ACPI_RESOURCE_TYPE_FIXED_IO */
207  sizeof (AML_RESOURCE_VENDOR_SMALL), /* ACPI_RESOURCE_TYPE_VENDOR */
208  sizeof (AML_RESOURCE_END_TAG), /* ACPI_RESOURCE_TYPE_END_TAG */
209  sizeof (AML_RESOURCE_MEMORY24), /* ACPI_RESOURCE_TYPE_MEMORY24 */
210  sizeof (AML_RESOURCE_MEMORY32), /* ACPI_RESOURCE_TYPE_MEMORY32 */
211  sizeof (AML_RESOURCE_FIXED_MEMORY32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
212  sizeof (AML_RESOURCE_ADDRESS16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */
213  sizeof (AML_RESOURCE_ADDRESS32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */
214  sizeof (AML_RESOURCE_ADDRESS64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */
215  sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
216  sizeof (AML_RESOURCE_EXTENDED_IRQ), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
217  sizeof (AML_RESOURCE_GENERIC_REGISTER), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
218  sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */
219  sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */
220  sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */
221  sizeof (AML_RESOURCE_PIN_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */
222  sizeof (AML_RESOURCE_PIN_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_CONFIG */
223  sizeof (AML_RESOURCE_PIN_GROUP), /* ACPI_RESOURCE_TYPE_PIN_GROUP */
224  sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */
225  sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */
226 };
227 
228 
230 {
231  /* Small descriptors */
232 
233  0,
234  0,
235  0,
236  0,
244  0,
245  0,
246  0,
249 
250  /* Large descriptors */
251 
252  0,
255  0,
271 };
272 
274 {
275  0,
279 };
280 
282 {
283  0,
287 };
ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[]
Definition: rsmemory.c:126
ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[]
Definition: rsserial.c:412
struct aml_resource_start_dependent AML_RESOURCE_START_DEPENDENT
struct aml_resource_generic_register AML_RESOURCE_GENERIC_REGISTER
ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[]
Definition: rsserial.c:596
const UINT8 AcpiGbl_ResourceStructSerialBusSizes[]
Definition: rsinfo.c:281
ACPI_RSCONVERT_INFO AcpiRsGetIrq[]
Definition: rsirq.c:58
struct aml_resource_extended_address64 AML_RESOURCE_EXTENDED_ADDRESS64
struct aml_resource_pin_group AML_RESOURCE_PIN_GROUP
#define ACPI_RS_SIZE(Type)
Definition: acrestyp.h:798
ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[]
Definition: rsaddr.c:178
ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[]
Definition: rsserial.c:228
ACPI_RSCONVERT_INFO AcpiRsConvertDma[]
Definition: rsirq.c:258
const UINT8 AcpiGbl_ResourceStructSizes[]
Definition: rsinfo.c:229
ACPI_RSCONVERT_INFO AcpiRsConvertGpio[]
Definition: rsserial.c:58
ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[]
Definition: rsio.c:96
ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[]
Definition: rsio.c:241
struct aml_resource_irq AML_RESOURCE_IRQ
const UINT8 AcpiGbl_AmlResourceSizes[]
Definition: rsinfo.c:199
struct aml_resource_memory24 AML_RESOURCE_MEMORY24
ACPI_RSCONVERT_INFO * AcpiGbl_GetResourceDispatch[]
Definition: rsinfo.c:96
ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[]
Definition: rsio.c:201
ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[]
Definition: rsirq.c:198
#define ACPI_MODULE_NAME(Name)
Definition: acoutput.h:216
ACPI_RSCONVERT_INFO AcpiRsSetVendor[]
Definition: rsmemory.c:210
ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[]
Definition: rsaddr.c:58
smooth NULL
Definition: ftsmooth.c:416
struct aml_resource_vendor_small AML_RESOURCE_VENDOR_SMALL
ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[]
Definition: rsio.c:178
struct aml_resource_fixed_memory32 AML_RESOURCE_FIXED_MEMORY32
ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[]
Definition: rsserial.c:312
struct aml_resource_pin_group_config AML_RESOURCE_PIN_GROUP_CONFIG
ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[]
Definition: rsmemory.c:158
ACPI_RSCONVERT_INFO AcpiRsSetIrq[]
Definition: rsirq.c:112
ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[]
Definition: rsserial.c:656
const UINT8 AcpiGbl_AmlResourceSerialBusSizes[]
Definition: rsinfo.c:273
struct aml_resource_pin_function AML_RESOURCE_PIN_FUNCTION
ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[]
Definition: rsserial.c:723
struct aml_resource_io AML_RESOURCE_IO
ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[]
Definition: rsmemory.c:184
ACPI_RSCONVERT_INFO * AcpiGbl_SetResourceDispatch[]
Definition: rsinfo.c:65
struct aml_resource_uart_serialbus AML_RESOURCE_UART_SERIALBUS
ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[]
Definition: rsaddr.c:138
ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[]
Definition: rsaddr.c:98
ACPI_RSCONVERT_INFO * AcpiGbl_ConvertResourceSerialBusDispatch[]
Definition: rsinfo.c:142
struct aml_resource_i2c_serialbus AML_RESOURCE_I2C_SERIALBUS
struct aml_resource_fixed_dma AML_RESOURCE_FIXED_DMA
ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[]
Definition: rsserial.c:155
ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[]
Definition: rsio.c:160
struct aml_resource_address32 AML_RESOURCE_ADDRESS32
ACPI_RSCONVERT_INFO AcpiRsConvertIo[]
Definition: rsio.c:58
ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[]
Definition: rsserial.c:520
ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[]
Definition: rsirq.c:296
ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[]
Definition: rsio.c:126
ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[]
Definition: rsmemory.c:92
unsigned char UINT8
#define ACPI_RS_SIZE_MIN
Definition: acrestyp.h:797
ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[]
Definition: rsmemory.c:58