summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Config.in1
-rw-r--r--drivers/char/Makefile10
-rw-r--r--drivers/char/fbmem.c3
-rw-r--r--drivers/char/keyboard.c5
-rw-r--r--drivers/char/lp.c11
-rw-r--r--drivers/char/mem.c4
-rw-r--r--drivers/char/misc.c4
-rw-r--r--drivers/char/pc110pad.c4
-rw-r--r--drivers/char/pc110pad.h2
-rw-r--r--drivers/char/pc_keyb.c74
-rw-r--r--drivers/char/pc_keyb.h6
-rw-r--r--drivers/char/psaux.c114
-rw-r--r--drivers/char/sysrq.c48
-rw-r--r--drivers/char/tty_io.c4
-rw-r--r--drivers/char/vga.c22
15 files changed, 187 insertions, 125 deletions
diff --git a/drivers/char/Config.in b/drivers/char/Config.in
index 0ef43d101..65407caf6 100644
--- a/drivers/char/Config.in
+++ b/drivers/char/Config.in
@@ -99,5 +99,6 @@ if [ "$CONFIG_WATCHDOG" != "n" ]; then
tristate ' Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG
fi
bool 'Enhanced Real Time Clock Support' CONFIG_RTC
+tristate '/dev/nvram support' CONFIG_NVRAM
tristate 'PC joystick support' CONFIG_JOYSTICK
endmenu
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 18d50bf74..ad3664204 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -267,6 +267,16 @@ M = y
L_OBJS += rtc.o
endif
+ifeq ($(CONFIG_NVRAM),y)
+M = y
+L_OBJS += nvram.o
+else
+ ifeq ($(CONFIG_NVRAM),m)
+ MM = m
+ M_OBJS += nvram.o
+ endif
+endif
+
ifeq ($(CONFIG_QIC02_TAPE),y)
L_OBJS += tpqic02.o
else
diff --git a/drivers/char/fbmem.c b/drivers/char/fbmem.c
index 7db3b5dba..4a5bea195 100644
--- a/drivers/char/fbmem.c
+++ b/drivers/char/fbmem.c
@@ -221,8 +221,7 @@ fb_mmap(struct inode *inode, struct file *file, struct vm_area_struct * vma)
if (remap_page_range(vma->vm_start, vma->vm_offset,
vma->vm_end - vma->vm_start, vma->vm_page_prot))
return -EAGAIN;
- vma->vm_inode = inode;
- atomic_inc(&inode->i_count);
+ vma->vm_dentry = dget(file->f_dentry);
return 0;
}
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index d29653c8a..932578806 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -37,6 +37,7 @@
#include <linux/kbd_diacr.h>
#include <linux/vt_kern.h>
#include <linux/kbd_ll.h>
+#include <linux/sysrq.h>
#define SIZE(x) (sizeof(x)/sizeof((x)[0]))
@@ -148,8 +149,6 @@ static unsigned char handle_diacr(unsigned char);
struct pt_regs * kbd_pt_regs;
#ifdef CONFIG_MAGIC_SYSRQ
-#define SYSRQ_KEY 0x54
-extern void handle_sysrq(int, struct pt_regs *, struct kbd_struct *, struct tty_struct *);
static int sysrq_pressed;
#endif
@@ -239,7 +238,7 @@ void handle_scancode(unsigned char scancode)
return;
} else if (sysrq_pressed) {
if (!up_flag)
- handle_sysrq(keycode, kbd_pt_regs, kbd, tty);
+ handle_sysrq(kbd_sysrq_xlate[keycode], kbd_pt_regs, kbd, tty);
return;
}
#endif
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index caf5b5ccf..59bb0a0a2 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -500,7 +500,7 @@ static int lp_release(struct inode * inode, struct file * file)
unsigned int minor = MINOR(inode->i_rdev);
unsigned int irq;
- if ((irq = LP_IRQ(minor))) {
+ if ((irq = LP_IRQ(minor)) != PARPORT_IRQ_NONE) {
kfree_s(lp_table[minor].lp_buffer, LP_BUFFER_SIZE);
lp_table[minor].lp_buffer = NULL;
}
@@ -642,7 +642,7 @@ void lp_setup(char *str, int *ints)
parport[0] = -3;
} else {
if (ints[0] == 0 || ints[1] == 0) {
- /* disable driver on "parport=" or "parport=0" */
+ /* disable driver on "lp=" or "lp=0" */
parport[0] = -2;
} else {
printk(KERN_WARNING "warning: 'lp=0x%x' is deprecated, ignored\n", ints[1]);
@@ -652,19 +652,18 @@ void lp_setup(char *str, int *ints)
#endif
-int lp_wakeup(void *ref)
+void lp_wakeup(void *ref)
{
struct lp_struct *lp_dev = (struct lp_struct *) ref;
if (!lp_dev->lp_wait_q)
- return 1; /* Wake up whom? */
+ return; /* Wake up whom? */
/* Claim the Parport */
if (parport_claim(lp_dev->dev))
- return 1; /* Shouldn't happen */
+ return; /* Shouldn't happen */
wake_up(&lp_dev->lp_wait_q);
- return 0;
}
static int inline lp_searchfor(int list[], int a)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 063503595..6e9eb5766 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -133,6 +133,10 @@ static int mmap_mem(struct inode * inode, struct file * file, struct vm_area_str
if (x86 > 3 && offset >= __pa(high_memory))
pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
#endif
+#ifdef __powerpc__
+ if (offset >= __pa(high_memory))
+ pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE | _PAGE_GUARDED;
+#endif
if (remap_page_range(vma->vm_start, offset, vma->vm_end - vma->vm_start, vma->vm_page_prot))
return -EAGAIN;
vma->vm_dentry = dget(file->f_dentry);
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 6262792b6..4495f881d 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -76,6 +76,7 @@ extern void wdt_init(void);
extern void pcwatchdog_init(void);
extern int rtc_init(void);
extern int dsp56k_init(void);
+extern int nvram_init(void);
#ifdef CONFIG_PROC_FS
static int misc_read_proc(char *buf, char **start, off_t offset,
@@ -244,6 +245,9 @@ __initfunc(int misc_init(void))
#ifdef CONFIG_ATARI_DSP56K
dsp56k_init();
#endif
+#ifdef CONFIG_NVRAM
+ nvram_init();
+#endif
#ifdef CONFIG_SGI_GRAPHICS
gfx_register ();
streamable_init ();
diff --git a/drivers/char/pc110pad.c b/drivers/char/pc110pad.c
index 7a6b8cde0..d9c5ac453 100644
--- a/drivers/char/pc110pad.c
+++ b/drivers/char/pc110pad.c
@@ -492,7 +492,7 @@ static int close_pad(struct inode * inode, struct file * file)
{
fasync_pad(inode, file, 0);
if (--active)
- return;
+ return 0;
outb(0x30, current_params.io+2); /* switch off digitiser */
MOD_DEC_USE_COUNT;
return 0;
@@ -640,7 +640,7 @@ static struct miscdevice pc110_pad = {
};
-static int pc110pad_init(void)
+int pc110pad_init(void)
{
current_params = default_params;
diff --git a/drivers/char/pc110pad.h b/drivers/char/pc110pad.h
index 56d8d82e0..d0ea0b0d3 100644
--- a/drivers/char/pc110pad.h
+++ b/drivers/char/pc110pad.h
@@ -26,6 +26,6 @@ struct pc110pad_params {
#define PC110PAD_IOCTL_TYPE 0x9a
#define PC110PADIOCGETP _IOR(PC110PAD_IOCTL_TYPE, 0, struct pc110pad_params)
-#define PC110PADIOCSETP _IOR(PC110PAD_IOCTL_TYPE, 1, struct pc110pad_params)
+#define PC110PADIOCSETP _IOW(PC110PAD_IOCTL_TYPE, 1, struct pc110pad_params)
#endif /* _PC110PAD_H */
diff --git a/drivers/char/pc_keyb.c b/drivers/char/pc_keyb.c
index fd1c8e862..866a4170f 100644
--- a/drivers/char/pc_keyb.c
+++ b/drivers/char/pc_keyb.c
@@ -7,6 +7,8 @@
* Major cleanup by Martin Mares, May 1997
*/
+#include <linux/config.h>
+
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
@@ -25,21 +27,38 @@
#include "pc_keyb.h"
+/* Simple translation table for the SysRq keys */
+
+#ifdef CONFIG_MAGIC_SYSRQ
+unsigned char pckbd_sysrq_xlate[128] =
+ "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
+ "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
+ "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
+ "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
+ "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
+ "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
+ "\r\000/"; /* 0x60 - 0x6f */
+#endif
+
/*
* In case we run on a non-x86 hardware we need to initialize both the keyboard
* controller and the keyboard. On a x86, the BIOS will already have initialized
* them.
*/
+#ifndef __i386__
+#define INIT_KBD
+#endif
+
#ifdef INIT_KBD
__initfunc(static int kbd_wait_for_input(void))
{
- int n;
- int status, data;
+ int n;
+ int status, data;
+ unsigned long start = jiffies;
- n = KBD_TIMEOUT;
- do {
+ do {
status = kbd_read_status();
/*
* Wait for input data to become available. This bit will
@@ -62,7 +81,7 @@ __initfunc(static int kbd_wait_for_input(void))
continue;
}
return (data & 0xff);
- } while (--n);
+ } while (jiffies - start < KBD_INIT_TIMEOUT);
return -1; /* timed-out if fell through to here... */
}
@@ -165,12 +184,11 @@ __initfunc(static char *initialize_kbd2(void))
__initfunc(void initialize_kbd(void))
{
- unsigned long flags;
char *msg;
- save_flags(flags); cli();
+ disable_irq(KEYBOARD_IRQ);
msg = initialize_kbd2();
- restore_flags(flags);
+ enable_irq(KEYBOARD_IRQ);
if (msg)
printk(KERN_WARNING "initialize_kbd: %s\n", msg);
@@ -191,12 +209,15 @@ static volatile unsigned char resend = 0;
static inline void kb_wait(void)
{
- int i;
+ unsigned long start = jiffies;
- for (i=0; i<KBD_TIMEOUT; i++)
+ do {
if (! (kbd_read_status() & KBD_STAT_IBF))
return;
+ } while (jiffies - start < KBC_TIMEOUT);
+#ifdef KBD_REPORT_TIMEOUTS
printk(KERN_WARNING "Keyboard timed out\n");
+#endif
}
/*
@@ -374,7 +395,7 @@ static int do_acknowledge(unsigned char scancode)
}
if (scancode == 0) {
#ifdef KBD_REPORT_ERR
- printk(KERN_INFO "keyboard buffer overflow\n");
+ printk(KERN_INFO "Keyboard buffer overflow\n");
#endif
prev_scancode = 0;
return 0;
@@ -390,7 +411,7 @@ int pckbd_pretranslate(unsigned char scancode, char raw_mode)
#ifndef KBD_IS_FOCUS_9000
#ifdef KBD_REPORT_ERR
if (!raw_mode)
- printk(KERN_DEBUG "keyboard error\n");
+ printk(KERN_DEBUG "Keyboard error\n");
#endif
#endif
prev_scancode = 0;
@@ -505,15 +526,17 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned char scancode;
/* mouse data? */
- if (status & kbd_read_mask & KBD_STAT_MOUSE_OBF)
+ if (status & kbd_read_mask & KBD_STAT_MOUSE_OBF){
+ printk ("MOUSE!\n");
break;
+ }
scancode = kbd_read_input();
if ((status & KBD_STAT_OBF) && do_acknowledge(scancode))
handle_scancode(scancode);
status = kbd_read_status();
- } while (status & (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF));
+ } while (status & KBD_STAT_OBF);
mark_bh(KEYBOARD_BH);
enable_keyboard();
@@ -527,7 +550,7 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static int send_data(unsigned char data)
{
int retries = 3;
- int i;
+ unsigned long start;
do {
kb_wait();
@@ -536,16 +559,21 @@ static int send_data(unsigned char data)
reply_expected = 1;
kbd_write_output(data);
kbd_pause();
- for(i=0; i<0x200000; i++) {
- kbd_read_status(); /* just as a delay */
+ start = jiffies;
+ do {
if (acknowledge)
return 1;
- if (resend)
- break;
- }
- if (!resend)
- return 0;
+ if (jiffies - start >= KBD_TIMEOUT) {
+#ifdef KBD_REPORT_TIMEOUTS
+ printk(KERN_WARNING "Keyboard timeout\n");
+#endif
+ return 0;
+ }
+ } while (!resend);
} while (retries-- > 0);
+#ifdef KBD_REPORT_TIMEOUTS
+ printk(KERN_WARNING "keyboard: Too many NACKs -- noisy kbd cable?\n");
+#endif
return 0;
}
@@ -557,7 +585,7 @@ void pckbd_leds(unsigned char leds)
__initfunc(void pckbd_init_hw(void))
{
- request_irq(KEYBOARD_IRQ, keyboard_interrupt, 0, "keyboard", NULL);
+ request_irq(KEYBOARD_IRQ, keyboard_interrupt, 0, "keyboard-aaa", NULL);
keyboard_setup();
#ifdef INIT_KBD
initialize_kbd();
diff --git a/drivers/char/pc_keyb.h b/drivers/char/pc_keyb.h
index f12ddab08..ffbfc49e2 100644
--- a/drivers/char/pc_keyb.h
+++ b/drivers/char/pc_keyb.h
@@ -12,8 +12,12 @@
#define KBD_REPORT_ERR /* Report keyboard errors */
#define KBD_REPORT_UNKN /* Report unknown scan codes */
+#define KBD_REPORT_TIMEOUTS /* Report keyboard timeouts */
#undef KBD_IS_FOCUS_9000 /* We have the brain-damaged FOCUS-9000 keyboard */
-#define KBD_TIMEOUT 0x100000 /* Timeout for sending of commands */
+
+#define KBD_INIT_TIMEOUT HZ /* Timeout for initializing the keyboard */
+#define KBC_TIMEOUT (HZ/4) /* Timeout for sending to keyboard controller */
+#define KBD_TIMEOUT (HZ/4) /* Timeout for keyboard command acknowledge */
/*
* Internal variables of the driver
diff --git a/drivers/char/psaux.c b/drivers/char/psaux.c
index d329a6883..78089e833 100644
--- a/drivers/char/psaux.c
+++ b/drivers/char/psaux.c
@@ -53,6 +53,7 @@
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/system.h>
+#include <asm/semaphore.h>
#include <linux/config.h>
@@ -143,25 +144,7 @@ static int poll_aux_status(void)
schedule();
retries++;
}
- return !(retries==MAX_RETRIES);
-}
-
-static int poll_aux_status_nosleep(void)
-{
- int retries = 0;
- unsigned char status;
-
- while ((kbd_read_status() & (KBD_STAT_IBF | KBD_STAT_OBF))
- && retries < 1000000) {
- status = kbd_read_status();
- kbd_pause();
- if ((status & AUX_STAT_OBF) == AUX_STAT_OBF) {
- kbd_read_input();
- kbd_pause();
- }
- retries++;
- }
- return !(retries == 1000000);
+ return (retries < MAX_RETRIES);
}
/*
@@ -181,18 +164,10 @@ static void aux_write_dev(int val)
*/
#ifdef INITIALIZE_DEVICE
-__initfunc(static void aux_write_dev_nosleep(int val))
-{
- poll_aux_status_nosleep();
- kbd_write_command(KBD_CCMD_WRITE_MOUSE);
- poll_aux_status_nosleep();
- kbd_write_output(val);
-}
-
__initfunc(static int aux_write_ack(int val))
{
- aux_write_dev_nosleep(val);
- poll_aux_status_nosleep();
+ aux_write_dev(val);
+ poll_aux_status();
if ((kbd_read_status() & AUX_STAT_OBF) == AUX_STAT_OBF)
{
@@ -215,6 +190,31 @@ static void aux_write_cmd(int val)
}
/*
+ * AUX handler critical section start and end.
+ *
+ * Only one process can be in the critical section and all keyboard sends are
+ * deferred as long as we're inside. This is necessary as we may sleep when
+ * waiting for the keyboard controller and other processes / BH's can
+ * preempt us. Please note that the input buffer must be flushed when
+ * aux_end_atomic() is called and the interrupt is no longer enabled as not
+ * doing so might cause the keyboard driver to ignore all incoming keystrokes.
+ */
+
+static struct semaphore aux_sema4 = MUTEX;
+
+static inline void aux_start_atomic(void)
+{
+ down(&aux_sema4);
+ disable_bh(KEYBOARD_BH);
+}
+
+static inline void aux_end_atomic(void)
+{
+ enable_bh(KEYBOARD_BH);
+ up(&aux_sema4);
+}
+
+/*
* Interrupt from the auxiliary device: a character
* is waiting in the keyboard/aux controller.
*/
@@ -273,14 +273,12 @@ static int release_aux(struct inode * inode, struct file * file)
fasync_aux(inode, file, 0);
if (--aux_count)
return 0;
- /* disable kbd bh to avoid mixing of cmd bytes */
- disable_bh(KEYBOARD_BH);
+ aux_start_atomic();
aux_write_cmd(AUX_INTS_OFF); /* Disable controller ints */
poll_aux_status();
kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* Disable Aux device */
poll_aux_status();
- /* reenable kbd bh */
- enable_bh(KEYBOARD_BH);
+ aux_end_atomic();
ps2_free_irq(inode);
MOD_DEC_USE_COUNT;
return 0;
@@ -291,27 +289,31 @@ static int open_aux(struct inode * inode, struct file * file)
{
if (!aux_present)
return -ENODEV;
- if (aux_count++)
+ aux_start_atomic();
+ if (aux_count++) {
+ aux_end_atomic();
return 0;
- if (!poll_aux_status()) {
+ }
+ if (!poll_aux_status()) { /* FIXME: Race condition */
aux_count--;
+ aux_end_atomic();
return -EBUSY;
}
queue->head = queue->tail = 0; /* Flush input queue */
if(ps2_request_irq()) {
aux_count--;
+ aux_end_atomic();
return -EBUSY;
}
MOD_INC_USE_COUNT;
- /* disable kbd bh to avoid mixing of cmd bytes */
- disable_bh(KEYBOARD_BH);
+
+
poll_aux_status();
kbd_write_command(KBD_CCMD_MOUSE_ENABLE); /* Enable Aux */
aux_write_dev(AUX_ENABLE_DEV); /* Enable aux device */
aux_write_cmd(AUX_INTS_ON); /* Enable controller ints */
poll_aux_status();
- /* reenable kbd bh */
- enable_bh(KEYBOARD_BH);
+ aux_end_atomic();
aux_ready = 0;
return 0;
@@ -329,9 +331,7 @@ static long write_aux(struct inode * inode, struct file * file,
if (count) {
int written = 0;
- /* disable kbd bh to avoid mixing of cmd bytes */
- disable_bh(KEYBOARD_BH);
-
+ aux_start_atomic();
do {
char c;
if (!poll_aux_status())
@@ -343,8 +343,7 @@ static long write_aux(struct inode * inode, struct file * file,
kbd_write_output(c);
written++;
} while (--count);
- /* reenable kbd bh */
- enable_bh(KEYBOARD_BH);
+ aux_end_atomic();
retval = -EIO;
if (written) {
retval = written;
@@ -628,11 +627,7 @@ __initfunc(int psaux_init(void))
psaux_fops.release = release_qp;
} else
#endif
-#if defined(CONFIG_SGI) && defined(CONFIG_PSMOUSE)
- if (1) {
-#else
if (aux_device_present == 0xaa) {
-#endif
printk(KERN_INFO "PS/2 auxiliary pointing device detected -- driver installed.\n");
aux_present = 1;
#ifdef CONFIG_VT
@@ -647,20 +642,33 @@ __initfunc(int psaux_init(void))
queue->head = queue->tail = 0;
queue->proc_list = NULL;
if (!qp_found) {
+ printk ("AUX--1\n");
+ aux_start_atomic();
#ifdef INITIALIZE_DEVICE
+ printk ("AUX--2\n");
kbd_write_command(AUX_ENABLE); /* Enable Aux */
aux_write_ack(AUX_SET_SAMPLE);
+ printk ("AUX--3\n");
aux_write_ack(100); /* 100 samples/sec */
aux_write_ack(AUX_SET_RES);
aux_write_ack(3); /* 8 counts per mm */
+ printk ("AUX--4\n");
aux_write_ack(AUX_SET_SCALE21); /* 2:1 scaling */
- poll_aux_status_nosleep();
+ poll_aux_status();
+ printk ("AUX--5\n");
#endif /* INITIALIZE_DEVICE */
+ printk ("AUX--6\n");
kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* Disable Aux device */
- poll_aux_status_nosleep();
- kbd_write_command(KBD_CCMD_WRITE_MODE);
- poll_aux_status_nosleep(); /* Disable interrupts */
- kbd_write_output(AUX_INTS_OFF); /* on the controller */
+ poll_aux_status();
+ printk ("AUX--7\n");
+ kbd_write_command(KBD_CCMD_WRITE_MODE); /* Disable controller interrupts */
+ kbd_pause ();
+ poll_aux_status();
+ printk ("AUX--8\n");
+ kbd_write_output (AUX_INTS_OFF);
+ kbd_pause ();
+ poll_aux_status();
+ aux_end_atomic();
}
return 0;
}
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 1e0e1a2a0..25396c3c1 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -1,6 +1,6 @@
/* -*- linux-c -*-
*
- * $Id: sysrq.c,v 1.1 1997/06/17 13:24:07 ralf Exp $
+ * $Id: sysrq.c,v 1.4 1997/07/17 11:54:15 mj Exp $
*
* Linux Magic System Request Key Hacks
*
@@ -63,72 +63,72 @@ void handle_sysrq(int key, struct pt_regs *pt_regs,
console_loglevel = 7;
printk(KERN_INFO "SysRq: ");
switch (key) {
- case 19: /* R -- Reset raw mode */
- kbd->kbdmode = VC_XLATE;
- printk("Keyboard mode set to XLATE\n");
+ case 'r': /* R -- Reset raw mode */
+ if (kbd) {
+ kbd->kbdmode = VC_XLATE;
+ printk("Keyboard mode set to XLATE\n");
+ }
break;
- case 30: /* A -- SAK */
+ case 'a': /* A -- SAK */
printk("SAK\n");
- do_SAK(tty);
+ if (tty)
+ do_SAK(tty);
reset_vc(fg_console);
break;
- case 48: /* B -- boot immediately */
+ case 'b': /* B -- boot immediately */
printk("Resetting\n");
machine_restart(NULL);
break;
#ifdef __sparc__
- case 35: /* H -- halt immediately */
+ case 'h': /* H -- halt immediately */
printk("Halting\n");
halt_now();
break;
#endif
#ifdef CONFIG_APM
- case 24: /* O -- power off */
+ case 'o': /* O -- power off */
printk("Power off\n");
apm_set_power_state(APM_STATE_OFF);
break;
#endif
- case 31: /* S -- emergency sync */
+ case 's': /* S -- emergency sync */
printk("Emergency Sync\n");
emergency_sync_scheduled = EMERG_SYNC;
wakeup_bdflush(0);
break;
- case 22: /* U -- emergency remount R/O */
+ case 'u': /* U -- emergency remount R/O */
printk("Emergency Remount R/O\n");
emergency_sync_scheduled = EMERG_REMOUNT;
wakeup_bdflush(0);
break;
- case 25: /* P -- show PC */
+ case 'p': /* P -- show PC */
printk("Show Regs\n");
if (pt_regs)
show_regs(pt_regs);
break;
- case 20: /* T -- show task info */
+ case 't': /* T -- show task info */
printk("Show State\n");
show_state();
break;
- case 50: /* M -- show memory info */
+ case 'm': /* M -- show memory info */
printk("Show Memory\n");
show_mem();
break;
- case 2 ... 11: /* 0-9 -- set console logging level */
- key--;
- if (key == 10)
- key = 0;
- orig_log_level = key;
- printk("Log level set to %d\n", key);
+ case '0' ... '9': /* 0-9 -- set console logging level */
+ orig_log_level = key - '0';
+ printk("Log level set to %d\n", orig_log_level);
break;
- case 18: /* E -- terminate all user processes */
+ case 'e': /* E -- terminate all user processes */
printk("Terminate All Tasks\n");
send_sig_all(SIGTERM, 0);
orig_log_level = 8; /* We probably have killed syslogd */
break;
- case 37: /* K -- kill all user processes */
+ case 'k': /* K -- kill all user processes */
printk("Kill All Tasks\n");
send_sig_all(SIGKILL, 0);
orig_log_level = 8;
break;
- case 38: /* L -- kill all processes including init */
+ case 'l': /* L -- kill all processes including init */
printk("Kill ALL Tasks (even init)\n");
send_sig_all(SIGKILL, 1);
orig_log_level = 8;
@@ -154,7 +154,7 @@ static void all_files_read_only(void) /* Kill write permissions of all files
struct file *file;
for (file = inuse_filps; file; file = file->f_next)
- if (file->f_inode && file->f_count && S_ISREG(file->f_inode->i_mode))
+ if (file->f_dentry && file->f_count && S_ISREG(file->f_dentry->d_inode->i_mode))
file->f_mode &= ~2;
}
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index d63578c55..4c6ecae22 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -688,7 +688,6 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
return -ENODEV;
idx = MINOR(device) - driver->minor_start;
- tty = driver->table[idx];
/*
* Check whether we need to acquire the tty semaphore to avoid
@@ -697,7 +696,8 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
down_tty_sem(idx);
/* check whether we're reopening an existing tty */
- if(tty) goto fast_track;
+ tty = driver->table[idx];
+ if (tty) goto fast_track;
/*
* First time open is complex, especially for PTY devices.
diff --git a/drivers/char/vga.c b/drivers/char/vga.c
index afce24c98..c3fee1ae7 100644
--- a/drivers/char/vga.c
+++ b/drivers/char/vga.c
@@ -84,6 +84,12 @@ unsigned long video_port_base;
#define dac_reg (0x3c8)
#define dac_val (0x3c9)
+#ifdef __powerpc__
+#define VGA_OFFSET 0xC0000000;
+#else
+#define VGA_OFFSET 0x0
+#endif
+
/*
* By replacing the four outb_p with two back to back outw, we can reduce
* the window of opportunity to see text mislocated to the RHS of the
@@ -241,20 +247,20 @@ con_type_init(unsigned long kmem_start, const char **display_desc))
#endif
if (ORIG_VIDEO_MODE == 7) /* Is this a monochrome display? */
{
- video_mem_base = 0xb0000;
+ video_mem_base = 0xb0000 + VGA_OFFSET;
video_port_reg = 0x3b4;
video_port_val = 0x3b5;
if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10)
{
video_type = VIDEO_TYPE_EGAM;
- video_mem_term = 0xb8000;
+ video_mem_term = 0xb8000 + VGA_OFFSET;
*display_desc = "EGA+";
request_region(0x3b0,16,"ega");
}
else
{
video_type = VIDEO_TYPE_MDA;
- video_mem_term = 0xb2000;
+ video_mem_term = 0xb2000 + VGA_OFFSET;
*display_desc = "*MDA";
request_region(0x3b0,12,"mda");
request_region(0x3bf, 1,"mda");
@@ -263,14 +269,14 @@ con_type_init(unsigned long kmem_start, const char **display_desc))
else /* If not, it is color. */
{
can_do_color = 1;
- video_mem_term = 0xb8000;
+ video_mem_term = 0xb8000 + VGA_OFFSET;
video_port_reg = 0x3d4;
video_port_val = 0x3d5;
if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10)
{
int i ;
- video_mem_term = 0xc0000;
+ video_mem_term = 0xc0000 + VGA_OFFSET;
if (!ORIG_VIDEO_ISVGA) {
video_type = VIDEO_TYPE_EGAC;
@@ -288,8 +294,8 @@ con_type_init(unsigned long kmem_start, const char **display_desc))
* controllers (it seems like setting MM=01
* and COE=1 isn't necessarily a good idea)
*/
- video_mem_base = 0xa0000;
- video_mem_term = 0xb0000;
+ video_mem_base = 0xa0000 + VGA_OFFSET;
+ video_mem_term = 0xb0000 + VGA_OFFSET;
outb_p (6, 0x3ce) ;
outb_p (6, 0x3cf) ;
#endif
@@ -321,7 +327,7 @@ con_type_init(unsigned long kmem_start, const char **display_desc))
else
{
video_type = VIDEO_TYPE_CGA;
- video_mem_term = 0xba000;
+ video_mem_term = 0xba000 + VGA_OFFSET;
*display_desc = "*CGA";
request_region(0x3d4,2,"cga");
}