From: James S. <jsi...@us...> - 2001-10-06 16:11:17
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv25708/linux/drivers/char Modified Files: Config.in Makefile keyboard.c mem.c selection.c sysrq.c tty_io.c vt_ioctl.c Log Message: Synced to 2.4.10 Index: Config.in =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/Config.in,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- Config.in 2001/10/05 03:58:58 1.25 +++ Config.in 2001/10/06 16:11:13 1.26 @@ -10,7 +10,7 @@ bool ' Support for console on virtual terminal' CONFIG_VT_CONSOLE # if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then # bool ' ISO6429 bidirectional support (EXPERIMENTAL)' CONFIG_VT_BDSM -# fi +# fi fi fi @@ -30,45 +30,75 @@ bool ' Autodetect IRQ on standard ports (unsafe)' CONFIG_SERIAL_DETECT_IRQ bool ' Support special multiport boards' CONFIG_SERIAL_MULTIPORT bool ' Support the Bell Technologies HUB6 card' CONFIG_HUB6 - fi -fi -bool 'Non-standard serial port support' CONFIG_SERIAL_NONSTANDARD -if [ "$CONFIG_SERIAL_NONSTANDARD" = "y" ]; then - tristate ' Computone IntelliPort Plus serial support' CONFIG_COMPUTONE - tristate ' Comtrol Rocketport support' CONFIG_ROCKETPORT - tristate ' Cyclades async mux support' CONFIG_CYCLADES - if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_CYCLADES" != "n" ]; then - bool ' Cyclades-Z interrupt mode operation (EXPERIMENTAL)' CONFIG_CYZ_INTR - fi - tristate ' Digiboard Intelligent Async Support' CONFIG_DIGIEPCA - if [ "$CONFIG_DIGIEPCA" = "n" ]; then - tristate ' Digiboard PC/Xx Support' CONFIG_DIGI fi - tristate ' Hayes ESP serial port support' CONFIG_ESPSERIAL - tristate ' Moxa Intellio support' CONFIG_MOXA_INTELLIO - tristate ' Moxa SmartIO support' CONFIG_MOXA_SMARTIO - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - dep_tristate ' Multi-Tech multiport card support (EXPERIMENTAL)' CONFIG_ISI m + bool 'Non-standard serial port support' CONFIG_SERIAL_NONSTANDARD + if [ "$CONFIG_SERIAL_NONSTANDARD" = "y" ]; then + tristate ' Computone IntelliPort Plus serial support' CONFIG_COMPUTONE + tristate ' Comtrol Rocketport support' CONFIG_ROCKETPORT + tristate ' Cyclades async mux support' CONFIG_CYCLADES + if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_CYCLADES" != "n" ]; then + bool ' Cyclades-Z interrupt mode operation (EXPERIMENTAL)' CONFIG_CYZ_INTR + fi + tristate ' Digiboard Intelligent Async Support' CONFIG_DIGIEPCA + if [ "$CONFIG_DIGIEPCA" = "n" ]; then + tristate ' Digiboard PC/Xx Support' CONFIG_DIGI + fi + tristate ' Hayes ESP serial port support' CONFIG_ESPSERIAL + tristate ' Moxa Intellio support' CONFIG_MOXA_INTELLIO + tristate ' Moxa SmartIO support' CONFIG_MOXA_SMARTIO + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate ' Multi-Tech multiport card support (EXPERIMENTAL)' CONFIG_ISI m + fi + tristate ' Microgate SyncLink card support' CONFIG_SYNCLINK + tristate ' HDLC line discipline support' CONFIG_N_HDLC + tristate ' SDL RISCom/8 card support' CONFIG_RISCOM8 + tristate ' Specialix IO8+ card support' CONFIG_SPECIALIX + if [ "$CONFIG_SPECIALIX" != "n" ]; then + bool ' Specialix DTR/RTS pin is RTS' CONFIG_SPECIALIX_RTSCTS + fi + tristate ' Specialix SX (and SI) card support' CONFIG_SX + tristate ' Specialix RIO system support' CONFIG_RIO + if [ "$CONFIG_RIO" != "n" ]; then + bool ' Support really old RIO/PCI cards' CONFIG_RIO_OLDPCI + fi + bool ' Stallion multiport serial support' CONFIG_STALDRV + if [ "$CONFIG_STALDRV" = "y" ]; then + tristate ' Stallion EasyIO or EC8/32 support' CONFIG_STALLION + tristate ' Stallion EC8/64, ONboard, Brumby support' CONFIG_ISTALLION + fi + if [ "$CONFIG_MIPS" = "y" ]; then + bool ' TMPTX3912/PR31700 serial port support' CONFIG_SERIAL_TX3912 + dep_bool ' Console on TMPTX3912/PR31700 serial port' CONFIG_SERIAL_TX3912_CONSOLE $CONFIG_SERIAL_TX3912 + bool ' Enable Au1000 UART Support' CONFIG_AU1000_UART + if [ "$CONFIG_AU1000_UART" = "y" ]; then + bool ' Enable Au1000 serial console' CONFIG_AU1000_SERIAL_CONSOLE + fi + fi fi - dep_tristate ' Microgate SyncLink card support' CONFIG_SYNCLINK m - dep_tristate ' HDLC line discipline support' CONFIG_N_HDLC m - tristate ' SDL RISCom/8 card support' CONFIG_RISCOM8 - tristate ' Specialix IO8+ card support' CONFIG_SPECIALIX - if [ "$CONFIG_SPECIALIX" != "n" ]; then - bool ' Specialix DTR/RTS pin is RTS' CONFIG_SPECIALIX_RTSCTS - fi - tristate ' Specialix SX (and SI) card support' CONFIG_SX - tristate ' Specialix RIO system support' CONFIG_RIO - if [ "$CONFIG_RIO" != "n" ]; then - bool ' Support really old RIO/PCI cards' CONFIG_RIO_OLDPCI +fi + +if [ "$CONFIG_IT8712" = "y" ]; then + bool 'Enable Qtronix 990P Keyboard Support' CONFIG_QTRONIX_KEYBOARD + if [ "$CONFIG_QTRONIX_KEYBOARD" = "y" ]; then + define_bool CONFIG_IT8172_CIR y + else + bool ' Enable PS2 Keyboard Support' CONFIG_PC_KEYB fi - bool ' Stallion multiport serial support' CONFIG_STALDRV - if [ "$CONFIG_STALDRV" = "y" ]; then - tristate ' Stallion EasyIO or EC8/32 support' CONFIG_STALLION - tristate ' Stallion EC8/64, ONboard, Brumby support' CONFIG_ISTALLION + bool 'Enable Smart Card Reader 0 Support ' CONFIG_IT8172_SCR0 + bool 'Enable Smart Card Reader 1 Support ' CONFIG_IT8172_SCR1 +fi +if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_ZORRO" = "y" ]; then + tristate 'Commodore A2232 serial support (EXPERIMENTAL)' CONFIG_A2232 +fi +if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then + bool 'DC21285 serial port support' CONFIG_SERIAL_21285 + if [ "$CONFIG_SERIAL_21285" = "y" ]; then + if [ "$CONFIG_OBSOLETE" = "y" ]; then + bool ' Use /dev/ttyS0 device (OBSOLETE)' CONFIG_SERIAL_21285_OLD + fi + bool ' Console on DC21285 serial port' CONFIG_SERIAL_21285_CONSOLE fi 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 @@ -113,13 +143,15 @@ tristate ' Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT tristate ' Advantech SBC Watchdog Timer' CONFIG_ADVANTECH_WDT tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT + tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT tristate ' Mixcom Watchdog' CONFIG_MIXCOMWD tristate ' Intel i810 TCO timer / Watchdog' CONFIG_I810_TCO - if [ "$CONFIG_ARM" = "y" ]; then - dep_tristate ' DC21285 watchdog' CONFIG_21285_WATCHDOG $CONFIG_FOOTBRIDGE - dep_tristate ' NetWinder WB83C977 watchdog' CONFIG_977_WATCHDOG $CONFIG_ARCH_NETWINDER - dep_tristate ' SA1100 watchdog' CONFIG_SA1100_WATCHDOG $CONFIG_ARCH_SA1100 - fi + if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then + tristate ' DC21285 watchdog' CONFIG_21285_WATCHDOG + if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then + tristate ' NetWinder WB83C977 watchdog' CONFIG_977_WATCHDOG + fi + fi tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT fi endmenu @@ -142,16 +174,13 @@ if [ "$CONFIG_OBSOLETE" = "y" -a "$CONFIG_ALPHA_BOOK1" = "y" ]; then bool 'Tadpole ANA H8 Support' CONFIG_H8 fi -if [ "$CONFIG_ARCH_SA1100" = "y" ]; then - tristate 'SA1100 Real Time Clock' CONFIG_SA1100_RTC -fi tristate 'Double Talk PC internal speech card support' CONFIG_DTLK tristate 'Siemens R3964 line discipline' CONFIG_R3964 tristate 'Applicom intelligent fieldbus card support' CONFIG_APPLICOM if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then dep_tristate 'Sony Vaio Programmable I/O Control Device support' CONFIG_SONYPI $CONFIG_PCI -fi +fi mainmenu_option next_comment comment 'Ftape, the floppy tape device driver' @@ -166,10 +195,10 @@ bool ' Intel 440LX/BX/GX and I815/I840/I850 support' CONFIG_AGP_INTEL bool ' Intel I810/I815 (on-board) support' CONFIG_AGP_I810 bool ' VIA chipset support' CONFIG_AGP_VIA - bool ' AMD Irongate support' CONFIG_AGP_AMD + bool ' AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD bool ' Generic SiS support' CONFIG_AGP_SIS bool ' ALI chipset support' CONFIG_AGP_ALI - bool ' Serverworks LE/HE support' CONFIG_AGP_SWORKS + bool ' Serverworks LE/HE support' CONFIG_AGP_SWORKS fi source drivers/char/drm/Config.in Index: Makefile =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/Makefile,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- Makefile 2001/07/29 18:24:12 1.26 +++ Makefile 2001/10/06 16:11:13 1.27 @@ -22,7 +22,7 @@ # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. export-objs := vt.o keyboard.o sysrq.o misc.o pty.o random.o \ - selection.o serial.o sonypi.o tty_io.o tty_ioctl.o + selection.o serial.o sonypi.o tty_io.o tty_ioctl.o mod-subdirs := ftape drm pcmcia @@ -30,9 +30,20 @@ SERIAL =serial.o +ifeq ($(CONFIG_DECSTATION),y) + SERIAL = decserial.o +endif + +ifeq ($(CONFIG_QTRONIX_KEYBOARD),y) + KEYBD = qtronix.o + KEYMAP = qtronixmap.o +endif + obj-$(CONFIG_VT) += vt.o vt_ioctl.o decvte.o vc_screen.o consolemap.o consolemap_deftbl.o selection.o keyboard.o defkeymap.o obj-$(CONFIG_SERIAL) += $(SERIAL) obj-$(CONFIG_SERIAL_21285) += serial_21285.o +obj-$(CONFIG_SERIAL_SA1100) += serial_sa1100.o +obj-$(CONFIG_SERIAL_AMBA) += serial_amba.o obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o @@ -60,18 +71,17 @@ 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_SERIAL_TX3912) += generic_serial.o serial_tx3912.o subdir-$(CONFIG_RIO) += rio obj-$(CONFIG_PRINTER) += lp.o - obj-$(CONFIG_DTLK) += dtlk.o obj-$(CONFIG_R3964) += n_r3964.o obj-$(CONFIG_APPLICOM) += applicom.o obj-$(CONFIG_SONYPI) += sonypi.o obj-$(CONFIG_RTC) += rtc.o obj-$(CONFIG_EFI_RTC) += efirtc.o -obj-$(CONFIG_SA1100_RTC) += sa1100-rtc.o ifeq ($(CONFIG_PPC),) obj-$(CONFIG_NVRAM) += nvram.o endif @@ -112,14 +122,8 @@ obj-$(CONFIG_977_WATCHDOG) += wdt977.o obj-$(CONFIG_I810_TCO) += i810-tco.o obj-$(CONFIG_MACHZ_WDT) += machzwd.o -obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o -ifeq ($(CONFIG_ARCH_ACORN),y) -mod-subdirs += ../acorn/char -subdir-y += ../acorn/char -obj-y += ../acorn/char/acorn-char.o -endif include $(TOPDIR)/Rules.make @@ -133,5 +137,10 @@ consolemap_deftbl.o: consolemap_deftbl.c $(TOPDIR)/include/linux/types.h +.DELETE_ON_ERROR: + defkeymap.c: defkeymap.map - loadkeys --mktable defkeymap.map > defkeymap.c + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@ + +qtronixmap.c: qtronixmap.map + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@ Index: keyboard.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/keyboard.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- keyboard.c 2001/09/25 09:37:57 1.60 +++ keyboard.c 2001/10/06 16:11:13 1.61 @@ -144,6 +144,8 @@ static int npadch = -1; /* -1 or number assembled on pad */ static unsigned char diacr; static char rep; /* flag telling character repeat */ +pm_callback pm_kbd_request_override = NULL; +typedef void (pm_kbd_func) (void); static struct pm_dev *pm_kbd; static unsigned char ledstate = 0xff; /* undefined */ @@ -1133,7 +1135,7 @@ tasklet_enable(&keyboard_tasklet); tasklet_schedule(&keyboard_tasklet); - pm_kbd = pm_register(PM_SYS_DEV, PM_SYS_KBC, NULL); + pm_kbd = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_kbd_request_override); input_register_handler(&kbd_handler); return 0; Index: mem.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/mem.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- mem.c 2001/09/09 16:36:33 1.16 +++ mem.c 2001/10/06 16:11:13 1.17 @@ -35,9 +35,6 @@ #if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR) extern void tapechar_init(void); #endif -#if defined(CONFIG_ADB) -extern void adbdev_init(void); -#endif static ssize_t do_write_mem(struct file * file, void *p, unsigned long realp, const char * buf, size_t count, loff_t *ppos) @@ -128,7 +125,7 @@ { unsigned long prot = pgprot_val(_prot); -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) /* On PPro and successors, PCD alone doesn't always mean uncached because of interactions with the MTRRs. PCD | PWT means definitely uncached. */ @@ -147,8 +144,6 @@ /* Use no-cache mode, serialized */ else if (MMU_IS_040 || MMU_IS_060) prot = (prot & _CACHEMASK040) | _PAGE_NOCACHE_S; -#elif defined(__mips__) - prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED; #endif return __pgprot(prot); @@ -628,9 +623,6 @@ #endif #if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR) tapechar_init(); -#endif -#if defined(CONFIG_ADB) - adbdev_init(); #endif return 0; } Index: selection.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/selection.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- selection.c 2001/03/07 04:42:27 1.12 +++ selection.c 2001/10/06 16:11:13 1.13 @@ -104,11 +104,7 @@ /* set inwordLut contents. Invoked by ioctl(). */ int sel_loadlut(const unsigned long arg) { - int err = -EFAULT; - - if (!copy_from_user(inwordLut, (u32 *)(arg+4), 32)) - err = 0; - return err; + return copy_from_user(inwordLut, (u32 *)(arg+4), 32) ? -EFAULT : 0; } /* does screen address p correspond to character at LH/RH edge of screen? */ @@ -138,15 +134,13 @@ args = (unsigned short *)(arg + 1); if (user) { - int err; - err = verify_area(VERIFY_READ, args, sizeof(short) * 5); - if (err) - return err; - get_user(xs, args++); - get_user(ys, args++); - get_user(xe, args++); - get_user(ye, args++); - get_user(sel_mode, args); + if (verify_area(VERIFY_READ, args, sizeof(short) * 5)) + return -EFAULT; + __get_user(xs, args++); + __get_user(ys, args++); + __get_user(xe, args++); + __get_user(ye, args++); + __get_user(sel_mode, args); } else { xs = *(args++); /* set selection from kernel */ ys = *(args++); Index: sysrq.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/sysrq.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- sysrq.c 2001/09/09 16:36:33 1.13 +++ sysrq.c 2001/10/06 16:11:13 1.14 @@ -6,6 +6,10 @@ * * (c) 1997 Martin Mares <mj...@at...> * based on ideas by Pavel Machek <pa...@at...> + * + * (c) 2000 Crutcher Dunnavant <cru...@da...> + * overhauled to use key registration + * based upon discusions in irc://irc.openprojects.net/#kernelnewbies */ #include <linux/config.h> @@ -22,9 +26,11 @@ #include <linux/quotaops.h> #include <linux/smp_lock.h> #include <linux/module.h> +#include <linux/spinlock.h> #ifdef CONFIG_VT #include <linux/vt_kern.h> #endif + #include <asm/ptrace.h> extern struct list_head super_blocks; @@ -35,135 +41,86 @@ /* Machine specific power off function */ void (*sysrq_power_off)(void); -EXPORT_SYMBOL(sysrq_power_off); +/* Loglevel sysrq handler */ +static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + int i; + i = key - '0'; + console_loglevel = 7; + printk("%d\n", i); + console_loglevel = i; +} +static struct sysrq_key_op sysrq_loglevel_op = { + handler: sysrq_handle_loglevel, + help_msg: "loglevel0-8", + action_msg: "Loglevel set to ", +}; -/* Send a signal to all user processes */ -static void send_sig_all(int sig, int even_init) +/* SAK sysrq handler */ +#ifdef CONFIG_VT +static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { - struct task_struct *p; + struct vc_data *vc = (struct vc_data *) tty->driver_data; - for_each_task(p) { - if (p->mm) { /* Not swapper nor kernel thread */ - if (p->pid == 1 && even_init) /* Ugly hack to kill init */ - p->pid = 0x8000; - force_sig(sig, p); - } - } + if (tty) + do_SAK(tty); + reset_vc(vc); } +static struct sysrq_key_op sysrq_SAK_op = { + handler: sysrq_handle_SAK, + help_msg: "saK", + action_msg: "SAK\n", +}; +#endif -/* - * This function is called by the keyboard handler when SysRq is pressed - * and any other keycode arrives. - */ - -void handle_sysrq(int key, struct pt_regs *pt_regs, - struct kbd_struct *kbd, struct tty_struct *tty) -{ - int orig_log_level = console_loglevel; - if (!key || !sysrq_enabled) - return; +/* unraw sysrq handler */ +static void sysrq_handle_unraw(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + if (kbd) + kbd->kbdmode = VC_XLATE; +} +static struct sysrq_key_op sysrq_unraw_op = { + handler: sysrq_handle_unraw, + help_msg: "unRaw", + action_msg: "Keyboard mode set to XLATE\n", +}; - console_loglevel = 7; - printk(KERN_INFO "SysRq: "); - switch (key) { -#ifdef CONFIG_VT - case 'r': /* R -- Reset raw mode */ - if (kbd) { - kbd->kbdmode = VC_XLATE; - printk("Keyboard mode set to XLATE\n"); - } - break; - case 'k': { /* K -- SAK */ - struct vc_data *vc = (struct vc_data *) tty->driver_data; - printk("SAK\n"); - if (tty) - do_SAK(tty); - reset_vc(vc); - break; - } -#endif - case 'b': /* B -- boot immediately */ - printk("Resetting\n"); - machine_restart(NULL); - break; - case 'o': /* O -- power off */ - if (sysrq_power_off) { - printk("Power off\n"); - sysrq_power_off(); - } - break; - case 's': /* S -- emergency sync */ - printk("Emergency Sync\n"); - emergency_sync_scheduled = EMERG_SYNC; - wakeup_bdflush(); - break; - case 'u': /* U -- emergency remount R/O */ - printk("Emergency Remount R/O\n"); - emergency_sync_scheduled = EMERG_REMOUNT; - wakeup_bdflush(); - break; - case 'p': /* P -- show PC */ - printk("Show Regs\n"); - if (pt_regs) - show_regs(pt_regs); - break; - case 't': /* T -- show task info */ - printk("Show State\n"); - show_state(); - break; - case 'm': /* M -- show memory info */ - printk("Show Memory\n"); - show_mem(); - break; - 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 '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 'i': /* I -- kill all user processes */ - printk("Kill All Tasks\n"); - send_sig_all(SIGKILL, 0); - orig_log_level = 8; - break; - case 'l': /* L -- kill all processes including init */ - printk("Kill ALL Tasks (even init)\n"); - send_sig_all(SIGKILL, 1); - orig_log_level = 8; - break; - default: /* Unknown: help */ -#ifdef CONFIG_VT - if (kbd) - printk("unRaw "); - if (tty) - printk("saK "); -#endif - printk("Boot "); - if (sysrq_power_off) - printk("Off "); - printk("Sync Unmount showPc showTasks showMem loglevel0-8 tErm kIll killalL\n"); - /* Don't use 'A' as it's handled specially on the Sparc */ - } - console_loglevel = orig_log_level; +/* reboot sysrq handler */ +static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + machine_restart(NULL); } +static struct sysrq_key_op sysrq_reboot_op = { + handler: sysrq_handle_reboot, + help_msg: "reBoot", + action_msg: "Resetting\n", +}; -/* Aux routines for the syncer */ -static int is_local_disk(kdev_t dev) /* Guess if the device is a local hard drive */ -{ - unsigned int major = MAJOR(dev); + +/* SYNC SYSRQ HANDLERS BLOCK */ + +/* do_emergency_sync helper function */ +/* Guesses if the device is a local hard drive */ +static int is_local_disk(kdev_t dev) { + unsigned int major; + major = MAJOR(dev); switch (major) { case IDE0_MAJOR: case IDE1_MAJOR: case IDE2_MAJOR: case IDE3_MAJOR: + case IDE4_MAJOR: + case IDE5_MAJOR: + case IDE6_MAJOR: + case IDE7_MAJOR: + case IDE8_MAJOR: + case IDE9_MAJOR: case SCSI_DISK0_MAJOR: case SCSI_DISK1_MAJOR: case SCSI_DISK2_MAJOR: @@ -172,19 +129,24 @@ case SCSI_DISK5_MAJOR: case SCSI_DISK6_MAJOR: case SCSI_DISK7_MAJOR: + case XT_DISK_MAJOR: return 1; default: return 0; } } +/* do_emergency_sync helper function */ static void go_sync(struct super_block *sb, int remount_flag) { + int orig_loglevel; + orig_loglevel = console_loglevel; + console_loglevel = 7; printk(KERN_INFO "%sing device %s ... ", remount_flag ? "Remount" : "Sync", kdevname(sb->s_dev)); - if (remount_flag) { /* Remount R/O */ + if (remount_flag) { /* Remount R/O */ int ret, flags; struct list_head *p; @@ -214,12 +176,12 @@ } } else printk("nothing to do\n"); - } else { - fsync_dev(sb->s_dev); /* Sync only */ + } else { /* Sync only */ + fsync_dev(sb->s_dev); printk("OK\n"); } + console_loglevel = orig_loglevel; } - /* * Emergency Sync or Unmount. We cannot do it directly, so we set a special * flag and wake up the bdflush kernel thread which immediately calls this function. @@ -229,10 +191,10 @@ int emergency_sync_scheduled; -void do_emergency_sync(void) -{ +void do_emergency_sync(void) { struct super_block *sb; int remount_flag; + int orig_loglevel; lock_kernel(); remount_flag = (emergency_sync_scheduled == EMERG_REMOUNT); @@ -251,5 +213,277 @@ go_sync(sb, remount_flag); unlock_kernel(); + + orig_loglevel = console_loglevel; + console_loglevel = 7; printk(KERN_INFO "Done.\n"); + console_loglevel = orig_loglevel; +} + +static void sysrq_handle_sync(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + emergency_sync_scheduled = EMERG_SYNC; + wakeup_bdflush(); +} +static struct sysrq_key_op sysrq_sync_op = { + handler: sysrq_handle_sync, + help_msg: "Sync", + action_msg: "Emergency Sync\n", +}; + +static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + emergency_sync_scheduled = EMERG_REMOUNT; + wakeup_bdflush(); +} +static struct sysrq_key_op sysrq_mountro_op = { + handler: sysrq_handle_mountro, + help_msg: "Unmount", + action_msg: "Emergency Remount R/0\n", +}; + +/* END SYNC SYSRQ HANDLERS BLOCK */ + + +/* SHOW SYSRQ HANDLERS BLOCK */ + +static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + if (pt_regs) + show_regs(pt_regs); +} +static struct sysrq_key_op sysrq_showregs_op = { + handler: sysrq_handle_showregs, + help_msg: "showPc", + action_msg: "Show Regs\n", +}; + + +static void sysrq_handle_showstate(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + show_state(); +} +static struct sysrq_key_op sysrq_showstate_op = { + handler: sysrq_handle_showstate, + help_msg: "showTasks", + action_msg: "Show State\n", +}; + + +static void sysrq_handle_showmem(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + show_mem(); +} +static struct sysrq_key_op sysrq_showmem_op = { + handler: sysrq_handle_showmem, + help_msg: "showMem", + action_msg: "Show Memory\n", +}; + +/* SHOW SYSRQ HANDLERS BLOCK */ + + +/* SIGNAL SYSRQ HANDLERS BLOCK */ + +/* signal sysrq helper function + * Sends a signal to all user processes */ +static void send_sig_all(int sig, int even_init) +{ + struct task_struct *p; + + for_each_task(p) { + if (p->mm) { /* Not swapper nor kernel thread */ + if (p->pid == 1 && even_init) + /* Ugly hack to kill init */ + p->pid = 0x8000; + if (p->pid != 1) + force_sig(sig, p); + } + } +} + +static void sysrq_handle_term(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + send_sig_all(SIGTERM, 0); + console_loglevel = 8; +} +static struct sysrq_key_op sysrq_term_op = { + handler: sysrq_handle_term, + help_msg: "tErm", + action_msg: "Terminate All Tasks\n", +}; + +static void sysrq_handle_kill(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + send_sig_all(SIGKILL, 0); + console_loglevel = 8; +} +static struct sysrq_key_op sysrq_kill_op = { + handler: sysrq_handle_kill, + help_msg: "kIll", + action_msg: "Kill All Tasks\n", +}; + +static void sysrq_handle_killall(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + send_sig_all(SIGKILL, 1); + console_loglevel = 8; +} +static struct sysrq_key_op sysrq_killall_op = { + handler: sysrq_handle_killall, + help_msg: "killalL", + action_msg: "Kill All Tasks (even init)\n", +}; + +/* END SIGNAL SYSRQ HANDLERS BLOCK */ + + +/* Key Operations table and lock */ +spinlock_t sysrq_key_table_lock = SPIN_LOCK_UNLOCKED; +#define SYSRQ_KEY_TABLE_LENGTH 36 +static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = { +/* 0 */ &sysrq_loglevel_op, +/* 1 */ &sysrq_loglevel_op, +/* 2 */ &sysrq_loglevel_op, +/* 3 */ &sysrq_loglevel_op, +/* 4 */ &sysrq_loglevel_op, +/* 5 */ &sysrq_loglevel_op, +/* 6 */ &sysrq_loglevel_op, +/* 7 */ &sysrq_loglevel_op, +/* 8 */ &sysrq_loglevel_op, +/* 9 */ &sysrq_loglevel_op, +/* a */ NULL, /* Don't use for system provided sysrqs, + it is handled specially on the spark + and will never arive */ +/* b */ &sysrq_reboot_op, +/* c */ NULL, +/* d */ NULL, +/* e */ &sysrq_term_op, +/* f */ NULL, +/* g */ NULL, +/* h */ NULL, +/* i */ &sysrq_kill_op, +/* j */ NULL, +#ifdef CONFIG_VT +/* k */ &sysrq_SAK_op, +#else +/* k */ NULL, +#endif +/* l */ &sysrq_killall_op, +/* m */ &sysrq_showmem_op, +/* n */ NULL, +/* o */ NULL, /* This will often be registered + as 'Off' at init time */ +/* p */ &sysrq_showregs_op, +/* q */ NULL, +/* r */ &sysrq_unraw_op, +/* s */ &sysrq_sync_op, +/* t */ &sysrq_showstate_op, +/* u */ &sysrq_mountro_op, +/* v */ NULL, +/* w */ NULL, +/* x */ NULL, +/* w */ NULL, +/* z */ NULL +}; + +/* key2index calculation, -1 on invalid index */ +static __inline__ int sysrq_key_table_key2index(int key) { + int retval; + if ((key >= '0') & (key <= '9')) { + retval = key - '0'; + } else if ((key >= 'a') & (key <= 'z')) { + retval = key + 10 - 'a'; + } else { + retval = -1; + } + return retval; } + +/* + * table lock and unlocking functions, exposed to modules + */ + +void __sysrq_lock_table (void) { spin_lock(&sysrq_key_table_lock); } + +void __sysrq_unlock_table (void) { spin_unlock(&sysrq_key_table_lock); } + +/* + * get and put functions for the table, exposed to modules. + */ + +struct sysrq_key_op *__sysrq_get_key_op (int key) { + struct sysrq_key_op *op_p; + int i; + + i = sysrq_key_table_key2index(key); + op_p = (i == -1) ? NULL : sysrq_key_table[i]; + return op_p; +} + +void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p) { + int i; + + i = sysrq_key_table_key2index(key); + if (i != -1) + sysrq_key_table[i] = op_p; +} + +/* + * This function is called by the keyboard handler when SysRq is pressed + * and any other keycode arrives. + */ + +void handle_sysrq(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + if (!sysrq_enabled) + return; + + __sysrq_lock_table(); + __handle_sysrq_nolock(key, pt_regs, kbd, tty); + __sysrq_unlock_table(); +} + +/* + * This is the non-locking version of handle_sysrq + * It must/can only be called by sysrq key handlers, + * as they are inside of the lock + */ + +void __handle_sysrq_nolock(int key, struct pt_regs *pt_regs, + struct kbd_struct *kbd, struct tty_struct *tty) { + struct sysrq_key_op *op_p; + int orig_log_level; + int i, j; + + if (!sysrq_enabled) + return; + + orig_log_level = console_loglevel; + console_loglevel = 7; + printk(KERN_INFO "SysRq : "); + + op_p = __sysrq_get_key_op(key); + if (op_p) { + printk ("%s", op_p->action_msg); + op_p->handler(key, pt_regs, kbd, tty); + } else { + printk("HELP : "); + /* Only print the help msg once per handler */ + for (i=0; i<SYSRQ_KEY_TABLE_LENGTH; i++) + if (sysrq_key_table[i]) { + for (j=0; sysrq_key_table[i] != sysrq_key_table[j]; j++); + if (j == i) + printk ("%s ", sysrq_key_table[i]->help_msg); + } + printk ("\n"); + } + console_loglevel = orig_log_level; +} + +EXPORT_SYMBOL(handle_sysrq); +EXPORT_SYMBOL(__handle_sysrq_nolock); +EXPORT_SYMBOL(__sysrq_lock_table); +EXPORT_SYMBOL(__sysrq_unlock_table); +EXPORT_SYMBOL(__sysrq_get_key_op); +EXPORT_SYMBOL(__sysrq_put_key_op); Index: tty_io.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/tty_io.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- tty_io.c 2001/10/05 03:58:58 1.35 +++ tty_io.c 2001/10/06 16:11:13 1.36 @@ -95,12 +95,12 @@ #include <asm/system.h> #include <asm/bitops.h> -#include <linux/vt_kern.h> #include <linux/devfs_fs_kernel.h> - #include <linux/kmod.h> #ifdef CONFIG_VT +#include <linux/vt_kern.h> +extern void con_init_devfs (void); #ifdef CONFIG_PROM_CONSOLE extern void prom_con_init(void); #endif @@ -163,6 +163,8 @@ extern void anakin_console_init(void); extern void sgi_serial_console_init(void); extern void sci_console_init(void); +extern void tx3912_console_init(void); +extern void tx3912_rs_init(void); #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) @@ -273,6 +275,8 @@ return 0; } +EXPORT_SYMBOL(tty_register_ldisc); + /* Set the discipline of a tty line. */ static int tty_set_ldisc(struct tty_struct *tty, int ldisc) { @@ -447,9 +451,7 @@ file_list_lock(); for (l = tty->tty_files.next; l != &tty->tty_files; l = l->next) { struct file * filp = list_entry(l, struct file, f_list); - if (!filp->f_dentry) - continue; - if (filp->f_dentry->d_inode->i_rdev == SYSCONS_DEV) { + if (filp->f_dentry->d_inode->i_rdev == SYSCONS_DEV) { cons_filp = filp; continue; } @@ -749,10 +751,10 @@ return -ESPIPE; /* - * For now, we redirect writes from /dev/console. + * For now, we redirect writes from /dev/console. */ inode = file->f_dentry->d_inode; - is_console = (inode->i_rdev == SYSCONS_DEV); + is_console = (inode->i_rdev == SYSCONS_DEV); if (is_console && redirect) tty = redirect; @@ -1498,12 +1500,12 @@ if (!memcmp(&tmp_ws, &tty->winsize, sizeof(*arg))) return 0; #ifdef CONFIG_VT - if (tty->driver.type == TTY_DRIVER_TYPE_CONSOLE) { - struct vc_data *vc = (struct vc_data *) tty->driver_data; + if (tty->driver.type == TTY_DRIVER_TYPE_CONSOLE) { + struct vc_data *vc = (struct vc_data *) tty->driver_data; - if (!vc || vc_resize(vc, tmp_ws.ws_col, tmp_ws.ws_row)) - return -ENXIO; - } + if (!vc || vc_resize(vc, tmp_ws.ws_col, tmp_ws.ws_row)) + return -ENXIO; + } #endif if (tty->pgrp > 0) kill_pg(tty->pgrp, SIGWINCH, 1); @@ -2024,7 +2026,7 @@ break; default: if (driver->major == PTY_MASTER_MAJOR) - flags |= DEVFS_FL_AUTO_OWNER; + mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; break; } if ( (minor < driver->minor_start) || @@ -2190,6 +2192,9 @@ #ifdef CONFIG_VT vt_console_init(); #endif +#ifdef CONFIG_AU1000_SERIAL_CONSOLE + au1000_serial_console_init(); +#endif #ifdef CONFIG_SERIAL_CONSOLE #if (defined(CONFIG_8xx) || defined(CONFIG_8260)) console_8xx_init(); @@ -2231,14 +2236,20 @@ #ifdef CONFIG_SERIAL_SA1100_CONSOLE sa1100_rs_console_init(); #endif +#ifdef CONFIG_ARC_CONSOLE + arc_console_init(); +#endif #ifdef CONFIG_SERIAL_AMBA_CONSOLE ambauart_console_init(); #endif +#ifdef CONFIG_SERIAL_TX3912_CONSOLE + tx3912_console_init(); +#endif #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE - clps711xuart_console_init(); + clps711xuart_console_init(); #endif #ifdef CONFIG_SERIAL_ANAKIN_CONSOLE - anakin_console_init(); + anakin_console_init(); #endif } @@ -2254,7 +2265,7 @@ void __init tty_init(void) { struct tty_driver *p; - int i; + int i; /* * dev_tty_driver and dev_console_driver are actually magic @@ -2288,8 +2299,8 @@ panic("Couldn't register /dev/console driver\n"); /* - * Some consoles calls tty_register_driver() before kmalloc() works. - * Thus, we can't devfs_register() then. Do so now, instead. + * Some console calls tty_register_driver() before kmalloc() works. + * Thus, we can't devfs_register() then. Do so now, instead. */ for (p = tty_drivers; p; p = p->next) { if (p->flags && TTY_DRIVER_NO_DEVFS) { @@ -2298,7 +2309,6 @@ } } - #ifdef CONFIG_UNIX98_PTYS dev_ptmx_driver = dev_tty_driver; dev_ptmx_driver.driver_name = "/dev/ptmx"; @@ -2314,20 +2324,23 @@ #ifdef CONFIG_VT #if defined (CONFIG_PROM_CONSOLE) - prom_con_init(); + prom_con_init(); #endif #if defined (CONFIG_FRAMEBUFFER_CONSOLE) - fb_console_init(); + fb_console_init(); #endif kbd_init(); console_map_init(); - vcs_init(); + vcs_init(); #endif #ifdef CONFIG_ESPSERIAL /* init ESP before rs, so rs doesn't see the port */ espserial_init(); #endif #if defined(CONFIG_MVME162_SCC) || defined(CONFIG_BVME6000_SCC) || defined(CONFIG_MVME147_SCC) vme_scc_init(); +#endif +#ifdef CONFIG_SERIAL_TX3912 + tx3912_rs_init(); #endif #ifdef CONFIG_COMPUTONE ip2_init(); Index: vt_ioctl.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/vt_ioctl.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- vt_ioctl.c 2001/10/05 03:58:58 1.60 +++ vt_ioctl.c 2001/10/06 16:11:13 1.61 @@ -1332,7 +1332,8 @@ vc->vt_mode.frsig = 0; vc->vt_pid = -1; vc->vt_newvt = -1; - reset_palette(vc); + if (!in_interrupt()) /* Via keyboard.c:SAK() - akpm */ + reset_palette(vc); } inline void switch_screen(struct vc_data *new_vc, struct vc_data *old_vc) |