ia64/xen-unstable

changeset 1220:d75495926616

bitkeeper revision 1.825.1.3 (4062ce06PgXOr3H1PxSNW_qtctjUMg)

console.c, hypervisor-if.h:
Fix console for non-DOM0.
author kaf24@scramble.cl.cam.ac.uk
date Thu Mar 25 12:18:14 2004 +0000 (2004-03-25)
parents fc8ea15b6dcf
children 9eb1d25256fa
files xen/include/hypervisor-ifs/hypervisor-if.h xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c
line diff
     1.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Thu Mar 25 11:51:43 2004 +0000
     1.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h	Thu Mar 25 12:18:14 2004 +0000
     1.3 @@ -147,6 +147,9 @@ typedef struct
     1.4      unsigned long args[7];
     1.5  } multicall_entry_t;
     1.6  
     1.7 +/* Event channel endpoints per domain. */
     1.8 +#define NR_EVENT_CHANNELS 1024
     1.9 +
    1.10  /*
    1.11   * Xen/guestos shared data -- pointer provided in start_info.
    1.12   * NB. We expect that this struct is smaller than a page.
     2.1 --- a/xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c	Thu Mar 25 11:51:43 2004 +0000
     2.2 +++ b/xenolinux-2.4.25-sparse/arch/xen/drivers/console/console.c	Thu Mar 25 12:18:14 2004 +0000
     2.3 @@ -32,6 +32,8 @@
     2.4  
     2.5  static spinlock_t xen_console_lock = SPIN_LOCK_UNLOCKED;
     2.6  
     2.7 +static int console_evtchn;
     2.8 +
     2.9  #define XEN_TTY_MINOR 123
    2.10  
    2.11  /******************** Kernel console driver ********************************/
    2.12 @@ -65,7 +67,7 @@ static void nonpriv_conwrite(const char 
    2.13          
    2.14          ctrl_if->tx_req_prod++;
    2.15          evtchn_op.cmd = EVTCHNOP_send;
    2.16 -        evtchn_op.u.send.local_port = 0;
    2.17 +        evtchn_op.u.send.local_port = console_evtchn;
    2.18          (void)HYPERVISOR_event_channel_op(&evtchn_op);
    2.19          
    2.20          s     += src;
    2.21 @@ -118,6 +120,28 @@ static struct console kcons_info = {
    2.22  
    2.23  void xen_console_init(void)
    2.24  {
    2.25 +    evtchn_op_t op;
    2.26 +    int i;
    2.27 +
    2.28 +    if ( !(start_info.flags & SIF_INITDOMAIN) )
    2.29 +    {
    2.30 +        /* Scan the event-channel space to find our control link to DOM0. */
    2.31 +        for ( i = 0; i < NR_EVENT_CHANNELS; i++ )
    2.32 +        {
    2.33 +            op.cmd           = EVTCHNOP_status;
    2.34 +            op.u.status.dom  = DOMID_SELF;
    2.35 +            op.u.status.port = i;
    2.36 +            if ( (HYPERVISOR_event_channel_op(&op) == 0) &&
    2.37 +                 (op.u.status.status == EVTCHNSTAT_interdomain) &&
    2.38 +                 (op.u.status.u.interdomain.dom == 0) )
    2.39 +                break;
    2.40 +        }
    2.41 +        
    2.42 +        /* Bug out if there is no control link. */
    2.43 +        if ( (console_evtchn = i) == NR_EVENT_CHANNELS )
    2.44 +            BUG();
    2.45 +    }
    2.46 +
    2.47      register_console(&kcons_info);
    2.48  
    2.49      /*
    2.50 @@ -259,7 +283,7 @@ static void __do_console_io(void)
    2.51      {
    2.52          /* Send a notification to the controller. */
    2.53          evtchn_op.cmd = EVTCHNOP_send;
    2.54 -        evtchn_op.u.send.local_port = 0;
    2.55 +        evtchn_op.u.send.local_port = console_evtchn;
    2.56          (void)HYPERVISOR_event_channel_op(&evtchn_op);
    2.57      }
    2.58  }
    2.59 @@ -467,7 +491,7 @@ int __init xen_con_init(void)
    2.60          panic("Couldn't register Xen virtual console driver\n");
    2.61  
    2.62      if ( !(start_info.flags & SIF_INITDOMAIN) )
    2.63 -        console_irq = bind_evtchn_to_irq(1);
    2.64 +        console_irq = bind_evtchn_to_irq(console_evtchn);
    2.65      else
    2.66          console_irq = bind_virq_to_irq(VIRQ_CONSOLE);
    2.67  
    2.68 @@ -490,7 +514,7 @@ void __exit xen_con_fini(void)
    2.69      free_irq(console_irq, NULL);
    2.70  
    2.71      if ( !(start_info.flags & SIF_INITDOMAIN) )
    2.72 -        unbind_evtchn_from_irq(1);
    2.73 +        unbind_evtchn_from_irq(console_evtchn);
    2.74      else
    2.75          unbind_virq_from_irq(VIRQ_CONSOLE);
    2.76  }