1 |
1275 |
phoenix |
/*******************************************************************************
|
2 |
|
|
*
|
3 |
|
|
* Module Name: evsci - System Control Interrupt configuration and
|
4 |
|
|
* legacy to ACPI mode state transition functions
|
5 |
|
|
*
|
6 |
|
|
******************************************************************************/
|
7 |
|
|
|
8 |
|
|
/*
|
9 |
|
|
* Copyright (C) 2000 - 2004, R. Byron Moore
|
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 |
|
|
|
48 |
|
|
|
49 |
|
|
#define _COMPONENT ACPI_EVENTS
|
50 |
|
|
ACPI_MODULE_NAME ("evsci")
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
/*******************************************************************************
|
54 |
|
|
*
|
55 |
|
|
* FUNCTION: acpi_ev_sci_xrupt_handler
|
56 |
|
|
*
|
57 |
|
|
* PARAMETERS: Context - Calling Context
|
58 |
|
|
*
|
59 |
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
60 |
|
|
*
|
61 |
|
|
* DESCRIPTION: Interrupt handler that will figure out what function or
|
62 |
|
|
* control method to call to deal with a SCI.
|
63 |
|
|
*
|
64 |
|
|
******************************************************************************/
|
65 |
|
|
|
66 |
|
|
static u32 ACPI_SYSTEM_XFACE
|
67 |
|
|
acpi_ev_sci_xrupt_handler (
|
68 |
|
|
void *context)
|
69 |
|
|
{
|
70 |
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
71 |
|
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
/*
|
78 |
|
|
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
79 |
|
|
* if this interrupt handler is installed, ACPI is enabled.
|
80 |
|
|
*/
|
81 |
|
|
|
82 |
|
|
/*
|
83 |
|
|
* Fixed Events:
|
84 |
|
|
* Check for and dispatch any Fixed Events that have occurred
|
85 |
|
|
*/
|
86 |
|
|
interrupt_handled |= acpi_ev_fixed_event_detect ();
|
87 |
|
|
|
88 |
|
|
/*
|
89 |
|
|
* General Purpose Events:
|
90 |
|
|
* Check for and dispatch any GPEs that have occurred
|
91 |
|
|
*/
|
92 |
|
|
interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
|
93 |
|
|
|
94 |
|
|
return_VALUE (interrupt_handled);
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
/*******************************************************************************
|
99 |
|
|
*
|
100 |
|
|
* FUNCTION: acpi_ev_gpe_xrupt_handler
|
101 |
|
|
*
|
102 |
|
|
* PARAMETERS: Context - Calling Context
|
103 |
|
|
*
|
104 |
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
105 |
|
|
*
|
106 |
|
|
* DESCRIPTION: Handler for GPE Block Device interrupts
|
107 |
|
|
*
|
108 |
|
|
******************************************************************************/
|
109 |
|
|
|
110 |
|
|
u32 ACPI_SYSTEM_XFACE
|
111 |
|
|
acpi_ev_gpe_xrupt_handler (
|
112 |
|
|
void *context)
|
113 |
|
|
{
|
114 |
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
115 |
|
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
/*
|
122 |
|
|
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
123 |
|
|
* if this interrupt handler is installed, ACPI is enabled.
|
124 |
|
|
*/
|
125 |
|
|
|
126 |
|
|
/*
|
127 |
|
|
* GPEs:
|
128 |
|
|
* Check for and dispatch any GPEs that have occurred
|
129 |
|
|
*/
|
130 |
|
|
interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
|
131 |
|
|
|
132 |
|
|
return_VALUE (interrupt_handled);
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
/******************************************************************************
|
137 |
|
|
*
|
138 |
|
|
* FUNCTION: acpi_ev_install_sci_handler
|
139 |
|
|
*
|
140 |
|
|
* PARAMETERS: none
|
141 |
|
|
*
|
142 |
|
|
* RETURN: Status
|
143 |
|
|
*
|
144 |
|
|
* DESCRIPTION: Installs SCI handler.
|
145 |
|
|
*
|
146 |
|
|
******************************************************************************/
|
147 |
|
|
|
148 |
|
|
u32
|
149 |
|
|
acpi_ev_install_sci_handler (void)
|
150 |
|
|
{
|
151 |
|
|
u32 status = AE_OK;
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
ACPI_FUNCTION_TRACE ("ev_install_sci_handler");
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
|
158 |
|
|
acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head);
|
159 |
|
|
return_ACPI_STATUS (status);
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
/******************************************************************************
|
164 |
|
|
*
|
165 |
|
|
* FUNCTION: acpi_ev_remove_sci_handler
|
166 |
|
|
*
|
167 |
|
|
* PARAMETERS: none
|
168 |
|
|
*
|
169 |
|
|
* RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
|
170 |
|
|
* installed to begin with
|
171 |
|
|
*
|
172 |
|
|
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
|
173 |
|
|
* taken.
|
174 |
|
|
*
|
175 |
|
|
* Note: It doesn't seem important to disable all events or set the event
|
176 |
|
|
* enable registers to their original values. The OS should disable
|
177 |
|
|
* the SCI interrupt level when the handler is removed, so no more
|
178 |
|
|
* events will come in.
|
179 |
|
|
*
|
180 |
|
|
******************************************************************************/
|
181 |
|
|
|
182 |
|
|
acpi_status
|
183 |
|
|
acpi_ev_remove_sci_handler (void)
|
184 |
|
|
{
|
185 |
|
|
acpi_status status;
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
ACPI_FUNCTION_TRACE ("ev_remove_sci_handler");
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
/* Just let the OS remove the handler and disable the level */
|
192 |
|
|
|
193 |
|
|
status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
|
194 |
|
|
acpi_ev_sci_xrupt_handler);
|
195 |
|
|
|
196 |
|
|
return_ACPI_STATUS (status);
|
197 |
|
|
}
|
198 |
|
|
|
199 |
|
|
|