diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1997-07-31 23:06:33 +0000 |
---|---|---|
committer | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1997-07-31 23:06:33 +0000 |
commit | e4ac0a23608326673055e4f864a554ee34559250 (patch) | |
tree | d99d4ec5fa3f3444b8715adebcf4880120dc1a0f | |
parent | 9765588f1533bde5f6af8056525368b301d72989 (diff) |
shared memory input queue changes:
- make keyboard forward events to the streams keyboard
module for delivery to the shmiq.
- Fixes to make the graphics streams driver use dentries
(this is the reason Alex's compile failed).
- Major/misc numbers that were assigned by HPA for the
streamable devices.
- keyboard streams device.
- working shmiq framework for the keyboard.
What needs to be done:
- Fix the mouse driver, did someone ever got any
information out from /dev/psaux on the SGI port?
- Figure out why changes made in the kernel side to the
SHMIQ are not always seen by the user space.
-rw-r--r-- | arch/mips/config.in | 1 | ||||
-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 | ||||
-rw-r--r-- | include/asm-mips/gfx.h | 2 | ||||
-rw-r--r-- | include/linux/major.h | 1 | ||||
-rw-r--r-- | include/linux/miscdevice.h | 8 |
9 files changed, 124 insertions, 13 deletions
diff --git a/arch/mips/config.in b/arch/mips/config.in index 642eac1aa..22aff787f 100644 --- a/arch/mips/config.in +++ b/arch/mips/config.in @@ -72,6 +72,7 @@ else fi if [ "$CONFIG_CPU_LITTLE_ENDIAN" = "n" ]; then define_bool CONFIG_BINFMT_IRIX y + define_bool CONFIG_FORWARD_KEYBOARD y fi define_bool CONFIG_BINFMT_ELF y define_bool CONFIG_BINFMT_AOUT n 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); } diff --git a/include/asm-mips/gfx.h b/include/asm-mips/gfx.h index b5d8c7ac9..cf4c9d8ad 100644 --- a/include/asm-mips/gfx.h +++ b/include/asm-mips/gfx.h @@ -41,4 +41,6 @@ struct gfx_attach_board_args { #ifdef __KERNEL__ /* umap.c */ extern void remove_mapping (struct task_struct *, unsigned long, unsigned long); +extern void *vmalloc_uncached (unsigned long size); +extern int vmap_page_range (unsigned long from, unsigned long size, unsigned long vaddr); #endif diff --git a/include/linux/major.h b/include/linux/major.h index 6e785af86..d72e6c2be 100644 --- a/include/linux/major.h +++ b/include/linux/major.h @@ -58,6 +58,7 @@ #define ACSI_MAJOR 28 #define AZTECH_CDROM_MAJOR 29 #define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */ +#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ #define CM206_CDROM_MAJOR 32 #define IDE2_MAJOR 33 #define IDE3_MAJOR 34 diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 8f4bde9ab..6ea9d896e 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -13,9 +13,11 @@ #define SUN_OPENPROM_MINOR 139 #define MISC_DYNAMIC_MINOR 255 -#define SGI_GRAPHICS_MINOR 20 -#define SGI_OPENGL_MINOR 21 -#define SGI_GFX_MINOR 22 +#define SGI_GRAPHICS_MINOR 146 +#define SGI_OPENGL_MINOR 147 +#define SGI_GFX_MINOR 148 +#define SGI_STREAMS_MOUSE 149 +#define SGI_STREAMS_KEYBOARD 150 extern int misc_init(void); |