Lines 6-12
Link Here
|
6 |
* Copyright (C) 2000 - 2019, Intel Corp. |
6 |
* Copyright (C) 2000 - 2019, Intel Corp. |
7 |
* |
7 |
* |
8 |
*****************************************************************************/ |
8 |
*****************************************************************************/ |
9 |
|
9 |
#include <linux/moduleparam.h> |
10 |
#include <acpi/acpi.h> |
10 |
#include <acpi/acpi.h> |
11 |
#include "accommon.h" |
11 |
#include "accommon.h" |
12 |
#include "acevents.h" |
12 |
#include "acevents.h" |
Lines 166-178
static u32 acpi_ev_global_lock_handler(void *context)
Link Here
|
166 |
* the global lock appear as a standard mutex on the OS side. |
166 |
* the global lock appear as a standard mutex on the OS side. |
167 |
* |
167 |
* |
168 |
*****************************************************************************/ |
168 |
*****************************************************************************/ |
169 |
|
169 |
static unsigned long lktry,lksuccess,lkfail,lkpending; |
170 |
acpi_status acpi_ev_acquire_global_lock(u16 timeout) |
170 |
acpi_status acpi_ev_acquire_global_lock(u16 timeout) |
171 |
{ |
171 |
{ |
172 |
acpi_cpu_flags flags; |
172 |
acpi_cpu_flags flags; |
173 |
acpi_status status; |
173 |
acpi_status status; |
174 |
u8 acquired = FALSE; |
174 |
u8 acquired = FALSE; |
175 |
|
175 |
unsigned long lkspin=0; |
176 |
ACPI_FUNCTION_TRACE(ev_acquire_global_lock); |
176 |
ACPI_FUNCTION_TRACE(ev_acquire_global_lock); |
177 |
|
177 |
|
178 |
/* |
178 |
/* |
Lines 209-215
acpi_status acpi_ev_acquire_global_lock(u16 timeout)
Link Here
|
209 |
} |
209 |
} |
210 |
|
210 |
|
211 |
flags = acpi_os_acquire_lock(acpi_gbl_global_lock_pending_lock); |
211 |
flags = acpi_os_acquire_lock(acpi_gbl_global_lock_pending_lock); |
212 |
|
212 |
ACPI_ERROR((AE_INFO,"the %zu'th grab\n", ++lktry)); |
213 |
do { |
213 |
do { |
214 |
|
214 |
|
215 |
/* Attempt to acquire the actual hardware lock */ |
215 |
/* Attempt to acquire the actual hardware lock */ |
Lines 219-225
acpi_status acpi_ev_acquire_global_lock(u16 timeout)
Link Here
|
219 |
acpi_gbl_global_lock_acquired = TRUE; |
219 |
acpi_gbl_global_lock_acquired = TRUE; |
220 |
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
220 |
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
221 |
"Acquired hardware Global Lock\n")); |
221 |
"Acquired hardware Global Lock\n")); |
222 |
break; |
222 |
++lksuccess;break; |
223 |
} |
223 |
} |
224 |
|
224 |
|
225 |
/* |
225 |
/* |
Lines 239-246
acpi_status acpi_ev_acquire_global_lock(u16 timeout)
Link Here
|
239 |
*/ |
239 |
*/ |
240 |
status = |
240 |
status = |
241 |
acpi_ex_system_wait_semaphore |
241 |
acpi_ex_system_wait_semaphore |
242 |
(acpi_gbl_global_lock_semaphore, ACPI_WAIT_FOREVER); |
242 |
(acpi_gbl_global_lock_semaphore, 44); |
243 |
|
243 |
if(status==AE_TIME){status=AE_OK;ACPI_ERROR((AE_INFO,"..sema not posted after %zux44ms",++lkspin));if(lkspin>=2){acpi_gbl_global_lock_acquired=1;++lkfail;++lkpending;break;}} |
244 |
flags = acpi_os_acquire_lock(acpi_gbl_global_lock_pending_lock); |
244 |
flags = acpi_os_acquire_lock(acpi_gbl_global_lock_pending_lock); |
245 |
|
245 |
|
246 |
} while (ACPI_SUCCESS(status)); |
246 |
} while (ACPI_SUCCESS(status)); |
Lines 281-287
acpi_status acpi_ev_release_global_lock(void)
Link Here
|
281 |
if (acpi_gbl_global_lock_present) { |
281 |
if (acpi_gbl_global_lock_present) { |
282 |
|
282 |
|
283 |
/* Allow any thread to release the lock */ |
283 |
/* Allow any thread to release the lock */ |
284 |
|
284 |
if(lkpending==0){ |
285 |
ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending); |
285 |
ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending); |
286 |
|
286 |
|
287 |
/* |
287 |
/* |
Lines 294-300
acpi_status acpi_ev_release_global_lock(void)
Link Here
|
294 |
(ACPI_BITREG_GLOBAL_LOCK_RELEASE, |
294 |
(ACPI_BITREG_GLOBAL_LOCK_RELEASE, |
295 |
ACPI_ENABLE_EVENT); |
295 |
ACPI_ENABLE_EVENT); |
296 |
} |
296 |
} |
297 |
|
297 |
}else{--lkpending;status=AE_OK;} |
298 |
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
298 |
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
299 |
"Released hardware Global Lock\n")); |
299 |
"Released hardware Global Lock\n")); |
300 |
} |
300 |
} |
Lines 306-310
acpi_status acpi_ev_release_global_lock(void)
Link Here
|
306 |
acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); |
306 |
acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); |
307 |
return_ACPI_STATUS(status); |
307 |
return_ACPI_STATUS(status); |
308 |
} |
308 |
} |
309 |
|
309 |
module_param(lktry,ulong,0444);module_param(lkfail,ulong,0444);module_param(lksuccess,ulong,0444); |
310 |
#endif /* !ACPI_REDUCED_HARDWARE */ |
310 |
#endif /* !ACPI_REDUCED_HARDWARE */ |