aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xen/console
diff options
context:
space:
mode:
authorKip Macy <kmacy@FreeBSD.org>2008-12-29 06:31:03 +0000
committerKip Macy <kmacy@FreeBSD.org>2008-12-29 06:31:03 +0000
commit3a6d1fcf9c8ed864c98e449a0b7696be6c838aea (patch)
tree78f4ff4cfc0d598fd6e8ccc01fa628fc8ded089f /sys/dev/xen/console
parent42d866dd69a50317c56b8e8ac29f020b739b3202 (diff)
Notes
Diffstat (limited to 'sys/dev/xen/console')
-rw-r--r--sys/dev/xen/console/console.c27
-rw-r--r--sys/dev/xen/console/xencons_ring.c11
2 files changed, 22 insertions, 16 deletions
diff --git a/sys/dev/xen/console/console.c b/sys/dev/xen/console/console.c
index 5b556c250490..a3d616a74856 100644
--- a/sys/dev/xen/console/console.c
+++ b/sys/dev/xen/console/console.c
@@ -15,8 +15,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/stdarg.h>
#include <machine/xen/xen-os.h>
-#include <machine/xen/hypervisor.h>
-#include <machine/xen/xen_intr.h>
+#include <xen/hypervisor.h>
+#include <xen/xen_intr.h>
#include <sys/cons.h>
#include <sys/priv.h>
#include <sys/proc.h>
@@ -75,17 +75,17 @@ static unsigned int wc, wp; /* write_cons, write_prod */
#define XCUNIT(x) (dev2unit(x))
#define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN))
#define CN_LOCK_INIT(x, _name) \
- mtx_init(&x, _name, NULL, MTX_SPIN|MTX_RECURSE)
+ mtx_init(&x, _name, NULL, MTX_DEF|MTX_RECURSE)
#define CN_LOCK(l) \
do { \
if (panicstr == NULL) \
- mtx_lock_spin(&(l)); \
+ mtx_lock(&(l)); \
} while (0)
#define CN_UNLOCK(l) \
do { \
if (panicstr == NULL) \
- mtx_unlock_spin(&(l)); \
+ mtx_unlock(&(l)); \
} while (0)
#define CN_LOCK_ASSERT(x) mtx_assert(&x, MA_OWNED)
#define CN_LOCK_DESTROY(x) mtx_destroy(&x)
@@ -216,6 +216,8 @@ xc_probe(device_t dev)
static int
xc_attach(device_t dev)
{
+ int error;
+ struct xc_softc *sc = (struct xc_softc *)device_get_softc(dev);
if (xen_start_info->flags & SIF_INITDOMAIN) {
xc_consdev.cn_putc = xccnputc_dom0;
@@ -232,14 +234,15 @@ xc_attach(device_t dev)
callout_reset(&xc_callout, XC_POLLTIME, xc_timeout, xccons);
if (xen_start_info->flags & SIF_INITDOMAIN) {
- PANIC_IF(bind_virq_to_irqhandler(
- VIRQ_CONSOLE,
- 0,
- "console",
- NULL,
- xencons_priv_interrupt,
- INTR_TYPE_TTY) < 0);
+ error = bind_virq_to_irqhandler(
+ VIRQ_CONSOLE,
+ 0,
+ "console",
+ NULL,
+ xencons_priv_interrupt,
+ sc, INTR_TYPE_TTY, NULL);
+ KASSERT(error >= 0, ("can't register console interrupt"));
}
diff --git a/sys/dev/xen/console/xencons_ring.c b/sys/dev/xen/console/xencons_ring.c
index 3d2323765c8e..596b5de48d36 100644
--- a/sys/dev/xen/console/xencons_ring.c
+++ b/sys/dev/xen/console/xencons_ring.c
@@ -15,19 +15,20 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/stdarg.h>
#include <machine/xen/xen-os.h>
-#include <machine/xen/hypervisor.h>
-#include <machine/xen/xen_intr.h>
+#include <xen/hypervisor.h>
+#include <xen/xen_intr.h>
#include <sys/cons.h>
#include <dev/xen/console/xencons_ring.h>
-#include <machine/xen/evtchn.h>
+#include <xen/evtchn.h>
#include <xen/interface/io/console.h>
#define console_evtchn console.domU.evtchn
extern char *console_page;
-
+extern struct mtx cn_mtx;
+
static inline struct xencons_interface *
xencons_interface(void)
{
@@ -82,6 +83,7 @@ xencons_handle_input(void *unused)
struct xencons_interface *intf;
XENCONS_RING_IDX cons, prod;
+ mtx_lock(&cn_mtx);
intf = xencons_interface();
cons = intf->in_cons;
@@ -99,6 +101,7 @@ xencons_handle_input(void *unused)
notify_remote_via_evtchn(xen_start_info->console_evtchn);
xencons_tx();
+ mtx_unlock(&cn_mtx);
}
void