ia64/xen-unstable

changeset 634:2e36bfa1978c

bitkeeper revision 1.353 (3f13c7d5NDWHAyq2VYrx7Mqs7QYIfQ)

vga.h, keyboard.h, setup.c, ioport.c:
Cleanups.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jul 15 09:22:29 2003 +0000 (2003-07-15)
parents d2aad5afa33c
children 062359854730
files xenolinux-2.4.21-sparse/arch/xeno/kernel/ioport.c xenolinux-2.4.21-sparse/arch/xeno/kernel/setup.c xenolinux-2.4.21-sparse/include/asm-xeno/keyboard.h xenolinux-2.4.21-sparse/include/asm-xeno/vga.h
line diff
     1.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/kernel/ioport.c	Tue Jul 15 00:49:09 2003 +0000
     1.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/kernel/ioport.c	Tue Jul 15 09:22:29 2003 +0000
     1.3 @@ -6,42 +6,8 @@
     1.4  #include <asm/hypervisor-ifs/dom0_ops.h>
     1.5  
     1.6  
     1.7 -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
     1.8 +asmlinkage int sys_iopl(unsigned int new_io_pl)
     1.9  {
    1.10 -    unsigned int new_io_pl = (turn_on)?3:0;
    1.11 -    unsigned int old_io_pl = current->thread.io_pl;
    1.12 -    dom0_op_t op;
    1.13 -
    1.14 -    if ( !(start_info.flags & SIF_PRIVILEGED) )
    1.15 -        return -EPERM;
    1.16 -
    1.17 -    /* Need "raw I/O" privileges for direct port access. */
    1.18 -    if ( (new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO) )
    1.19 -        return -EPERM;
    1.20 -
    1.21 -    /* Maintain OS privileges even if user attempts to relinquish them. */
    1.22 -    if ( (new_io_pl == 0) && (start_info.flags & SIF_PRIVILEGED) )
    1.23 -        new_io_pl = 1;
    1.24 -
    1.25 -    printk("ioperm not properly supported - set iopl to %d\n",new_io_pl);
    1.26 -
    1.27 -    /* Change our version of the privilege levels. */
    1.28 -    current->thread.io_pl = new_io_pl;
    1.29 -
    1.30 -    /* Force the change at ring 0. */
    1.31 -    op.cmd           = DOM0_IOPL;
    1.32 -    op.u.iopl.domain = start_info.dom_id;
    1.33 -    op.u.iopl.iopl   = new_io_pl;
    1.34 -    HYPERVISOR_dom0_op(&op);
    1.35 -
    1.36 -    return 0;
    1.37 -}
    1.38 -
    1.39 -
    1.40 -asmlinkage int sys_iopl(unsigned long unused)
    1.41 -{
    1.42 -    struct pt_regs *regs = (struct pt_regs *)&unused;
    1.43 -    unsigned int new_io_pl = regs->ebx;
    1.44      unsigned int old_io_pl = current->thread.io_pl;
    1.45      dom0_op_t op;
    1.46  
    1.47 @@ -70,3 +36,13 @@ asmlinkage int sys_iopl(unsigned long un
    1.48  
    1.49      return 0;
    1.50  }
    1.51 +
    1.52 +
    1.53 +asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
    1.54 +{
    1.55 +    unsigned int new_io_pl = turn_on ? 3 : 0;
    1.56 +    printk("ioperm not fully supported - set iopl to %d\n", new_io_pl);
    1.57 +    return sys_iopl(new_io_pl);
    1.58 +}
    1.59 +
    1.60 +
     2.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/kernel/setup.c	Tue Jul 15 00:49:09 2003 +0000
     2.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/kernel/setup.c	Tue Jul 15 09:22:29 2003 +0000
     2.3 @@ -166,7 +166,8 @@ void __init setup_arch(char **cmdline_p)
     2.4      ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
     2.5      memset(&drive_info, 0, sizeof(drive_info));
     2.6      memset(&screen_info, 0, sizeof(screen_info));
     2.7 -    // this is drawn from a dump from vgacon:startup in standard linux
     2.8 +    
     2.9 +    /* This is drawn from a dump from vgacon:startup in standard Linux. */
    2.10      screen_info.orig_video_mode = 3; 
    2.11      screen_info.orig_video_isVGA = 1;
    2.12      screen_info.orig_video_lines = 25;
    2.13 @@ -321,7 +322,7 @@ void __init setup_arch(char **cmdline_p)
    2.14          if( !(start_info.flags & SIF_PRIVILEGED) )
    2.15              panic("Xen granted us console access but not privileged status");
    2.16  
    2.17 -#ifdef CONFIG_VT
    2.18 +#if defined(CONFIG_VT)
    2.19  #if defined(CONFIG_VGA_CONSOLE)
    2.20          conswitchp = &vga_con;
    2.21  #elif defined(CONFIG_DUMMY_CONSOLE)
     3.1 --- a/xenolinux-2.4.21-sparse/include/asm-xeno/keyboard.h	Tue Jul 15 00:49:09 2003 +0000
     3.2 +++ b/xenolinux-2.4.21-sparse/include/asm-xeno/keyboard.h	Tue Jul 15 09:22:29 2003 +0000
     3.3 @@ -56,32 +56,24 @@ extern unsigned char pckbd_sysrq_xlate[1
     3.4  
     3.5  static inline int xen_kbd_controller_present ()
     3.6  {
     3.7 -	if( start_info.flags & SIF_CONSOLE )
     3.8 -		{
     3.9 -		printk("Enable keyboard\n");
    3.10 -		return 1;
    3.11 -		}
    3.12 -	else
    3.13 -		return 0;
    3.14 +    return start_info.flags & SIF_CONSOLE;
    3.15  }
    3.16  
    3.17  /* resource allocation */
    3.18  #define kbd_request_region() do { } while (0)
    3.19  #define kbd_request_irq(handler) request_irq(_EVENT_KBD, handler, 0, "PS/2 kbd", NULL)
    3.20  
    3.21 -// could implement these with command to xen to filter mouse stuff...
    3.22 +/* could implement these with command to xen to filter mouse stuff... */
    3.23  #define aux_request_irq(hand, dev_id) 0
    3.24  #define aux_free_irq(dev_id) do { } while(0)
    3.25  
    3.26  /* Some stoneage hardware needs delays after some operations.  */
    3.27  #define kbd_pause() do { } while(0)
    3.28  
    3.29 -
    3.30  static unsigned char kbd_current_scancode = 0;
    3.31  
    3.32  static unsigned char kbd_read_input(void) 
    3.33  {
    3.34 -  //xprintk("kbd_read_input: returning scancode 0x%2x\n", kbd_current_scancode);
    3.35    return kbd_current_scancode;
    3.36  }
    3.37  
    3.38 @@ -89,13 +81,12 @@ static unsigned char kbd_read_status(voi
    3.39  {
    3.40    long res;
    3.41    res = HYPERVISOR_kbd_op(KBD_OP_READ,0);
    3.42 -  if(res<0) {
    3.43 -    //printk("kbd_read_status: error from hypervisor: %d", res);
    3.44 +  if ( res<0 ) 
    3.45 +  {
    3.46      kbd_current_scancode = 0;
    3.47 -    return 0; // error with our request - wrong domain?
    3.48 +    return 0; /* error with our request - wrong domain? */
    3.49    }
    3.50    kbd_current_scancode = KBD_CODE_SCANCODE(res);
    3.51 -  //printk("kbd_read_status: returning status 0x%2x\n", KBD_CODE_STATUS(res));
    3.52    return KBD_CODE_STATUS(res);
    3.53  }
    3.54  
     4.1 --- a/xenolinux-2.4.21-sparse/include/asm-xeno/vga.h	Tue Jul 15 00:49:09 2003 +0000
     4.2 +++ b/xenolinux-2.4.21-sparse/include/asm-xeno/vga.h	Tue Jul 15 09:22:29 2003 +0000
     4.3 @@ -11,42 +11,30 @@
     4.4  
     4.5  extern unsigned char *vgacon_mmap;
     4.6  
     4.7 -
     4.8  static unsigned long VGA_MAP_MEM(unsigned long x)
     4.9  {
    4.10 -
    4.11 -	if( vgacon_mmap == NULL )
    4.12 -	{
    4.13 -		/* This is our first time in this function. This whole thing
    4.14 -		is a rather grim hack. We know we're going to get asked 
    4.15 -		to map a 32KB region between 0xb0000 and 0xb8000 because
    4.16 -		that's what VGAs are. We used the boot time permanent 
    4.17 -		fixed map region, and map it to machine pages.
    4.18 -		*/
    4.19 -
    4.20 -		if( x != 0xb8000 )
    4.21 -		{
    4.22 -			printk("Argghh! VGA Console is weird. 1:%08lx\n",x);
    4.23 -			BUG();	
    4.24 -		}
    4.25 +    if( vgacon_mmap == NULL )
    4.26 +    {
    4.27 +        /* This is our first time in this function. This whole thing
    4.28 +           is a rather grim hack. We know we're going to get asked 
    4.29 +           to map a 32KB region between 0xb0000 and 0xb8000 because
    4.30 +           that's what VGAs are. We used the boot time permanent 
    4.31 +           fixed map region, and map it to machine pages.
    4.32 +        */
    4.33 +        if( x != 0xb8000 )
    4.34 +            panic("Argghh! VGA Console is weird. 1:%08lx\n",x);
    4.35  
    4.36 -		vgacon_mmap = (unsigned char*) bt_ioremap( 0xb8000, 32*1024 );
    4.37 -//xprintk("VGA_MAP_MEM(%08x) first. return %p\n",x,vgacon_mmap);
    4.38 -		return (unsigned long) vgacon_mmap;
    4.39 -	}
    4.40 -	else
    4.41 -	{
    4.42 -		if( x != 0xc0000 )
    4.43 -                {
    4.44 -                        printk("Argghh! VGA Console is weird. 2:%08lx\n",x);  
    4.45 -                        BUG();
    4.46 -                }
    4.47 -//xprintk("VGA_MAP_MEM(%08x) second. return %p\n",x,(unsigned long) vgacon_mmap+0x8000);
    4.48 +        vgacon_mmap = (unsigned char*) bt_ioremap( 0xb8000, 32*1024 );
    4.49 +        return (unsigned long) vgacon_mmap;
    4.50 +    }
    4.51 +    else
    4.52 +    {
    4.53 +        if( x != 0xc0000 )
    4.54 +            panic("Argghh! VGA Console is weird. 2:%08lx\n",x);  
    4.55  
    4.56 -		return (unsigned long) vgacon_mmap + 0x8000;
    4.57 -
    4.58 -	}
    4.59 -	return 0;
    4.60 +        return (unsigned long) vgacon_mmap + 0x8000;
    4.61 +    }
    4.62 +    return 0;
    4.63  }
    4.64  
    4.65  static inline unsigned char vga_readb(unsigned char * x) { return (*(x)); }