summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2006-02-17 17:36:00 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2006-02-17 17:36:00 +0000
commit9feddf7310b0081ed0217a504a11ae9f3c0b4a4c (patch)
tree73405ec1bb828663137377126329105d066da183
parent91e797ab84bb2ad882731a0c53fd78b2d004dfe7 (diff)
Add a generic delay function as per the ACPI spec.
from jordan@
-rw-r--r--sys/dev/acpi/acpi.c9
-rw-r--r--sys/dev/acpi/acpivar.h3
-rw-r--r--sys/dev/acpi/dsdt.c9
3 files changed, 17 insertions, 4 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index b8354d672da..aadd9d226aa 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.31 2006/02/17 06:57:58 marco Exp $ */
+/* $OpenBSD: acpi.c,v 1.32 2006/02/17 17:35:59 marco Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -98,6 +98,13 @@ int acpi_s5, acpi_evindex, icount;
#define pch(x) (((x)>=' ' && (x)<='z') ? (x) : ' ')
+void
+acpi_delay(struct acpi_softc *sc, int64_t uSecs)
+{
+ /* XXX this needs to become a tsleep later */
+ delay(uSecs);
+}
+
int
acpi_gasio(struct acpi_softc *sc, int iodir, int iospace, uint64_t address,
int access_size, int len, void *buffer)
diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h
index e90419935e9..dc0bb680413 100644
--- a/sys/dev/acpi/acpivar.h
+++ b/sys/dev/acpi/acpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivar.h,v 1.14 2006/02/03 23:55:47 jordan Exp $ */
+/* $OpenBSD: acpivar.h,v 1.15 2006/02/17 17:35:59 marco Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -163,6 +163,7 @@ void acpi_powerdown(void);
#define ACPI_IOREAD 0
#define ACPI_IOWRITE 1
+void acpi_delay(struct acpi_softc *, int64_t);
int acpi_gasio(struct acpi_softc *, int, int, uint64_t, int, int, void *);
#endif
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index 33baa15ce08..73d9320c97c 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.22 2006/02/17 00:46:54 jordan Exp $ */
+/* $OpenBSD: dsdt.c,v 1.23 2006/02/17 17:35:59 marco Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -2054,6 +2054,7 @@ aml_domatch(struct acpi_context *ctx)
return rv;
}
+
/* Parse AMLOP_XXXX
*
* This is the guts of the evaluator
@@ -2312,10 +2313,12 @@ aml_eparseval(struct acpi_context *ctx, int deref)
case AMLOP_STALL:
i1 = aml_eparseint(ctx, AML_ANYINT);
dnprintf(40, "stall %lld usecs\n", i1);
+ acpi_delay(ctx->sc, i1);
break;
case AMLOP_SLEEP:
i1 = aml_eparseint(ctx, AML_ANYINT);
dnprintf(40, "sleep %lld msecs\n", i1);
+ acpi_delay(ctx->sc, i1 * 1000);
break;
case AMLOP_MUTEX:
name = aml_parse_name(ctx);
@@ -2457,7 +2460,9 @@ aml_eparseval(struct acpi_context *ctx, int deref)
break;
case AMLOP_OBJECTTYPE:
lhs = aml_eparseval(ctx, 1);
- rv = aml_allocint(lhs->type);
+ i1 = (lhs->type == AML_OBJTYPE_STATICINT) ?
+ AML_OBJTYPE_INTEGER : lhs->type;
+ rv = aml_allocint(i1);
break;
case AMLOP_SIZEOF:
lhs = aml_eparseval(ctx, 1);