summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2006-11-11 19:26:02 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2006-11-11 19:26:02 +0000
commitc72402b6302f9fca0c7c63acd08c8cb260f9f262 (patch)
tree6f173504cc040463f42af899b1a5a0e1d5923543 /sys
parentd52b2f405707187af91cf4a15c7a0f4ad675e292 (diff)
Add acpi_sleep and acpi_stall functions.
ok jordan
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/dsdt.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index cb3797d4951..96e1c2fa652 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.62 2006/10/31 13:49:44 thib Exp $ */
+/* $OpenBSD: dsdt.c,v 1.63 2006/11/11 19:26:01 marco Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -103,6 +103,8 @@ struct aml_opcode *aml_findopcode(int);
void *_acpi_os_malloc(size_t, const char *, int);
void _acpi_os_free(void *, const char *, int);
+void acpi_sleep(int);
+void acpi_stall(int);
struct aml_value *aml_evalmethod(struct aml_scope *,struct aml_node *, int, struct aml_value *, struct aml_value *);
@@ -407,6 +409,24 @@ _acpi_os_free(void *ptr, const char *fn, int line)
}
}
+void
+acpi_sleep(int ms)
+{
+ extern int hz;
+
+ if (cold)
+ delay(ms * 1000);
+ else
+ while (tsleep(dsdt_softc, PWAIT, "asleep", ms / hz) !=
+ EWOULDBLOCK);
+}
+
+void
+acpi_stall(int us)
+{
+ delay(us);
+}
+
/*
* @@@: Misc utility functions
*/
@@ -2584,6 +2604,7 @@ aml_parsemisc2(struct aml_scope *scope, int opcode, struct aml_value *res)
int i1, i2, i3;
AML_CHECKSTACK();
+
switch (opcode) {
case AMLOP_NOTIFY:
/* Assert: tmparg is nameref or objref */
@@ -2600,11 +2621,21 @@ aml_parsemisc2(struct aml_scope *scope, int opcode, struct aml_value *res)
break;
case AMLOP_SLEEP:
i1 = aml_parseint(scope, AML_ANYINT);
- dnprintf(10,"SLEEP: %x\n", i1);
+ dnprintf(50,"SLEEP: %x\n", i1);
+ if (i1)
+ acpi_sleep(i1);
+ else {
+ dnprintf(10, "acpi_sleep(0)\n");
+ }
break;
case AMLOP_STALL:
i1 = aml_parseint(scope, AML_ANYINT);
- dnprintf(10,"STALL: %x\n", i1);
+ dnprintf(50,"STALL: %x\n", i1);
+ if (i1)
+ acpi_stall(i1);
+ else {
+ dnprintf(10, "acpi_stall(0)\n");
+ }
break;
case AMLOP_FATAL:
i1 = aml_parseint(scope, AMLOP_BYTEPREFIX);