1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * SUCH DAMAGE. 26 */ 27 28/* 29 * 6.1 : Mutual Exclusion and Synchronisation 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/acpica/Osd/OsdSynch.c 167814 2007-03-22 18:16:43Z jkim $"); |
34 35#include <contrib/dev/acpica/acpi.h> 36 37#include "opt_acpi.h" 38#include <sys/kernel.h> 39#include <sys/malloc.h> 40#include <sys/sysctl.h> 41#include <sys/lock.h> --- 15 unchanged lines hidden (view full) --- 57 struct mtx as_mtx; 58 UINT32 as_units; 59 UINT32 as_maxunits; 60 UINT32 as_pendings; 61 UINT32 as_resetting; 62 UINT32 as_timeouts; 63}; 64 |
65/* Default number of maximum pending threads. */ |
66#ifndef ACPI_NO_SEMAPHORES 67#ifndef ACPI_SEMAPHORES_MAX_PENDING 68#define ACPI_SEMAPHORES_MAX_PENDING 4 69#endif |
70 |
71static int acpi_semaphore_debug = 0; 72TUNABLE_INT("debug.acpi_semaphore_debug", &acpi_semaphore_debug); 73SYSCTL_DECL(_debug_acpi); 74SYSCTL_INT(_debug_acpi, OID_AUTO, semaphore_debug, CTLFLAG_RW, 75 &acpi_semaphore_debug, 0, "Enable ACPI semaphore debug messages"); 76#endif /* !ACPI_NO_SEMAPHORES */ 77 78ACPI_STATUS --- 113 unchanged lines hidden (view full) --- 192 break; 193 } 194 if (as->as_units >= Units) { 195 as->as_units -= Units; 196 result = AE_OK; 197 break; 198 } 199 |
200 /* limit number of pending threads */ |
201 if (as->as_pendings >= ACPI_SEMAPHORES_MAX_PENDING) { 202 result = AE_TIME; 203 break; 204 } 205 206 /* if timeout values of zero is specified, return immediately */ 207 if (Timeout == 0) { 208 result = AE_TIME; --- 211 unchanged lines hidden --- |