Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Module Name: evglock - Global Lock support
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, 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.


  32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 #include "acpi.h"
  45 #include "accommon.h"
  46 #include "acevents.h"
  47 #include "acinterp.h"
  48 
  49 #define _COMPONENT          ACPI_EVENTS
  50         ACPI_MODULE_NAME    ("evglock")
  51 

  52 
  53 /* Local prototypes */
  54 
  55 static UINT32
  56 AcpiEvGlobalLockHandler (
  57     void                    *Context);
  58 
  59 
  60 /*******************************************************************************
  61  *
  62  * FUNCTION:    AcpiEvInitGlobalLockHandler
  63  *
  64  * PARAMETERS:  None
  65  *
  66  * RETURN:      Status
  67  *
  68  * DESCRIPTION: Install a handler for the global lock release event
  69  *
  70  ******************************************************************************/
  71 
  72 ACPI_STATUS
  73 AcpiEvInitGlobalLockHandler (
  74     void)
  75 {
  76     ACPI_STATUS             Status;
  77 
  78 
  79     ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
  80 
  81 







  82     /* Attempt installation of the global lock handler */
  83 
  84     Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
  85                 AcpiEvGlobalLockHandler, NULL);
  86 
  87     /*
  88      * If the global lock does not exist on this platform, the attempt to
  89      * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
  90      * Map to AE_OK, but mark global lock as not present. Any attempt to
  91      * actually use the global lock will be flagged with an error.
  92      */
  93     AcpiGbl_GlobalLockPresent = FALSE;
  94     if (Status == AE_NO_HARDWARE_RESPONSE)
  95     {
  96         ACPI_ERROR ((AE_INFO,
  97             "No response from Global Lock hardware, disabling lock"));
  98 
  99         return_ACPI_STATUS (AE_OK);
 100     }
 101 


 119  *
 120  * RETURN:      Status
 121  *
 122  * DESCRIPTION: Remove the handler for the Global Lock
 123  *
 124  ******************************************************************************/
 125 
 126 ACPI_STATUS
 127 AcpiEvRemoveGlobalLockHandler (
 128     void)
 129 {
 130     ACPI_STATUS             Status;
 131 
 132 
 133     ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler);
 134 
 135     AcpiGbl_GlobalLockPresent = FALSE;
 136     Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL,
 137                 AcpiEvGlobalLockHandler);
 138 

 139     return_ACPI_STATUS (Status);
 140 }
 141 
 142 
 143 /*******************************************************************************
 144  *
 145  * FUNCTION:    AcpiEvGlobalLockHandler
 146  *
 147  * PARAMETERS:  Context         - From thread interface, not used
 148  *
 149  * RETURN:      ACPI_INTERRUPT_HANDLED
 150  *
 151  * DESCRIPTION: Invoked directly from the SCI handler when a global lock
 152  *              release interrupt occurs. If there is actually a pending
 153  *              request for the lock, signal the waiting thread.
 154  *
 155  ******************************************************************************/
 156 
 157 static UINT32
 158 AcpiEvGlobalLockHandler (


 348         /*
 349          * If the pending bit was set, we must write GBL_RLS to the control
 350          * register
 351          */
 352         if (Pending)
 353         {
 354             Status = AcpiWriteBitRegister (
 355                         ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT);
 356         }
 357 
 358         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
 359     }
 360 
 361     AcpiGbl_GlobalLockAcquired = FALSE;
 362 
 363     /* Release the local GL mutex */
 364 
 365     AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex);
 366     return_ACPI_STATUS (Status);
 367 }


   1 /******************************************************************************
   2  *
   3  * Module Name: evglock - Global Lock support
   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.


  32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 #include "acpi.h"
  45 #include "accommon.h"
  46 #include "acevents.h"
  47 #include "acinterp.h"
  48 
  49 #define _COMPONENT          ACPI_EVENTS
  50         ACPI_MODULE_NAME    ("evglock")
  51 
  52 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */
  53 
  54 /* Local prototypes */
  55 
  56 static UINT32
  57 AcpiEvGlobalLockHandler (
  58     void                    *Context);
  59 
  60 
  61 /*******************************************************************************
  62  *
  63  * FUNCTION:    AcpiEvInitGlobalLockHandler
  64  *
  65  * PARAMETERS:  None
  66  *
  67  * RETURN:      Status
  68  *
  69  * DESCRIPTION: Install a handler for the global lock release event
  70  *
  71  ******************************************************************************/
  72 
  73 ACPI_STATUS
  74 AcpiEvInitGlobalLockHandler (
  75     void)
  76 {
  77     ACPI_STATUS             Status;
  78 
  79 
  80     ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
  81 
  82 
  83     /* If Hardware Reduced flag is set, there is no global lock */
  84 
  85     if (AcpiGbl_ReducedHardware)
  86     {
  87         return_ACPI_STATUS (AE_OK);
  88     }
  89 
  90     /* Attempt installation of the global lock handler */
  91 
  92     Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
  93                 AcpiEvGlobalLockHandler, NULL);
  94 
  95     /*
  96      * If the global lock does not exist on this platform, the attempt to
  97      * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
  98      * Map to AE_OK, but mark global lock as not present. Any attempt to
  99      * actually use the global lock will be flagged with an error.
 100      */
 101     AcpiGbl_GlobalLockPresent = FALSE;
 102     if (Status == AE_NO_HARDWARE_RESPONSE)
 103     {
 104         ACPI_ERROR ((AE_INFO,
 105             "No response from Global Lock hardware, disabling lock"));
 106 
 107         return_ACPI_STATUS (AE_OK);
 108     }
 109 


 127  *
 128  * RETURN:      Status
 129  *
 130  * DESCRIPTION: Remove the handler for the Global Lock
 131  *
 132  ******************************************************************************/
 133 
 134 ACPI_STATUS
 135 AcpiEvRemoveGlobalLockHandler (
 136     void)
 137 {
 138     ACPI_STATUS             Status;
 139 
 140 
 141     ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler);
 142 
 143     AcpiGbl_GlobalLockPresent = FALSE;
 144     Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL,
 145                 AcpiEvGlobalLockHandler);
 146 
 147     AcpiOsDeleteLock (AcpiGbl_GlobalLockPendingLock);
 148     return_ACPI_STATUS (Status);
 149 }
 150 
 151 
 152 /*******************************************************************************
 153  *
 154  * FUNCTION:    AcpiEvGlobalLockHandler
 155  *
 156  * PARAMETERS:  Context         - From thread interface, not used
 157  *
 158  * RETURN:      ACPI_INTERRUPT_HANDLED
 159  *
 160  * DESCRIPTION: Invoked directly from the SCI handler when a global lock
 161  *              release interrupt occurs. If there is actually a pending
 162  *              request for the lock, signal the waiting thread.
 163  *
 164  ******************************************************************************/
 165 
 166 static UINT32
 167 AcpiEvGlobalLockHandler (


 357         /*
 358          * If the pending bit was set, we must write GBL_RLS to the control
 359          * register
 360          */
 361         if (Pending)
 362         {
 363             Status = AcpiWriteBitRegister (
 364                         ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT);
 365         }
 366 
 367         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
 368     }
 369 
 370     AcpiGbl_GlobalLockAcquired = FALSE;
 371 
 372     /* Release the local GL mutex */
 373 
 374     AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex);
 375     return_ACPI_STATUS (Status);
 376 }
 377 
 378 #endif /* !ACPI_REDUCED_HARDWARE */