ia64/xen-unstable

changeset 244:0f0113d4cd89

bitkeeper revision 1.102 (3e5ccddc9uBpJ0IXud6JDGQKpSZshw)

xen_serial.c:
Fix serial handler.
author kaf24@labyrinth.cl.cam.ac.uk
date Wed Feb 26 14:23:24 2003 +0000 (2003-02-26)
parents 084eaa7c072e
children ce6eb0deb0c7 cc4b8df6bd54
files xen/drivers/char/xen_serial.c
line diff
     1.1 --- a/xen/drivers/char/xen_serial.c	Wed Feb 26 11:22:48 2003 +0000
     1.2 +++ b/xen/drivers/char/xen_serial.c	Wed Feb 26 14:23:24 2003 +0000
     1.3 @@ -2,6 +2,7 @@
     1.4  #include <xeno/sched.h>    /* this has request_irq() proto for some reason */
     1.5  #include <xeno/keyhandler.h> 
     1.6  #include <xeno/reboot.h>
     1.7 +#include <xeno/irq.h>
     1.8  
     1.9  /* Register offsets */
    1.10  #define NS16550_RBR	0x00	/* receive buffer	*/
    1.11 @@ -42,27 +43,21 @@
    1.12  
    1.13  #define SERIAL_BASE 0x3f8  /* XXX SMH: horrible hardwired COM1   */
    1.14  
    1.15 -
    1.16 +static int serial_echo = 0;   /* default is not to echo; change with 'e' */
    1.17  
    1.18 -static int serial_echo = 0;   /* default is not to echo; change with 'e' */
    1.19  
    1.20  void toggle_echo(u_char key, void *dev_id, struct pt_regs *regs) 
    1.21  {
    1.22      serial_echo = !serial_echo; 
    1.23 -    return; 
    1.24  }
    1.25  
    1.26 -
    1.27 -
    1.28  static void serial_rx_int(int irq, void *dev_id, struct pt_regs *regs)
    1.29  {
    1.30      u_char c; 
    1.31      key_handler *handler; 
    1.32  
    1.33 -    /* XXX SMH: should probably check this is an RX interrupt :-) */
    1.34 -
    1.35      /* clear the interrupt by reading the character */
    1.36 -    c = inb(SERIAL_BASE + NS16550_RBR );
    1.37 +    c = inb(SERIAL_BASE + NS16550_RBR);
    1.38  
    1.39      /* if there's a handler, call it: we trust it won't screw us too badly */
    1.40      if((handler = get_key_handler(c)) != NULL) 
    1.41 @@ -70,8 +65,6 @@ static void serial_rx_int(int irq, void 
    1.42  
    1.43      if(serial_echo) 
    1.44  	printk("%c", c); 
    1.45 -
    1.46 -    return; 
    1.47  }
    1.48  
    1.49  void initialize_serial() 
    1.50 @@ -92,12 +85,6 @@ void initialize_serial()
    1.51      outb(NS16550_MCR_OUT2, SERIAL_BASE + NS16550_MCR);   /* Modem control */
    1.52      outb(NS16550_IER_ERDAI, SERIAL_BASE + NS16550_IER ); /* Setup interrupts */
    1.53  
    1.54 -    /* XXX SMH: this is a hack; probably is IRQ4 but grab both anyway */
    1.55 -    if((rc = request_irq(4, serial_rx_int, 0, "serial", (void *)0x1234)))
    1.56 +    if((rc = request_irq(4, serial_rx_int, 0, "serial", 0)))
    1.57  	printk("initialize_serial: failed to get IRQ4, rc=%d\n", rc); 
    1.58 -
    1.59 -    if((rc = request_irq(3, serial_rx_int, 0, "serial", (void *)0x1234)))
    1.60 -	printk("initialize_serial: failed to get IRQ3, rc=%d\n", rc); 
    1.61 -    
    1.62 -    return; 
    1.63  }