xref: /titanic_44/usr/src/uts/intel/io/acpica/resources/rsinfo.c (revision be468fc6d7266e97f1330ad9a761169925f5f3f1)
1 /*******************************************************************************
2  *
3  * Module Name: rsinfo - Dispatch and Info tables
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2011, 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 #define __RSINFO_C__
45 
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acresrc.h"
49 
50 #define _COMPONENT          ACPI_RESOURCES
51         ACPI_MODULE_NAME    ("rsinfo")
52 
53 /*
54  * Resource dispatch and information tables. Any new resource types (either
55  * Large or Small) must be reflected in each of these tables, so they are here
56  * in one place.
57  *
58  * The tables for Large descriptors are indexed by bits 6:0 of the AML
59  * descriptor type byte. The tables for Small descriptors are indexed by
60  * bits 6:3 of the descriptor byte. The tables for internal resource
61  * descriptors are indexed by the ACPI_RESOURCE_TYPE field.
62  */
63 
64 
65 /* Dispatch table for resource-to-AML (Set Resource) conversion functions */
66 
67 ACPI_RSCONVERT_INFO         *AcpiGbl_SetResourceDispatch[] =
68 {
69     AcpiRsSetIrq,                   /* 0x00, ACPI_RESOURCE_TYPE_IRQ */
70     AcpiRsConvertDma,               /* 0x01, ACPI_RESOURCE_TYPE_DMA */
71     AcpiRsSetStartDpf,              /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */
72     AcpiRsConvertEndDpf,            /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */
73     AcpiRsConvertIo,                /* 0x04, ACPI_RESOURCE_TYPE_IO */
74     AcpiRsConvertFixedIo,           /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */
75     AcpiRsSetVendor,                /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */
76     AcpiRsConvertEndTag,            /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */
77     AcpiRsConvertMemory24,          /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */
78     AcpiRsConvertMemory32,          /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */
79     AcpiRsConvertFixedMemory32,     /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
80     AcpiRsConvertAddress16,         /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */
81     AcpiRsConvertAddress32,         /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */
82     AcpiRsConvertAddress64,         /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
83     AcpiRsConvertExtAddress64,      /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
84     AcpiRsConvertExtIrq,            /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
85     AcpiRsConvertGenericReg         /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
86 };
87 
88 /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
89 
90 ACPI_RSCONVERT_INFO         *AcpiGbl_GetResourceDispatch[] =
91 {
92     /* Small descriptors */
93 
94     NULL,                           /* 0x00, Reserved */
95     NULL,                           /* 0x01, Reserved */
96     NULL,                           /* 0x02, Reserved */
97     NULL,                           /* 0x03, Reserved */
98     AcpiRsGetIrq,                   /* 0x04, ACPI_RESOURCE_NAME_IRQ */
99     AcpiRsConvertDma,               /* 0x05, ACPI_RESOURCE_NAME_DMA */
100     AcpiRsGetStartDpf,              /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
101     AcpiRsConvertEndDpf,            /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
102     AcpiRsConvertIo,                /* 0x08, ACPI_RESOURCE_NAME_IO */
103     AcpiRsConvertFixedIo,           /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
104     NULL,                           /* 0x0A, Reserved */
105     NULL,                           /* 0x0B, Reserved */
106     NULL,                           /* 0x0C, Reserved */
107     NULL,                           /* 0x0D, Reserved */
108     AcpiRsGetVendorSmall,           /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
109     AcpiRsConvertEndTag,            /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
110 
111     /* Large descriptors */
112 
113     NULL,                           /* 0x00, Reserved */
114     AcpiRsConvertMemory24,          /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
115     AcpiRsConvertGenericReg,        /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
116     NULL,                           /* 0x03, Reserved */
117     AcpiRsGetVendorLarge,           /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */
118     AcpiRsConvertMemory32,          /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */
119     AcpiRsConvertFixedMemory32,     /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */
120     AcpiRsConvertAddress32,         /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */
121     AcpiRsConvertAddress16,         /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
122     AcpiRsConvertExtIrq,            /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
123     AcpiRsConvertAddress64,         /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
124     AcpiRsConvertExtAddress64       /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
125 };
126 
127 
128 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
129 
130 /* Dispatch table for resource dump functions */
131 
132 ACPI_RSDUMP_INFO            *AcpiGbl_DumpResourceDispatch[] =
133 {
134     AcpiRsDumpIrq,                  /* ACPI_RESOURCE_TYPE_IRQ */
135     AcpiRsDumpDma,                  /* ACPI_RESOURCE_TYPE_DMA */
136     AcpiRsDumpStartDpf,             /* ACPI_RESOURCE_TYPE_START_DEPENDENT */
137     AcpiRsDumpEndDpf,               /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
138     AcpiRsDumpIo,                   /* ACPI_RESOURCE_TYPE_IO */
139     AcpiRsDumpFixedIo,              /* ACPI_RESOURCE_TYPE_FIXED_IO */
140     AcpiRsDumpVendor,               /* ACPI_RESOURCE_TYPE_VENDOR */
141     AcpiRsDumpEndTag,               /* ACPI_RESOURCE_TYPE_END_TAG */
142     AcpiRsDumpMemory24,             /* ACPI_RESOURCE_TYPE_MEMORY24 */
143     AcpiRsDumpMemory32,             /* ACPI_RESOURCE_TYPE_MEMORY32 */
144     AcpiRsDumpFixedMemory32,        /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
145     AcpiRsDumpAddress16,            /* ACPI_RESOURCE_TYPE_ADDRESS16 */
146     AcpiRsDumpAddress32,            /* ACPI_RESOURCE_TYPE_ADDRESS32 */
147     AcpiRsDumpAddress64,            /* ACPI_RESOURCE_TYPE_ADDRESS64 */
148     AcpiRsDumpExtAddress64,         /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
149     AcpiRsDumpExtIrq,               /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
150     AcpiRsDumpGenericReg,           /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
151 };
152 #endif
153 
154 
155 /*
156  * Base sizes for external AML resource descriptors, indexed by internal type.
157  * Includes size of the descriptor header (1 byte for small descriptors,
158  * 3 bytes for large descriptors)
159  */
160 const UINT8                 AcpiGbl_AmlResourceSizes[] =
161 {
162     sizeof (AML_RESOURCE_IRQ),              /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */
163     sizeof (AML_RESOURCE_DMA),              /* ACPI_RESOURCE_TYPE_DMA */
164     sizeof (AML_RESOURCE_START_DEPENDENT),  /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */
165     sizeof (AML_RESOURCE_END_DEPENDENT),    /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
166     sizeof (AML_RESOURCE_IO),               /* ACPI_RESOURCE_TYPE_IO */
167     sizeof (AML_RESOURCE_FIXED_IO),         /* ACPI_RESOURCE_TYPE_FIXED_IO */
168     sizeof (AML_RESOURCE_VENDOR_SMALL),     /* ACPI_RESOURCE_TYPE_VENDOR */
169     sizeof (AML_RESOURCE_END_TAG),          /* ACPI_RESOURCE_TYPE_END_TAG */
170     sizeof (AML_RESOURCE_MEMORY24),         /* ACPI_RESOURCE_TYPE_MEMORY24 */
171     sizeof (AML_RESOURCE_MEMORY32),         /* ACPI_RESOURCE_TYPE_MEMORY32 */
172     sizeof (AML_RESOURCE_FIXED_MEMORY32),   /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
173     sizeof (AML_RESOURCE_ADDRESS16),        /* ACPI_RESOURCE_TYPE_ADDRESS16 */
174     sizeof (AML_RESOURCE_ADDRESS32),        /* ACPI_RESOURCE_TYPE_ADDRESS32 */
175     sizeof (AML_RESOURCE_ADDRESS64),        /* ACPI_RESOURCE_TYPE_ADDRESS64 */
176     sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
177     sizeof (AML_RESOURCE_EXTENDED_IRQ),     /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
178     sizeof (AML_RESOURCE_GENERIC_REGISTER)  /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
179 };
180 
181 
182 const UINT8                 AcpiGbl_ResourceStructSizes[] =
183 {
184     /* Small descriptors */
185 
186     0,
187     0,
188     0,
189     0,
190     ACPI_RS_SIZE (ACPI_RESOURCE_IRQ),
191     ACPI_RS_SIZE (ACPI_RESOURCE_DMA),
192     ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT),
193     ACPI_RS_SIZE_MIN,
194     ACPI_RS_SIZE (ACPI_RESOURCE_IO),
195     ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO),
196     0,
197     0,
198     0,
199     0,
200     ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
201     ACPI_RS_SIZE_MIN,
202 
203     /* Large descriptors */
204 
205     0,
206     ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24),
207     ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER),
208     0,
209     ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
210     ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32),
211     ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32),
212     ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32),
213     ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16),
214     ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ),
215     ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64),
216     ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64)
217 };
218 
219