ACPICA: update Intel copyright
[deliverable/linux.git] / drivers / acpi / events / evsci.c
CommitLineData
1da177e4
LT
1/*******************************************************************************
2 *
3 * Module Name: evsci - System Control Interrupt configuration and
4 * legacy to ACPI mode state transition functions
5 *
6 ******************************************************************************/
7
8/*
75a44ce0 9 * Copyright (C) 2000 - 2008, Intel Corp.
1da177e4
LT
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#include <acpi/acpi.h>
46#include <acpi/acevents.h>
47
1da177e4 48#define _COMPONENT ACPI_EVENTS
4be44fcd 49ACPI_MODULE_NAME("evsci")
1da177e4 50
44f6c012 51/* Local prototypes */
4be44fcd 52static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
1da177e4
LT
53
54/*******************************************************************************
55 *
56 * FUNCTION: acpi_ev_sci_xrupt_handler
57 *
58 * PARAMETERS: Context - Calling Context
59 *
60 * RETURN: Status code indicates whether interrupt was handled.
61 *
62 * DESCRIPTION: Interrupt handler that will figure out what function or
63 * control method to call to deal with a SCI.
64 *
65 ******************************************************************************/
66
4be44fcd 67static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
1da177e4 68{
4be44fcd
LB
69 struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
70 u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
1da177e4 71
b229cf92 72 ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler);
1da177e4 73
1da177e4
LT
74 /*
75 * We are guaranteed by the ACPI CA initialization/shutdown code that
76 * if this interrupt handler is installed, ACPI is enabled.
77 */
78
79 /*
80 * Fixed Events:
81 * Check for and dispatch any Fixed Events that have occurred
82 */
4be44fcd 83 interrupt_handled |= acpi_ev_fixed_event_detect();
1da177e4
LT
84
85 /*
86 * General Purpose Events:
87 * Check for and dispatch any GPEs that have occurred
88 */
4be44fcd 89 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
1da177e4 90
50eca3eb 91 return_UINT32(interrupt_handled);
1da177e4
LT
92}
93
1da177e4
LT
94/*******************************************************************************
95 *
96 * FUNCTION: acpi_ev_gpe_xrupt_handler
97 *
98 * PARAMETERS: Context - Calling Context
99 *
100 * RETURN: Status code indicates whether interrupt was handled.
101 *
102 * DESCRIPTION: Handler for GPE Block Device interrupts
103 *
104 ******************************************************************************/
105
4be44fcd 106u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
1da177e4 107{
4be44fcd
LB
108 struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
109 u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
1da177e4 110
b229cf92 111 ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler);
1da177e4 112
1da177e4
LT
113 /*
114 * We are guaranteed by the ACPI CA initialization/shutdown code that
115 * if this interrupt handler is installed, ACPI is enabled.
116 */
117
118 /*
119 * GPEs:
120 * Check for and dispatch any GPEs that have occurred
121 */
4be44fcd 122 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
1da177e4 123
50eca3eb 124 return_UINT32(interrupt_handled);
1da177e4
LT
125}
126
1da177e4
LT
127/******************************************************************************
128 *
129 * FUNCTION: acpi_ev_install_sci_handler
130 *
131 * PARAMETERS: none
132 *
133 * RETURN: Status
134 *
135 * DESCRIPTION: Installs SCI handler.
136 *
137 ******************************************************************************/
138
4be44fcd 139u32 acpi_ev_install_sci_handler(void)
1da177e4 140{
4be44fcd 141 u32 status = AE_OK;
1da177e4 142
b229cf92 143 ACPI_FUNCTION_TRACE(ev_install_sci_handler);
1da177e4 144
f3d2e786
BM
145 status =
146 acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt,
147 acpi_ev_sci_xrupt_handler,
148 acpi_gbl_gpe_xrupt_list_head);
4be44fcd 149 return_ACPI_STATUS(status);
1da177e4
LT
150}
151
1da177e4
LT
152/******************************************************************************
153 *
154 * FUNCTION: acpi_ev_remove_sci_handler
155 *
156 * PARAMETERS: none
157 *
158 * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
159 * installed to begin with
160 *
161 * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
162 * taken.
163 *
164 * Note: It doesn't seem important to disable all events or set the event
165 * enable registers to their original values. The OS should disable
166 * the SCI interrupt level when the handler is removed, so no more
167 * events will come in.
168 *
169 ******************************************************************************/
170
4be44fcd 171acpi_status acpi_ev_remove_sci_handler(void)
1da177e4 172{
4be44fcd 173 acpi_status status;
1da177e4 174
b229cf92 175 ACPI_FUNCTION_TRACE(ev_remove_sci_handler);
1da177e4
LT
176
177 /* Just let the OS remove the handler and disable the level */
178
f3d2e786
BM
179 status =
180 acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt,
181 acpi_ev_sci_xrupt_handler);
1da177e4 182
4be44fcd 183 return_ACPI_STATUS(status);
1da177e4 184}
This page took 0.303992 seconds and 5 git commands to generate.