summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/Osd
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-10-16 17:25:29 +0000
committerjhb <jhb@FreeBSD.org>2002-10-16 17:25:29 +0000
commite2a2be0fbb0a3692eee6a66d60238ea61855296e (patch)
tree134ade69b6afe5ed6f955012d5f509850f2a2221 /sys/dev/acpica/Osd
parentbce0ae714fff33dd5d520ee56763e0bf87baba6d (diff)
downloadFreeBSD-src-e2a2be0fbb0a3692eee6a66d60238ea61855296e.zip
FreeBSD-src-e2a2be0fbb0a3692eee6a66d60238ea61855296e.tar.gz
- In AcpiOsGetThreadId(), allow for curproc to be NULL on 4-stable systems.
In that case use proc0's pid to return the thread ID. - For 4-stable, use the generic swi taskqueue for ACPI events rather than implementing our own. Sponsored by: The Weather Channel
Diffstat (limited to 'sys/dev/acpica/Osd')
-rw-r--r--sys/dev/acpica/Osd/OsdSchedule.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index f402a02..8289c5d 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -40,9 +40,7 @@
#include <sys/interrupt.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
-#include <sys/lock.h>
#include <sys/malloc.h>
-#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/taskqueue.h>
#include <machine/clock.h>
@@ -74,6 +72,7 @@ struct acpi_task_queue {
struct acpi_task *at;
};
+#if __FreeBSD_version >= 500000
/*
* Private task queue definition for ACPI
*/
@@ -157,6 +156,7 @@ acpi_task_thread_init(void)
return (err);
}
#endif
+#endif
ACPI_STATUS
AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void *Context)
@@ -195,7 +195,11 @@ AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void *
}
TASK_INIT(&at->at_task, pri, AcpiOsExecuteQueue, at);
+#if __FreeBSD_version < 500000
+ taskqueue_enqueue(taskqueue_swi, (struct task *)at);
+#else
taskqueue_enqueue(taskqueue_acpi, (struct task *)at);
+#endif
return_ACPI_STATUS(AE_OK);
}
@@ -269,8 +273,14 @@ AcpiOsStall (UINT32 Microseconds)
UINT32
AcpiOsGetThreadId (void)
{
+ struct proc *p;
/* XXX do not add FUNCTION_TRACE here, results in recursive call */
- KASSERT(curproc != NULL, ("%s: curproc is NULL!", __func__));
- return(curproc->p_pid + 1); /* can't return 0 */
+ p = curproc;
+#if __FreeBSD_version < 500000
+ if (p == NULL)
+ p = &proc0;
+#endif
+ KASSERT(p != NULL, ("%s: curproc is NULL!", __func__));
+ return(p->p_pid + 1); /* can't return 0 */
}
OpenPOWER on IntegriCloud