asltree.c (229989) | asltree.c (239340) |
---|---|
1 2/****************************************************************************** 3 * 4 * Module Name: asltree - parse tree management 5 * 6 *****************************************************************************/ 7 8/* --- 54 unchanged lines hidden (view full) --- 63 64 65/******************************************************************************* 66 * 67 * FUNCTION: TrGetNextNode 68 * 69 * PARAMETERS: None 70 * | 1 2/****************************************************************************** 3 * 4 * Module Name: asltree - parse tree management 5 * 6 *****************************************************************************/ 7 8/* --- 54 unchanged lines hidden (view full) --- 63 64 65/******************************************************************************* 66 * 67 * FUNCTION: TrGetNextNode 68 * 69 * PARAMETERS: None 70 * |
71 * RETURN: New parse node. Aborts on allocation failure | 71 * RETURN: New parse node. Aborts on allocation failure |
72 * | 72 * |
73 * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local | 73 * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local |
74 * dynamic memory manager for performance reasons (This has a 75 * major impact on the speed of the compiler.) 76 * 77 ******************************************************************************/ 78 79static ACPI_PARSE_OBJECT * 80TrGetNextNode ( 81 void) --- 11 unchanged lines hidden (view full) --- 93 94 95/******************************************************************************* 96 * 97 * FUNCTION: TrAllocateNode 98 * 99 * PARAMETERS: ParseOpcode - Opcode to be assigned to the node 100 * | 74 * dynamic memory manager for performance reasons (This has a 75 * major impact on the speed of the compiler.) 76 * 77 ******************************************************************************/ 78 79static ACPI_PARSE_OBJECT * 80TrGetNextNode ( 81 void) --- 11 unchanged lines hidden (view full) --- 93 94 95/******************************************************************************* 96 * 97 * FUNCTION: TrAllocateNode 98 * 99 * PARAMETERS: ParseOpcode - Opcode to be assigned to the node 100 * |
101 * RETURN: New parse node. Aborts on allocation failure | 101 * RETURN: New parse node. Aborts on allocation failure |
102 * 103 * DESCRIPTION: Allocate and initialize a new parse node for the parse tree 104 * 105 ******************************************************************************/ 106 107ACPI_PARSE_OBJECT * 108TrAllocateNode ( 109 UINT32 ParseOpcode) --- 18 unchanged lines hidden (view full) --- 128/******************************************************************************* 129 * 130 * FUNCTION: TrReleaseNode 131 * 132 * PARAMETERS: Op - Op to be released 133 * 134 * RETURN: None 135 * | 102 * 103 * DESCRIPTION: Allocate and initialize a new parse node for the parse tree 104 * 105 ******************************************************************************/ 106 107ACPI_PARSE_OBJECT * 108TrAllocateNode ( 109 UINT32 ParseOpcode) --- 18 unchanged lines hidden (view full) --- 128/******************************************************************************* 129 * 130 * FUNCTION: TrReleaseNode 131 * 132 * PARAMETERS: Op - Op to be released 133 * 134 * RETURN: None 135 * |
136 * DESCRIPTION: "release" a node. In truth, nothing is done since the node | 136 * DESCRIPTION: "release" a node. In truth, nothing is done since the node |
137 * is part of a larger buffer 138 * 139 ******************************************************************************/ 140 141void 142TrReleaseNode ( 143 ACPI_PARSE_OBJECT *Op) 144{ --- 6 unchanged lines hidden (view full) --- 151 * 152 * FUNCTION: TrUpdateNode 153 * 154 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node 155 * Op - An existing parse node 156 * 157 * RETURN: The updated node 158 * | 137 * is part of a larger buffer 138 * 139 ******************************************************************************/ 140 141void 142TrReleaseNode ( 143 ACPI_PARSE_OBJECT *Op) 144{ --- 6 unchanged lines hidden (view full) --- 151 * 152 * FUNCTION: TrUpdateNode 153 * 154 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node 155 * Op - An existing parse node 156 * 157 * RETURN: The updated node 158 * |
159 * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to | 159 * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to |
160 * change an opcode to DEFAULT_ARG so that the node is ignored | 160 * change an opcode to DEFAULT_ARG so that the node is ignored |
161 * during the code generation. Also used to set generic integers | 161 * during the code generation. Also used to set generic integers |
162 * to a specific size (8, 16, 32, or 64 bits) 163 * 164 ******************************************************************************/ 165 166ACPI_PARSE_OBJECT * 167TrUpdateNode ( 168 UINT32 ParseOpcode, 169 ACPI_PARSE_OBJECT *Op) --- 11 unchanged lines hidden (view full) --- 181 182 /* Assign new opcode and name */ 183 184 if (Op->Asl.ParseOpcode == PARSEOP_ONES) 185 { 186 switch (ParseOpcode) 187 { 188 case PARSEOP_BYTECONST: | 162 * to a specific size (8, 16, 32, or 64 bits) 163 * 164 ******************************************************************************/ 165 166ACPI_PARSE_OBJECT * 167TrUpdateNode ( 168 UINT32 ParseOpcode, 169 ACPI_PARSE_OBJECT *Op) --- 11 unchanged lines hidden (view full) --- 181 182 /* Assign new opcode and name */ 183 184 if (Op->Asl.ParseOpcode == PARSEOP_ONES) 185 { 186 switch (ParseOpcode) 187 { 188 case PARSEOP_BYTECONST: |
189 Op->Asl.Value.Integer = 0xFF; | 189 Op->Asl.Value.Integer = ACPI_UINT8_MAX; |
190 break; 191 192 case PARSEOP_WORDCONST: | 190 break; 191 192 case PARSEOP_WORDCONST: |
193 Op->Asl.Value.Integer = 0xFFFF; | 193 Op->Asl.Value.Integer = ACPI_UINT16_MAX; |
194 break; 195 196 case PARSEOP_DWORDCONST: | 194 break; 195 196 case PARSEOP_DWORDCONST: |
197 Op->Asl.Value.Integer = 0xFFFFFFFF; | 197 Op->Asl.Value.Integer = ACPI_UINT32_MAX; |
198 break; 199 | 198 break; 199 |
200 /* Don't need to do the QWORD case */ 201 |
|
200 default: | 202 default: |
201 /* Don't care about others, don't need to check QWORD */ | 203 /* Don't care about others */ |
202 break; 203 } 204 } 205 206 Op->Asl.ParseOpcode = (UINT16) ParseOpcode; 207 UtSetParseOpName (Op); 208 209 /* 210 * For the BYTE, WORD, and DWORD constants, make sure that the integer 211 * that was passed in will actually fit into the data type 212 */ 213 switch (ParseOpcode) 214 { 215 case PARSEOP_BYTECONST: | 204 break; 205 } 206 } 207 208 Op->Asl.ParseOpcode = (UINT16) ParseOpcode; 209 UtSetParseOpName (Op); 210 211 /* 212 * For the BYTE, WORD, and DWORD constants, make sure that the integer 213 * that was passed in will actually fit into the data type 214 */ 215 switch (ParseOpcode) 216 { 217 case PARSEOP_BYTECONST: |
216 Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX); | 218 UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX); 219 Op->Asl.Value.Integer &= ACPI_UINT8_MAX; |
217 break; 218 219 case PARSEOP_WORDCONST: | 220 break; 221 222 case PARSEOP_WORDCONST: |
220 Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX); | 223 UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX); 224 Op->Asl.Value.Integer &= ACPI_UINT16_MAX; |
221 break; 222 223 case PARSEOP_DWORDCONST: | 225 break; 226 227 case PARSEOP_DWORDCONST: |
224 Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX); | 228 UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX); 229 Op->Asl.Value.Integer &= ACPI_UINT32_MAX; |
225 break; 226 227 default: 228 /* Don't care about others, don't need to check QWORD */ 229 break; 230 } 231 232 return Op; --- 77 unchanged lines hidden (view full) --- 310 * 311 * FUNCTION: TrSetNodeFlags 312 * 313 * PARAMETERS: Op - An existing parse node 314 * Flags - New flags word 315 * 316 * RETURN: The updated parser op 317 * | 230 break; 231 232 default: 233 /* Don't care about others, don't need to check QWORD */ 234 break; 235 } 236 237 return Op; --- 77 unchanged lines hidden (view full) --- 315 * 316 * FUNCTION: TrSetNodeFlags 317 * 318 * PARAMETERS: Op - An existing parse node 319 * Flags - New flags word 320 * 321 * RETURN: The updated parser op 322 * |
318 * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set | 323 * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set |
319 * 320 ******************************************************************************/ 321 322ACPI_PARSE_OBJECT * 323TrSetNodeFlags ( 324 ACPI_PARSE_OBJECT *Op, 325 UINT32 Flags) 326{ 327 328 DbgPrint (ASL_PARSE_OUTPUT, 329 "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, 330 TrGetNodeFlagName (Flags)); 331 332 if (!Op) 333 { 334 return NULL; 335 } 336 337 Op->Asl.CompileFlags |= Flags; | 324 * 325 ******************************************************************************/ 326 327ACPI_PARSE_OBJECT * 328TrSetNodeFlags ( 329 ACPI_PARSE_OBJECT *Op, 330 UINT32 Flags) 331{ 332 333 DbgPrint (ASL_PARSE_OUTPUT, 334 "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, 335 TrGetNodeFlagName (Flags)); 336 337 if (!Op) 338 { 339 return NULL; 340 } 341 342 Op->Asl.CompileFlags |= Flags; |
343 return (Op); 344} |
|
338 | 345 |
339 return Op; | 346 347/******************************************************************************* 348 * 349 * FUNCTION: TrSetNodeAmlLength 350 * 351 * PARAMETERS: Op - An existing parse node 352 * Length - AML Length 353 * 354 * RETURN: The updated parser op 355 * 356 * DESCRIPTION: Set the AML Length in a node. Used by the parser to indicate 357 * the presence of a node that must be reduced to a fixed length 358 * constant. 359 * 360 ******************************************************************************/ 361 362ACPI_PARSE_OBJECT * 363TrSetNodeAmlLength ( 364 ACPI_PARSE_OBJECT *Op, 365 UINT32 Length) 366{ 367 368 DbgPrint (ASL_PARSE_OUTPUT, 369 "\nSetNodeAmlLength: Op %p, %8.8X\n", Op, Length); 370 371 if (!Op) 372 { 373 return NULL; 374 } 375 376 Op->Asl.AmlLength = Length; 377 return (Op); |
340} 341 342 343/******************************************************************************* 344 * 345 * FUNCTION: TrSetEndLineNumber 346 * 347 * PARAMETERS: Op - An existing parse node --- 23 unchanged lines hidden (view full) --- 371 372 373/******************************************************************************* 374 * 375 * FUNCTION: TrCreateLeafNode 376 * 377 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node 378 * | 378} 379 380 381/******************************************************************************* 382 * 383 * FUNCTION: TrSetEndLineNumber 384 * 385 * PARAMETERS: Op - An existing parse node --- 23 unchanged lines hidden (view full) --- 409 410 411/******************************************************************************* 412 * 413 * FUNCTION: TrCreateLeafNode 414 * 415 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node 416 * |
379 * RETURN: Pointer to the new node. Aborts on allocation failure | 417 * RETURN: Pointer to the new node. Aborts on allocation failure |
380 * 381 * DESCRIPTION: Create a simple leaf node (no children or peers, and no value 382 * assigned to the node) 383 * 384 ******************************************************************************/ 385 386ACPI_PARSE_OBJECT * 387TrCreateLeafNode ( --- 13 unchanged lines hidden (view full) --- 401 402 403/******************************************************************************* 404 * 405 * FUNCTION: TrCreateConstantLeafNode 406 * 407 * PARAMETERS: ParseOpcode - The constant opcode 408 * | 418 * 419 * DESCRIPTION: Create a simple leaf node (no children or peers, and no value 420 * assigned to the node) 421 * 422 ******************************************************************************/ 423 424ACPI_PARSE_OBJECT * 425TrCreateLeafNode ( --- 13 unchanged lines hidden (view full) --- 439 440 441/******************************************************************************* 442 * 443 * FUNCTION: TrCreateConstantLeafNode 444 * 445 * PARAMETERS: ParseOpcode - The constant opcode 446 * |
409 * RETURN: Pointer to the new node. Aborts on allocation failure | 447 * RETURN: Pointer to the new node. Aborts on allocation failure |
410 * 411 * DESCRIPTION: Create a leaf node (no children or peers) for one of the 412 * special constants - __LINE__, __FILE__, and __DATE__. 413 * 414 * Note: An implemenation of __FUNC__ cannot happen here because we don't 415 * have a full parse tree at this time and cannot find the parent control 416 * method. If it is ever needed, __FUNC__ must be implemented later, after 417 * the parse tree has been fully constructed. --- 65 unchanged lines hidden (view full) --- 483 484/******************************************************************************* 485 * 486 * FUNCTION: TrCreateValuedLeafNode 487 * 488 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node 489 * Value - Value to be assigned to the node 490 * | 448 * 449 * DESCRIPTION: Create a leaf node (no children or peers) for one of the 450 * special constants - __LINE__, __FILE__, and __DATE__. 451 * 452 * Note: An implemenation of __FUNC__ cannot happen here because we don't 453 * have a full parse tree at this time and cannot find the parent control 454 * method. If it is ever needed, __FUNC__ must be implemented later, after 455 * the parse tree has been fully constructed. --- 65 unchanged lines hidden (view full) --- 521 522/******************************************************************************* 523 * 524 * FUNCTION: TrCreateValuedLeafNode 525 * 526 * PARAMETERS: ParseOpcode - New opcode to be assigned to the node 527 * Value - Value to be assigned to the node 528 * |
491 * RETURN: Pointer to the new node. Aborts on allocation failure | 529 * RETURN: Pointer to the new node. Aborts on allocation failure |
492 * 493 * DESCRIPTION: Create a leaf node (no children or peers) with a value 494 * assigned to it 495 * 496 ******************************************************************************/ 497 498ACPI_PARSE_OBJECT * 499TrCreateValuedLeafNode ( --- 48 unchanged lines hidden (view full) --- 548 549/******************************************************************************* 550 * 551 * FUNCTION: TrCreateNode 552 * 553 * PARAMETERS: ParseOpcode - Opcode to be assigned to the node 554 * NumChildren - Number of children to follow 555 * ... - A list of child nodes to link to the new | 530 * 531 * DESCRIPTION: Create a leaf node (no children or peers) with a value 532 * assigned to it 533 * 534 ******************************************************************************/ 535 536ACPI_PARSE_OBJECT * 537TrCreateValuedLeafNode ( --- 48 unchanged lines hidden (view full) --- 586 587/******************************************************************************* 588 * 589 * FUNCTION: TrCreateNode 590 * 591 * PARAMETERS: ParseOpcode - Opcode to be assigned to the node 592 * NumChildren - Number of children to follow 593 * ... - A list of child nodes to link to the new |
556 * node. NumChildren long. | 594 * node. NumChildren long. |
557 * | 595 * |
558 * RETURN: Pointer to the new node. Aborts on allocation failure | 596 * RETURN: Pointer to the new node. Aborts on allocation failure |
559 * 560 * DESCRIPTION: Create a new parse node and link together a list of child 561 * nodes underneath the new node. 562 * 563 ******************************************************************************/ 564 565ACPI_PARSE_OBJECT * 566TrCreateNode ( --- 49 unchanged lines hidden (view full) --- 616 { 617 /* Get the next child */ 618 619 Child = va_arg (ap, ACPI_PARSE_OBJECT *); 620 DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); 621 622 /* 623 * If child is NULL, this means that an optional argument | 597 * 598 * DESCRIPTION: Create a new parse node and link together a list of child 599 * nodes underneath the new node. 600 * 601 ******************************************************************************/ 602 603ACPI_PARSE_OBJECT * 604TrCreateNode ( --- 49 unchanged lines hidden (view full) --- 654 { 655 /* Get the next child */ 656 657 Child = va_arg (ap, ACPI_PARSE_OBJECT *); 658 DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); 659 660 /* 661 * If child is NULL, this means that an optional argument |
624 * was omitted. We must create a placeholder with a special | 662 * was omitted. We must create a placeholder with a special |
625 * opcode (DEFAULT_ARG) so that the code generator will know 626 * that it must emit the correct default for this argument 627 */ 628 if (!Child) 629 { 630 Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); 631 } 632 --- 37 unchanged lines hidden (view full) --- 670 671/******************************************************************************* 672 * 673 * FUNCTION: TrLinkChildren 674 * 675 * PARAMETERS: Op - An existing parse node 676 * NumChildren - Number of children to follow 677 * ... - A list of child nodes to link to the new | 663 * opcode (DEFAULT_ARG) so that the code generator will know 664 * that it must emit the correct default for this argument 665 */ 666 if (!Child) 667 { 668 Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); 669 } 670 --- 37 unchanged lines hidden (view full) --- 708 709/******************************************************************************* 710 * 711 * FUNCTION: TrLinkChildren 712 * 713 * PARAMETERS: Op - An existing parse node 714 * NumChildren - Number of children to follow 715 * ... - A list of child nodes to link to the new |
678 * node. NumChildren long. | 716 * node. NumChildren long. |
679 * 680 * RETURN: The updated (linked) node 681 * 682 * DESCRIPTION: Link a group of nodes to an existing parse node 683 * 684 ******************************************************************************/ 685 686ACPI_PARSE_OBJECT * --- 53 unchanged lines hidden (view full) --- 740 "Child node list invalid"); 741 return Op; 742 } 743 744 DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); 745 746 /* 747 * If child is NULL, this means that an optional argument | 717 * 718 * RETURN: The updated (linked) node 719 * 720 * DESCRIPTION: Link a group of nodes to an existing parse node 721 * 722 ******************************************************************************/ 723 724ACPI_PARSE_OBJECT * --- 53 unchanged lines hidden (view full) --- 778 "Child node list invalid"); 779 return Op; 780 } 781 782 DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); 783 784 /* 785 * If child is NULL, this means that an optional argument |
748 * was omitted. We must create a placeholder with a special | 786 * was omitted. We must create a placeholder with a special |
749 * opcode (DEFAULT_ARG) so that the code generator will know 750 * that it must emit the correct default for this argument 751 */ 752 if (!Child) 753 { 754 Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); 755 } 756 --- 38 unchanged lines hidden (view full) --- 795 * 796 * FUNCTION: TrLinkPeerNode 797 * 798 * PARAMETERS: Op1 - First peer 799 * Op2 - Second peer 800 * 801 * RETURN: Op1 or the non-null node. 802 * | 787 * opcode (DEFAULT_ARG) so that the code generator will know 788 * that it must emit the correct default for this argument 789 */ 790 if (!Child) 791 { 792 Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); 793 } 794 --- 38 unchanged lines hidden (view full) --- 833 * 834 * FUNCTION: TrLinkPeerNode 835 * 836 * PARAMETERS: Op1 - First peer 837 * Op2 - Second peer 838 * 839 * RETURN: Op1 or the non-null node. 840 * |
803 * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null. | 841 * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null. |
804 * 805 ******************************************************************************/ 806 807ACPI_PARSE_OBJECT * 808TrLinkPeerNode ( 809 ACPI_PARSE_OBJECT *Op1, 810 ACPI_PARSE_OBJECT *Op2) 811{ --- 391 unchanged lines hidden --- | 842 * 843 ******************************************************************************/ 844 845ACPI_PARSE_OBJECT * 846TrLinkPeerNode ( 847 ACPI_PARSE_OBJECT *Op1, 848 ACPI_PARSE_OBJECT *Op2) 849{ --- 391 unchanged lines hidden --- |