aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events/evevent.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/events/evevent.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/events/evevent.c')
-rw-r--r--drivers/acpi/events/evevent.c168
1 files changed, 66 insertions, 102 deletions
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index dd3a72a869f4..842d1e3fb37b 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -45,18 +45,12 @@
45#include <acpi/acevents.h> 45#include <acpi/acevents.h>
46 46
47#define _COMPONENT ACPI_EVENTS 47#define _COMPONENT ACPI_EVENTS
48 ACPI_MODULE_NAME ("evevent") 48ACPI_MODULE_NAME("evevent")
49 49
50/* Local prototypes */ 50/* Local prototypes */
51static acpi_status acpi_ev_fixed_event_initialize(void);
51 52
52static acpi_status 53static u32 acpi_ev_fixed_event_dispatch(u32 event);
53acpi_ev_fixed_event_initialize (
54 void);
55
56static u32
57acpi_ev_fixed_event_dispatch (
58 u32 event);
59
60 54
61/******************************************************************************* 55/*******************************************************************************
62 * 56 *
@@ -70,21 +64,17 @@ acpi_ev_fixed_event_dispatch (
70 * 64 *
71 ******************************************************************************/ 65 ******************************************************************************/
72 66
73acpi_status 67acpi_status acpi_ev_initialize_events(void)
74acpi_ev_initialize_events (
75 void)
76{ 68{
77 acpi_status status; 69 acpi_status status;
78
79
80 ACPI_FUNCTION_TRACE ("ev_initialize_events");
81 70
71 ACPI_FUNCTION_TRACE("ev_initialize_events");
82 72
83 /* Make sure we have ACPI tables */ 73 /* Make sure we have ACPI tables */
84 74
85 if (!acpi_gbl_DSDT) { 75 if (!acpi_gbl_DSDT) {
86 ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n")); 76 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n"));
87 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 77 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
88 } 78 }
89 79
90 /* 80 /*
@@ -92,26 +82,22 @@ acpi_ev_initialize_events (
92 * enabling SCIs to prevent interrupts from occurring before the handlers are 82 * enabling SCIs to prevent interrupts from occurring before the handlers are
93 * installed. 83 * installed.
94 */ 84 */
95 status = acpi_ev_fixed_event_initialize (); 85 status = acpi_ev_fixed_event_initialize();
96 if (ACPI_FAILURE (status)) { 86 if (ACPI_FAILURE(status)) {
97 ACPI_REPORT_ERROR (( 87 ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
98 "Unable to initialize fixed events, %s\n", 88 acpi_format_exception(status)));
99 acpi_format_exception (status))); 89 return_ACPI_STATUS(status);
100 return_ACPI_STATUS (status);
101 } 90 }
102 91
103 status = acpi_ev_gpe_initialize (); 92 status = acpi_ev_gpe_initialize();
104 if (ACPI_FAILURE (status)) { 93 if (ACPI_FAILURE(status)) {
105 ACPI_REPORT_ERROR (( 94 ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
106 "Unable to initialize general purpose events, %s\n", 95 return_ACPI_STATUS(status);
107 acpi_format_exception (status)));
108 return_ACPI_STATUS (status);
109 } 96 }
110 97
111 return_ACPI_STATUS (status); 98 return_ACPI_STATUS(status);
112} 99}
113 100
114
115/******************************************************************************* 101/*******************************************************************************
116 * 102 *
117 * FUNCTION: acpi_ev_install_xrupt_handlers 103 * FUNCTION: acpi_ev_install_xrupt_handlers
@@ -124,41 +110,32 @@ acpi_ev_initialize_events (
124 * 110 *
125 ******************************************************************************/ 111 ******************************************************************************/
126 112
127acpi_status 113acpi_status acpi_ev_install_xrupt_handlers(void)
128acpi_ev_install_xrupt_handlers (
129 void)
130{ 114{
131 acpi_status status; 115 acpi_status status;
132
133
134 ACPI_FUNCTION_TRACE ("ev_install_xrupt_handlers");
135 116
117 ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
136 118
137 /* Install the SCI handler */ 119 /* Install the SCI handler */
138 120
139 status = acpi_ev_install_sci_handler (); 121 status = acpi_ev_install_sci_handler();
140 if (ACPI_FAILURE (status)) { 122 if (ACPI_FAILURE(status)) {
141 ACPI_REPORT_ERROR (( 123 ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
142 "Unable to install System Control Interrupt Handler, %s\n", 124 return_ACPI_STATUS(status);
143 acpi_format_exception (status)));
144 return_ACPI_STATUS (status);
145 } 125 }
146 126
147 /* Install the handler for the Global Lock */ 127 /* Install the handler for the Global Lock */
148 128
149 status = acpi_ev_init_global_lock_handler (); 129 status = acpi_ev_init_global_lock_handler();
150 if (ACPI_FAILURE (status)) { 130 if (ACPI_FAILURE(status)) {
151 ACPI_REPORT_ERROR (( 131 ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
152 "Unable to initialize Global Lock handler, %s\n", 132 return_ACPI_STATUS(status);
153 acpi_format_exception (status)));
154 return_ACPI_STATUS (status);
155 } 133 }
156 134
157 acpi_gbl_events_initialized = TRUE; 135 acpi_gbl_events_initialized = TRUE;
158 return_ACPI_STATUS (status); 136 return_ACPI_STATUS(status);
159} 137}
160 138
161
162/******************************************************************************* 139/*******************************************************************************
163 * 140 *
164 * FUNCTION: acpi_ev_fixed_event_initialize 141 * FUNCTION: acpi_ev_fixed_event_initialize
@@ -171,13 +148,10 @@ acpi_ev_install_xrupt_handlers (
171 * 148 *
172 ******************************************************************************/ 149 ******************************************************************************/
173 150
174static acpi_status 151static acpi_status acpi_ev_fixed_event_initialize(void)
175acpi_ev_fixed_event_initialize (
176 void)
177{ 152{
178 acpi_native_uint i; 153 acpi_native_uint i;
179 acpi_status status; 154 acpi_status status;
180
181 155
182 /* 156 /*
183 * Initialize the structure that keeps track of fixed event handlers 157 * Initialize the structure that keeps track of fixed event handlers
@@ -190,10 +164,11 @@ acpi_ev_fixed_event_initialize (
190 /* Enable the fixed event */ 164 /* Enable the fixed event */
191 165
192 if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { 166 if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
193 status = acpi_set_register ( 167 status =
194 acpi_gbl_fixed_event_info[i].enable_register_id, 168 acpi_set_register(acpi_gbl_fixed_event_info[i].
195 0, ACPI_MTX_LOCK); 169 enable_register_id, 0,
196 if (ACPI_FAILURE (status)) { 170 ACPI_MTX_LOCK);
171 if (ACPI_FAILURE(status)) {
197 return (status); 172 return (status);
198 } 173 }
199 } 174 }
@@ -202,7 +177,6 @@ acpi_ev_fixed_event_initialize (
202 return (AE_OK); 177 return (AE_OK);
203} 178}
204 179
205
206/******************************************************************************* 180/*******************************************************************************
207 * 181 *
208 * FUNCTION: acpi_ev_fixed_event_detect 182 * FUNCTION: acpi_ev_fixed_event_detect
@@ -215,31 +189,27 @@ acpi_ev_fixed_event_initialize (
215 * 189 *
216 ******************************************************************************/ 190 ******************************************************************************/
217 191
218u32 192u32 acpi_ev_fixed_event_detect(void)
219acpi_ev_fixed_event_detect (
220 void)
221{ 193{
222 u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; 194 u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
223 u32 fixed_status; 195 u32 fixed_status;
224 u32 fixed_enable; 196 u32 fixed_enable;
225 acpi_native_uint i; 197 acpi_native_uint i;
226
227
228 ACPI_FUNCTION_NAME ("ev_fixed_event_detect");
229 198
199 ACPI_FUNCTION_NAME("ev_fixed_event_detect");
230 200
231 /* 201 /*
232 * Read the fixed feature status and enable registers, as all the cases 202 * Read the fixed feature status and enable registers, as all the cases
233 * depend on their values. Ignore errors here. 203 * depend on their values. Ignore errors here.
234 */ 204 */
235 (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, 205 (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
236 &fixed_status); 206 ACPI_REGISTER_PM1_STATUS, &fixed_status);
237 (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, 207 (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
238 &fixed_enable); 208 ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
239 209
240 ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, 210 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
241 "Fixed Event Block: Enable %08X Status %08X\n", 211 "Fixed Event Block: Enable %08X Status %08X\n",
242 fixed_enable, fixed_status)); 212 fixed_enable, fixed_status));
243 213
244 /* 214 /*
245 * Check for all possible Fixed Events and dispatch those that are active 215 * Check for all possible Fixed Events and dispatch those that are active
@@ -247,18 +217,19 @@ acpi_ev_fixed_event_detect (
247 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { 217 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
248 /* Both the status and enable bits must be on for this event */ 218 /* Both the status and enable bits must be on for this event */
249 219
250 if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) && 220 if ((fixed_status & acpi_gbl_fixed_event_info[i].
251 (fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) { 221 status_bit_mask)
222 && (fixed_enable & acpi_gbl_fixed_event_info[i].
223 enable_bit_mask)) {
252 /* Found an active (signalled) event */ 224 /* Found an active (signalled) event */
253 225
254 int_status |= acpi_ev_fixed_event_dispatch ((u32) i); 226 int_status |= acpi_ev_fixed_event_dispatch((u32) i);
255 } 227 }
256 } 228 }
257 229
258 return (int_status); 230 return (int_status);
259} 231}
260 232
261
262/******************************************************************************* 233/*******************************************************************************
263 * 234 *
264 * FUNCTION: acpi_ev_fixed_event_dispatch 235 * FUNCTION: acpi_ev_fixed_event_dispatch
@@ -272,39 +243,32 @@ acpi_ev_fixed_event_detect (
272 * 243 *
273 ******************************************************************************/ 244 ******************************************************************************/
274 245
275static u32 246static u32 acpi_ev_fixed_event_dispatch(u32 event)
276acpi_ev_fixed_event_dispatch (
277 u32 event)
278{ 247{
279 248
280 249 ACPI_FUNCTION_ENTRY();
281 ACPI_FUNCTION_ENTRY ();
282
283 250
284 /* Clear the status bit */ 251 /* Clear the status bit */
285 252
286 (void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id, 253 (void)acpi_set_register(acpi_gbl_fixed_event_info[event].
287 1, ACPI_MTX_DO_NOT_LOCK); 254 status_register_id, 1, ACPI_MTX_DO_NOT_LOCK);
288 255
289 /* 256 /*
290 * Make sure we've got a handler. If not, report an error. 257 * Make sure we've got a handler. If not, report an error.
291 * The event is disabled to prevent further interrupts. 258 * The event is disabled to prevent further interrupts.
292 */ 259 */
293 if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { 260 if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
294 (void) acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, 261 (void)acpi_set_register(acpi_gbl_fixed_event_info[event].
295 0, ACPI_MTX_DO_NOT_LOCK); 262 enable_register_id, 0,
263 ACPI_MTX_DO_NOT_LOCK);
296 264
297 ACPI_REPORT_ERROR ( 265 ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
298 ("No installed handler for fixed event [%08X]\n",
299 event));
300 266
301 return (ACPI_INTERRUPT_NOT_HANDLED); 267 return (ACPI_INTERRUPT_NOT_HANDLED);
302 } 268 }
303 269
304 /* Invoke the Fixed Event handler */ 270 /* Invoke the Fixed Event handler */
305 271
306 return ((acpi_gbl_fixed_event_handlers[event].handler)( 272 return ((acpi_gbl_fixed_event_handlers[event].
307 acpi_gbl_fixed_event_handlers[event].context)); 273 handler) (acpi_gbl_fixed_event_handlers[event].context));
308} 274}
309
310