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/executer/exprep.c
+++ new/usr/src/common/acpica/components/executer/exprep.c
1 -
2 1 /******************************************************************************
3 2 *
4 3 * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
5 4 *
6 5 *****************************************************************************/
7 6
8 7 /*
9 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
10 9 * All rights reserved.
11 10 *
12 11 * Redistribution and use in source and binary forms, with or without
13 12 * modification, are permitted provided that the following conditions
14 13 * are met:
15 14 * 1. Redistributions of source code must retain the above copyright
16 15 * notice, this list of conditions, and the following disclaimer,
17 16 * without modification.
18 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 18 * substantially similar to the "NO WARRANTY" disclaimer below
20 19 * ("Disclaimer") and any redistribution must be conditioned upon
21 20 * including a substantially similar Disclaimer requirement for further
22 21 * binary redistribution.
23 22 * 3. Neither the names of the above-listed copyright holders nor the names
24 23 * of any contributors may be used to endorse or promote products derived
25 24 * from this software without specific prior written permission.
26 25 *
27 26 * Alternatively, this software may be distributed under the terms of the
28 27 * GNU General Public License ("GPL") version 2 as published by the Free
29 28 * Software Foundation.
30 29 *
31 30 * NO WARRANTY
32 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
42 41 * POSSIBILITY OF SUCH DAMAGES.
43 42 */
44 43
45 44 #define __EXPREP_C__
46 45
47 46 #include "acpi.h"
48 47 #include "accommon.h"
49 48 #include "acinterp.h"
50 49 #include "amlcode.h"
51 50 #include "acnamesp.h"
51 +#include "acdispat.h"
52 52
53 53
54 54 #define _COMPONENT ACPI_EXECUTER
55 55 ACPI_MODULE_NAME ("exprep")
56 56
57 57 /* Local prototypes */
58 58
59 59 static UINT32
60 60 AcpiExDecodeFieldAccess (
61 61 ACPI_OPERAND_OBJECT *ObjDesc,
62 62 UINT8 FieldFlags,
63 63 UINT32 *ReturnByteAlignment);
64 64
65 65
66 66 #ifdef ACPI_UNDER_DEVELOPMENT
67 67
68 68 static UINT32
69 69 AcpiExGenerateAccess (
70 70 UINT32 FieldBitOffset,
71 71 UINT32 FieldBitLength,
72 72 UINT32 RegionLength);
73 73
74 74 /*******************************************************************************
75 75 *
76 76 * FUNCTION: AcpiExGenerateAccess
77 77 *
78 78 * PARAMETERS: FieldBitOffset - Start of field within parent region/buffer
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
79 79 * FieldBitLength - Length of field in bits
80 80 * RegionLength - Length of parent in bytes
81 81 *
82 82 * RETURN: Field granularity (8, 16, 32 or 64) and
83 83 * ByteAlignment (1, 2, 3, or 4)
84 84 *
85 85 * DESCRIPTION: Generate an optimal access width for fields defined with the
86 86 * AnyAcc keyword.
87 87 *
88 88 * NOTE: Need to have the RegionLength in order to check for boundary
89 - * conditions (end-of-region). However, the RegionLength is a deferred
90 - * operation. Therefore, to complete this implementation, the generation
89 + * conditions (end-of-region). However, the RegionLength is a deferred
90 + * operation. Therefore, to complete this implementation, the generation
91 91 * of this access width must be deferred until the region length has
92 92 * been evaluated.
93 93 *
94 94 ******************************************************************************/
95 95
96 96 static UINT32
97 97 AcpiExGenerateAccess (
98 98 UINT32 FieldBitOffset,
99 99 UINT32 FieldBitLength,
100 100 UINT32 RegionLength)
101 101 {
102 102 UINT32 FieldByteLength;
103 103 UINT32 FieldByteOffset;
104 104 UINT32 FieldByteEndOffset;
105 105 UINT32 AccessByteWidth;
106 106 UINT32 FieldStartOffset;
107 107 UINT32 FieldEndOffset;
108 108 UINT32 MinimumAccessWidth = 0xFFFFFFFF;
109 109 UINT32 MinimumAccesses = 0xFFFFFFFF;
110 110 UINT32 Accesses;
111 111
112 112
113 113 ACPI_FUNCTION_TRACE (ExGenerateAccess);
114 114
115 115
116 116 /* Round Field start offset and length to "minimal" byte boundaries */
117 117
118 118 FieldByteOffset = ACPI_DIV_8 (ACPI_ROUND_DOWN (FieldBitOffset, 8));
119 119 FieldByteEndOffset = ACPI_DIV_8 (ACPI_ROUND_UP (FieldBitLength +
120 120 FieldBitOffset, 8));
121 121 FieldByteLength = FieldByteEndOffset - FieldByteOffset;
122 122
123 123 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
124 124 "Bit length %u, Bit offset %u\n",
125 125 FieldBitLength, FieldBitOffset));
126 126
127 127 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
128 128 "Byte Length %u, Byte Offset %u, End Offset %u\n",
129 129 FieldByteLength, FieldByteOffset, FieldByteEndOffset));
130 130
131 131 /*
132 132 * Iterative search for the maximum access width that is both aligned
133 133 * and does not go beyond the end of the region
134 134 *
135 135 * Start at ByteAcc and work upwards to QwordAcc max. (1,2,4,8 bytes)
136 136 */
137 137 for (AccessByteWidth = 1; AccessByteWidth <= 8; AccessByteWidth <<= 1)
138 138 {
139 139 /*
140 140 * 1) Round end offset up to next access boundary and make sure that
141 141 * this does not go beyond the end of the parent region.
142 142 * 2) When the Access width is greater than the FieldByteLength, we
143 143 * are done. (This does not optimize for the perfectly aligned
144 144 * case yet).
145 145 */
146 146 if (ACPI_ROUND_UP (FieldByteEndOffset, AccessByteWidth) <= RegionLength)
147 147 {
148 148 FieldStartOffset =
149 149 ACPI_ROUND_DOWN (FieldByteOffset, AccessByteWidth) /
150 150 AccessByteWidth;
151 151
152 152 FieldEndOffset =
153 153 ACPI_ROUND_UP ((FieldByteLength + FieldByteOffset),
154 154 AccessByteWidth) / AccessByteWidth;
155 155
156 156 Accesses = FieldEndOffset - FieldStartOffset;
157 157
158 158 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
159 159 "AccessWidth %u end is within region\n", AccessByteWidth));
160 160
161 161 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
162 162 "Field Start %u, Field End %u -- requires %u accesses\n",
163 163 FieldStartOffset, FieldEndOffset, Accesses));
164 164
165 165 /* Single access is optimal */
166 166
167 167 if (Accesses <= 1)
168 168 {
169 169 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
170 170 "Entire field can be accessed with one operation of size %u\n",
171 171 AccessByteWidth));
172 172 return_VALUE (AccessByteWidth);
173 173 }
174 174
175 175 /*
176 176 * Fits in the region, but requires more than one read/write.
177 177 * try the next wider access on next iteration
178 178 */
179 179 if (Accesses < MinimumAccesses)
180 180 {
181 181 MinimumAccesses = Accesses;
182 182 MinimumAccessWidth = AccessByteWidth;
183 183 }
184 184 }
185 185 else
186 186 {
187 187 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
188 188 "AccessWidth %u end is NOT within region\n", AccessByteWidth));
189 189 if (AccessByteWidth == 1)
190 190 {
191 191 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
192 192 "Field goes beyond end-of-region!\n"));
193 193
194 194 /* Field does not fit in the region at all */
195 195
196 196 return_VALUE (0);
197 197 }
198 198
199 199 /*
200 200 * This width goes beyond the end-of-region, back off to
201 201 * previous access
202 202 */
203 203 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
204 204 "Backing off to previous optimal access width of %u\n",
205 205 MinimumAccessWidth));
206 206 return_VALUE (MinimumAccessWidth);
207 207 }
208 208 }
209 209
210 210 /*
211 211 * Could not read/write field with one operation,
212 212 * just use max access width
213 213 */
214 214 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
215 215 "Cannot access field in one operation, using width 8\n"));
216 216 return_VALUE (8);
217 217 }
218 218 #endif /* ACPI_UNDER_DEVELOPMENT */
219 219
220 220
221 221 /*******************************************************************************
222 222 *
223 223 * FUNCTION: AcpiExDecodeFieldAccess
224 224 *
225 225 * PARAMETERS: ObjDesc - Field object
226 226 * FieldFlags - Encoded fieldflags (contains access bits)
227 227 * ReturnByteAlignment - Where the byte alignment is returned
228 228 *
229 229 * RETURN: Field granularity (8, 16, 32 or 64) and
230 230 * ByteAlignment (1, 2, 3, or 4)
231 231 *
232 232 * DESCRIPTION: Decode the AccessType bits of a field definition.
233 233 *
234 234 ******************************************************************************/
235 235
236 236 static UINT32
237 237 AcpiExDecodeFieldAccess (
238 238 ACPI_OPERAND_OBJECT *ObjDesc,
239 239 UINT8 FieldFlags,
240 240 UINT32 *ReturnByteAlignment)
241 241 {
242 242 UINT32 Access;
243 243 UINT32 ByteAlignment;
244 244 UINT32 BitLength;
245 245
246 246
247 247 ACPI_FUNCTION_TRACE (ExDecodeFieldAccess);
248 248
249 249
250 250 Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
251 251
252 252 switch (Access)
253 253 {
254 254 case AML_FIELD_ACCESS_ANY:
255 255
256 256 #ifdef ACPI_UNDER_DEVELOPMENT
257 257 ByteAlignment =
258 258 AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset,
259 259 ObjDesc->CommonField.BitLength,
↓ open down ↓ |
159 lines elided |
↑ open up ↑ |
260 260 0xFFFFFFFF /* Temp until we pass RegionLength as parameter */);
261 261 BitLength = ByteAlignment * 8;
262 262 #endif
263 263
264 264 ByteAlignment = 1;
265 265 BitLength = 8;
266 266 break;
267 267
268 268 case AML_FIELD_ACCESS_BYTE:
269 269 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
270 +
270 271 ByteAlignment = 1;
271 272 BitLength = 8;
272 273 break;
273 274
274 275 case AML_FIELD_ACCESS_WORD:
276 +
275 277 ByteAlignment = 2;
276 278 BitLength = 16;
277 279 break;
278 280
279 281 case AML_FIELD_ACCESS_DWORD:
282 +
280 283 ByteAlignment = 4;
281 284 BitLength = 32;
282 285 break;
283 286
284 287 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
288 +
285 289 ByteAlignment = 8;
286 290 BitLength = 64;
287 291 break;
288 292
289 293 default:
294 +
290 295 /* Invalid field access type */
291 296
292 297 ACPI_ERROR ((AE_INFO,
293 298 "Unknown field access type 0x%X",
294 299 Access));
295 300 return_UINT32 (0);
296 301 }
297 302
298 303 if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
299 304 {
300 305 /*
301 306 * BufferField access can be on any byte boundary, so the
302 307 * ByteAlignment is always 1 byte -- regardless of any ByteAlignment
303 308 * implied by the field access type.
304 309 */
305 310 ByteAlignment = 1;
306 311 }
307 312
308 313 *ReturnByteAlignment = ByteAlignment;
309 314 return_UINT32 (BitLength);
310 315 }
311 316
312 317
313 318 /*******************************************************************************
314 319 *
315 320 * FUNCTION: AcpiExPrepCommonFieldObject
316 321 *
317 322 * PARAMETERS: ObjDesc - The field object
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
318 323 * FieldFlags - Access, LockRule, and UpdateRule.
319 324 * The format of a FieldFlag is described
320 325 * in the ACPI specification
321 326 * FieldAttribute - Special attributes (not used)
322 327 * FieldBitPosition - Field start position
323 328 * FieldBitLength - Field length in number of bits
324 329 *
325 330 * RETURN: Status
326 331 *
327 332 * DESCRIPTION: Initialize the areas of the field object that are common
328 - * to the various types of fields. Note: This is very "sensitive"
333 + * to the various types of fields. Note: This is very "sensitive"
329 334 * code because we are solving the general case for field
330 335 * alignment.
331 336 *
332 337 ******************************************************************************/
333 338
334 339 ACPI_STATUS
335 340 AcpiExPrepCommonFieldObject (
336 341 ACPI_OPERAND_OBJECT *ObjDesc,
337 342 UINT8 FieldFlags,
338 343 UINT8 FieldAttribute,
339 344 UINT32 FieldBitPosition,
340 345 UINT32 FieldBitLength)
341 346 {
342 347 UINT32 AccessBitWidth;
343 348 UINT32 ByteAlignment;
344 349 UINT32 NearestByteAddress;
345 350
346 351
347 352 ACPI_FUNCTION_TRACE (ExPrepCommonFieldObject);
348 353
349 354
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
350 355 /*
351 356 * Note: the structure being initialized is the
352 357 * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common
353 358 * area are initialized by this procedure.
354 359 */
355 360 ObjDesc->CommonField.FieldFlags = FieldFlags;
356 361 ObjDesc->CommonField.Attribute = FieldAttribute;
357 362 ObjDesc->CommonField.BitLength = FieldBitLength;
358 363
359 364 /*
360 - * Decode the access type so we can compute offsets. The access type gives
365 + * Decode the access type so we can compute offsets. The access type gives
361 366 * two pieces of information - the width of each field access and the
362 367 * necessary ByteAlignment (address granularity) of the access.
363 368 *
364 369 * For AnyAcc, the AccessBitWidth is the largest width that is both
365 370 * necessary and possible in an attempt to access the whole field in one
366 - * I/O operation. However, for AnyAcc, the ByteAlignment is always one
371 + * I/O operation. However, for AnyAcc, the ByteAlignment is always one
367 372 * byte.
368 373 *
369 374 * For all Buffer Fields, the ByteAlignment is always one byte.
370 375 *
371 376 * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
372 377 * the same (equivalent) as the ByteAlignment.
373 378 */
374 379 AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags,
375 380 &ByteAlignment);
376 381 if (!AccessBitWidth)
377 382 {
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
378 383 return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
379 384 }
380 385
381 386 /* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */
382 387
383 388 ObjDesc->CommonField.AccessByteWidth = (UINT8)
384 389 ACPI_DIV_8 (AccessBitWidth);
385 390
386 391 /*
387 392 * BaseByteOffset is the address of the start of the field within the
388 - * region. It is the byte address of the first *datum* (field-width data
393 + * region. It is the byte address of the first *datum* (field-width data
389 394 * unit) of the field. (i.e., the first datum that contains at least the
390 395 * first *bit* of the field.)
391 396 *
392 397 * Note: ByteAlignment is always either equal to the AccessBitWidth or 8
393 398 * (Byte access), and it defines the addressing granularity of the parent
394 399 * region or buffer.
395 400 */
396 401 NearestByteAddress =
397 402 ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
398 403 ObjDesc->CommonField.BaseByteOffset = (UINT32)
399 404 ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
400 405
401 406 /*
402 407 * StartFieldBitOffset is the offset of the first bit of the field within
403 408 * a field datum.
404 409 */
405 410 ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
406 411 (FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
407 412
408 413 return_ACPI_STATUS (AE_OK);
409 414 }
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
410 415
411 416
412 417 /*******************************************************************************
413 418 *
414 419 * FUNCTION: AcpiExPrepFieldValue
415 420 *
416 421 * PARAMETERS: Info - Contains all field creation info
417 422 *
418 423 * RETURN: Status
419 424 *
420 - * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type DefField and
421 - * connect it to the parent Node.
425 + * DESCRIPTION: Construct an object of type ACPI_OPERAND_OBJECT with a
426 + * subtype of DefField and connect it to the parent Node.
422 427 *
423 428 ******************************************************************************/
424 429
425 430 ACPI_STATUS
426 431 AcpiExPrepFieldValue (
427 432 ACPI_CREATE_FIELD_INFO *Info)
428 433 {
429 434 ACPI_OPERAND_OBJECT *ObjDesc;
430 435 ACPI_OPERAND_OBJECT *SecondDesc = NULL;
431 436 ACPI_STATUS Status;
432 437 UINT32 AccessByteWidth;
433 438 UINT32 Type;
434 439
435 440
436 441 ACPI_FUNCTION_TRACE (ExPrepFieldValue);
437 442
438 443
439 444 /* Parameter validation */
440 445
441 446 if (Info->FieldType != ACPI_TYPE_LOCAL_INDEX_FIELD)
442 447 {
443 448 if (!Info->RegionNode)
444 449 {
445 450 ACPI_ERROR ((AE_INFO, "Null RegionNode"));
446 451 return_ACPI_STATUS (AE_AML_NO_OPERAND);
447 452 }
448 453
449 454 Type = AcpiNsGetType (Info->RegionNode);
450 455 if (Type != ACPI_TYPE_REGION)
451 456 {
452 457 ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)",
453 458 Type, AcpiUtGetTypeName (Type)));
454 459
455 460 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
456 461 }
457 462 }
458 463
459 464 /* Allocate a new field object */
460 465
461 466 ObjDesc = AcpiUtCreateInternalObject (Info->FieldType);
462 467 if (!ObjDesc)
463 468 {
464 469 return_ACPI_STATUS (AE_NO_MEMORY);
465 470 }
466 471
467 472 /* Initialize areas of the object that are common to all fields */
468 473
469 474 ObjDesc->CommonField.Node = Info->FieldNode;
470 475 Status = AcpiExPrepCommonFieldObject (ObjDesc,
471 476 Info->FieldFlags, Info->Attribute,
472 477 Info->FieldBitPosition, Info->FieldBitLength);
473 478 if (ACPI_FAILURE (Status))
474 479 {
475 480 AcpiUtDeleteObjectDesc (ObjDesc);
476 481 return_ACPI_STATUS (Status);
↓ open down ↓ |
45 lines elided |
↑ open up ↑ |
477 482 }
478 483
479 484 /* Initialize areas of the object that are specific to the field type */
480 485
481 486 switch (Info->FieldType)
482 487 {
483 488 case ACPI_TYPE_LOCAL_REGION_FIELD:
484 489
485 490 ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
486 491
492 + /* Fields specific to GenericSerialBus fields */
493 +
494 + ObjDesc->Field.AccessLength = Info->AccessLength;
495 +
496 + if (Info->ConnectionNode)
497 + {
498 + SecondDesc = Info->ConnectionNode->Object;
499 + if (!(SecondDesc->Common.Flags & AOPOBJ_DATA_VALID))
500 + {
501 + Status = AcpiDsGetBufferArguments (SecondDesc);
502 + if (ACPI_FAILURE (Status))
503 + {
504 + AcpiUtDeleteObjectDesc (ObjDesc);
505 + return_ACPI_STATUS (Status);
506 + }
507 + }
508 +
509 + ObjDesc->Field.ResourceBuffer = SecondDesc->Buffer.Pointer;
510 + ObjDesc->Field.ResourceLength = (UINT16) SecondDesc->Buffer.Length;
511 + }
512 + else if (Info->ResourceBuffer)
513 + {
514 + ObjDesc->Field.ResourceBuffer = Info->ResourceBuffer;
515 + ObjDesc->Field.ResourceLength = Info->ResourceLength;
516 + }
517 +
487 518 /* Allow full data read from EC address space */
488 519
489 520 if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
490 521 (ObjDesc->CommonField.BitLength > 8))
491 522 {
492 523 AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES (
493 524 ObjDesc->CommonField.BitLength);
494 525
495 526 /* Maximum byte width supported is 255 */
496 527
497 528 if (AccessByteWidth < 256)
498 529 {
499 530 ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth;
500 531 }
501 532 }
502 533
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
503 534 /* An additional reference for the container */
504 535
505 536 AcpiUtAddReference (ObjDesc->Field.RegionObj);
506 537
507 538 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
508 539 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
509 540 ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,
510 541 ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
511 542 break;
512 543
513 -
514 544 case ACPI_TYPE_LOCAL_BANK_FIELD:
515 545
516 546 ObjDesc->BankField.Value = Info->BankValue;
517 547 ObjDesc->BankField.RegionObj =
518 548 AcpiNsGetAttachedObject (Info->RegionNode);
519 549 ObjDesc->BankField.BankObj =
520 550 AcpiNsGetAttachedObject (Info->RegisterNode);
521 551
522 552 /* An additional reference for the attached objects */
523 553
524 554 AcpiUtAddReference (ObjDesc->BankField.RegionObj);
525 555 AcpiUtAddReference (ObjDesc->BankField.BankObj);
526 556
527 557 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
528 558 "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n",
529 559 ObjDesc->BankField.StartFieldBitOffset,
530 560 ObjDesc->BankField.BaseByteOffset,
531 561 ObjDesc->Field.AccessByteWidth,
532 562 ObjDesc->BankField.RegionObj,
533 563 ObjDesc->BankField.BankObj));
534 564
535 565 /*
536 566 * Remember location in AML stream of the field unit
537 567 * opcode and operands -- since the BankValue
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
538 568 * operands must be evaluated.
539 569 */
540 570 SecondDesc = ObjDesc->Common.NextObject;
541 571 SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
542 572 Info->DataRegisterNode)->Named.Data;
543 573 SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
544 574 Info->DataRegisterNode)->Named.Length;
545 575
546 576 break;
547 577
548 -
549 578 case ACPI_TYPE_LOCAL_INDEX_FIELD:
550 579
551 580 /* Get the Index and Data registers */
552 581
553 582 ObjDesc->IndexField.IndexObj =
554 583 AcpiNsGetAttachedObject (Info->RegisterNode);
555 584 ObjDesc->IndexField.DataObj =
556 585 AcpiNsGetAttachedObject (Info->DataRegisterNode);
557 586
558 587 if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
559 588 {
560 589 ACPI_ERROR ((AE_INFO, "Null Index Object during field prep"));
561 590 AcpiUtDeleteObjectDesc (ObjDesc);
562 591 return_ACPI_STATUS (AE_AML_INTERNAL);
563 592 }
564 593
565 594 /* An additional reference for the attached objects */
566 595
567 596 AcpiUtAddReference (ObjDesc->IndexField.DataObj);
568 597 AcpiUtAddReference (ObjDesc->IndexField.IndexObj);
569 598
570 599 /*
571 600 * April 2006: Changed to match MS behavior
572 601 *
573 602 * The value written to the Index register is the byte offset of the
574 603 * target field in units of the granularity of the IndexField
575 604 *
576 605 * Previously, the value was calculated as an index in terms of the
577 606 * width of the Data register, as below:
578 607 *
579 608 * ObjDesc->IndexField.Value = (UINT32)
580 609 * (Info->FieldBitPosition / ACPI_MUL_8 (
581 610 * ObjDesc->Field.AccessByteWidth));
582 611 *
583 612 * February 2006: Tried value as a byte offset:
584 613 * ObjDesc->IndexField.Value = (UINT32)
585 614 * ACPI_DIV_8 (Info->FieldBitPosition);
586 615 */
587 616 ObjDesc->IndexField.Value = (UINT32) ACPI_ROUND_DOWN (
588 617 ACPI_DIV_8 (Info->FieldBitPosition),
589 618 ObjDesc->IndexField.AccessByteWidth);
590 619
591 620 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
592 621 "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
593 622 ObjDesc->IndexField.StartFieldBitOffset,
594 623 ObjDesc->IndexField.BaseByteOffset,
595 624 ObjDesc->IndexField.Value,
596 625 ObjDesc->Field.AccessByteWidth,
597 626 ObjDesc->IndexField.IndexObj,
598 627 ObjDesc->IndexField.DataObj));
599 628 break;
600 629
601 630 default:
631 +
602 632 /* No other types should get here */
633 +
603 634 break;
604 635 }
605 636
606 637 /*
607 638 * Store the constructed descriptor (ObjDesc) into the parent Node,
608 639 * preserving the current type of that NamedObj.
609 640 */
610 641 Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
611 642 AcpiNsGetType (Info->FieldNode));
612 643
613 644 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n",
614 645 Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc));
615 646
616 647 /* Remove local reference to the object */
617 648
618 649 AcpiUtRemoveReference (ObjDesc);
619 650 return_ACPI_STATUS (Status);
620 651 }
621 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX