diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
commit | 012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch) | |
tree | 87efc733f9b164e8c85c0336f92c8fb7eff6d183 /drivers/sbus | |
parent | 625a1589d3d6464b5d90b8a0918789e3afffd220 (diff) |
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found
that this kernel will only boot SMP on Origin; the UP kernel freeze
soon after bootup with SCSI timeout messages. I commit this anyway
since I found that the last CVS versions had the same problem.
Diffstat (limited to 'drivers/sbus')
-rw-r--r-- | drivers/sbus/audio/dbri.c | 11 | ||||
-rw-r--r-- | drivers/sbus/char/Makefile | 6 | ||||
-rw-r--r-- | drivers/sbus/char/bpp.c | 15 | ||||
-rw-r--r-- | drivers/sbus/char/display7seg.c | 10 | ||||
-rw-r--r-- | drivers/sbus/char/openprom.c | 32 | ||||
-rw-r--r-- | drivers/sbus/char/rtc.c | 8 | ||||
-rw-r--r-- | drivers/sbus/char/sab82532.c | 193 | ||||
-rw-r--r-- | drivers/sbus/char/su.c | 54 | ||||
-rw-r--r-- | drivers/sbus/char/sunkbd.c | 51 | ||||
-rw-r--r-- | drivers/sbus/char/sunmouse.c | 26 | ||||
-rw-r--r-- | drivers/sbus/char/vfc_dev.c | 1 | ||||
-rw-r--r-- | drivers/sbus/char/zs.c | 29 |
12 files changed, 256 insertions, 180 deletions
diff --git a/drivers/sbus/audio/dbri.c b/drivers/sbus/audio/dbri.c index 45ee9dd1b..b3a53b4a7 100644 --- a/drivers/sbus/audio/dbri.c +++ b/drivers/sbus/audio/dbri.c @@ -1,4 +1,4 @@ -/* $Id: dbri.c,v 1.19 2000/02/18 13:49:42 davem Exp $ +/* $Id: dbri.c,v 1.21 2000/08/31 23:44:17 davem Exp $ * drivers/sbus/audio/dbri.c * * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de) @@ -226,7 +226,7 @@ static void dbri_detach(struct dbri *dbri) free_irq(dbri->irq, dbri); sbus_iounmap(dbri->regs, dbri->regs_size); sbus_free_consistent(dbri->sdev, sizeof(struct dbri_dma), - dbri->dma, dbri->dma_dvma); + (void *)dbri->dma, dbri->dma_dvma); kfree(dbri); } @@ -2079,7 +2079,9 @@ void dbri_liu_activate(int dev, int priority) void dbri_liu_deactivate(int dev) { struct dbri *dbri; +#if 0 u32 tmp; +#endif if (dev >= num_drivers) return; @@ -2228,7 +2230,6 @@ static int dbri_attach(struct sparcaudio_driver *drv, { struct dbri *dbri; struct linux_prom_irqs irq; - __u32 dma_dvma; int err; if (sdev->prom_name[9] < 'e') { @@ -2265,7 +2266,7 @@ static int dbri_attach(struct sparcaudio_driver *drv, if (!dbri->regs) { printk(KERN_ERR "DBRI: could not allocate registers\n"); sbus_free_consistent(sdev, sizeof(struct dbri_dma), - dbri->dma, dbri->dma_dvma); + (void *)dbri->dma, dbri->dma_dvma); kfree(drv->private); return -EIO; } @@ -2279,7 +2280,7 @@ static int dbri_attach(struct sparcaudio_driver *drv, printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); sbus_iounmap(dbri->regs, dbri->regs_size); sbus_free_consistent(sdev, sizeof(struct dbri_dma), - dbri->dma, dbri->dma_dvma); + (void *)dbri->dma, dbri->dma_dvma); kfree(drv->private); return err; } diff --git a/drivers/sbus/char/Makefile b/drivers/sbus/char/Makefile index 84ee1ad22..7c5a21b2c 100644 --- a/drivers/sbus/char/Makefile +++ b/drivers/sbus/char/Makefile @@ -19,7 +19,8 @@ ifeq ($(ARCH),sparc64) ifeq ($(CONFIG_PCI),y) -O_OBJS += su.o pcikbd.o +OX_OBJS += su.o +O_OBJS += pcikbd.o ifeq ($(CONFIG_SAB82532),y) O_OBJS += sab82532.o @@ -58,7 +59,8 @@ endif else # !eq($(ARCH),sparc64) ifeq ($(CONFIG_PCI),y) -O_OBJS += su.o pcikbd.o +OX_OBJS += su.o +O_OBJS += pcikbd.o endif endif # !eq($(ARCH),sparc64) diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index 56f9d38af..133246129 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c @@ -507,7 +507,8 @@ static long read_nibble(unsigned minor, char *c, unsigned long cnt) if (pins & BPP_GP_PError) byte |= 0x40; if (pins & BPP_GP_Busy) byte |= 0x80; - put_user_ret(byte, c, -EFAULT); + if (put_user(byte, c)) + return -EFAULT; c += 1; remaining -= 1; @@ -559,7 +560,8 @@ static long read_ecp(unsigned minor, char *c, unsigned long cnt) for (idx = 0 ; idx < repeat ; idx += 1) buffer[idx] = instances[minor].repeat_byte; - copy_to_user_ret(c, buffer, repeat, -EFAULT); + if (copy_to_user(c, buffer, repeat)) + return -EFAULT; remaining -= repeat; c += repeat; instances[minor].run_length -= repeat; @@ -575,7 +577,8 @@ static long read_ecp(unsigned minor, char *c, unsigned long cnt) if (rc & BPP_GP_Busy) { /* OK, this is data. read it in. */ unsigned char byte = bpp_inb(base_addrs[minor]); - put_user_ret(byte, c, -EFAULT); + if (put_user(byte, c)) + return -EFAULT; c += 1; remaining -= 1; @@ -685,7 +688,8 @@ static long write_compat(unsigned minor, const char *c, unsigned long cnt) while (remaining > 0) { unsigned char byte; - get_user_ret(byte, c, -EFAULT); + if (get_user(byte, c)) + return -EFAULT; c += 1; rc = wait_for(BPP_GP_nAck, BPP_GP_Busy, TIME_IDLE_LIMIT, minor); @@ -735,7 +739,8 @@ static long write_ecp(unsigned minor, const char *c, unsigned long cnt) unsigned char byte; int rc; - get_user_ret(byte, c, -EFAULT); + if (get_user(byte, c)) + return -EFAULT; rc = wait_for(0, BPP_GP_Busy, TIME_PResponse, minor); if (rc == -1) return -ETIMEDOUT; diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index c9d4ea0f6..2ee0aee37 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -1,4 +1,4 @@ -/* $Id: display7seg.c,v 1.2 2000/08/02 06:22:35 davem Exp $ +/* $Id: display7seg.c,v 1.3 2000/08/29 07:01:55 davem Exp $ * * display7seg - Driver implementation for the 7-segment display * present on Sun Microsystems CP1400 and CP1500 @@ -18,7 +18,7 @@ #include <linux/ioport.h> /* request_region, check_region */ #include <asm/ebus.h> /* EBus device */ #include <asm/oplib.h> /* OpenProm Library */ -#include <asm/uaccess.h> /* put_/get_user_ret */ +#include <asm/uaccess.h> /* put_/get_user */ #include <asm/display7seg.h> @@ -132,7 +132,8 @@ static int d7s_ioctl(struct inode *inode, struct file *f, /* assign device register values * we mask-out D7S_FLIP if in sol_compat mode */ - get_user_ret(ireg, (int *) arg, -EFAULT); + if (get_user(ireg, (int *) arg)) + return -EFAULT; if (0 != sol_compat) { (regs & D7S_FLIP) ? (ireg |= D7S_FLIP) : (ireg &= ~D7S_FLIP); @@ -147,7 +148,8 @@ static int d7s_ioctl(struct inode *inode, struct file *f, * This driver will not misinform you about the state * of your hardware while in sol_compat mode */ - put_user_ret(regs, (int *) arg, -EFAULT); + if (put_user(regs, (int *) arg)) + return -EFAULT; break; case D7SIOCTM: diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index c38101957..26e5ae8d9 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -73,7 +73,8 @@ static int copyin(struct openpromio *info, struct openpromio **opp_p) if (!info || !opp_p) return -EFAULT; - get_user_ret(bufsize, &info->oprom_size, -EFAULT); + if (get_user(bufsize, &info->oprom_size)) + return -EFAULT; if (bufsize == 0) return -EINVAL; @@ -132,7 +133,8 @@ static int getstrings(struct openpromio *info, struct openpromio **opp_p) */ static int copyout(void *info, struct openpromio *opp, int len) { - copy_to_user_ret(info, opp, len, -EFAULT); + if (copy_to_user(info, opp, len)) + return -EFAULT; return 0; } @@ -364,7 +366,8 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, switch (cmd) { case OPIOCGET: - copy_from_user_ret(&op, (void *)arg, sizeof(op), -EFAULT); + if (copy_from_user(&op, (void *)arg, sizeof(op))) + return -EFAULT; if (!goodnode(op.op_nodeid,data)) return -EINVAL; @@ -386,9 +389,10 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, if (len <= 0) { kfree(str); - /* Verified by the above copy_from_user_ret */ - __copy_to_user_ret((void *)arg, &op, - sizeof(op), -EFAULT); + /* Verified by the above copy_from_user */ + if (__copy_to_user((void *)arg, &op, + sizeof(op))) + return -EFAULT; return 0; } @@ -414,7 +418,8 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, return error; case OPIOCNEXTPROP: - copy_from_user_ret(&op, (void *)arg, sizeof(op), -EFAULT); + if (copy_from_user(&op, (void *)arg, sizeof(op))) + return -EFAULT; if (!goodnode(op.op_nodeid,data)) return -EINVAL; @@ -457,7 +462,8 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, return error; case OPIOCSET: - copy_from_user_ret(&op, (void *)arg, sizeof(op), -EFAULT); + if (copy_from_user(&op, (void *)arg, sizeof(op))) + return -EFAULT; if (!goodnode(op.op_nodeid,data)) return -EINVAL; @@ -485,13 +491,14 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, return 0; case OPIOCGETOPTNODE: - copy_to_user_ret((void *)arg, &options_node, - sizeof(int), -EFAULT); + if (copy_to_user((void *)arg, &options_node, sizeof(int))) + return -EFAULT; return 0; case OPIOCGETNEXT: case OPIOCGETCHILD: - copy_from_user_ret(&node, (void *)arg, sizeof(int), -EFAULT); + if (copy_from_user(&node, (void *)arg, sizeof(int))) + return -EFAULT; save_and_cli(flags); if (cmd == OPIOCGETNEXT) @@ -500,7 +507,8 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, node = __prom_getchild(node); restore_flags(flags); - __copy_to_user_ret((void *)arg, &node, sizeof(int), -EFAULT); + if (__copy_to_user((void *)arg, &node, sizeof(int))) + return -EFAULT; return 0; diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c index de875f5f6..d8454cf25 100644 --- a/drivers/sbus/char/rtc.c +++ b/drivers/sbus/char/rtc.c @@ -1,4 +1,4 @@ -/* $Id: rtc.c,v 1.22 2000/08/22 06:56:33 davem Exp $ +/* $Id: rtc.c,v 1.23 2000/08/29 07:01:55 davem Exp $ * * Linux/SPARC Real Time Clock Driver * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) @@ -97,7 +97,8 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case RTCGET: get_rtc_time(&rtc_tm); - copy_to_user_ret((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time), -EFAULT); + if (copy_to_user((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time))) + return -EFAULT; return 0; @@ -106,7 +107,8 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (!capable(CAP_SYS_TIME)) return -EPERM; - copy_from_user_ret(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time), -EFAULT); + if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time))) + return -EFAULT; set_rtc_time(&rtc_tm); diff --git a/drivers/sbus/char/sab82532.c b/drivers/sbus/char/sab82532.c index 05a92c82c..7d010f035 100644 --- a/drivers/sbus/char/sab82532.c +++ b/drivers/sbus/char/sab82532.c @@ -1,4 +1,4 @@ -/* $Id: sab82532.c,v 1.47 2000/08/16 21:12:14 ecd Exp $ +/* $Id: sab82532.c,v 1.51 2000/09/04 19:41:26 ecd Exp $ * sab82532.c: ASYNC Driver for the SIEMENS SAB82532 DUSCC. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -55,9 +55,11 @@ static int sab82532_refcount; /* Set of debugging defines */ #undef SERIAL_DEBUG_OPEN #undef SERIAL_DEBUG_FLOW +#undef SERIAL_DEBUG_MODEM #undef SERIAL_DEBUG_WAIT_UNTIL_SENT #undef SERIAL_DEBUG_SEND_BREAK #undef SERIAL_DEBUG_INTR +#define SERIAL_DEBUG_OVERFLOW 1 /* Trace things on serial device, useful for console debugging: */ #undef SERIAL_LOG_DEVICE @@ -79,10 +81,15 @@ static struct tty_struct *sab82532_table[NR_PORTS]; static struct termios *sab82532_termios[NR_PORTS]; static struct termios *sab82532_termios_locked[NR_PORTS]; +#ifdef MODULE +#undef CONFIG_SERIAL_CONSOLE +#endif + #ifdef CONFIG_SERIAL_CONSOLE extern int serial_console; static struct console sab82532_console; static int sab82532_console_init(void); +static void batten_down_hatches(struct sab82532 *info); #endif #ifndef MIN @@ -208,7 +215,10 @@ static __inline__ void sab82532_start_tx(struct sab82532 *info) if (!(readb(&info->regs->r.star) & SAB82532_STAR_XFW)) goto out; + info->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS); + writeb(info->interrupt_mask1, &info->regs->w.imr1); info->all_sent = 0; + for (i = 0; i < info->xmit_fifo_size; i++) { u8 val = info->xmit_buf[info->xmit_tail++]; writeb(val, &info->regs->w.xfifo[i]); @@ -264,47 +274,6 @@ static void sab82532_start(struct tty_struct *tty) restore_flags(flags); } -static void batten_down_hatches(struct sab82532 *info) -{ - unsigned char saved_rfc, tmp; - - if (!stop_a_enabled) - return; - - /* If we are doing kadb, we call the debugger - * else we just drop into the boot monitor. - * Note that we must flush the user windows - * first before giving up control. - */ - printk("\n"); - flush_user_windows(); - - /* - * Set FIFO to single character mode. - */ - saved_rfc = readb(&info->regs->r.rfc); - tmp = readb(&info->regs->rw.rfc); - tmp &= ~(SAB82532_RFC_RFDF); - writeb(tmp, &info->regs->rw.rfc); - sab82532_cec_wait(info); - writeb(SAB82532_CMDR_RRES, &info->regs->w.cmdr); - -#ifndef __sparc_v9__ - if ((((unsigned long)linux_dbvec) >= DEBUG_FIRSTVADDR) && - (((unsigned long)linux_dbvec) <= DEBUG_LASTVADDR)) - sp_enter_debugger(); - else -#endif - prom_cmdline(); - - /* - * Reset FIFO to character + status mode. - */ - writeb(saved_rfc, &info->regs->w.rfc); - sab82532_cec_wait(info); - writeb(SAB82532_CMDR_RRES, &info->regs->w.cmdr); -} - /* * ---------------------------------------------------------------------- * @@ -361,12 +330,11 @@ static inline void receive_chars(struct sab82532 *info, if (stat->sreg.isr0 & SAB82532_ISR0_TIME) { sab82532_cec_wait(info); writeb(SAB82532_CMDR_RFRD, &info->regs->w.cmdr); - /* Wait for command execution, to catch the TCD below. */ - sab82532_cec_wait(info); + return; } if (stat->sreg.isr0 & SAB82532_ISR0_RFO) { -#if 1 +#ifdef SERIAL_DEBUG_OVERFLOW printk("sab82532: receive_chars: RFO"); #endif free_fifo++; @@ -382,14 +350,16 @@ static inline void receive_chars(struct sab82532 *info, writeb(SAB82532_CMDR_RMC, &info->regs->w.cmdr); } +#ifdef CONFIG_SERIAL_CONSOLE if (info->is_console) wake_up(&keypress_wait); +#endif if (!tty) return; for (i = 0; i < count; ) { if (tty->flip.count >= TTY_FLIPBUF_SIZE) { -#if 1 +#ifdef SERIAL_DEBUG_OVERFLOW printk("sab82532: receive_chars: tty overrun\n"); #endif info->icount.buf_overrun++; @@ -424,9 +394,13 @@ static inline void transmit_chars(struct sab82532 *info, { int i; - if (stat->sreg.isr1 & SAB82532_ISR1_ALLS) + if (stat->sreg.isr1 & SAB82532_ISR1_ALLS) { + info->interrupt_mask1 |= SAB82532_IMR1_ALLS; + writeb(info->interrupt_mask1, &info->regs->w.imr1); info->all_sent = 1; - if (!(readb(&info->regs->r.star) & SAB82532_STAR_XFW)) + } + + if (!(stat->sreg.isr1 & SAB82532_ISR1_XPR)) return; if (!info->tty) { @@ -442,8 +416,11 @@ static inline void transmit_chars(struct sab82532 *info, return; } - /* Stuff 32 bytes into Transmit FIFO. */ + info->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS); + writeb(info->interrupt_mask1, &info->regs->w.imr1); info->all_sent = 0; + + /* Stuff 32 bytes into Transmit FIFO. */ for (i = 0; i < info->xmit_fifo_size; i++) { u8 val = info->xmit_buf[info->xmit_tail++]; writeb(val, &info->regs->w.xfifo[i]); @@ -476,10 +453,12 @@ static inline void check_status(struct sab82532 *info, int modem_change = 0; if (stat->sreg.isr1 & SAB82532_ISR1_BRK) { +#ifdef CONFIG_SERIAL_CONSOLE if (info->is_console) { batten_down_hatches(info); return; } +#endif if (tty->flip.count >= TTY_FLIPBUF_SIZE) { info->icount.buf_overrun++; goto check_modem; @@ -509,7 +488,7 @@ check_modem: info->dcd = (readb(&info->regs->r.vstr) & SAB82532_VSTR_CD) ? 0 : 1; info->icount.dcd++; modem_change++; -#if 0 +#ifdef SERIAL_DEBUG_MODEM printk("DCD change: %d\n", info->icount.dcd); #endif } @@ -517,7 +496,7 @@ check_modem: info->cts = readb(&info->regs->r.star) & SAB82532_STAR_CTS; info->icount.cts++; modem_change++; -#if 0 +#ifdef SERIAL_DEBUG_MODEM printk("CTS change: %d, CTS %s\n", info->icount.cts, info->cts ? "on" : "off"); #endif } @@ -525,7 +504,7 @@ check_modem: info->dsr = (readb(&info->regs->r.pvr) & info->pvr_dsr_bit) ? 0 : 1; info->icount.dsr++; modem_change++; -#if 0 +#ifdef SERIAL_DEBUG_MODEM printk("DSR change: %d\n", info->icount.dsr); #endif } @@ -828,10 +807,12 @@ static int startup(struct sab82532 *info) info->interrupt_mask0 = SAB82532_IMR0_PERR | SAB82532_IMR0_FERR | SAB82532_IMR0_PLLA; writeb(info->interrupt_mask0, &info->regs->w.imr0); - info->interrupt_mask1 = SAB82532_IMR1_BRKT | SAB82532_IMR1_XOFF | - SAB82532_IMR1_TIN | SAB82532_IMR1_CSC | - SAB82532_IMR1_XON | SAB82532_IMR1_XPR; + info->interrupt_mask1 = SAB82532_IMR1_BRKT | SAB82532_IMR1_ALLS | + SAB82532_IMR1_XOFF | SAB82532_IMR1_TIN | + SAB82532_IMR1_CSC | SAB82532_IMR1_XON | + SAB82532_IMR1_XPR; writeb(info->interrupt_mask1, &info->regs->w.imr1); + info->all_sent = 1; if (info->tty) clear_bit(TTY_IO_ERROR, &info->tty->flags); @@ -880,6 +861,7 @@ static void shutdown(struct sab82532 *info) info->xmit_buf = 0; } +#ifdef CONFIG_SERIAL_CONSOLE if (info->is_console) { info->interrupt_mask0 = SAB82532_IMR0_PERR | SAB82532_IMR0_FERR | SAB82532_IMR0_PLLA | SAB82532_IMR0_CDSC; @@ -895,6 +877,7 @@ static void shutdown(struct sab82532 *info) restore_flags(flags); return; } +#endif /* Disable Interrupts */ info->interrupt_mask0 = 0xff; @@ -1238,10 +1221,6 @@ static void sab82532_throttle(struct tty_struct * tty) if (I_IXOFF(tty)) sab82532_send_xchar(tty, STOP_CHAR(tty)); -#if 0 - if (tty->termios->c_cflag & CRTSCTS) - writeb(readb(&info->regs->rw.mode) | SAB82532_MODE_RTS, &info->regs->rw.mode); -#endif } static void sab82532_unthrottle(struct tty_struct * tty) @@ -1263,11 +1242,6 @@ static void sab82532_unthrottle(struct tty_struct * tty) else sab82532_send_xchar(tty, START_CHAR(tty)); } - -#if 0 - if (tty->termios->c_cflag & CRTSCTS) - writeb(readb(&info->regs->rw.mode) & ~(SAB82532_MODE_RTS), &info->regs->rw.mode); -#endif } /* @@ -1562,18 +1536,6 @@ static void sab82532_set_termios(struct tty_struct *tty, tty->hw_stopped = 0; sab82532_start(tty); } - -#if 0 - /* - * No need to wake up processes in open wait, since they - * sample the CLOCAL flag once, and don't recheck it. - * XXX It's not clear whether the current behavior is correct - * or not. Hence, this may change..... - */ - if (!(old_termios->c_cflag & CLOCAL) && - (tty->termios->c_cflag & CLOCAL)) - wake_up_interruptible(&info->open_wait); -#endif } /* @@ -1651,9 +1613,6 @@ static void sab82532_close(struct tty_struct *tty, struct file * filp) */ info->interrupt_mask0 |= SAB82532_IMR0_TCD; writeb(info->interrupt_mask0, &info->regs->w.imr0); -#if 0 - writeb(readb(&info->regs->rw.mode) & ~(SAB82532_MODE_RAC), &info->regs->rw.mode); -#endif if (info->flags & ASYNC_INITIALIZED) { /* * Before we drop DTR, make sure the UART transmitter @@ -1722,7 +1681,6 @@ static void sab82532_wait_until_sent(struct tty_struct *tty, int timeout) if (timeout && time_after(jiffies, orig_jiffies + timeout)) break; } - current->state = TASK_RUNNING; #ifdef SERIAL_DEBUG_WAIT_UNTIL_SENT printk("xmit_cnt = %d, alls = %d (jiff=%lu)...done\n", info->xmit_cnt, info->all_sent, jiffies); #endif @@ -1738,8 +1696,10 @@ static void sab82532_hangup(struct tty_struct *tty) if (serial_paranoia_check(info, tty->device, "sab82532_hangup")) return; +#ifdef CONFIG_SERIAL_CONSOLE if (info->is_console) return; +#endif sab82532_flush_buffer(tty); shutdown(info); @@ -1873,7 +1833,6 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, #endif schedule(); } - current->state = TASK_RUNNING; remove_wait_queue(&info->open_wait, &wait); if (!tty_hung_up_p(filp)) info->count++; @@ -2010,7 +1969,7 @@ line_info(char *buf, struct sab82532 *info) char stat_buf[30]; int ret; - ret = sprintf(buf, "%d: uart:SAB82532 ", info->line); + ret = sprintf(buf, "%u: uart:SAB82532 ", info->line); switch (info->type) { case 0: ret += sprintf(buf+ret, "V1.0 "); @@ -2056,19 +2015,22 @@ line_info(char *buf, struct sab82532 *info) restore_flags(flags); if (info->baud) - ret += sprintf(buf+ret, " baud:%d", info->baud); + ret += sprintf(buf+ret, " baud:%u", info->baud); + + ret += sprintf(buf+ret, " tx:%u rx:%u", + info->icount.tx, info->icount.rx); if (info->icount.frame) - ret += sprintf(buf+ret, " fe:%d", info->icount.frame); + ret += sprintf(buf+ret, " fe:%u", info->icount.frame); if (info->icount.parity) - ret += sprintf(buf+ret, " pe:%d", info->icount.parity); + ret += sprintf(buf+ret, " pe:%u", info->icount.parity); if (info->icount.brk) - ret += sprintf(buf+ret, " brk:%d", info->icount.brk); + ret += sprintf(buf+ret, " brk:%u", info->icount.brk); if (info->icount.overrun) - ret += sprintf(buf+ret, " oe:%d", info->icount.overrun); + ret += sprintf(buf+ret, " oe:%u", info->icount.overrun); /* * Last thing is the RS-232 status lines. @@ -2161,15 +2123,17 @@ ebus_done: return 0; } +#ifndef MODULE static void __init sab82532_kgdb_hook(int line) { prom_printf("sab82532: kgdb support is not implemented, yet\n"); prom_halt(); } +#endif static inline void __init show_serial_version(void) { - char *revision = "$Revision: 1.47 $"; + char *revision = "$Revision: 1.51 $"; char *version, *p; version = strchr(revision, ' '); @@ -2246,7 +2210,11 @@ int __init sab82532_init(void) * major number and the subtype code. */ callout_driver = serial_driver; +#ifdef CONFIG_DEVFS_FS callout_driver.name = "cua/%d"; +#else + callout_driver.name = "cua"; +#endif callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; callout_driver.read_proc = 0; @@ -2364,8 +2332,10 @@ found: #ifdef CONFIG_SERIAL_CONSOLE sunserial_setinitfunc(sab82532_console_init); #endif +#ifndef MODULE sunserial_setinitfunc(sab82532_init); rs_ops.rs_kgdb_hook = sab82532_kgdb_hook; +#endif return 0; } @@ -2400,12 +2370,56 @@ void cleanup_module(void) free_page((unsigned long) tmp_buf); tmp_buf = NULL; } - for (sab = sab82532_chain; sab; sab = sab->next) + for (sab = sab82532_chain; sab; sab = sab->next) { + if (!(sab->line & 0x01)) + free_irq(sab->irq, sab); iounmap(sab->regs); + } } #endif /* MODULE */ #ifdef CONFIG_SERIAL_CONSOLE +static void +batten_down_hatches(struct sab82532 *info) +{ + unsigned char saved_rfc, tmp; + + if (!stop_a_enabled) + return; + + /* If we are doing kadb, we call the debugger + * else we just drop into the boot monitor. + * Note that we must flush the user windows + * first before giving up control. + */ + printk("\n"); + flush_user_windows(); + + /* + * Set FIFO to single character mode. + */ + saved_rfc = readb(&info->regs->r.rfc); + tmp = readb(&info->regs->rw.rfc); + tmp &= ~(SAB82532_RFC_RFDF); + writeb(tmp, &info->regs->rw.rfc); + sab82532_cec_wait(info); + writeb(SAB82532_CMDR_RRES, &info->regs->w.cmdr); + +#ifndef __sparc_v9__ + if ((((unsigned long)linux_dbvec) >= DEBUG_FIRSTVADDR) && + (((unsigned long)linux_dbvec) <= DEBUG_LASTVADDR)) + sp_enter_debugger(); + else +#endif + prom_cmdline(); + + /* + * Reset FIFO to character + status mode. + */ + writeb(saved_rfc, &info->regs->w.rfc); + sab82532_cec_wait(info); + writeb(SAB82532_CMDR_RRES, &info->regs->w.cmdr); +} static __inline__ void sab82532_console_putchar(struct sab82532 *info, char c) @@ -2645,4 +2659,3 @@ dprintf(const char *fmt, ...) } #endif /* SERIAL_LOG_DEVICE */ #endif /* CONFIG_SERIAL_CONSOLE */ - diff --git a/drivers/sbus/char/su.c b/drivers/sbus/char/su.c index 6df7d9911..c6e90328e 100644 --- a/drivers/sbus/char/su.c +++ b/drivers/sbus/char/su.c @@ -1,4 +1,4 @@ -/* $Id: su.c,v 1.38 2000/04/22 00:45:16 davem Exp $ +/* $Id: su.c,v 1.41 2000/09/04 19:41:27 ecd Exp $ * su.c: Small serial driver for keyboard/mouse interface on sparc32/PCI * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -1851,7 +1851,6 @@ su_wait_until_sent(struct tty_struct *tty, int timeout) if (timeout && time_after(jiffies, orig_jiffies + timeout)) break; } - current->state = TASK_RUNNING; #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies); #endif @@ -2002,7 +2001,6 @@ block_til_ready(struct tty_struct *tty, struct file * filp, #endif schedule(); } - current->state = TASK_RUNNING; remove_wait_queue(&info->open_wait, &wait); if (extra_count) info->count++; @@ -2125,14 +2123,12 @@ line_info(char *buf, struct su_struct *info) int ret; unsigned long flags; - ret = sprintf(buf, "%d: uart:%s port:%X irq:%s", - info->line, uart_config[info->type].name, - (int)info->port, __irq_itoa(info->irq)); + if (info->port == 0 || info->type == PORT_UNKNOWN) + return 0; - if (info->port == 0 || info->type == PORT_UNKNOWN) { - ret += sprintf(buf+ret, "\n"); - return ret; - } + ret = sprintf(buf, "%u: uart:%s port:%lX irq:%s", + info->line, uart_config[info->type].name, + (unsigned long)info->port, __irq_itoa(info->irq)); /* * Figure out the current RS-232 lines @@ -2158,24 +2154,24 @@ line_info(char *buf, struct su_struct *info) strcat(stat_buf, "|RI"); if (info->quot) { - ret += sprintf(buf+ret, " baud:%d", + ret += sprintf(buf+ret, " baud:%u", info->baud_base / info->quot); } - ret += sprintf(buf+ret, " tx:%d rx:%d", - info->icount.tx, info->icount.rx); + ret += sprintf(buf+ret, " tx:%u rx:%u", + info->icount.tx, info->icount.rx); if (info->icount.frame) - ret += sprintf(buf+ret, " fe:%d", info->icount.frame); + ret += sprintf(buf+ret, " fe:%u", info->icount.frame); if (info->icount.parity) - ret += sprintf(buf+ret, " pe:%d", info->icount.parity); + ret += sprintf(buf+ret, " pe:%u", info->icount.parity); if (info->icount.brk) - ret += sprintf(buf+ret, " brk:%d", info->icount.brk); + ret += sprintf(buf+ret, " brk:%u", info->icount.brk); if (info->icount.overrun) - ret += sprintf(buf+ret, " oe:%d", info->icount.overrun); + ret += sprintf(buf+ret, " oe:%u", info->icount.overrun); /* * Last thing is the RS-232 status lines @@ -2223,7 +2219,7 @@ done: */ static __inline__ void __init show_su_version(void) { - char *revision = "$Revision: 1.38 $"; + char *revision = "$Revision: 1.41 $"; char *version, *p; version = strchr(revision, ' '); @@ -2425,6 +2421,7 @@ ebus_done: * numbers start, we always are probed for first. */ int su_num_ports = 0; +EXPORT_SYMBOL(su_num_ports); /* * The serial driver boot-time initialization code! @@ -2442,7 +2439,11 @@ int __init su_serial_init(void) memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; serial_driver.driver_name = "su"; - serial_driver.name = "ttys/%d"; +#ifdef CONFIG_DEVFS_FS + serial_driver.name = "tts/%d"; +#else + serial_driver.name = "ttyS"; +#endif serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = NR_PORTS; @@ -2482,7 +2483,11 @@ int __init su_serial_init(void) * major number and the subtype code. */ callout_driver = serial_driver; +#ifdef CONFIG_DEVFS_FS callout_driver.name = "cua/%d"; +#else + callout_driver.name = "cua"; +#endif callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; callout_driver.read_proc = 0; @@ -2598,6 +2603,17 @@ void __init su_probe_any(struct su_probe_scan *t, int sunode) t->msx = t->devices; info->port_type = SU_PORT_MS; } else { +#ifdef __sparc_v9__ + /* + * Do not attempt to use the truncated + * keyboard/mouse ports as serial ports + * on Ultras with PC keyboard attached. + */ + if (prom_getbool(sunode, "mouse")) + continue; + if (prom_getbool(sunode, "keyboard")) + continue; +#endif info->port_type = SU_PORT_PORT; } info->is_console = 0; diff --git a/drivers/sbus/char/sunkbd.c b/drivers/sbus/char/sunkbd.c index cc71cab7e..5540e734b 100644 --- a/drivers/sbus/char/sunkbd.c +++ b/drivers/sbus/char/sunkbd.c @@ -1346,19 +1346,22 @@ repeat: #ifdef CONFIG_SPARC32_COMPAT if (current->thread.flags & SPARC_FLAG_32BIT) { - copy_to_user_ret((Firm_event *)p, &this_event, - sizeof(Firm_event)-sizeof(struct timeval), - -EFAULT); + if (copy_to_user((Firm_event *)p, &this_event, + sizeof(Firm_event)-sizeof(struct timeval))) + return -EFAULT; p += sizeof(Firm_event)-sizeof(struct timeval); - __put_user_ret(this_event.time.tv_sec, (u32 *)p, -EFAULT); + if (__put_user(this_event.time.tv_sec, (u32 *)p)) + return -EFAULT; p += sizeof(u32); - __put_user_ret(this_event.time.tv_usec, (u32 *)p, -EFAULT); + if (__put_user(this_event.time.tv_usec, (u32 *)p)) + return -EFAULT; p += sizeof(u32); } else #endif { - copy_to_user_ret((Firm_event *)p, &this_event, - sizeof(Firm_event), -EFAULT); + if (copy_to_user((Firm_event *)p, &this_event, + sizeof(Firm_event))) + return -EFAULT; p += sizeof (Firm_event); } #ifdef KBD_DEBUG @@ -1401,22 +1404,27 @@ kbd_ioctl (struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) switch (cmd){ case KIOCTYPE: /* return keyboard type */ - put_user_ret(sunkbd_type, (int *) arg, -EFAULT); + if (put_user(sunkbd_type, (int *) arg)) + return -EFAULT; break; case KIOCGTRANS: - put_user_ret(TR_UNTRANS_EVENT, (int *) arg, -EFAULT); + if (put_user(TR_UNTRANS_EVENT, (int *) arg)) + return -EFAULT; break; case KIOCTRANS: - get_user_ret(value, (int *) arg, -EFAULT); + if (get_user(value, (int *) arg)) + return -EFAULT; if (value != TR_UNTRANS_EVENT) return -EINVAL; break; case KIOCLAYOUT: - put_user_ret(sunkbd_layout, (int *) arg, -EFAULT); + if (put_user(sunkbd_layout, (int *) arg)) + return -EFAULT; break; case KIOCSDIRECT: #ifndef CODING_NEW_DRIVER - get_user_ret(value, (int *) arg, -EFAULT); + if (get_user(value, (int *) arg)) + return -EFAULT; if(value) kbd_redirected = fg_console + 1; else @@ -1425,7 +1433,8 @@ kbd_ioctl (struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) #endif break; case KIOCCMD: - get_user_ret(value, (int *) arg, -EFAULT); + if (get_user(value, (int *) arg)) + return -EFAULT; c = (unsigned char) value; switch (c) { case SKBDCMD_CLICK: @@ -1444,8 +1453,9 @@ kbd_ioctl (struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) return -EINVAL; } case KIOCSLED: - get_user_ret(c, (unsigned char *) arg, -EFAULT); - + if (get_user(c, (unsigned char *) arg)) + return -EFAULT; + if (c & LED_SCRLCK) leds |= (1 << VC_SCROLLOCK); if (c & LED_NLOCK) leds |= (1 << VC_NUMLOCK); if (c & LED_CLOCK) leds |= (1 << VC_CAPSLOCK); @@ -1453,7 +1463,8 @@ kbd_ioctl (struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) sun_setledstate(kbd_table + fg_console, leds); break; case KIOCGLED: - put_user_ret(vcleds_to_sunkbd(getleds()), (unsigned char *) arg, -EFAULT); + if (put_user(vcleds_to_sunkbd(getleds()), (unsigned char *) arg)) + return -EFAULT; break; case KIOCGRATE: { @@ -1465,8 +1476,9 @@ kbd_ioctl (struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) else rate.rate = 0; - copy_to_user_ret((struct kbd_rate *)arg, &rate, - sizeof(struct kbd_rate), -EFAULT); + if (copy_to_user((struct kbd_rate *)arg, &rate, + sizeof(struct kbd_rate))) + return -EFAULT; return 0; } @@ -1495,7 +1507,8 @@ kbd_ioctl (struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) int count; count = kbd_head - kbd_tail; - put_user_ret((count < 0) ? KBD_QSIZE - count : count, (int *) arg, -EFAULT); + if (put_user((count < 0) ? KBD_QSIZE - count : count, (int *) arg)) + return -EFAULT; return 0; } default: diff --git a/drivers/sbus/char/sunmouse.c b/drivers/sbus/char/sunmouse.c index b9dd25653..fd92bc434 100644 --- a/drivers/sbus/char/sunmouse.c +++ b/drivers/sbus/char/sunmouse.c @@ -462,21 +462,24 @@ repeat: ((sizeof(Firm_event) - sizeof(struct timeval) + (sizeof(u32) * 2)))) break; - copy_to_user_ret((Firm_event *)p, &this_event, - sizeof(Firm_event)-sizeof(struct timeval), - -EFAULT); + if (copy_to_user((Firm_event *)p, &this_event, + sizeof(Firm_event)-sizeof(struct timeval))) + return -EFAULT; p += sizeof(Firm_event)-sizeof(struct timeval); - __put_user_ret(this_event.time.tv_sec, (u32 *)p, -EFAULT); + if (__put_user(this_event.time.tv_sec, (u32 *)p)) + return -EFAULT; p += sizeof(u32); - __put_user_ret(this_event.time.tv_usec, (u32 *)p, -EFAULT); + if (__put_user(this_event.time.tv_usec, (u32 *)p)) + return -EFAULT; p += sizeof(u32); } else #endif { if ((end - p) < sizeof(Firm_event)) break; - copy_to_user_ret((Firm_event *)p, &this_event, - sizeof(Firm_event), -EFAULT); + if (copy_to_user((Firm_event *)p, &this_event, + sizeof(Firm_event))) + return -EFAULT; p += sizeof (Firm_event); } spin_lock_irqsave(&sunmouse.lock, flags); @@ -540,16 +543,19 @@ sun_mouse_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsig switch (cmd){ /* VUIDGFORMAT - Get input device byte stream format */ case _IOR('v', 2, int): - put_user_ret(sunmouse.vuid_mode, (int *) arg, -EFAULT); + if (put_user(sunmouse.vuid_mode, (int *) arg)) + return -EFAULT; break; /* VUIDSFORMAT - Set input device byte stream format*/ case _IOW('v', 1, int): - get_user_ret(i, (int *) arg, -EFAULT); + if (get_user(i, (int *) arg)) + return -EFAULT; if (i == VUID_NATIVE || i == VUID_FIRM_EVENT){ int value; - get_user_ret(value, (int *)arg, -EFAULT); + if (get_user(value, (int *)arg)) + return -EFAULT; spin_lock_irq(&sunmouse.lock); sunmouse.vuid_mode = value; diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index 554a15676..77b849ef0 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c @@ -42,6 +42,7 @@ #include "vfc.h" #include <asm/vfc_ioctls.h> +static struct file_operations vfc_fops; static devfs_handle_t devfs_handle = NULL; /* For the directory */ struct vfc_dev **vfc_dev_lst; static char vfcstr[]="vfc"; diff --git a/drivers/sbus/char/zs.c b/drivers/sbus/char/zs.c index 40284c603..7acfb2aba 100644 --- a/drivers/sbus/char/zs.c +++ b/drivers/sbus/char/zs.c @@ -1,4 +1,4 @@ -/* $Id: zs.c,v 1.58 2000/07/06 01:41:38 davem Exp $ +/* $Id: zs.c,v 1.59 2000/08/29 07:01:55 davem Exp $ * zs.c: Zilog serial port driver for the Sparc. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -1319,7 +1319,8 @@ static int get_serial_info(struct sun_serial * info, tmp.close_delay = info->close_delay; tmp.closing_wait = info->closing_wait; tmp.custom_divisor = info->custom_divisor; - copy_to_user_ret(retinfo,&tmp,sizeof(*retinfo), -EFAULT); + if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) + return -EFAULT; return 0; } @@ -1390,7 +1391,8 @@ static int get_lsr_info(struct sun_serial * info, unsigned int *value) ZSDELAY(); ZSLOG(REGCTRL, status, 0); sti(); - put_user_ret(status, value, -EFAULT); + if (put_user(status, value)) + return -EFAULT; return 0; } @@ -1409,7 +1411,8 @@ static int get_modem_info(struct sun_serial * info, unsigned int *value) | ((status & DCD) ? TIOCM_CAR : 0) | ((status & SYNC) ? TIOCM_DSR : 0) | ((status & CTS) ? TIOCM_CTS : 0); - put_user_ret(result, value, -EFAULT); + if (put_user(result, value)) + return -EFAULT; return 0; } @@ -1418,7 +1421,8 @@ static int set_modem_info(struct sun_serial * info, unsigned int cmd, { unsigned int arg; - get_user_ret(arg, value, -EFAULT); + if (get_user(arg, value)) + return -EFAULT; switch (cmd) { case TIOCMBIS: if (arg & TIOCM_RTS) @@ -1494,11 +1498,13 @@ static int zs_ioctl(struct tty_struct *tty, struct file * file, send_break(info, arg ? arg*(HZ/10) : HZ/4); return 0; case TIOCGSOFTCAR: - put_user_ret(C_CLOCAL(tty) ? 1 : 0, - (unsigned long *) arg, -EFAULT); + if (put_user(C_CLOCAL(tty) ? 1 : 0, + (unsigned long *) arg)) + return -EFAULT; return 0; case TIOCSSOFTCAR: - get_user_ret(arg, (unsigned long *) arg, -EFAULT); + if (get_user(arg, (unsigned long *) arg)) + return -EFAULT; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); @@ -1519,8 +1525,9 @@ static int zs_ioctl(struct tty_struct *tty, struct file * file, return get_lsr_info(info, (unsigned int *) arg); case TIOCSERGSTRUCT: - copy_to_user_ret((struct sun_serial *) arg, - info, sizeof(struct sun_serial), -EFAULT); + if (copy_to_user((struct sun_serial *) arg, + info, sizeof(struct sun_serial))) + return -EFAULT; return 0; default: @@ -1906,7 +1913,7 @@ int zs_open(struct tty_struct *tty, struct file * filp) static void show_serial_version(void) { - char *revision = "$Revision: 1.58 $"; + char *revision = "$Revision: 1.59 $"; char *version, *p; version = strchr(revision, ' '); |