summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-12-14 16:06:36 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-12-14 16:06:36 +0000
commit2c1805e867fb1bf521080a933ba332efe85d5da2 (patch)
tree5998eb376019db998864f4cd265d0e03c457f4e7 /sys
parentefe549445494f023aa3d8b9db72fd4e90954cec6 (diff)
Add wrapper functions to enable/disable interrupts and manipulate their state.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/dev/cbus.c30
-rw-r--r--sys/arch/sparc64/dev/cbusvar.h4
2 files changed, 32 insertions, 2 deletions
diff --git a/sys/arch/sparc64/dev/cbus.c b/sys/arch/sparc64/dev/cbus.c
index 97975a79681..8c44e0b2bc8 100644
--- a/sys/arch/sparc64/dev/cbus.c
+++ b/sys/arch/sparc64/dev/cbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cbus.c,v 1.6 2009/05/10 12:48:24 kettenis Exp $ */
+/* $OpenBSD: cbus.c,v 1.7 2009/12/14 16:06:35 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -135,6 +135,34 @@ cbus_intr_map(int node, int ino, uint64_t *sysino)
return (0);
}
+int
+cbus_intr_setstate(uint64_t sysino, uint64_t state)
+{
+ uint64_t devhandle = INTIGN(sysino);
+ uint64_t devino = INTINO(sysino);
+ int err;
+
+ err = hv_vintr_setstate(devhandle, devino, state);
+ if (err != H_EOK)
+ return (-1);
+
+ return (0);
+}
+
+int
+cbus_intr_setenabled(uint64_t sysino, uint64_t enabled)
+{
+ uint64_t devhandle = INTIGN(sysino);
+ uint64_t devino = INTINO(sysino);
+ int err;
+
+ err = hv_vintr_setenabled(devhandle, devino, enabled);
+ if (err != H_EOK)
+ return (-1);
+
+ return (0);
+}
+
void *
cbus_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle,
int level, int flags, int (*handler)(void *), void *arg, const char *what)
diff --git a/sys/arch/sparc64/dev/cbusvar.h b/sys/arch/sparc64/dev/cbusvar.h
index d222c361b83..67f84ac8d09 100644
--- a/sys/arch/sparc64/dev/cbusvar.h
+++ b/sys/arch/sparc64/dev/cbusvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cbusvar.h,v 1.3 2009/05/10 12:48:24 kettenis Exp $ */
+/* $OpenBSD: cbusvar.h,v 1.4 2009/12/14 16:06:35 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -36,5 +36,7 @@ struct cbus_attach_args {
int cbus_print(void *, const char *);
int cbus_intr_map(int, int, uint64_t *);
+int cbus_intr_setstate(uint64_t, uint64_t);
+int cbus_intr_setenabled(uint64_t, uint64_t);
#endif