Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 
   2 /******************************************************************************
   3  *
   4  * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
   5  *
   6  *****************************************************************************/
   7 
   8 /*
   9  * Copyright (C) 2000 - 2011, Intel Corp.
  10  * All rights reserved.
  11  *
  12  * Redistribution and use in source and binary forms, with or without
  13  * modification, are permitted provided that the following conditions
  14  * are met:
  15  * 1. Redistributions of source code must retain the above copyright
  16  *    notice, this list of conditions, and the following disclaimer,
  17  *    without modification.
  18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19  *    substantially similar to the "NO WARRANTY" disclaimer below
  20  *    ("Disclaimer") and any redistribution must be conditioned upon
  21  *    including a substantially similar Disclaimer requirement for further
  22  *    binary redistribution.
  23  * 3. Neither the names of the above-listed copyright holders nor the names
  24  *    of any contributors may be used to endorse or promote products derived
  25  *    from this software without specific prior written permission.
  26  *
  27  * Alternatively, this software may be distributed under the terms of the
  28  * GNU General Public License ("GPL") version 2 as published by the Free
  29  * Software Foundation.


 114 
 115     /*
 116      * Note: Since the PackageObj/MatchObj ordering is opposite to that of
 117      * the standard logical operators, we have to reverse them when we call
 118      * DoLogicalOp in order to make the implicit conversion rules work
 119      * correctly. However, this means we have to flip the entire equation
 120      * also. A bit ugly perhaps, but overall, better than fussing the
 121      * parameters around at runtime, over and over again.
 122      *
 123      * Below, P[i] refers to the package element, M refers to the Match object.
 124      */
 125     switch (MatchOp)
 126     {
 127     case MATCH_MTR:
 128 
 129         /* Always true */
 130 
 131         break;
 132 
 133     case MATCH_MEQ:
 134 
 135         /*
 136          * True if equal: (P[i] == M)
 137          * Change to:     (M == P[i])
 138          */
 139         Status = AcpiExDoLogicalOp (AML_LEQUAL_OP, MatchObj, PackageObj,
 140                     &LogicalResult);
 141         if (ACPI_FAILURE (Status))
 142         {
 143             return (FALSE);
 144         }
 145         break;
 146 
 147     case MATCH_MLE:
 148 
 149         /*
 150          * True if less than or equal: (P[i] <= M) (P[i] NotGreater than M)
 151          * Change to:                  (M >= P[i]) (M NotLess than P[i])
 152          */
 153         Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
 154                     &LogicalResult);
 155         if (ACPI_FAILURE (Status))
 156         {
 157             return (FALSE);
 158         }
 159         LogicalResult = (BOOLEAN) !LogicalResult;
 160         break;
 161 
 162     case MATCH_MLT:
 163 
 164         /*
 165          * True if less than: (P[i] < M)
 166          * Change to:         (M > P[i])
 167          */
 168         Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
 169                     &LogicalResult);
 170         if (ACPI_FAILURE (Status))
 171         {
 172             return (FALSE);
 173         }
 174         break;
 175 
 176     case MATCH_MGE:
 177 
 178         /*
 179          * True if greater than or equal: (P[i] >= M) (P[i] NotLess than M)
 180          * Change to:                     (M <= P[i]) (M NotGreater than P[i])
 181          */
 182         Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
 183                     &LogicalResult);
 184         if (ACPI_FAILURE (Status))
 185         {
 186             return (FALSE);
 187         }
 188         LogicalResult = (BOOLEAN)!LogicalResult;
 189         break;
 190 
 191     case MATCH_MGT:
 192 
 193         /*
 194          * True if greater than: (P[i] > M)
 195          * Change to:            (M < P[i])
 196          */
 197         Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
 198                     &LogicalResult);
 199         if (ACPI_FAILURE (Status))
 200         {
 201             return (FALSE);
 202         }
 203         break;
 204 
 205     default:
 206 
 207         /* Undefined */
 208 
 209         return (FALSE);
 210     }
 211 
 212     return LogicalResult;
 213 }
 214 
 215 
 216 /*******************************************************************************
 217  *
 218  * FUNCTION:    AcpiExOpcode_6A_0T_1R
 219  *
 220  * PARAMETERS:  WalkState           - Current walk state
 221  *
 222  * RETURN:      Status
 223  *
 224  * DESCRIPTION: Execute opcode with 6 arguments, no target, and a return value
 225  *
 226  ******************************************************************************/
 227 
 228 ACPI_STATUS
 229 AcpiExOpcode_6A_0T_1R (
 230     ACPI_WALK_STATE         *WalkState)
 231 {
 232     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];


 312              */
 313             if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value,
 314                                 ThisElement, Operand[2]))
 315             {
 316                 continue;
 317             }
 318 
 319             if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value,
 320                                 ThisElement, Operand[4]))
 321             {
 322                 continue;
 323             }
 324 
 325             /* Match found: Index is the return value */
 326 
 327             ReturnDesc->Integer.Value = Index;
 328             break;
 329         }
 330         break;
 331 
 332 
 333     case AML_LOAD_TABLE_OP:
 334 
 335         Status = AcpiExLoadTableOp (WalkState, &ReturnDesc);
 336         break;
 337 
 338 
 339     default:
 340 
 341         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
 342             WalkState->Opcode));
 343         Status = AE_AML_BAD_OPCODE;
 344         goto Cleanup;
 345     }
 346 
 347 
 348 Cleanup:
 349 
 350     /* Delete return object on error */
 351 
 352     if (ACPI_FAILURE (Status))
 353     {
 354         AcpiUtRemoveReference (ReturnDesc);
 355     }
 356 
 357     /* Save return object on success */
 358 

   1 /******************************************************************************
   2  *
   3  * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, 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.


 113 
 114     /*
 115      * Note: Since the PackageObj/MatchObj ordering is opposite to that of
 116      * the standard logical operators, we have to reverse them when we call
 117      * DoLogicalOp in order to make the implicit conversion rules work
 118      * correctly. However, this means we have to flip the entire equation
 119      * also. A bit ugly perhaps, but overall, better than fussing the
 120      * parameters around at runtime, over and over again.
 121      *
 122      * Below, P[i] refers to the package element, M refers to the Match object.
 123      */
 124     switch (MatchOp)
 125     {
 126     case MATCH_MTR:
 127 
 128         /* Always true */
 129 
 130         break;
 131 
 132     case MATCH_MEQ:

 133         /*
 134          * True if equal: (P[i] == M)
 135          * Change to:     (M == P[i])
 136          */
 137         Status = AcpiExDoLogicalOp (AML_LEQUAL_OP, MatchObj, PackageObj,
 138                     &LogicalResult);
 139         if (ACPI_FAILURE (Status))
 140         {
 141             return (FALSE);
 142         }
 143         break;
 144 
 145     case MATCH_MLE:

 146         /*
 147          * True if less than or equal: (P[i] <= M) (P[i] NotGreater than M)
 148          * Change to:                  (M >= P[i]) (M NotLess than P[i])
 149          */
 150         Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
 151                     &LogicalResult);
 152         if (ACPI_FAILURE (Status))
 153         {
 154             return (FALSE);
 155         }
 156         LogicalResult = (BOOLEAN) !LogicalResult;
 157         break;
 158 
 159     case MATCH_MLT:

 160         /*
 161          * True if less than: (P[i] < M)
 162          * Change to:         (M > P[i])
 163          */
 164         Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
 165                     &LogicalResult);
 166         if (ACPI_FAILURE (Status))
 167         {
 168             return (FALSE);
 169         }
 170         break;
 171 
 172     case MATCH_MGE:

 173         /*
 174          * True if greater than or equal: (P[i] >= M) (P[i] NotLess than M)
 175          * Change to:                     (M <= P[i]) (M NotGreater than P[i])
 176          */
 177         Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
 178                     &LogicalResult);
 179         if (ACPI_FAILURE (Status))
 180         {
 181             return (FALSE);
 182         }
 183         LogicalResult = (BOOLEAN)!LogicalResult;
 184         break;
 185 
 186     case MATCH_MGT:

 187         /*
 188          * True if greater than: (P[i] > M)
 189          * Change to:            (M < P[i])
 190          */
 191         Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
 192                     &LogicalResult);
 193         if (ACPI_FAILURE (Status))
 194         {
 195             return (FALSE);
 196         }
 197         break;
 198 
 199     default:
 200 
 201         /* Undefined */
 202 
 203         return (FALSE);
 204     }
 205 
 206     return (LogicalResult);
 207 }
 208 
 209 
 210 /*******************************************************************************
 211  *
 212  * FUNCTION:    AcpiExOpcode_6A_0T_1R
 213  *
 214  * PARAMETERS:  WalkState           - Current walk state
 215  *
 216  * RETURN:      Status
 217  *
 218  * DESCRIPTION: Execute opcode with 6 arguments, no target, and a return value
 219  *
 220  ******************************************************************************/
 221 
 222 ACPI_STATUS
 223 AcpiExOpcode_6A_0T_1R (
 224     ACPI_WALK_STATE         *WalkState)
 225 {
 226     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];


 306              */
 307             if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value,
 308                                 ThisElement, Operand[2]))
 309             {
 310                 continue;
 311             }
 312 
 313             if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value,
 314                                 ThisElement, Operand[4]))
 315             {
 316                 continue;
 317             }
 318 
 319             /* Match found: Index is the return value */
 320 
 321             ReturnDesc->Integer.Value = Index;
 322             break;
 323         }
 324         break;
 325 

 326     case AML_LOAD_TABLE_OP:
 327 
 328         Status = AcpiExLoadTableOp (WalkState, &ReturnDesc);
 329         break;
 330 

 331     default:
 332 
 333         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
 334             WalkState->Opcode));
 335         Status = AE_AML_BAD_OPCODE;
 336         goto Cleanup;
 337     }
 338 
 339 
 340 Cleanup:
 341 
 342     /* Delete return object on error */
 343 
 344     if (ACPI_FAILURE (Status))
 345     {
 346         AcpiUtRemoveReference (ReturnDesc);
 347     }
 348 
 349     /* Save return object on success */
 350