aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjws@cairnwell.research <jws@cairnwell.research>2003-05-01 18:27:12 +0000
committerjws@cairnwell.research <jws@cairnwell.research>2003-05-01 18:27:12 +0000
commit78cbdf5809c68481cdb32bf0ecbd313bc57b3903 (patch)
tree956147f8fb3052fb5fd9a9440cb9c6669611a44f
parentbc368b21de560c78722a71a115f2927f3e49b37d (diff)
parent4b150117e82021c58c9cda27d8c65a5b5974e076 (diff)
downloadxen-78cbdf5809c68481cdb32bf0ecbd313bc57b3903.tar.gz
xen-78cbdf5809c68481cdb32bf0ecbd313bc57b3903.tar.bz2
xen-78cbdf5809c68481cdb32bf0ecbd313bc57b3903.zip
bitkeeper revision 1.202 (3eb16700-gEpXFlt08DC4GuoWltR6Q)
jws merge
-rw-r--r--.rootkeys2
-rw-r--r--xen/common/domain.c6
-rw-r--r--xen/common/kernel.c120
-rw-r--r--xen/drivers/char/xen_kbd.c25
-rw-r--r--xen/include/hypervisor-ifs/hypervisor-if.h3
-rw-r--r--xen/include/xeno/console.h32
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig4
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/Makefile2
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/console.c110
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c31
-rw-r--r--xenolinux-2.4.21-pre4-sparse/drivers/char/Config.in14
-rw-r--r--xenolinux-2.4.21-pre4-sparse/drivers/char/Makefile339
-rw-r--r--xenolinux-2.4.21-pre4-sparse/drivers/char/tty_io.c24
13 files changed, 237 insertions, 475 deletions
diff --git a/.rootkeys b/.rootkeys
index 5dbe203b37..655b7d0f43 100644
--- a/.rootkeys
+++ b/.rootkeys
@@ -298,6 +298,7 @@
3ddb79c0c0cX_DZE209-Bb-Rx1v-Aw xen/include/xeno/cache.h
3e9c248aEG_nCngztiFmv5CfayNkcA xen/include/xeno/cdrom.h
3ddb79c259jh8hE7vre_8NuE7nwNSA xen/include/xeno/config.h
+3eb165e0eawr3R-p2ZQtSdLWtLRN_A xen/include/xeno/console.h
3ddb79c1V44RD26YqCUm-kqIupM37A xen/include/xeno/ctype.h
3ddb79c05DdHQ0UxX_jKsXdR4QlMCA xen/include/xeno/delay.h
3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/xeno/dom0_ops.h
@@ -416,7 +417,6 @@
3ea53c6em6uzVHSiGqrbbAVofyRY_g xenolinux-2.4.21-pre4-sparse/drivers/block/genhd.c
3e5a4e66mrtlmV75L1tjKDg8RaM5gA xenolinux-2.4.21-pre4-sparse/drivers/block/ll_rw_blk.c
3ead095dEkj9JJWYYBnbvW3OYbKFxg xenolinux-2.4.21-pre4-sparse/drivers/char/Config.in
-3ead095d00j61GCBaYdu_SwmY-vdSQ xenolinux-2.4.21-pre4-sparse/drivers/char/Makefile
3ead095dPseRoFELVf_xcnVXjq02hw xenolinux-2.4.21-pre4-sparse/drivers/char/dummy_console.c
3e5a4e66rw65CxyolW9PKz4GG42RcA xenolinux-2.4.21-pre4-sparse/drivers/char/tty_io.c
3e5a4e669uzIE54VwucPYtGwXLAbzA xenolinux-2.4.21-pre4-sparse/fs/exec.c
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0542743341..f54e7c9d67 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -15,6 +15,7 @@
#include <asm/flushtlb.h>
#include <asm/msr.h>
#include <xeno/blkdev.h>
+#include <xeno/console.h>
/*
* NB. No ring-3 access in initial guestOS pagetables. Note that we allow
@@ -625,6 +626,11 @@ int setup_guestos(struct task_struct *p, dom0_newdomain_t *params,
virt_startinfo_address->dom_id = p->domain;
virt_startinfo_address->flags = IS_PRIV(p) ? SIF_PRIVILEGED : 0;
+ // guest os can have console if:
+ // 1) its privileged (need iopl right now)
+ // 2) its the owner of the console (and therefore will get kbd/mouse events)
+ // 3) xen hasnt tried to touch the console (see console.h)
+ virt_startinfo_address->flags |= (IS_PRIV(p) && CONSOLE_ISOWNER(p) && opt_console == 0) ? SIF_CONSOLE : 0;
if ( initrd_len )
{
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 5ee3f2e3cb..4d5a2deba0 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -15,6 +15,7 @@
#include <asm/byteorder.h>
#include <linux/if_ether.h>
#include <asm/domain_page.h>
+#include <xeno/console.h>
static int xpos, ypos;
static volatile unsigned char *video;
@@ -32,6 +33,7 @@ void init_serial(void);
void start_of_day(void);
/* Command line options and variables. */
+int opt_console = 1;
unsigned int opt_ser_baud = 9600; /* default baud for COM1 */
unsigned int opt_dom0_mem = 16000; /* default kbytes for DOM0 */
unsigned int opt_ne_base = 0; /* NE2k NICs cannot be probed */
@@ -43,6 +45,7 @@ static struct {
int type;
void *var;
} opts[] = {
+ { "console", OPT_BOOL, &opt_console },
{ "ser_baud", OPT_UINT, &opt_ser_baud },
{ "dom0_mem", OPT_UINT, &opt_dom0_mem },
{ "ne_base", OPT_UINT, &opt_ne_base },
@@ -219,6 +222,7 @@ void cmain (unsigned long magic, multiboot_info_t *mbi)
void init_serial(void)
{
+#ifdef CONFIG_OUTPUT_SERIAL
/* 'opt_ser_baud' baud, no parity, 1 stop bit, 8 data bits. */
outb(0x83, SERIAL_BASE+DATA_FORMAT);
outb(115200/opt_ser_baud, SERIAL_BASE+DIVISOR_LO);
@@ -227,14 +231,17 @@ void init_serial(void)
/* No interrupts. */
outb(0x00, SERIAL_BASE+INT_ENABLE);
+#endif
}
void putchar_serial(unsigned char c)
{
+#ifdef CONFIG_OUTPUT_SERIAL
if ( c == '\n' ) putchar_serial('\r');
while ( !(inb(SERIAL_BASE+LINE_STATUS)&(1<<5)) ) barrier();
outb(c, SERIAL_BASE+TX_HOLD);
+#endif
}
@@ -247,6 +254,7 @@ void putchar_serial(unsigned char c)
/* This is actually code from vgaHWRestore in an old version of XFree86 :-) */
void init_vga(void)
{
+#ifdef CONFIG_OUTPUT_CONSOLE
/* The following VGA state was saved from a chip in text mode 3. */
static unsigned char regs[] = {
/* Sequencer registers */
@@ -265,81 +273,93 @@ void init_vga(void)
int i, j = 0;
volatile unsigned char tmp;
- tmp = inb(0x3da);
- outb(0x00, 0x3c0);
-
- for ( i = 0; i < 5; i++ )
+ if(opt_console) {
+ tmp = inb(0x3da);
+ outb(0x00, 0x3c0);
+
+ for ( i = 0; i < 5; i++ )
outw((regs[j++] << 8) | i, 0x3c4);
-
- /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 of CRTC[17]. */
- outw(((regs[5+17] & 0x7F) << 8) | 17, 0x3d4);
-
- for ( i = 0; i < 25; i++ )
+
+ /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 of CRTC[17]. */
+ outw(((regs[5+17] & 0x7F) << 8) | 17, 0x3d4);
+
+ for ( i = 0; i < 25; i++ )
outw((regs[j++] << 8) | i, 0x3d4);
-
- for ( i = 0; i < 9; i++ )
+
+ for ( i = 0; i < 9; i++ )
outw((regs[j++] << 8) | i, 0x3ce);
-
- for ( i = 0; i < 21; i++ )
- {
- tmp = inb(0x3da);
- outb(i, 0x3c0);
- outb(regs[j++], 0x3c0);
+
+ for ( i = 0; i < 21; i++ )
+ {
+ tmp = inb(0x3da);
+ outb(i, 0x3c0);
+ outb(regs[j++], 0x3c0);
+ }
+
+ tmp = inb(0x3da);
+ outb(0x20, 0x3c0);
}
-
- tmp = inb(0x3da);
- outb(0x20, 0x3c0);
+#endif
}
/* Clear the screen and initialize VIDEO, XPOS and YPOS. */
void cls(void)
{
+#ifdef CONFIG_OUTPUT_CONSOLE
int i;
- video = (unsigned char *) VIDEO;
-
- for (i = 0; i < COLUMNS * LINES * 2; i++)
+ if(opt_console) {
+ video = (unsigned char *) VIDEO;
+
+ for (i = 0; i < COLUMNS * LINES * 2; i++)
*(video + i) = 0;
-
- xpos = 0;
- ypos = 0;
-
- outw(10+(1<<(5+8)), 0x3d4); /* cursor off */
+
+ xpos = 0;
+ ypos = 0;
+
+ outw(10+(1<<(5+8)), 0x3d4); /* cursor off */
+ }
+#endif
}
/* Put the character C on the screen. */
static void putchar (int c)
{
+#ifdef CONFIG_OUTPUT_CONSOLE
static char zeroarr[2*COLUMNS] = { 0 };
-
if ( (c != '\n') && ((c < 32) || (c > 126)) ) return;
+#endif
putchar_serial(c);
- if ( c == '\n' )
- {
- newline:
- xpos = 0;
- ypos++;
- if (ypos >= LINES)
- {
- ypos = LINES-1;
- memcpy((char*)video,
- (char*)video + 2*COLUMNS, (LINES-1)*2*COLUMNS);
- memcpy((char*)video + (LINES-1)*2*COLUMNS,
- zeroarr, 2*COLUMNS);
- }
- return;
- }
-
- *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF;
- *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE;
-
- xpos++;
- if (xpos >= COLUMNS)
+#ifdef CONFIG_OUTPUT_CONSOLE
+ if(opt_console) {
+ if (c == '\n')
+ {
+ newline:
+ xpos = 0;
+ ypos++;
+ if (ypos >= LINES)
+ {
+ ypos = LINES-1;
+ memcpy((char*)video,
+ (char*)video + 2*COLUMNS, (LINES-1)*2*COLUMNS);
+ memcpy((char*)video + (LINES-1)*2*COLUMNS,
+ zeroarr, 2*COLUMNS);
+ }
+ return;
+ }
+
+ *(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF;
+ *(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE;
+
+ xpos++;
+ if (xpos >= COLUMNS)
goto newline;
+ }
+#endif
}
static inline void __putstr(const char *str)
diff --git a/xen/drivers/char/xen_kbd.c b/xen/drivers/char/xen_kbd.c
index 4c65f4e0bb..065f2f7c39 100644
--- a/xen/drivers/char/xen_kbd.c
+++ b/xen/drivers/char/xen_kbd.c
@@ -31,10 +31,12 @@
#define AUX_IRQ 12
+#undef KBD_DEBUG
/* THIS SECTION DEALS WITH CONFIG_XEN_ATTENTION_KEY */
-// always set for now. potentially moved to config.in later.
+// always set for now. potentially moved to a central config later.
+// this should really affect common/keyhandler.c too
#define CONFIG_XEN_ATTENTION_KEY
#ifdef CONFIG_XEN_ATTENTION_KEY
@@ -43,8 +45,6 @@ static int xen_attention_key_down = 0;
#define XEN_ATTENTION_KEY 0x46 // scroll lock
#define KBD_SCANCODE_KEYUP_MASK 0x80
-#undef KBD_DEBUG
-
/* naive scancode -> key mappings for internal xen use */
static unsigned char keymap_normal[] =
@@ -144,7 +144,7 @@ static unsigned char convert_scancode (unsigned char scancode)
#endif /* CONFIG_XEN_ATTENTION_KEY */
-/* THIS SECTION DEALS WITH STORING A RING OF PENDING EVENTS */
+/* THIS SECTION DEALS WITH STORING A RING OF PENDING KBD EVENTS */
// store kbd events waiting to be processed by guest os
#define KBD_RING_SIZE 64
@@ -179,9 +179,7 @@ static int kbd_ring_pop() {
/* THIS SECTION DEALS WITH COMMUNICATING PS2 EVENTS/CMDS WITH GUEST OS */
-// ownership of keyboard - current defaulting to dom0
-#define KBD_ISOWNER(p) (p->domain == 0)
-#define KBD_OWNER find_domain_by_id(0)
+#include <xeno/console.h>
// need lock as there may be _two_ interrupts at play, keyboard and mouse, as well as guest os actions
static spinlock_t kbd_lock;
@@ -194,7 +192,7 @@ long do_kbd_op(unsigned char op, unsigned char val)
printk("do_kbd_op: op %2x, val %2x, prod %d, cons %d\n", op, val, kbd_ring_prod, kbd_ring_cons);
#endif
- if ( !KBD_ISOWNER(current) ) return -EPERM;
+ if ( !CONSOLE_ISOWNER(current) ) return -EPERM;
switch(op) {
case KBD_OP_WRITEOUTPUT:
@@ -225,6 +223,7 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned long flags;
spin_lock_irqsave(&kbd_lock, flags);
status = kbd_read_status();
+
#ifdef KBD_DEBUG
printk("keyboard_interrupt irq %d, status 0x%2x\n", irq, status);
#endif
@@ -241,10 +240,14 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
//printk("xen_attention_key_down %d\n", xen_attention_key_down);
} else if (xen_attention_key_down) {
key_handler *handler;
- unsigned char key = convert_scancode(scancode);
+ unsigned char key;
+
+ spin_unlock_irqrestore(&kbd_lock, flags);
+ key = convert_scancode(scancode);
if(key && (handler = get_key_handler(key)))
(*handler)(key, dev_id, regs);
+ spin_lock_irqsave(&kbd_lock, flags);
status = kbd_read_status();
continue; // do not send key to guest os
}
@@ -254,11 +257,11 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (!(status & (KBD_STAT_GTO | KBD_STAT_PERR))) {
kbd_ring_push(status, scancode);
- cpu_mask = mark_guest_event(KBD_OWNER, _EVENT_KBD);
+ cpu_mask = mark_guest_event(CONSOLE_OWNER, _EVENT_KBD);
guest_event_notify(cpu_mask);
status = kbd_read_status();
- scancode = kbd_read_input();
+ //scancode = kbd_read_input();
}
}
diff --git a/xen/include/hypervisor-ifs/hypervisor-if.h b/xen/include/hypervisor-ifs/hypervisor-if.h
index 6a4c6b817c..f72e8783d5 100644
--- a/xen/include/hypervisor-ifs/hypervisor-if.h
+++ b/xen/include/hypervisor-ifs/hypervisor-if.h
@@ -250,7 +250,8 @@ typedef struct start_info_st {
} start_info_t;
/* These flags are passed in the 'flags' field of start_info_t. */
-#define SIF_PRIVILEGED 1 /* Is thie domain privileged? */
+#define SIF_PRIVILEGED 1 /* Is the domain privileged? */
+#define SIF_CONSOLE 2 /* Does the domain own the physical console? */
/* For use in guest OSes. */
extern shared_info_t *HYPERVISOR_shared_info;
diff --git a/xen/include/xeno/console.h b/xen/include/xeno/console.h
new file mode 100644
index 0000000000..e5cb947b2f
--- /dev/null
+++ b/xen/include/xeno/console.h
@@ -0,0 +1,32 @@
+// <xeno/console.h> - Xen header file concerning console access
+// Copyright (c) 2003 James Scott, Intel Research Cambridge
+
+// ownership of console - current defaulting to dom0
+// this is currently used to see who gets the PS/2 keyboard/mouse events
+#define CONSOLE_ISOWNER(p) (p->domain == 0)
+#define CONSOLE_OWNER find_domain_by_id(0)
+
+
+// Xen output redirection (in common/kernel.c!)
+//
+// This is coarsely done right now -
+// a boot-time option for console output
+// a compile-time option for serial output
+//
+// Really, when starting up a guest os with console privilege, we should:
+// - reset the video to a known state
+// - stop sending characters (use global var opt_console)
+// - allow the guest os access to the video RAM area (instead of the coarse IOPL hack nowadays) and keyboard (see above)
+// Similarly, when stopping that guest os, we should:
+// - stop allowing the guest os access to video RAM
+// - reset the video to a known state
+// - start sending it console output again (if we so desire)
+//
+// resetting the video to a known state has not been explored yet
+// the notion of privileges for guest os's (e.g. console privilege) has not been explored yet
+// so this will do for now
+
+#define CONFIG_OUTPUT_CONSOLE 1 // but see also opt_console
+#define CONFIG_OUTPUT_SERIAL 1
+
+extern int opt_console;
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig b/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig
index 6024daa6c2..c8120dfa4c 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig
@@ -125,9 +125,11 @@ CONFIG_XENOLINUX_BLOCK=y
#
# Character devices
#
+CONFIG_XEN_CONSOLE=y
# CONFIG_VT is not set
+# CONFIG_VGA_CONSOLE is not set
# CONFIG_DUMMY_CONSOLE is not set
-CONFIG_PSMOUSE=y
+# CONFIG_PSMOUSE is not set
# CONFIG_UNIX98_PTYS is not set
#
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/Makefile b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/Makefile
index 5a0e7b36b1..546180a3c2 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/Makefile
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/Makefile
@@ -1,3 +1,3 @@
O_TARGET := con.o
-obj-y := console.o
+obj-$(CONFIG_XEN_CONSOLE) := console.o
include $(TOPDIR)/Rules.make
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/console.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/console.c
index 11548f877e..2704905813 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/console.c
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/console/console.c
@@ -24,9 +24,11 @@
#include <asm/uaccess.h>
#include <asm/hypervisor.h>
+#define XENO_TTY_MINOR 123
+
/******************** Kernel console driver ********************************/
-static void kconsole_write(struct console *co, const char *s, unsigned count)
+static void xen_console_write(struct console *co, const char *s, unsigned count)
{
#define STRLEN 256
static char str[STRLEN];
@@ -49,56 +51,57 @@ static void kconsole_write(struct console *co, const char *s, unsigned count)
}
}
-static kdev_t kconsole_device(struct console *c)
+static kdev_t xen_console_device(struct console *c)
{
/*
* This is the magic that binds our "struct console" to our
* "tty_struct", defined below.
*/
- return MKDEV(TTY_MAJOR, 0);
+ return MKDEV(TTY_MAJOR, XENO_TTY_MINOR);
}
-static struct console kconsole_info = {
- name: "xenocon",
- write: kconsole_write,
- device: kconsole_device,
+static struct console xen_console_info = {
+ name: "xen_console",
+ write: xen_console_write,
+ device: xen_console_device,
flags: CON_PRINTBUFFER,
index: -1,
};
-void xeno_console_init(void)
+void xen_console_init(void)
{
- register_console(&kconsole_info);
+ printk("xeno_console_init\n");
+ register_console(&xen_console_info);
}
/******************** Initial /dev/console *********************************/
-static struct tty_driver console_driver;
-static int console_refcount;
-static struct tty_struct *console_table[1];
-static struct termios *console_termios[1];
-static struct termios *console_termios_locked[1];
+static struct tty_driver xeno_console_driver;
+static int xeno_console_refcount;
+static struct tty_struct *xeno_console_table[1];
+static struct termios *xeno_console_termios[1];
+static struct termios *xeno_console_termios_locked[1];
-static int console_write_room(struct tty_struct *tty)
+static int xeno_console_write_room(struct tty_struct *tty)
{
return INT_MAX;
}
-static int console_chars_in_buffer(struct tty_struct *tty)
+static int xeno_console_chars_in_buffer(struct tty_struct *tty)
{
return 0;
}
-static inline int console_xmit(int ch)
+static inline int xeno_console_xmit(int ch)
{
char _ch = ch;
- kconsole_write(NULL, &_ch, 1);
+ xen_console_write(NULL, &_ch, 1);
return 1;
}
-static int console_write(struct tty_struct *tty, int from_user,
+static int xeno_console_write(struct tty_struct *tty, int from_user,
const u_char * buf, int count)
{
int i;
@@ -119,17 +122,17 @@ static int console_write(struct tty_struct *tty, int from_user,
{
ch = buf[i];
}
- console_xmit(ch);
+ xeno_console_xmit(ch);
}
return i;
}
-static void console_put_char(struct tty_struct *tty, u_char ch)
+static void xeno_console_put_char(struct tty_struct *tty, u_char ch)
{
- console_xmit(ch);
+ xeno_console_xmit(ch);
}
-static int console_open(struct tty_struct *tty, struct file *filp)
+static int xeno_console_open(struct tty_struct *tty, struct file *filp)
{
int line;
@@ -146,37 +149,40 @@ static int console_open(struct tty_struct *tty, struct file *filp)
return 0;
}
-static void console_close(struct tty_struct *tty, struct file *filp)
+static void xeno_console_close(struct tty_struct *tty, struct file *filp)
{
MOD_DEC_USE_COUNT;
}
-static int __init console_ini(void)
+int __init xeno_con_init(void)
{
- memset(&console_driver, 0, sizeof(struct tty_driver));
- console_driver.magic = TTY_DRIVER_MAGIC;
- console_driver.driver_name = "xeno_console";
- console_driver.name = "console";
- console_driver.major = TTY_MAJOR;
- console_driver.minor_start = 0;
- console_driver.num = 1;
- console_driver.type = TTY_DRIVER_TYPE_SERIAL;
- console_driver.subtype = SERIAL_TYPE_NORMAL;
- console_driver.init_termios = tty_std_termios;
- console_driver.flags = TTY_DRIVER_REAL_RAW;
- console_driver.refcount = &console_refcount;
- console_driver.table = console_table;
- console_driver.termios = console_termios;
- console_driver.termios_locked = console_termios_locked;
+
+ printk("xeno_con_init\n");
+
+ memset(&xeno_console_driver, 0, sizeof(struct tty_driver));
+ xeno_console_driver.magic = TTY_DRIVER_MAGIC;
+ xeno_console_driver.driver_name = "xeno_console";
+ xeno_console_driver.name = "xencon";
+ xeno_console_driver.major = TTY_MAJOR;
+ xeno_console_driver.minor_start = XENO_TTY_MINOR;
+ xeno_console_driver.num = 1;
+ xeno_console_driver.type = TTY_DRIVER_TYPE_SERIAL;
+ xeno_console_driver.subtype = SERIAL_TYPE_NORMAL;
+ xeno_console_driver.init_termios = tty_std_termios;
+ xeno_console_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
+ xeno_console_driver.refcount = &xeno_console_refcount;
+ xeno_console_driver.table = xeno_console_table;
+ xeno_console_driver.termios = xeno_console_termios;
+ xeno_console_driver.termios_locked = xeno_console_termios_locked;
/* Functions */
- console_driver.open = console_open;
- console_driver.close = console_close;
- console_driver.write = console_write;
- console_driver.write_room = console_write_room;
- console_driver.put_char = console_put_char;
- console_driver.chars_in_buffer = console_chars_in_buffer;
-
- if ( tty_register_driver(&console_driver) )
+ xeno_console_driver.open = xeno_console_open;
+ xeno_console_driver.close = xeno_console_close;
+ xeno_console_driver.write = xeno_console_write;
+ xeno_console_driver.write_room = xeno_console_write_room;
+ xeno_console_driver.put_char = xeno_console_put_char;
+ xeno_console_driver.chars_in_buffer = xeno_console_chars_in_buffer;
+
+ if ( tty_register_driver(&xeno_console_driver) )
{
printk(KERN_ERR "Couldn't register Xeno console driver\n");
}
@@ -188,17 +194,17 @@ static int __init console_ini(void)
return 0;
}
-static void __exit console_fin(void)
+void __exit xeno_con_fini(void)
{
int ret;
- ret = tty_unregister_driver(&console_driver);
+ ret = tty_unregister_driver(&xeno_console_driver);
if ( ret != 0 )
{
printk(KERN_ERR "Unable to unregister Xeno console driver: %d\n", ret);
}
}
-module_init(console_ini);
-module_exit(console_fin);
+module_init(xeno_con_init);
+module_exit(xeno_con_fini);
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c
index b3fa27fb11..832a7a2087 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c
@@ -163,8 +163,16 @@ 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
+ screen_info.orig_video_mode = 3;
+ screen_info.orig_video_isVGA = 1;
+ screen_info.orig_video_lines = 25;
+ screen_info.orig_video_cols = 80;
+ screen_info.orig_video_ega_bx = 3;
+ screen_info.orig_video_points = 16;
+
memset(&apm_info.bios, 0, sizeof(apm_info.bios));
- aux_device_present = 0;
+ aux_device_present = 0;
#ifdef CONFIG_BLK_DEV_RAM
rd_image_start = 0;
rd_prompt = 0;
@@ -292,6 +300,27 @@ void __init setup_arch(char **cmdline_p)
#endif
paging_init();
+
+ if(start_info.flags & SIF_PRIVILEGED) {
+ // we are privileged guest os - should be able to set IOPL
+ if(HYPERVISOR_iopl(1)) {
+ panic("Unable to obtain IOPL, despite being SIF_PRIVILEGED");
+ }
+
+ }
+
+ if(start_info.flags & SIF_CONSOLE) {
+ if(!(start_info.flags & SIF_PRIVILEGED)) {
+ panic("Xen granted us console access but not privileged status");
+ }
+#ifdef CONFIG_VT
+#if defined(CONFIG_VGA_CONSOLE)
+ conswitchp = &vga_con;
+#elif defined(CONFIG_DUMMY_CONSOLE)
+ conswitchp = &dummy_con;
+#endif
+#endif
+ }
}
static int cachesize_override __initdata = -1;
diff --git a/xenolinux-2.4.21-pre4-sparse/drivers/char/Config.in b/xenolinux-2.4.21-pre4-sparse/drivers/char/Config.in
index edeb8b3a71..217398d6e2 100644
--- a/xenolinux-2.4.21-pre4-sparse/drivers/char/Config.in
+++ b/xenolinux-2.4.21-pre4-sparse/drivers/char/Config.in
@@ -4,18 +4,22 @@
mainmenu_option next_comment
comment 'Character devices'
+bool 'Xen console support' CONFIG_XEN_CONSOLE
+comment 'The options below are alpha-stage and will probably not work'
bool 'Virtual terminal' CONFIG_VT
-if [ "$CONFIG_VT" = "n" ]; then
- bool 'Dummy Console (to allow kbd/mouse testing without VTs)' CONFIG_DUMMY_CONSOLE
-fi
-
-bool 'PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE
+if [ "$CONFIG_VT" = "y" ]; then
+ bool ' Support for console on virtual terminal' CONFIG_VT_CONSOLE
+ bool ' Support for VGA Video' CONFIG_VGA_CONSOLE
+ bool ' Support for Dummy Video (for testing)' CONFIG_DUMMY_CONSOLE
+ bool ' PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE
+fi
bool 'Unix98 PTY support' CONFIG_UNIX98_PTYS
if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256
fi
+
endmenu
# KEPT IN CASE WE WANT TO BRING SOME BACK...
diff --git a/xenolinux-2.4.21-pre4-sparse/drivers/char/Makefile b/xenolinux-2.4.21-pre4-sparse/drivers/char/Makefile
deleted file mode 100644
index 0b7b73cd16..0000000000
--- a/xenolinux-2.4.21-pre4-sparse/drivers/char/Makefile
+++ /dev/null
@@ -1,339 +0,0 @@
-#
-# Makefile for the kernel character device drivers.
-#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# XENO INFO - this is just copied from the linux one
-# and most is irrelevant for xenolinux and can go.
-# (see Config.in for the relevant bits)
-# JWS - added dummy_console to test ps2 functionality
-
-
-#
-# This file contains the font map for the default (hardware) font
-#
-FONTMAPFILE = cp437.uni
-
-O_TARGET := char.o
-
-obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o raw.o pty.o misc.o random.o
-
-# All of the (potential) objects that export symbols.
-# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
-
-export-objs := busmouse.o console.o keyboard.o sysrq.o \
- misc.o pty.o random.o selection.o serial.o \
- sonypi.o tty_io.o tty_ioctl.o generic_serial.o \
- au1000_gpio.o hp_psaux.o nvram.o dummy_console.o
-
-mod-subdirs := joystick ftape drm drm-4.0 pcmcia
-
-list-multi :=
-
-KEYMAP =defkeymap.o
-KEYBD =pc_keyb.o
-CONSOLE =console.o
-SERIAL =serial.o
-
-ifeq ($(ARCH),s390)
- KEYMAP =
- KEYBD =
- CONSOLE =
- SERIAL =
-endif
-
-ifeq ($(ARCH),mips)
- ifneq ($(CONFIG_PC_KEYB),y)
- KEYBD =
- endif
-endif
-
-ifeq ($(ARCH),s390x)
- KEYMAP =
- KEYBD =
- CONSOLE =
- SERIAL =
-endif
-
-ifeq ($(ARCH),m68k)
- ifdef CONFIG_AMIGA
- KEYBD = amikeyb.o
- else
- ifndef CONFIG_MAC
- KEYBD =
- endif
- endif
- SERIAL =
-endif
-
-ifeq ($(ARCH),parisc)
- ifdef CONFIG_GSC_PS2
- KEYBD = hp_psaux.o hp_keyb.o
- else
- KEYBD =
- endif
- ifdef CONFIG_SERIAL_MUX
- CONSOLE += mux.o
- endif
- ifdef CONFIG_PDC_CONSOLE
- CONSOLE += pdc_console.o
- endif
-endif
-
-ifdef CONFIG_Q40
- KEYBD += q40_keyb.o
- SERIAL = serial.o
-endif
-
-ifdef CONFIG_APOLLO
- KEYBD += dn_keyb.o
-endif
-
-ifeq ($(ARCH),parisc)
- ifdef CONFIG_GSC_PS2
- KEYBD = hp_psaux.o hp_keyb.o
- else
- KEYBD =
- endif
- ifdef CONFIG_PDC_CONSOLE
- CONSOLE += pdc_console.o
- endif
-endif
-
-ifeq ($(ARCH),arm)
- ifneq ($(CONFIG_PC_KEYMAP),y)
- KEYMAP =
- endif
- ifneq ($(CONFIG_PC_KEYB),y)
- KEYBD =
- endif
-endif
-
-ifeq ($(ARCH),sh)
- KEYMAP =
- KEYBD =
- CONSOLE =
- ifeq ($(CONFIG_SH_HP600),y)
- KEYMAP = defkeymap.o
- KEYBD = scan_keyb.o hp600_keyb.o
- CONSOLE = console.o
- endif
- ifeq ($(CONFIG_SH_DMIDA),y)
- # DMIDA does not connect the HD64465 PS/2 keyboard port
- # but we allow for USB keyboards to be plugged in.
- KEYMAP = defkeymap.o
- KEYBD = # hd64465_keyb.o pc_keyb.o
- CONSOLE = console.o
- endif
- ifeq ($(CONFIG_SH_EC3104),y)
- KEYMAP = defkeymap.o
- KEYBD = ec3104_keyb.o
- CONSOLE = console.o
- endif
- ifeq ($(CONFIG_SH_DREAMCAST),y)
- KEYMAP = defkeymap.o
- KEYBD =
- CONSOLE = console.o
- endif
-endif
-
-ifeq ($(CONFIG_DECSTATION),y)
- KEYMAP =
- KEYBD =
- SERIAL = decserial.o
-endif
-
-ifeq ($(CONFIG_BAGET_MIPS),y)
- KEYBD =
- SERIAL =
-endif
-
-ifeq ($(CONFIG_NINO),y)
- SERIAL =
-endif
-
-ifneq ($(CONFIG_SUN_SERIAL),)
- SERIAL =
-endif
-
-ifeq ($(CONFIG_QTRONIX_KEYBOARD),y)
- KEYBD = qtronix.o
- KEYMAP = qtronixmap.o
-endif
-
-ifeq ($(CONFIG_DUMMY_KEYB),y)
- KEYBD = dummy_keyb.o
-endif
-
-obj-$(CONFIG_VT) += vt.o vc_screen.o consolemap.o consolemap_deftbl.o $(CONSOLE) selection.o
-
-ifeq ($(CONFIG_VT),)
- obj-$(CONFIG_DUMMY_CONSOLE) += $(KEYBD) dummy_console.o
-endif
-
-obj-$(CONFIG_SERIAL) += $(SERIAL)
-obj-$(CONFIG_SERIAL_HCDP) += hcdp_serial.o
-obj-$(CONFIG_SERIAL_21285) += serial_21285.o
-obj-$(CONFIG_SERIAL_SA1100) += serial_sa1100.o
-obj-$(CONFIG_SERIAL_AMBA) += serial_amba.o
-obj-$(CONFIG_TS_AU1000_ADS7846) += au1000_ts.o
-
-ifndef CONFIG_SUN_KEYBOARD
- obj-$(CONFIG_VT) += keyboard.o $(KEYMAP) $(KEYBD)
-else
- obj-$(CONFIG_PCI) += keyboard.o $(KEYMAP)
-endif
-
-obj-$(CONFIG_HIL) += hp_keyb.o
-obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
-obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
-obj-$(CONFIG_ROCKETPORT) += rocket.o
-obj-$(CONFIG_MOXA_SMARTIO) += mxser.o
-obj-$(CONFIG_MOXA_INTELLIO) += moxa.o
-obj-$(CONFIG_DIGI) += pcxx.o
-obj-$(CONFIG_DIGIEPCA) += epca.o
-obj-$(CONFIG_CYCLADES) += cyclades.o
-obj-$(CONFIG_STALLION) += stallion.o
-obj-$(CONFIG_ISTALLION) += istallion.o
-obj-$(CONFIG_SIBYTE_SB1250_DUART) += sb1250_duart.o
-obj-$(CONFIG_COMPUTONE) += ip2.o ip2main.o
-obj-$(CONFIG_RISCOM8) += riscom8.o
-obj-$(CONFIG_ISI) += isicom.o
-obj-$(CONFIG_ESPSERIAL) += esp.o
-obj-$(CONFIG_SYNCLINK) += synclink.o
-obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o
-obj-$(CONFIG_N_HDLC) += n_hdlc.o
-obj-$(CONFIG_SPECIALIX) += specialix.o
-obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
-obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o
-obj-$(CONFIG_SX) += sx.o generic_serial.o
-obj-$(CONFIG_RIO) += rio/rio.o generic_serial.o
-obj-$(CONFIG_SH_SCI) += sh-sci.o generic_serial.o
-obj-$(CONFIG_SERIAL167) += serial167.o
-obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o
-obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o
-obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
-obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o
-obj-$(CONFIG_SERIAL_TX3912) += generic_serial.o serial_tx3912.o
-obj-$(CONFIG_TXX927_SERIAL) += serial_txx927.o
-
-subdir-$(CONFIG_RIO) += rio
-subdir-$(CONFIG_INPUT) += joystick
-
-obj-$(CONFIG_ATIXL_BUSMOUSE) += atixlmouse.o
-obj-$(CONFIG_LOGIBUSMOUSE) += logibusmouse.o
-obj-$(CONFIG_PRINTER) += lp.o
-obj-$(CONFIG_TIPAR) += tipar.o
-
-ifeq ($(CONFIG_INPUT),y)
-obj-y += joystick/js.o
-endif
-
-obj-$(CONFIG_BUSMOUSE) += busmouse.o
-obj-$(CONFIG_DTLK) += dtlk.o
-obj-$(CONFIG_R3964) += n_r3964.o
-obj-$(CONFIG_APPLICOM) += applicom.o
-obj-$(CONFIG_SONYPI) += sonypi.o
-obj-$(CONFIG_MS_BUSMOUSE) += msbusmouse.o
-obj-$(CONFIG_82C710_MOUSE) += qpmouse.o
-obj-$(CONFIG_AMIGAMOUSE) += amigamouse.o
-obj-$(CONFIG_ATARIMOUSE) += atarimouse.o
-obj-$(CONFIG_ADBMOUSE) += adbmouse.o
-obj-$(CONFIG_PC110_PAD) += pc110pad.o
-obj-$(CONFIG_MK712_MOUSE) += mk712.o
-obj-$(CONFIG_RTC) += rtc.o
-obj-$(CONFIG_EFI_RTC) += efirtc.o
-ifeq ($(CONFIG_PPC),)
- obj-$(CONFIG_NVRAM) += nvram.o
-endif
-obj-$(CONFIG_TOSHIBA) += toshiba.o
-obj-$(CONFIG_I8K) += i8k.o
-obj-$(CONFIG_DS1620) += ds1620.o
-obj-$(CONFIG_INTEL_RNG) += i810_rng.o
-obj-$(CONFIG_AMD_RNG) += amd768_rng.o
-obj-$(CONFIG_AMD_PM768) += amd76x_pm.o
-
-obj-$(CONFIG_ITE_GPIO) += ite_gpio.o
-obj-$(CONFIG_AU1000_GPIO) += au1000_gpio.o
-obj-$(CONFIG_COBALT_LCD) += lcd.o
-
-obj-$(CONFIG_QIC02_TAPE) += tpqic02.o
-
-subdir-$(CONFIG_FTAPE) += ftape
-subdir-$(CONFIG_DRM_OLD) += drm-4.0
-subdir-$(CONFIG_DRM_NEW) += drm
-subdir-$(CONFIG_PCMCIA) += pcmcia
-subdir-$(CONFIG_AGP) += agp
-
-ifeq ($(CONFIG_FTAPE),y)
-obj-y += ftape/ftape.o
-endif
-
-obj-$(CONFIG_H8) += h8.o
-obj-$(CONFIG_PPDEV) += ppdev.o
-obj-$(CONFIG_DZ) += dz.o
-obj-$(CONFIG_NWBUTTON) += nwbutton.o
-obj-$(CONFIG_NWFLASH) += nwflash.o
-obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o scx200.o
-
-# Only one watchdog can succeed. We probe the hardware watchdog
-# drivers first, then the softdog driver. This means if your hardware
-# watchdog dies or is 'borrowed' for some reason the software watchdog
-# still gives you some cover.
-
-obj-$(CONFIG_PCWATCHDOG) += pcwd.o
-obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
-obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
-obj-$(CONFIG_IB700_WDT) += ib700wdt.o
-obj-$(CONFIG_MIXCOMWD) += mixcomwd.o
-obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
-obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
-obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
-obj-$(CONFIG_WDT) += wdt.o
-obj-$(CONFIG_WDTPCI) += wdt_pci.o
-obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
-obj-$(CONFIG_977_WATCHDOG) += wdt977.o
-obj-$(CONFIG_I810_TCO) += i810-tco.o
-obj-$(CONFIG_MACHZ_WDT) += machzwd.o
-obj-$(CONFIG_SH_WDT) += shwdt.o
-obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
-obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
-#obj-$(CONFIG_ALIM1535_WDT) += alim1535d_wdt.o
-obj-$(CONFIG_INDYDOG) += indydog.o
-obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
-obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
-obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
-obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
-obj-$(CONFIG_AMD7XX_TCO) += amd7xx_tco.o
-
-subdir-$(CONFIG_MWAVE) += mwave
-ifeq ($(CONFIG_MWAVE),y)
- obj-y += mwave/mwave.o
-endif
-
-subdir-$(CONFIG_IPMI_HANDLER) += ipmi
-ifeq ($(CONFIG_IPMI_HANDLER),y)
- obj-y += ipmi/ipmi.o
-endif
-
-include $(TOPDIR)/Rules.make
-
-fastdep:
-
-conmakehash: conmakehash.c
- $(HOSTCC) $(HOSTCFLAGS) -o conmakehash conmakehash.c
-
-consolemap_deftbl.c: $(FONTMAPFILE) conmakehash
- ./conmakehash $(FONTMAPFILE) > consolemap_deftbl.c
-
-consolemap_deftbl.o: consolemap_deftbl.c $(TOPDIR)/include/linux/types.h
-
-.DELETE_ON_ERROR:
-
-defkeymap.c: defkeymap.map
- set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
-
-qtronixmap.c: qtronixmap.map
- set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
diff --git a/xenolinux-2.4.21-pre4-sparse/drivers/char/tty_io.c b/xenolinux-2.4.21-pre4-sparse/drivers/char/tty_io.c
index 8f7e08bc94..62c6c09740 100644
--- a/xenolinux-2.4.21-pre4-sparse/drivers/char/tty_io.c
+++ b/xenolinux-2.4.21-pre4-sparse/drivers/char/tty_io.c
@@ -102,8 +102,8 @@
#include <linux/kmod.h>
-#ifdef CONFIG_XENO
-extern void xeno_console_init(void);
+#ifdef CONFIG_XEN_CONSOLE
+extern void xen_console_init(void);
#endif
#ifdef CONFIG_VT
@@ -817,8 +817,9 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
int idx;
driver = get_tty_driver(device);
- if (!driver)
- return -ENODEV;
+ if (!driver) {
+ return -ENODEV;
+ }
idx = MINOR(device) - driver->minor_start;
@@ -2186,7 +2187,7 @@ int tty_unregister_driver(struct tty_driver *driver)
*/
void __init console_init(void)
{
- /* Setup the default TTY line discipline. */
+ /* Setup the default TTY line discipline. */
memset(ldiscs, 0, sizeof(ldiscs));
(void) tty_register_ldisc(N_TTY, &tty_ldisc_N_TTY);
@@ -2209,9 +2210,14 @@ void __init console_init(void)
#ifdef CONFIG_EARLY_PRINTK
disable_early_printk();
#endif
+
#ifdef CONFIG_VT
con_init();
#endif
+
+#ifdef CONFIG_XEN_CONSOLE
+ xen_console_init();
+#endif
#ifdef CONFIG_AU1000_SERIAL_CONSOLE
au1000_serial_console_init();
#endif
@@ -2326,9 +2332,6 @@ void __init tty_init(void)
/* console calls tty_register_driver() before kmalloc() works.
* Thus, we can't devfs_register() then. Do so now, instead.
*/
-#ifdef CONFIG_XENO
- xeno_console_init();
-#endif
#ifdef CONFIG_VT
con_init_devfs();
#endif
@@ -2358,11 +2361,6 @@ void __init tty_init(void)
panic("Couldn't register /dev/tty0 driver\n");
kbd_init();
-#else
- // the below is a dodgy hack to allow keyboard/mouse support without the console support, along with the file "dummy_console.c"
-#ifdef CONFIG_DUMMY_CONSOLE
- kbd_init();
-#endif
#endif
#ifdef CONFIG_ESPSERIAL /* init ESP before rs, so rs doesn't see the port */