cvparser.c (316303) | cvparser.c (322877) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: cvparser - Converter functions that are called from the AML 4 * parser. 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** --- 190 unchanged lines hidden (view full) --- 199 * 200 ******************************************************************************/ 201 202static BOOLEAN 203CvIsFilename ( 204 char *Filename) 205{ 206 UINT64 Length = strlen(Filename); | 1/****************************************************************************** 2 * 3 * Module Name: cvparser - Converter functions that are called from the AML 4 * parser. 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** --- 190 unchanged lines hidden (view full) --- 199 * 200 ******************************************************************************/ 201 202static BOOLEAN 203CvIsFilename ( 204 char *Filename) 205{ 206 UINT64 Length = strlen(Filename); |
207 UINT64 i; | |
208 char *FileExt = Filename + Length - 4; | 207 char *FileExt = Filename + Length - 4; |
208 UINT64 i; |
|
209 210 211 if ((Length > 4) && AcpiUtStricmp (FileExt, ".dsl")) 212 { | 209 210 211 if ((Length > 4) && AcpiUtStricmp (FileExt, ".dsl")) 212 { |
213 return FALSE; | 213 return (FALSE); |
214 } 215 216 for(i = 0; i<Length; ++i) 217 { | 214 } 215 216 for(i = 0; i<Length; ++i) 217 { |
218 if (!isprint (Filename[i])) | 218 if (!isprint ((int) Filename[i])) |
219 { | 219 { |
220 return FALSE; | 220 return (FALSE); |
221 } 222 } | 221 } 222 } |
223 return TRUE; | 223 224 return (TRUE); |
224} 225 226 227/******************************************************************************* 228 * 229 * FUNCTION: CvInitFileTree 230 * 231 * PARAMETERS: Table - input table 232 * AmlStart - Address of the starting point of the AML. 233 * AmlLength - Length of the AML file. 234 * | 225} 226 227 228/******************************************************************************* 229 * 230 * FUNCTION: CvInitFileTree 231 * 232 * PARAMETERS: Table - input table 233 * AmlStart - Address of the starting point of the AML. 234 * AmlLength - Length of the AML file. 235 * |
235 * RETURN: none | 236 * RETURN: None |
236 * 237 * DESCRIPTION: Initialize the file dependency tree by scanning the AML. 238 * This is referred as ASL_CV_INIT_FILETREE. 239 * 240 ******************************************************************************/ 241 242void 243CvInitFileTree ( --- 14 unchanged lines hidden (view full) --- 258 return; 259 } 260 261 CvDbgPrint ("AmlLength: %x\n", AmlLength); 262 CvDbgPrint ("AmlStart: %p\n", AmlStart); 263 CvDbgPrint ("AmlEnd?: %p\n", AmlStart+AmlLength); 264 265 AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache); | 237 * 238 * DESCRIPTION: Initialize the file dependency tree by scanning the AML. 239 * This is referred as ASL_CV_INIT_FILETREE. 240 * 241 ******************************************************************************/ 242 243void 244CvInitFileTree ( --- 14 unchanged lines hidden (view full) --- 259 return; 260 } 261 262 CvDbgPrint ("AmlLength: %x\n", AmlLength); 263 CvDbgPrint ("AmlStart: %p\n", AmlStart); 264 CvDbgPrint ("AmlEnd?: %p\n", AmlStart+AmlLength); 265 266 AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache); |
267 |
|
266 AcpiGbl_FileTreeRoot->FileStart = (char *)(AmlStart); 267 AcpiGbl_FileTreeRoot->FileEnd = (char *)(AmlStart + Table->Length); 268 AcpiGbl_FileTreeRoot->Next = NULL; 269 AcpiGbl_FileTreeRoot->Parent = NULL; 270 AcpiGbl_FileTreeRoot->Filename = (char *)(AmlStart+2); 271 272 /* Set the root file to the current open file */ 273 --- 14 unchanged lines hidden (view full) --- 288 while (TreeAml <= FileEnd) 289 { 290 /* 291 * Make sure that this filename contains all printable characters 292 * and a .dsl extension at the end. If not, then it must be some 293 * raw data that doesn't outline a filename. 294 */ 295 if ((*TreeAml == AML_COMMENT_OP) && | 268 AcpiGbl_FileTreeRoot->FileStart = (char *)(AmlStart); 269 AcpiGbl_FileTreeRoot->FileEnd = (char *)(AmlStart + Table->Length); 270 AcpiGbl_FileTreeRoot->Next = NULL; 271 AcpiGbl_FileTreeRoot->Parent = NULL; 272 AcpiGbl_FileTreeRoot->Filename = (char *)(AmlStart+2); 273 274 /* Set the root file to the current open file */ 275 --- 14 unchanged lines hidden (view full) --- 290 while (TreeAml <= FileEnd) 291 { 292 /* 293 * Make sure that this filename contains all printable characters 294 * and a .dsl extension at the end. If not, then it must be some 295 * raw data that doesn't outline a filename. 296 */ 297 if ((*TreeAml == AML_COMMENT_OP) && |
296 (*(TreeAml+1) == FILENAME_COMMENT) && 297 (CvIsFilename ((char *)(TreeAml+2)))) | 298 (*(TreeAml +1) == FILENAME_COMMENT) && 299 (CvIsFilename ((char *)(TreeAml +2)))) |
298 { 299 CvDbgPrint ("A9 and a 08 file\n"); 300 PreviousFilename = Filename; | 300 { 301 CvDbgPrint ("A9 and a 08 file\n"); 302 PreviousFilename = Filename; |
301 Filename = (char *) (TreeAml+2); | 303 Filename = (char *) (TreeAml +2); 304 |
302 CvAddToFileTree (Filename, PreviousFilename); 303 ChildFilename = Filename; 304 CvDbgPrint ("%s\n", Filename); 305 } 306 else if ((*TreeAml == AML_COMMENT_OP) && | 305 CvAddToFileTree (Filename, PreviousFilename); 306 ChildFilename = Filename; 307 CvDbgPrint ("%s\n", Filename); 308 } 309 else if ((*TreeAml == AML_COMMENT_OP) && |
307 (*(TreeAml+1) == PARENTFILENAME_COMMENT) && 308 (CvIsFilename ((char *)(TreeAml+2)))) | 310 (*(TreeAml +1) == PARENTFILENAME_COMMENT) && 311 (CvIsFilename ((char *)(TreeAml +2)))) |
309 { 310 CvDbgPrint ("A9 and a 09 file\n"); | 312 { 313 CvDbgPrint ("A9 and a 09 file\n"); |
311 ParentFilename = (char *)(TreeAml+2); | 314 ParentFilename = (char *)(TreeAml +2); |
312 CvSetFileParent (ChildFilename, ParentFilename); 313 CvDbgPrint ("%s\n", ParentFilename); 314 } | 315 CvSetFileParent (ChildFilename, ParentFilename); 316 CvDbgPrint ("%s\n", ParentFilename); 317 } |
318 |
|
315 ++TreeAml; 316 } 317} 318 319 320/******************************************************************************* 321 * 322 * FUNCTION: CvClearOpComments 323 * 324 * PARAMETERS: Op -- clear all comments within this Op 325 * | 319 ++TreeAml; 320 } 321} 322 323 324/******************************************************************************* 325 * 326 * FUNCTION: CvClearOpComments 327 * 328 * PARAMETERS: Op -- clear all comments within this Op 329 * |
326 * RETURN: none | 330 * RETURN: None |
327 * 328 * DESCRIPTION: Clear all converter-related fields of the given Op. 329 * This is referred as ASL_CV_CLEAR_OP_COMMENTS. 330 * 331 ******************************************************************************/ 332 333void 334CvClearOpComments ( 335 ACPI_PARSE_OBJECT *Op) 336{ | 331 * 332 * DESCRIPTION: Clear all converter-related fields of the given Op. 333 * This is referred as ASL_CV_CLEAR_OP_COMMENTS. 334 * 335 ******************************************************************************/ 336 337void 338CvClearOpComments ( 339 ACPI_PARSE_OBJECT *Op) 340{ |
341 |
|
337 Op->Common.InlineComment = NULL; 338 Op->Common.EndNodeComment = NULL; 339 Op->Common.NameComment = NULL; 340 Op->Common.CommentList = NULL; 341 Op->Common.EndBlkComment = NULL; 342 Op->Common.CloseBraceComment = NULL; 343 Op->Common.CvFilename = NULL; 344 Op->Common.CvParentFilename = NULL; 345} 346 347 348/******************************************************************************* 349 * 350 * FUNCTION: CvCommentExists 351 * | 342 Op->Common.InlineComment = NULL; 343 Op->Common.EndNodeComment = NULL; 344 Op->Common.NameComment = NULL; 345 Op->Common.CommentList = NULL; 346 Op->Common.EndBlkComment = NULL; 347 Op->Common.CloseBraceComment = NULL; 348 Op->Common.CvFilename = NULL; 349 Op->Common.CvParentFilename = NULL; 350} 351 352 353/******************************************************************************* 354 * 355 * FUNCTION: CvCommentExists 356 * |
352 * PARAMETERS: address - check if this address appears in the list | 357 * PARAMETERS: Address - check if this address appears in the list |
353 * 354 * RETURN: BOOLEAN - TRUE if the address exists. 355 * | 358 * 359 * RETURN: BOOLEAN - TRUE if the address exists. 360 * |
356 * DESCRIPTION: look at the pointer address and check if this appears in the 357 * list of all addresses. If it exitsts in the list, return TRUE | 361 * DESCRIPTION: Look at the pointer address and check if this appears in the 362 * list of all addresses. If it exists in the list, return TRUE |
358 * if it exists. Otherwise add to the list and return FALSE. 359 * 360 ******************************************************************************/ 361 362static BOOLEAN 363CvCommentExists ( 364 UINT8 *Address) 365{ 366 ACPI_COMMENT_ADDR_NODE *Current = AcpiGbl_CommentAddrListHead; 367 UINT8 Option; 368 369 370 if (!Address) 371 { 372 return (FALSE); 373 } | 363 * if it exists. Otherwise add to the list and return FALSE. 364 * 365 ******************************************************************************/ 366 367static BOOLEAN 368CvCommentExists ( 369 UINT8 *Address) 370{ 371 ACPI_COMMENT_ADDR_NODE *Current = AcpiGbl_CommentAddrListHead; 372 UINT8 Option; 373 374 375 if (!Address) 376 { 377 return (FALSE); 378 } |
379 |
|
374 Option = *(Address + 1); 375 376 /* | 380 Option = *(Address + 1); 381 382 /* |
377 * FILENAME_COMMENT and PARENTFILENAME_COMMENT are not treated as comments. 378 * They serve as markers for where the file starts and ends. | 383 * FILENAME_COMMENT and PARENTFILENAME_COMMENT are not treated as 384 * comments. They serve as markers for where the file starts and ends. |
379 */ | 385 */ |
380 if ((Option == FILENAME_COMMENT) || (Option == PARENTFILENAME_COMMENT)) | 386 if ((Option == FILENAME_COMMENT) || 387 (Option == PARENTFILENAME_COMMENT)) |
381 { 382 return (FALSE); 383 } 384 385 if (!Current) 386 { 387 AcpiGbl_CommentAddrListHead = 388 AcpiOsAcquireObject (AcpiGbl_RegCommentCache); --- 11 unchanged lines hidden (view full) --- 400 } 401 else 402 { 403 return (TRUE); 404 } 405 } 406 407 /* | 388 { 389 return (FALSE); 390 } 391 392 if (!Current) 393 { 394 AcpiGbl_CommentAddrListHead = 395 AcpiOsAcquireObject (AcpiGbl_RegCommentCache); --- 11 unchanged lines hidden (view full) --- 407 } 408 else 409 { 410 return (TRUE); 411 } 412 } 413 414 /* |
408 * If the execution gets to this point, it means that this address 409 * does not exists in the list. Add this address to the | 415 * If the execution gets to this point, it means that this 416 * address does not exists in the list. Add this address to the |
410 * beginning of the list. 411 */ 412 Current = AcpiGbl_CommentAddrListHead; 413 AcpiGbl_CommentAddrListHead = 414 AcpiOsAcquireObject (AcpiGbl_RegCommentCache); | 417 * beginning of the list. 418 */ 419 Current = AcpiGbl_CommentAddrListHead; 420 AcpiGbl_CommentAddrListHead = 421 AcpiOsAcquireObject (AcpiGbl_RegCommentCache); |
422 |
|
415 AcpiGbl_CommentAddrListHead->Addr = Address; 416 AcpiGbl_CommentAddrListHead->Next = Current; 417 return (FALSE); 418 } 419} 420 421 422/******************************************************************************* --- 12 unchanged lines hidden (view full) --- 435ACPI_FILE_NODE* 436CvFilenameExists( 437 char *Filename, 438 ACPI_FILE_NODE *Head) 439{ 440 ACPI_FILE_NODE *Current = Head; 441 442 | 423 AcpiGbl_CommentAddrListHead->Addr = Address; 424 AcpiGbl_CommentAddrListHead->Next = Current; 425 return (FALSE); 426 } 427} 428 429 430/******************************************************************************* --- 12 unchanged lines hidden (view full) --- 443ACPI_FILE_NODE* 444CvFilenameExists( 445 char *Filename, 446 ACPI_FILE_NODE *Head) 447{ 448 ACPI_FILE_NODE *Current = Head; 449 450 |
451 if (!Filename) 452 { 453 return (NULL); 454 } 455 |
|
443 while (Current) 444 { 445 if (!AcpiUtStricmp (Current->Filename, Filename)) 446 { 447 return (Current); 448 } | 456 while (Current) 457 { 458 if (!AcpiUtStricmp (Current->Filename, Filename)) 459 { 460 return (Current); 461 } |
462 |
|
449 Current = Current->Next; 450 } 451 return (NULL); 452} 453 454 455/******************************************************************************* 456 * 457 * FUNCTION: CvFileAddressLookup 458 * 459 * PARAMETERS: Address - address to look up 460 * Head - file dependency tree 461 * | 463 Current = Current->Next; 464 } 465 return (NULL); 466} 467 468 469/******************************************************************************* 470 * 471 * FUNCTION: CvFileAddressLookup 472 * 473 * PARAMETERS: Address - address to look up 474 * Head - file dependency tree 475 * |
462 * RETURN: ACPI_FLE_NODE - pointer to a file node containing the address | 476 * RETURN: ACPI_FILE_NODE - pointer to a file node containing the address |
463 * 464 * DESCRIPTION: Look for the given address in the file dependency tree. 465 * Returns the first file node where the given address is within 466 * the file node's starting and ending address. 467 * 468 ******************************************************************************/ 469 | 477 * 478 * DESCRIPTION: Look for the given address in the file dependency tree. 479 * Returns the first file node where the given address is within 480 * the file node's starting and ending address. 481 * 482 ******************************************************************************/ 483 |
470static ACPI_FILE_NODE* | 484static ACPI_FILE_NODE * |
471CvFileAddressLookup( 472 char *Address, 473 ACPI_FILE_NODE *Head) 474{ 475 ACPI_FILE_NODE *Current = Head; 476 477 478 while (Current) 479 { 480 if ((Address >= Current->FileStart) && 481 (Address < Current->FileEnd || 482 !Current->FileEnd)) 483 { 484 return (Current); 485 } | 485CvFileAddressLookup( 486 char *Address, 487 ACPI_FILE_NODE *Head) 488{ 489 ACPI_FILE_NODE *Current = Head; 490 491 492 while (Current) 493 { 494 if ((Address >= Current->FileStart) && 495 (Address < Current->FileEnd || 496 !Current->FileEnd)) 497 { 498 return (Current); 499 } |
500 |
|
486 Current = Current->Next; 487 } 488 489 return (NULL); 490} 491 492 493/******************************************************************************* --- 18 unchanged lines hidden (view full) --- 512 ACPI_FILE_NODE *Node; 513 514 515 if (!Op) 516 { 517 return; 518 } 519 | 501 Current = Current->Next; 502 } 503 504 return (NULL); 505} 506 507 508/******************************************************************************* --- 18 unchanged lines hidden (view full) --- 527 ACPI_FILE_NODE *Node; 528 529 530 if (!Op) 531 { 532 return; 533 } 534 |
520 Node = CvFileAddressLookup ((char *)Op->Common.Aml, AcpiGbl_FileTreeRoot); | 535 Node = CvFileAddressLookup ((char *) 536 Op->Common.Aml, AcpiGbl_FileTreeRoot); |
521 if (!Node) 522 { 523 return; 524 } 525 526 Op->Common.CvFilename = Node->Filename; 527 if (Node->Parent) 528 { --- 10 unchanged lines hidden (view full) --- 539 * 540 * FUNCTION: CvAddToFileTree 541 * 542 * PARAMETERS: Filename - Address containing the name of the current 543 * filename 544 * PreviousFilename - Address containing the name of the previous 545 * filename 546 * | 537 if (!Node) 538 { 539 return; 540 } 541 542 Op->Common.CvFilename = Node->Filename; 543 if (Node->Parent) 544 { --- 10 unchanged lines hidden (view full) --- 555 * 556 * FUNCTION: CvAddToFileTree 557 * 558 * PARAMETERS: Filename - Address containing the name of the current 559 * filename 560 * PreviousFilename - Address containing the name of the previous 561 * filename 562 * |
547 * RETURN: void | 563 * RETURN: None |
548 * 549 * DESCRIPTION: Add this filename to the AcpiGbl_FileTree if it does not exist. 550 * 551 ******************************************************************************/ 552 553static void 554CvAddToFileTree ( 555 char *Filename, --- 20 unchanged lines hidden (view full) --- 576 { 577 return; 578 } 579 580 Node = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot); 581 if (Node && PreviousFilename) 582 { 583 /* | 564 * 565 * DESCRIPTION: Add this filename to the AcpiGbl_FileTree if it does not exist. 566 * 567 ******************************************************************************/ 568 569static void 570CvAddToFileTree ( 571 char *Filename, --- 20 unchanged lines hidden (view full) --- 592 { 593 return; 594 } 595 596 Node = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot); 597 if (Node && PreviousFilename) 598 { 599 /* |
584 * Update the end of the previous file and all of their parents' ending 585 * Addresses. This is done to ensure that parent file ranges extend to 586 * the end of their childrens' files. | 600 * Update the end of the previous file and all of their parents' 601 * ending addresses. This is done to ensure that parent file 602 * ranges extend to the end of their childrens' files. |
587 */ 588 Node = CvFilenameExists (PreviousFilename, AcpiGbl_FileTreeRoot); 589 if (Node && (Node->FileEnd < Filename)) 590 { 591 Node->FileEnd = Filename; 592 Node = Node->Parent; 593 while (Node) 594 { 595 if (Node->FileEnd < Filename) 596 { 597 Node->FileEnd = Filename; 598 } | 603 */ 604 Node = CvFilenameExists (PreviousFilename, AcpiGbl_FileTreeRoot); 605 if (Node && (Node->FileEnd < Filename)) 606 { 607 Node->FileEnd = Filename; 608 Node = Node->Parent; 609 while (Node) 610 { 611 if (Node->FileEnd < Filename) 612 { 613 Node->FileEnd = Filename; 614 } |
615 |
|
599 Node = Node->Parent; 600 } 601 } 602 } 603 else 604 { 605 Node = AcpiGbl_FileTreeRoot; 606 AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache); | 616 Node = Node->Parent; 617 } 618 } 619 } 620 else 621 { 622 Node = AcpiGbl_FileTreeRoot; 623 AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache); |
624 |
|
607 AcpiGbl_FileTreeRoot->Next = Node; 608 AcpiGbl_FileTreeRoot->Parent = NULL; 609 AcpiGbl_FileTreeRoot->Filename = Filename; 610 AcpiGbl_FileTreeRoot->FileStart = Filename; 611 AcpiGbl_FileTreeRoot->IncludeWritten = FALSE; 612 AcpiGbl_FileTreeRoot->File = fopen(Filename, "w+"); 613 614 /* 615 * If we can't open the file, we need to abort here before we 616 * accidentally write to a NULL file. 617 */ 618 if (!AcpiGbl_FileTreeRoot->File) 619 { 620 /* delete the .xxx file */ 621 622 FlDeleteFile (ASL_FILE_AML_OUTPUT); 623 sprintf (MsgBuffer, "\"%s\" - %s", Filename, strerror (errno)); | 625 AcpiGbl_FileTreeRoot->Next = Node; 626 AcpiGbl_FileTreeRoot->Parent = NULL; 627 AcpiGbl_FileTreeRoot->Filename = Filename; 628 AcpiGbl_FileTreeRoot->FileStart = Filename; 629 AcpiGbl_FileTreeRoot->IncludeWritten = FALSE; 630 AcpiGbl_FileTreeRoot->File = fopen(Filename, "w+"); 631 632 /* 633 * If we can't open the file, we need to abort here before we 634 * accidentally write to a NULL file. 635 */ 636 if (!AcpiGbl_FileTreeRoot->File) 637 { 638 /* delete the .xxx file */ 639 640 FlDeleteFile (ASL_FILE_AML_OUTPUT); 641 sprintf (MsgBuffer, "\"%s\" - %s", Filename, strerror (errno)); |
624 AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, NULL, MsgBuffer); | 642 AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, 643 NULL, MsgBuffer); |
625 AslAbort (); 626 } 627 } 628} 629 630 631/******************************************************************************* 632 * 633 * FUNCTION: CvSetFileParent 634 * 635 * PARAMETERS: ChildFile - contains the filename of the child file 636 * ParentFile - contains the filename of the parent file. 637 * | 644 AslAbort (); 645 } 646 } 647} 648 649 650/******************************************************************************* 651 * 652 * FUNCTION: CvSetFileParent 653 * 654 * PARAMETERS: ChildFile - contains the filename of the child file 655 * ParentFile - contains the filename of the parent file. 656 * |
638 * RETURN: none | 657 * RETURN: None |
639 * | 658 * |
640 * DESCRIPTION: point the parent pointer of the Child to the node that | 659 * DESCRIPTION: Point the parent pointer of the Child to the node that |
641 * corresponds with the parent file node. 642 * 643 ******************************************************************************/ 644 645static void 646CvSetFileParent ( 647 char *ChildFile, 648 char *ParentFile) 649{ 650 ACPI_FILE_NODE *Child; 651 ACPI_FILE_NODE *Parent; 652 653 654 Child = CvFilenameExists (ChildFile, AcpiGbl_FileTreeRoot); 655 Parent = CvFilenameExists (ParentFile, AcpiGbl_FileTreeRoot); | 660 * corresponds with the parent file node. 661 * 662 ******************************************************************************/ 663 664static void 665CvSetFileParent ( 666 char *ChildFile, 667 char *ParentFile) 668{ 669 ACPI_FILE_NODE *Child; 670 ACPI_FILE_NODE *Parent; 671 672 673 Child = CvFilenameExists (ChildFile, AcpiGbl_FileTreeRoot); 674 Parent = CvFilenameExists (ParentFile, AcpiGbl_FileTreeRoot); |
675 |
|
656 if (Child && Parent) 657 { 658 Child->Parent = Parent; 659 660 while (Child->Parent) 661 { 662 if (Child->Parent->FileEnd < Child->FileStart) 663 { 664 Child->Parent->FileEnd = Child->FileStart; 665 } | 676 if (Child && Parent) 677 { 678 Child->Parent = Parent; 679 680 while (Child->Parent) 681 { 682 if (Child->Parent->FileEnd < Child->FileStart) 683 { 684 Child->Parent->FileEnd = Child->FileStart; 685 } |
686 |
|
666 Child = Child->Parent; 667 } 668 } 669} 670 671 672/******************************************************************************* 673 * 674 * FUNCTION: CvCaptureCommentsOnly 675 * 676 * PARAMETERS: ParserState - A parser state object 677 * | 687 Child = Child->Parent; 688 } 689 } 690} 691 692 693/******************************************************************************* 694 * 695 * FUNCTION: CvCaptureCommentsOnly 696 * 697 * PARAMETERS: ParserState - A parser state object 698 * |
678 * RETURN: none | 699 * RETURN: None |
679 * | 700 * |
680 * DESCRIPTION: look at the aml that the parser state is pointing to, | 701 * DESCRIPTION: Look at the aml that the parser state is pointing to, |
681 * capture any AML_COMMENT_OP and it's arguments and increment the 682 * aml pointer past the comment. Comments are transferred to parse 683 * nodes through CvTransferComments() as well as 684 * AcpiPsBuildNamedOp(). 685 * This is referred as ASL_CV_CAPTURE_COMMENTS_ONLY. 686 * 687 ******************************************************************************/ 688 --- 21 unchanged lines hidden (view full) --- 710 CvDbgPrint ("comment aml address: %p\n", Aml); 711 712 if (CvCommentExists(ParserState->Aml)) 713 { 714 CvDbgPrint ("Avoiding capturing an existing comment.\n"); 715 } 716 else 717 { | 702 * capture any AML_COMMENT_OP and it's arguments and increment the 703 * aml pointer past the comment. Comments are transferred to parse 704 * nodes through CvTransferComments() as well as 705 * AcpiPsBuildNamedOp(). 706 * This is referred as ASL_CV_CAPTURE_COMMENTS_ONLY. 707 * 708 ******************************************************************************/ 709 --- 21 unchanged lines hidden (view full) --- 731 CvDbgPrint ("comment aml address: %p\n", Aml); 732 733 if (CvCommentExists(ParserState->Aml)) 734 { 735 CvDbgPrint ("Avoiding capturing an existing comment.\n"); 736 } 737 else 738 { |
718 CommentOption = *(Aml+1); | 739 CommentOption = *(Aml +1); |
719 | 740 |
720 /* Increment past the comment option and point the approperiate char pointers.*/ 721 | 741 /* 742 * Increment past the comment option and point the 743 * appropriate char pointers 744 */ |
722 Aml += 2; 723 | 745 Aml += 2; 746 |
724 /* found a comment. Now, set pointers to these comments. */ | 747 /* Found a comment. Now, set pointers to these comments. */ |
725 726 switch (CommentOption) 727 { 728 case STD_DEFBLK_COMMENT: 729 730 StdDefBlockFlag = TRUE; 731 | 748 749 switch (CommentOption) 750 { 751 case STD_DEFBLK_COMMENT: 752 753 StdDefBlockFlag = TRUE; 754 |
732 /* add to a linked list of nodes. This list will be taken by the parse node created next. */ 733 734 CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache); | 755 /* 756 * Add to a linked list of nodes. This list will be 757 * taken by the parse node created next. 758 */ 759 CommentNode = AcpiOsAcquireObject ( 760 AcpiGbl_RegCommentCache); |
735 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 736 CommentNode->Next = NULL; 737 738 if (!AcpiGbl_DefBlkCommentListHead) 739 { 740 AcpiGbl_DefBlkCommentListHead = CommentNode; 741 AcpiGbl_DefBlkCommentListTail = CommentNode; 742 } 743 else 744 { 745 AcpiGbl_DefBlkCommentListTail->Next = CommentNode; | 761 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 762 CommentNode->Next = NULL; 763 764 if (!AcpiGbl_DefBlkCommentListHead) 765 { 766 AcpiGbl_DefBlkCommentListHead = CommentNode; 767 AcpiGbl_DefBlkCommentListTail = CommentNode; 768 } 769 else 770 { 771 AcpiGbl_DefBlkCommentListTail->Next = CommentNode; |
746 AcpiGbl_DefBlkCommentListTail = AcpiGbl_DefBlkCommentListTail->Next; | 772 AcpiGbl_DefBlkCommentListTail = 773 AcpiGbl_DefBlkCommentListTail->Next; |
747 } 748 break; 749 750 case STANDARD_COMMENT: 751 752 CvDbgPrint ("found regular comment.\n"); 753 | 774 } 775 break; 776 777 case STANDARD_COMMENT: 778 779 CvDbgPrint ("found regular comment.\n"); 780 |
754 /* add to a linked list of nodes. This list will be taken by the parse node created next. */ 755 756 CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache); | 781 /* 782 * Add to a linked list of nodes. This list will be 783 * taken by the parse node created next. 784 */ 785 CommentNode = AcpiOsAcquireObject ( 786 AcpiGbl_RegCommentCache); |
757 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 758 CommentNode->Next = NULL; 759 760 if (!AcpiGbl_RegCommentListHead) 761 { 762 AcpiGbl_RegCommentListHead = CommentNode; 763 AcpiGbl_RegCommentListTail = CommentNode; 764 } 765 else 766 { 767 AcpiGbl_RegCommentListTail->Next = CommentNode; | 787 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 788 CommentNode->Next = NULL; 789 790 if (!AcpiGbl_RegCommentListHead) 791 { 792 AcpiGbl_RegCommentListHead = CommentNode; 793 AcpiGbl_RegCommentListTail = CommentNode; 794 } 795 else 796 { 797 AcpiGbl_RegCommentListTail->Next = CommentNode; |
768 AcpiGbl_RegCommentListTail = AcpiGbl_RegCommentListTail->Next; | 798 AcpiGbl_RegCommentListTail = 799 AcpiGbl_RegCommentListTail->Next; |
769 } 770 break; 771 772 case ENDBLK_COMMENT: 773 774 CvDbgPrint ("found endblk comment.\n"); 775 | 800 } 801 break; 802 803 case ENDBLK_COMMENT: 804 805 CvDbgPrint ("found endblk comment.\n"); 806 |
776 /* add to a linked list of nodes. This will be taken by the next created parse node. */ 777 778 CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache); | 807 /* Add to a linked list of nodes. This will be 808 * taken by the next created parse node. 809 */ 810 CommentNode = AcpiOsAcquireObject ( 811 AcpiGbl_RegCommentCache); |
779 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 780 CommentNode->Next = NULL; 781 782 if (!AcpiGbl_EndBlkCommentListHead) 783 { 784 AcpiGbl_EndBlkCommentListHead = CommentNode; 785 AcpiGbl_EndBlkCommentListTail = CommentNode; 786 } 787 else 788 { 789 AcpiGbl_EndBlkCommentListTail->Next = CommentNode; | 812 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 813 CommentNode->Next = NULL; 814 815 if (!AcpiGbl_EndBlkCommentListHead) 816 { 817 AcpiGbl_EndBlkCommentListHead = CommentNode; 818 AcpiGbl_EndBlkCommentListTail = CommentNode; 819 } 820 else 821 { 822 AcpiGbl_EndBlkCommentListTail->Next = CommentNode; |
790 AcpiGbl_EndBlkCommentListTail = AcpiGbl_EndBlkCommentListTail->Next; | 823 AcpiGbl_EndBlkCommentListTail = 824 AcpiGbl_EndBlkCommentListTail->Next; |
791 } 792 break; 793 794 case INLINE_COMMENT: 795 796 CvDbgPrint ("found inline comment.\n"); | 825 } 826 break; 827 828 case INLINE_COMMENT: 829 830 CvDbgPrint ("found inline comment.\n"); |
797 AcpiGbl_CurrentInlineComment = ACPI_CAST_PTR (char, Aml); | 831 AcpiGbl_CurrentInlineComment = 832 ACPI_CAST_PTR (char, Aml); |
798 break; 799 800 case ENDNODE_COMMENT: 801 802 CvDbgPrint ("found EndNode comment.\n"); | 833 break; 834 835 case ENDNODE_COMMENT: 836 837 CvDbgPrint ("found EndNode comment.\n"); |
803 AcpiGbl_CurrentEndNodeComment = ACPI_CAST_PTR (char, Aml); | 838 AcpiGbl_CurrentEndNodeComment = 839 ACPI_CAST_PTR (char, Aml); |
804 break; 805 806 case CLOSE_BRACE_COMMENT: 807 808 CvDbgPrint ("found close brace comment.\n"); | 840 break; 841 842 case CLOSE_BRACE_COMMENT: 843 844 CvDbgPrint ("found close brace comment.\n"); |
809 AcpiGbl_CurrentCloseBraceComment = ACPI_CAST_PTR (char, Aml); | 845 AcpiGbl_CurrentCloseBraceComment = 846 ACPI_CAST_PTR (char, Aml); |
810 break; 811 812 case END_DEFBLK_COMMENT: 813 | 847 break; 848 849 case END_DEFBLK_COMMENT: 850 |
814 CvDbgPrint ("Found comment that belongs after the } for a definition block.\n"); 815 AcpiGbl_CurrentScope->Common.CloseBraceComment = ACPI_CAST_PTR (char, Aml); | 851 CvDbgPrint ("Found comment that belongs after" 852 " the } for a definition block.\n"); 853 AcpiGbl_CurrentScope->Common.CloseBraceComment = 854 ACPI_CAST_PTR (char, Aml); |
816 break; 817 818 case FILENAME_COMMENT: 819 | 855 break; 856 857 case FILENAME_COMMENT: 858 |
820 CvDbgPrint ("Found a filename: %s\n", ACPI_CAST_PTR (char, Aml)); 821 FileNode = CvFilenameExists (ACPI_CAST_PTR (char, Aml), AcpiGbl_FileTreeRoot); | 859 CvDbgPrint ("Found a filename: %s\n", 860 ACPI_CAST_PTR (char, Aml)); 861 FileNode = CvFilenameExists ( 862 ACPI_CAST_PTR (char, Aml), AcpiGbl_FileTreeRoot); |
822 823 /* 824 * If there is an INCLUDE_COMMENT followed by a 825 * FILENAME_COMMENT, then the INCLUDE_COMMENT is a comment 826 * that is emitted before the #include for the file. 827 * We will save the IncludeComment within the FileNode 828 * associated with this FILENAME_COMMENT. 829 */ --- 11 unchanged lines hidden (view full) --- 841 842 case INCLUDE_COMMENT: 843 844 /* 845 * Add to a linked list. This list will be taken by the 846 * parse node created next. See the FILENAME_COMMENT case 847 * for more details 848 */ | 863 864 /* 865 * If there is an INCLUDE_COMMENT followed by a 866 * FILENAME_COMMENT, then the INCLUDE_COMMENT is a comment 867 * that is emitted before the #include for the file. 868 * We will save the IncludeComment within the FileNode 869 * associated with this FILENAME_COMMENT. 870 */ --- 11 unchanged lines hidden (view full) --- 882 883 case INCLUDE_COMMENT: 884 885 /* 886 * Add to a linked list. This list will be taken by the 887 * parse node created next. See the FILENAME_COMMENT case 888 * for more details 889 */ |
849 CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache); | 890 CommentNode = AcpiOsAcquireObject ( 891 AcpiGbl_RegCommentCache); |
850 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 851 CommentNode->Next = NULL; 852 853 if (!AcpiGbl_IncCommentListHead) 854 { 855 AcpiGbl_IncCommentListHead = CommentNode; 856 AcpiGbl_IncCommentListTail = CommentNode; 857 } 858 else 859 { 860 AcpiGbl_IncCommentListTail->Next = CommentNode; | 892 CommentNode->Comment = ACPI_CAST_PTR (char, Aml); 893 CommentNode->Next = NULL; 894 895 if (!AcpiGbl_IncCommentListHead) 896 { 897 AcpiGbl_IncCommentListHead = CommentNode; 898 AcpiGbl_IncCommentListTail = CommentNode; 899 } 900 else 901 { 902 AcpiGbl_IncCommentListTail->Next = CommentNode; |
861 AcpiGbl_IncCommentListTail = AcpiGbl_IncCommentListTail->Next; | 903 AcpiGbl_IncCommentListTail = 904 AcpiGbl_IncCommentListTail->Next; |
862 } 863 | 905 } 906 |
864 CvDbgPrint ("Found a include comment: %s\n", CommentNode->Comment); | 907 CvDbgPrint ("Found a include comment: %s\n", 908 CommentNode->Comment); |
865 break; 866 867 default: 868 869 /* Not a valid comment option. Revert the AML */ 870 871 Aml -= 2; 872 goto DefBlock; | 909 break; 910 911 default: 912 913 /* Not a valid comment option. Revert the AML */ 914 915 Aml -= 2; 916 goto DefBlock; |
873 break; | |
874 | 917 |
875 } /* end switch statement */ | 918 } /* End switch statement */ |
876 | 919 |
877 } /* end else */ | 920 } /* End else */ |
878 | 921 |
879 /* determine the length and move forward that amount */ | 922 /* Determine the length and move forward that amount */ |
880 881 Length = 0; 882 while (ParserState->Aml[Length]) 883 { 884 Length++; 885 } 886 887 ParserState->Aml += Length + 1; 888 | 923 924 Length = 0; 925 while (ParserState->Aml[Length]) 926 { 927 Length++; 928 } 929 930 ParserState->Aml += Length + 1; 931 |
889 | |
890 /* Peek at the next Opcode. */ 891 892 Aml = ParserState->Aml; 893 Opcode = (UINT16) ACPI_GET8 (Aml); | 932 /* Peek at the next Opcode. */ 933 934 Aml = ParserState->Aml; 935 Opcode = (UINT16) ACPI_GET8 (Aml); |
894 | |
895 } 896 897DefBlock: 898 if (StdDefBlockFlag) 899 { 900 /* 901 * Give all of its comments to the current scope, which is known as 902 * the definition block, since STD_DEFBLK_COMMENT only appears after --- 8 unchanged lines hidden (view full) --- 911 912 913/******************************************************************************* 914 * 915 * FUNCTION: CvCaptureComments 916 * 917 * PARAMETERS: ParserState - A parser state object 918 * | 936 } 937 938DefBlock: 939 if (StdDefBlockFlag) 940 { 941 /* 942 * Give all of its comments to the current scope, which is known as 943 * the definition block, since STD_DEFBLK_COMMENT only appears after --- 8 unchanged lines hidden (view full) --- 952 953 954/******************************************************************************* 955 * 956 * FUNCTION: CvCaptureComments 957 * 958 * PARAMETERS: ParserState - A parser state object 959 * |
919 * RETURN: none | 960 * RETURN: None |
920 * 921 * DESCRIPTION: Wrapper function for CvCaptureCommentsOnly 922 * This is referred as ASL_CV_CAPTURE_COMMENTS. 923 * 924 ******************************************************************************/ 925 926void 927CvCaptureComments ( --- 5 unchanged lines hidden (view full) --- 933 934 935 if (!Gbl_CaptureComments) 936 { 937 return; 938 } 939 940 /* | 961 * 962 * DESCRIPTION: Wrapper function for CvCaptureCommentsOnly 963 * This is referred as ASL_CV_CAPTURE_COMMENTS. 964 * 965 ******************************************************************************/ 966 967void 968CvCaptureComments ( --- 5 unchanged lines hidden (view full) --- 974 975 976 if (!Gbl_CaptureComments) 977 { 978 return; 979 } 980 981 /* |
941 * Before parsing, check to see that comments that come directly after 942 * deferred opcodes aren't being processed. | 982 * Before parsing, check to see that comments that come directly 983 * after deferred opcodes aren't being processed. |
943 */ 944 Aml = WalkState->ParserState.Aml; 945 Opcode = (UINT16) ACPI_GET8 (Aml); 946 OpInfo = AcpiPsGetOpcodeInfo (Opcode); 947 948 if (!(OpInfo->Flags & AML_DEFER) || 949 ((OpInfo->Flags & AML_DEFER) && 950 (WalkState->PassNumber != ACPI_IMODE_LOAD_PASS1))) --- 4 unchanged lines hidden (view full) --- 955 956} 957 958 959/******************************************************************************* 960 * 961 * FUNCTION: CvTransferComments 962 * | 984 */ 985 Aml = WalkState->ParserState.Aml; 986 Opcode = (UINT16) ACPI_GET8 (Aml); 987 OpInfo = AcpiPsGetOpcodeInfo (Opcode); 988 989 if (!(OpInfo->Flags & AML_DEFER) || 990 ((OpInfo->Flags & AML_DEFER) && 991 (WalkState->PassNumber != ACPI_IMODE_LOAD_PASS1))) --- 4 unchanged lines hidden (view full) --- 996 997} 998 999 1000/******************************************************************************* 1001 * 1002 * FUNCTION: CvTransferComments 1003 * |
963 * PARAMETERS: Op - Transfer comments to this Op | 1004 * PARAMETERS: Op - Transfer comments to this Op |
964 * | 1005 * |
965 * RETURN: none | 1006 * RETURN: None |
966 * 967 * DESCRIPTION: Transfer all of the commments stored in global containers to the 968 * given Op. This will be invoked shortly after the parser creates 969 * a ParseOp. 970 * This is referred as ASL_CV_TRANSFER_COMMENTS. 971 * 972 ******************************************************************************/ 973 974void 975CvTransferComments ( 976 ACPI_PARSE_OBJECT *Op) 977{ | 1007 * 1008 * DESCRIPTION: Transfer all of the commments stored in global containers to the 1009 * given Op. This will be invoked shortly after the parser creates 1010 * a ParseOp. 1011 * This is referred as ASL_CV_TRANSFER_COMMENTS. 1012 * 1013 ******************************************************************************/ 1014 1015void 1016CvTransferComments ( 1017 ACPI_PARSE_OBJECT *Op) 1018{ |
1019 |
|
978 Op->Common.InlineComment = AcpiGbl_CurrentInlineComment; 979 AcpiGbl_CurrentInlineComment = NULL; 980 981 Op->Common.EndNodeComment = AcpiGbl_CurrentEndNodeComment; 982 AcpiGbl_CurrentEndNodeComment = NULL; 983 984 Op->Common.CloseBraceComment = AcpiGbl_CurrentCloseBraceComment; 985 AcpiGbl_CurrentCloseBraceComment = NULL; 986 987 Op->Common.CommentList = AcpiGbl_RegCommentListHead; 988 AcpiGbl_RegCommentListHead = NULL; 989 AcpiGbl_RegCommentListTail = NULL; 990 991 Op->Common.EndBlkComment = AcpiGbl_EndBlkCommentListHead; 992 AcpiGbl_EndBlkCommentListHead = NULL; 993 AcpiGbl_EndBlkCommentListTail = NULL; | 1020 Op->Common.InlineComment = AcpiGbl_CurrentInlineComment; 1021 AcpiGbl_CurrentInlineComment = NULL; 1022 1023 Op->Common.EndNodeComment = AcpiGbl_CurrentEndNodeComment; 1024 AcpiGbl_CurrentEndNodeComment = NULL; 1025 1026 Op->Common.CloseBraceComment = AcpiGbl_CurrentCloseBraceComment; 1027 AcpiGbl_CurrentCloseBraceComment = NULL; 1028 1029 Op->Common.CommentList = AcpiGbl_RegCommentListHead; 1030 AcpiGbl_RegCommentListHead = NULL; 1031 AcpiGbl_RegCommentListTail = NULL; 1032 1033 Op->Common.EndBlkComment = AcpiGbl_EndBlkCommentListHead; 1034 AcpiGbl_EndBlkCommentListHead = NULL; 1035 AcpiGbl_EndBlkCommentListTail = NULL; |
994 | |
995} | 1036} |