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 /drivers/sgi/char | |
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.
Diffstat (limited to 'drivers/sgi/char')
-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 |
4 files changed, 99 insertions, 10 deletions
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); } |