diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/keyboard.c | 16 | ||||
-rw-r--r-- | drivers/sgi/char/Makefile | 2 | ||||
-rw-r--r-- | drivers/sgi/char/graphics.c | 21 | ||||
-rw-r--r-- | drivers/sgi/char/graphics.h | 2 | ||||
-rw-r--r-- | drivers/sgi/char/streamable.c | 84 |
5 files changed, 115 insertions, 10 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 66523964a..d29653c8a 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -312,15 +312,31 @@ void handle_scancode(unsigned char scancode) } } +#ifdef CONFIG_FORWARD_KEYBOARD +extern int forward_chars; static void put_queue(int ch) { + if (forward_chars == fg_console+1){ + kbd_forward_char (ch); + } else { + wake_up(&keypress_wait); + if (tty) { + tty_insert_flip_char(tty, ch, 0); + tty_schedule_flip(tty); + } + } +} +#else +static void put_queue(int ch) +{ wake_up(&keypress_wait); if (tty) { tty_insert_flip_char(tty, ch, 0); tty_schedule_flip(tty); } } +#endif static void puts_queue(char *cp) { diff --git a/drivers/sgi/char/Makefile b/drivers/sgi/char/Makefile index d5a0110df..123b2c90a 100644 --- a/drivers/sgi/char/Makefile +++ b/drivers/sgi/char/Makefile @@ -9,7 +9,7 @@ O_TARGET := sgichar.o O_OBJS := graphics.o streamable.o newport.o cons_newport.o sgicons.o \ - vga_font.o rrm.o + vga_font.o rrm.o shmiq.o ifeq ($(CONFIG_SGI_SERIAL),y) O_OBJS += sgiserial.o diff --git a/drivers/sgi/char/graphics.c b/drivers/sgi/char/graphics.c index a454eda6f..14390c40f 100644 --- a/drivers/sgi/char/graphics.c +++ b/drivers/sgi/char/graphics.c @@ -165,7 +165,7 @@ unsigned long sgi_graphics_nopage (struct vm_area_struct *vma, unsigned long address, int write_access) { unsigned long page; - int board = MINOR (vma->vm_inode->i_rdev); + int board = MINOR (vma->vm_dentry->d_inode->i_rdev); printk ("Got a page fault for board %d\n", board); @@ -222,7 +222,7 @@ sgi_graphics_mmap (struct inode *inode, struct file *file, struct vm_area_struct vma->vm_page_prot = PAGE_USERIO; /* final setup */ - vma->vm_inode = inode; + vma->vm_dentry = dget (file->f_dentry); atomic_inc (&inode->i_count); return 0; } @@ -262,12 +262,23 @@ static struct miscdevice dev_opengl = { SGI_OPENGL_MINOR, "sgi-opengl", &sgi_graphics_fops }; +/* This is called later from the misc-init routine */ +void +gfx_register (void) +{ + misc_register (&dev_graphics); + misc_register (&dev_opengl); +} + void gfx_init (const char **name) { struct console_ops *console; struct graphics_ops *g; + printk ("GFX INIT: "); + shmiq_init (); + if ((g = newport_probe (boards, name)) != 0){ cards [boards] = *g; graphics_ops_post_init (boards); @@ -283,10 +294,4 @@ gfx_init (const char **name) } } -void -gfx_register (void) -{ - misc_register (&dev_graphics); - misc_register (&dev_opengl); -} diff --git a/drivers/sgi/char/graphics.h b/drivers/sgi/char/graphics.h index a0477df1e..35c4f4f9a 100644 --- a/drivers/sgi/char/graphics.h +++ b/drivers/sgi/char/graphics.h @@ -21,3 +21,5 @@ struct graphics_ops { void (*g_restore_context)(void); }; +void shmiq_init (void); +void streamable_init (void); diff --git a/drivers/sgi/char/streamable.c b/drivers/sgi/char/streamable.c index 6d2282917..b241fce56 100644 --- a/drivers/sgi/char/streamable.c +++ b/drivers/sgi/char/streamable.c @@ -10,6 +10,23 @@ #include <linux/fs.h> #include <linux/miscdevice.h> #include <linux/sched.h> +#include <asm/shmiq.h> +#include "graphics.h" + +#include <asm/keyboard.h> +#include <linux/kbd_kern.h> +#include <linux/vt_kern.h> + +extern struct kbd_struct kbd_table [MAX_NR_CONSOLES]; + +/* console number where forwarding is enabled */ +int forward_chars; + +/* To which shmiq this keyboard is assigned */ +int kbd_assigned_device; + +/* previous kbd_mode for the forward_chars terminal */ +int kbd_prev_mode; static int sgi_gfx_open (struct inode *inode, struct file *file) @@ -32,6 +49,39 @@ sgi_gfx_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigne return -EINVAL; } +static int +sgi_keyb_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +{ + + /* IRIX calls I_PUSH on the opened device, go figure */ + if (cmd == I_PUSH) + return 0; + + if (cmd == SHMIQ_ON){ + kbd_assigned_device = arg; + forward_chars = fg_console + 1; + kbd_prev_mode = kbd_table [fg_console].kbdmode; + + kbd_table [fg_console].kbdmode = VC_RAW; + } else if (cmd == SHMIQ_OFF && forward_chars){ + kbd_table [forward_chars-1].kbdmode = kbd_prev_mode; + forward_chars = 0; + } else + return -EINVAL; + return 0; +} + +void +kbd_forward_char (int ch) +{ + static struct shmqevent ev; + + ev.data.flags = (ch & 0200) ? 0 : 1; + ev.data.which = ch; + ev.data.device = kbd_assigned_device + 0x11; + shmiq_push_event (&ev); +} + struct file_operations sgi_gfx_fops = { NULL, /* llseek */ NULL, /* read */ @@ -48,13 +98,45 @@ struct file_operations sgi_gfx_fops = { NULL /* lock */ }; -/* dev gfx */ +/* /dev/gfx */ static struct miscdevice dev_gfx = { SGI_GFX_MINOR, "sgi-gfx", &sgi_gfx_fops }; +static int +sgi_keyb_open (struct inode *inode, struct file *file) +{ + /* Nothing, but required by the misc driver */ + return 0; +} + +struct file_operations sgi_keyb_fops = { + NULL, /* llseek */ + NULL, /* read */ + NULL, /* write */ + NULL, /* readdir */ + NULL, /* poll */ + sgi_keyb_ioctl, /* ioctl */ + NULL, /* mmap */ + sgi_keyb_open, /* open */ + NULL, /* release */ + NULL, /* fsync */ + NULL, /* check_media_change */ + NULL, /* revalidate */ + NULL /* lock */ +}; + +/* /dev/input/keyboard */ +static struct miscdevice dev_input_keyboard = { + SGI_STREAMS_KEYBOARD, "streams-keyboard", &sgi_keyb_fops +}; + void streamable_init (void) { + printk ("streamable misc devices registered (keyb:%d, gfx:%d)\n", + SGI_STREAMS_KEYBOARD, SGI_GFX_MINOR); + misc_register (&dev_gfx); + misc_register (&dev_input_keyboard); } |