diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-03-25 12:18:14 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-03-25 12:18:14 +0000 |
commit | 7e3515a07f3a0b4ac08dab7ce2e27ff76cfbf7ad (patch) | |
tree | 123cc3edbfb3063de025678d3f768c3825ff2320 /xenolinux-2.4.25-sparse | |
parent | 163ce6261c54cbfe6fec6f011497a3d14d30b5e4 (diff) | |
download | xen-7e3515a07f3a0b4ac08dab7ce2e27ff76cfbf7ad.tar.gz xen-7e3515a07f3a0b4ac08dab7ce2e27ff76cfbf7ad.tar.bz2 xen-7e3515a07f3a0b4ac08dab7ce2e27ff76cfbf7ad.zip |
bitkeeper revision 1.825.1.3 (4062ce06PgXOr3H1PxSNW_qtctjUMg)
console.c, hypervisor-if.h:
Fix console for non-DOM0.
Diffstat (limited to 'xenolinux-2.4.25-sparse')
-rw-r--r-- | xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c b/xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c index a994f461d8..c55cd01464 100644 --- a/xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c +++ b/xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c @@ -32,6 +32,8 @@ static spinlock_t xen_console_lock = SPIN_LOCK_UNLOCKED; +static int console_evtchn; + #define XEN_TTY_MINOR 123 /******************** Kernel console driver ********************************/ @@ -65,7 +67,7 @@ static void nonpriv_conwrite(const char *s, unsigned int count) ctrl_if->tx_req_prod++; evtchn_op.cmd = EVTCHNOP_send; - evtchn_op.u.send.local_port = 0; + evtchn_op.u.send.local_port = console_evtchn; (void)HYPERVISOR_event_channel_op(&evtchn_op); s += src; @@ -118,6 +120,28 @@ static struct console kcons_info = { void xen_console_init(void) { + evtchn_op_t op; + int i; + + if ( !(start_info.flags & SIF_INITDOMAIN) ) + { + /* Scan the event-channel space to find our control link to DOM0. */ + for ( i = 0; i < NR_EVENT_CHANNELS; i++ ) + { + op.cmd = EVTCHNOP_status; + op.u.status.dom = DOMID_SELF; + op.u.status.port = i; + if ( (HYPERVISOR_event_channel_op(&op) == 0) && + (op.u.status.status == EVTCHNSTAT_interdomain) && + (op.u.status.u.interdomain.dom == 0) ) + break; + } + + /* Bug out if there is no control link. */ + if ( (console_evtchn = i) == NR_EVENT_CHANNELS ) + BUG(); + } + register_console(&kcons_info); /* @@ -259,7 +283,7 @@ static void __do_console_io(void) { /* Send a notification to the controller. */ evtchn_op.cmd = EVTCHNOP_send; - evtchn_op.u.send.local_port = 0; + evtchn_op.u.send.local_port = console_evtchn; (void)HYPERVISOR_event_channel_op(&evtchn_op); } } @@ -467,7 +491,7 @@ int __init xen_con_init(void) panic("Couldn't register Xen virtual console driver\n"); if ( !(start_info.flags & SIF_INITDOMAIN) ) - console_irq = bind_evtchn_to_irq(1); + console_irq = bind_evtchn_to_irq(console_evtchn); else console_irq = bind_virq_to_irq(VIRQ_CONSOLE); @@ -490,7 +514,7 @@ void __exit xen_con_fini(void) free_irq(console_irq, NULL); if ( !(start_info.flags & SIF_INITDOMAIN) ) - unbind_evtchn_from_irq(1); + unbind_evtchn_from_irq(console_evtchn); else unbind_virq_from_irq(VIRQ_CONSOLE); } |