mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
bitkeeper revision 1.353 (3f13c7d5NDWHAyq2VYrx7Mqs7QYIfQ)
vga.h, keyboard.h, setup.c, ioport.c: Cleanups.
This commit is contained in:
1 parent
0cd262a3d8
commit
f4bf3c30da
4 files changed
+39
-83
No files matched your search
@@ -6,42 +6,8 @@
|
||||
#include <asm/hypervisor-ifs/dom0_ops.h>
|
||||
|
||||
|
||||
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
|
||||
asmlinkage int sys_iopl(unsigned int new_io_pl)
|
||||
{
|
||||
unsigned int new_io_pl = (turn_on)?3:0;
|
||||
unsigned int old_io_pl = current->thread.io_pl;
|
||||
dom0_op_t op;
|
||||
|
||||
if ( !(start_info.flags & SIF_PRIVILEGED) )
|
||||
return -EPERM;
|
||||
|
||||
/* Need "raw I/O" privileges for direct port access. */
|
||||
if ( (new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO) )
|
||||
return -EPERM;
|
||||
|
||||
/* Maintain OS privileges even if user attempts to relinquish them. */
|
||||
if ( (new_io_pl == 0) && (start_info.flags & SIF_PRIVILEGED) )
|
||||
new_io_pl = 1;
|
||||
|
||||
printk("ioperm not properly supported - set iopl to %d\n",new_io_pl);
|
||||
|
||||
/* Change our version of the privilege levels. */
|
||||
current->thread.io_pl = new_io_pl;
|
||||
|
||||
/* Force the change at ring 0. */
|
||||
op.cmd = DOM0_IOPL;
|
||||
op.u.iopl.domain = start_info.dom_id;
|
||||
op.u.iopl.iopl = new_io_pl;
|
||||
HYPERVISOR_dom0_op(&op);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
asmlinkage int sys_iopl(unsigned long unused)
|
||||
{
|
||||
struct pt_regs *regs = (struct pt_regs *)&unused;
|
||||
unsigned int new_io_pl = regs->ebx;
|
||||
unsigned int old_io_pl = current->thread.io_pl;
|
||||
dom0_op_t op;
|
||||
|
||||
@@ -70,3 +36,13 @@ asmlinkage int sys_iopl(unsigned long unused)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
|
||||
{
|
||||
unsigned int new_io_pl = turn_on ? 3 : 0;
|
||||
printk("ioperm not fully supported - set iopl to %d\n", new_io_pl);
|
||||
return sys_iopl(new_io_pl);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,8 @@ void __init setup_arch(char **cmdline_p)
|
||||
ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
|
||||
memset(&drive_info, 0, sizeof(drive_info));
|
||||
memset(&screen_info, 0, sizeof(screen_info));
|
||||
// this is drawn from a dump from vgacon:startup in standard linux
|
||||
|
||||
/* This is drawn from a dump from vgacon:startup in standard Linux. */
|
||||
screen_info.orig_video_mode = 3;
|
||||
screen_info.orig_video_isVGA = 1;
|
||||
screen_info.orig_video_lines = 25;
|
||||
@@ -321,7 +322,7 @@ void __init setup_arch(char **cmdline_p)
|
||||
if( !(start_info.flags & SIF_PRIVILEGED) )
|
||||
panic("Xen granted us console access but not privileged status");
|
||||
|
||||
#ifdef CONFIG_VT
|
||||
#if defined(CONFIG_VT)
|
||||
#if defined(CONFIG_VGA_CONSOLE)
|
||||
conswitchp = &vga_con;
|
||||
#elif defined(CONFIG_DUMMY_CONSOLE)
|
||||
|
||||
@@ -56,32 +56,24 @@ extern unsigned char pckbd_sysrq_xlate[128];
|
||||
|
||||
static inline int xen_kbd_controller_present ()
|
||||
{
|
||||
if( start_info.flags & SIF_CONSOLE )
|
||||
{
|
||||
printk("Enable keyboard\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
return start_info.flags & SIF_CONSOLE;
|
||||
}
|
||||
|
||||
/* resource allocation */
|
||||
#define kbd_request_region() do { } while (0)
|
||||
#define kbd_request_irq(handler) request_irq(_EVENT_KBD, handler, 0, "PS/2 kbd", NULL)
|
||||
|
||||
// could implement these with command to xen to filter mouse stuff...
|
||||
/* could implement these with command to xen to filter mouse stuff... */
|
||||
#define aux_request_irq(hand, dev_id) 0
|
||||
#define aux_free_irq(dev_id) do { } while(0)
|
||||
|
||||
/* Some stoneage hardware needs delays after some operations. */
|
||||
#define kbd_pause() do { } while(0)
|
||||
|
||||
|
||||
static unsigned char kbd_current_scancode = 0;
|
||||
|
||||
static unsigned char kbd_read_input(void)
|
||||
{
|
||||
//xprintk("kbd_read_input: returning scancode 0x%2x\n", kbd_current_scancode);
|
||||
return kbd_current_scancode;
|
||||
}
|
||||
|
||||
@@ -89,13 +81,12 @@ static unsigned char kbd_read_status(void)
|
||||
{
|
||||
long res;
|
||||
res = HYPERVISOR_kbd_op(KBD_OP_READ,0);
|
||||
if(res<0) {
|
||||
//printk("kbd_read_status: error from hypervisor: %d", res);
|
||||
if ( res<0 )
|
||||
{
|
||||
kbd_current_scancode = 0;
|
||||
return 0; // error with our request - wrong domain?
|
||||
return 0; /* error with our request - wrong domain? */
|
||||
}
|
||||
kbd_current_scancode = KBD_CODE_SCANCODE(res);
|
||||
//printk("kbd_read_status: returning status 0x%2x\n", KBD_CODE_STATUS(res));
|
||||
return KBD_CODE_STATUS(res);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,42 +11,30 @@
|
||||
|
||||
extern unsigned char *vgacon_mmap;
|
||||
|
||||
|
||||
static unsigned long VGA_MAP_MEM(unsigned long x)
|
||||
{
|
||||
if( vgacon_mmap == NULL )
|
||||
{
|
||||
/* This is our first time in this function. This whole thing
|
||||
is a rather grim hack. We know we're going to get asked
|
||||
to map a 32KB region between 0xb0000 and 0xb8000 because
|
||||
that's what VGAs are. We used the boot time permanent
|
||||
fixed map region, and map it to machine pages.
|
||||
*/
|
||||
if( x != 0xb8000 )
|
||||
panic("Argghh! VGA Console is weird. 1:%08lx\n",x);
|
||||
|
||||
if( vgacon_mmap == NULL )
|
||||
{
|
||||
/* This is our first time in this function. This whole thing
|
||||
is a rather grim hack. We know we're going to get asked
|
||||
to map a 32KB region between 0xb0000 and 0xb8000 because
|
||||
that's what VGAs are. We used the boot time permanent
|
||||
fixed map region, and map it to machine pages.
|
||||
*/
|
||||
vgacon_mmap = (unsigned char*) bt_ioremap( 0xb8000, 32*1024 );
|
||||
return (unsigned long) vgacon_mmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( x != 0xc0000 )
|
||||
panic("Argghh! VGA Console is weird. 2:%08lx\n",x);
|
||||
|
||||
if( x != 0xb8000 )
|
||||
{
|
||||
printk("Argghh! VGA Console is weird. 1:%08lx\n",x);
|
||||
BUG();
|
||||
}
|
||||
|
||||
vgacon_mmap = (unsigned char*) bt_ioremap( 0xb8000, 32*1024 );
|
||||
//xprintk("VGA_MAP_MEM(%08x) first. return %p\n",x,vgacon_mmap);
|
||||
return (unsigned long) vgacon_mmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( x != 0xc0000 )
|
||||
{
|
||||
printk("Argghh! VGA Console is weird. 2:%08lx\n",x);
|
||||
BUG();
|
||||
}
|
||||
//xprintk("VGA_MAP_MEM(%08x) second. return %p\n",x,(unsigned long) vgacon_mmap+0x8000);
|
||||
|
||||
return (unsigned long) vgacon_mmap + 0x8000;
|
||||
|
||||
}
|
||||
return 0;
|
||||
return (unsigned long) vgacon_mmap + 0x8000;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned char vga_readb(unsigned char * x) { return (*(x)); }
|
||||
|
||||