aslresource.c (151937) | aslresource.c (167802) |
---|---|
1 2/****************************************************************************** 3 * 4 * Module Name: aslresource - Resource templates and descriptors | 1 2/****************************************************************************** 3 * 4 * Module Name: aslresource - Resource templates and descriptors |
5 * $Revision: 1.38 $ | 5 * $Revision: 1.43 $ |
6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * | 6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * |
13 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. | 13 * Some or all of this work - Copyright (c) 1999 - 2007, 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. --- 349 unchanged lines hidden (view full) --- 371RsDoOneResourceDescriptor ( 372 ACPI_PARSE_OBJECT *DescriptorTypeOp, 373 UINT32 CurrentByteOffset, 374 UINT8 *State) 375{ 376 ASL_RESOURCE_NODE *Rnode = NULL; 377 378 | 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. --- 349 unchanged lines hidden (view full) --- 371RsDoOneResourceDescriptor ( 372 ACPI_PARSE_OBJECT *DescriptorTypeOp, 373 UINT32 CurrentByteOffset, 374 UINT8 *State) 375{ 376 ASL_RESOURCE_NODE *Rnode = NULL; 377 378 |
379 /* Determine type of resource */ | 379 /* Construct the resource */ |
380 381 switch (DescriptorTypeOp->Asl.ParseOpcode) 382 { 383 case PARSEOP_DMA: 384 Rnode = RsDoDmaDescriptor (DescriptorTypeOp, 385 CurrentByteOffset); 386 break; 387 --- 30 unchanged lines hidden (view full) --- 418 break; 419 } 420 421 *State = ACPI_RSTATE_NORMAL; 422 Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, 423 CurrentByteOffset); 424 break; 425 | 380 381 switch (DescriptorTypeOp->Asl.ParseOpcode) 382 { 383 case PARSEOP_DMA: 384 Rnode = RsDoDmaDescriptor (DescriptorTypeOp, 385 CurrentByteOffset); 386 break; 387 --- 30 unchanged lines hidden (view full) --- 418 break; 419 } 420 421 *State = ACPI_RSTATE_NORMAL; 422 Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, 423 CurrentByteOffset); 424 break; 425 |
426 case PARSEOP_ENDTAG: 427 Rnode = RsDoEndTagDescriptor (DescriptorTypeOp, 428 CurrentByteOffset); 429 break; 430 |
|
426 case PARSEOP_EXTENDEDIO: 427 Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp, 428 CurrentByteOffset); 429 break; 430 431 case PARSEOP_EXTENDEDMEMORY: 432 Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp, 433 CurrentByteOffset); --- 141 unchanged lines hidden (view full) --- 575 576 /* 577 * Mark original node as unused, but head of a resource descriptor. 578 * This allows the resource to be installed in the namespace so that 579 * references to the descriptor can be resolved. 580 */ 581 DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 582 DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; | 431 case PARSEOP_EXTENDEDIO: 432 Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp, 433 CurrentByteOffset); 434 break; 435 436 case PARSEOP_EXTENDEDMEMORY: 437 Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp, 438 CurrentByteOffset); --- 141 unchanged lines hidden (view full) --- 580 581 /* 582 * Mark original node as unused, but head of a resource descriptor. 583 * This allows the resource to be installed in the namespace so that 584 * references to the descriptor can be resolved. 585 */ 586 DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 587 DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; |
588 DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset; |
|
583 | 589 |
590 if (Rnode) 591 { 592 DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; 593 } 594 |
|
584 return (Rnode); 585} 586 587 588/******************************************************************************* 589 * 590 * FUNCTION: RsLinkDescriptorChain 591 * --- 61 unchanged lines hidden (view full) --- 653void 654RsDoResourceTemplate ( 655 ACPI_PARSE_OBJECT *Op) 656{ 657 ACPI_PARSE_OBJECT *BufferLengthOp; 658 ACPI_PARSE_OBJECT *BufferOp; 659 ACPI_PARSE_OBJECT *DescriptorTypeOp; 660 ACPI_PARSE_OBJECT *LastOp = NULL; | 595 return (Rnode); 596} 597 598 599/******************************************************************************* 600 * 601 * FUNCTION: RsLinkDescriptorChain 602 * --- 61 unchanged lines hidden (view full) --- 664void 665RsDoResourceTemplate ( 666 ACPI_PARSE_OBJECT *Op) 667{ 668 ACPI_PARSE_OBJECT *BufferLengthOp; 669 ACPI_PARSE_OBJECT *BufferOp; 670 ACPI_PARSE_OBJECT *DescriptorTypeOp; 671 ACPI_PARSE_OBJECT *LastOp = NULL; |
661 AML_RESOURCE *Descriptor; | |
662 UINT32 CurrentByteOffset = 0; 663 ASL_RESOURCE_NODE HeadRnode; 664 ASL_RESOURCE_NODE *PreviousRnode; 665 ASL_RESOURCE_NODE *Rnode; 666 UINT8 State; 667 668 | 672 UINT32 CurrentByteOffset = 0; 673 ASL_RESOURCE_NODE HeadRnode; 674 ASL_RESOURCE_NODE *PreviousRnode; 675 ASL_RESOURCE_NODE *Rnode; 676 UINT8 State; 677 678 |
679 /* Mark parent as containing a resource template */ 680 681 if (Op->Asl.Parent) 682 { 683 Op->Asl.Parent->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; 684 } 685 |
|
669 /* ResourceTemplate Opcode is first (Op) */ 670 /* Buffer Length node is first child */ 671 672 BufferLengthOp = ASL_GET_CHILD_NODE (Op); 673 674 /* Buffer Op is first peer */ 675 676 BufferOp = ASL_GET_PEER_NODE (BufferLengthOp); 677 678 /* First Descriptor type is next */ 679 680 DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); 681 | 686 /* ResourceTemplate Opcode is first (Op) */ 687 /* Buffer Length node is first child */ 688 689 BufferLengthOp = ASL_GET_CHILD_NODE (Op); 690 691 /* Buffer Op is first peer */ 692 693 BufferOp = ASL_GET_PEER_NODE (BufferLengthOp); 694 695 /* First Descriptor type is next */ 696 697 DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); 698 |
682 /* Process all resource descriptors in the list */ 683 | 699 /* 700 * Process all resource descriptors in the list 701 * Note: It is assumed that the EndTag node has been automatically 702 * inserted at the end of the template by the parser. 703 */ |
684 State = ACPI_RSTATE_NORMAL; 685 PreviousRnode = &HeadRnode; 686 while (DescriptorTypeOp) 687 { | 704 State = ACPI_RSTATE_NORMAL; 705 PreviousRnode = &HeadRnode; 706 while (DescriptorTypeOp) 707 { |
708 DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; |
|
688 Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, 689 &State); 690 691 /* 692 * Update current byte offset to indicate the number of bytes from the 693 * start of the buffer. Buffer can include multiple descriptors, we 694 * must keep track of the offset of not only each descriptor, but each 695 * element (field) within each descriptor as well. --- 11 unchanged lines hidden (view full) --- 707 if (LastOp) 708 { 709 LastOp = LastOp->Asl.Parent; 710 } 711 AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL); 712 } 713 714 /* | 709 Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, 710 &State); 711 712 /* 713 * Update current byte offset to indicate the number of bytes from the 714 * start of the buffer. Buffer can include multiple descriptors, we 715 * must keep track of the offset of not only each descriptor, but each 716 * element (field) within each descriptor as well. --- 11 unchanged lines hidden (view full) --- 728 if (LastOp) 729 { 730 LastOp = LastOp->Asl.Parent; 731 } 732 AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL); 733 } 734 735 /* |
715 * Insert the EndTag descriptor after all other descriptors have 716 * been processed 717 */ 718 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG)); 719 720 Descriptor = Rnode->Buffer; 721 Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG | 722 ASL_RDESC_END_TAG_SIZE; 723 Descriptor->EndTag.Checksum = 0; 724 725 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); 726 727 /* | |
728 * Transform the nodes into the following 729 * 730 * Op -> AML_BUFFER_OP 731 * First Child -> BufferLength 732 * Second Child -> Descriptor Buffer (raw byte data) 733 */ 734 Op->Asl.ParseOpcode = PARSEOP_BUFFER; 735 Op->Asl.AmlOpcode = AML_BUFFER_OP; | 736 * Transform the nodes into the following 737 * 738 * Op -> AML_BUFFER_OP 739 * First Child -> BufferLength 740 * Second Child -> Descriptor Buffer (raw byte data) 741 */ 742 Op->Asl.ParseOpcode = PARSEOP_BUFFER; 743 Op->Asl.AmlOpcode = AML_BUFFER_OP; |
736 Op->Asl.CompileFlags = NODE_AML_PACKAGE; | 744 Op->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; |
737 738 BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; 739 BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; | 745 746 BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; 747 BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; |
740 | |
741 (void) OpcSetOptimalIntegerSize (BufferLengthOp); 742 743 BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; 744 BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; 745 BufferOp->Asl.AmlOpcodeLength = 0; 746 BufferOp->Asl.AmlLength = CurrentByteOffset; 747 BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; | 748 (void) OpcSetOptimalIntegerSize (BufferLengthOp); 749 750 BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; 751 BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; 752 BufferOp->Asl.AmlOpcodeLength = 0; 753 BufferOp->Asl.AmlLength = CurrentByteOffset; 754 BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; |
755 BufferOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DATA; |
|
748 749 return; 750} 751 752 | 756 757 return; 758} 759 760 |