diff options
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r-- | sys/dev/acpica/Osd/OsdBusMgr.c | 44 | ||||
-rw-r--r-- | sys/dev/acpica/Osd/OsdInterrupt.c | 27 | ||||
-rw-r--r-- | sys/dev/acpica/Osd/OsdSchedule.c | 22 |
3 files changed, 67 insertions, 26 deletions
diff --git a/sys/dev/acpica/Osd/OsdBusMgr.c b/sys/dev/acpica/Osd/OsdBusMgr.c index b97c2f9..3d8e125 100644 --- a/sys/dev/acpica/Osd/OsdBusMgr.c +++ b/sys/dev/acpica/Osd/OsdBusMgr.c @@ -37,6 +37,9 @@ #include <sys/eventhandler.h> #include <sys/reboot.h> +#define _COMPONENT OS_DEPENDENT +MODULE_NAME("BUSMGR") + struct osd_eventhandle { eventhandler_tag tag; OSD_IDLE_HANDLER Function; @@ -53,7 +56,10 @@ osd_idlehandler(void *arg, int junk) { struct osd_eventhandle *oh = (struct osd_eventhandle *)arg; + FUNCTION_TRACE(__FUNCTION__); + oh->Function(oh->Context); + return_VOID(); } static void @@ -61,7 +67,10 @@ osd_shutdownhandler(void *arg, int howto) { struct osd_eventhandle *oh = (struct osd_eventhandle *)arg; + FUNCTION_TRACE(__FUNCTION__); + oh->Function(oh->Context); + return_VOID(); } ACPI_STATUS @@ -69,18 +78,20 @@ AcpiOsInstallIdleHandler(OSD_IDLE_HANDLER Function, void *Context) { int i; + FUNCTION_TRACE(__FUNCTION__); + if (Function == NULL) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); for (i = 0; i < NUM_IDLEHANDLERS; i++) { if (idlehandlers[i].Function == NULL) { idlehandlers[i].Function = Function; idlehandlers[i].Context = Context; idlehandlers[i].tag = EVENTHANDLER_FAST_REGISTER(idle_event, osd_idlehandler, &idlehandlers[i], IDLE_PRI_FIRST); - return(AE_OK); + return_ACPI_STATUS(AE_OK); } } - return(AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } ACPI_STATUS @@ -88,16 +99,18 @@ AcpiOsRemoveIdleHandler(OSD_IDLE_HANDLER Function) { int i; + FUNCTION_TRACE(__FUNCTION__); + if (Function == NULL) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); for (i = 0; i < NUM_IDLEHANDLERS; i++) { if (idlehandlers[i].Function == Function) { EVENTHANDLER_FAST_DEREGISTER(idle_event, idlehandlers[i].tag); idlehandlers[i].Function = NULL; - return(AE_OK); + return_ACPI_STATUS(AE_OK); } } - return(AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } /* @@ -109,18 +122,20 @@ AcpiOsInstallShutdownHandler(OSD_SHUTDOWN_HANDLER Function, void *Context) { int i; + FUNCTION_TRACE(__FUNCTION__); + if (Function == NULL) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); for (i = 0; i < NUM_SHUTDOWNHANDLERS; i++) { if (shutdownhandlers[i].Function == NULL) { shutdownhandlers[i].Function = Function; shutdownhandlers[i].Context = Context; shutdownhandlers[i].tag = EVENTHANDLER_REGISTER(shutdown_final, osd_shutdownhandler, &shutdownhandlers[i], SHUTDOWN_PRI_LAST); - return(AE_OK); + return_ACPI_STATUS(AE_OK); } } - return(AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } ACPI_STATUS @@ -128,20 +143,25 @@ AcpiOsRemoveShutdownHandler(OSD_SHUTDOWN_HANDLER Function) { int i; + FUNCTION_TRACE(__FUNCTION__); + if (Function == NULL) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); for (i = 0; i < NUM_SHUTDOWNHANDLERS; i++) { if (shutdownhandlers[i].Function == Function) { EVENTHANDLER_DEREGISTER(shutdown_final, shutdownhandlers[i].tag); shutdownhandlers[i].Function = NULL; - return(AE_OK); + return_ACPI_STATUS(AE_OK); } } - return(AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } ACPI_STATUS AcpiOsShutdown (void) { + FUNCTION_TRACE(__FUNCTION__); + shutdown_nice(0); + return_VOID(); } diff --git a/sys/dev/acpica/Osd/OsdInterrupt.c b/sys/dev/acpica/Osd/OsdInterrupt.c index 9b6f8cc..f7eefab 100644 --- a/sys/dev/acpica/Osd/OsdInterrupt.c +++ b/sys/dev/acpica/Osd/OsdInterrupt.c @@ -40,6 +40,9 @@ #include <dev/acpica/acpivar.h> +#define _COMPONENT OS_DEPENDENT +MODULE_NAME("INTERRUPT") + /* * XXX this does not correctly free resources in the case of partically successful * attachment. @@ -49,10 +52,12 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine { struct acpi_softc *sc; + FUNCTION_TRACE(__FUNCTION__); + if ((InterruptNumber < 0) || (InterruptNumber > 255)) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); if (ServiceRoutine == NULL) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); if ((sc = devclass_get_softc(acpi_devclass, 0)) == NULL) panic("can't find ACPI device to register interrupt"); @@ -65,22 +70,22 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine */ if (sc->acpi_irq != NULL) { device_printf(sc->acpi_dev, "attempt to register more than one interrupt handler\n"); - return(AE_EXIST); + return_ACPI_STATUS(AE_EXIST); } sc->acpi_irq_rid = 0; bus_set_resource(sc->acpi_dev, SYS_RES_IRQ, 0, InterruptNumber, 1); if ((sc->acpi_irq = bus_alloc_resource(sc->acpi_dev, SYS_RES_IRQ, &sc->acpi_irq_rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { device_printf(sc->acpi_dev, "could not allocate SCI interrupt\n"); - return(AE_EXIST); + return_ACPI_STATUS(AE_EXIST); } if (bus_setup_intr(sc->acpi_dev, sc->acpi_irq, INTR_TYPE_MISC, (driver_intr_t *)ServiceRoutine, Context, &sc->acpi_irq_handle)) { device_printf(sc->acpi_dev, "could not set up SCI interrupt\n"); - return(AE_EXIST); + return_ACPI_STATUS(AE_EXIST); } - return(AE_OK); + return_ACPI_STATUS(AE_OK); } ACPI_STATUS @@ -88,16 +93,18 @@ AcpiOsRemoveInterruptHandler (UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine { struct acpi_softc *sc; + FUNCTION_TRACE(__FUNCTION__); + if ((InterruptNumber < 0) || (InterruptNumber > 255)) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); if (ServiceRoutine == NULL) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); if ((sc = devclass_get_softc(acpi_devclass, 0)) == NULL) panic("can't find ACPI device to deregister interrupt"); if (sc->acpi_irq == NULL) - return(AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); bus_teardown_intr(sc->acpi_dev, sc->acpi_irq, sc->acpi_irq_handle); bus_release_resource(sc->acpi_dev, SYS_RES_IRQ, 0, sc->acpi_irq); @@ -105,6 +112,6 @@ AcpiOsRemoveInterruptHandler (UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine sc->acpi_irq = NULL; - return(AE_OK); + return_ACPI_STATUS(AE_OK); } diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c index 02d0997..65b03a0 100644 --- a/sys/dev/acpica/Osd/OsdSchedule.c +++ b/sys/dev/acpica/Osd/OsdSchedule.c @@ -38,6 +38,9 @@ #include <sys/taskqueue.h> #include <machine/clock.h> +#define _COMPONENT OS_DEPENDENT +MODULE_NAME("SCHEDULE") + /* * This is a little complicated due to the fact that we need to build and then * free a 'struct task' for each task we enqueue. @@ -61,12 +64,14 @@ AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void * { struct acpi_task *at; + FUNCTION_TRACE(__FUNCTION__); + if (Function == NULL) - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); at = malloc(sizeof(*at), M_ACPITASK, M_NOWAIT); /* Interrupt Context */ if (at == NULL) - return(AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); bzero(at, sizeof(*at)); at->at_function = Function; @@ -88,11 +93,11 @@ AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void * break; default: free(at, M_ACPITASK); - return(AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } taskqueue_enqueue(taskqueue_swi, (struct task *)at); - return(AE_OK); + return_ACPI_STATUS(AE_OK); } static void @@ -102,12 +107,15 @@ AcpiOsExecuteQueue(void *arg, int pending) OSD_EXECUTION_CALLBACK Function; void *Context; + FUNCTION_TRACE(__FUNCTION__); + Function = (OSD_EXECUTION_CALLBACK)at->at_function; Context = at->at_context; free(at, M_ACPITASK); Function(Context); + return_VOID; } /* @@ -119,18 +127,24 @@ AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds) { int timo; + FUNCTION_TRACE(__FUNCTION__); + timo = (Seconds * hz) + Milliseconds / (1000 * hz); if (timo == 0) timo = 1; tsleep(NULL, 0, "acpislp", timo); + return_VOID; } void AcpiOsSleepUsec (UINT32 Microseconds) { + FUNCTION_TRACE(__FUNCTION__); + if (Microseconds > 1000) { /* long enough to be worth the overhead of sleeping */ AcpiOsSleep(0, Microseconds / 1000); } else { DELAY(Microseconds); } + return_VOID; } |