1 /*******************************************************************************
3 * Module Name: rsio - IO and DMA resource descriptors
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2015, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acresrc.h>
48 #define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsio")
52 /*******************************************************************************
56 ******************************************************************************/
58 ACPI_RSCONVERT_INFO AcpiRsConvertIo[5] =
60 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO,
61 ACPI_RS_SIZE (ACPI_RESOURCE_IO),
62 ACPI_RSC_TABLE_SIZE (AcpiRsConvertIo)},
64 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO,
65 sizeof (AML_RESOURCE_IO),
70 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Io.IoDecode),
71 AML_OFFSET (Io.Flags),
74 * These fields are contiguous in both the source and destination:
77 * Minimum Base Address
78 * Maximum Base Address
80 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Io.Alignment),
81 AML_OFFSET (Io.Alignment),
84 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Io.Minimum),
85 AML_OFFSET (Io.Minimum),
90 /*******************************************************************************
92 * AcpiRsConvertFixedIo
94 ******************************************************************************/
96 ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[4] =
98 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO,
99 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO),
100 ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedIo)},
102 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO,
103 sizeof (AML_RESOURCE_FIXED_IO),
106 * These fields are contiguous in both the source and destination:
110 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedIo.AddressLength),
111 AML_OFFSET (FixedIo.AddressLength),
114 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedIo.Address),
115 AML_OFFSET (FixedIo.Address),
120 /*******************************************************************************
122 * AcpiRsConvertGenericReg
124 ******************************************************************************/
126 ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[4] =
128 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER,
129 ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER),
130 ACPI_RSC_TABLE_SIZE (AcpiRsConvertGenericReg)},
132 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER,
133 sizeof (AML_RESOURCE_GENERIC_REGISTER),
136 * These fields are contiguous in both the source and destination:
139 * Register Bit Offset
142 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.GenericReg.SpaceId),
143 AML_OFFSET (GenericReg.AddressSpaceId),
146 /* Get the Register Address */
148 {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.GenericReg.Address),
149 AML_OFFSET (GenericReg.Address),
154 /*******************************************************************************
156 * AcpiRsConvertEndDpf
158 ******************************************************************************/
160 ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[2] =
162 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT,
164 ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndDpf)},
166 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT,
167 sizeof (AML_RESOURCE_END_DEPENDENT),
172 /*******************************************************************************
174 * AcpiRsConvertEndTag
176 ******************************************************************************/
178 ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[2] =
180 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG,
182 ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndTag)},
185 * Note: The checksum field is set to zero, meaning that the resource
186 * data is treated as if the checksum operation succeeded.
187 * (ACPI Spec 1.0b Section 6.4.2.8)
189 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG,
190 sizeof (AML_RESOURCE_END_TAG),
195 /*******************************************************************************
199 ******************************************************************************/
201 ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[6] =
203 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT,
204 ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT),
205 ACPI_RSC_TABLE_SIZE (AcpiRsGetStartDpf)},
207 /* Defaults for Compatibility and Performance priorities */
209 {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
210 ACPI_ACCEPTABLE_CONFIGURATION,
213 /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */
215 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.DescriptorLength),
216 AML_OFFSET (StartDpf.DescriptorType),
219 /* All done if there is no flag byte present in the descriptor */
221 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1},
223 /* Flag byte is present, get the flags */
225 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
226 AML_OFFSET (StartDpf.Flags),
229 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
230 AML_OFFSET (StartDpf.Flags),
235 /*******************************************************************************
239 ******************************************************************************/
241 ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[10] =
243 /* Start with a default descriptor of length 1 */
245 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT,
246 sizeof (AML_RESOURCE_START_DEPENDENT),
247 ACPI_RSC_TABLE_SIZE (AcpiRsSetStartDpf)},
249 /* Set the default flag values */
251 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
252 AML_OFFSET (StartDpf.Flags),
255 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
256 AML_OFFSET (StartDpf.Flags),
259 * All done if the output descriptor length is required to be 1
260 * (i.e., optimization to 0 bytes cannot be attempted)
262 {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE,
263 ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength),
266 /* Set length to 0 bytes (no flags byte) */
268 {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)},
271 * All done if the output descriptor length is required to be 0.
273 * TBD: Perhaps we should check for error if input flags are not
274 * compatible with a 0-byte descriptor.
276 {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE,
277 ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength),
280 /* Reset length to 1 byte (descriptor with flags byte) */
282 {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT)},
286 * All done if flags byte is necessary -- if either priority value
287 * is not ACPI_ACCEPTABLE_CONFIGURATION
289 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
290 ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
291 ACPI_ACCEPTABLE_CONFIGURATION},
293 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
294 ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
295 ACPI_ACCEPTABLE_CONFIGURATION},
297 /* Flag byte is not necessary */
299 {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)}