diff options
author | msmith <msmith@FreeBSD.org> | 2001-05-29 20:13:42 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-05-29 20:13:42 +0000 |
commit | 7996f19f432a6f4cf9a62d6121b95f412a9828bb (patch) | |
tree | 3b22869e0df2f024daec841766dd27368c33ca28 /sys/dev/acpica/Osd | |
parent | cc0ed18a81964224f46b56f81af2bc62de049ae3 (diff) | |
download | FreeBSD-src-7996f19f432a6f4cf9a62d6121b95f412a9828bb.zip FreeBSD-src-7996f19f432a6f4cf9a62d6121b95f412a9828bb.tar.gz |
- Updates for new constant naming in the ACPI CA 20010518 update.
- Use __func__ instead of __FUNCTION.
- Support power-off to S3 or S5 (takawata)
- Enable ACPI debugging earlier (with a sysinit)
- Fix a deadlock in the EC code (takawata)
- Improve arithmetic and reduce the risk of spurious wakeup in
AcpiOsSleep.
- Add AcpiOsGetThreadId.
- Simplify mutex code (still disabled).
Diffstat (limited to 'sys/dev/acpica/Osd')
-rw-r--r-- | sys/dev/acpica/Osd/OsdBusMgr.c | 16 | ||||
-rw-r--r-- | sys/dev/acpica/Osd/OsdInterrupt.c | 6 | ||||
-rw-r--r-- | sys/dev/acpica/Osd/OsdSchedule.c | 24 | ||||
-rw-r--r-- | sys/dev/acpica/Osd/OsdSynch.c | 22 |
4 files changed, 35 insertions, 33 deletions
diff --git a/sys/dev/acpica/Osd/OsdBusMgr.c b/sys/dev/acpica/Osd/OsdBusMgr.c index 3d8e125..0ffdef3 100644 --- a/sys/dev/acpica/Osd/OsdBusMgr.c +++ b/sys/dev/acpica/Osd/OsdBusMgr.c @@ -37,7 +37,7 @@ #include <sys/eventhandler.h> #include <sys/reboot.h> -#define _COMPONENT OS_DEPENDENT +#define _COMPONENT ACPI_OS_SERVICES MODULE_NAME("BUSMGR") struct osd_eventhandle { @@ -56,7 +56,7 @@ osd_idlehandler(void *arg, int junk) { struct osd_eventhandle *oh = (struct osd_eventhandle *)arg; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); oh->Function(oh->Context); return_VOID(); @@ -67,7 +67,7 @@ osd_shutdownhandler(void *arg, int howto) { struct osd_eventhandle *oh = (struct osd_eventhandle *)arg; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); oh->Function(oh->Context); return_VOID(); @@ -78,7 +78,7 @@ AcpiOsInstallIdleHandler(OSD_IDLE_HANDLER Function, void *Context) { int i; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (Function == NULL) return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -99,7 +99,7 @@ AcpiOsRemoveIdleHandler(OSD_IDLE_HANDLER Function) { int i; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (Function == NULL) return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -122,7 +122,7 @@ AcpiOsInstallShutdownHandler(OSD_SHUTDOWN_HANDLER Function, void *Context) { int i; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (Function == NULL) return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -143,7 +143,7 @@ AcpiOsRemoveShutdownHandler(OSD_SHUTDOWN_HANDLER Function) { int i; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (Function == NULL) return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -160,7 +160,7 @@ AcpiOsRemoveShutdownHandler(OSD_SHUTDOWN_HANDLER Function) ACPI_STATUS AcpiOsShutdown (void) { - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); shutdown_nice(0); return_VOID(); diff --git a/sys/dev/acpica/Osd/OsdInterrupt.c b/sys/dev/acpica/Osd/OsdInterrupt.c index f7eefab..fd94ad1 100644 --- a/sys/dev/acpica/Osd/OsdInterrupt.c +++ b/sys/dev/acpica/Osd/OsdInterrupt.c @@ -40,7 +40,7 @@ #include <dev/acpica/acpivar.h> -#define _COMPONENT OS_DEPENDENT +#define _COMPONENT ACPI_OS_SERVICES MODULE_NAME("INTERRUPT") /* @@ -52,7 +52,7 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine { struct acpi_softc *sc; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if ((InterruptNumber < 0) || (InterruptNumber > 255)) return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -93,7 +93,7 @@ AcpiOsRemoveInterruptHandler (UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine { struct acpi_softc *sc; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if ((InterruptNumber < 0) || (InterruptNumber > 255)) return_ACPI_STATUS(AE_BAD_PARAMETER); diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c index f838580..6089031 100644 --- a/sys/dev/acpica/Osd/OsdSchedule.c +++ b/sys/dev/acpica/Osd/OsdSchedule.c @@ -38,7 +38,7 @@ #include <sys/taskqueue.h> #include <machine/clock.h> -#define _COMPONENT OS_DEPENDENT +#define _COMPONENT ACPI_OS_SERVICES MODULE_NAME("SCHEDULE") /* @@ -64,7 +64,7 @@ AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void * { struct acpi_task *at; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (Function == NULL) return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -107,7 +107,7 @@ AcpiOsExecuteQueue(void *arg, int pending) OSD_EXECUTION_CALLBACK Function; void *Context; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); Function = (OSD_EXECUTION_CALLBACK)at->at_function; Context = at->at_context; @@ -126,20 +126,21 @@ void AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds) { int timo; + static int dummy; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); - timo = (Seconds * hz) + Milliseconds / (1000 * hz); + timo = (Seconds * hz) + Milliseconds * hz / 1000; if (timo == 0) timo = 1; - tsleep(NULL, PZERO, "acpislp", timo); + tsleep(&dummy, 0, "acpislp", timo); return_VOID; } void AcpiOsSleepUsec (UINT32 Microseconds) { - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (Microseconds > 1000) { /* long enough to be worth the overhead of sleeping */ AcpiOsSleep(0, Microseconds / 1000); @@ -148,3 +149,12 @@ AcpiOsSleepUsec (UINT32 Microseconds) } return_VOID; } + +UINT32 +AcpiOsGetThreadId (void) +{ + /* XXX do not add FUNCTION_TRACE here, results in recursive call */ + + KASSERT(curproc != NULL, (__func__ ": curproc is NULL!")); + return(curproc->p_pid + 1); /* can't return 0 */ +} diff --git a/sys/dev/acpica/Osd/OsdSynch.c b/sys/dev/acpica/Osd/OsdSynch.c index 84773de..85068c0 100644 --- a/sys/dev/acpica/Osd/OsdSynch.c +++ b/sys/dev/acpica/Osd/OsdSynch.c @@ -37,8 +37,9 @@ #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mutex.h> +#include <sys/proc.h> -#define _COMPONENT OS_DEPENDENT +#define _COMPONENT ACPI_OS_SERVICES MODULE_NAME("SYNCH") static MALLOC_DEFINE(M_ACPISEM, "acpisem", "ACPI semaphore"); @@ -54,7 +55,6 @@ struct acpi_semaphore { struct mtx as_mtx; UINT32 as_units; UINT32 as_maxunits; - char *as_name; }; ACPI_STATUS @@ -63,7 +63,7 @@ AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits, ACPI_HANDLE *OutHand #ifndef ACPI_NO_SEMAPHORES struct acpi_semaphore *as; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (OutHandle == NULL) return(AE_BAD_PARAMETER); @@ -76,8 +76,6 @@ AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits, ACPI_HANDLE *OutHand mtx_init(&as->as_mtx, "ACPI semaphore", MTX_DEF); as->as_units = InitialUnits; as->as_maxunits = MaxUnits; - as->as_name = malloc(strlen(name) + 1, M_ACPISEM, M_NOWAIT); - strcpy(as->as_name, name); DEBUG_PRINT(TRACE_MUTEX, ("created semaphore %p max %d, initial %d\n", as, InitialUnits, MaxUnits)); @@ -96,15 +94,10 @@ AcpiOsDeleteSemaphore (ACPI_HANDLE Handle) #ifndef ACPI_NO_SEMAPHORES struct acpi_semaphore *as = (struct acpi_semaphore *)Handle; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); -#ifdef ACPI_TRACK_SEMAPHORE - printf("destroyed semaphore '%s' @ %p\n", as->as_name, as); -#else DEBUG_PRINT(TRACE_MUTEX, ("destroyed semaphore %p\n", as)); -#endif mtx_destroy(&as->as_mtx); - free(as->as_name, M_ACPISEM); free(Handle, M_ACPISEM); return_ACPI_STATUS(AE_OK); #else @@ -125,7 +118,7 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT32 Timeout) ACPI_STATUS result; int rv, tmo; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (as == NULL) return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -135,7 +128,7 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT32 Timeout) tmo = 0; } else { /* compute timeout using microseconds per tick */ - tmo = (Timeout * 1000) / (1000000 / hz) + tmo = (Timeout * 1000) / (1000000 / hz); if (tmo <= 0) tmo = 1; } @@ -155,7 +148,6 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT32 Timeout) } DEBUG_PRINT(TRACE_MUTEX, ("semaphore blocked, calling msleep(%p, %p, %d, \"acpisem\", %d)\n", as, as->as_mtx, 0, tmo)); - for (;;) ; rv = msleep(as, &as->as_mtx, 0, "acpisem", tmo); DEBUG_PRINT(TRACE_MUTEX, ("msleep returned %d\n", rv)); @@ -178,7 +170,7 @@ AcpiOsSignalSemaphore(ACPI_HANDLE Handle, UINT32 Units) #ifndef ACPI_NO_SEMAPHORES struct acpi_semaphore *as = (struct acpi_semaphore *)Handle; - FUNCTION_TRACE(__FUNCTION__); + FUNCTION_TRACE(__func__); if (as == NULL) return_ACPI_STATUS(AE_BAD_PARAMETER); |