From f8c60df7a631eeb727c4ec3288519dfe00c87292 Mon Sep 17 00:00:00 2001 From: Mark Santcroos Date: Thu, 2 Dec 2004 00:25:35 +0000 Subject: [PATCH] Catch up with AcpiOsSleep() interface change. Catch up with some #define's renaming. Implement AcpiOsGetTimer() as per ACPI 3.0. Approved by: njl MFC after: 1 week --- sys/dev/acpica/Osd/OsdInterrupt.c | 4 ++-- sys/dev/acpica/Osd/OsdSchedule.c | 34 ++++++++++++++++++++++++------- sys/dev/acpica/acpi_acad.c | 2 +- sys/dev/acpica/acpi_cmbat.c | 2 +- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/sys/dev/acpica/Osd/OsdInterrupt.c b/sys/dev/acpica/Osd/OsdInterrupt.c index da57695516a3..1066254f0b02 100644 --- a/sys/dev/acpica/Osd/OsdInterrupt.c +++ b/sys/dev/acpica/Osd/OsdInterrupt.c @@ -48,7 +48,7 @@ static UINT32 InterruptOverride = 0; ACPI_STATUS AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, - OSD_HANDLER ServiceRoutine, void *Context) + ACPI_OSD_HANDLER ServiceRoutine, void *Context) { struct acpi_softc *sc; @@ -105,7 +105,7 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, } ACPI_STATUS -AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine) +AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine) { struct acpi_softc *sc; diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c index 2bb19b05a7ed..265d9d977f2c 100644 --- a/sys/dev/acpica/Osd/OsdSchedule.c +++ b/sys/dev/acpica/Osd/OsdSchedule.c @@ -60,7 +60,7 @@ static void AcpiOsExecuteQueue(void *arg, int pending); struct acpi_task { struct task at_task; - OSD_EXECUTION_CALLBACK at_function; + ACPI_OSD_EXEC_CALLBACK at_function; void *at_context; }; @@ -98,7 +98,7 @@ static void acpi_task_thread(void *arg) { struct acpi_task_queue *atq; - OSD_EXECUTION_CALLBACK Function; + ACPI_OSD_EXEC_CALLBACK Function; void *Context; ACPI_LOCK(taskq); @@ -108,7 +108,7 @@ acpi_task_thread(void *arg) STAILQ_REMOVE_HEAD(&acpi_task_queue, at_q); ACPI_UNLOCK(taskq); - Function = (OSD_EXECUTION_CALLBACK)atq->at->at_function; + Function = (ACPI_OSD_EXEC_CALLBACK)atq->at->at_function; Context = atq->at->at_context; Function(Context); @@ -143,7 +143,7 @@ acpi_task_thread_init(void) /* This function is called in interrupt context. */ ACPI_STATUS -AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, +AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function, void *Context) { struct acpi_task *at; @@ -188,7 +188,7 @@ static void AcpiOsExecuteQueue(void *arg, int pending) { struct acpi_task_queue *atq; - OSD_EXECUTION_CALLBACK Function; + ACPI_OSD_EXEC_CALLBACK Function; void *Context; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -213,14 +213,14 @@ AcpiOsExecuteQueue(void *arg, int pending) } void -AcpiOsSleep(UINT32 Seconds, UINT32 Milliseconds) +AcpiOsSleep(ACPI_INTEGER Milliseconds) { int timo; static int dummy; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - timo = (Seconds * hz) + Milliseconds * hz / 1000; + timo = Milliseconds * hz / 1000; /* * If requested sleep time is less than our hz resolution, use @@ -234,6 +234,26 @@ AcpiOsSleep(UINT32 Seconds, UINT32 Milliseconds) return_VOID; } +/* + * Return the current time in 100 nanosecond units + */ +UINT64 +AcpiOsGetTimer(void) +{ + struct bintime bt; + UINT64 t; + + /* XXX During early boot there is no (decent) timer available yet. */ + if (cold) + panic("acpi: timer op not yet supported during boot"); + + binuptime(&bt); + t = ((UINT64)10000000 * (uint32_t)(bt.frac >> 32)) >> 32; + t += bt.sec * 10000000; + + return (t); +} + void AcpiOsStall(UINT32 Microseconds) { diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c index 8ff6dd01e974..0b9bac35c579 100644 --- a/sys/dev/acpica/acpi_acad.c +++ b/sys/dev/acpica/acpi_acad.c @@ -238,7 +238,7 @@ acpi_acad_init_acline(void *arg) acpi_acad_get_status(dev); if (sc->status != -1) break; - AcpiOsSleep(10, 0); + AcpiOsSleep(10000); } ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c index 6bcd4a056d3d..f48fdc6b08a7 100644 --- a/sys/dev/acpica/acpi_cmbat.c +++ b/sys/dev/acpica/acpi_cmbat.c @@ -587,7 +587,7 @@ acpi_cmbat_init_battery(void *arg) ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), "battery initialization start\n"); - for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10, 0)) { + for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10000)) { sc->present = acpi_BatteryIsPresent(dev); if (!sc->present) continue;