From: Paul M. <le...@us...> - 2002-04-21 20:02:50
|
Update of /cvsroot/linux-mips/linux/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv3535/drivers/char Modified Files: Makefile dz.c lcd.c lcd.h mem.c misc.c serial.c Log Message: More OSS syncing.. Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/char/Makefile,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- Makefile 7 Mar 2002 09:15:16 -0000 1.27 +++ Makefile 21 Apr 2002 20:01:14 -0000 1.28 @@ -24,9 +24,9 @@ export-objs := busmouse.o console.o keyboard.o sysrq.o \ misc.o pty.o random.o selection.o serial.o \ sonypi.o tty_io.o tty_ioctl.o generic_serial.o \ - au1000_gpio.o lcd.o + au1000_gpio.o -mod-subdirs := joystick ftape drm pcmcia +mod-subdirs := joystick ftape drm drm-4.0 pcmcia list-multi := @@ -222,7 +222,8 @@ obj-$(CONFIG_QIC02_TAPE) += tpqic02.o subdir-$(CONFIG_FTAPE) += ftape -subdir-$(CONFIG_DRM) += drm +subdir-$(CONFIG_DRM_OLD) += drm-4.0 +subdir-$(CONFIG_DRM_NEW) += drm subdir-$(CONFIG_PCMCIA) += pcmcia subdir-$(CONFIG_AGP) += agp Index: dz.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/char/dz.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- dz.c 30 Nov 2001 18:34:10 -0000 1.8 +++ dz.c 21 Apr 2002 20:01:14 -0000 1.9 @@ -866,7 +866,7 @@ tmp.type = info->type; tmp.line = info->line; tmp.port = info->port; - tmp.irq = SERIAL; + tmp.irq = dec_interrupt[DEC_IRQ_DZ11]; tmp.flags = info->flags; tmp.baud_base = info->baud_base; tmp.close_delay = info->close_delay; @@ -1408,7 +1408,7 @@ return 0; printk("ttyS%02d at 0x%08x (irq = %d)\n", info->line, - info->port, SERIAL); + info->port, dec_interrupt[DEC_IRQ_DZ11]); tty_register_devfs(&serial_driver, 0, serial_driver.minor_start + info->line); @@ -1432,7 +1432,8 @@ restore_flags(flags); - if (request_irq(SERIAL, dz_interrupt, SA_INTERRUPT, "DZ", lines[0])) + if (request_irq(dec_interrupt[DEC_IRQ_DZ11], dz_interrupt, + SA_INTERRUPT, "DZ", lines[0])) panic("Unable to register DZ interrupt"); return 0; Index: lcd.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/char/lcd.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- lcd.c 5 Dec 2001 18:37:06 -0000 1.4 +++ lcd.c 21 Apr 2002 20:01:14 -0000 1.5 @@ -1,13 +1,19 @@ /* - * LCD, LED, and Button interface for Cobalt - * Andrew Bose + * LCD, LED and Button interface for Cobalt + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1996, 1997 by Andrew Bose * + * Linux kernel version history: + * March 2001: Ported from 2.0.34 by Liam Davies * */ #define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */ -#include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/miscdevice.h> @@ -32,6 +38,8 @@ int led_state = 0; +#if defined(CONFIG_TULIP) && 0 + #define MAX_INTERFACES 8 static linkcheck_func_t linkcheck_callbacks[MAX_INTERFACES]; static void *linkcheck_cookies[MAX_INTERFACES]; @@ -46,6 +54,7 @@ linkcheck_cookies[iface_num] = cookie; return 0; } +#endif static int lcd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) @@ -355,14 +364,15 @@ if(copy_from_user(&button_display, (struct lcd_display *)arg, sizeof(button_display))) return -EFAULT; iface_num = button_display.buttons; +#if defined(CONFIG_TULIP) && 0 if (iface_num >= 0 && iface_num < MAX_INTERFACES && linkcheck_callbacks[iface_num] != NULL) { button_display.buttons = linkcheck_callbacks[iface_num](linkcheck_cookies[iface_num]); - } else { + } else +#endif button_display.buttons = 0; - } if(__copy_to_user((struct lcd_display*)arg, &button_display, sizeof(struct lcd_display))) return -EFAULT; @@ -618,5 +628,5 @@ } -EXPORT_SYMBOL(lcd_register_linkcheck_func); -MODULE_LICENSE("GPL"); + + Index: lcd.h =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/char/lcd.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- lcd.h 10 Jul 2001 03:11:19 -0000 1.1 +++ lcd.h 21 Apr 2002 20:01:14 -0000 1.2 @@ -1,11 +1,16 @@ /* -* -* -* File: lcd.h -* Andrew Bose -* -*/ - + * LED, LCD and Button panel driver for Cobalt + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1996, 1997 by Andrew Bose + * + * Linux kernel version history: + * March 2001: Ported from 2.0.34 by Liam Davies + * + */ // function headers @@ -176,3 +181,4 @@ #define kClassA 5 #define kClassB 6 #define kClassC 7 + Index: mem.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/char/mem.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- mem.c 19 Oct 2001 21:19:38 -0000 1.5 +++ mem.c 21 Apr 2002 20:01:14 -0000 1.6 @@ -272,6 +272,8 @@ return virtr + read; } +extern long vwrite(char *buf, char *addr, unsigned long count); + /* * This function writes to the *virtual* memory as seen by the kernel. */ @@ -279,12 +281,46 @@ size_t count, loff_t *ppos) { unsigned long p = *ppos; + ssize_t wrote = 0; + ssize_t virtr = 0; + char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */ - if (p >= (unsigned long) high_memory) - return 0; + if (p < (unsigned long) high_memory) { + wrote = count; if (count > (unsigned long) high_memory - p) - count = (unsigned long) high_memory - p; - return do_write_mem(file, (void*)p, p, buf, count, ppos); + wrote = (unsigned long) high_memory - p; + + wrote = do_write_mem(file, (void*)p, p, buf, wrote, ppos); + + p += wrote; + buf += wrote; + count -= wrote; + } + + if (count > 0) { + kbuf = (char *)__get_free_page(GFP_KERNEL); + if (!kbuf) + return -ENOMEM; + while (count > 0) { + int len = count; + + if (len > PAGE_SIZE) + len = PAGE_SIZE; + if (len && copy_from_user(kbuf, buf, len)) { + free_page((unsigned long)kbuf); + return -EFAULT; + } + len = vwrite(kbuf, (char *)p, len); + count -= len; + buf += len; + virtr += len; + p += len; + } + free_page((unsigned long)kbuf); + } + + *ppos = p; + return virtr + wrote; } #ifdef CONFIG_ISA Index: misc.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/char/misc.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- misc.c 7 Mar 2002 09:15:16 -0000 1.6 +++ misc.c 21 Apr 2002 20:01:14 -0000 1.7 @@ -78,6 +78,7 @@ extern int pmu_device_init(void); extern int tosh_init(void); extern int i8k_init(void); +extern int lcd_init(void); static int misc_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *private) @@ -289,11 +290,11 @@ #ifdef CONFIG_TOSHIBA tosh_init(); #endif -#ifdef CONFIG_I8K - i8k_init(); -#endif #ifdef CONFIG_COBALT_LCD lcd_init(); +#endif +#ifdef CONFIG_I8K + i8k_init(); #endif if (devfs_register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { printk("unable to get major %d for misc devices\n", Index: serial.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/char/serial.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- serial.c 21 Apr 2002 06:45:57 -0000 1.11 +++ serial.c 21 Apr 2002 20:01:14 -0000 1.12 @@ -127,7 +127,7 @@ #define ENABLE_SERIAL_ACPI #endif -#ifdef __ISAPNP__ +#if defined(CONFIG_ISAPNP)|| (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) #ifndef ENABLE_SERIAL_PNP #define ENABLE_SERIAL_PNP #endif @@ -236,8 +236,8 @@ #include <asm/irq.h> #include <asm/bitops.h> -#ifdef CONFIG_MAC_SERIAL -#define SERIAL_DEV_OFFSET 2 +#if defined(CONFIG_MAC_SERIAL) +#define SERIAL_DEV_OFFSET ((_machine == _MACH_prep || _machine == _MACH_chrp) ? 0 : 2) #else #define SERIAL_DEV_OFFSET 0 #endif @@ -3156,6 +3156,10 @@ * enables interrupts for a serial port, linking in its async structure into * the IRQ chain. It also performs the serial-specific * initialization for the tty structure. + * + * Note that on failure, we don't decrement the module use count - the tty + * later will call rs_close, which will decrement it for us as long as + * tty->driver_data is set non-NULL. --rmk */ static int rs_open(struct tty_struct *tty, struct file * filp) { @@ -3176,10 +3180,8 @@ } tty->driver_data = info; info->tty = tty; - if (serial_paranoia_check(info, tty->device, "rs_open")) { - MOD_DEC_USE_COUNT; + if (serial_paranoia_check(info, tty->device, "rs_open")) return -ENODEV; - } #ifdef SERIAL_DEBUG_OPEN printk("rs_open %s%d, count = %d\n", tty->driver.name, info->line, @@ -3194,10 +3196,8 @@ */ if (!tmp_buf) { page = get_zeroed_page(GFP_KERNEL); - if (!page) { - MOD_DEC_USE_COUNT; + if (!page) return -ENOMEM; - } if (tmp_buf) free_page(page); else @@ -3211,7 +3211,6 @@ (info->flags & ASYNC_CLOSING)) { if (info->flags & ASYNC_CLOSING) interruptible_sleep_on(&info->close_wait); - MOD_DEC_USE_COUNT; #ifdef SERIAL_DO_RESTART return ((info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); @@ -3224,10 +3223,8 @@ * Start up serial port */ retval = startup(info); - if (retval) { - MOD_DEC_USE_COUNT; + if (retval) return retval; - } retval = block_til_ready(tty, filp, info); if (retval) { @@ -3235,7 +3232,6 @@ printk("rs_open returning after block_til_ready with %d\n", retval); #endif - MOD_DEC_USE_COUNT; return retval; } @@ -3752,7 +3748,6 @@ state->type = PORT_16550A; break; } -#ifndef CONFIG_COBALT_MICRO_SERVER if (state->type == PORT_16550A) { /* Check for Startech UART's */ serial_outp(info, UART_LCR, UART_LCR_DLAB); @@ -3787,7 +3782,6 @@ } serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO); } -#endif #if defined(CONFIG_SERIAL_RSA) && defined(MODULE) if (state->type == PORT_16550A) { int i; @@ -5422,6 +5416,7 @@ #endif serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64 + SERIAL_DEV_OFFSET; + serial_driver.name_base = SERIAL_DEV_OFFSET; serial_driver.num = NR_PORTS; serial_driver.type = TTY_DRIVER_TYPE_SERIAL; serial_driver.subtype = SERIAL_TYPE_NORMAL; @@ -5514,7 +5509,7 @@ && (state->port != 0 || state->iomem_base != 0)) state->irq = detect_uart_irq(state); if (state->io_type == SERIAL_IO_MEM) { - printk(KERN_INFO "ttyS%02d%s at 0x%p (irq = %d) is a %s\n", + printk(KERN_INFO"ttyS%02d%s at 0x%px (irq = %d) is a %s\n", state->line + SERIAL_DEV_OFFSET, (state->flags & ASYNC_FOURPORT) ? " FourPort" : "", state->iomem_base, state->irq, |