Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
   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.
  29  *
  30  * NO WARRANTY
  31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  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 
  45 #define __EVXFEVNT_C__

  46 
  47 #include "acpi.h"
  48 #include "accommon.h"
  49 #include "actables.h"
  50 
  51 #define _COMPONENT          ACPI_EVENTS
  52         ACPI_MODULE_NAME    ("evxfevnt")
  53 
  54 

  55 /*******************************************************************************
  56  *
  57  * FUNCTION:    AcpiEnable
  58  *
  59  * PARAMETERS:  None
  60  *
  61  * RETURN:      Status
  62  *
  63  * DESCRIPTION: Transfers the system into ACPI mode.
  64  *
  65  ******************************************************************************/
  66 
  67 ACPI_STATUS
  68 AcpiEnable (
  69     void)
  70 {
  71     ACPI_STATUS             Status = AE_OK;
  72 
  73 
  74     ACPI_FUNCTION_TRACE (AcpiEnable);
  75 
  76 
  77     /* ACPI tables must be present */
  78 
  79     if (!AcpiTbTablesLoaded ())
  80     {
  81         return_ACPI_STATUS (AE_NO_ACPI_TABLES);
  82     }
  83 







  84     /* Check current mode */
  85 
  86     if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
  87     {
  88         ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
  89     }
  90     else
  91     {
  92         /* Transition to ACPI mode */
  93 
  94         Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
  95         if (ACPI_FAILURE (Status))
  96         {
  97             ACPI_ERROR ((AE_INFO, "Could not transition to ACPI mode"));
  98             return_ACPI_STATUS (Status);
  99         }
 100 
 101         ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
 102             "Transition to ACPI mode successful\n"));
 103     }


 113  * FUNCTION:    AcpiDisable
 114  *
 115  * PARAMETERS:  None
 116  *
 117  * RETURN:      Status
 118  *
 119  * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
 120  *
 121  ******************************************************************************/
 122 
 123 ACPI_STATUS
 124 AcpiDisable (
 125     void)
 126 {
 127     ACPI_STATUS             Status = AE_OK;
 128 
 129 
 130     ACPI_FUNCTION_TRACE (AcpiDisable);
 131 
 132 







 133     if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
 134     {
 135         ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
 136             "System is already in legacy (non-ACPI) mode\n"));
 137     }
 138     else
 139     {
 140         /* Transition to LEGACY mode */
 141 
 142         Status = AcpiHwSetMode (ACPI_SYS_MODE_LEGACY);
 143 
 144         if (ACPI_FAILURE (Status))
 145         {
 146             ACPI_ERROR ((AE_INFO,
 147                 "Could not exit ACPI mode to legacy mode"));
 148             return_ACPI_STATUS (Status);
 149         }
 150 
 151         ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
 152     }


 360         return_ACPI_STATUS (AE_BAD_PARAMETER);
 361     }
 362 
 363     /* Decode the Fixed Event */
 364 
 365     if (Event > ACPI_EVENT_MAX)
 366     {
 367         return_ACPI_STATUS (AE_BAD_PARAMETER);
 368     }
 369 
 370     /* Get the status of the requested fixed event */
 371 
 372     Status = AcpiReadBitRegister (
 373                 AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus);
 374 
 375     return_ACPI_STATUS (Status);
 376 }
 377 
 378 ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
 379 
 380 
   1 /******************************************************************************
   2  *
   3  * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
   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.
  29  *
  30  * NO WARRANTY
  31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  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 
  45 #define __EVXFEVNT_C__
  46 #define EXPORT_ACPI_INTERFACES
  47 
  48 #include "acpi.h"
  49 #include "accommon.h"
  50 #include "actables.h"
  51 
  52 #define _COMPONENT          ACPI_EVENTS
  53         ACPI_MODULE_NAME    ("evxfevnt")
  54 
  55 
  56 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */
  57 /*******************************************************************************
  58  *
  59  * FUNCTION:    AcpiEnable
  60  *
  61  * PARAMETERS:  None
  62  *
  63  * RETURN:      Status
  64  *
  65  * DESCRIPTION: Transfers the system into ACPI mode.
  66  *
  67  ******************************************************************************/
  68 
  69 ACPI_STATUS
  70 AcpiEnable (
  71     void)
  72 {
  73     ACPI_STATUS             Status = AE_OK;
  74 
  75 
  76     ACPI_FUNCTION_TRACE (AcpiEnable);
  77 
  78 
  79     /* ACPI tables must be present */
  80 
  81     if (!AcpiTbTablesLoaded ())
  82     {
  83         return_ACPI_STATUS (AE_NO_ACPI_TABLES);
  84     }
  85 
  86     /* If the Hardware Reduced flag is set, machine is always in acpi mode */
  87 
  88     if (AcpiGbl_ReducedHardware)
  89     {
  90         return_ACPI_STATUS (AE_OK);
  91     }
  92 
  93     /* Check current mode */
  94 
  95     if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
  96     {
  97         ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
  98     }
  99     else
 100     {
 101         /* Transition to ACPI mode */
 102 
 103         Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
 104         if (ACPI_FAILURE (Status))
 105         {
 106             ACPI_ERROR ((AE_INFO, "Could not transition to ACPI mode"));
 107             return_ACPI_STATUS (Status);
 108         }
 109 
 110         ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
 111             "Transition to ACPI mode successful\n"));
 112     }


 122  * FUNCTION:    AcpiDisable
 123  *
 124  * PARAMETERS:  None
 125  *
 126  * RETURN:      Status
 127  *
 128  * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
 129  *
 130  ******************************************************************************/
 131 
 132 ACPI_STATUS
 133 AcpiDisable (
 134     void)
 135 {
 136     ACPI_STATUS             Status = AE_OK;
 137 
 138 
 139     ACPI_FUNCTION_TRACE (AcpiDisable);
 140 
 141 
 142     /* If the Hardware Reduced flag is set, machine is always in acpi mode */
 143 
 144     if (AcpiGbl_ReducedHardware)
 145     {
 146         return_ACPI_STATUS (AE_OK);
 147     }
 148 
 149     if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
 150     {
 151         ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
 152             "System is already in legacy (non-ACPI) mode\n"));
 153     }
 154     else
 155     {
 156         /* Transition to LEGACY mode */
 157 
 158         Status = AcpiHwSetMode (ACPI_SYS_MODE_LEGACY);
 159 
 160         if (ACPI_FAILURE (Status))
 161         {
 162             ACPI_ERROR ((AE_INFO,
 163                 "Could not exit ACPI mode to legacy mode"));
 164             return_ACPI_STATUS (Status);
 165         }
 166 
 167         ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
 168     }


 376         return_ACPI_STATUS (AE_BAD_PARAMETER);
 377     }
 378 
 379     /* Decode the Fixed Event */
 380 
 381     if (Event > ACPI_EVENT_MAX)
 382     {
 383         return_ACPI_STATUS (AE_BAD_PARAMETER);
 384     }
 385 
 386     /* Get the status of the requested fixed event */
 387 
 388     Status = AcpiReadBitRegister (
 389                 AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus);
 390 
 391     return_ACPI_STATUS (Status);
 392 }
 393 
 394 ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
 395 
 396 #endif /* !ACPI_REDUCED_HARDWARE */