1
2 /******************************************************************************
3 *
4 * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45 #define __EXPREP_C__
46
47 #include "acpi.h"
48 #include "accommon.h"
49 #include "acinterp.h"
50 #include "amlcode.h"
51 #include "acnamesp.h"
52
53
54 #define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exprep")
56
57 /* Local prototypes */
58
59 static UINT32
60 AcpiExDecodeFieldAccess (
61 ACPI_OPERAND_OBJECT *ObjDesc,
62 UINT8 FieldFlags,
63 UINT32 *ReturnByteAlignment);
64
65
66 #ifdef ACPI_UNDER_DEVELOPMENT
67
68 static UINT32
69 AcpiExGenerateAccess (
70 UINT32 FieldBitOffset,
71 UINT32 FieldBitLength,
250 Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
251
252 switch (Access)
253 {
254 case AML_FIELD_ACCESS_ANY:
255
256 #ifdef ACPI_UNDER_DEVELOPMENT
257 ByteAlignment =
258 AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset,
259 ObjDesc->CommonField.BitLength,
260 0xFFFFFFFF /* Temp until we pass RegionLength as parameter */);
261 BitLength = ByteAlignment * 8;
262 #endif
263
264 ByteAlignment = 1;
265 BitLength = 8;
266 break;
267
268 case AML_FIELD_ACCESS_BYTE:
269 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
270 ByteAlignment = 1;
271 BitLength = 8;
272 break;
273
274 case AML_FIELD_ACCESS_WORD:
275 ByteAlignment = 2;
276 BitLength = 16;
277 break;
278
279 case AML_FIELD_ACCESS_DWORD:
280 ByteAlignment = 4;
281 BitLength = 32;
282 break;
283
284 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
285 ByteAlignment = 8;
286 BitLength = 64;
287 break;
288
289 default:
290 /* Invalid field access type */
291
292 ACPI_ERROR ((AE_INFO,
293 "Unknown field access type 0x%X",
294 Access));
295 return_UINT32 (0);
296 }
297
298 if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
299 {
300 /*
301 * BufferField access can be on any byte boundary, so the
302 * ByteAlignment is always 1 byte -- regardless of any ByteAlignment
303 * implied by the field access type.
304 */
305 ByteAlignment = 1;
306 }
307
308 *ReturnByteAlignment = ByteAlignment;
309 return_UINT32 (BitLength);
400
401 /*
402 * StartFieldBitOffset is the offset of the first bit of the field within
403 * a field datum.
404 */
405 ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
406 (FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
407
408 return_ACPI_STATUS (AE_OK);
409 }
410
411
412 /*******************************************************************************
413 *
414 * FUNCTION: AcpiExPrepFieldValue
415 *
416 * PARAMETERS: Info - Contains all field creation info
417 *
418 * RETURN: Status
419 *
420 * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type DefField and
421 * connect it to the parent Node.
422 *
423 ******************************************************************************/
424
425 ACPI_STATUS
426 AcpiExPrepFieldValue (
427 ACPI_CREATE_FIELD_INFO *Info)
428 {
429 ACPI_OPERAND_OBJECT *ObjDesc;
430 ACPI_OPERAND_OBJECT *SecondDesc = NULL;
431 ACPI_STATUS Status;
432 UINT32 AccessByteWidth;
433 UINT32 Type;
434
435
436 ACPI_FUNCTION_TRACE (ExPrepFieldValue);
437
438
439 /* Parameter validation */
440
441 if (Info->FieldType != ACPI_TYPE_LOCAL_INDEX_FIELD)
467 /* Initialize areas of the object that are common to all fields */
468
469 ObjDesc->CommonField.Node = Info->FieldNode;
470 Status = AcpiExPrepCommonFieldObject (ObjDesc,
471 Info->FieldFlags, Info->Attribute,
472 Info->FieldBitPosition, Info->FieldBitLength);
473 if (ACPI_FAILURE (Status))
474 {
475 AcpiUtDeleteObjectDesc (ObjDesc);
476 return_ACPI_STATUS (Status);
477 }
478
479 /* Initialize areas of the object that are specific to the field type */
480
481 switch (Info->FieldType)
482 {
483 case ACPI_TYPE_LOCAL_REGION_FIELD:
484
485 ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
486
487 /* Allow full data read from EC address space */
488
489 if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
490 (ObjDesc->CommonField.BitLength > 8))
491 {
492 AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES (
493 ObjDesc->CommonField.BitLength);
494
495 /* Maximum byte width supported is 255 */
496
497 if (AccessByteWidth < 256)
498 {
499 ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth;
500 }
501 }
502
503 /* An additional reference for the container */
504
505 AcpiUtAddReference (ObjDesc->Field.RegionObj);
506
507 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
508 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
509 ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,
510 ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
511 break;
512
513
514 case ACPI_TYPE_LOCAL_BANK_FIELD:
515
516 ObjDesc->BankField.Value = Info->BankValue;
517 ObjDesc->BankField.RegionObj =
518 AcpiNsGetAttachedObject (Info->RegionNode);
519 ObjDesc->BankField.BankObj =
520 AcpiNsGetAttachedObject (Info->RegisterNode);
521
522 /* An additional reference for the attached objects */
523
524 AcpiUtAddReference (ObjDesc->BankField.RegionObj);
525 AcpiUtAddReference (ObjDesc->BankField.BankObj);
526
527 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
528 "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n",
529 ObjDesc->BankField.StartFieldBitOffset,
530 ObjDesc->BankField.BaseByteOffset,
531 ObjDesc->Field.AccessByteWidth,
532 ObjDesc->BankField.RegionObj,
533 ObjDesc->BankField.BankObj));
534
535 /*
536 * Remember location in AML stream of the field unit
537 * opcode and operands -- since the BankValue
538 * operands must be evaluated.
539 */
540 SecondDesc = ObjDesc->Common.NextObject;
541 SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
542 Info->DataRegisterNode)->Named.Data;
543 SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
544 Info->DataRegisterNode)->Named.Length;
545
546 break;
547
548
549 case ACPI_TYPE_LOCAL_INDEX_FIELD:
550
551 /* Get the Index and Data registers */
552
553 ObjDesc->IndexField.IndexObj =
554 AcpiNsGetAttachedObject (Info->RegisterNode);
555 ObjDesc->IndexField.DataObj =
556 AcpiNsGetAttachedObject (Info->DataRegisterNode);
557
558 if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
559 {
560 ACPI_ERROR ((AE_INFO, "Null Index Object during field prep"));
561 AcpiUtDeleteObjectDesc (ObjDesc);
562 return_ACPI_STATUS (AE_AML_INTERNAL);
563 }
564
565 /* An additional reference for the attached objects */
566
567 AcpiUtAddReference (ObjDesc->IndexField.DataObj);
568 AcpiUtAddReference (ObjDesc->IndexField.IndexObj);
582 *
583 * February 2006: Tried value as a byte offset:
584 * ObjDesc->IndexField.Value = (UINT32)
585 * ACPI_DIV_8 (Info->FieldBitPosition);
586 */
587 ObjDesc->IndexField.Value = (UINT32) ACPI_ROUND_DOWN (
588 ACPI_DIV_8 (Info->FieldBitPosition),
589 ObjDesc->IndexField.AccessByteWidth);
590
591 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
592 "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
593 ObjDesc->IndexField.StartFieldBitOffset,
594 ObjDesc->IndexField.BaseByteOffset,
595 ObjDesc->IndexField.Value,
596 ObjDesc->Field.AccessByteWidth,
597 ObjDesc->IndexField.IndexObj,
598 ObjDesc->IndexField.DataObj));
599 break;
600
601 default:
602 /* No other types should get here */
603 break;
604 }
605
606 /*
607 * Store the constructed descriptor (ObjDesc) into the parent Node,
608 * preserving the current type of that NamedObj.
609 */
610 Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
611 AcpiNsGetType (Info->FieldNode));
612
613 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n",
614 Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc));
615
616 /* Remove local reference to the object */
617
618 AcpiUtRemoveReference (ObjDesc);
619 return_ACPI_STATUS (Status);
620 }
621
|
1 /******************************************************************************
2 *
3 * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2013, 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.
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 MERCHANTIBILITY 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 #define __EXPREP_C__
45
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acinterp.h"
49 #include "amlcode.h"
50 #include "acnamesp.h"
51 #include "acdispat.h"
52
53
54 #define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exprep")
56
57 /* Local prototypes */
58
59 static UINT32
60 AcpiExDecodeFieldAccess (
61 ACPI_OPERAND_OBJECT *ObjDesc,
62 UINT8 FieldFlags,
63 UINT32 *ReturnByteAlignment);
64
65
66 #ifdef ACPI_UNDER_DEVELOPMENT
67
68 static UINT32
69 AcpiExGenerateAccess (
70 UINT32 FieldBitOffset,
71 UINT32 FieldBitLength,
250 Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
251
252 switch (Access)
253 {
254 case AML_FIELD_ACCESS_ANY:
255
256 #ifdef ACPI_UNDER_DEVELOPMENT
257 ByteAlignment =
258 AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset,
259 ObjDesc->CommonField.BitLength,
260 0xFFFFFFFF /* Temp until we pass RegionLength as parameter */);
261 BitLength = ByteAlignment * 8;
262 #endif
263
264 ByteAlignment = 1;
265 BitLength = 8;
266 break;
267
268 case AML_FIELD_ACCESS_BYTE:
269 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
270
271 ByteAlignment = 1;
272 BitLength = 8;
273 break;
274
275 case AML_FIELD_ACCESS_WORD:
276
277 ByteAlignment = 2;
278 BitLength = 16;
279 break;
280
281 case AML_FIELD_ACCESS_DWORD:
282
283 ByteAlignment = 4;
284 BitLength = 32;
285 break;
286
287 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
288
289 ByteAlignment = 8;
290 BitLength = 64;
291 break;
292
293 default:
294
295 /* Invalid field access type */
296
297 ACPI_ERROR ((AE_INFO,
298 "Unknown field access type 0x%X",
299 Access));
300 return_UINT32 (0);
301 }
302
303 if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
304 {
305 /*
306 * BufferField access can be on any byte boundary, so the
307 * ByteAlignment is always 1 byte -- regardless of any ByteAlignment
308 * implied by the field access type.
309 */
310 ByteAlignment = 1;
311 }
312
313 *ReturnByteAlignment = ByteAlignment;
314 return_UINT32 (BitLength);
405
406 /*
407 * StartFieldBitOffset is the offset of the first bit of the field within
408 * a field datum.
409 */
410 ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
411 (FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
412
413 return_ACPI_STATUS (AE_OK);
414 }
415
416
417 /*******************************************************************************
418 *
419 * FUNCTION: AcpiExPrepFieldValue
420 *
421 * PARAMETERS: Info - Contains all field creation info
422 *
423 * RETURN: Status
424 *
425 * DESCRIPTION: Construct an object of type ACPI_OPERAND_OBJECT with a
426 * subtype of DefField and connect it to the parent Node.
427 *
428 ******************************************************************************/
429
430 ACPI_STATUS
431 AcpiExPrepFieldValue (
432 ACPI_CREATE_FIELD_INFO *Info)
433 {
434 ACPI_OPERAND_OBJECT *ObjDesc;
435 ACPI_OPERAND_OBJECT *SecondDesc = NULL;
436 ACPI_STATUS Status;
437 UINT32 AccessByteWidth;
438 UINT32 Type;
439
440
441 ACPI_FUNCTION_TRACE (ExPrepFieldValue);
442
443
444 /* Parameter validation */
445
446 if (Info->FieldType != ACPI_TYPE_LOCAL_INDEX_FIELD)
472 /* Initialize areas of the object that are common to all fields */
473
474 ObjDesc->CommonField.Node = Info->FieldNode;
475 Status = AcpiExPrepCommonFieldObject (ObjDesc,
476 Info->FieldFlags, Info->Attribute,
477 Info->FieldBitPosition, Info->FieldBitLength);
478 if (ACPI_FAILURE (Status))
479 {
480 AcpiUtDeleteObjectDesc (ObjDesc);
481 return_ACPI_STATUS (Status);
482 }
483
484 /* Initialize areas of the object that are specific to the field type */
485
486 switch (Info->FieldType)
487 {
488 case ACPI_TYPE_LOCAL_REGION_FIELD:
489
490 ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
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
518 /* Allow full data read from EC address space */
519
520 if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
521 (ObjDesc->CommonField.BitLength > 8))
522 {
523 AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES (
524 ObjDesc->CommonField.BitLength);
525
526 /* Maximum byte width supported is 255 */
527
528 if (AccessByteWidth < 256)
529 {
530 ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth;
531 }
532 }
533
534 /* An additional reference for the container */
535
536 AcpiUtAddReference (ObjDesc->Field.RegionObj);
537
538 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
539 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
540 ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,
541 ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
542 break;
543
544 case ACPI_TYPE_LOCAL_BANK_FIELD:
545
546 ObjDesc->BankField.Value = Info->BankValue;
547 ObjDesc->BankField.RegionObj =
548 AcpiNsGetAttachedObject (Info->RegionNode);
549 ObjDesc->BankField.BankObj =
550 AcpiNsGetAttachedObject (Info->RegisterNode);
551
552 /* An additional reference for the attached objects */
553
554 AcpiUtAddReference (ObjDesc->BankField.RegionObj);
555 AcpiUtAddReference (ObjDesc->BankField.BankObj);
556
557 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
558 "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n",
559 ObjDesc->BankField.StartFieldBitOffset,
560 ObjDesc->BankField.BaseByteOffset,
561 ObjDesc->Field.AccessByteWidth,
562 ObjDesc->BankField.RegionObj,
563 ObjDesc->BankField.BankObj));
564
565 /*
566 * Remember location in AML stream of the field unit
567 * opcode and operands -- since the BankValue
568 * operands must be evaluated.
569 */
570 SecondDesc = ObjDesc->Common.NextObject;
571 SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
572 Info->DataRegisterNode)->Named.Data;
573 SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
574 Info->DataRegisterNode)->Named.Length;
575
576 break;
577
578 case ACPI_TYPE_LOCAL_INDEX_FIELD:
579
580 /* Get the Index and Data registers */
581
582 ObjDesc->IndexField.IndexObj =
583 AcpiNsGetAttachedObject (Info->RegisterNode);
584 ObjDesc->IndexField.DataObj =
585 AcpiNsGetAttachedObject (Info->DataRegisterNode);
586
587 if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
588 {
589 ACPI_ERROR ((AE_INFO, "Null Index Object during field prep"));
590 AcpiUtDeleteObjectDesc (ObjDesc);
591 return_ACPI_STATUS (AE_AML_INTERNAL);
592 }
593
594 /* An additional reference for the attached objects */
595
596 AcpiUtAddReference (ObjDesc->IndexField.DataObj);
597 AcpiUtAddReference (ObjDesc->IndexField.IndexObj);
611 *
612 * February 2006: Tried value as a byte offset:
613 * ObjDesc->IndexField.Value = (UINT32)
614 * ACPI_DIV_8 (Info->FieldBitPosition);
615 */
616 ObjDesc->IndexField.Value = (UINT32) ACPI_ROUND_DOWN (
617 ACPI_DIV_8 (Info->FieldBitPosition),
618 ObjDesc->IndexField.AccessByteWidth);
619
620 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
621 "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
622 ObjDesc->IndexField.StartFieldBitOffset,
623 ObjDesc->IndexField.BaseByteOffset,
624 ObjDesc->IndexField.Value,
625 ObjDesc->Field.AccessByteWidth,
626 ObjDesc->IndexField.IndexObj,
627 ObjDesc->IndexField.DataObj));
628 break;
629
630 default:
631
632 /* No other types should get here */
633
634 break;
635 }
636
637 /*
638 * Store the constructed descriptor (ObjDesc) into the parent Node,
639 * preserving the current type of that NamedObj.
640 */
641 Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
642 AcpiNsGetType (Info->FieldNode));
643
644 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n",
645 Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc));
646
647 /* Remove local reference to the object */
648
649 AcpiUtRemoveReference (ObjDesc);
650 return_ACPI_STATUS (Status);
651 }
|