Print this page
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/utilities/utosi.c
          +++ new/usr/src/common/acpica/components/utilities/utosi.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: utosi - Support for the _OSI predefined control method
   4    4   *
   5    5   *****************************************************************************/
   6    6  
   7    7  /*
   8      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2013, 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 ↓ 51 lines elided ↑ open up ↑
  70   70      {"Windows 2001",        NULL, 0, ACPI_OSI_WIN_XP},           /* Windows XP */
  71   71      {"Windows 2001 SP1",    NULL, 0, ACPI_OSI_WIN_XP_SP1},       /* Windows XP SP1 */
  72   72      {"Windows 2001.1",      NULL, 0, ACPI_OSI_WINSRV_2003},      /* Windows Server 2003 */
  73   73      {"Windows 2001 SP2",    NULL, 0, ACPI_OSI_WIN_XP_SP2},       /* Windows XP SP2 */
  74   74      {"Windows 2001.1 SP1",  NULL, 0, ACPI_OSI_WINSRV_2003_SP1},  /* Windows Server 2003 SP1 - Added 03/2006 */
  75   75      {"Windows 2006",        NULL, 0, ACPI_OSI_WIN_VISTA},        /* Windows Vista - Added 03/2006 */
  76   76      {"Windows 2006.1",      NULL, 0, ACPI_OSI_WINSRV_2008},      /* Windows Server 2008 - Added 09/2009 */
  77   77      {"Windows 2006 SP1",    NULL, 0, ACPI_OSI_WIN_VISTA_SP1},    /* Windows Vista SP1 - Added 09/2009 */
  78   78      {"Windows 2006 SP2",    NULL, 0, ACPI_OSI_WIN_VISTA_SP2},    /* Windows Vista SP2 - Added 09/2010 */
  79   79      {"Windows 2009",        NULL, 0, ACPI_OSI_WIN_7},            /* Windows 7 and Server 2008 R2 - Added 09/2009 */
       80 +    {"Windows 2012",        NULL, 0, ACPI_OSI_WIN_8},            /* Windows 8 and Server 2012 - Added 08/2012 */
  80   81  
  81   82      /* Feature Group Strings */
  82   83  
  83      -    {"Extended Address Space Descriptor", NULL, 0, 0}
       84 +    {"Extended Address Space Descriptor", NULL, ACPI_OSI_FEATURE, 0},
  84   85  
  85   86      /*
  86   87       * All "optional" feature group strings (features that are implemented
  87      -     * by the host) should be dynamically added by the host via
  88      -     * AcpiInstallInterface and should not be manually added here.
  89      -     *
  90      -     * Examples of optional feature group strings:
  91      -     *
  92      -     * "Module Device"
  93      -     * "Processor Device"
  94      -     * "3.0 Thermal Model"
  95      -     * "3.0 _SCP Extensions"
  96      -     * "Processor Aggregator Device"
       88 +     * by the host) should be dynamically modified to VALID by the host via
       89 +     * AcpiInstallInterface or AcpiUpdateInterfaces. Such optional feature
       90 +     * group strings are set as INVALID by default here.
  97   91       */
       92 +
       93 +    {"Module Device",               NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
       94 +    {"Processor Device",            NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
       95 +    {"3.0 Thermal Model",           NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
       96 +    {"3.0 _SCP Extensions",         NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
       97 +    {"Processor Aggregator Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}
  98   98  };
  99   99  
 100  100  
 101  101  /*******************************************************************************
 102  102   *
 103  103   * FUNCTION:    AcpiUtInitializeInterfaces
 104  104   *
 105  105   * PARAMETERS:  None
 106  106   *
 107  107   * RETURN:      Status
 108  108   *
 109  109   * DESCRIPTION: Initialize the global _OSI supported interfaces list
 110  110   *
 111  111   ******************************************************************************/
 112  112  
 113  113  ACPI_STATUS
 114  114  AcpiUtInitializeInterfaces (
 115  115      void)
 116  116  {
      117 +    ACPI_STATUS             Status;
 117  118      UINT32                  i;
 118  119  
 119  120  
 120      -    (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
      121 +    Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
      122 +    if (ACPI_FAILURE (Status))
      123 +    {
      124 +        return (Status);
      125 +    }
      126 +
 121  127      AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces;
 122  128  
 123  129      /* Link the static list of supported interfaces */
 124  130  
 125  131      for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++)
 126  132      {
 127  133          AcpiDefaultSupportedInterfaces[i].Next =
 128  134              &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1];
 129  135      }
 130  136  
↓ open down ↓ 1 lines elided ↑ open up ↑
 132  138      return (AE_OK);
 133  139  }
 134  140  
 135  141  
 136  142  /*******************************************************************************
 137  143   *
 138  144   * FUNCTION:    AcpiUtInterfaceTerminate
 139  145   *
 140  146   * PARAMETERS:  None
 141  147   *
 142      - * RETURN:      None
      148 + * RETURN:      Status
 143  149   *
 144  150   * DESCRIPTION: Delete all interfaces in the global list. Sets
 145  151   *              AcpiGbl_SupportedInterfaces to NULL.
 146  152   *
 147  153   ******************************************************************************/
 148  154  
 149      -void
      155 +ACPI_STATUS
 150  156  AcpiUtInterfaceTerminate (
 151  157      void)
 152  158  {
      159 +    ACPI_STATUS             Status;
 153  160      ACPI_INTERFACE_INFO     *NextInterface;
 154  161  
 155  162  
 156      -    (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
 157      -    NextInterface = AcpiGbl_SupportedInterfaces;
      163 +    Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
      164 +    if (ACPI_FAILURE (Status))
      165 +    {
      166 +        return (Status);
      167 +    }
 158  168  
      169 +    NextInterface = AcpiGbl_SupportedInterfaces;
 159  170      while (NextInterface)
 160  171      {
 161  172          AcpiGbl_SupportedInterfaces = NextInterface->Next;
 162  173  
 163      -        /* Only interfaces added at runtime can be freed */
 164      -
 165  174          if (NextInterface->Flags & ACPI_OSI_DYNAMIC)
 166  175          {
      176 +            /* Only interfaces added at runtime can be freed */
      177 +
 167  178              ACPI_FREE (NextInterface->Name);
 168  179              ACPI_FREE (NextInterface);
 169  180          }
      181 +        else
      182 +        {
      183 +            /* Interface is in static list. Reset it to invalid or valid. */
 170  184  
      185 +            if (NextInterface->Flags & ACPI_OSI_DEFAULT_INVALID)
      186 +            {
      187 +                NextInterface->Flags |= ACPI_OSI_INVALID;
      188 +            }
      189 +            else
      190 +            {
      191 +                NextInterface->Flags &= ~ACPI_OSI_INVALID;
      192 +            }
      193 +        }
      194 +
 171  195          NextInterface = AcpiGbl_SupportedInterfaces;
 172  196      }
 173  197  
 174  198      AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
      199 +    return (AE_OK);
 175  200  }
 176  201  
 177  202  
 178  203  /*******************************************************************************
 179  204   *
 180  205   * FUNCTION:    AcpiUtInstallInterface
 181  206   *
 182  207   * PARAMETERS:  InterfaceName       - The interface to install
 183  208   *
 184  209   * RETURN:      Status
↓ open down ↓ 102 lines elided ↑ open up ↑
 287  312      }
 288  313  
 289  314      /* Interface was not found */
 290  315  
 291  316      return (AE_NOT_EXIST);
 292  317  }
 293  318  
 294  319  
 295  320  /*******************************************************************************
 296  321   *
      322 + * FUNCTION:    AcpiUtUpdateInterfaces
      323 + *
      324 + * PARAMETERS:  Action              - Actions to be performed during the
      325 + *                                    update
      326 + *
      327 + * RETURN:      Status
      328 + *
      329 + * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor
      330 + *              strings or/and feature group strings.
      331 + *              Caller MUST hold AcpiGbl_OsiMutex
      332 + *
      333 + ******************************************************************************/
      334 +
      335 +ACPI_STATUS
      336 +AcpiUtUpdateInterfaces (
      337 +    UINT8                   Action)
      338 +{
      339 +    ACPI_INTERFACE_INFO     *NextInterface;
      340 +
      341 +
      342 +    NextInterface = AcpiGbl_SupportedInterfaces;
      343 +    while (NextInterface)
      344 +    {
      345 +        if (((NextInterface->Flags & ACPI_OSI_FEATURE) &&
      346 +             (Action & ACPI_FEATURE_STRINGS)) ||
      347 +            (!(NextInterface->Flags & ACPI_OSI_FEATURE) &&
      348 +             (Action & ACPI_VENDOR_STRINGS)))
      349 +        {
      350 +            if (Action & ACPI_DISABLE_INTERFACES)
      351 +            {
      352 +                /* Mark the interfaces as invalid */
      353 +
      354 +                NextInterface->Flags |= ACPI_OSI_INVALID;
      355 +            }
      356 +            else
      357 +            {
      358 +                /* Mark the interfaces as valid */
      359 +
      360 +                NextInterface->Flags &= ~ACPI_OSI_INVALID;
      361 +            }
      362 +        }
      363 +
      364 +        NextInterface = NextInterface->Next;
      365 +    }
      366 +
      367 +    return (AE_OK);
      368 +}
      369 +
      370 +
      371 +/*******************************************************************************
      372 + *
 297  373   * FUNCTION:    AcpiUtGetInterface
 298  374   *
 299  375   * PARAMETERS:  InterfaceName       - The interface to find
 300  376   *
 301  377   * RETURN:      ACPI_INTERFACE_INFO if found. NULL if not found.
 302  378   *
 303  379   * DESCRIPTION: Search for the specified interface name in the global list.
 304  380   *              Caller MUST hold AcpiGbl_OsiMutex
 305  381   *
 306  382   ******************************************************************************/
↓ open down ↓ 35 lines elided ↑ open up ↑
 342  418   ******************************************************************************/
 343  419  
 344  420  ACPI_STATUS
 345  421  AcpiUtOsiImplementation (
 346  422      ACPI_WALK_STATE         *WalkState)
 347  423  {
 348  424      ACPI_OPERAND_OBJECT     *StringDesc;
 349  425      ACPI_OPERAND_OBJECT     *ReturnDesc;
 350  426      ACPI_INTERFACE_INFO     *InterfaceInfo;
 351  427      ACPI_INTERFACE_HANDLER  InterfaceHandler;
      428 +    ACPI_STATUS             Status;
 352  429      UINT32                  ReturnValue;
 353  430  
 354  431  
 355  432      ACPI_FUNCTION_TRACE (UtOsiImplementation);
 356  433  
 357  434  
 358  435      /* Validate the string input argument (from the AML caller) */
 359  436  
 360  437      StringDesc = WalkState->Arguments[0].Object;
 361  438      if (!StringDesc ||
↓ open down ↓ 6 lines elided ↑ open up ↑
 368  445  
 369  446      ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
 370  447      if (!ReturnDesc)
 371  448      {
 372  449          return_ACPI_STATUS (AE_NO_MEMORY);
 373  450      }
 374  451  
 375  452      /* Default return value is 0, NOT SUPPORTED */
 376  453  
 377  454      ReturnValue = 0;
 378      -    (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
      455 +    Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
      456 +    if (ACPI_FAILURE (Status))
      457 +    {
      458 +        AcpiUtRemoveReference (ReturnDesc);
      459 +        return_ACPI_STATUS (Status);
      460 +    }
 379  461  
 380  462      /* Lookup the interface in the global _OSI list */
 381  463  
 382  464      InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer);
 383  465      if (InterfaceInfo &&
 384  466          !(InterfaceInfo->Flags & ACPI_OSI_INVALID))
 385  467      {
 386  468          /*
 387  469           * The interface is supported.
 388  470           * Update the OsiData if necessary. We keep track of the latest
↓ open down ↓ 34 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX