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/exconfig.c
          +++ new/usr/src/common/acpica/components/executer/exconfig.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
   4    4   *
   5    5   *****************************************************************************/
   6    6  
   7    7  /*
   8      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2014, Intel Corp.
   9    9   * All rights reserved.
  10   10   *
  11   11   * Redistribution and use in source and binary forms, with or without
  12   12   * modification, are permitted provided that the following conditions
  13   13   * are met:
  14   14   * 1. Redistributions of source code must retain the above copyright
  15   15   *    notice, this list of conditions, and the following disclaimer,
  16   16   *    without modification.
  17   17   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18   18   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 24 lines elided ↑ open up ↑
  43   43  
  44   44  #define __EXCONFIG_C__
  45   45  
  46   46  #include "acpi.h"
  47   47  #include "accommon.h"
  48   48  #include "acinterp.h"
  49   49  #include "acnamesp.h"
  50   50  #include "actables.h"
  51   51  #include "acdispat.h"
  52   52  #include "acevents.h"
       53 +#include "amlcode.h"
  53   54  
  54   55  
  55   56  #define _COMPONENT          ACPI_EXECUTER
  56   57          ACPI_MODULE_NAME    ("exconfig")
  57   58  
  58   59  /* Local prototypes */
  59   60  
  60   61  static ACPI_STATUS
  61   62  AcpiExAddTable (
  62   63      UINT32                  TableIndex,
↓ open down ↓ 109 lines elided ↑ open up ↑
 172  173      ACPI_NAMESPACE_NODE     *StartNode;
 173  174      ACPI_NAMESPACE_NODE     *ParameterNode = NULL;
 174  175      ACPI_OPERAND_OBJECT     *DdbHandle;
 175  176      ACPI_TABLE_HEADER       *Table;
 176  177      UINT32                  TableIndex;
 177  178  
 178  179  
 179  180      ACPI_FUNCTION_TRACE (ExLoadTableOp);
 180  181  
 181  182  
 182      -    /* Validate lengths for the SignatureString, OEMIDString, OEMTableID */
      183 +    /* Validate lengths for the Signature, OemId, and OemTableId strings */
 183  184  
 184  185      if ((Operand[0]->String.Length > ACPI_NAME_SIZE) ||
 185  186          (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) ||
 186  187          (Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE))
 187  188      {
 188      -        return_ACPI_STATUS (AE_BAD_PARAMETER);
      189 +        return_ACPI_STATUS (AE_AML_STRING_LIMIT);
 189  190      }
 190  191  
 191  192      /* Find the ACPI table in the RSDT/XSDT */
 192  193  
 193      -    Status = AcpiTbFindTable (Operand[0]->String.Pointer,
 194      -                              Operand[1]->String.Pointer,
 195      -                              Operand[2]->String.Pointer, &TableIndex);
      194 +    Status = AcpiTbFindTable (
      195 +                Operand[0]->String.Pointer,
      196 +                Operand[1]->String.Pointer,
      197 +                Operand[2]->String.Pointer, &TableIndex);
 196  198      if (ACPI_FAILURE (Status))
 197  199      {
 198  200          if (Status != AE_NOT_FOUND)
 199  201          {
 200  202              return_ACPI_STATUS (Status);
 201  203          }
 202  204  
 203  205          /* Table not found, return an Integer=0 and AE_OK */
 204  206  
 205  207          DdbHandle = AcpiUtCreateIntegerObject ((UINT64) 0);
↓ open down ↓ 9 lines elided ↑ open up ↑
 215  217      /* Default nodes */
 216  218  
 217  219      StartNode = WalkState->ScopeInfo->Scope.Node;
 218  220      ParentNode = AcpiGbl_RootNode;
 219  221  
 220  222      /* RootPath (optional parameter) */
 221  223  
 222  224      if (Operand[3]->String.Length > 0)
 223  225      {
 224  226          /*
 225      -         * Find the node referenced by the RootPathString.  This is the
      227 +         * Find the node referenced by the RootPathString. This is the
 226  228           * location within the namespace where the table will be loaded.
 227  229           */
 228  230          Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer,
 229  231                      ACPI_NS_SEARCH_PARENT, &ParentNode);
 230  232          if (ACPI_FAILURE (Status))
 231  233          {
 232  234              return_ACPI_STATUS (Status);
 233  235          }
 234  236      }
 235  237  
 236  238      /* ParameterPath (optional parameter) */
 237  239  
 238  240      if (Operand[4]->String.Length > 0)
 239  241      {
 240      -        if ((Operand[4]->String.Pointer[0] != '\\') &&
 241      -            (Operand[4]->String.Pointer[0] != '^'))
      242 +        if ((Operand[4]->String.Pointer[0] != AML_ROOT_PREFIX) &&
      243 +            (Operand[4]->String.Pointer[0] != AML_PARENT_PREFIX))
 242  244          {
 243  245              /*
 244  246               * Path is not absolute, so it will be relative to the node
 245  247               * referenced by the RootPathString (or the NS root if omitted)
 246  248               */
 247  249              StartNode = ParentNode;
 248  250          }
 249  251  
 250  252          /* Find the node referenced by the ParameterPathString */
 251  253  
↓ open down ↓ 40 lines elided ↑ open up ↑
 292  294  
 293  295      /* Invoke table handler if present */
 294  296  
 295  297      if (AcpiGbl_TableHandler)
 296  298      {
 297  299          (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
 298  300                      AcpiGbl_TableHandlerContext);
 299  301      }
 300  302  
 301  303      *ReturnDesc = DdbHandle;
 302      -    return_ACPI_STATUS  (Status);
      304 +    return_ACPI_STATUS (Status);
 303  305  }
 304  306  
 305  307  
 306  308  /*******************************************************************************
 307  309   *
 308  310   * FUNCTION:    AcpiExRegionRead
 309  311   *
 310  312   * PARAMETERS:  ObjDesc         - Region descriptor
 311  313   *              Length          - Number of bytes to read
 312  314   *              Buffer          - Pointer to where to put the data
↓ open down ↓ 14 lines elided ↑ open up ↑
 327  329      ACPI_STATUS             Status;
 328  330      UINT64                  Value;
 329  331      UINT32                  RegionOffset = 0;
 330  332      UINT32                  i;
 331  333  
 332  334  
 333  335      /* Bytewise reads */
 334  336  
 335  337      for (i = 0; i < Length; i++)
 336  338      {
 337      -        Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
      339 +        Status = AcpiEvAddressSpaceDispatch (ObjDesc, NULL, ACPI_READ,
 338  340                      RegionOffset, 8, &Value);
 339  341          if (ACPI_FAILURE (Status))
 340  342          {
 341  343              return (Status);
 342  344          }
 343  345  
 344  346          *Buffer = (UINT8) Value;
 345  347          Buffer++;
 346  348          RegionOffset++;
 347  349      }
↓ open down ↓ 126 lines elided ↑ open up ↑
 474  476                      ACPI_CAST_PTR (UINT8, TableDesc.Pointer));
 475  477          if (ACPI_FAILURE (Status))
 476  478          {
 477  479              ACPI_FREE (TableDesc.Pointer);
 478  480              return_ACPI_STATUS (Status);
 479  481          }
 480  482  
 481  483          TableDesc.Address = ObjDesc->Region.Address;
 482  484          break;
 483  485  
 484      -
 485  486      case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
 486  487  
 487  488          ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
 488  489              "Load table from Buffer or Field %p\n", ObjDesc));
 489  490  
 490  491          /* Must have at least an ACPI table header */
 491  492  
 492  493          if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER))
 493  494          {
 494  495              return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
↓ open down ↓ 22 lines elided ↑ open up ↑
 517  518          TableDesc.Pointer = ACPI_ALLOCATE (Length);
 518  519          if (!TableDesc.Pointer)
 519  520          {
 520  521              return_ACPI_STATUS (AE_NO_MEMORY);
 521  522          }
 522  523  
 523  524          ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
 524  525          TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer);
 525  526          break;
 526  527  
 527      -
 528  528      default:
      529 +
 529  530          return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 530  531      }
 531  532  
 532  533      /* Validate table checksum (will not get validated in TbAddTable) */
 533  534  
 534  535      Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length);
 535  536      if (ACPI_FAILURE (Status))
 536  537      {
 537  538          ACPI_FREE (TableDesc.Pointer);
 538  539          return_ACPI_STATUS (Status);
↓ open down ↓ 95 lines elided ↑ open up ↑
 634  635       *
 635  636       * Handle must be a valid operand object of type reference. Also, the
 636  637       * DdbHandle must still be marked valid (table has not been previously
 637  638       * unloaded)
 638  639       */
 639  640      if ((!DdbHandle) ||
 640  641          (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
 641  642          (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) ||
 642  643          (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID)))
 643  644      {
 644      -        return_ACPI_STATUS (AE_BAD_PARAMETER);
      645 +        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 645  646      }
 646  647  
 647  648      /* Get the table index from the DdbHandle */
 648  649  
 649  650      TableIndex = TableDesc->Reference.Value;
 650  651  
 651  652      /* Ensure the table is still loaded */
 652  653  
 653  654      if (!AcpiTbIsTableLoaded (TableIndex))
 654  655      {
↓ open down ↓ 23 lines elided ↑ open up ↑
 678  679      (void) AcpiTbReleaseOwnerId (TableIndex);
 679  680      AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
 680  681  
 681  682      /*
 682  683       * Invalidate the handle. We do this because the handle may be stored
 683  684       * in a named object and may not be actually deleted until much later.
 684  685       */
 685  686      DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID;
 686  687      return_ACPI_STATUS (AE_OK);
 687  688  }
 688      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX