Deleted Added
full compact
aslpredef.c (204773) aslpredef.c (206117)
1/******************************************************************************
2 *
3 * Module Name: aslpredef - support for ACPI predefined names
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *

--- 282 unchanged lines hidden (view full) ---

291
292 /*
293 * Check if method returns no value, but the predefined name is
294 * required to return a value
295 */
296 if (MethodInfo->NumReturnNoValue &&
297 PredefinedNames[Index].Info.ExpectedBtypes)
298 {
1/******************************************************************************
2 *
3 * Module Name: aslpredef - support for ACPI predefined names
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *

--- 282 unchanged lines hidden (view full) ---

291
292 /*
293 * Check if method returns no value, but the predefined name is
294 * required to return a value
295 */
296 if (MethodInfo->NumReturnNoValue &&
297 PredefinedNames[Index].Info.ExpectedBtypes)
298 {
299 sprintf (MsgBuffer, "%4.4s", PredefinedNames[Index].Info.Name);
299 ApGetExpectedTypes (StringBuffer,
300 PredefinedNames[Index].Info.ExpectedBtypes);
300
301
302 sprintf (MsgBuffer, "%s required for %4.4s",
303 StringBuffer, PredefinedNames[Index].Info.Name);
304
301 AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
302 MsgBuffer);
303 }
304 break;
305 }
306}
307
308
309/*******************************************************************************
310 *
305 AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
306 MsgBuffer);
307 }
308 break;
309 }
310}
311
312
313/*******************************************************************************
314 *
315 * FUNCTION: ApCheckPredefinedReturnValue
316 *
317 * PARAMETERS: Op - A parse node of type "RETURN".
318 * MethodInfo - Saved info about this method
319 *
320 * RETURN: None
321 *
322 * DESCRIPTION: If method is a predefined name, attempt to validate the return
323 * value. Only "static" types can be validated - a simple return
324 * of an integer/string/buffer/package or a named reference to
325 * a static object. Values such as a Localx or Argx or a control
326 * method invocation are not checked.
327 *
328 ******************************************************************************/
329
330void
331ApCheckPredefinedReturnValue (
332 ACPI_PARSE_OBJECT *Op,
333 ASL_METHOD_INFO *MethodInfo)
334{
335 UINT32 Index;
336 ACPI_PARSE_OBJECT *ReturnValueOp;
337
338
339 /* Check parent method for a match against the predefined name list */
340
341 Index = ApCheckForPredefinedName (MethodInfo->Op,
342 MethodInfo->Op->Asl.NameSeg);
343
344 switch (Index)
345 {
346 case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
347 case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
348 case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
349 case ACPI_EVENT_RESERVED_NAME: /* _Lxx, _Exx, and _Qxx methods */
350
351 /* Just return, nothing to do */
352 return;
353
354 default: /* a real predefined ACPI name */
355
356 /* Exit if no return value expected */
357
358 if (!PredefinedNames[Index].Info.ExpectedBtypes)
359 {
360 return;
361 }
362
363 /* Get the object returned, it is the next argument */
364
365 ReturnValueOp = Op->Asl.Child;
366 switch (ReturnValueOp->Asl.ParseOpcode)
367 {
368 case PARSEOP_ZERO:
369 case PARSEOP_ONE:
370 case PARSEOP_ONES:
371 case PARSEOP_INTEGER:
372 case PARSEOP_STRING_LITERAL:
373 case PARSEOP_BUFFER:
374 case PARSEOP_PACKAGE:
375
376 /* Static data return object - check against expected type */
377
378 ApCheckObjectType (ReturnValueOp,
379 PredefinedNames[Index].Info.ExpectedBtypes);
380 break;
381
382 default:
383
384 /*
385 * All other ops are very difficult or impossible to typecheck at
386 * compile time. These include all Localx, Argx, and method
387 * invocations. Also, NAMESEG and NAMESTRING because the type of
388 * any named object can be changed at runtime (for example,
389 * CopyObject will change the type of the target object.)
390 */
391 break;
392 }
393 }
394}
395
396
397/*******************************************************************************
398 *
311 * FUNCTION: ApCheckForPredefinedObject
312 *
313 * PARAMETERS: Op - A parse node
314 * Name - The ACPI name to be checked
315 *
316 * RETURN: None
317 *
318 * DESCRIPTION: Check for a predefined name for a static object (created via

--- 117 unchanged lines hidden (view full) ---

436 *
437 * FUNCTION: ApCheckForSpecialName
438 *
439 * PARAMETERS: Op - A parse node
440 * Name - NameSeg to check
441 *
442 * RETURN: None
443 *
399 * FUNCTION: ApCheckForPredefinedObject
400 *
401 * PARAMETERS: Op - A parse node
402 * Name - The ACPI name to be checked
403 *
404 * RETURN: None
405 *
406 * DESCRIPTION: Check for a predefined name for a static object (created via

--- 117 unchanged lines hidden (view full) ---

524 *
525 * FUNCTION: ApCheckForSpecialName
526 *
527 * PARAMETERS: Op - A parse node
528 * Name - NameSeg to check
529 *
530 * RETURN: None
531 *
444 * DESCRIPTION: Check for the "special" predefined names -
532 * DESCRIPTION: Check for the "special" predefined names -
445 * _Lxx, _Exx, _Qxx, and _T_x
446 *
447 ******************************************************************************/
448
449static UINT32
450ApCheckForSpecialName (
451 ACPI_PARSE_OBJECT *Op,
452 char *Name)

--- 54 unchanged lines hidden (view full) ---

507 return (ACPI_NOT_RESERVED_NAME);
508}
509
510
511/*******************************************************************************
512 *
513 * FUNCTION: ApCheckObjectType
514 *
533 * _Lxx, _Exx, _Qxx, and _T_x
534 *
535 ******************************************************************************/
536
537static UINT32
538ApCheckForSpecialName (
539 ACPI_PARSE_OBJECT *Op,
540 char *Name)

--- 54 unchanged lines hidden (view full) ---

595 return (ACPI_NOT_RESERVED_NAME);
596}
597
598
599/*******************************************************************************
600 *
601 * FUNCTION: ApCheckObjectType
602 *
515 * PARAMETERS: Op - A parse node
603 * PARAMETERS: Op - Current parse node
516 * ExpectedBtypes - Bitmap of expected return type(s)
517 *
518 * RETURN: None
519 *
520 * DESCRIPTION: Check if the object type is one of the types that is expected
521 * by the predefined name. Only a limited number of object types
522 * can be returned by the predefined names.
523 *
524 ******************************************************************************/
525
526static void
527ApCheckObjectType (
528 ACPI_PARSE_OBJECT *Op,
529 UINT32 ExpectedBtypes)
530{
531 UINT32 ReturnBtype;
604 * ExpectedBtypes - Bitmap of expected return type(s)
605 *
606 * RETURN: None
607 *
608 * DESCRIPTION: Check if the object type is one of the types that is expected
609 * by the predefined name. Only a limited number of object types
610 * can be returned by the predefined names.
611 *
612 ******************************************************************************/
613
614static void
615ApCheckObjectType (
616 ACPI_PARSE_OBJECT *Op,
617 UINT32 ExpectedBtypes)
618{
619 UINT32 ReturnBtype;
532 char TypeBuffer[48]; /* Room for 5 types */
533
534
535 switch (Op->Asl.ParseOpcode)
536 {
620
621
622 switch (Op->Asl.ParseOpcode)
623 {
624 case PARSEOP_ZERO:
625 case PARSEOP_ONE:
626 case PARSEOP_ONES:
537 case PARSEOP_INTEGER:
538 ReturnBtype = ACPI_RTYPE_INTEGER;
539 break;
540
541 case PARSEOP_BUFFER:
542 ReturnBtype = ACPI_RTYPE_BUFFER;
543 break;
544
545 case PARSEOP_STRING_LITERAL:
546 ReturnBtype = ACPI_RTYPE_STRING;
547 break;
548
549 case PARSEOP_PACKAGE:
550 ReturnBtype = ACPI_RTYPE_PACKAGE;
551 break;
552
553 default:
554 /* Not one of the supported object types */
627 case PARSEOP_INTEGER:
628 ReturnBtype = ACPI_RTYPE_INTEGER;
629 break;
630
631 case PARSEOP_BUFFER:
632 ReturnBtype = ACPI_RTYPE_BUFFER;
633 break;
634
635 case PARSEOP_STRING_LITERAL:
636 ReturnBtype = ACPI_RTYPE_STRING;
637 break;
638
639 case PARSEOP_PACKAGE:
640 ReturnBtype = ACPI_RTYPE_PACKAGE;
641 break;
642
643 default:
644 /* Not one of the supported object types */
555
645
556 goto TypeErrorExit;
557 }
558
646 goto TypeErrorExit;
647 }
648
559 /* Is the object one of the expected types? */
649 /* Exit if the object is one of the expected types */
560
561 if (ReturnBtype & ExpectedBtypes)
562 {
563 return;
564 }
565
566
567TypeErrorExit:
568
569 /* Format the expected types and emit an error message */
570
650
651 if (ReturnBtype & ExpectedBtypes)
652 {
653 return;
654 }
655
656
657TypeErrorExit:
658
659 /* Format the expected types and emit an error message */
660
571 ApGetExpectedTypes (TypeBuffer, ExpectedBtypes);
661 ApGetExpectedTypes (StringBuffer, ExpectedBtypes);
572
662
663 sprintf (MsgBuffer, "found %s, requires %s",
664 UtGetOpName (Op->Asl.ParseOpcode), StringBuffer);
665
573 AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op,
666 AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op,
574 TypeBuffer);
667 MsgBuffer);
575}
576
577
578/*******************************************************************************
579 *
580 * FUNCTION: ApDisplayReservedNames
581 *
582 * PARAMETERS: None

--- 124 unchanged lines hidden ---
668}
669
670
671/*******************************************************************************
672 *
673 * FUNCTION: ApDisplayReservedNames
674 *
675 * PARAMETERS: None

--- 124 unchanged lines hidden ---