summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2003-10-02 05:09:37 +0000
committernjl <njl@FreeBSD.org>2003-10-02 05:09:37 +0000
commita787da5c6b11d1eeb7f85c8f766715eb5651543b (patch)
treec9b84c8776b9affc9da040ac432221cf621473d5 /sys/dev/acpica
parentccbdb269fd6aaa14984f9f6aa816fdc21d381d93 (diff)
downloadFreeBSD-src-a787da5c6b11d1eeb7f85c8f766715eb5651543b.zip
FreeBSD-src-a787da5c6b11d1eeb7f85c8f766715eb5651543b.tar.gz
If requested to Sleep for less than our hz granularity (e.g., 10 ms),
use DELAY instead of tsleep. Submitted by: peter
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/Osd/OsdSchedule.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index ac29c1e..4ba1dee 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -243,7 +243,7 @@ AcpiOsExecuteQueue(void *arg, int pending)
* make do with that.
*/
void
-AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds)
+AcpiOsSleep(UINT32 Seconds, UINT32 Milliseconds)
{
int timo;
static int dummy;
@@ -251,14 +251,21 @@ AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
timo = (Seconds * hz) + Milliseconds * hz / 1000;
- if (timo == 0)
- timo = 1;
- tsleep(&dummy, 0, "acpislp", timo);
+
+ /*
+ * If requested sleep time is less than our hz resolution, use
+ * DELAY instead for better granularity.
+ */
+ if (timo > 0)
+ tsleep(&dummy, 0, "acpislp", timo);
+ else
+ DELAY(Milliseconds * 1000);
+
return_VOID;
}
void
-AcpiOsStall (UINT32 Microseconds)
+AcpiOsStall(UINT32 Microseconds)
{
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -267,7 +274,7 @@ AcpiOsStall (UINT32 Microseconds)
}
UINT32
-AcpiOsGetThreadId (void)
+AcpiOsGetThreadId(void)
{
struct proc *p;
/* XXX do not add FUNCTION_TRACE here, results in recursive call */
OpenPOWER on IntegriCloud