Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
   1 
   2 /******************************************************************************
   3  *
   4  * Module Name: exoparg3 - AML execution - opcodes with 3 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.


 113             (UINT32) Operand[1]->Integer.Value,
 114             (UINT32) Operand[2]->Integer.Value));
 115 
 116         Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
 117         if (Fatal)
 118         {
 119             Fatal->Type     = (UINT32) Operand[0]->Integer.Value;
 120             Fatal->Code     = (UINT32) Operand[1]->Integer.Value;
 121             Fatal->Argument = (UINT32) Operand[2]->Integer.Value;
 122         }
 123 
 124         /* Always signal the OS! */
 125 
 126         Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
 127 
 128         /* Might return while OS is shutting down, just continue */
 129 
 130         ACPI_FREE (Fatal);
 131         break;
 132 
 133 
 134     default:
 135 
 136         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
 137             WalkState->Opcode));
 138         Status = AE_AML_BAD_OPCODE;
 139         goto Cleanup;
 140     }
 141 
 142 
 143 Cleanup:
 144 
 145     return_ACPI_STATUS (Status);
 146 }
 147 
 148 
 149 /*******************************************************************************
 150  *
 151  * FUNCTION:    AcpiExOpcode_3A_1T_1R
 152  *
 153  * PARAMETERS:  WalkState           - Current walk state


 160 
 161 ACPI_STATUS
 162 AcpiExOpcode_3A_1T_1R (
 163     ACPI_WALK_STATE         *WalkState)
 164 {
 165     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
 166     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
 167     char                    *Buffer = NULL;
 168     ACPI_STATUS             Status = AE_OK;
 169     UINT64                  Index;
 170     ACPI_SIZE               Length;
 171 
 172 
 173     ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_1T_1R,
 174         AcpiPsGetOpcodeName (WalkState->Opcode));
 175 
 176 
 177     switch (WalkState->Opcode)
 178     {
 179     case AML_MID_OP:    /* Mid (Source[0], Index[1], Length[2], Result[3]) */
 180 
 181         /*
 182          * Create the return object.  The Source operand is guaranteed to be
 183          * either a String or a Buffer, so just use its type.
 184          */
 185         ReturnDesc = AcpiUtCreateInternalObject (
 186                         (Operand[0])->Common.Type);
 187         if (!ReturnDesc)
 188         {
 189             Status = AE_NO_MEMORY;
 190             goto Cleanup;
 191         }
 192 
 193         /* Get the Integer values from the objects */
 194 
 195         Index = Operand[1]->Integer.Value;
 196         Length = (ACPI_SIZE) Operand[2]->Integer.Value;
 197 
 198         /*
 199          * If the index is beyond the length of the String/Buffer, or if the
 200          * requested length is zero, return a zero-length String/Buffer


 252         }
 253 
 254         if (Buffer)
 255         {
 256             /* We have a buffer, copy the portion requested */
 257 
 258             ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
 259                          Length);
 260         }
 261 
 262         /* Set the length of the new String/Buffer */
 263 
 264         ReturnDesc->String.Pointer = Buffer;
 265         ReturnDesc->String.Length = (UINT32) Length;
 266 
 267         /* Mark buffer initialized */
 268 
 269         ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
 270         break;
 271 
 272 
 273     default:
 274 
 275         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
 276             WalkState->Opcode));
 277         Status = AE_AML_BAD_OPCODE;
 278         goto Cleanup;
 279     }
 280 
 281     /* Store the result in the target */
 282 
 283     Status = AcpiExStore (ReturnDesc, Operand[3], WalkState);
 284 
 285 Cleanup:
 286 
 287     /* Delete return object on error */
 288 
 289     if (ACPI_FAILURE (Status) || WalkState->ResultObj)
 290     {
 291         AcpiUtRemoveReference (ReturnDesc);
 292         WalkState->ResultObj = NULL;
 293     }
 294 
 295     /* Set the return object and exit */
 296 
 297     else
 298     {
 299         WalkState->ResultObj = ReturnDesc;
 300     }
 301     return_ACPI_STATUS (Status);
 302 }
 303 
 304 

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


 112             (UINT32) Operand[1]->Integer.Value,
 113             (UINT32) Operand[2]->Integer.Value));
 114 
 115         Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
 116         if (Fatal)
 117         {
 118             Fatal->Type     = (UINT32) Operand[0]->Integer.Value;
 119             Fatal->Code     = (UINT32) Operand[1]->Integer.Value;
 120             Fatal->Argument = (UINT32) Operand[2]->Integer.Value;
 121         }
 122 
 123         /* Always signal the OS! */
 124 
 125         Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
 126 
 127         /* Might return while OS is shutting down, just continue */
 128 
 129         ACPI_FREE (Fatal);
 130         break;
 131 

 132     default:
 133 
 134         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
 135             WalkState->Opcode));
 136         Status = AE_AML_BAD_OPCODE;
 137         goto Cleanup;
 138     }
 139 
 140 
 141 Cleanup:
 142 
 143     return_ACPI_STATUS (Status);
 144 }
 145 
 146 
 147 /*******************************************************************************
 148  *
 149  * FUNCTION:    AcpiExOpcode_3A_1T_1R
 150  *
 151  * PARAMETERS:  WalkState           - Current walk state


 158 
 159 ACPI_STATUS
 160 AcpiExOpcode_3A_1T_1R (
 161     ACPI_WALK_STATE         *WalkState)
 162 {
 163     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
 164     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
 165     char                    *Buffer = NULL;
 166     ACPI_STATUS             Status = AE_OK;
 167     UINT64                  Index;
 168     ACPI_SIZE               Length;
 169 
 170 
 171     ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_1T_1R,
 172         AcpiPsGetOpcodeName (WalkState->Opcode));
 173 
 174 
 175     switch (WalkState->Opcode)
 176     {
 177     case AML_MID_OP:    /* Mid (Source[0], Index[1], Length[2], Result[3]) */

 178         /*
 179          * Create the return object. The Source operand is guaranteed to be
 180          * either a String or a Buffer, so just use its type.
 181          */
 182         ReturnDesc = AcpiUtCreateInternalObject (
 183                         (Operand[0])->Common.Type);
 184         if (!ReturnDesc)
 185         {
 186             Status = AE_NO_MEMORY;
 187             goto Cleanup;
 188         }
 189 
 190         /* Get the Integer values from the objects */
 191 
 192         Index = Operand[1]->Integer.Value;
 193         Length = (ACPI_SIZE) Operand[2]->Integer.Value;
 194 
 195         /*
 196          * If the index is beyond the length of the String/Buffer, or if the
 197          * requested length is zero, return a zero-length String/Buffer


 249         }
 250 
 251         if (Buffer)
 252         {
 253             /* We have a buffer, copy the portion requested */
 254 
 255             ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
 256                          Length);
 257         }
 258 
 259         /* Set the length of the new String/Buffer */
 260 
 261         ReturnDesc->String.Pointer = Buffer;
 262         ReturnDesc->String.Length = (UINT32) Length;
 263 
 264         /* Mark buffer initialized */
 265 
 266         ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
 267         break;
 268 

 269     default:
 270 
 271         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
 272             WalkState->Opcode));
 273         Status = AE_AML_BAD_OPCODE;
 274         goto Cleanup;
 275     }
 276 
 277     /* Store the result in the target */
 278 
 279     Status = AcpiExStore (ReturnDesc, Operand[3], WalkState);
 280 
 281 Cleanup:
 282 
 283     /* Delete return object on error */
 284 
 285     if (ACPI_FAILURE (Status) || WalkState->ResultObj)
 286     {
 287         AcpiUtRemoveReference (ReturnDesc);
 288         WalkState->ResultObj = NULL;
 289     }
 290 
 291     /* Set the return object and exit */
 292 
 293     else
 294     {
 295         WalkState->ResultObj = ReturnDesc;
 296     }
 297     return_ACPI_STATUS (Status);
 298 }