1 /****************************************************************************** 2 * 3 * Module Name: exfield - ACPI AML (p-code) execution - field manipulation 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 *****************************************************************************/ 115 116 #include "acpi.h" 117 #include "accommon.h" 118 #include "acdispat.h" 119 #include "acinterp.h" 120 #include "amlcode.h" 121 122 123 #define _COMPONENT ACPI_EXECUTER 124 ACPI_MODULE_NAME ("exfield") 125 126 /* Local prototypes */ 127 128 static UINT32 129 AcpiExGetSerialAccessLength ( 130 UINT32 AccessorType, 131 UINT32 AccessLength); 132 133 134 /******************************************************************************* 135 * 136 * FUNCTION: AcpiExGetSerialAccessLength 137 * 138 * PARAMETERS: AccessorType - The type of the protocol indicated by region 139 * field access attributes 140 * AccessLength - The access length of the region field 141 * 142 * RETURN: Decoded access length 143 * 144 * DESCRIPTION: This routine returns the length of the GenericSerialBus 145 * protocol bytes 146 * 147 ******************************************************************************/ 148 149 static UINT32 150 AcpiExGetSerialAccessLength ( 151 UINT32 AccessorType, 152 UINT32 AccessLength) 153 { 154 UINT32 Length; 155 156 157 switch (AccessorType) 158 { 159 case AML_FIELD_ATTRIB_QUICK: 160 161 Length = 0; 162 break; 163 164 case AML_FIELD_ATTRIB_SEND_RCV: 165 case AML_FIELD_ATTRIB_BYTE: 166 167 Length = 1; 168 break; 169 170 case AML_FIELD_ATTRIB_WORD: 171 case AML_FIELD_ATTRIB_WORD_CALL: 172 173 Length = 2; 174 break; 175 176 case AML_FIELD_ATTRIB_MULTIBYTE: 177 case AML_FIELD_ATTRIB_RAW_BYTES: 178 case AML_FIELD_ATTRIB_RAW_PROCESS: 179 180 Length = AccessLength; 181 break; 182 183 case AML_FIELD_ATTRIB_BLOCK: 184 case AML_FIELD_ATTRIB_BLOCK_CALL: 185 default: 186 187 Length = ACPI_GSBUS_BUFFER_SIZE - 2; 188 break; 189 } 190 191 return (Length); 192 } 193 194 195 /******************************************************************************* 196 * 197 * FUNCTION: AcpiExReadDataFromField 198 * 199 * PARAMETERS: WalkState - Current execution state 200 * ObjDesc - The named field 201 * RetBufferDesc - Where the return data object is stored 202 * 203 * RETURN: Status 204 * 205 * DESCRIPTION: Read from a named field. Returns either an Integer or a 206 * Buffer, depending on the size of the field. 207 * 208 ******************************************************************************/ 209 210 ACPI_STATUS 211 AcpiExReadDataFromField ( 212 ACPI_WALK_STATE *WalkState, 213 ACPI_OPERAND_OBJECT *ObjDesc, 214 ACPI_OPERAND_OBJECT **RetBufferDesc) 215 { 216 ACPI_STATUS Status; 217 ACPI_OPERAND_OBJECT *BufferDesc; 218 ACPI_SIZE Length; 219 void *Buffer; 220 UINT32 Function; 221 UINT16 AccessorType; 222 223 224 ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); 225 226 227 /* Parameter validation */ 228 229 if (!ObjDesc) 230 { 231 return_ACPI_STATUS (AE_AML_NO_OPERAND); 232 } 233 if (!RetBufferDesc) 234 { 235 return_ACPI_STATUS (AE_BAD_PARAMETER); 236 } 237 238 if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) 239 { 240 /* 241 * If the BufferField arguments have not been previously evaluated, 242 * evaluate them now and save the results. 243 */ 244 if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) 245 { 246 Status = AcpiDsGetBufferFieldArguments (ObjDesc); 247 if (ACPI_FAILURE (Status)) 248 { 249 return_ACPI_STATUS (Status); 250 } 251 } 252 } 253 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 254 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || 255 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || 256 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) 257 { 258 /* 259 * This is an SMBus, GSBus or IPMI read. We must create a buffer to 260 * hold the data and then directly access the region handler. 261 * 262 * Note: SMBus and GSBus protocol value is passed in upper 16-bits 263 * of Function 264 */ 265 if (ObjDesc->Field.RegionObj->Region.SpaceId == 266 ACPI_ADR_SPACE_SMBUS) 267 { 268 Length = ACPI_SMBUS_BUFFER_SIZE; 269 Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); 270 } 271 else if (ObjDesc->Field.RegionObj->Region.SpaceId == 272 ACPI_ADR_SPACE_GSBUS) 273 { 274 AccessorType = ObjDesc->Field.Attribute; 275 Length = AcpiExGetSerialAccessLength ( 276 AccessorType, ObjDesc->Field.AccessLength); 277 278 /* 279 * Add additional 2 bytes for the GenericSerialBus data buffer: 280 * 281 * Status; (Byte 0 of the data buffer) 282 * Length; (Byte 1 of the data buffer) 283 * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) 284 */ 285 Length += 2; 286 Function = ACPI_READ | (AccessorType << 16); 287 } 288 else /* IPMI */ 289 { 290 Length = ACPI_IPMI_BUFFER_SIZE; 291 Function = ACPI_READ; 292 } 293 294 BufferDesc = AcpiUtCreateBufferObject (Length); 295 if (!BufferDesc) 296 { 297 return_ACPI_STATUS (AE_NO_MEMORY); 298 } 299 300 /* Lock entire transaction if requested */ 301 302 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 303 304 /* Call the region handler for the read */ 305 306 Status = AcpiExAccessRegion (ObjDesc, 0, 307 ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), Function); 308 309 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 310 goto Exit; 311 } 312 313 /* 314 * Allocate a buffer for the contents of the field. 315 * 316 * If the field is larger than the current integer width, create 317 * a BUFFER to hold it. Otherwise, use an INTEGER. This allows 318 * the use of arithmetic operators on the returned value if the 319 * field size is equal or smaller than an Integer. 320 * 321 * Note: Field.length is in bits. 322 */ 323 Length = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( 324 ObjDesc->Field.BitLength); 325 326 if (Length > AcpiGbl_IntegerByteWidth) 327 { 328 /* Field is too large for an Integer, create a Buffer instead */ 329 330 BufferDesc = AcpiUtCreateBufferObject (Length); 331 if (!BufferDesc) 332 { 333 return_ACPI_STATUS (AE_NO_MEMORY); 334 } 335 Buffer = BufferDesc->Buffer.Pointer; 336 } 337 else 338 { 339 /* Field will fit within an Integer (normal case) */ 340 341 BufferDesc = AcpiUtCreateIntegerObject ((UINT64) 0); 342 if (!BufferDesc) 343 { 344 return_ACPI_STATUS (AE_NO_MEMORY); 345 } 346 347 Length = AcpiGbl_IntegerByteWidth; 348 Buffer = &BufferDesc->Integer.Value; 349 } 350 351 if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 352 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) 353 { 354 /* 355 * For GPIO (GeneralPurposeIo), the Address will be the bit offset 356 * from the previous Connection() operator, making it effectively a 357 * pin number index. The BitLength is the length of the field, which 358 * is thus the number of pins. 359 */ 360 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 361 "GPIO FieldRead [FROM]: Pin %u Bits %u\n", 362 ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); 363 364 /* Lock entire transaction if requested */ 365 366 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 367 368 /* Perform the write */ 369 370 Status = AcpiExAccessRegion ( 371 ObjDesc, 0, (UINT64 *) Buffer, ACPI_READ); 372 373 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 374 if (ACPI_FAILURE (Status)) 375 { 376 AcpiUtRemoveReference (BufferDesc); 377 } 378 else 379 { 380 *RetBufferDesc = BufferDesc; 381 } 382 return_ACPI_STATUS (Status); 383 } 384 385 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 386 "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", 387 ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length)); 388 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 389 "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", 390 ObjDesc->CommonField.BitLength, 391 ObjDesc->CommonField.StartFieldBitOffset, 392 ObjDesc->CommonField.BaseByteOffset)); 393 394 /* Lock entire transaction if requested */ 395 396 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 397 398 /* Read from the field */ 399 400 Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length); 401 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 402 403 404 Exit: 405 if (ACPI_FAILURE (Status)) 406 { 407 AcpiUtRemoveReference (BufferDesc); 408 } 409 else 410 { 411 *RetBufferDesc = BufferDesc; 412 } 413 414 return_ACPI_STATUS (Status); 415 } 416 417 418 /******************************************************************************* 419 * 420 * FUNCTION: AcpiExWriteDataToField 421 * 422 * PARAMETERS: SourceDesc - Contains data to write 423 * ObjDesc - The named field 424 * ResultDesc - Where the return value is returned, if any 425 * 426 * RETURN: Status 427 * 428 * DESCRIPTION: Write to a named field 429 * 430 ******************************************************************************/ 431 432 ACPI_STATUS 433 AcpiExWriteDataToField ( 434 ACPI_OPERAND_OBJECT *SourceDesc, 435 ACPI_OPERAND_OBJECT *ObjDesc, 436 ACPI_OPERAND_OBJECT **ResultDesc) 437 { 438 ACPI_STATUS Status; 439 UINT32 Length; 440 void *Buffer; 441 ACPI_OPERAND_OBJECT *BufferDesc; 442 UINT32 Function; 443 UINT16 AccessorType; 444 445 446 ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); 447 448 449 /* Parameter validation */ 450 451 if (!SourceDesc || !ObjDesc) 452 { 453 return_ACPI_STATUS (AE_AML_NO_OPERAND); 454 } 455 456 if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) 457 { 458 /* 459 * If the BufferField arguments have not been previously evaluated, 460 * evaluate them now and save the results. 461 */ 462 if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) 463 { 464 Status = AcpiDsGetBufferFieldArguments (ObjDesc); 465 if (ACPI_FAILURE (Status)) 466 { 467 return_ACPI_STATUS (Status); 468 } 469 } 470 } 471 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 472 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || 473 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || 474 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) 475 { 476 /* 477 * This is an SMBus, GSBus or IPMI write. We will bypass the entire 478 * field mechanism and handoff the buffer directly to the handler. 479 * For these address spaces, the buffer is bi-directional; on a 480 * write, return data is returned in the same buffer. 481 * 482 * Source must be a buffer of sufficient size: 483 * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or 484 * ACPI_IPMI_BUFFER_SIZE. 485 * 486 * Note: SMBus and GSBus protocol type is passed in upper 16-bits 487 * of Function 488 */ 489 if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) 490 { 491 ACPI_ERROR ((AE_INFO, 492 "SMBus/IPMI/GenericSerialBus write requires " 493 "Buffer, found type %s", 494 AcpiUtGetObjectTypeName (SourceDesc))); 495 496 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 497 } 498 499 if (ObjDesc->Field.RegionObj->Region.SpaceId == 500 ACPI_ADR_SPACE_SMBUS) 501 { 502 Length = ACPI_SMBUS_BUFFER_SIZE; 503 Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); 504 } 505 else if (ObjDesc->Field.RegionObj->Region.SpaceId == 506 ACPI_ADR_SPACE_GSBUS) 507 { 508 AccessorType = ObjDesc->Field.Attribute; 509 Length = AcpiExGetSerialAccessLength ( 510 AccessorType, ObjDesc->Field.AccessLength); 511 512 /* 513 * Add additional 2 bytes for the GenericSerialBus data buffer: 514 * 515 * Status; (Byte 0 of the data buffer) 516 * Length; (Byte 1 of the data buffer) 517 * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) 518 */ 519 Length += 2; 520 Function = ACPI_WRITE | (AccessorType << 16); 521 } 522 else /* IPMI */ 523 { 524 Length = ACPI_IPMI_BUFFER_SIZE; 525 Function = ACPI_WRITE; 526 } 527 528 if (SourceDesc->Buffer.Length < Length) 529 { 530 ACPI_ERROR ((AE_INFO, 531 "SMBus/IPMI/GenericSerialBus write requires " 532 "Buffer of length %u, found length %u", 533 Length, SourceDesc->Buffer.Length)); 534 535 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); 536 } 537 538 /* Create the bi-directional buffer */ 539 540 BufferDesc = AcpiUtCreateBufferObject (Length); 541 if (!BufferDesc) 542 { 543 return_ACPI_STATUS (AE_NO_MEMORY); 544 } 545 546 Buffer = BufferDesc->Buffer.Pointer; 547 memcpy (Buffer, SourceDesc->Buffer.Pointer, Length); 548 549 /* Lock entire transaction if requested */ 550 551 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 552 553 /* 554 * Perform the write (returns status and perhaps data in the 555 * same buffer) 556 */ 557 Status = AcpiExAccessRegion ( 558 ObjDesc, 0, (UINT64 *) Buffer, Function); 559 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 560 561 *ResultDesc = BufferDesc; 562 return_ACPI_STATUS (Status); 563 } 564 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 565 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) 566 { 567 /* 568 * For GPIO (GeneralPurposeIo), we will bypass the entire field 569 * mechanism and handoff the bit address and bit width directly to 570 * the handler. The Address will be the bit offset 571 * from the previous Connection() operator, making it effectively a 572 * pin number index. The BitLength is the length of the field, which 573 * is thus the number of pins. 574 */ 575 if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) 576 { 577 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 578 } 579 580 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 581 "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", 582 AcpiUtGetTypeName (SourceDesc->Common.Type), 583 SourceDesc->Common.Type, (UINT32) SourceDesc->Integer.Value, 584 ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); 585 586 Buffer = &SourceDesc->Integer.Value; 587 588 /* Lock entire transaction if requested */ 589 590 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 591 592 /* Perform the write */ 593 594 Status = AcpiExAccessRegion ( 595 ObjDesc, 0, (UINT64 *) Buffer, ACPI_WRITE); 596 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 597 return_ACPI_STATUS (Status); 598 } 599 600 /* Get a pointer to the data to be written */ 601 602 switch (SourceDesc->Common.Type) 603 { 604 case ACPI_TYPE_INTEGER: 605 606 Buffer = &SourceDesc->Integer.Value; 607 Length = sizeof (SourceDesc->Integer.Value); 608 break; 609 610 case ACPI_TYPE_BUFFER: 611 612 Buffer = SourceDesc->Buffer.Pointer; 613 Length = SourceDesc->Buffer.Length; 614 break; 615 616 case ACPI_TYPE_STRING: 617 618 Buffer = SourceDesc->String.Pointer; 619 Length = SourceDesc->String.Length; 620 break; 621 622 default: 623 624 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 625 } 626 627 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 628 "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", 629 SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), 630 SourceDesc->Common.Type, Buffer, Length)); 631 632 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 633 "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", 634 ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type), 635 ObjDesc->Common.Type, 636 ObjDesc->CommonField.BitLength, 637 ObjDesc->CommonField.StartFieldBitOffset, 638 ObjDesc->CommonField.BaseByteOffset)); 639 640 /* Lock entire transaction if requested */ 641 642 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 643 644 /* Write to the field */ 645 646 Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length); 647 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 648 649 return_ACPI_STATUS (Status); 650 } 651