1 /*******************************************************************************
3 * Module Name: rsio - IO and DMA resource descriptors
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2013, 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.
50 #define _COMPONENT ACPI_RESOURCES
51 ACPI_MODULE_NAME ("rsio")
54 /*******************************************************************************
58 ******************************************************************************/
60 ACPI_RSCONVERT_INFO AcpiRsConvertIo
[5] =
62 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_IO
,
63 ACPI_RS_SIZE (ACPI_RESOURCE_IO
),
64 ACPI_RSC_TABLE_SIZE (AcpiRsConvertIo
)},
66 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_IO
,
67 sizeof (AML_RESOURCE_IO
),
72 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET (Data
.Io
.IoDecode
),
73 AML_OFFSET (Io
.Flags
),
76 * These fields are contiguous in both the source and destination:
79 * Minimum Base Address
80 * Maximum Base Address
82 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET (Data
.Io
.Alignment
),
83 AML_OFFSET (Io
.Alignment
),
86 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET (Data
.Io
.Minimum
),
87 AML_OFFSET (Io
.Minimum
),
92 /*******************************************************************************
94 * AcpiRsConvertFixedIo
96 ******************************************************************************/
98 ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo
[4] =
100 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_FIXED_IO
,
101 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO
),
102 ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedIo
)},
104 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_FIXED_IO
,
105 sizeof (AML_RESOURCE_FIXED_IO
),
108 * These fields are contiguous in both the source and destination:
112 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET (Data
.FixedIo
.AddressLength
),
113 AML_OFFSET (FixedIo
.AddressLength
),
116 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET (Data
.FixedIo
.Address
),
117 AML_OFFSET (FixedIo
.Address
),
122 /*******************************************************************************
124 * AcpiRsConvertGenericReg
126 ******************************************************************************/
128 ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg
[4] =
130 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_GENERIC_REGISTER
,
131 ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER
),
132 ACPI_RSC_TABLE_SIZE (AcpiRsConvertGenericReg
)},
134 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_GENERIC_REGISTER
,
135 sizeof (AML_RESOURCE_GENERIC_REGISTER
),
138 * These fields are contiguous in both the source and destination:
141 * Register Bit Offset
144 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET (Data
.GenericReg
.SpaceId
),
145 AML_OFFSET (GenericReg
.AddressSpaceId
),
148 /* Get the Register Address */
150 {ACPI_RSC_MOVE64
, ACPI_RS_OFFSET (Data
.GenericReg
.Address
),
151 AML_OFFSET (GenericReg
.Address
),
156 /*******************************************************************************
158 * AcpiRsConvertEndDpf
160 ******************************************************************************/
162 ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf
[2] =
164 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_END_DEPENDENT
,
166 ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndDpf
)},
168 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_END_DEPENDENT
,
169 sizeof (AML_RESOURCE_END_DEPENDENT
),
174 /*******************************************************************************
176 * AcpiRsConvertEndTag
178 ******************************************************************************/
180 ACPI_RSCONVERT_INFO AcpiRsConvertEndTag
[2] =
182 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_END_TAG
,
184 ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndTag
)},
187 * Note: The checksum field is set to zero, meaning that the resource
188 * data is treated as if the checksum operation succeeded.
189 * (ACPI Spec 1.0b Section 6.4.2.8)
191 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_END_TAG
,
192 sizeof (AML_RESOURCE_END_TAG
),
197 /*******************************************************************************
201 ******************************************************************************/
203 ACPI_RSCONVERT_INFO AcpiRsGetStartDpf
[6] =
205 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_START_DEPENDENT
,
206 ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT
),
207 ACPI_RSC_TABLE_SIZE (AcpiRsGetStartDpf
)},
209 /* Defaults for Compatibility and Performance priorities */
211 {ACPI_RSC_SET8
, ACPI_RS_OFFSET (Data
.StartDpf
.CompatibilityPriority
),
212 ACPI_ACCEPTABLE_CONFIGURATION
,
215 /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */
217 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET (Data
.StartDpf
.DescriptorLength
),
218 AML_OFFSET (StartDpf
.DescriptorType
),
221 /* All done if there is no flag byte present in the descriptor */
223 {ACPI_RSC_EXIT_NE
, ACPI_RSC_COMPARE_AML_LENGTH
, 0, 1},
225 /* Flag byte is present, get the flags */
227 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET (Data
.StartDpf
.CompatibilityPriority
),
228 AML_OFFSET (StartDpf
.Flags
),
231 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET (Data
.StartDpf
.PerformanceRobustness
),
232 AML_OFFSET (StartDpf
.Flags
),
237 /*******************************************************************************
241 ******************************************************************************/
243 ACPI_RSCONVERT_INFO AcpiRsSetStartDpf
[10] =
245 /* Start with a default descriptor of length 1 */
247 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_START_DEPENDENT
,
248 sizeof (AML_RESOURCE_START_DEPENDENT
),
249 ACPI_RSC_TABLE_SIZE (AcpiRsSetStartDpf
)},
251 /* Set the default flag values */
253 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET (Data
.StartDpf
.CompatibilityPriority
),
254 AML_OFFSET (StartDpf
.Flags
),
257 {ACPI_RSC_2BITFLAG
, ACPI_RS_OFFSET (Data
.StartDpf
.PerformanceRobustness
),
258 AML_OFFSET (StartDpf
.Flags
),
261 * All done if the output descriptor length is required to be 1
262 * (i.e., optimization to 0 bytes cannot be attempted)
264 {ACPI_RSC_EXIT_EQ
, ACPI_RSC_COMPARE_VALUE
,
265 ACPI_RS_OFFSET(Data
.StartDpf
.DescriptorLength
),
268 /* Set length to 0 bytes (no flags byte) */
270 {ACPI_RSC_LENGTH
, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO
)},
273 * All done if the output descriptor length is required to be 0.
275 * TBD: Perhaps we should check for error if input flags are not
276 * compatible with a 0-byte descriptor.
278 {ACPI_RSC_EXIT_EQ
, ACPI_RSC_COMPARE_VALUE
,
279 ACPI_RS_OFFSET(Data
.StartDpf
.DescriptorLength
),
282 /* Reset length to 1 byte (descriptor with flags byte) */
284 {ACPI_RSC_LENGTH
, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT
)},
288 * All done if flags byte is necessary -- if either priority value
289 * is not ACPI_ACCEPTABLE_CONFIGURATION
291 {ACPI_RSC_EXIT_NE
, ACPI_RSC_COMPARE_VALUE
,
292 ACPI_RS_OFFSET (Data
.StartDpf
.CompatibilityPriority
),
293 ACPI_ACCEPTABLE_CONFIGURATION
},
295 {ACPI_RSC_EXIT_NE
, ACPI_RSC_COMPARE_VALUE
,
296 ACPI_RS_OFFSET (Data
.StartDpf
.PerformanceRobustness
),
297 ACPI_ACCEPTABLE_CONFIGURATION
},
299 /* Flag byte is not necessary */
301 {ACPI_RSC_LENGTH
, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO
)}