Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/resources/rsaddr.c
+++ new/usr/src/common/acpica/components/resources/rsaddr.c
1 1 /*******************************************************************************
2 2 *
3 3 * Module Name: rsaddr - Address resource descriptors (16/32/64)
4 4 *
5 5 ******************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44 #define __RSADDR_C__
45 45
46 46 #include "acpi.h"
47 47 #include "accommon.h"
48 48 #include "acresrc.h"
49 49
50 50 #define _COMPONENT ACPI_RESOURCES
51 51 ACPI_MODULE_NAME ("rsaddr")
52 52
53 53
54 54 /*******************************************************************************
55 55 *
56 56 * AcpiRsConvertAddress16 - All WORD (16-bit) address resources
57 57 *
58 58 ******************************************************************************/
59 59
60 60 ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[5] =
61 61 {
62 62 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16,
63 63 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16),
64 64 ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress16)},
65 65
66 66 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16,
67 67 sizeof (AML_RESOURCE_ADDRESS16),
68 68 0},
69 69
70 70 /* Resource Type, General Flags, and Type-Specific Flags */
71 71
72 72 {ACPI_RSC_ADDRESS, 0, 0, 0},
73 73
74 74 /*
75 75 * These fields are contiguous in both the source and destination:
76 76 * Address Granularity
77 77 * Address Range Minimum
78 78 * Address Range Maximum
79 79 * Address Translation Offset
80 80 * Address Length
81 81 */
82 82 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Address16.Granularity),
83 83 AML_OFFSET (Address16.Granularity),
84 84 5},
85 85
86 86 /* Optional ResourceSource (Index and String) */
87 87
88 88 {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address16.ResourceSource),
89 89 0,
90 90 sizeof (AML_RESOURCE_ADDRESS16)}
91 91 };
92 92
93 93
94 94 /*******************************************************************************
95 95 *
96 96 * AcpiRsConvertAddress32 - All DWORD (32-bit) address resources
97 97 *
98 98 ******************************************************************************/
99 99
100 100 ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[5] =
101 101 {
102 102 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32,
103 103 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32),
104 104 ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress32)},
105 105
106 106 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32,
107 107 sizeof (AML_RESOURCE_ADDRESS32),
108 108 0},
109 109
110 110 /* Resource Type, General Flags, and Type-Specific Flags */
111 111
112 112 {ACPI_RSC_ADDRESS, 0, 0, 0},
113 113
114 114 /*
115 115 * These fields are contiguous in both the source and destination:
116 116 * Address Granularity
117 117 * Address Range Minimum
118 118 * Address Range Maximum
119 119 * Address Translation Offset
120 120 * Address Length
121 121 */
122 122 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Address32.Granularity),
123 123 AML_OFFSET (Address32.Granularity),
124 124 5},
125 125
126 126 /* Optional ResourceSource (Index and String) */
127 127
128 128 {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address32.ResourceSource),
129 129 0,
130 130 sizeof (AML_RESOURCE_ADDRESS32)}
131 131 };
132 132
133 133
134 134 /*******************************************************************************
135 135 *
136 136 * AcpiRsConvertAddress64 - All QWORD (64-bit) address resources
137 137 *
138 138 ******************************************************************************/
139 139
140 140 ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[5] =
141 141 {
142 142 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64,
143 143 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64),
144 144 ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress64)},
145 145
146 146 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64,
147 147 sizeof (AML_RESOURCE_ADDRESS64),
148 148 0},
149 149
150 150 /* Resource Type, General Flags, and Type-Specific Flags */
151 151
152 152 {ACPI_RSC_ADDRESS, 0, 0, 0},
153 153
154 154 /*
155 155 * These fields are contiguous in both the source and destination:
156 156 * Address Granularity
157 157 * Address Range Minimum
158 158 * Address Range Maximum
159 159 * Address Translation Offset
160 160 * Address Length
161 161 */
162 162 {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.Address64.Granularity),
163 163 AML_OFFSET (Address64.Granularity),
164 164 5},
165 165
166 166 /* Optional ResourceSource (Index and String) */
167 167
168 168 {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address64.ResourceSource),
169 169 0,
170 170 sizeof (AML_RESOURCE_ADDRESS64)}
171 171 };
172 172
173 173
174 174 /*******************************************************************************
175 175 *
176 176 * AcpiRsConvertExtAddress64 - All Extended (64-bit) address resources
177 177 *
178 178 ******************************************************************************/
179 179
180 180 ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[5] =
181 181 {
182 182 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64,
183 183 ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64),
184 184 ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtAddress64)},
185 185
186 186 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
187 187 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),
188 188 0},
189 189
190 190 /* Resource Type, General Flags, and Type-Specific Flags */
191 191
192 192 {ACPI_RSC_ADDRESS, 0, 0, 0},
193 193
194 194 /* Revision ID */
195 195
196 196 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.ExtAddress64.RevisionID),
197 197 AML_OFFSET (ExtAddress64.RevisionID),
198 198 1},
199 199 /*
200 200 * These fields are contiguous in both the source and destination:
201 201 * Address Granularity
202 202 * Address Range Minimum
203 203 * Address Range Maximum
204 204 * Address Translation Offset
205 205 * Address Length
206 206 * Type-Specific Attribute
207 207 */
208 208 {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.ExtAddress64.Granularity),
209 209 AML_OFFSET (ExtAddress64.Granularity),
210 210 6}
211 211 };
212 212
213 213
214 214 /*******************************************************************************
215 215 *
216 216 * AcpiRsConvertGeneralFlags - Flags common to all address descriptors
217 217 *
218 218 ******************************************************************************/
219 219
220 220 static ACPI_RSCONVERT_INFO AcpiRsConvertGeneralFlags[6] =
221 221 {
222 222 {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.Flags),
223 223 ACPI_RSC_TABLE_SIZE (AcpiRsConvertGeneralFlags)},
224 224
225 225 /* Resource Type (Memory, Io, BusNumber, etc.) */
226 226
227 227 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Address.ResourceType),
228 228 AML_OFFSET (Address.ResourceType),
229 229 1},
230 230
231 231 /* General Flags - Consume, Decode, MinFixed, MaxFixed */
232 232
233 233 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.ProducerConsumer),
234 234 AML_OFFSET (Address.Flags),
235 235 0},
236 236
237 237 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Decode),
238 238 AML_OFFSET (Address.Flags),
239 239 1},
240 240
241 241 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MinAddressFixed),
242 242 AML_OFFSET (Address.Flags),
243 243 2},
244 244
245 245 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MaxAddressFixed),
246 246 AML_OFFSET (Address.Flags),
247 247 3}
248 248 };
249 249
250 250
251 251 /*******************************************************************************
252 252 *
253 253 * AcpiRsConvertMemFlags - Flags common to Memory address descriptors
254 254 *
255 255 ******************************************************************************/
256 256
257 257 static ACPI_RSCONVERT_INFO AcpiRsConvertMemFlags[5] =
258 258 {
259 259 {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags),
260 260 ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemFlags)},
261 261
262 262 /* Memory-specific flags */
263 263
264 264 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.WriteProtect),
265 265 AML_OFFSET (Address.SpecificFlags),
266 266 0},
267 267
268 268 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Caching),
269 269 AML_OFFSET (Address.SpecificFlags),
270 270 1},
271 271
272 272 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.RangeType),
273 273 AML_OFFSET (Address.SpecificFlags),
274 274 3},
275 275
276 276 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Translation),
277 277 AML_OFFSET (Address.SpecificFlags),
278 278 5}
279 279 };
280 280
281 281
282 282 /*******************************************************************************
283 283 *
284 284 * AcpiRsConvertIoFlags - Flags common to I/O address descriptors
285 285 *
286 286 ******************************************************************************/
287 287
288 288 static ACPI_RSCONVERT_INFO AcpiRsConvertIoFlags[4] =
289 289 {
290 290 {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags),
291 291 ACPI_RSC_TABLE_SIZE (AcpiRsConvertIoFlags)},
292 292
293 293 /* I/O-specific flags */
294 294
295 295 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.RangeType),
296 296 AML_OFFSET (Address.SpecificFlags),
297 297 0},
298 298
299 299 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.Translation),
300 300 AML_OFFSET (Address.SpecificFlags),
301 301 4},
302 302
303 303 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.TranslationType),
304 304 AML_OFFSET (Address.SpecificFlags),
305 305 5}
306 306 };
307 307
308 308
309 309 /*******************************************************************************
310 310 *
311 311 * FUNCTION: AcpiRsGetAddressCommon
312 312 *
313 313 * PARAMETERS: Resource - Pointer to the internal resource struct
314 314 * Aml - Pointer to the AML resource descriptor
315 315 *
316 316 * RETURN: TRUE if the ResourceType field is OK, FALSE otherwise
317 317 *
318 318 * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
319 319 * to an internal resource descriptor
320 320 *
321 321 ******************************************************************************/
322 322
323 323 BOOLEAN
324 324 AcpiRsGetAddressCommon (
325 325 ACPI_RESOURCE *Resource,
326 326 AML_RESOURCE *Aml)
327 327 {
328 328 ACPI_FUNCTION_ENTRY ();
329 329
330 330
331 331 /* Validate the Resource Type */
332 332
333 333 if ((Aml->Address.ResourceType > 2) && (Aml->Address.ResourceType < 0xC0))
334 334 {
335 335 return (FALSE);
336 336 }
337 337
338 338 /* Get the Resource Type and General Flags */
339 339
340 340 (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertGeneralFlags);
341 341
342 342 /* Get the Type-Specific Flags (Memory and I/O descriptors only) */
343 343
344 344 if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
345 345 {
346 346 (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertMemFlags);
347 347 }
348 348 else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
349 349 {
350 350 (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertIoFlags);
351 351 }
352 352 else
353 353 {
354 354 /* Generic resource type, just grab the TypeSpecific byte */
355 355
356 356 Resource->Data.Address.Info.TypeSpecific = Aml->Address.SpecificFlags;
357 357 }
358 358
359 359 return (TRUE);
360 360 }
361 361
362 362
363 363 /*******************************************************************************
364 364 *
365 365 * FUNCTION: AcpiRsSetAddressCommon
366 366 *
367 367 * PARAMETERS: Aml - Pointer to the AML resource descriptor
368 368 * Resource - Pointer to the internal resource struct
369 369 *
370 370 * RETURN: None
371 371 *
372 372 * DESCRIPTION: Convert common flag fields from a resource descriptor to an
373 373 * AML descriptor
374 374 *
375 375 ******************************************************************************/
376 376
377 377 void
378 378 AcpiRsSetAddressCommon (
379 379 AML_RESOURCE *Aml,
380 380 ACPI_RESOURCE *Resource)
381 381 {
382 382 ACPI_FUNCTION_ENTRY ();
383 383
384 384
385 385 /* Set the Resource Type and General Flags */
386 386
387 387 (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertGeneralFlags);
388 388
389 389 /* Set the Type-Specific Flags (Memory and I/O descriptors only) */
390 390
391 391 if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
392 392 {
393 393 (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertMemFlags);
394 394 }
395 395 else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
↓ open down ↓ |
377 lines elided |
↑ open up ↑ |
396 396 {
397 397 (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertIoFlags);
398 398 }
399 399 else
400 400 {
401 401 /* Generic resource type, just copy the TypeSpecific byte */
402 402
403 403 Aml->Address.SpecificFlags = Resource->Data.Address.Info.TypeSpecific;
404 404 }
405 405 }
406 -
407 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX