Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/executer/exmisc.c
          +++ new/usr/src/common/acpica/components/executer/exmisc.c
   1      -
   2    1  /******************************************************************************
   3    2   *
   4    3   * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
   5    4   *
   6    5   *****************************************************************************/
   7    6  
   8    7  /*
   9      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2014, Intel Corp.
  10    9   * All rights reserved.
  11   10   *
  12   11   * Redistribution and use in source and binary forms, with or without
  13   12   * modification, are permitted provided that the following conditions
  14   13   * are met:
  15   14   * 1. Redistributions of source code must retain the above copyright
  16   15   *    notice, this list of conditions, and the following disclaimer,
  17   16   *    without modification.
  18   17   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19   18   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 89 lines elided ↑ open up ↑
 109  108              break;
 110  109  
 111  110          default:
 112  111  
 113  112              ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
 114  113                  ObjDesc->Reference.Class));
 115  114              return_ACPI_STATUS (AE_AML_INTERNAL);
 116  115          }
 117  116          break;
 118  117  
 119      -
 120  118      case ACPI_DESC_TYPE_NAMED:
 121      -
 122  119          /*
 123  120           * A named reference that has already been resolved to a Node
 124  121           */
 125  122          ReferencedObj = ObjDesc;
 126  123          break;
 127  124  
 128      -
 129  125      default:
 130  126  
 131  127          ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X",
 132  128              ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
 133  129          return_ACPI_STATUS (AE_TYPE);
 134  130      }
 135  131  
 136  132  
 137  133      /* Create a new reference object */
 138  134  
↓ open down ↓ 132 lines elided ↑ open up ↑
 271  267      ACPI_OPERAND_OBJECT     *LocalOperand1 = Operand1;
 272  268      ACPI_OPERAND_OBJECT     *ReturnDesc;
 273  269      char                    *NewBuf;
 274  270      ACPI_STATUS             Status;
 275  271  
 276  272  
 277  273      ACPI_FUNCTION_TRACE (ExDoConcatenate);
 278  274  
 279  275  
 280  276      /*
 281      -     * Convert the second operand if necessary.  The first operand
      277 +     * Convert the second operand if necessary. The first operand
 282  278       * determines the type of the second operand, (See the Data Types
 283  279       * section of the ACPI specification.)  Both object types are
 284  280       * guaranteed to be either Integer/String/Buffer by the operand
 285  281       * resolution mechanism.
 286  282       */
 287  283      switch (Operand0->Common.Type)
 288  284      {
 289  285      case ACPI_TYPE_INTEGER:
      286 +
 290  287          Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
 291  288          break;
 292  289  
 293  290      case ACPI_TYPE_STRING:
      291 +
 294  292          Status = AcpiExConvertToString (Operand1, &LocalOperand1,
 295  293                      ACPI_IMPLICIT_CONVERT_HEX);
 296  294          break;
 297  295  
 298  296      case ACPI_TYPE_BUFFER:
      297 +
 299  298          Status = AcpiExConvertToBuffer (Operand1, &LocalOperand1);
 300  299          break;
 301  300  
 302  301      default:
      302 +
 303  303          ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
 304  304              Operand0->Common.Type));
 305  305          Status = AE_AML_INTERNAL;
 306  306      }
 307  307  
 308  308      if (ACPI_FAILURE (Status))
 309  309      {
 310  310          goto Cleanup;
 311  311      }
 312  312  
↓ open down ↓ 131 lines elided ↑ open up ↑
 444  444  
 445  445      ACPI_FUNCTION_ENTRY ();
 446  446  
 447  447  
 448  448      switch (Opcode)
 449  449      {
 450  450      case AML_ADD_OP:                /* Add (Integer0, Integer1, Result) */
 451  451  
 452  452          return (Integer0 + Integer1);
 453  453  
 454      -
 455  454      case AML_BIT_AND_OP:            /* And (Integer0, Integer1, Result) */
 456  455  
 457  456          return (Integer0 & Integer1);
 458  457  
 459      -
 460  458      case AML_BIT_NAND_OP:           /* NAnd (Integer0, Integer1, Result) */
 461  459  
 462  460          return (~(Integer0 & Integer1));
 463  461  
 464      -
 465  462      case AML_BIT_OR_OP:             /* Or (Integer0, Integer1, Result) */
 466  463  
 467  464          return (Integer0 | Integer1);
 468  465  
 469      -
 470  466      case AML_BIT_NOR_OP:            /* NOr (Integer0, Integer1, Result) */
 471  467  
 472  468          return (~(Integer0 | Integer1));
 473  469  
 474      -
 475  470      case AML_BIT_XOR_OP:            /* XOr (Integer0, Integer1, Result) */
 476  471  
 477  472          return (Integer0 ^ Integer1);
 478  473  
 479      -
 480  474      case AML_MULTIPLY_OP:           /* Multiply (Integer0, Integer1, Result) */
 481  475  
 482  476          return (Integer0 * Integer1);
 483  477  
 484      -
 485  478      case AML_SHIFT_LEFT_OP:         /* ShiftLeft (Operand, ShiftCount, Result)*/
 486  479  
 487  480          /*
 488  481           * We need to check if the shiftcount is larger than the integer bit
 489  482           * width since the behavior of this is not well-defined in the C language.
 490  483           */
 491  484          if (Integer1 >= AcpiGbl_IntegerBitWidth)
 492  485          {
 493  486              return (0);
 494  487          }
 495  488          return (Integer0 << Integer1);
 496  489  
 497      -
 498  490      case AML_SHIFT_RIGHT_OP:        /* ShiftRight (Operand, ShiftCount, Result) */
 499  491  
 500  492          /*
 501  493           * We need to check if the shiftcount is larger than the integer bit
 502  494           * width since the behavior of this is not well-defined in the C language.
 503  495           */
 504  496          if (Integer1 >= AcpiGbl_IntegerBitWidth)
 505  497          {
 506  498              return (0);
 507  499          }
 508  500          return (Integer0 >> Integer1);
 509  501  
 510      -
 511  502      case AML_SUBTRACT_OP:           /* Subtract (Integer0, Integer1, Result) */
 512  503  
 513  504          return (Integer0 - Integer1);
 514  505  
 515  506      default:
 516  507  
 517  508          return (0);
 518  509      }
 519  510  }
 520  511  
↓ open down ↓ 44 lines elided ↑ open up ↑
 565  556  
 566  557      case AML_LOR_OP:                /* LOr (Integer0, Integer1) */
 567  558  
 568  559          if (Integer0 || Integer1)
 569  560          {
 570  561              LocalResult = TRUE;
 571  562          }
 572  563          break;
 573  564  
 574  565      default:
      566 +
 575  567          Status = AE_AML_INTERNAL;
 576  568          break;
 577  569      }
 578  570  
 579  571      /* Return the logical result and status */
 580  572  
 581  573      *LogicalResult = LocalResult;
 582  574      return_ACPI_STATUS (Status);
 583  575  }
 584  576  
↓ open down ↓ 38 lines elided ↑ open up ↑
 623  615      UINT32                  Length1;
 624  616      ACPI_STATUS             Status = AE_OK;
 625  617      BOOLEAN                 LocalResult = FALSE;
 626  618      int                     Compare;
 627  619  
 628  620  
 629  621      ACPI_FUNCTION_TRACE (ExDoLogicalOp);
 630  622  
 631  623  
 632  624      /*
 633      -     * Convert the second operand if necessary.  The first operand
      625 +     * Convert the second operand if necessary. The first operand
 634  626       * determines the type of the second operand, (See the Data Types
 635  627       * section of the ACPI 3.0+ specification.)  Both object types are
 636  628       * guaranteed to be either Integer/String/Buffer by the operand
 637  629       * resolution mechanism.
 638  630       */
 639  631      switch (Operand0->Common.Type)
 640  632      {
 641  633      case ACPI_TYPE_INTEGER:
      634 +
 642  635          Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
 643  636          break;
 644  637  
 645  638      case ACPI_TYPE_STRING:
      639 +
 646  640          Status = AcpiExConvertToString (Operand1, &LocalOperand1,
 647  641                      ACPI_IMPLICIT_CONVERT_HEX);
 648  642          break;
 649  643  
 650  644      case ACPI_TYPE_BUFFER:
      645 +
 651  646          Status = AcpiExConvertToBuffer (Operand1, &LocalOperand1);
 652  647          break;
 653  648  
 654  649      default:
      650 +
 655  651          Status = AE_AML_INTERNAL;
 656  652          break;
 657  653      }
 658  654  
 659  655      if (ACPI_FAILURE (Status))
 660  656      {
 661  657          goto Cleanup;
 662  658      }
 663  659  
 664  660      /*
↓ open down ↓ 28 lines elided ↑ open up ↑
 693  689  
 694  690          case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
 695  691  
 696  692              if (Integer0 < Integer1)
 697  693              {
 698  694                  LocalResult = TRUE;
 699  695              }
 700  696              break;
 701  697  
 702  698          default:
      699 +
 703  700              Status = AE_AML_INTERNAL;
 704  701              break;
 705  702          }
 706  703      }
 707  704      else
 708  705      {
 709  706          /*
 710  707           * 2) Both operands are Strings or both are Buffers
 711  708           *    Note: Code below takes advantage of common Buffer/String
 712  709           *          object fields. LocalOperand1 may have changed above. Use
↓ open down ↓ 57 lines elided ↑ open up ↑
 770  767  
 771  768              /* Bytes match (to shortest length), compare lengths */
 772  769  
 773  770              if (Length0 < Length1)
 774  771              {
 775  772                  LocalResult = TRUE;
 776  773              }
 777  774              break;
 778  775  
 779  776          default:
      777 +
 780  778              Status = AE_AML_INTERNAL;
 781  779              break;
 782  780          }
 783  781      }
 784  782  
 785  783  Cleanup:
 786  784  
 787  785      /* New object was created if implicit conversion performed - delete */
 788  786  
 789  787      if (LocalOperand1 != Operand1)
 790  788      {
 791  789          AcpiUtRemoveReference (LocalOperand1);
 792  790      }
 793  791  
 794  792      /* Return the logical result and status */
 795  793  
 796  794      *LogicalResult = LocalResult;
 797  795      return_ACPI_STATUS (Status);
 798  796  }
 799      -
 800      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX