1 /****************************************************************************** 2 * 3 * Module Name: aslpredef - support for ACPI predefined names 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 *****************************************************************************/ 115 116 #define ACPI_CREATE_PREDEFINED_TABLE 117 118 #include <contrib/dev/acpica/compiler/aslcompiler.h> 119 #include "aslcompiler.y.h" 120 #include <contrib/dev/acpica/include/acpredef.h> 121 122 123 #define _COMPONENT ACPI_COMPILER 124 ACPI_MODULE_NAME ("aslpredef") 125 126 127 /* Local prototypes */ 128 129 static UINT32 130 ApCheckForSpecialName ( 131 ACPI_PARSE_OBJECT *Op, 132 char *Name); 133 134 static void 135 ApCheckObjectType ( 136 ACPI_PARSE_OBJECT *Op, 137 UINT32 ExpectedBtypes); 138 139 static void 140 ApGetExpectedTypes ( 141 char *Buffer, 142 UINT32 ExpectedBtypes); 143 144 145 /* 146 * Names for the types that can be returned by the predefined objects. 147 * Used for warning messages. Must be in the same order as the ACPI_RTYPEs 148 */ 149 static const char *AcpiRtypeNames[] = 150 { 151 "/Integer", 152 "/String", 153 "/Buffer", 154 "/Package", 155 "/Reference", 156 }; 157 158 /* 159 * Predefined names for use in Resource Descriptors. These names do not 160 * appear in the global Predefined Name table (since these names never 161 * appear in actual AML byte code, only in the original ASL) 162 */ 163 static const ACPI_PREDEFINED_INFO ResourceNames[] = { 164 {{"_ALN", 0, 0}}, 165 {{"_ASI", 0, 0}}, 166 {{"_ASZ", 0, 0}}, 167 {{"_ATT", 0, 0}}, 168 {{"_BAS", 0, 0}}, 169 {{"_BM_", 0, 0}}, 170 {{"_DEC", 0, 0}}, 171 {{"_GRA", 0, 0}}, 172 {{"_HE_", 0, 0}}, 173 {{"_INT", 0, 0}}, 174 {{"_LEN", 0, 0}}, 175 {{"_LL_", 0, 0}}, 176 {{"_MAF", 0, 0}}, 177 {{"_MAX", 0, 0}}, 178 {{"_MEM", 0, 0}}, 179 {{"_MIF", 0, 0}}, 180 {{"_MIN", 0, 0}}, 181 {{"_MTP", 0, 0}}, 182 {{"_RBO", 0, 0}}, 183 {{"_RBW", 0, 0}}, 184 {{"_RNG", 0, 0}}, 185 {{"_RT_", 0, 0}}, /* Acpi 3.0 */ 186 {{"_RW_", 0, 0}}, 187 {{"_SHR", 0, 0}}, 188 {{"_SIZ", 0, 0}}, 189 {{"_TRA", 0, 0}}, 190 {{"_TRS", 0, 0}}, 191 {{"_TSF", 0, 0}}, /* Acpi 3.0 */ 192 {{"_TTP", 0, 0}}, 193 {{"_TYP", 0, 0}}, 194 {{{0,0,0,0}, 0, 0}} /* Table terminator */ 195 }; 196 197 static const ACPI_PREDEFINED_INFO ScopeNames[] = { 198 {{"_SB_", 0, 0}}, 199 {{"_SI_", 0, 0}}, 200 {{"_TZ_", 0, 0}}, 201 {{{0,0,0,0}, 0, 0}} /* Table terminator */ 202 }; 203 204 205 /******************************************************************************* 206 * 207 * FUNCTION: ApCheckForPredefinedMethod 208 * 209 * PARAMETERS: Op - A parse node of type "METHOD". 210 * MethodInfo - Saved info about this method 211 * 212 * RETURN: None 213 * 214 * DESCRIPTION: If method is a predefined name, check that the number of 215 * arguments and the return type (returns a value or not) 216 * is correct. 217 * 218 ******************************************************************************/ 219 220 void 221 ApCheckForPredefinedMethod ( 222 ACPI_PARSE_OBJECT *Op, 223 ASL_METHOD_INFO *MethodInfo) 224 { 225 UINT32 Index; 226 UINT32 RequiredArgsCurrent; 227 UINT32 RequiredArgsOld; 228 229 230 /* Check for a match against the predefined name list */ 231 232 Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); 233 234 switch (Index) 235 { 236 case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ 237 case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ 238 case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ 239 240 /* Just return, nothing to do */ 241 break; 242 243 244 case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ 245 246 Gbl_ReservedMethods++; 247 248 /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */ 249 250 if (MethodInfo->NumArguments != 0) 251 { 252 sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0); 253 254 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, 255 MsgBuffer); 256 } 257 break; 258 259 260 default: 261 /* 262 * Matched a predefined method name 263 * 264 * Validate the ASL-defined argument count. Allow two different legal 265 * arg counts. 266 */ 267 Gbl_ReservedMethods++; 268 269 RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F; 270 RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4; 271 272 if ((MethodInfo->NumArguments != RequiredArgsCurrent) && 273 (MethodInfo->NumArguments != RequiredArgsOld)) 274 { 275 sprintf (MsgBuffer, "%4.4s requires %u", 276 PredefinedNames[Index].Info.Name, RequiredArgsCurrent); 277 278 if (MethodInfo->NumArguments > RequiredArgsCurrent) 279 { 280 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, 281 MsgBuffer); 282 } 283 else 284 { 285 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, 286 MsgBuffer); 287 } 288 } 289 290 /* 291 * Check if method returns no value, but the predefined name is 292 * required to return a value 293 */ 294 if (MethodInfo->NumReturnNoValue && 295 PredefinedNames[Index].Info.ExpectedBtypes) 296 { 297 ApGetExpectedTypes (StringBuffer, 298 PredefinedNames[Index].Info.ExpectedBtypes); 299 300 sprintf (MsgBuffer, "%s required for %4.4s", 301 StringBuffer, PredefinedNames[Index].Info.Name); 302 303 AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, 304 MsgBuffer); 305 } 306 break; 307 } 308 } 309 310 311 /******************************************************************************* 312 * 313 * FUNCTION: ApCheckPredefinedReturnValue 314 * 315 * PARAMETERS: Op - A parse node of type "RETURN". 316 * MethodInfo - Saved info about this method 317 * 318 * RETURN: None 319 * 320 * DESCRIPTION: If method is a predefined name, attempt to validate the return 321 * value. Only "static" types can be validated - a simple return 322 * of an integer/string/buffer/package or a named reference to 323 * a static object. Values such as a Localx or Argx or a control 324 * method invocation are not checked. 325 * 326 ******************************************************************************/ 327 328 void 329 ApCheckPredefinedReturnValue ( 330 ACPI_PARSE_OBJECT *Op, 331 ASL_METHOD_INFO *MethodInfo) 332 { 333 UINT32 Index; 334 ACPI_PARSE_OBJECT *ReturnValueOp; 335 336 337 /* Check parent method for a match against the predefined name list */ 338 339 Index = ApCheckForPredefinedName (MethodInfo->Op, 340 MethodInfo->Op->Asl.NameSeg); 341 342 switch (Index) 343 { 344 case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ 345 case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ 346 case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ 347 case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ 348 349 /* Just return, nothing to do */ 350 return; 351 352 default: /* A standard predefined ACPI name */ 353 354 /* Exit if no return value expected */ 355 356 if (!PredefinedNames[Index].Info.ExpectedBtypes) 357 { 358 return; 359 } 360 361 /* Get the object returned, it is the next argument */ 362 363 ReturnValueOp = Op->Asl.Child; 364 switch (ReturnValueOp->Asl.ParseOpcode) 365 { 366 case PARSEOP_ZERO: 367 case PARSEOP_ONE: 368 case PARSEOP_ONES: 369 case PARSEOP_INTEGER: 370 case PARSEOP_STRING_LITERAL: 371 case PARSEOP_BUFFER: 372 case PARSEOP_PACKAGE: 373 374 /* Static data return object - check against expected type */ 375 376 ApCheckObjectType (ReturnValueOp, 377 PredefinedNames[Index].Info.ExpectedBtypes); 378 break; 379 380 default: 381 382 /* 383 * All other ops are very difficult or impossible to typecheck at 384 * compile time. These include all Localx, Argx, and method 385 * invocations. Also, NAMESEG and NAMESTRING because the type of 386 * any named object can be changed at runtime (for example, 387 * CopyObject will change the type of the target object.) 388 */ 389 break; 390 } 391 } 392 } 393 394 395 /******************************************************************************* 396 * 397 * FUNCTION: ApCheckForPredefinedObject 398 * 399 * PARAMETERS: Op - A parse node 400 * Name - The ACPI name to be checked 401 * 402 * RETURN: None 403 * 404 * DESCRIPTION: Check for a predefined name for a static object (created via 405 * the ASL Name operator). If it is a predefined ACPI name, ensure 406 * that the name does not require any arguments (which would 407 * require a control method implemenation of the name), and that 408 * the type of the object is one of the expected types for the 409 * predefined name. 410 * 411 ******************************************************************************/ 412 413 void 414 ApCheckForPredefinedObject ( 415 ACPI_PARSE_OBJECT *Op, 416 char *Name) 417 { 418 UINT32 Index; 419 420 421 /* 422 * Check for a real predefined name -- not a resource descriptor name 423 * or a predefined scope name 424 */ 425 Index = ApCheckForPredefinedName (Op, Name); 426 427 switch (Index) 428 { 429 case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ 430 case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ 431 case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ 432 433 /* Nothing to do */ 434 return; 435 436 case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ 437 438 /* 439 * These names must be control methods, by definition in ACPI spec. 440 * Also because they are defined to return no value. None of them 441 * require any arguments. 442 */ 443 AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, 444 "with zero arguments"); 445 return; 446 447 default: /* A standard predefined ACPI name */ 448 449 /* 450 * If this predefined name requires input arguments, then 451 * it must be implemented as a control method 452 */ 453 if (PredefinedNames[Index].Info.ParamCount > 0) 454 { 455 AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, 456 "with arguments"); 457 return; 458 } 459 460 /* 461 * If no return value is expected from this predefined name, then 462 * it follows that it must be implemented as a control method 463 * (with zero args, because the args > 0 case was handled above) 464 * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx 465 */ 466 if (!PredefinedNames[Index].Info.ExpectedBtypes) 467 { 468 AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, 469 "with zero arguments"); 470 return; 471 } 472 473 /* Typecheck the actual object, it is the next argument */ 474 475 ApCheckObjectType (Op->Asl.Child->Asl.Next, 476 PredefinedNames[Index].Info.ExpectedBtypes); 477 return; 478 } 479 } 480 481 482 /******************************************************************************* 483 * 484 * FUNCTION: ApCheckForPredefinedName 485 * 486 * PARAMETERS: Op - A parse node 487 * Name - NameSeg to check 488 * 489 * RETURN: None 490 * 491 * DESCRIPTION: Check a NameSeg against the reserved list. 492 * 493 ******************************************************************************/ 494 495 UINT32 496 ApCheckForPredefinedName ( 497 ACPI_PARSE_OBJECT *Op, 498 char *Name) 499 { 500 UINT32 i; 501 502 503 if (Name[0] == 0) 504 { 505 AcpiOsPrintf ("Found a null name, external = %s\n", 506 Op->Asl.ExternalName); 507 } 508 509 /* All reserved names are prefixed with a single underscore */ 510 511 if (Name[0] != '_') 512 { 513 return (ACPI_NOT_RESERVED_NAME); 514 } 515 516 /* Check for a standard predefined method name */ 517 518 for (i = 0; PredefinedNames[i].Info.Name[0]; i++) 519 { 520 if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name)) 521 { 522 /* Return index into predefined array */ 523 return (i); 524 } 525 } 526 527 /* Check for resource names and predefined scope names */ 528 529 for (i = 0; ResourceNames[i].Info.Name[0]; i++) 530 { 531 if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name)) 532 { 533 return (ACPI_PREDEFINED_NAME); 534 } 535 } 536 537 for (i = 0; ScopeNames[i].Info.Name[0]; i++) 538 { 539 if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name)) 540 { 541 return (ACPI_PREDEFINED_NAME); 542 } 543 } 544 545 /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */ 546 547 return (ApCheckForSpecialName (Op, Name)); 548 } 549 550 551 /******************************************************************************* 552 * 553 * FUNCTION: ApCheckForSpecialName 554 * 555 * PARAMETERS: Op - A parse node 556 * Name - NameSeg to check 557 * 558 * RETURN: None 559 * 560 * DESCRIPTION: Check for the "special" predefined names - 561 * _Lxx, _Exx, _Qxx, _Wxx, and _T_x 562 * 563 ******************************************************************************/ 564 565 static UINT32 566 ApCheckForSpecialName ( 567 ACPI_PARSE_OBJECT *Op, 568 char *Name) 569 { 570 571 /* 572 * Check for the "special" predefined names. We already know that the 573 * first character is an underscore. 574 * GPE: _Lxx 575 * GPE: _Exx 576 * GPE: _Wxx 577 * EC: _Qxx 578 */ 579 if ((Name[1] == 'L') || 580 (Name[1] == 'E') || 581 (Name[1] == 'W') || 582 (Name[1] == 'Q')) 583 { 584 /* The next two characters must be hex digits */ 585 586 if ((isxdigit ((int) Name[2])) && 587 (isxdigit ((int) Name[3]))) 588 { 589 return (ACPI_EVENT_RESERVED_NAME); 590 } 591 } 592 593 /* Check for the names reserved for the compiler itself: _T_x */ 594 595 else if ((Op->Asl.ExternalName[1] == 'T') && 596 (Op->Asl.ExternalName[2] == '_')) 597 { 598 /* Ignore if actually emitted by the compiler */ 599 600 if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED) 601 { 602 return (ACPI_NOT_RESERVED_NAME); 603 } 604 605 /* 606 * Was not actually emitted by the compiler. This is a special case, 607 * however. If the ASL code being compiled was the result of a 608 * dissasembly, it may possibly contain valid compiler-emitted names 609 * of the form "_T_x". We don't want to issue an error or even a 610 * warning and force the user to manually change the names. So, we 611 * will issue a remark instead. 612 */ 613 AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); 614 return (ACPI_COMPILER_RESERVED_NAME); 615 } 616 617 /* 618 * The name didn't match any of the known predefined names. Flag it as a 619 * warning, since the entire namespace starting with an underscore is 620 * reserved by the ACPI spec. 621 */ 622 AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, 623 Op->Asl.ExternalName); 624 625 return (ACPI_NOT_RESERVED_NAME); 626 } 627 628 629 /******************************************************************************* 630 * 631 * FUNCTION: ApCheckObjectType 632 * 633 * PARAMETERS: Op - Current parse node 634 * ExpectedBtypes - Bitmap of expected return type(s) 635 * 636 * RETURN: None 637 * 638 * DESCRIPTION: Check if the object type is one of the types that is expected 639 * by the predefined name. Only a limited number of object types 640 * can be returned by the predefined names. 641 * 642 ******************************************************************************/ 643 644 static void 645 ApCheckObjectType ( 646 ACPI_PARSE_OBJECT *Op, 647 UINT32 ExpectedBtypes) 648 { 649 UINT32 ReturnBtype; 650 651 652 switch (Op->Asl.ParseOpcode) 653 { 654 case PARSEOP_ZERO: 655 case PARSEOP_ONE: 656 case PARSEOP_ONES: 657 case PARSEOP_INTEGER: 658 ReturnBtype = ACPI_RTYPE_INTEGER; 659 break; 660 661 case PARSEOP_BUFFER: 662 ReturnBtype = ACPI_RTYPE_BUFFER; 663 break; 664 665 case PARSEOP_STRING_LITERAL: 666 ReturnBtype = ACPI_RTYPE_STRING; 667 break; 668 669 case PARSEOP_PACKAGE: 670 ReturnBtype = ACPI_RTYPE_PACKAGE; 671 break; 672 673 default: 674 /* Not one of the supported object types */ 675 676 goto TypeErrorExit; 677 } 678 679 /* Exit if the object is one of the expected types */ 680 681 if (ReturnBtype & ExpectedBtypes) 682 { 683 return; 684 } 685 686 687 TypeErrorExit: 688 689 /* Format the expected types and emit an error message */ 690 691 ApGetExpectedTypes (StringBuffer, ExpectedBtypes); 692 693 sprintf (MsgBuffer, "found %s, requires %s", 694 UtGetOpName (Op->Asl.ParseOpcode), StringBuffer); 695 696 AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, 697 MsgBuffer); 698 } 699 700 701 /******************************************************************************* 702 * 703 * FUNCTION: ApDisplayReservedNames 704 * 705 * PARAMETERS: None 706 * 707 * RETURN: None 708 * 709 * DESCRIPTION: Dump information about the ACPI predefined names and predefined 710 * resource descriptor names. 711 * 712 ******************************************************************************/ 713 714 void 715 ApDisplayReservedNames ( 716 void) 717 { 718 const ACPI_PREDEFINED_INFO *ThisName; 719 char TypeBuffer[48]; /* Room for 5 types */ 720 UINT32 Count; 721 722 723 /* 724 * Predefined names/methods 725 */ 726 printf ("\nPredefined Name Information\n\n"); 727 728 Count = 0; 729 ThisName = PredefinedNames; 730 while (ThisName->Info.Name[0]) 731 { 732 printf ("%4.4s Requires %u arguments, ", 733 ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F); 734 735 if (ThisName->Info.ExpectedBtypes) 736 { 737 ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes); 738 printf ("Must return: %s\n", TypeBuffer); 739 } 740 else 741 { 742 printf ("No return value\n"); 743 } 744 745 /* 746 * Skip next entry in the table if this name returns a Package 747 * (next entry contains the package info) 748 */ 749 if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) 750 { 751 ThisName++; 752 } 753 754 Count++; 755 ThisName++; 756 } 757 758 printf ("%u Predefined Names are recognized\n", Count); 759 760 /* 761 * Resource Descriptor names 762 */ 763 printf ("\nResource Descriptor Predefined Names\n\n"); 764 765 Count = 0; 766 ThisName = ResourceNames; 767 while (ThisName->Info.Name[0]) 768 { 769 printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name); 770 Count++; 771 ThisName++; 772 } 773 774 printf ("%u Resource Descriptor Names are recognized\n", Count); 775 776 /* 777 * Predefined scope names 778 */ 779 printf ("\nPredefined Scope Names\n\n"); 780 781 ThisName = ScopeNames; 782 while (ThisName->Info.Name[0]) 783 { 784 printf ("%4.4s Scope\n", ThisName->Info.Name); 785 ThisName++; 786 } 787 } 788 789 790 /******************************************************************************* 791 * 792 * FUNCTION: ApGetExpectedTypes 793 * 794 * PARAMETERS: Buffer - Where the formatted string is returned 795 * ExpectedBTypes - Bitfield of expected data types 796 * 797 * RETURN: None, formatted string 798 * 799 * DESCRIPTION: Format the expected object types into a printable string. 800 * 801 ******************************************************************************/ 802 803 static void 804 ApGetExpectedTypes ( 805 char *Buffer, 806 UINT32 ExpectedBtypes) 807 { 808 UINT32 ThisRtype; 809 UINT32 i; 810 UINT32 j; 811 812 813 j = 1; 814 Buffer[0] = 0; 815 ThisRtype = ACPI_RTYPE_INTEGER; 816 817 for (i = 0; i < ACPI_NUM_RTYPES; i++) 818 { 819 /* If one of the expected types, concatenate the name of this type */ 820 821 if (ExpectedBtypes & ThisRtype) 822 { 823 ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); 824 j = 0; /* Use name separator from now on */ 825 } 826 ThisRtype <<= 1; /* Next Rtype */ 827 } 828 } 829 830