From b18b56bdc4d12eddd4b16c9d95cc041af449c130 Mon Sep 17 00:00:00 2001 From: YONETANI Tomokazu Date: Sat, 12 Mar 2005 14:33:40 +0000 Subject: [PATCH] Update ACPI build wrappers to use new ACPICA code. Submitted-by: Craig Dooley Add a small patch for userland ACPI tools by me, to compile osunixxf.c . The absence of working AeLocalGetRootPointer() only affects AcpiOsGetRootPointer() in userland ACPI tools. For kernel module it's implemented in /sys/${ARCH}/acpica5/OsdEnvironment.c . The callers of AcpiOsGetRootPointer() properly check anyway to see if the returned pointer is valid, so making it no-op doesn't make a problem. --- sys/dev/acpica5/Osd/OsdInterrupt.c | 8 +++--- sys/dev/acpica5/Osd/OsdSchedule.c | 35 ++++++++++++++++++--------- sys/dev/acpica5/acpi_acad.c | 4 +-- sys/dev/acpica5/acpi_cmbat.c | 4 +-- sys/dev/acpica5/acpi_thermal.c | 6 ++--- usr.sbin/acpi/acpidb/Makefile | 7 +++++- usr.sbin/acpi/acpidb/osunixxf.c.patch | 16 ++++++++++++ 7 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 usr.sbin/acpi/acpidb/osunixxf.c.patch diff --git a/sys/dev/acpica5/Osd/OsdInterrupt.c b/sys/dev/acpica5/Osd/OsdInterrupt.c index 2d6f1ae430..4c7f313f0e 100644 --- a/sys/dev/acpica5/Osd/OsdInterrupt.c +++ b/sys/dev/acpica5/Osd/OsdInterrupt.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/Osd/OsdInterrupt.c,v 1.17 2004/04/14 03:41:06 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/Osd/OsdInterrupt.c,v 1.2 2004/06/27 08:52:42 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/Osd/OsdInterrupt.c,v 1.3 2005/03/12 14:33:40 y0netan1 Exp $ */ /* @@ -47,12 +47,12 @@ ACPI_MODULE_NAME("INTERRUPT") static void InterruptWrapper(void *arg); -static OSD_HANDLER InterruptHandler; +static ACPI_OSD_HANDLER InterruptHandler; static UINT32 InterruptOverride = 0; ACPI_STATUS AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, - OSD_HANDLER ServiceRoutine, void *Context) + ACPI_OSD_HANDLER ServiceRoutine, void *Context) { struct acpi_softc *sc; @@ -115,7 +115,7 @@ error: } ACPI_STATUS -AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine) +AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine) { struct acpi_softc *sc; diff --git a/sys/dev/acpica5/Osd/OsdSchedule.c b/sys/dev/acpica5/Osd/OsdSchedule.c index a9f2b74adf..1deb9b2dd6 100644 --- a/sys/dev/acpica5/Osd/OsdSchedule.c +++ b/sys/dev/acpica5/Osd/OsdSchedule.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/Osd/OsdSchedule.c,v 1.28 2004/05/06 02:18:58 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/Osd/OsdSchedule.c,v 1.4 2004/08/02 19:51:09 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/Osd/OsdSchedule.c,v 1.5 2005/03/12 14:33:40 y0netan1 Exp $ */ /* @@ -66,7 +66,7 @@ static void acpi_autofree_reply(lwkt_port_t port, lwkt_msg_t msg); struct acpi_task { struct lwkt_msg at_msg; - OSD_EXECUTION_CALLBACK at_function; + ACPI_OSD_EXEC_CALLBACK at_function; void *at_context; int at_priority; }; @@ -93,12 +93,12 @@ acpi_task_thread_init(void) static void acpi_task_thread(void *arg) { - OSD_EXECUTION_CALLBACK func; + ACPI_OSD_EXEC_CALLBACK func; struct acpi_task *at; for (;;) { at = (void *)lwkt_waitport(&curthread->td_msgport, NULL); - func = (OSD_EXECUTION_CALLBACK)at->at_function; + func = (ACPI_OSD_EXEC_CALLBACK)at->at_function; func((void *)at->at_context); lwkt_replymsg(&at->at_msg, 0); } @@ -111,7 +111,7 @@ acpi_task_thread(void *arg) * to automatically free the message. */ ACPI_STATUS -AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, +AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function, void *Context) { struct acpi_task *at; @@ -159,16 +159,27 @@ acpi_autofree_reply(lwkt_port_t port, lwkt_msg_t msg) free(msg, M_ACPITASK); } +UINT64 +AcpiOsGetTimer (void) +{ + struct timeval time; + + microtime(&time); + + /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */ + + return (((UINT64) time.tv_sec * 10000000) + ((UINT64) time.tv_usec * 10)); +} 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, or if @@ -176,13 +187,13 @@ AcpiOsSleep(UINT32 Seconds, UINT32 Milliseconds) * use DELAY instead for better granularity. */ if (clocks_running == 0) { - while (Seconds) { + while (timo > 1000000) { DELAY(1000000); - --Seconds; + timo -= 1000000; } - if (Milliseconds) - DELAY(Milliseconds * 1000); - } else if (timo > 0) { + if (timo) + DELAY(timo * 1000); + } else if (timo > 1000) { tsleep(&dummy, 0, "acpislp", timo); } else { DELAY(Milliseconds * 1000); diff --git a/sys/dev/acpica5/acpi_acad.c b/sys/dev/acpica5/acpi_acad.c index ec833460f9..6e7b31b2af 100644 --- a/sys/dev/acpica5/acpi_acad.c +++ b/sys/dev/acpica5/acpi_acad.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_acad.c,v 1.26 2004/05/30 20:08:23 phk Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_acad.c,v 1.4 2004/08/02 19:51:07 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_acad.c,v 1.5 2005/03/12 14:33:40 y0netan1 Exp $ */ #include "opt_acpi.h" @@ -248,7 +248,7 @@ acpi_acad_init_acline(void *arg) acpi_acad_get_status(dev); if (status != sc->status) break; - AcpiOsSleep(0, 10); + AcpiOsSleep(10); } sc->initializing = 0; diff --git a/sys/dev/acpica5/acpi_cmbat.c b/sys/dev/acpica5/acpi_cmbat.c index adea3c23ca..664dc6e7f8 100644 --- a/sys/dev/acpica5/acpi_cmbat.c +++ b/sys/dev/acpica5/acpi_cmbat.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_cmbat.c,v 1.29 2004/05/30 20:08:23 phk Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_cmbat.c,v 1.5 2004/08/02 19:51:07 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_cmbat.c,v 1.6 2005/03/12 14:33:40 y0netan1 Exp $ */ #include "opt_acpi.h" @@ -583,7 +583,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(0, 10)) { + for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10)) { sc->present = acpi_BatteryIsPresent(dev); if (!sc->present) continue; diff --git a/sys/dev/acpica5/acpi_thermal.c b/sys/dev/acpica5/acpi_thermal.c index 3074eeb2ff..cd43c42078 100644 --- a/sys/dev/acpica5/acpi_thermal.c +++ b/sys/dev/acpica5/acpi_thermal.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.47 2004/05/30 20:08:23 phk Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_thermal.c,v 1.3 2004/07/05 00:07:35 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_thermal.c,v 1.4 2005/03/12 14:33:40 y0netan1 Exp $ */ #include "opt_acpi.h" @@ -690,7 +690,7 @@ acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) case TZ_NOTIFY_LEVELS: /* Zone devices/setpoints changed */ AcpiOsQueueForExecution(OSD_PRIORITY_HIGH, - (OSD_EXECUTION_CALLBACK)acpi_tz_establish, sc); + (ACPI_OSD_EXEC_CALLBACK)acpi_tz_establish, sc); break; default: ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev), @@ -761,7 +761,7 @@ acpi_tz_power_profile(void *arg) } else { /* We have to re-evaluate the entire zone now */ AcpiOsQueueForExecution(OSD_PRIORITY_HIGH, - (OSD_EXECUTION_CALLBACK)acpi_tz_establish, + (ACPI_OSD_EXEC_CALLBACK)acpi_tz_establish, sc); } } diff --git a/usr.sbin/acpi/acpidb/Makefile b/usr.sbin/acpi/acpidb/Makefile index d0cb25eb8a..9cc7f1397b 100644 --- a/usr.sbin/acpi/acpidb/Makefile +++ b/usr.sbin/acpi/acpidb/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/usr.sbin/acpi/acpidb/Makefile,v 1.5 2004/05/25 02:56:55 njl Exp $ -# $DragonFly: src/usr.sbin/acpi/acpidb/Makefile,v 1.1 2004/07/05 00:22:43 dillon Exp $ +# $DragonFly: src/usr.sbin/acpi/acpidb/Makefile,v 1.2 2005/03/12 14:33:40 y0netan1 Exp $ PROG= acpidb SRCS+= acpidb.c @@ -35,6 +35,11 @@ SRCS+= dbcmds.c dbdisply.c dbexec.c dbfileio.c \ uteval.c utglobal.c utinit.c utmath.c \ utmisc.c utobject.c utxface.c +.include +.if ${SYSACPICA_VERSION} >= 20041203 +CONTRIBDIR= ${SYSACPICA_DIR} +SRCS+= osunixxf.c.patch +.endif MAN= acpidb.8 CFLAGS+= -DACPI_APPLICATION -DACPI_DEBUG_OUTPUT -DACPI_DEBUGGER \ diff --git a/usr.sbin/acpi/acpidb/osunixxf.c.patch b/usr.sbin/acpi/acpidb/osunixxf.c.patch new file mode 100644 index 0000000000..e940f6d711 --- /dev/null +++ b/usr.sbin/acpi/acpidb/osunixxf.c.patch @@ -0,0 +1,16 @@ +$DragonFly: src/usr.sbin/acpi/acpidb/osunixxf.c.patch,v 1.1 2005/03/12 14:33:40 y0netan1 Exp $ + +--- osunixxf.c.orig 2005-02-12 08:32:17.000000000 +0900 ++++ osunixxf.c 2005-03-05 20:47:12.000000000 +0900 +@@ -184,8 +184,10 @@ + UINT32 Flags, + ACPI_POINTER *Address) + { +- ++#if 0 ++ /* AeLocalGetRootPointer is not properly implemented yet */ + return (AeLocalGetRootPointer(Flags, Address)); ++#endif + } + + -- 2.41.0