exprep.c revision 126372
1 2/****************************************************************************** 3 * 4 * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities 5 * $Revision: 127 $ 6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * 13 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. 14 * All rights reserved. 15 * 16 * 2. License 17 * 18 * 2.1. This is your license from Intel Corp. under its intellectual property 19 * rights. You may have additional license terms from the party that provided 20 * you this software, covering your right to use that party's intellectual 21 * property rights. 22 * 23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 24 * copy of the source code appearing in this file ("Covered Code") an 25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 26 * base code distributed originally by Intel ("Original Intel Code") to copy, 27 * make derivatives, distribute, use and display any portion of the Covered 28 * Code in any form, with the right to sublicense such rights; and 29 * 30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 31 * license (with the right to sublicense), under only those claims of Intel 32 * patents that are infringed by the Original Intel Code, to make, use, sell, 33 * offer to sell, and import the Covered Code and derivative works thereof 34 * solely to the minimum extent necessary to exercise the above copyright 35 * license, and in no event shall the patent license extend to any additions 36 * to or modifications of the Original Intel Code. No other license or right 37 * is granted directly or by implication, estoppel or otherwise; 38 * 39 * The above copyright and patent license is granted only if the following 40 * conditions are met: 41 * 42 * 3. Conditions 43 * 44 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 45 * Redistribution of source code of any substantial portion of the Covered 46 * Code or modification with rights to further distribute source must include 47 * the above Copyright Notice, the above License, this list of Conditions, 48 * and the following Disclaimer and Export Compliance provision. In addition, 49 * Licensee must cause all Covered Code to which Licensee contributes to 50 * contain a file documenting the changes Licensee made to create that Covered 51 * Code and the date of any change. Licensee must include in that file the 52 * documentation of any changes made by any predecessor Licensee. Licensee 53 * must include a prominent statement that the modification is derived, 54 * directly or indirectly, from Original Intel Code. 55 * 56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 57 * Redistribution of source code of any substantial portion of the Covered 58 * Code or modification without rights to further distribute source must 59 * include the following Disclaimer and Export Compliance provision in the 60 * documentation and/or other materials provided with distribution. In 61 * addition, Licensee may not authorize further sublicense of source of any 62 * portion of the Covered Code, and must include terms to the effect that the 63 * license from Licensee to its licensee is limited to the intellectual 64 * property embodied in the software Licensee provides to its licensee, and 65 * not to intellectual property embodied in modifications its licensee may 66 * make. 67 * 68 * 3.3. Redistribution of Executable. Redistribution in executable form of any 69 * substantial portion of the Covered Code or modification must reproduce the 70 * above Copyright Notice, and the following Disclaimer and Export Compliance 71 * provision in the documentation and/or other materials provided with the 72 * distribution. 73 * 74 * 3.4. Intel retains all right, title, and interest in and to the Original 75 * Intel Code. 76 * 77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 78 * Intel shall be used in advertising or otherwise to promote the sale, use or 79 * other dealings in products derived from or relating to the Covered Code 80 * without prior written authorization from Intel. 81 * 82 * 4. Disclaimer and Export Compliance 83 * 84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 90 * PARTICULAR PURPOSE. 91 * 92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 99 * LIMITED REMEDY. 100 * 101 * 4.3. Licensee shall not export, either directly or indirectly, any of this 102 * software or system incorporating such software without first obtaining any 103 * required license or other approval from the U. S. Department of Commerce or 104 * any other agency or department of the United States Government. In the 105 * event Licensee exports any such software from the United States or 106 * re-exports any such software from a foreign destination, Licensee shall 107 * ensure that the distribution and export/re-export of the software is in 108 * compliance with all laws, regulations, orders, or other restrictions of the 109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 110 * any of its subsidiaries will export/re-export any technical data, process, 111 * software, or service, directly or indirectly, to any country for which the 112 * United States government or any agency thereof requires an export license, 113 * other governmental approval, or letter of assurance, without first obtaining 114 * such license, approval or letter. 115 * 116 *****************************************************************************/ 117 118#define __EXPREP_C__ 119 120#include "acpi.h" 121#include "acinterp.h" 122#include "amlcode.h" 123#include "acnamesp.h" 124 125 126#define _COMPONENT ACPI_EXECUTER 127 ACPI_MODULE_NAME ("exprep") 128 129 130#ifdef ACPI_UNDER_DEVELOPMENT 131/******************************************************************************* 132 * 133 * FUNCTION: AcpiExGenerateAccess 134 * 135 * PARAMETERS: FieldBitOffset - Start of field within parent region/buffer 136 * FieldBitLength - Length of field in bits 137 * RegionLength - Length of parent in bytes 138 * 139 * RETURN: Field granularity (8, 16, 32 or 64) and 140 * ByteAlignment (1, 2, 3, or 4) 141 * 142 * DESCRIPTION: Generate an optimal access width for fields defined with the 143 * AnyAcc keyword. 144 * 145 * NOTE: Need to have the RegionLength in order to check for boundary 146 * conditions (end-of-region). However, the RegionLength is a deferred 147 * operation. Therefore, to complete this implementation, the generation 148 * of this access width must be deferred until the region length has 149 * been evaluated. 150 * 151 ******************************************************************************/ 152 153static UINT32 154AcpiExGenerateAccess ( 155 UINT32 FieldBitOffset, 156 UINT32 FieldBitLength, 157 UINT32 RegionLength) 158{ 159 UINT32 FieldByteLength; 160 UINT32 FieldByteOffset; 161 UINT32 FieldByteEndOffset; 162 UINT32 AccessByteWidth; 163 UINT32 FieldStartOffset; 164 UINT32 FieldEndOffset; 165 UINT32 MinimumAccessWidth = 0xFFFFFFFF; 166 UINT32 MinimumAccesses = 0xFFFFFFFF; 167 UINT32 Accesses; 168 169 170 ACPI_FUNCTION_TRACE ("ExGenerateAccess"); 171 172 173 /* Round Field start offset and length to "minimal" byte boundaries */ 174 175 FieldByteOffset = ACPI_DIV_8 (ACPI_ROUND_DOWN (FieldBitOffset, 8)); 176 FieldByteEndOffset = ACPI_DIV_8 (ACPI_ROUND_UP (FieldBitLength + FieldBitOffset, 8)); 177 FieldByteLength = FieldByteEndOffset - FieldByteOffset; 178 179 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 180 "Bit length %d, Bit offset %d\n", 181 FieldBitLength, FieldBitOffset)); 182 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 183 "Byte Length %d, Byte Offset %d, End Offset %d\n", 184 FieldByteLength, FieldByteOffset, FieldByteEndOffset)); 185 186 /* 187 * Iterative search for the maximum access width that is both aligned 188 * and does not go beyond the end of the region 189 * 190 * Start at ByteAcc and work upwards to QwordAcc max. (1,2,4,8 bytes) 191 */ 192 for (AccessByteWidth = 1; AccessByteWidth <= 8; AccessByteWidth <<= 1) 193 { 194 /* 195 * 1) Round end offset up to next access boundary and make sure that this 196 * does not go beyond the end of the parent region. 197 * 2) When the Access width is greater than the FieldByteLength, we are done. 198 * (This does not optimize for the perfectly aligned case yet). 199 */ 200 if (ACPI_ROUND_UP (FieldByteEndOffset, AccessByteWidth) <= RegionLength) 201 { 202 FieldStartOffset = ACPI_ROUND_DOWN (FieldByteOffset, AccessByteWidth) / 203 AccessByteWidth; 204 FieldEndOffset = ACPI_ROUND_UP ((FieldByteLength + FieldByteOffset), 205 AccessByteWidth) / AccessByteWidth; 206 Accesses = FieldEndOffset - FieldStartOffset; 207 208 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 209 "AccessWidth %d end is within region\n", AccessByteWidth)); 210 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 211 "Field Start %d, Field End %d -- requires %d accesses\n", 212 FieldStartOffset, FieldEndOffset, Accesses)); 213 214 /* Single access is optimal */ 215 216 if (Accesses <= 1) 217 { 218 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 219 "Entire field can be accessed with one operation of size %d\n", 220 AccessByteWidth)); 221 return_VALUE (AccessByteWidth); 222 } 223 224 /* 225 * Fits in the region, but requires more than one read/write. 226 * try the next wider access on next iteration 227 */ 228 if (Accesses < MinimumAccesses) 229 { 230 MinimumAccesses = Accesses; 231 MinimumAccessWidth = AccessByteWidth; 232 } 233 } 234 else 235 { 236 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 237 "AccessWidth %d end is NOT within region\n", AccessByteWidth)); 238 if (AccessByteWidth == 1) 239 { 240 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 241 "Field goes beyond end-of-region!\n")); 242 return_VALUE (0); /* Field does not fit in the region at all */ 243 } 244 245 /* This width goes beyond the end-of-region, back off to previous access */ 246 247 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 248 "Backing off to previous optimal access width of %d\n", 249 MinimumAccessWidth)); 250 return_VALUE (MinimumAccessWidth); 251 } 252 } 253 254 /* Could not read/write field with one operation, just use max access width */ 255 256 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 257 "Cannot access field in one operation, using width 8\n")); 258 return_VALUE (8); 259} 260#endif /* ACPI_UNDER_DEVELOPMENT */ 261 262 263/******************************************************************************* 264 * 265 * FUNCTION: AcpiExDecodeFieldAccess 266 * 267 * PARAMETERS: Access - Encoded field access bits 268 * Length - Field length. 269 * 270 * RETURN: Field granularity (8, 16, 32 or 64) and 271 * ByteAlignment (1, 2, 3, or 4) 272 * 273 * DESCRIPTION: Decode the AccessType bits of a field definition. 274 * 275 ******************************************************************************/ 276 277static UINT32 278AcpiExDecodeFieldAccess ( 279 ACPI_OPERAND_OBJECT *ObjDesc, 280 UINT8 FieldFlags, 281 UINT32 *ReturnByteAlignment) 282{ 283 UINT32 Access; 284 UINT32 ByteAlignment; 285 UINT32 BitLength; 286 287 288 ACPI_FUNCTION_TRACE ("ExDecodeFieldAccess"); 289 290 291 Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK); 292 293 switch (Access) 294 { 295 case AML_FIELD_ACCESS_ANY: 296 297#ifdef ACPI_UNDER_DEVELOPMENT 298 ByteAlignment = AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset, 299 ObjDesc->CommonField.BitLength, 300 0xFFFFFFFF /* Temp until we pass RegionLength as param */); 301 BitLength = ByteAlignment * 8; 302#endif 303 304 ByteAlignment = 1; 305 BitLength = 8; 306 break; 307 308 case AML_FIELD_ACCESS_BYTE: 309 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ 310 ByteAlignment = 1; 311 BitLength = 8; 312 break; 313 314 case AML_FIELD_ACCESS_WORD: 315 ByteAlignment = 2; 316 BitLength = 16; 317 break; 318 319 case AML_FIELD_ACCESS_DWORD: 320 ByteAlignment = 4; 321 BitLength = 32; 322 break; 323 324 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ 325 ByteAlignment = 8; 326 BitLength = 64; 327 break; 328 329 default: 330 /* Invalid field access type */ 331 332 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 333 "Unknown field access type %X\n", 334 Access)); 335 return_VALUE (0); 336 } 337 338 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) 339 { 340 /* 341 * BufferField access can be on any byte boundary, so the 342 * ByteAlignment is always 1 byte -- regardless of any ByteAlignment 343 * implied by the field access type. 344 */ 345 ByteAlignment = 1; 346 } 347 348 *ReturnByteAlignment = ByteAlignment; 349 return_VALUE (BitLength); 350} 351 352 353/******************************************************************************* 354 * 355 * FUNCTION: AcpiExPrepCommonFieldObject 356 * 357 * PARAMETERS: ObjDesc - The field object 358 * FieldFlags - Access, LockRule, and UpdateRule. 359 * The format of a FieldFlag is described 360 * in the ACPI specification 361 * FieldBitPosition - Field start position 362 * FieldBitLength - Field length in number of bits 363 * 364 * RETURN: Status 365 * 366 * DESCRIPTION: Initialize the areas of the field object that are common 367 * to the various types of fields. Note: This is very "sensitive" 368 * code because we are solving the general case for field 369 * alignment. 370 * 371 ******************************************************************************/ 372 373ACPI_STATUS 374AcpiExPrepCommonFieldObject ( 375 ACPI_OPERAND_OBJECT *ObjDesc, 376 UINT8 FieldFlags, 377 UINT8 FieldAttribute, 378 UINT32 FieldBitPosition, 379 UINT32 FieldBitLength) 380{ 381 UINT32 AccessBitWidth; 382 UINT32 ByteAlignment; 383 UINT32 NearestByteAddress; 384 385 386 ACPI_FUNCTION_TRACE ("ExPrepCommonFieldObject"); 387 388 389 /* 390 * Note: the structure being initialized is the 391 * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common 392 * area are initialized by this procedure. 393 */ 394 ObjDesc->CommonField.FieldFlags = FieldFlags; 395 ObjDesc->CommonField.Attribute = FieldAttribute; 396 ObjDesc->CommonField.BitLength = FieldBitLength; 397 398 /* 399 * Decode the access type so we can compute offsets. The access type gives 400 * two pieces of information - the width of each field access and the 401 * necessary ByteAlignment (address granularity) of the access. 402 * 403 * For AnyAcc, the AccessBitWidth is the largest width that is both 404 * necessary and possible in an attempt to access the whole field in one 405 * I/O operation. However, for AnyAcc, the ByteAlignment is always one 406 * byte. 407 * 408 * For all Buffer Fields, the ByteAlignment is always one byte. 409 * 410 * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is 411 * the same (equivalent) as the ByteAlignment. 412 */ 413 AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags, 414 &ByteAlignment); 415 if (!AccessBitWidth) 416 { 417 return_ACPI_STATUS (AE_AML_OPERAND_VALUE); 418 } 419 420 /* Setup width (access granularity) fields */ 421 422 ObjDesc->CommonField.AccessByteWidth = (UINT8) 423 ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */ 424 425 /* 426 * BaseByteOffset is the address of the start of the field within the 427 * region. It is the byte address of the first *datum* (field-width data 428 * unit) of the field. (i.e., the first datum that contains at least the 429 * first *bit* of the field.) 430 * 431 * Note: ByteAlignment is always either equal to the AccessBitWidth or 8 432 * (Byte access), and it defines the addressing granularity of the parent 433 * region or buffer. 434 */ 435 NearestByteAddress = 436 ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); 437 ObjDesc->CommonField.BaseByteOffset = (UINT32) 438 ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment); 439 440 /* 441 * StartFieldBitOffset is the offset of the first bit of the field within 442 * a field datum. 443 */ 444 ObjDesc->CommonField.StartFieldBitOffset = (UINT8) 445 (FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset)); 446 447 /* 448 * Valid bits -- the number of bits that compose a partial datum, 449 * 1) At the end of the field within the region (arbitrary starting bit 450 * offset) 451 * 2) At the end of a buffer used to contain the field (starting offset 452 * always zero) 453 */ 454 ObjDesc->CommonField.EndFieldValidBits = (UINT8) 455 ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) % 456 AccessBitWidth); 457 /* StartBufferBitOffset always = 0 */ 458 459 ObjDesc->CommonField.EndBufferValidBits = (UINT8) 460 (FieldBitLength % AccessBitWidth); 461 462 /* 463 * DatumValidBits is the number of valid field bits in the first 464 * field datum. 465 */ 466 ObjDesc->CommonField.DatumValidBits = (UINT8) 467 (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset); 468 469 /* 470 * Does the entire field fit within a single field access element? (datum) 471 * (i.e., without crossing a datum boundary) 472 */ 473 if ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) <= 474 (UINT16) AccessBitWidth) 475 { 476 ObjDesc->Common.Flags |= AOPOBJ_SINGLE_DATUM; 477 } 478 479 return_ACPI_STATUS (AE_OK); 480} 481 482 483/******************************************************************************* 484 * 485 * FUNCTION: AcpiExPrepFieldValue 486 * 487 * PARAMETERS: Node - Owning Node 488 * RegionNode - Region in which field is being defined 489 * FieldFlags - Access, LockRule, and UpdateRule. 490 * FieldBitPosition - Field start position 491 * FieldBitLength - Field length in number of bits 492 * 493 * RETURN: Status 494 * 495 * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type DefField and 496 * connect it to the parent Node. 497 * 498 ******************************************************************************/ 499 500ACPI_STATUS 501AcpiExPrepFieldValue ( 502 ACPI_CREATE_FIELD_INFO *Info) 503{ 504 ACPI_OPERAND_OBJECT *ObjDesc; 505 UINT32 Type; 506 ACPI_STATUS Status; 507 508 509 ACPI_FUNCTION_TRACE ("ExPrepFieldValue"); 510 511 512 /* Parameter validation */ 513 514 if (Info->FieldType != ACPI_TYPE_LOCAL_INDEX_FIELD) 515 { 516 if (!Info->RegionNode) 517 { 518 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null RegionNode\n")); 519 return_ACPI_STATUS (AE_AML_NO_OPERAND); 520 } 521 522 Type = AcpiNsGetType (Info->RegionNode); 523 if (Type != ACPI_TYPE_REGION) 524 { 525 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 526 "Needed Region, found type %X (%s)\n", 527 Type, AcpiUtGetTypeName (Type))); 528 529 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 530 } 531 } 532 533 /* Allocate a new field object */ 534 535 ObjDesc = AcpiUtCreateInternalObject (Info->FieldType); 536 if (!ObjDesc) 537 { 538 return_ACPI_STATUS (AE_NO_MEMORY); 539 } 540 541 /* Initialize areas of the object that are common to all fields */ 542 543 ObjDesc->CommonField.Node = Info->FieldNode; 544 Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags, 545 Info->Attribute, Info->FieldBitPosition, Info->FieldBitLength); 546 if (ACPI_FAILURE (Status)) 547 { 548 AcpiUtDeleteObjectDesc (ObjDesc); 549 return_ACPI_STATUS (Status); 550 } 551 552 /* Initialize areas of the object that are specific to the field type */ 553 554 switch (Info->FieldType) 555 { 556 case ACPI_TYPE_LOCAL_REGION_FIELD: 557 558 ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); 559 560 /* An additional reference for the container */ 561 562 AcpiUtAddReference (ObjDesc->Field.RegionObj); 563 564 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 565 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", 566 ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset, 567 ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj)); 568 break; 569 570 571 case ACPI_TYPE_LOCAL_BANK_FIELD: 572 573 ObjDesc->BankField.Value = Info->BankValue; 574 ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); 575 ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject (Info->RegisterNode); 576 577 /* An additional reference for the attached objects */ 578 579 AcpiUtAddReference (ObjDesc->BankField.RegionObj); 580 AcpiUtAddReference (ObjDesc->BankField.BankObj); 581 582 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 583 "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n", 584 ObjDesc->BankField.StartFieldBitOffset, 585 ObjDesc->BankField.BaseByteOffset, 586 ObjDesc->Field.AccessByteWidth, 587 ObjDesc->BankField.RegionObj, 588 ObjDesc->BankField.BankObj)); 589 break; 590 591 592 case ACPI_TYPE_LOCAL_INDEX_FIELD: 593 594 ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (Info->RegisterNode); 595 ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (Info->DataRegisterNode); 596 ObjDesc->IndexField.Value = (UINT32) 597 (Info->FieldBitPosition / ACPI_MUL_8 (ObjDesc->Field.AccessByteWidth)); 598 599 if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj) 600 { 601 ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); 602 return_ACPI_STATUS (AE_AML_INTERNAL); 603 } 604 605 /* An additional reference for the attached objects */ 606 607 AcpiUtAddReference (ObjDesc->IndexField.DataObj); 608 AcpiUtAddReference (ObjDesc->IndexField.IndexObj); 609 610 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 611 "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", 612 ObjDesc->IndexField.StartFieldBitOffset, 613 ObjDesc->IndexField.BaseByteOffset, 614 ObjDesc->IndexField.Value, 615 ObjDesc->Field.AccessByteWidth, 616 ObjDesc->IndexField.IndexObj, 617 ObjDesc->IndexField.DataObj)); 618 break; 619 620 default: 621 /* No other types should get here */ 622 break; 623 } 624 625 /* 626 * Store the constructed descriptor (ObjDesc) into the parent Node, 627 * preserving the current type of that NamedObj. 628 */ 629 Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc, 630 AcpiNsGetType (Info->FieldNode)); 631 632 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n", 633 Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc)); 634 635 /* Remove local reference to the object */ 636 637 AcpiUtRemoveReference (ObjDesc); 638 return_ACPI_STATUS (Status); 639} 640 641