ReactOS 0.4.15-dev-7834-g00c4b3d
rsio.c
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Module Name: rsio - IO and DMA resource descriptors
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, 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 MERCHANTABILITY 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 ("rsio")
50
51
52/*******************************************************************************
53 *
54 * AcpiRsConvertIo
55 *
56 ******************************************************************************/
57
59{
63
65 sizeof (AML_RESOURCE_IO),
66 0},
67
68 /* Decode flag */
69
71 AML_OFFSET (Io.Flags),
72 0},
73 /*
74 * These fields are contiguous in both the source and destination:
75 * Address Alignment
76 * Length
77 * Minimum Base Address
78 * Maximum Base Address
79 */
80 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Io.Alignment),
81 AML_OFFSET (Io.Alignment),
82 2},
83
84 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Io.Minimum),
85 AML_OFFSET (Io.Minimum),
86 2}
87};
88
89
90/*******************************************************************************
91 *
92 * AcpiRsConvertFixedIo
93 *
94 ******************************************************************************/
95
97{
101
103 sizeof (AML_RESOURCE_FIXED_IO),
104 0},
105 /*
106 * These fields are contiguous in both the source and destination:
107 * Base Address
108 * Length
109 */
110 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedIo.AddressLength),
111 AML_OFFSET (FixedIo.AddressLength),
112 1},
113
114 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedIo.Address),
115 AML_OFFSET (FixedIo.Address),
116 1}
117};
118
119
120/*******************************************************************************
121 *
122 * AcpiRsConvertGenericReg
123 *
124 ******************************************************************************/
125
127{
131
134 0},
135 /*
136 * These fields are contiguous in both the source and destination:
137 * Address Space ID
138 * Register Bit Width
139 * Register Bit Offset
140 * Access Size
141 */
142 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.GenericReg.SpaceId),
143 AML_OFFSET (GenericReg.AddressSpaceId),
144 4},
145
146 /* Get the Register Address */
147
148 {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.GenericReg.Address),
149 AML_OFFSET (GenericReg.Address),
150 1}
151};
152
153
154/*******************************************************************************
155 *
156 * AcpiRsConvertEndDpf
157 *
158 ******************************************************************************/
159
161{
165
168 0}
169};
170
171
172/*******************************************************************************
173 *
174 * AcpiRsConvertEndTag
175 *
176 ******************************************************************************/
177
179{
183
184 /*
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)
188 */
190 sizeof (AML_RESOURCE_END_TAG),
191 0}
192};
193
194
195/*******************************************************************************
196 *
197 * AcpiRsGetStartDpf
198 *
199 ******************************************************************************/
200
202{
206
207 /* Defaults for Compatibility and Performance priorities */
208
209 {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
211 2},
212
213 /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */
214
215 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.DescriptorLength),
216 AML_OFFSET (StartDpf.DescriptorType),
217 0},
218
219 /* All done if there is no flag byte present in the descriptor */
220
222
223 /* Flag byte is present, get the flags */
224
225 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
226 AML_OFFSET (StartDpf.Flags),
227 0},
228
229 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
230 AML_OFFSET (StartDpf.Flags),
231 2}
232};
233
234
235/*******************************************************************************
236 *
237 * AcpiRsSetStartDpf
238 *
239 ******************************************************************************/
240
242{
243 /* Start with a default descriptor of length 1 */
244
248
249 /* Set the default flag values */
250
251 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
252 AML_OFFSET (StartDpf.Flags),
253 0},
254
255 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
256 AML_OFFSET (StartDpf.Flags),
257 2},
258 /*
259 * All done if the output descriptor length is required to be 1
260 * (i.e., optimization to 0 bytes cannot be attempted)
261 */
263 ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength),
264 1},
265
266 /* Set length to 0 bytes (no flags byte) */
267
269
270 /*
271 * All done if the output descriptor length is required to be 0.
272 *
273 * TBD: Perhaps we should check for error if input flags are not
274 * compatible with a 0-byte descriptor.
275 */
277 ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength),
278 0},
279
280 /* Reset length to 1 byte (descriptor with flags byte) */
281
283
284
285 /*
286 * All done if flags byte is necessary -- if either priority value
287 * is not ACPI_ACCEPTABLE_CONFIGURATION
288 */
290 ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
292
294 ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
296
297 /* Flag byte is not necessary */
298
300};
#define ACPI_RESOURCE_NAME_START_DEPENDENT
Definition: aclocal.h:1314
#define ACPI_RESOURCE_NAME_END_TAG
Definition: aclocal.h:1323
#define ACPI_RESOURCE_NAME_GENERIC_REGISTER
Definition: aclocal.h:1330
#define ACPI_RESOURCE_NAME_IO
Definition: aclocal.h:1316
#define ACPI_RESOURCE_NAME_END_DEPENDENT
Definition: aclocal.h:1315
#define ACPI_RESOURCE_NAME_FIXED_IO
Definition: aclocal.h:1317
#define ACPI_MODULE_NAME(Name)
Definition: acoutput.h:216
#define ACPI_RSC_COMPARE_AML_LENGTH
Definition: acresrc.h:118
@ ACPI_RSC_INITSET
Definition: acresrc.h:81
@ ACPI_RSC_EXIT_NE
Definition: acresrc.h:100
@ ACPI_RSC_MOVE64
Definition: acresrc.h:109
@ ACPI_RSC_2BITFLAG
Definition: acresrc.h:84
@ ACPI_RSC_LENGTH
Definition: acresrc.h:101
@ ACPI_RSC_MOVE8
Definition: acresrc.h:106
@ ACPI_RSC_EXIT_EQ
Definition: acresrc.h:98
@ ACPI_RSC_MOVE16
Definition: acresrc.h:107
@ ACPI_RSC_1BITFLAG
Definition: acresrc.h:83
@ ACPI_RSC_INITGET
Definition: acresrc.h:80
@ ACPI_RSC_SET8
Definition: acresrc.h:110
#define ACPI_RSC_TABLE_SIZE(d)
Definition: acresrc.h:121
#define ACPI_RS_OFFSET(f)
Definition: acresrc.h:123
#define ACPI_RSC_COMPARE_VALUE
Definition: acresrc.h:119
#define AML_OFFSET(f)
Definition: acresrc.h:124
#define ACPI_RS_SIZE_MIN
Definition: acrestyp.h:807
#define ACPI_RESOURCE_TYPE_FIXED_IO
Definition: acrestyp.h:728
#define ACPI_ACCEPTABLE_CONFIGURATION
Definition: acrestyp.h:131
#define ACPI_RESOURCE_TYPE_END_DEPENDENT
Definition: acrestyp.h:726
#define ACPI_RESOURCE_TYPE_END_TAG
Definition: acrestyp.h:730
#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER
Definition: acrestyp.h:739
#define ACPI_RESOURCE_TYPE_START_DEPENDENT
Definition: acrestyp.h:725
#define ACPI_RS_SIZE(Type)
Definition: acrestyp.h:808
#define ACPI_RESOURCE_TYPE_IO
Definition: acrestyp.h:727
struct aml_resource_end_tag AML_RESOURCE_END_TAG
struct aml_resource_start_dependent_noprio AML_RESOURCE_START_DEPENDENT_NOPRIO
struct aml_resource_fixed_io AML_RESOURCE_FIXED_IO
struct aml_resource_generic_register AML_RESOURCE_GENERIC_REGISTER
struct aml_resource_io AML_RESOURCE_IO
struct aml_resource_end_dependent AML_RESOURCE_END_DEPENDENT
struct aml_resource_start_dependent AML_RESOURCE_START_DEPENDENT
ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[4]
Definition: rsio.c:96
ACPI_RSCONVERT_INFO AcpiRsConvertIo[5]
Definition: rsio.c:58
ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[10]
Definition: rsio.c:241
ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[2]
Definition: rsio.c:160
ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[4]
Definition: rsio.c:126
ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[2]
Definition: rsio.c:178
ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[6]
Definition: rsio.c:201