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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/events/evgpeutil.c
          +++ new/usr/src/common/acpica/components/events/evgpeutil.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: evgpeutil - GPE utilities
   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 ↓ 15 lines elided ↑ open up ↑
  34   34   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35   35   * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36   36   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37   37   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38   38   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39   39   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40   40   * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41   41   * POSSIBILITY OF SUCH DAMAGES.
  42   42   */
  43   43  
  44      -
  45   44  #include "acpi.h"
  46   45  #include "accommon.h"
  47   46  #include "acevents.h"
  48   47  
  49   48  #define _COMPONENT          ACPI_EVENTS
  50   49          ACPI_MODULE_NAME    ("evgpeutil")
  51   50  
  52   51  
       52 +#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
  53   53  /*******************************************************************************
  54   54   *
  55   55   * FUNCTION:    AcpiEvWalkGpeList
  56   56   *
  57   57   * PARAMETERS:  GpeWalkCallback     - Routine called for each GPE block
  58   58   *              Context             - Value passed to callback
  59   59   *
  60   60   * RETURN:      Status
  61   61   *
  62   62   * DESCRIPTION: Walk the GPE lists.
↓ open down ↓ 146 lines elided ↑ open up ↑
 209  209      }
 210  210  
 211  211      return (AE_OK);
 212  212  }
 213  213  
 214  214  
 215  215  /*******************************************************************************
 216  216   *
 217  217   * FUNCTION:    AcpiEvGetGpeXruptBlock
 218  218   *
 219      - * PARAMETERS:  InterruptNumber      - Interrupt for a GPE block
      219 + * PARAMETERS:  InterruptNumber             - Interrupt for a GPE block
      220 + *              GpeXruptBlock               - Where the block is returned
 220  221   *
 221      - * RETURN:      A GPE interrupt block
      222 + * RETURN:      Status
 222  223   *
 223  224   * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
 224  225   *              block per unique interrupt level used for GPEs. Should be
 225  226   *              called only when the GPE lists are semaphore locked and not
 226  227   *              subject to change.
 227  228   *
 228  229   ******************************************************************************/
 229  230  
 230      -ACPI_GPE_XRUPT_INFO *
      231 +ACPI_STATUS
 231  232  AcpiEvGetGpeXruptBlock (
 232      -    UINT32                  InterruptNumber)
      233 +    UINT32                  InterruptNumber,
      234 +    ACPI_GPE_XRUPT_INFO     **GpeXruptBlock)
 233  235  {
 234  236      ACPI_GPE_XRUPT_INFO     *NextGpeXrupt;
 235  237      ACPI_GPE_XRUPT_INFO     *GpeXrupt;
 236  238      ACPI_STATUS             Status;
 237  239      ACPI_CPU_FLAGS          Flags;
 238  240  
 239  241  
 240  242      ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
 241  243  
 242  244  
 243  245      /* No need for lock since we are not changing any list elements here */
 244  246  
 245  247      NextGpeXrupt = AcpiGbl_GpeXruptListHead;
 246  248      while (NextGpeXrupt)
 247  249      {
 248  250          if (NextGpeXrupt->InterruptNumber == InterruptNumber)
 249  251          {
 250      -            return_PTR (NextGpeXrupt);
      252 +            *GpeXruptBlock = NextGpeXrupt;
      253 +            return_ACPI_STATUS (AE_OK);
 251  254          }
 252  255  
 253  256          NextGpeXrupt = NextGpeXrupt->Next;
 254  257      }
 255  258  
 256  259      /* Not found, must allocate a new xrupt descriptor */
 257  260  
 258  261      GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
 259  262      if (!GpeXrupt)
 260  263      {
 261      -        return_PTR (NULL);
      264 +        return_ACPI_STATUS (AE_NO_MEMORY);
 262  265      }
 263  266  
 264  267      GpeXrupt->InterruptNumber = InterruptNumber;
 265  268  
 266  269      /* Install new interrupt descriptor with spin lock */
 267  270  
 268  271      Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
 269  272      if (AcpiGbl_GpeXruptListHead)
 270  273      {
 271  274          NextGpeXrupt = AcpiGbl_GpeXruptListHead;
↓ open down ↓ 2 lines elided ↑ open up ↑
 274  277              NextGpeXrupt = NextGpeXrupt->Next;
 275  278          }
 276  279  
 277  280          NextGpeXrupt->Next = GpeXrupt;
 278  281          GpeXrupt->Previous = NextGpeXrupt;
 279  282      }
 280  283      else
 281  284      {
 282  285          AcpiGbl_GpeXruptListHead = GpeXrupt;
 283  286      }
      287 +
 284  288      AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
 285  289  
 286  290      /* Install new interrupt handler if not SCI_INT */
 287  291  
 288  292      if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
 289  293      {
 290  294          Status = AcpiOsInstallInterruptHandler (InterruptNumber,
 291  295                      AcpiEvGpeXruptHandler, GpeXrupt);
 292  296          if (ACPI_FAILURE (Status))
 293  297          {
 294      -            ACPI_ERROR ((AE_INFO,
      298 +            ACPI_EXCEPTION ((AE_INFO, Status,
 295  299                  "Could not install GPE interrupt handler at level 0x%X",
 296  300                  InterruptNumber));
 297      -            return_PTR (NULL);
      301 +            return_ACPI_STATUS (Status);
 298  302          }
 299  303      }
 300  304  
 301      -    return_PTR (GpeXrupt);
      305 +    *GpeXruptBlock = GpeXrupt;
      306 +    return_ACPI_STATUS (AE_OK);
 302  307  }
 303  308  
 304  309  
 305  310  /*******************************************************************************
 306  311   *
 307  312   * FUNCTION:    AcpiEvDeleteGpeXrupt
 308  313   *
 309  314   * PARAMETERS:  GpeXrupt        - A GPE interrupt info block
 310  315   *
 311  316   * RETURN:      Status
↓ open down ↓ 72 lines elided ↑ open up ↑
 384  389   *
 385  390   ******************************************************************************/
 386  391  
 387  392  ACPI_STATUS
 388  393  AcpiEvDeleteGpeHandlers (
 389  394      ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
 390  395      ACPI_GPE_BLOCK_INFO     *GpeBlock,
 391  396      void                    *Context)
 392  397  {
 393  398      ACPI_GPE_EVENT_INFO     *GpeEventInfo;
      399 +    ACPI_GPE_NOTIFY_INFO    *Notify;
      400 +    ACPI_GPE_NOTIFY_INFO    *Next;
 394  401      UINT32                  i;
 395  402      UINT32                  j;
 396  403  
 397  404  
 398  405      ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
 399  406  
 400  407  
 401  408      /* Examine each GPE Register within the block */
 402  409  
 403  410      for (i = 0; i < GpeBlock->RegisterCount; i++)
↓ open down ↓ 1 lines elided ↑ open up ↑
 405  412          /* Now look at the individual GPEs in this byte register */
 406  413  
 407  414          for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
 408  415          {
 409  416              GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
 410  417                  ACPI_GPE_REGISTER_WIDTH) + j];
 411  418  
 412  419              if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
 413  420                      ACPI_GPE_DISPATCH_HANDLER)
 414  421              {
      422 +                /* Delete an installed handler block */
      423 +
 415  424                  ACPI_FREE (GpeEventInfo->Dispatch.Handler);
 416  425                  GpeEventInfo->Dispatch.Handler = NULL;
 417  426                  GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
 418  427              }
      428 +            else if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
      429 +                    ACPI_GPE_DISPATCH_NOTIFY)
      430 +            {
      431 +                /* Delete the implicit notification device list */
      432 +
      433 +                Notify = GpeEventInfo->Dispatch.NotifyList;
      434 +                while (Notify)
      435 +                {
      436 +                    Next = Notify->Next;
      437 +                    ACPI_FREE (Notify);
      438 +                    Notify = Next;
      439 +                }
      440 +                GpeEventInfo->Dispatch.NotifyList = NULL;
      441 +                GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
      442 +            }
 419  443          }
 420  444      }
 421  445  
 422  446      return_ACPI_STATUS (AE_OK);
 423  447  }
 424  448  
      449 +#endif /* !ACPI_REDUCED_HARDWARE */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX