aslpredef.c revision 218590
1/****************************************************************************** 2 * 3 * Module Name: aslpredef - support for ACPI predefined names 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2011, 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. 29 * 30 * NO WARRANTY 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 ACPI_CREATE_PREDEFINED_TABLE 45 46#include <contrib/dev/acpica/compiler/aslcompiler.h> 47#include "aslcompiler.y.h" 48#include <contrib/dev/acpica/include/acpredef.h> 49 50 51#define _COMPONENT ACPI_COMPILER 52 ACPI_MODULE_NAME ("aslpredef") 53 54 55/* Local prototypes */ 56 57static void 58ApCheckForUnexpectedReturnValue ( 59 ACPI_PARSE_OBJECT *Op, 60 ASL_METHOD_INFO *MethodInfo); 61 62static UINT32 63ApCheckForSpecialName ( 64 ACPI_PARSE_OBJECT *Op, 65 char *Name); 66 67static void 68ApCheckObjectType ( 69 ACPI_PARSE_OBJECT *Op, 70 UINT32 ExpectedBtypes); 71 72static void 73ApGetExpectedTypes ( 74 char *Buffer, 75 UINT32 ExpectedBtypes); 76 77 78/* 79 * Names for the types that can be returned by the predefined objects. 80 * Used for warning messages. Must be in the same order as the ACPI_RTYPEs 81 */ 82static const char *AcpiRtypeNames[] = 83{ 84 "/Integer", 85 "/String", 86 "/Buffer", 87 "/Package", 88 "/Reference", 89}; 90 91/* 92 * Predefined names for use in Resource Descriptors. These names do not 93 * appear in the global Predefined Name table (since these names never 94 * appear in actual AML byte code, only in the original ASL) 95 */ 96static const ACPI_PREDEFINED_INFO ResourceNames[] = { 97 {{"_ALN", 0, 0}}, 98 {{"_ASI", 0, 0}}, 99 {{"_ASZ", 0, 0}}, 100 {{"_ATT", 0, 0}}, 101 {{"_BAS", 0, 0}}, 102 {{"_BM_", 0, 0}}, 103 {{"_DEC", 0, 0}}, 104 {{"_GRA", 0, 0}}, 105 {{"_HE_", 0, 0}}, 106 {{"_INT", 0, 0}}, 107 {{"_LEN", 0, 0}}, 108 {{"_LL_", 0, 0}}, 109 {{"_MAF", 0, 0}}, 110 {{"_MAX", 0, 0}}, 111 {{"_MEM", 0, 0}}, 112 {{"_MIF", 0, 0}}, 113 {{"_MIN", 0, 0}}, 114 {{"_MTP", 0, 0}}, 115 {{"_RBO", 0, 0}}, 116 {{"_RBW", 0, 0}}, 117 {{"_RNG", 0, 0}}, 118 {{"_RT_", 0, 0}}, /* Acpi 3.0 */ 119 {{"_RW_", 0, 0}}, 120 {{"_SHR", 0, 0}}, 121 {{"_SIZ", 0, 0}}, 122 {{"_TRA", 0, 0}}, 123 {{"_TRS", 0, 0}}, 124 {{"_TSF", 0, 0}}, /* Acpi 3.0 */ 125 {{"_TTP", 0, 0}}, 126 {{"_TYP", 0, 0}}, 127 {{{0,0,0,0}, 0, 0}} /* Table terminator */ 128}; 129 130static const ACPI_PREDEFINED_INFO ScopeNames[] = { 131 {{"_SB_", 0, 0}}, 132 {{"_SI_", 0, 0}}, 133 {{"_TZ_", 0, 0}}, 134 {{{0,0,0,0}, 0, 0}} /* Table terminator */ 135}; 136 137 138/******************************************************************************* 139 * 140 * FUNCTION: ApCheckForPredefinedMethod 141 * 142 * PARAMETERS: Op - A parse node of type "METHOD". 143 * MethodInfo - Saved info about this method 144 * 145 * RETURN: None 146 * 147 * DESCRIPTION: If method is a predefined name, check that the number of 148 * arguments and the return type (returns a value or not) 149 * is correct. 150 * 151 ******************************************************************************/ 152 153void 154ApCheckForPredefinedMethod ( 155 ACPI_PARSE_OBJECT *Op, 156 ASL_METHOD_INFO *MethodInfo) 157{ 158 UINT32 Index; 159 UINT32 RequiredArgsCurrent; 160 UINT32 RequiredArgsOld; 161 162 163 /* Check for a match against the predefined name list */ 164 165 Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); 166 167 switch (Index) 168 { 169 case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ 170 case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ 171 case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ 172 173 /* Just return, nothing to do */ 174 break; 175 176 177 case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ 178 179 Gbl_ReservedMethods++; 180 181 /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */ 182 183 if (MethodInfo->NumArguments != 0) 184 { 185 sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0); 186 187 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, 188 MsgBuffer); 189 } 190 break; 191 192 193 default: 194 /* 195 * Matched a predefined method name 196 * 197 * Validate the ASL-defined argument count. Allow two different legal 198 * arg counts. 199 */ 200 Gbl_ReservedMethods++; 201 202 RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F; 203 RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4; 204 205 if ((MethodInfo->NumArguments != RequiredArgsCurrent) && 206 (MethodInfo->NumArguments != RequiredArgsOld)) 207 { 208 sprintf (MsgBuffer, "%4.4s requires %u", 209 PredefinedNames[Index].Info.Name, RequiredArgsCurrent); 210 211 if (MethodInfo->NumArguments > RequiredArgsCurrent) 212 { 213 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, 214 MsgBuffer); 215 } 216 else 217 { 218 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, 219 MsgBuffer); 220 } 221 } 222 223 /* 224 * Check if method returns no value, but the predefined name is 225 * required to return a value 226 */ 227 if (MethodInfo->NumReturnNoValue && 228 PredefinedNames[Index].Info.ExpectedBtypes) 229 { 230 ApGetExpectedTypes (StringBuffer, 231 PredefinedNames[Index].Info.ExpectedBtypes); 232 233 sprintf (MsgBuffer, "%s required for %4.4s", 234 StringBuffer, PredefinedNames[Index].Info.Name); 235 236 AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, 237 MsgBuffer); 238 } 239 break; 240 } 241} 242 243 244/******************************************************************************* 245 * 246 * FUNCTION: ApCheckForUnexpectedReturnValue 247 * 248 * PARAMETERS: Op - A parse node of type "RETURN". 249 * MethodInfo - Saved info about this method 250 * 251 * RETURN: None 252 * 253 * DESCRIPTION: Check for an unexpected return value from a predefined method. 254 * Invoked for predefined methods that are defined to not return 255 * any value. If there is a return value, issue a remark, since 256 * the ASL writer may be confused as to the method definition 257 * and/or functionality. 258 * 259 * Note: We ignore all return values of "Zero", since this is what a standalone 260 * Return() statement will always generate -- so we ignore it here -- 261 * i.e., there is no difference between Return() and Return(Zero). 262 * Also, a null Return() will be disassembled to return(Zero) -- so, we 263 * don't want to generate extraneous remarks/warnings for a disassembled 264 * ASL file. 265 * 266 ******************************************************************************/ 267 268static void 269ApCheckForUnexpectedReturnValue ( 270 ACPI_PARSE_OBJECT *Op, 271 ASL_METHOD_INFO *MethodInfo) 272{ 273 ACPI_PARSE_OBJECT *ReturnValueOp; 274 275 276 /* Ignore Return() and Return(Zero) (they are the same) */ 277 278 ReturnValueOp = Op->Asl.Child; 279 if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO) 280 { 281 return; 282 } 283 284 /* We have a valid return value, but the reserved name did not expect it */ 285 286 AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL, 287 Op, MethodInfo->Op->Asl.ExternalName); 288} 289 290 291/******************************************************************************* 292 * 293 * FUNCTION: ApCheckPredefinedReturnValue 294 * 295 * PARAMETERS: Op - A parse node of type "RETURN". 296 * MethodInfo - Saved info about this method 297 * 298 * RETURN: None 299 * 300 * DESCRIPTION: If method is a predefined name, attempt to validate the return 301 * value. Only "static" types can be validated - a simple return 302 * of an integer/string/buffer/package or a named reference to 303 * a static object. Values such as a Localx or Argx or a control 304 * method invocation are not checked. Issue a warning if there is 305 * a valid return value, but the reserved method defines no 306 * return value. 307 * 308 ******************************************************************************/ 309 310void 311ApCheckPredefinedReturnValue ( 312 ACPI_PARSE_OBJECT *Op, 313 ASL_METHOD_INFO *MethodInfo) 314{ 315 UINT32 Index; 316 ACPI_PARSE_OBJECT *ReturnValueOp; 317 318 319 /* Check parent method for a match against the predefined name list */ 320 321 Index = ApCheckForPredefinedName (MethodInfo->Op, 322 MethodInfo->Op->Asl.NameSeg); 323 324 switch (Index) 325 { 326 case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ 327 328 /* No return value expected, warn if there is one */ 329 330 ApCheckForUnexpectedReturnValue (Op, MethodInfo); 331 return; 332 333 case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ 334 case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ 335 case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ 336 337 /* Just return, nothing to do */ 338 return; 339 340 default: /* A standard predefined ACPI name */ 341 342 if (!PredefinedNames[Index].Info.ExpectedBtypes) 343 { 344 /* No return value expected, warn if there is one */ 345 346 ApCheckForUnexpectedReturnValue (Op, MethodInfo); 347 return; 348 } 349 350 /* Get the object returned, it is the next argument */ 351 352 ReturnValueOp = Op->Asl.Child; 353 switch (ReturnValueOp->Asl.ParseOpcode) 354 { 355 case PARSEOP_ZERO: 356 case PARSEOP_ONE: 357 case PARSEOP_ONES: 358 case PARSEOP_INTEGER: 359 case PARSEOP_STRING_LITERAL: 360 case PARSEOP_BUFFER: 361 case PARSEOP_PACKAGE: 362 363 /* Static data return object - check against expected type */ 364 365 ApCheckObjectType (ReturnValueOp, 366 PredefinedNames[Index].Info.ExpectedBtypes); 367 break; 368 369 default: 370 371 /* 372 * All other ops are very difficult or impossible to typecheck at 373 * compile time. These include all Localx, Argx, and method 374 * invocations. Also, NAMESEG and NAMESTRING because the type of 375 * any named object can be changed at runtime (for example, 376 * CopyObject will change the type of the target object.) 377 */ 378 break; 379 } 380 } 381} 382 383 384/******************************************************************************* 385 * 386 * FUNCTION: ApCheckForPredefinedObject 387 * 388 * PARAMETERS: Op - A parse node 389 * Name - The ACPI name to be checked 390 * 391 * RETURN: None 392 * 393 * DESCRIPTION: Check for a predefined name for a static object (created via 394 * the ASL Name operator). If it is a predefined ACPI name, ensure 395 * that the name does not require any arguments (which would 396 * require a control method implemenation of the name), and that 397 * the type of the object is one of the expected types for the 398 * predefined name. 399 * 400 ******************************************************************************/ 401 402void 403ApCheckForPredefinedObject ( 404 ACPI_PARSE_OBJECT *Op, 405 char *Name) 406{ 407 UINT32 Index; 408 409 410 /* 411 * Check for a real predefined name -- not a resource descriptor name 412 * or a predefined scope name 413 */ 414 Index = ApCheckForPredefinedName (Op, Name); 415 416 switch (Index) 417 { 418 case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ 419 case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ 420 case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ 421 422 /* Nothing to do */ 423 return; 424 425 case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ 426 427 /* 428 * These names must be control methods, by definition in ACPI spec. 429 * Also because they are defined to return no value. None of them 430 * require any arguments. 431 */ 432 AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, 433 "with zero arguments"); 434 return; 435 436 default: /* A standard predefined ACPI name */ 437 438 /* 439 * If this predefined name requires input arguments, then 440 * it must be implemented as a control method 441 */ 442 if (PredefinedNames[Index].Info.ParamCount > 0) 443 { 444 AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, 445 "with arguments"); 446 return; 447 } 448 449 /* 450 * If no return value is expected from this predefined name, then 451 * it follows that it must be implemented as a control method 452 * (with zero args, because the args > 0 case was handled above) 453 * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx 454 */ 455 if (!PredefinedNames[Index].Info.ExpectedBtypes) 456 { 457 AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, 458 "with zero arguments"); 459 return; 460 } 461 462 /* Typecheck the actual object, it is the next argument */ 463 464 ApCheckObjectType (Op->Asl.Child->Asl.Next, 465 PredefinedNames[Index].Info.ExpectedBtypes); 466 return; 467 } 468} 469 470 471/******************************************************************************* 472 * 473 * FUNCTION: ApCheckForPredefinedName 474 * 475 * PARAMETERS: Op - A parse node 476 * Name - NameSeg to check 477 * 478 * RETURN: None 479 * 480 * DESCRIPTION: Check a NameSeg against the reserved list. 481 * 482 ******************************************************************************/ 483 484UINT32 485ApCheckForPredefinedName ( 486 ACPI_PARSE_OBJECT *Op, 487 char *Name) 488{ 489 UINT32 i; 490 491 492 if (Name[0] == 0) 493 { 494 AcpiOsPrintf ("Found a null name, external = %s\n", 495 Op->Asl.ExternalName); 496 } 497 498 /* All reserved names are prefixed with a single underscore */ 499 500 if (Name[0] != '_') 501 { 502 return (ACPI_NOT_RESERVED_NAME); 503 } 504 505 /* Check for a standard predefined method name */ 506 507 for (i = 0; PredefinedNames[i].Info.Name[0]; i++) 508 { 509 if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name)) 510 { 511 /* Return index into predefined array */ 512 return (i); 513 } 514 } 515 516 /* Check for resource names and predefined scope names */ 517 518 for (i = 0; ResourceNames[i].Info.Name[0]; i++) 519 { 520 if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name)) 521 { 522 return (ACPI_PREDEFINED_NAME); 523 } 524 } 525 526 for (i = 0; ScopeNames[i].Info.Name[0]; i++) 527 { 528 if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name)) 529 { 530 return (ACPI_PREDEFINED_NAME); 531 } 532 } 533 534 /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */ 535 536 return (ApCheckForSpecialName (Op, Name)); 537} 538 539 540/******************************************************************************* 541 * 542 * FUNCTION: ApCheckForSpecialName 543 * 544 * PARAMETERS: Op - A parse node 545 * Name - NameSeg to check 546 * 547 * RETURN: None 548 * 549 * DESCRIPTION: Check for the "special" predefined names - 550 * _Lxx, _Exx, _Qxx, _Wxx, and _T_x 551 * 552 ******************************************************************************/ 553 554static UINT32 555ApCheckForSpecialName ( 556 ACPI_PARSE_OBJECT *Op, 557 char *Name) 558{ 559 560 /* 561 * Check for the "special" predefined names. We already know that the 562 * first character is an underscore. 563 * GPE: _Lxx 564 * GPE: _Exx 565 * GPE: _Wxx 566 * EC: _Qxx 567 */ 568 if ((Name[1] == 'L') || 569 (Name[1] == 'E') || 570 (Name[1] == 'W') || 571 (Name[1] == 'Q')) 572 { 573 /* The next two characters must be hex digits */ 574 575 if ((isxdigit ((int) Name[2])) && 576 (isxdigit ((int) Name[3]))) 577 { 578 return (ACPI_EVENT_RESERVED_NAME); 579 } 580 } 581 582 /* Check for the names reserved for the compiler itself: _T_x */ 583 584 else if ((Op->Asl.ExternalName[1] == 'T') && 585 (Op->Asl.ExternalName[2] == '_')) 586 { 587 /* Ignore if actually emitted by the compiler */ 588 589 if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED) 590 { 591 return (ACPI_NOT_RESERVED_NAME); 592 } 593 594 /* 595 * Was not actually emitted by the compiler. This is a special case, 596 * however. If the ASL code being compiled was the result of a 597 * dissasembly, it may possibly contain valid compiler-emitted names 598 * of the form "_T_x". We don't want to issue an error or even a 599 * warning and force the user to manually change the names. So, we 600 * will issue a remark instead. 601 */ 602 AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); 603 return (ACPI_COMPILER_RESERVED_NAME); 604 } 605 606 /* 607 * The name didn't match any of the known predefined names. Flag it as a 608 * warning, since the entire namespace starting with an underscore is 609 * reserved by the ACPI spec. 610 */ 611 AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, 612 Op->Asl.ExternalName); 613 614 return (ACPI_NOT_RESERVED_NAME); 615} 616 617 618/******************************************************************************* 619 * 620 * FUNCTION: ApCheckObjectType 621 * 622 * PARAMETERS: Op - Current parse node 623 * ExpectedBtypes - Bitmap of expected return type(s) 624 * 625 * RETURN: None 626 * 627 * DESCRIPTION: Check if the object type is one of the types that is expected 628 * by the predefined name. Only a limited number of object types 629 * can be returned by the predefined names. 630 * 631 ******************************************************************************/ 632 633static void 634ApCheckObjectType ( 635 ACPI_PARSE_OBJECT *Op, 636 UINT32 ExpectedBtypes) 637{ 638 UINT32 ReturnBtype; 639 640 641 switch (Op->Asl.ParseOpcode) 642 { 643 case PARSEOP_ZERO: 644 case PARSEOP_ONE: 645 case PARSEOP_ONES: 646 case PARSEOP_INTEGER: 647 ReturnBtype = ACPI_RTYPE_INTEGER; 648 break; 649 650 case PARSEOP_BUFFER: 651 ReturnBtype = ACPI_RTYPE_BUFFER; 652 break; 653 654 case PARSEOP_STRING_LITERAL: 655 ReturnBtype = ACPI_RTYPE_STRING; 656 break; 657 658 case PARSEOP_PACKAGE: 659 ReturnBtype = ACPI_RTYPE_PACKAGE; 660 break; 661 662 default: 663 /* Not one of the supported object types */ 664 665 goto TypeErrorExit; 666 } 667 668 /* Exit if the object is one of the expected types */ 669 670 if (ReturnBtype & ExpectedBtypes) 671 { 672 return; 673 } 674 675 676TypeErrorExit: 677 678 /* Format the expected types and emit an error message */ 679 680 ApGetExpectedTypes (StringBuffer, ExpectedBtypes); 681 682 sprintf (MsgBuffer, "found %s, requires %s", 683 UtGetOpName (Op->Asl.ParseOpcode), StringBuffer); 684 685 AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, 686 MsgBuffer); 687} 688 689 690/******************************************************************************* 691 * 692 * FUNCTION: ApDisplayReservedNames 693 * 694 * PARAMETERS: None 695 * 696 * RETURN: None 697 * 698 * DESCRIPTION: Dump information about the ACPI predefined names and predefined 699 * resource descriptor names. 700 * 701 ******************************************************************************/ 702 703void 704ApDisplayReservedNames ( 705 void) 706{ 707 const ACPI_PREDEFINED_INFO *ThisName; 708 char TypeBuffer[48]; /* Room for 5 types */ 709 UINT32 Count; 710 711 712 /* 713 * Predefined names/methods 714 */ 715 printf ("\nPredefined Name Information\n\n"); 716 717 Count = 0; 718 ThisName = PredefinedNames; 719 while (ThisName->Info.Name[0]) 720 { 721 printf ("%4.4s Requires %u arguments, ", 722 ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F); 723 724 if (ThisName->Info.ExpectedBtypes) 725 { 726 ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes); 727 printf ("Must return: %s\n", TypeBuffer); 728 } 729 else 730 { 731 printf ("No return value\n"); 732 } 733 734 /* 735 * Skip next entry in the table if this name returns a Package 736 * (next entry contains the package info) 737 */ 738 if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) 739 { 740 ThisName++; 741 } 742 743 Count++; 744 ThisName++; 745 } 746 747 printf ("%u Predefined Names are recognized\n", Count); 748 749 /* 750 * Resource Descriptor names 751 */ 752 printf ("\nResource Descriptor Predefined Names\n\n"); 753 754 Count = 0; 755 ThisName = ResourceNames; 756 while (ThisName->Info.Name[0]) 757 { 758 printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name); 759 Count++; 760 ThisName++; 761 } 762 763 printf ("%u Resource Descriptor Names are recognized\n", Count); 764 765 /* 766 * Predefined scope names 767 */ 768 printf ("\nPredefined Scope Names\n\n"); 769 770 ThisName = ScopeNames; 771 while (ThisName->Info.Name[0]) 772 { 773 printf ("%4.4s Scope\n", ThisName->Info.Name); 774 ThisName++; 775 } 776} 777 778 779/******************************************************************************* 780 * 781 * FUNCTION: ApGetExpectedTypes 782 * 783 * PARAMETERS: Buffer - Where the formatted string is returned 784 * ExpectedBTypes - Bitfield of expected data types 785 * 786 * RETURN: None, formatted string 787 * 788 * DESCRIPTION: Format the expected object types into a printable string. 789 * 790 ******************************************************************************/ 791 792static void 793ApGetExpectedTypes ( 794 char *Buffer, 795 UINT32 ExpectedBtypes) 796{ 797 UINT32 ThisRtype; 798 UINT32 i; 799 UINT32 j; 800 801 802 j = 1; 803 Buffer[0] = 0; 804 ThisRtype = ACPI_RTYPE_INTEGER; 805 806 for (i = 0; i < ACPI_NUM_RTYPES; i++) 807 { 808 /* If one of the expected types, concatenate the name of this type */ 809 810 if (ExpectedBtypes & ThisRtype) 811 { 812 ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); 813 j = 0; /* Use name separator from now on */ 814 } 815 ThisRtype <<= 1; /* Next Rtype */ 816 } 817} 818 819