summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-03-19 01:28:40 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-03-19 01:28:40 +0000
commit8abb719409c9060a7c0676f76e9182c1e0b8ca46 (patch)
treeb88cc5a6cd513a04a512b7e6215c873c90a1c5dd /drivers/char
parentf01bd7aeafd95a08aafc9e3636bb26974df69d82 (diff)
Merge with 2.3.99-pre1.
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Config.in2
-rw-r--r--drivers/char/bttv.c8
-rw-r--r--drivers/char/bttv.h2
-rw-r--r--drivers/char/console.c2
-rw-r--r--drivers/char/drm/auth.c7
-rw-r--r--drivers/char/drm/bufs.c8
-rw-r--r--drivers/char/drm/context.c5
-rw-r--r--drivers/char/drm/dma.c5
-rw-r--r--drivers/char/drm/drawable.c5
-rw-r--r--drivers/char/drm/drm.h5
-rw-r--r--drivers/char/drm/drmP.h10
-rw-r--r--drivers/char/drm/fops.c18
-rw-r--r--drivers/char/drm/gamma_dma.c5
-rw-r--r--drivers/char/drm/gamma_drv.c9
-rw-r--r--drivers/char/drm/gamma_drv.h5
-rw-r--r--drivers/char/drm/init.c5
-rw-r--r--drivers/char/drm/ioctl.c5
-rw-r--r--drivers/char/drm/lists.c7
-rw-r--r--drivers/char/drm/lock.c5
-rw-r--r--drivers/char/drm/memory.c5
-rw-r--r--drivers/char/drm/proc.c21
-rw-r--r--drivers/char/drm/tdfx_context.c5
-rw-r--r--drivers/char/drm/tdfx_drv.c25
-rw-r--r--drivers/char/drm/tdfx_drv.h6
-rw-r--r--drivers/char/drm/vm.c5
-rw-r--r--drivers/char/generic_serial.c168
-rw-r--r--drivers/char/generic_serial.h104
-rw-r--r--drivers/char/mem.c8
-rw-r--r--drivers/char/misc.c26
-rw-r--r--drivers/char/mixcomwd.c58
-rw-r--r--drivers/char/n_tty.c50
-rw-r--r--drivers/char/ppdev.c11
-rw-r--r--drivers/char/pty.c4
-rw-r--r--drivers/char/radio-gemtek.c4
-rw-r--r--drivers/char/serial.c35
-rw-r--r--drivers/char/sx.c437
-rw-r--r--drivers/char/sx.h38
-rw-r--r--drivers/char/sxboards.h1
-rw-r--r--drivers/char/tty_io.c4
-rw-r--r--drivers/char/videodev.c72
40 files changed, 590 insertions, 615 deletions
diff --git a/drivers/char/Config.in b/drivers/char/Config.in
index 18f867c04..21720c81a 100644
--- a/drivers/char/Config.in
+++ b/drivers/char/Config.in
@@ -219,7 +219,7 @@ if [ "$CONFIG_VIDEO_DEV" != "n" ]; then
fi
dep_tristate ' Zoran ZR36057/36060 Video For Linux' CONFIG_VIDEO_ZORAN $CONFIG_VIDEO_DEV $CONFIG_PCI
dep_tristate ' Include support for Iomega Buz' CONFIG_VIDEO_BUZ $CONFIG_VIDEO_ZORAN
- dep_tristate ' Zoran ZR36120/36125 Video For Linux' CONFIG_VIDEO_ZR36120 $CONFIG_VIDEO_DEV $CONFIG_PCI
+ dep_tristate ' Zoran ZR36120/36125 Video For Linux' CONFIG_VIDEO_ZR36120 $CONFIG_VIDEO_DEV $CONFIG_PCI $CONFIG_I2C
fi
endmenu
diff --git a/drivers/char/bttv.c b/drivers/char/bttv.c
index 19e252968..66dfc0fe5 100644
--- a/drivers/char/bttv.c
+++ b/drivers/char/bttv.c
@@ -719,12 +719,14 @@ static void init_PXC200(struct bttv *btv)
/* ----------------------------------------------------------------------- */
+/* for some vendors it is just the PCI ID */
static struct VENDOR {
int id;
char *name;
} vendors[] = {
{ 0x0001, "ATI Technologies Inc" },
{ 0x10b4, "STB Systems Inc" },
+ { 0x1118, "Terratec" },
{ 0x13eb, "Hauppauge Computer Works Inc" },
{ 0x1461, "Avermedia" },
{ 0x1850, "Chronos" },
@@ -743,6 +745,7 @@ static struct CARD {
} cards[] = {
{ 0x0001, 0x1002, BTTV_HAUPPAUGE878, "TV Wonder" },
{ 0x10b4, 0x2636, BTTV_HAUPPAUGE878, "???" },
+ { 0x1118, 0x153b, BTTV_TERRATVALUE, "TV Value" },
{ 0x13eb, 0x0070, BTTV_HAUPPAUGE878, "WinTV" },
{ 0x1461, 0x0002, BTTV_AVERMEDIA98, "TVCapture 98" },
{ 0x1850, 0x1851, BTTV_CHRONOS_VS2, "Video Shuttle II" },
@@ -2018,6 +2021,7 @@ static int bttv_open(struct video_device *dev, int flags)
btv->gbuf[i].stat = GBUFFER_UNUSED;
burst(0);
+ set_pll(btv);
btv->user++;
up(&btv->lock);
MOD_INC_USE_COUNT;
@@ -2235,6 +2239,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
if (btv->win.norm != v.mode) {
btv->win.norm = v.mode;
down(&btv->lock);
+ set_pll(btv);
make_vbitab(btv);
bt848_set_winsize(btv);
up(&btv->lock);
@@ -2866,6 +2871,7 @@ static struct video_device vbi_template=
static int radio_open(struct video_device *dev, int flags)
{
struct bttv *btv = (struct bttv *)(dev-1);
+ unsigned long v;
down(&btv->lock);
if (btv->user)
@@ -2873,6 +2879,8 @@ static int radio_open(struct video_device *dev, int flags)
btv->user++;
btv->radio = 1;
+ v = 400*16;
+ call_i2c_clients(btv,VIDIOCSFREQ,&v);
call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
bt848_muxsel(btv,0);
up(&btv->lock);
diff --git a/drivers/char/bttv.h b/drivers/char/bttv.h
index ab3d88ab5..3a2cd7e21 100644
--- a/drivers/char/bttv.h
+++ b/drivers/char/bttv.h
@@ -21,7 +21,7 @@
#ifndef _BTTV_H_
#define _BTTV_H_
-#define BTTV_VERSION_CODE KERNEL_VERSION(0,7,21)
+#define BTTV_VERSION_CODE KERNEL_VERSION(0,7,22)
#include <linux/types.h>
#include <linux/wait.h>
diff --git a/drivers/char/console.c b/drivers/char/console.c
index 9d8bf6cb0..93e710188 100644
--- a/drivers/char/console.c
+++ b/drivers/char/console.c
@@ -369,7 +369,7 @@ static u8 build_attr(int currcons, u8 _color, u8 _intensity, u8 _blink, u8 _unde
static void update_attr(int currcons)
{
attr = build_attr(currcons, color, intensity, blink, underline, reverse ^ decscnm);
- video_erase_char = (build_attr(currcons, color, 1, 0, 0, decscnm) << 8) | ' ';
+ video_erase_char = (build_attr(currcons, color, 1, blink, 0, decscnm) << 8) | ' ';
}
/* Note: inverting the screen twice should revert to the original state */
diff --git a/drivers/char/drm/auth.c b/drivers/char/drm/auth.c
index 865681956..ebf0671f4 100644
--- a/drivers/char/drm/auth.c
+++ b/drivers/char/drm/auth.c
@@ -1,6 +1,5 @@
/* auth.c -- IOCTLs for authentication -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:31:48 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -23,9 +22,9 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.4 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.1 1999/09/25 14:37:57 dawes Exp $
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/bufs.c b/drivers/char/drm/bufs.c
index a71d6dde9..1bb7bd612 100644
--- a/drivers/char/drm/bufs.c
+++ b/drivers/char/drm/bufs.c
@@ -1,8 +1,7 @@
/* bufs.c -- IOCTLs to manage buffers -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Dec 3 12:11:11 1999 by faith@precisioninsight.com
*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,13 +23,12 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.8 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.1 1999/09/25 14:37:57 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
#define __NO_VERSION__
-#include <linux/config.h>
#include "drmP.h"
#include "linux/un.h"
diff --git a/drivers/char/drm/context.c b/drivers/char/drm/context.c
index d7f8bdf2b..a8919d83d 100644
--- a/drivers/char/drm/context.c
+++ b/drivers/char/drm/context.c
@@ -1,6 +1,5 @@
/* context.c -- IOCTLs for contexts and DMA queues -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:32:09 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.5 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/dma.c b/drivers/char/drm/dma.c
index ea08a859e..0ec14ede5 100644
--- a/drivers/char/drm/dma.c
+++ b/drivers/char/drm/dma.c
@@ -1,6 +1,5 @@
/* dma.c -- DMA IOCTL and function support -*- linux-c -*-
* Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
- * Revised: Thu Sep 16 12:55:39 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.7 1999/09/16 16:56:18 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/drawable.c b/drivers/char/drm/drawable.c
index c26953c1d..19e5da3b7 100644
--- a/drivers/char/drm/drawable.c
+++ b/drivers/char/drm/drawable.c
@@ -1,6 +1,5 @@
/* drawable.c -- IOCTLs for drawables -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:03 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.3 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 320db51eb..fe0f8defe 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -1,6 +1,5 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
* Acknowledgements:
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index fce2df7ec..3a371c23d 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -1,6 +1,5 @@
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:06:49 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.1 1999/09/25 14:37:59 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
@@ -50,6 +49,10 @@
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+#include <asm/spinlock.h>
+#include <linux/poll.h>
+#endif
#include "drm.h"
#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
@@ -475,6 +478,7 @@ extern int drm_fasync(int fd, struct file *filp, int on);
extern ssize_t drm_read(struct file *filp, char *buf, size_t count,
loff_t *off);
extern int drm_write_string(drm_device_t *dev, const char *s);
+extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
/* Mapping support (vm.c) */
#if LINUX_VERSION_CODE < 0x020317
diff --git a/drivers/char/drm/fops.c b/drivers/char/drm/fops.c
index 24b17356b..a823db356 100644
--- a/drivers/char/drm/fops.c
+++ b/drivers/char/drm/fops.c
@@ -1,8 +1,7 @@
/* fops.c -- File operations for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Dec 3 10:26:26 1999 by faith@precisioninsight.com
*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,8 +23,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.3 1999/08/20 15:36:45 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.1 1999/09/25 14:37:59 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Daryll Strauss <daryll@precisioninsight.com>
*
*/
@@ -222,3 +222,13 @@ int drm_write_string(drm_device_t *dev, const char *s)
wake_up_interruptible(&dev->buf_readers);
return 0;
}
+
+unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+
+ poll_wait(filp, &dev->buf_readers, wait);
+ if (dev->buf_wp != dev->buf_rp) return POLLIN | POLLRDNORM;
+ return 0;
+}
diff --git a/drivers/char/drm/gamma_dma.c b/drivers/char/drm/gamma_dma.c
index 3b1592180..1f8c0a7de 100644
--- a/drivers/char/drm/gamma_dma.c
+++ b/drivers/char/drm/gamma_dma.c
@@ -1,6 +1,5 @@
/* gamma_dma.c -- DMA support for GMX 2000 -*- linux-c -*-
* Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
- * Revised: Thu Sep 16 12:55:37 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.9 1999/09/16 16:56:18 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.1 1999/09/25 14:38:00 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/gamma_drv.c b/drivers/char/drm/gamma_drv.c
index 028772f26..6df4440f3 100644
--- a/drivers/char/drm/gamma_drv.c
+++ b/drivers/char/drm/gamma_drv.c
@@ -1,8 +1,7 @@
/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:51:36 1999 by faith@precisioninsight.com
*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,12 +23,11 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.17 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.1 1999/09/25 14:38:00 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
-#include <linux/config.h>
#include "drmP.h"
#include "gamma_drv.h"
EXPORT_SYMBOL(gamma_init);
@@ -52,6 +50,7 @@ static struct file_operations gamma_fops = {
mmap: drm_mmap,
read: drm_read,
fasync: drm_fasync,
+ poll: drm_poll,
};
static struct miscdevice gamma_misc = {
diff --git a/drivers/char/drm/gamma_drv.h b/drivers/char/drm/gamma_drv.h
index 15e77dca9..a87655cb9 100644
--- a/drivers/char/drm/gamma_drv.h
+++ b/drivers/char/drm/gamma_drv.h
@@ -1,6 +1,5 @@
/* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:24:27 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.4 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.1 1999/09/25 14:38:00 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/init.c b/drivers/char/drm/init.c
index f416a99af..7a0115e86 100644
--- a/drivers/char/drm/init.c
+++ b/drivers/char/drm/init.c
@@ -1,6 +1,5 @@
/* init.c -- Setup/Cleanup for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:02 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.3 1999/08/20 15:07:01 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/ioctl.c b/drivers/char/drm/ioctl.c
index 886ef661c..13bb60659 100644
--- a/drivers/char/drm/ioctl.c
+++ b/drivers/char/drm/ioctl.c
@@ -1,6 +1,5 @@
/* ioctl.c -- IOCTL processing for DRM -*- linux-c -*-
* Created: Fri Jan 8 09:01:26 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:02 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.3 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/lists.c b/drivers/char/drm/lists.c
index b84561f2e..212ed18ed 100644
--- a/drivers/char/drm/lists.c
+++ b/drivers/char/drm/lists.c
@@ -1,6 +1,5 @@
/* lists.c -- Buffer list handling routines -*- linux-c -*-
* Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.3 1999/08/20 15:07:02 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
@@ -154,7 +153,7 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
buf->list = DRM_LIST_FREE;
do {
old = bl->next;
- bl->next = old;
+ buf->next = old;
prev = cmpxchg(&bl->next, old, buf);
if (++count > DRM_LOOPING_LIMIT) {
DRM_ERROR("Looping\n");
diff --git a/drivers/char/drm/lock.c b/drivers/char/drm/lock.c
index e8c1eff10..2523eb21a 100644
--- a/drivers/char/drm/lock.c
+++ b/drivers/char/drm/lock.c
@@ -1,6 +1,5 @@
/* lock.c -- IOCTLs for locking -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.5 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/memory.c b/drivers/char/drm/memory.c
index af8d510b5..a778a1539 100644
--- a/drivers/char/drm/memory.c
+++ b/drivers/char/drm/memory.c
@@ -1,6 +1,5 @@
/* memory.c -- Memory management wrappers for DRM -*- linux-c -*-
* Created: Thu Feb 4 14:00:34 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 10:28:18 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.4 1999/08/20 20:00:53 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/proc.c b/drivers/char/drm/proc.c
index 33a5b20e8..4d5d1a964 100644
--- a/drivers/char/drm/proc.c
+++ b/drivers/char/drm/proc.c
@@ -1,6 +1,5 @@
/* proc.c -- /proc support for DRM -*- linux-c -*-
* Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com
- * Revised: Fri Dec 3 09:44:16 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
@@ -79,26 +78,26 @@ int drm_proc_init(drm_device_t *dev)
struct proc_dir_entry *ent;
int i, j;
- drm_root = create_proc_entry("graphics", S_IFDIR, NULL);
+ drm_root = create_proc_entry("dri", S_IFDIR, NULL);
if (!drm_root) {
- DRM_ERROR("Cannot create /proc/graphics\n");
+ DRM_ERROR("Cannot create /proc/dri\n");
return -1;
}
/* Instead of doing this search, we should
- add some global support for /proc/graphics. */
+ add some global support for /proc/dri. */
for (i = 0; i < 8; i++) {
- sprintf(drm_slot_name, "graphics/%d", i);
+ sprintf(drm_slot_name, "dri/%d", i);
drm_dev_root = create_proc_entry(drm_slot_name, S_IFDIR, NULL);
if (!drm_dev_root) {
DRM_ERROR("Cannot create /proc/%s\n", drm_slot_name);
- remove_proc_entry("graphics", NULL);
+ remove_proc_entry("dri", NULL);
}
if (drm_dev_root->nlink == 2) break;
drm_dev_root = NULL;
}
if (!drm_dev_root) {
- DRM_ERROR("Cannot find slot in /proc/graphics\n");
+ DRM_ERROR("Cannot find slot in /proc/dri\n");
return -1;
}
@@ -112,7 +111,7 @@ int drm_proc_init(drm_device_t *dev)
remove_proc_entry(drm_proc_list[i].name,
drm_dev_root);
remove_proc_entry(drm_slot_name, NULL);
- remove_proc_entry("graphics", NULL);
+ remove_proc_entry("dri", NULL);
return -1;
}
ent->read_proc = drm_proc_list[i].f;
@@ -135,7 +134,7 @@ int drm_proc_cleanup(void)
}
remove_proc_entry(drm_slot_name, NULL);
}
- remove_proc_entry("graphics", NULL);
+ remove_proc_entry("dri", NULL);
remove_proc_entry(DRM_NAME, NULL);
}
drm_root = drm_dev_root = NULL;
diff --git a/drivers/char/drm/tdfx_context.c b/drivers/char/drm/tdfx_context.c
index 0c3c541d0..22bf59ff3 100644
--- a/drivers/char/drm/tdfx_context.c
+++ b/drivers/char/drm/tdfx_context.c
@@ -1,6 +1,5 @@
/* tdfx_context.c -- IOCTLs for tdfx contexts -*- linux-c -*-
* Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com
- * Revised: Sat Oct 9 23:39:56 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI$
- * $XFree86$
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c
index f56e2af95..82b2ac9a2 100644
--- a/drivers/char/drm/tdfx_drv.c
+++ b/drivers/char/drm/tdfx_drv.c
@@ -1,8 +1,7 @@
/* tdfx.c -- tdfx driver -*- linux-c -*-
* Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:51:35 1999 by faith@precisioninsight.com
*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -23,17 +22,15 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
- *
- * $PI$
- * $XFree86$
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Daryll Strauss <daryll@precisioninsight.com>
*
*/
-#include <linux/config.h>
#include "drmP.h"
#include "tdfx_drv.h"
-EXPORT_SYMBOL(tdfx_init);
-EXPORT_SYMBOL(tdfx_cleanup);
#define TDFX_NAME "tdfx"
#define TDFX_DESC "tdfx"
@@ -53,6 +50,7 @@ static struct file_operations tdfx_fops = {
mmap: drm_mmap,
read: drm_read,
fasync: drm_fasync,
+ poll: drm_poll,
};
static struct miscdevice tdfx_misc = {
@@ -542,6 +540,12 @@ int tdfx_lock(struct inode *inode, struct file *filp, unsigned int cmd,
#endif
}
}
+
+ if (lock.context != tdfx_res_ctx.handle) {
+ current->counter = 5;
+ current->priority = DEF_PRIORITY/4;
+ }
+
DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
#if DRM_DMA_HISTOGRAM
@@ -582,6 +586,11 @@ int tdfx_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
}
}
+ if (lock.context != tdfx_res_ctx.handle) {
+ current->counter = 5;
+ current->priority = DEF_PRIORITY;
+ }
+
return 0;
}
diff --git a/drivers/char/drm/tdfx_drv.h b/drivers/char/drm/tdfx_drv.h
index bdff05ee1..4c0c3282b 100644
--- a/drivers/char/drm/tdfx_drv.h
+++ b/drivers/char/drm/tdfx_drv.h
@@ -1,6 +1,5 @@
/* tdfx_drv.h -- Private header for tdfx driver -*- linux-c -*-
* Created: Thu Oct 7 10:40:04 1999 by faith@precisioninsight.com
- * Revised: Sat Oct 9 23:38:19 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -24,8 +23,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI$
- * $XFree86$
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Daryll Strauss <daryll@precisioninsight.com>
*
*/
diff --git a/drivers/char/drm/vm.c b/drivers/char/drm/vm.c
index d649a6e75..b4c4c5bbf 100644
--- a/drivers/char/drm/vm.c
+++ b/drivers/char/drm/vm.c
@@ -1,6 +1,5 @@
/* vm.c -- Memory mapping for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 16:54:35 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +23,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.7 1999/08/21 02:48:34 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@precisioninsight.com>
*
*/
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 95a6c4370..212525df7 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -18,90 +18,12 @@
#include <linux/serial.h>
#include <linux/mm.h>
#include <asm/semaphore.h>
-#include <linux/version.h>
-
-
-#if LINUX_VERSION_CODE < 0x020100 /* Less than 2.1.0 */
-#define TWO_ZERO
-#else
-#if LINUX_VERSION_CODE < 0x020200 /* less than 2.2.x */
-#warning "Please use a 2.2.x kernel. "
-#else
-#if LINUX_VERSION_CODE < 0x020300 /* less than 2.2.x */
-#define TWO_TWO
-#else
-#define TWO_THREE
-#endif
-#endif
-#endif
-
-#ifdef TWO_ZERO
-
-/* Here is the section that makes the 2.2 compatible driver source
- work for 2.0 too! We mostly try to adopt the "new thingies" from 2.2,
- and provide for compatibility stuff here if possible. */
-
-/* Some 200 days (on intel) */
-#define MAX_SCHEDULE_TIMEOUT ((long)(~0UL>>1))
-
-
-#ifndef MODULE
-
-#define copy_to_user(a,b,c) memcpy_tofs(a,b,c)
-
-static inline int copy_from_user(void *to,const void *from, int c)
-{
- memcpy_fromfs(to, from, c);
- return 0;
-}
-
-
-#define capable(x) suser()
-
-#define queue_task queue_task_irq_off
-#define tty_flip_buffer_push(tty) queue_task(&tty->flip.tqueue, &tq_timer)
-#define signal_pending(current) (current->signal & ~current->blocked)
-#define schedule_timeout(to) do {current->timeout = jiffies + (to);schedule ();} while (0)
-#define time_after(t1,t2) (((long)t1-t2) > 0)
-
-#define test_and_set_bit(nr, addr) set_bit(nr, addr)
-#define test_and_clear_bit(nr, addr) clear_bit(nr, addr)
-
-/* Not yet implemented on 2.0 */
-#define ASYNC_SPD_SHI -1
-#define ASYNC_SPD_WARP -1
-
-
-
-/* Ugly hack: the driver_name doesn't exist in 2.0.x . So we define it
- to the "name" field that does exist. As long as the assignments are
- done in the right order, there is nothing to worry about. */
-#define driver_name name
-
-
-/* Should be in a header somewhere. */
-#define TTY_HW_COOK_OUT 14 /* Flag to tell ntty what we can handle */
-#define TTY_HW_COOK_IN 15 /* in hardware - output and input */
-#endif
-
-#endif
-
-#ifndef TWO_ZERO
-/* This include is new with 2.2 (and required!) */
#include <asm/uaccess.h>
-#endif
-
-#ifndef TWO_THREE
-/* These are new in 2.3. The source now uses 2.3 syntax, and here is
- the compatibility define... */
-#define wait_queue_head_t struct wait_queue *
-#define DECLARE_MUTEX(name) struct semaphore name = MUTEX
-#define DECLARE_WAITQUEUE(wait, current) struct wait_queue wait = { current, NULL }
-
-#endif
-
-#include "generic_serial.h"
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/generic_serial.h>
+#define DEBUG
static char * tmp_buf;
static DECLARE_MUTEX(tmp_buf_sem);
@@ -118,8 +40,6 @@ int gs_debug = 0;
#define func_enter() gs_dprintk (GS_DEBUG_FLOW, "gs: enter " __FUNCTION__ "\n")
#define func_exit() gs_dprintk (GS_DEBUG_FLOW, "gs: exit " __FUNCTION__ "\n")
-
-
#if NEW_WRITE_LOCKING
#define DECL /* Nothing */
#define LOCKIT down (& port->port_write_sem);
@@ -130,6 +50,28 @@ int gs_debug = 0;
#define RELEASEIT restore_flags (flags)
#endif
+#define RS_EVENT_WRITE_WAKEUP 1
+
+#ifdef DEBUG
+static void my_hd (unsigned char *addr, int len)
+{
+ int i, j, ch;
+
+ for (i=0;i<len;i+=16) {
+ printk ("%08x ", (int) addr+i);
+ for (j=0;j<16;j++) {
+ printk ("%02x %s", addr[j+i], (j==7)?" ":"");
+ }
+ for (j=0;j<16;j++) {
+ ch = addr[j+i];
+ printk ("%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch));
+ }
+ printk ("\n");
+ }
+}
+#else
+#define my_hd(addr,len)
+#endif
void gs_put_char(struct tty_struct * tty, unsigned char ch)
@@ -393,16 +335,19 @@ int gs_real_chars_in_buffer(struct tty_struct *tty)
if (!tty) return 0;
port = tty->driver_data;
+ if (!port->rd) return 0;
+ if (!port->rd->chars_in_buffer) return 0;
+
func_exit ();
return port->xmit_cnt + port->rd->chars_in_buffer (port);
}
-static void gs_wait_tx_flushed (void * ptr, int timeout)
+static int gs_wait_tx_flushed (void * ptr, int timeout)
{
struct gs_port *port = ptr;
long end_jiffies;
- int jiffies_to_transmit, charsleft;
+ int jiffies_to_transmit, charsleft = 0, rv = 0;
int to, rcib;
func_enter();
@@ -416,7 +361,7 @@ static void gs_wait_tx_flushed (void * ptr, int timeout)
if (!port || port->xmit_cnt < 0 || !port->xmit_buf) {
gs_dprintk (GS_DEBUG_FLUSH, "ERROR: !port, !port->xmit_buf or prot->xmit_cnt < 0.\n");
func_exit();
- return; /* This is an error which we don't know how to handle. */
+ return -EINVAL; /* This is an error which we don't know how to handle. */
}
gs_dprintk (GS_DEBUG_FLUSH, "checkpoint 1\n");
@@ -426,8 +371,8 @@ static void gs_wait_tx_flushed (void * ptr, int timeout)
if(rcib <= 0) {
gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n");
- func_exit();
- return;
+ func_exit();
+ return rv;
}
gs_dprintk (GS_DEBUG_FLUSH, "checkpoint 3\n");
@@ -460,14 +405,18 @@ static void gs_wait_tx_flushed (void * ptr, int timeout)
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(jiffies_to_transmit);
- if (signal_pending (current))
+ if (signal_pending (current)) {
+ gs_dprintk (GS_DEBUG_FLUSH, "Signal pending. Bombing out: ");
+ rv = -EINTR;
break;
+ }
}
gs_dprintk (GS_DEBUG_FLUSH, "charsleft = %d.\n", charsleft);
current->state = TASK_RUNNING;
func_exit();
+ return rv;
}
@@ -541,7 +490,7 @@ void gs_start(struct tty_struct * tty)
void gs_shutdown_port (struct gs_port *port)
{
long flags;
-
+ func_enter();
if (!(port->flags & ASYNC_INITIALIZED))
return;
@@ -560,6 +509,7 @@ void gs_shutdown_port (struct gs_port *port)
port->flags &= ~ASYNC_INITIALIZED;
restore_flags (flags);
+ func_exit();
}
@@ -746,8 +696,10 @@ void gs_close(struct tty_struct * tty, struct file * filp)
func_exit();
return;
}
+
if (!port->tty) {
- printk (KERN_WARNING "gs: Odd: port->tty is NULL\n");
+ /* This seems to happen when this is called from vhangup. */
+ gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n");
port->tty = tty;
}
@@ -771,6 +723,7 @@ void gs_close(struct tty_struct * tty, struct file * filp)
port->count = 0;
}
if (port->count) {
+ gs_dprintk(GS_DEBUG_CLOSE, "gs_close: count: %d\n", port->count);
restore_flags(flags);
func_exit ();
return;
@@ -802,6 +755,7 @@ void gs_close(struct tty_struct * tty, struct file * filp)
port->rd->disable_rx_interrupts (port);
+ /* close has no way of returning "EINTR", so discard return value */
if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
gs_wait_tx_flushed (port, port->closing_wait);
@@ -812,8 +766,12 @@ void gs_close(struct tty_struct * tty, struct file * filp)
if (tty->ldisc.flush_buffer)
tty->ldisc.flush_buffer(tty);
tty->closing = 0;
+
port->event = 0;
+ port->rd->close (port);
+ port->rd->shutdown_port (port);
port->tty = 0;
+
if (port->blocked_open) {
if (port->close_delay) {
current->state = TASK_INTERRUPTIBLE;
@@ -825,8 +783,6 @@ void gs_close(struct tty_struct * tty, struct file * filp)
ASYNC_CLOSING | ASYNC_INITIALIZED);
wake_up_interruptible(&port->close_wait);
- port->rd->close (port);
- port->rd->shutdown_port (port);
restore_flags(flags);
func_exit ();
}
@@ -842,7 +798,7 @@ void gs_set_termios (struct tty_struct * tty,
struct termios * old_termios)
{
struct gs_port *port = tty->driver_data;
- int baudrate, tmp;
+ int baudrate, tmp, rv;
struct termios *tiosp;
func_enter();
@@ -867,7 +823,7 @@ void gs_set_termios (struct tty_struct * tty,
&& (tiosp->c_line == old_termios->c_line)
&& (memcmp(tiosp->c_cc, old_termios->c_cc, NCC) == 0)) {
gs_dprintk(GS_DEBUG_TERMIOS, "gs_set_termios: optimized away\n");
- return;
+ return /* 0 */;
}
} else
gs_dprintk(GS_DEBUG_TERMIOS, "gs_set_termios: no old_termios: "
@@ -923,9 +879,11 @@ void gs_set_termios (struct tty_struct * tty,
/* We should really wait for the characters to be all sent before
changing the settings. -- CAL */
- gs_wait_tx_flushed (port, MAX_SCHEDULE_TIMEOUT);
+ rv = gs_wait_tx_flushed (port, MAX_SCHEDULE_TIMEOUT);
+ if (rv < 0) return /* rv */;
- port->rd->set_real_termios(port);
+ rv = port->rd->set_real_termios(port);
+ if (rv < 0) return /* rv */;
if ((!old_termios ||
(old_termios->c_cflag & CRTSCTS)) &&
@@ -943,7 +901,7 @@ void gs_set_termios (struct tty_struct * tty,
#endif
func_exit();
- return;
+ return /* 0 */;
}
@@ -1067,3 +1025,15 @@ void gs_getserial(struct gs_port *port, struct serial_struct *sp)
copy_to_user(sp, &sio, sizeof(struct serial_struct));
}
+
+#ifdef MODULE
+int init_module (void)
+{
+ return 0;
+}
+
+int cleanup_module (void)
+{
+ return 0;
+}
+#endif
diff --git a/drivers/char/generic_serial.h b/drivers/char/generic_serial.h
deleted file mode 100644
index 2e44bee95..000000000
--- a/drivers/char/generic_serial.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * generic_serial.h
- *
- * Copyright (C) 1998 R.E.Wolff@BitWizard.nl
- *
- * written for the SX serial driver.
- * Contains the code that should be shared over all the serial drivers.
- *
- * Version 0.1 -- December, 1998.
- */
-
-#ifndef GENERIC_SERIAL_H
-#define GENERIC_SERIAL_H
-
-#define RS_EVENT_WRITE_WAKEUP 0
-
-struct real_driver {
- void (*disable_tx_interrupts) (void *);
- void (*enable_tx_interrupts) (void *);
- void (*disable_rx_interrupts) (void *);
- void (*enable_rx_interrupts) (void *);
- int (*get_CD) (void *);
- void (*shutdown_port) (void*);
- void (*set_real_termios) (void*);
- int (*chars_in_buffer) (void*);
- void (*close) (void*);
- void (*hungup) (void*);
- void (*getserial) (void*, struct serial_struct *sp);
-};
-
-
-
-struct gs_port {
- int magic;
- unsigned char *xmit_buf;
- int xmit_head;
- int xmit_tail;
- int xmit_cnt;
- /* struct semaphore port_write_sem; */
- int flags;
- struct termios normal_termios;
- struct termios callout_termios;
- wait_queue_head_t open_wait;
- wait_queue_head_t close_wait;
- long session;
- long pgrp;
- int count;
- int blocked_open;
- struct tty_struct *tty;
- int event;
- unsigned short closing_wait;
- int close_delay;
- struct real_driver *rd;
- int wakeup_chars;
- int baud_base;
- int baud;
- int custom_divisor;
-};
-
-
-/* Flags */
-/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
- used in serial.c, but they are also used in all other serial drivers.
- Make sure they don't clash with these here... */
-#define GS_TX_INTEN 0x00800000
-#define GS_RX_INTEN 0x00400000
-#define GS_ACTIVE 0x00200000
-
-
-
-#define GS_TYPE_NORMAL 1
-#define GS_TYPE_CALLOUT 2
-
-
-#define GS_DEBUG_FLUSH 0x00000001
-#define GS_DEBUG_BTR 0x00000002
-#define GS_DEBUG_TERMIOS 0x00000004
-#define GS_DEBUG_STUFF 0x00000008
-#define GS_DEBUG_CLOSE 0x00000010
-#define GS_DEBUG_FLOW 0x00000020
-
-
-void gs_put_char(struct tty_struct *tty, unsigned char ch);
-int gs_write(struct tty_struct *tty, int from_user,
- const unsigned char *buf, int count);
-int gs_write_room(struct tty_struct *tty);
-int gs_chars_in_buffer(struct tty_struct *tty);
-void gs_flush_buffer(struct tty_struct *tty);
-void gs_flush_chars(struct tty_struct *tty);
-void gs_stop(struct tty_struct *tty);
-void gs_start(struct tty_struct *tty);
-void gs_hangup(struct tty_struct *tty);
-void gs_do_softint(void *private_);
-int block_til_ready(void *port, struct file *filp);
-void gs_close(struct tty_struct *tty, struct file *filp);
-void gs_set_termios (struct tty_struct * tty,
- struct termios * old_termios);
-int gs_init_port(struct gs_port *port);
-int gs_setserial(struct gs_port *port, struct serial_struct *sp);
-void gs_getserial(struct gs_port *port, struct serial_struct *sp);
-
-extern int gs_debug;
-
-#endif
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 3bf3fbf28..e9a34fbf3 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -26,9 +26,6 @@
#include <asm/io.h>
#include <asm/pgalloc.h>
-#ifdef CONFIG_VIDEO_BT848
-extern int i2c_init(void);
-#endif
#ifdef CONFIG_I2C
extern int i2c_init_all(void);
#endif
@@ -52,7 +49,6 @@ extern int videodev_init(void);
#endif
#ifdef CONFIG_FB
extern void fbmem_init(void);
-extern void fbconsole_init(void);
#endif
#ifdef CONFIG_PROM_CONSOLE
extern void prom_con_init(void);
@@ -621,7 +617,6 @@ int __init chr_dev_init(void)
#endif
#if defined (CONFIG_FB)
fbmem_init();
- fbconsole_init();
#endif
#if defined (CONFIG_PROM_CONSOLE)
prom_con_init();
@@ -665,9 +660,6 @@ int __init chr_dev_init(void)
#ifdef CONFIG_FTAPE
ftape_init();
#endif
-#ifdef CONFIG_VIDEO_BT848
- i2c_init();
-#endif
#if defined(CONFIG_ADB)
adbdev_init();
#endif
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index d3687d9f6..53939959f 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -123,6 +123,22 @@ static struct file_operations misc_fops = {
open: misc_open,
};
+/**
+ * misc_register - register a miscellaneous device
+ * @misc: device structure
+ *
+ * Register a miscellaneous device with the kernel. If the minor
+ * number is set to MISC_DYNAMIC_MINOR a minor number is assigned
+ * and placed in the minor field of the structure. For other cases
+ * the minor number requested is used.
+ *
+ * The structure passed is linked into the kernel and may not be
+ * destroyed until it has been unregistered
+ *
+ * A zero is returned on success and a negative errno code for
+ * failure.
+ */
+
int misc_register(struct miscdevice * misc)
{
static devfs_handle_t devfs_handle = NULL;
@@ -158,6 +174,16 @@ int misc_register(struct miscdevice * misc)
return 0;
}
+/**
+ * misc_deregister - unregister a miscellaneous device
+ * @misc: device to unregister
+ *
+ * Unregister a miscellaneous device that was previously
+ * successfully registered with misc_register. Success
+ * is indicated by a zero return, a negative errno code
+ * indicates an error.
+ */
+
int misc_deregister(struct miscdevice * misc)
{
int i = misc->minor;
diff --git a/drivers/char/mixcomwd.c b/drivers/char/mixcomwd.c
index 199818ebf..5894353e3 100644
--- a/drivers/char/mixcomwd.c
+++ b/drivers/char/mixcomwd.c
@@ -24,10 +24,13 @@
* Version 0.3.1 (99/06/22):
* - allow module removal while internal timer is active,
* print warning about probable reset
+ *
+ * Version 0.4 (99/11/15):
+ * - support for one more type board
*
*/
-#define VERSION "0.3.1"
+#define VERSION "0.4"
#include <linux/module.h>
#include <linux/config.h>
@@ -46,11 +49,13 @@
static int mixcomwd_ioports[] = { 0x180, 0x280, 0x380, 0x000 };
#define MIXCOM_WATCHDOG_OFFSET 0xc10
-#define MIXCOM_ID1 0x11
-#define MIXCOM_ID2 0x13
+#define MIXCOM_ID 0x11
+#define FLASHCOM_WATCHDOG_OFFSET 0x4
+#define FLASHCOM_ID 0x18
static int mixcomwd_opened;
-static int mixcomwd_port;
+
+static int watchdog_port;
#ifndef CONFIG_WATCHDOG_NOWAYOUT
static int mixcomwd_timer_alive;
@@ -59,7 +64,7 @@ static struct timer_list mixcomwd_timer;
static void mixcomwd_ping(void)
{
- outb_p(55,mixcomwd_port+MIXCOM_WATCHDOG_OFFSET);
+ outb_p(55,watchdog_port);
return;
}
@@ -183,40 +188,61 @@ static int __init mixcomwd_checkcard(int port)
{
int id;
- if(check_region(port,1)) {
+ if(check_region(port+MIXCOM_WATCHDOG_OFFSET,1)) {
return 0;
}
id=inb_p(port + MIXCOM_WATCHDOG_OFFSET) & 0x3f;
- if(id!=MIXCOM_ID1 && id!=MIXCOM_ID2) {
+ if(id!=MIXCOM_ID) {
return 0;
}
return 1;
}
-
+static int __init flashcom_checkcard(int port)
+{
+ int id;
+
+ if(check_region(port + FLASHCOM_WATCHDOG_OFFSET,1)) {
+ return 0;
+ }
+
+ id=inb_p(port + FLASHCOM_WATCHDOG_OFFSET);
+ if(id!=FLASHCOM_ID) {
+ return 0;
+ }
+ return 1;
+ }
+
void __init mixcomwd_init(void)
{
int i;
int found=0;
- for (i = 0; mixcomwd_ioports[i] != 0; i++) {
+ for (i = 0; !found && mixcomwd_ioports[i] != 0; i++) {
if (mixcomwd_checkcard(mixcomwd_ioports[i])) {
found = 1;
- mixcomwd_port = mixcomwd_ioports[i];
- break;
+ watchdog_port = mixcomwd_ioports[i] + MIXCOM_WATCHDOG_OFFSET;
}
}
-
+
+ /* The FlashCOM card can be set up at 0x300 -> 0x378, in 0x8 jumps */
+ for (i = 0x300; !found && i < 0x380; i+=0x8) {
+ if (flashcom_checkcard(i)) {
+ found = 1;
+ watchdog_port = i + FLASHCOM_WATCHDOG_OFFSET;
+ }
+ }
+
if (!found) {
printk("mixcomwd: No card detected, or port not available.\n");
return;
}
- request_region(mixcomwd_port+MIXCOM_WATCHDOG_OFFSET,1,"MixCOM watchdog");
-
+ request_region(watchdog_port,1,"MixCOM watchdog");
+
misc_register(&mixcomwd_miscdev);
- printk("MixCOM watchdog driver v%s, MixCOM card at 0x%3x\n",VERSION,mixcomwd_port);
+ printk(KERN_INFO "MixCOM watchdog driver v%s, watchdog port at 0x%3x\n",VERSION,watchdog_port);
}
#ifdef MODULE
@@ -236,7 +262,7 @@ void cleanup_module(void)
mixcomwd_timer_alive=0;
}
#endif
- release_region(mixcomwd_port+MIXCOM_WATCHDOG_OFFSET,1);
+ release_region(watchdog_port,1);
misc_deregister(&mixcomwd_miscdev);
}
#endif
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 0da69c55c..f447dbbbc 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -17,6 +17,10 @@
*
* This file may be redistributed under the terms of the GNU Public
* License.
+ *
+ * 2000/01/20 Fixed SMP locking on put_tty_queue using bits of
+ * the patch by Andrew J. Kroll <ag784@freenet.buffalo.edu>
+ * who actually finally proved there really was a race.
*/
#include <linux/types.h>
@@ -59,11 +63,18 @@
static inline void put_tty_queue(unsigned char c, struct tty_struct *tty)
{
+ unsigned long flags;
+ /*
+ * The problem of stomping on the buffers ends here.
+ * Why didn't anyone see this one comming? --AJK
+ */
+ spin_lock_irqsave(&tty->read_lock, flags);
if (tty->read_cnt < N_TTY_BUF_SIZE) {
tty->read_buf[tty->read_head] = c;
tty->read_head = (tty->read_head + 1) & (N_TTY_BUF_SIZE-1);
tty->read_cnt++;
}
+ spin_unlock_irqrestore(&tty->read_lock, flags);
}
/*
@@ -86,7 +97,11 @@ static void check_unthrottle(struct tty_struct * tty)
*/
static void reset_buffer_flags(struct tty_struct *tty)
{
+ unsigned long flags;
+
+ spin_lock_irqsave(&tty->read_lock, flags);
tty->read_head = tty->read_tail = tty->read_cnt = 0;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
tty->canon_head = tty->canon_data = tty->erasing = 0;
memset(&tty->read_flags, 0, sizeof tty->read_flags);
check_unthrottle(tty);
@@ -114,14 +129,19 @@ void n_tty_flush_buffer(struct tty_struct * tty)
*/
ssize_t n_tty_chars_in_buffer(struct tty_struct *tty)
{
- if (tty->icanon) {
- if (!tty->canon_data) return 0;
+ unsigned long flags;
+ ssize_t n = 0;
- return (tty->canon_head > tty->read_tail) ?
+ spin_lock_irqsave(&tty->read_lock, flags);
+ if (!tty->icanon) {
+ n = tty->read_cnt;
+ } else if (tty->canon_data) {
+ n = (tty->canon_head > tty->read_tail) ?
tty->canon_head - tty->read_tail :
tty->canon_head + (N_TTY_BUF_SIZE - tty->read_tail);
}
- return tty->read_cnt;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
+ return n;
}
/*
@@ -283,6 +303,7 @@ static void eraser(unsigned char c, struct tty_struct *tty)
{
enum { ERASE, WERASE, KILL } kill_type;
int head, seen_alnums;
+ unsigned long flags;
if (tty->read_head == tty->canon_head) {
/* opost('\a', tty); */ /* what do you think? */
@@ -294,15 +315,19 @@ static void eraser(unsigned char c, struct tty_struct *tty)
kill_type = WERASE;
else {
if (!L_ECHO(tty)) {
+ spin_lock_irqsave(&tty->read_lock, flags);
tty->read_cnt -= ((tty->read_head - tty->canon_head) &
(N_TTY_BUF_SIZE - 1));
tty->read_head = tty->canon_head;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
return;
}
if (!L_ECHOK(tty) || !L_ECHOKE(tty) || !L_ECHOE(tty)) {
+ spin_lock_irqsave(&tty->read_lock, flags);
tty->read_cnt -= ((tty->read_head - tty->canon_head) &
(N_TTY_BUF_SIZE - 1));
tty->read_head = tty->canon_head;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
finish_erasing(tty);
echo_char(KILL_CHAR(tty), tty);
/* Add a newline if ECHOK is on and ECHOKE is off. */
@@ -324,8 +349,10 @@ static void eraser(unsigned char c, struct tty_struct *tty)
else if (seen_alnums)
break;
}
+ spin_lock_irqsave(&tty->read_lock, flags);
tty->read_head = head;
tty->read_cnt--;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
if (L_ECHO(tty)) {
if (L_ECHOPRT(tty)) {
if (!tty->erasing) {
@@ -658,11 +685,13 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
char *f, flags = TTY_NORMAL;
int i;
char buf[64];
+ unsigned long cpuflags;
if (!tty->read_buf)
return;
if (tty->real_raw) {
+ spin_lock_irqsave(&tty->read_lock, cpuflags);
i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt,
N_TTY_BUF_SIZE - tty->read_head));
memcpy(tty->read_buf + tty->read_head, cp, i);
@@ -676,6 +705,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
memcpy(tty->read_buf + tty->read_head, cp, i);
tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
tty->read_cnt += i;
+ spin_unlock_irqrestore(&tty->read_lock, cpuflags);
} else {
for (i=count, p = cp, f = fp; i; i--, p++) {
if (f)
@@ -850,15 +880,20 @@ static inline int copy_from_read_buf(struct tty_struct *tty,
{
int retval;
ssize_t n;
+ unsigned long flags;
retval = 0;
+ spin_lock_irqsave(&tty->read_lock, flags);
n = MIN(*nr, MIN(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail));
+ spin_unlock_irqrestore(&tty->read_lock, flags);
if (n) {
mb();
retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n);
n -= retval;
+ spin_lock_irqsave(&tty->read_lock, flags);
tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
tty->read_cnt -= n;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
*b += n;
*nr -= n;
}
@@ -875,6 +910,7 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file,
ssize_t retval = 0;
ssize_t size;
long timeout;
+ unsigned long flags;
do_it_again:
@@ -993,9 +1029,11 @@ do_it_again:
eol = test_and_clear_bit(tty->read_tail,
&tty->read_flags);
c = tty->read_buf[tty->read_tail];
+ spin_lock_irqsave(&tty->read_lock, flags);
tty->read_tail = ((tty->read_tail+1) &
(N_TTY_BUF_SIZE-1));
tty->read_cnt--;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
if (!eol || (c != __DISABLED_CHAR)) {
put_user(c, b++);
@@ -1094,7 +1132,9 @@ static ssize_t write_chan(struct tty_struct * tty, struct file * file,
nr -= num;
if (nr == 0)
break;
+ current->state = TASK_RUNNING;
get_user(c, b);
+ current->state = TASK_INTERRUPTIBLE;
if (opost(c, tty) < 0)
break;
b++; nr--;
@@ -1102,7 +1142,9 @@ static ssize_t write_chan(struct tty_struct * tty, struct file * file,
if (tty->driver.flush_chars)
tty->driver.flush_chars(tty);
} else {
+ current->state = TASK_RUNNING;
c = tty->driver.write(tty, 1, b, nr);
+ current->state = TASK_INTERRUPTIBLE;
if (c < 0) {
retval = c;
goto break_out;
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 59853da1f..4336009fc 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -537,6 +537,17 @@ static int pp_release (struct inode * inode, struct file * file)
unsigned int minor = MINOR (inode->i_rdev);
struct pp_struct *pp = file->private_data;
+ if (pp->pdev->port->ieee1284.mode != IEEE1284_MODE_COMPAT) {
+ if (!(pp->flags & PP_CLAIMED)) {
+ parport_claim_or_block (pp->pdev);
+ pp->flags |= PP_CLAIMED;
+ }
+ parport_negotiate (pp->pdev->port, IEEE1284_MODE_COMPAT);
+ printk (KERN_DEBUG CHRDEV
+ "%x: negotiated back to compatibility mode because "
+ "user-space forgot\n", minor);
+ }
+
if (pp->flags & PP_CLAIMED) {
parport_release (pp->pdev);
printk (KERN_DEBUG CHRDEV "%x: released pardevice because "
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 8f25926e9..9331852e1 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -174,7 +174,9 @@ static int pty_write(struct tty_struct * tty, int from_user,
}
up(&tty->flip.pty_sem);
} else {
- c = MIN(count, to->ldisc.receive_room(to));
+ c = to->ldisc.receive_room(to);
+ if (c > count)
+ c = count;
to->ldisc.receive_buf(to, buf, 0, c);
}
diff --git a/drivers/char/radio-gemtek.c b/drivers/char/radio-gemtek.c
index 523ac0955..8b53dbd0d 100644
--- a/drivers/char/radio-gemtek.c
+++ b/drivers/char/radio-gemtek.c
@@ -266,7 +266,7 @@ static int __init gemtek_init(void)
{
if(io==-1)
{
- printk(KERN_ERR "You must set an I/O address with io=0x20c, io=0x30c, io=0x24c or io=0x34c (or io=0x248 for the combined sound/radiocard)\n");
+ printk(KERN_ERR "You must set an I/O address with io=0x20c, io=0x30c, io=0x24c or io=0x34c (io=0x020c or io=0x248 for the combined sound/radiocard)\n");
return -EINVAL;
}
@@ -299,7 +299,7 @@ static int __init gemtek_init(void)
MODULE_AUTHOR("Jonas Munsin");
MODULE_DESCRIPTION("A driver for the GemTek Radio Card");
MODULE_PARM(io, "i");
-MODULE_PARM_DESC(io, "I/O address of the GemTek card (0x20c, 0x30c, 0x24c or 0x34c (or 0x248 for the combined sound/radiocard))");
+MODULE_PARM_DESC(io, "I/O address of the GemTek card (0x20c, 0x30c, 0x24c or 0x34c (0x20c or 0x248 have been reported to work for the combined sound/radiocard)).");
EXPORT_NO_SYMBOLS;
diff --git a/drivers/char/serial.c b/drivers/char/serial.c
index 9c3f2e2e5..2d160acfd 100644
--- a/drivers/char/serial.c
+++ b/drivers/char/serial.c
@@ -1648,8 +1648,13 @@ static void change_speed(struct async_struct *info,
serial_outp(info, UART_FCR, fcr); /* set fcr */
serial_outp(info, UART_LCR, cval); /* reset DLAB */
info->LCR = cval; /* Save LCR */
- if (info->state->type != PORT_16750)
+ if (info->state->type != PORT_16750) {
+ if (fcr & UART_FCR_ENABLE_FIFO) {
+ /* emulated UARTs (Lucent Venus 167x) need two steps */
+ serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO);
+ }
serial_outp(info, UART_FCR, fcr); /* set fcr */
+ }
restore_flags(flags);
}
@@ -4515,9 +4520,24 @@ int __init rs_init(void)
}
/*
- * register_serial and unregister_serial allows for serial ports to be
+ * register_serial and unregister_serial allows for 16x50 serial ports to be
* configured at run-time, to support PCMCIA modems.
*/
+
+/**
+ * register_serial - configure a 16x50 serial port at runtime
+ * @req: request structure
+ *
+ * Configure the serial port specified by the request. If the
+ * port exists and is in use an error is returned. If the port
+ * is not currently in the table it is added.
+ *
+ * The port is then probed and if neccessary the IRQ is autodetected
+ * If this fails an error is returned.
+ *
+ * On success the port is ready to use and the line number is returned.
+ */
+
int register_serial(struct serial_struct *req)
{
int i;
@@ -4575,7 +4595,7 @@ int register_serial(struct serial_struct *req)
if ((state->flags & ASYNC_AUTO_IRQ) && CONFIGURED_SERIAL_PORT(state))
state->irq = detect_uart_irq(state);
- printk(KERN_INFO "ttyS%02d at %s 0x%04lx (irq = %d) is a %s\n",
+ printk(KERN_INFO "ttyS%02d at %s 0x%04lx (irq = %d) is a %s\n",
state->line + SERIAL_DEV_OFFSET,
state->iomem_base ? "iomem" : "port",
state->iomem_base ? (unsigned long)state->iomem_base :
@@ -4588,6 +4608,15 @@ int register_serial(struct serial_struct *req)
return state->line + SERIAL_DEV_OFFSET;
}
+/**
+ * unregister_serial - deconfigure a 16x50 serial port
+ * @line: line to deconfigure
+ *
+ * The port specified is deconfigured and its resources are freed. Any
+ * user of the port is disconnected as if carrier was dropped. Line is
+ * the port number returned by register_serial.
+ */
+
void unregister_serial(int line)
{
unsigned long flags;
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 7caf1058a..1b8583034 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -4,7 +4,7 @@
* This driver will also support the older SI, and XIO cards.
*
*
- * (C) 1998 R.E.Wolff@BitWizard.nl
+ * (C) 1998 - 2000 R.E.Wolff@BitWizard.nl
*
* Simon Allen (simonallen@cix.compulink.co.uk) wrote a previous
* version of this driver. Some fragments may have been copied. (none
@@ -33,6 +33,16 @@
*
* Revision history:
* $Log: sx.c,v $
+ * Revision 1.32 2000/03/07 90:00:00 wolff,pvdl
+ * - Fixed some sx_dprintk typos
+ * - added detection for an invalid board/module configuration
+ *
+ * Revision 1.31 2000/03/06 12:00:00 wolff,pvdl
+ * - Added support for EISA
+ *
+ * Revision 1.30 2000/01/21 17:43:06 wolff
+ * - Added support for SX+
+ *
* Revision 1.26 1999/08/05 15:22:14 wolff
* - Port to 2.3.x
* - Reformatted to Linus' liking.
@@ -185,8 +195,8 @@
* */
-#define RCS_ID "$Id: sx.c,v 1.26 1999/08/05 15:22:14 wolff Exp $"
-#define RCS_REV "$Revision: 1.26 $"
+#define RCS_ID "$Id: sx.c,v 1.32 2000/03/07 17:01:02 wolff, pvdl Exp $"
+#define RCS_REV "$Revision: 1.32 $"
#include <linux/module.h>
@@ -221,6 +231,9 @@
#include "sxboards.h"
#include "sxwindow.h"
+#include <linux/generic_serial.h>
+#include <linux/compatmac.h>
+#include "sx.h"
/* I don't think that this driver can handle more than 256 ports on
@@ -228,149 +241,16 @@
if you want more than 4 boards. */
-/* ************************************************************** */
-/* * This section can be removed when 2.0 becomes outdated.... * */
-/* ************************************************************** */
-
-
-#if LINUX_VERSION_CODE < 0x020100 /* Less than 2.1.0 */
-#define TWO_ZERO
-#else
-#if LINUX_VERSION_CODE < 0x020200 /* less than 2.2.x */
-#warning "Please use a 2.2.x kernel. "
-#else
-#if LINUX_VERSION_CODE < 0x020300 /* less than 2.3.x */
-#define TWO_TWO
-#else
-#define TWO_THREE
-#endif
-#endif
-#endif
-
-#ifdef TWO_ZERO
-
-/* Here is the section that makes the 2.2 compatible driver source
- work for 2.0 too! We mostly try to adopt the "new thingies" from 2.2,
- and provide for compatibility stuff here if possible. */
-
-#include <linux/bios32.h>
-
-#define Get_user(a,b) a = get_user(b)
-#define Put_user(a,b) 0,put_user(a,b)
-#define copy_to_user(a,b,c) memcpy_tofs(a,b,c)
-
-static inline int copy_from_user(void *to,const void *from, int c)
-{
- memcpy_fromfs(to, from, c);
- return 0;
-}
-
-#define pci_present pcibios_present
-#define pci_read_config_word pcibios_read_config_word
-#define pci_read_config_dword pcibios_read_config_dword
-
-static inline unsigned char get_irq (unsigned char bus, unsigned char fn)
-{
- unsigned char t;
- pcibios_read_config_byte (bus, fn, PCI_INTERRUPT_LINE, &t);
- return t;
-}
-
-static inline void *ioremap(unsigned long base, long length)
-{
- if (base < 0x100000) return (void *)base;
- return vremap (base, length);
-}
-
-#define my_iounmap(x, b) (((long)x<0x100000)?0:vfree ((void*)x))
-
-#define capable(x) suser()
-
-#define queue_task queue_task_irq_off
-#define tty_flip_buffer_push(tty) queue_task(&tty->flip.tqueue, &tq_timer)
-#define signal_pending(current) (current->signal & ~current->blocked)
-#define schedule_timeout(to) do {current->timeout = jiffies + (to);schedule ();} while (0)
-#define time_after(t1,t2) (((long)t1-t2) > 0)
-
-
-#define test_and_set_bit(nr, addr) set_bit(nr, addr)
-#define test_and_clear_bit(nr, addr) clear_bit(nr, addr)
-
-/* Not yet implemented on 2.0 */
-#define ASYNC_SPD_SHI -1
-#define ASYNC_SPD_WARP -1
-
-
-/* Ugly hack: the driver_name doesn't exist in 2.0.x . So we define it
- to the "name" field that does exist. As long as the assignments are
- done in the right order, there is nothing to worry about. */
-#define driver_name name
-
-/* Should be in a header somewhere. They are in tty.h on 2.2 */
-#define TTY_HW_COOK_OUT 14 /* Flag to tell ntty what we can handle */
-#define TTY_HW_COOK_IN 15 /* in hardware - output and input */
-
-/* The return type of a "close" routine. */
-#define INT void
-#define NO_ERROR /* Nothing */
-
-#else
-
-/* The 2.2.x compatibility section. */
-#include <asm/uaccess.h>
-
-
-#define Get_user(a,b) get_user(a,b)
-#define Put_user(a,b) put_user(a,b)
-#define get_irq(pdev) pdev->irq
-
-#define INT int
-#define NO_ERROR 0
-
-#define my_iounmap(x,b) (iounmap((char *)(b)))
-
-#endif
-
-#ifndef TWO_THREE
-/* These are new in 2.3. The source now uses 2.3 syntax, and here is
- the compatibility define... */
-#define wait_queue_head_t struct wait_queue *
-#define DECLARE_MUTEX(name) struct semaphore name = MUTEX
-#define DECLARE_WAITQUEUE(wait, current) struct wait_queue wait = { current, NULL }
-
-#endif
-
-#undef RS_EVENT_WRITE_WAKEUP
-#define RS_EVENT_WRITE_WAKEUP 0
-
-
-#include "generic_serial.h"
-#include "sx.h"
-
-
-/* ************************************************************** */
-/* * End of compatibility section.. * */
-/* ************************************************************** */
-
-
/* Why the hell am I defining these here? */
#define SX_TYPE_NORMAL 1
#define SX_TYPE_CALLOUT 2
-#ifndef SX_NORMAL_MAJOR
-/* This allows overriding on the compiler commandline, or in a "major.h"
- include or something like that */
-#define SX_NORMAL_MAJOR 32
-#define SX_CALLOUT_MAJOR 33
-#endif
-
#ifndef PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8
#define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000
#endif
-
/* Configurable options:
(Don't be too sure that it'll work if you toggle them) */
@@ -410,19 +290,17 @@ static void sx_disable_rx_interrupts (void * ptr);
static void sx_enable_rx_interrupts (void * ptr);
static int sx_get_CD (void * ptr);
static void sx_shutdown_port (void * ptr);
-static void sx_set_real_termios (void *ptr);
+static int sx_set_real_termios (void *ptr);
static void sx_hungup (void *ptr);
static void sx_close (void *ptr);
static int sx_chars_in_buffer (void * ptr);
static int sx_init_board (struct sx_board *board);
static int sx_init_portstructs (int nboards, int nports);
static int sx_fw_ioctl (struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
+ unsigned int cmd, unsigned long arg);
static int sx_fw_open(struct inode *inode, struct file *filp);
static INT sx_fw_release(struct inode *inode, struct file *filp);
static int sx_init_drivers(void);
-void my_hd (unsigned char *addr, int len);
-
static struct tty_driver sx_driver, sx_callout_driver;
@@ -458,11 +336,13 @@ int sx_slowpoll = 0;
int sx_maxints = 100;
/* These are the only open spaces in my computer. Yours may have more
- or less.... */
+ or less.... -- REW
+ duh: Card at 0xa0000 is possible on HP Netserver?? -- pvdl
+*/
int sx_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000,
0xc8000, 0xd8000, 0xe8000};
int si_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000,
- 0xc8000, 0xd8000, 0xe8000};
+ 0xc8000, 0xd8000, 0xe8000, 0xa0000};
#define NR_SX_ADDRS (sizeof(sx_probe_addrs)/sizeof (int))
#define NR_SI_ADDRS (sizeof(si_probe_addrs)/sizeof (int))
@@ -474,6 +354,8 @@ int sx_irqmask = -1;
#ifndef TWO_ZERO
#ifdef MODULE
+MODULE_PARM(sx_probe_addrs, "i");
+MODULE_PARM(si_probe_addrs, "i");
MODULE_PARM(sx_poll, "i");
MODULE_PARM(sx_slowpoll, "i");
MODULE_PARM(sx_maxints, "i");
@@ -580,6 +462,27 @@ static inline int sx_paranoia_check(struct sx_port const * port,
#define TIMEOUT_2 1000000
+#ifdef DEBUG
+static void my_hd (unsigned char *addr, int len)
+{
+ int i, j, ch;
+
+ for (i=0;i<len;i+=16) {
+ printk ("%08x ", (int) addr+i);
+ for (j=0;j<16;j++) {
+ printk ("%02x %s", addr[j+i], (j==7)?" ":"");
+ }
+ for (j=0;j<16;j++) {
+ ch = addr[j+i];
+ printk ("%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch));
+ }
+ printk ("\n");
+ }
+}
+#endif
+
+
+
/* This needs redoing for Alpha -- REW -- Done. */
inline void write_sx_byte (struct sx_board *board, int offset, u8 byte)
@@ -675,6 +578,8 @@ int sx_reset (struct sx_board *board)
printk (KERN_INFO "sx: Card doesn't respond to reset....\n");
return 0;
}
+ } else if (IS_EISA_BOARD(board)) {
+ outb(board->irq<<4, board->eisa_base+0xc02);
} else {
/* Gory details of the SI/ISA board */
write_sx_byte (board, SI2_ISA_RESET, SI2_ISA_RESET_SET);
@@ -746,9 +651,12 @@ int sx_start_board (struct sx_board *board)
{
if (IS_SX_BOARD (board)) {
write_sx_byte (board, SX_CONFIG, SX_CONF_BUSEN);
+ } else if (IS_EISA_BOARD(board)) {
+ write_sx_byte(board, SI2_EISA_OFF, SI2_EISA_VAL);
+ outb((board->irq<<4)|4, board->eisa_base+0xc02);
} else {
/* Don't bug me about the clear_set.
- I haven't the foggiest idea what it's about -- REW*/
+ I haven't the foggiest idea what it's about -- REW */
write_sx_byte (board, SI2_ISA_RESET, SI2_ISA_RESET_CLEAR);
write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET);
}
@@ -769,6 +677,8 @@ int sx_start_interrupts (struct sx_board *board)
write_sx_byte (board, SX_CONFIG, SX_IRQ_REG_VAL (board) |
SX_CONF_BUSEN |
SX_CONF_HOSTIRQ);
+ } else if (IS_EISA_BOARD(board)) {
+ inb(board->eisa_base+0xc03);
} else {
switch (board->irq) {
case 11:write_sx_byte (board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_SET);break;
@@ -834,6 +744,18 @@ int mod_compat_type (int module_type)
return module_type >> 4;
}
+static void sx_reconfigure_port(struct sx_port *port)
+{
+ if (sx_read_channel_byte (port, hi_hstat) == HS_IDLE_OPEN) {
+ if (sx_send_command (port, HS_CONFIG, -1, HS_IDLE_OPEN) != 1) {
+ printk (KERN_WARNING "sx: Sent reconfigure command, but card didn't react.\n");
+ }
+ } else {
+ sx_dprintk (SX_DEBUG_TERMIOS,
+ "sx: Not sending reconfigure: port isn't open (%02x).\n",
+ sx_read_channel_byte (port, hi_hstat));
+ }
+}
static void sx_setsignals (struct sx_port *port, int dtr, int rts)
{
@@ -954,7 +876,7 @@ static void sx_set_baud (struct sx_port *port)
/* Simon Allen's version of this routine was 225 lines long. 85 is a lot
better. -- REW */
-static void sx_set_real_termios (void *ptr)
+static int sx_set_real_termios (void *ptr)
{
struct sx_port *port = ptr;
@@ -1008,16 +930,7 @@ static void sx_set_real_termios (void *ptr)
sx_write_channel_byte (port, hi_txoff, STOP_CHAR (port->gs.tty));
sx_write_channel_byte (port, hi_rxoff, STOP_CHAR (port->gs.tty));
- if (sx_read_channel_byte (port, hi_hstat) == HS_IDLE_OPEN) {
- if (sx_send_command (port, HS_CONFIG, -1, HS_IDLE_OPEN) != 1) {
- printk (KERN_WARNING "sx: Sent reconfigure command, but card didn't react.\n");
- }
- } else {
- sx_dprintk (SX_DEBUG_TERMIOS,
- "sx: Not sending reconfigure: port isn't open (%02x).\n",
- sx_read_channel_byte (port, hi_hstat));
- }
-
+ sx_reconfigure_port(port);
/* Tell line discipline whether we will do input cooking */
if(I_OTHER(port->gs.tty)) {
@@ -1045,6 +958,7 @@ static void sx_set_real_termios (void *ptr)
O_OTHER(port->gs.tty));
/* port->c_dcd = sx_get_CD (port); */
func_exit ();
+ return 0;
}
@@ -1102,7 +1016,7 @@ void sx_transmit_chars (struct sx_port *port)
/* Don't copy pas the end of the source buffer */
if (c > SERIAL_XMIT_SIZE - port->gs.xmit_tail)
- c = SERIAL_XMIT_SIZE - port->gs.xmit_tail;
+ c = SERIAL_XMIT_SIZE - port->gs.xmit_tail;
sx_dprintk (SX_DEBUG_TRANSMIT, " %d(%d) \n",
c, SERIAL_XMIT_SIZE- port->gs.xmit_tail);
@@ -1331,6 +1245,9 @@ static void sx_interrupt (int irq, void *ptr, struct pt_regs *regs)
sx_write_board_word (board, cc_int_pending, 0);
if (IS_SX_BOARD (board)) {
write_sx_byte (board, SX_RESET_IRQ, 1);
+ } else if (IS_EISA_BOARD(board)) {
+ inb(board->eisa_base+0xc03);
+ write_sx_word(board, 8, 0);
} else {
write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_CLEAR);
write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET);
@@ -1474,6 +1391,7 @@ static void sx_shutdown_port (void * ptr)
port->gs.flags &= ~ GS_ACTIVE;
if (port->gs.tty && port->gs.tty->termios->c_cflag & HUPCL) {
sx_setsignals (port, 0, 0);
+ sx_reconfigure_port(port);
}
func_exit();
@@ -1711,7 +1629,7 @@ int do_memtest_w (struct sx_board *board, int min, int max)
static int sx_fw_ioctl (struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+ unsigned int cmd, unsigned long arg)
{
int rc = 0;
int *descr = (int *)arg, i;
@@ -1754,7 +1672,11 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp,
board = &boards[arg];
break;
case SXIO_GET_TYPE:
- rc = IS_SX_BOARD (board)? SX_TYPE_SX:SX_TYPE_SI;
+ rc = -ENOENT; /* If we manage to miss one, return error. */
+ if (IS_SX_BOARD (board)) rc = SX_TYPE_SX;
+ if (IS_CF_BOARD (board)) rc = SX_TYPE_CF;
+ if (IS_SI_BOARD (board)) rc = SX_TYPE_SI;
+ if (IS_EISA_BOARD (board)) rc = SX_TYPE_SI;
sx_dprintk (SX_DEBUG_FIRMWARE, "returning type= %d\n", rc);
break;
case SXIO_DO_RAMTEST:
@@ -1786,7 +1708,7 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp,
for (i=0;i<nbytes;i += SX_CHUNK_SIZE) {
copy_from_user (tmp, (char *)data+i,
(i+SX_CHUNK_SIZE>nbytes)?nbytes-i:SX_CHUNK_SIZE);
- memcpy_toio ((char *) (board->base + offset + i), tmp,
+ memcpy_toio ((char *) (board->base2 + offset + i), tmp,
(i+SX_CHUNK_SIZE>nbytes)?nbytes-i:SX_CHUNK_SIZE);
}
@@ -1830,6 +1752,9 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp,
case SXIO_GETGSDEBUG:
rc = gs_debug;
break;
+ case SXIO_GETNPORTS:
+ rc = sx_nports;
+ break;
default:
printk (KERN_WARNING "Unknown ioctl on firmware device (%x).\n", cmd);
break;
@@ -1886,6 +1811,7 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp,
Get_user(ival, (unsigned int *) arg);
sx_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1),
((ival & TIOCM_RTS) ? 1 : -1));
+ sx_reconfigure_port(port);
}
break;
case TIOCMBIC:
@@ -1894,6 +1820,7 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp,
Get_user(ival, (unsigned int *) arg);
sx_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1),
((ival & TIOCM_RTS) ? 0 : -1));
+ sx_reconfigure_port(port);
}
break;
case TIOCMSET:
@@ -1902,6 +1829,7 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp,
Get_user(ival, (unsigned int *) arg);
sx_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0),
((ival & TIOCM_RTS) ? 1 : 0));
+ sx_reconfigure_port(port);
}
break;
@@ -1980,13 +1908,17 @@ static int sx_init_board (struct sx_board *board)
board->flags |= SX_BOARD_INITIALIZED;
+ if (read_sx_byte (board, 0))
+ /* CF boards may need this. */
+ write_sx_byte(board,0, 0);
+
/* This resets the processor again, to make sure it didn't do any
foolish things while we were downloading the image */
if (!sx_reset (board))
return 0;
sx_start_board (board);
-
+ udelay (10);
if (!sx_busy_wait_neq (board, 0, 0xff, 0)) {
printk (KERN_ERR "sx: Ooops. Board won't initialize.\n");
return 0;
@@ -2050,7 +1982,8 @@ static int sx_init_board (struct sx_board *board)
chans=0;
break;
}
- if (IS_SI_BOARD(board) && (mod_compat_type(type) == 4)) {
+ if ((IS_EISA_BOARD(board) ||
+ IS_SI_BOARD(board)) && (mod_compat_type(type) == 4)) {
printk (KERN_ERR "sx: This is an invalid configuration.\n"
"Don't use SXDCs on an SI/XIO adapter.\n");
chans=0;
@@ -2147,52 +2080,56 @@ int probe_sx (struct sx_board *board)
int i;
func_enter();
- sx_dprintk (SX_DEBUG_PROBE, "Going to verify vpd prom at %x.\n",
- board->base + SX_VPD_ROM);
- if (sx_debug & SX_DEBUG_PROBE)
- my_hd ((char *)(board->base + SX_VPD_ROM), 0x40);
+ if (!IS_CF_BOARD (board)) {
+ sx_dprintk (SX_DEBUG_PROBE, "Going to verify vpd prom at %x.\n",
+ board->base + SX_VPD_ROM);
- p = (char *) &vpdp;
- for (i=0;i< sizeof (struct vpd_prom);i++)
- *p++ = read_sx_byte (board, SX_VPD_ROM + i*2);
+ if (sx_debug & SX_DEBUG_PROBE)
+ my_hd ((char *)(board->base + SX_VPD_ROM), 0x40);
- if (sx_debug & SX_DEBUG_PROBE)
- my_hd ((char *)&vpdp, 0x20);
+ p = (char *) &vpdp;
+ for (i=0;i< sizeof (struct vpd_prom);i++)
+ *p++ = read_sx_byte (board, SX_VPD_ROM + i*2);
- sx_dprintk (SX_DEBUG_PROBE, "checking identifier...\n");
+ if (sx_debug & SX_DEBUG_PROBE)
+ my_hd ((char *)&vpdp, 0x20);
- if (strncmp (vpdp.identifier, SX_VPD_IDENT_STRING, 16) != 0) {
- sx_dprintk (SX_DEBUG_PROBE, "Got non-SX identifier: '%s'\n",
- vpdp.identifier);
- return 0;
+ sx_dprintk (SX_DEBUG_PROBE, "checking identifier...\n");
+
+ if (strncmp (vpdp.identifier, SX_VPD_IDENT_STRING, 16) != 0) {
+ sx_dprintk (SX_DEBUG_PROBE, "Got non-SX identifier: '%s'\n",
+ vpdp.identifier);
+ return 0;
+ }
}
printheader ();
- printk (KERN_DEBUG "sx: Found an SX board at %x\n", board->hw_base);
- printk (KERN_DEBUG "sx: hw_rev: %d, assembly level: %d, uniq ID:%08x, ",
- vpdp.hwrev, vpdp.hwass, vpdp.uniqid);
- printk ( "Manufactured: %d/%d\n",
- 1970 + vpdp.myear, vpdp.mweek);
+ if (!IS_CF_BOARD (board)) {
+ printk (KERN_DEBUG "sx: Found an SX board at %x\n", board->hw_base);
+ printk (KERN_DEBUG "sx: hw_rev: %d, assembly level: %d, uniq ID:%08x, ",
+ vpdp.hwrev, vpdp.hwass, vpdp.uniqid);
+ printk ( "Manufactured: %d/%d\n",
+ 1970 + vpdp.myear, vpdp.mweek);
- if ((((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) != SX_PCI_UNIQUEID1) &&
- (((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) != SX_ISA_UNIQUEID1)) {
- /* This might be a bit harsh. This was the primary reason the
- SX/ISA card didn't work at first... */
- printk (KERN_ERR "sx: Hmm. Not an SX/PCI or SX/ISA card. Sorry: giving up.\n");
- return (0);
- }
+ if ((((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) != SX_PCI_UNIQUEID1) &&
+ (((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) != SX_ISA_UNIQUEID1)) {
+ /* This might be a bit harsh. This was the primary reason the
+ SX/ISA card didn't work at first... */
+ printk (KERN_ERR "sx: Hmm. Not an SX/PCI or SX/ISA card. Sorry: giving up.\n");
+ return (0);
+ }
- if (((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) == SX_ISA_UNIQUEID1) {
- if (board->base & 0x8000) {
- printk (KERN_WARNING "sx: Warning: There may be hardware problems with the card at %x.\n", board->base);
- printk (KERN_WARNING "sx: Read sx.txt for more info.\n");
+ if (((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) == SX_ISA_UNIQUEID1) {
+ if (board->base & 0x8000) {
+ printk (KERN_WARNING "sx: Warning: There may be hardware problems with the card at %x.\n", board->base);
+ printk (KERN_WARNING "sx: Read sx.txt for more info.\n");
+ }
}
}
-
board->nports = -1;
/* This resets the processor, and keeps it off the bus. */
@@ -2225,9 +2162,11 @@ int probe_si (struct sx_board *board)
if (sx_debug & SX_DEBUG_PROBE)
my_hd ((char *)(board->base + SI2_ISA_ID_BASE), 0x8);
- for (i=0;i<8;i++) {
- if ((read_sx_byte (board, SI2_ISA_ID_BASE+7-i) & 7) != i) {
- return 0;
+ if (!IS_EISA_BOARD(board)) {
+ for (i=0;i<8;i++) {
+ if ((read_sx_byte (board, SI2_ISA_ID_BASE+7-i) & 7) != i) {
+ return 0;
+ }
}
}
@@ -2449,7 +2388,7 @@ void fix_sx_pci (PDEV, struct sx_board *board)
unsigned int t;
#define CNTRL_REG_OFFSET 0x50
-#define CNTRL_REG_GOODVALUE 0x00260000
+#define CNTRL_REG_GOODVALUE 0x18260000
pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase);
hwbase &= PCI_BASE_ADDRESS_MEM_MASK;
@@ -2472,6 +2411,7 @@ int sx_init(void)
{
int i;
int found = 0;
+ int eisa_slot;
struct sx_board *board;
#ifdef CONFIG_PCI
@@ -2518,22 +2458,35 @@ int sx_init(void)
tshort = (tint >> 16) & 0xffff;
sx_dprintk (SX_DEBUG_PROBE, "Got a specialix card: %x.\n", tint);
/* sx_dprintk (SX_DEBUG_PROBE, "pdev = %d/%d (%x)\n", pdev, tint); */
- if (tshort != 0x0200) {
+ if ((tshort != 0x0200) && (tshort != 0x0300)) {
sx_dprintk (SX_DEBUG_PROBE, "But it's not an SX card (%d)...\n",
tshort);
continue;
}
board = &boards[found];
- pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint);
+ board->flags &= ~SX_BOARD_TYPE;
+ board->flags |= (tshort == 0x200)?SX_PCI_BOARD:
+ SX_CFPCI_BOARD;
+
+ /* CF boards use base address 3.... */
+ if (IS_CF_BOARD (board))
+ pci_read_config_dword(pdev, PCI_BASE_ADDRESS_3,
+ &tint);
+ else
+ pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2,
+ &tint);
board->hw_base = tint & PCI_BASE_ADDRESS_MEM_MASK;
- board->base = (ulong) ioremap(board->hw_base, SX_WINDOW_LEN);
+ board->base2 =
+ board->base = (ulong) ioremap(board->hw_base, WINDOW_LEN (board));
+ /* Most of the stuff on the CF board is offset by
+ 0x18000 .... */
+ if (IS_CF_BOARD (board)) board->base += 0x18000;
+
board->irq = get_irq (pdev);
- board->flags &= ~SX_BOARD_TYPE;
- board->flags |= SX_PCI_BOARD;
- sx_dprintk (SX_DEBUG_PROBE, "Got a specialix card: %x/%x(%d).\n",
- tint, boards[found].base, board->irq);
+ sx_dprintk (SX_DEBUG_PROBE, "Got a specialix card: %x/%x(%d) %x.\n",
+ tint, boards[found].base, board->irq, board->flags);
if (probe_sx (board)) {
found++;
@@ -2547,6 +2500,7 @@ int sx_init(void)
for (i=0;i<NR_SX_ADDRS;i++) {
board = &boards[found];
board->hw_base = sx_probe_addrs[i];
+ board->base2 =
board->base = (ulong) ioremap(board->hw_base, SX_WINDOW_LEN);
board->flags &= ~SX_BOARD_TYPE;
board->flags |= SX_ISA_BOARD;
@@ -2562,6 +2516,7 @@ int sx_init(void)
for (i=0;i<NR_SI_ADDRS;i++) {
board = &boards[found];
board->hw_base = si_probe_addrs[i];
+ board->base2 =
board->base = (ulong) ioremap(board->hw_base, SI2_ISA_WINDOW_LEN);
board->flags &= ~SX_BOARD_TYPE;
board->flags |= SI_ISA_BOARD;
@@ -2574,6 +2529,34 @@ int sx_init(void)
}
}
+ sx_dprintk(SX_DEBUG_PROBE, "Probing for EISA cards\n");
+ for(eisa_slot=0x1000; eisa_slot<0x10000; eisa_slot+=0x1000)
+ {
+ if((inb(eisa_slot+0xc80)==0x4d) &&
+ (inb(eisa_slot+0xc81)==0x98))
+ {
+ sx_dprintk(SX_DEBUG_PROBE, "%s : Signature found in EISA slot %d, Product %d Rev %d\n",
+ "XIO", (eisa_slot>>12), inb(eisa_slot+0xc82), inb(eisa_slot+0xc83));
+
+ board = &boards[found];
+ board->eisa_base = eisa_slot;
+ board->flags &= ~SX_BOARD_TYPE;
+ board->flags |= SI_EISA_BOARD;
+
+ board->hw_base = (((inb(0xc01+eisa_slot) << 8) + inb(0xc00+eisa_slot)) << 16);
+ board->base2 =
+ board->base = (ulong) ioremap(board->hw_base, SI2_EISA_WINDOW_LEN);
+
+ sx_dprintk(SX_DEBUG_PROBE, "IO hw_base address: %x\n", board->hw_base);
+ sx_dprintk(SX_DEBUG_PROBE, "base: %x\n", board->base);
+ board->irq = inb(board->eisa_base+0xc02)>>4;
+ sx_dprintk(SX_DEBUG_PROBE, "IRQ: %d\n", board->irq);
+
+ probe_si(board);
+
+ found++;
+ }
+ }
if (found) {
printk (KERN_INFO "sx: total of %d boards detected.\n", found);
@@ -2588,7 +2571,7 @@ int sx_init(void)
}
-
+#ifdef MODULE
void cleanup_module(void)
{
int i;
@@ -2622,52 +2605,4 @@ void cleanup_module(void)
kfree (sx_termios_locked);
func_exit();
}
-
-
-#ifdef DEBUG
-void my_hd (unsigned char *addr, int len)
-{
- int i, j, ch;
-
- for (i=0;i<len;i+=16) {
- printk ("%08x ", (int) addr+i);
- for (j=0;j<16;j++) {
- printk ("%02x %s", addr[j+i], (j==7)?" ":"");
- }
- for (j=0;j<16;j++) {
- ch = addr[j+i];
- printk ("%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch));
- }
- printk ("\n");
- }
-}
#endif
-
-#ifdef MODULE
-#undef func_enter
-#undef func_exit
-
-#include "generic_serial.c"
-#endif
-
-
-/*
- * Anybody who knows why this doesn't work for me, please tell me -- REW.
- * Snatched from scsi.c (fixed one spelling error):
- * Overrides for Emacs so that we follow Linus' tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only. This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * indent-tabs-mode: nil
- * tab-width: 8
- * End:
- */
diff --git a/drivers/char/sx.h b/drivers/char/sx.h
index e046482e4..662b27ca2 100644
--- a/drivers/char/sx.h
+++ b/drivers/char/sx.h
@@ -37,7 +37,9 @@ struct sx_port {
struct sx_board {
int magic;
unsigned int base;
+ unsigned int base2;
unsigned int hw_base;
+ int eisa_base;
int port_base; /* Number of the first port */
struct sx_port *ports;
int nports;
@@ -65,19 +67,27 @@ struct vpd_prom {
#define MOD_RS232DB25MALE 0x0a
#endif
-
-#define SX_BOARD_PRESENT 0x00000001
+#define SI_ISA_BOARD 0x00000001
#define SX_ISA_BOARD 0x00000002
#define SX_PCI_BOARD 0x00000004
-#define SI_ISA_BOARD 0x00000008
-#define SX_BOARD_INITIALIZED 0x00000010
-#define SX_IRQ_ALLOCATED 0x00000020
+#define SX_CFPCI_BOARD 0x00000008
+#define SX_CFISA_BOARD 0x00000010
+#define SI_EISA_BOARD 0x00000020
+
+#define SX_BOARD_PRESENT 0x00001000
+#define SX_BOARD_INITIALIZED 0x00002000
+#define SX_IRQ_ALLOCATED 0x00004000
+
+#define SX_BOARD_TYPE 0x000000ff
-#define SX_BOARD_TYPE (SX_ISA_BOARD|SX_PCI_BOARD|SI_ISA_BOARD)
+#define IS_SX_BOARD(board) (board->flags & (SX_PCI_BOARD | SX_CFPCI_BOARD | \
+ SX_ISA_BOARD | SX_CFISA_BOARD))
-#define IS_SX_BOARD(board) (board->flags & (SX_PCI_BOARD | SX_ISA_BOARD))
#define IS_SI_BOARD(board) (board->flags & SI_ISA_BOARD)
+#define IS_EISA_BOARD(board) (board->flags & SI_EISA_BOARD)
+
+#define IS_CF_BOARD(board) (board->flags & (SX_CFISA_BOARD | SX_CFPCI_BOARD))
#define SERIAL_TYPE_NORMAL 1
@@ -168,6 +178,7 @@ struct vpd_prom {
#define SXIO_DO_RAMTEST SPXL(0x07)
#define SXIO_SETGSDEBUG SPXL(0x08)
#define SXIO_GETGSDEBUG SPXL(0x09)
+#define SXIO_GETNPORTS SPXL(0x0a)
#ifndef SXCTL_MISC_MINOR
@@ -175,6 +186,19 @@ struct vpd_prom {
#define SXCTL_MISC_MINOR 167
#endif
+#ifndef SX_NORMAL_MAJOR
+/* This allows overriding on the compiler commandline, or in a "major.h"
+ include or something like that */
+#define SX_NORMAL_MAJOR 32
+#define SX_CALLOUT_MAJOR 33
+#endif
+
+
#define SX_TYPE_SX 0x01
#define SX_TYPE_SI 0x02
+#define SX_TYPE_CF 0x03
+
+
+#define WINDOW_LEN(board) (IS_CF_BOARD(board)?0x20000:SX_WINDOW_LEN)
+/* Need a #define for ^^^^^^^ !!! */
diff --git a/drivers/char/sxboards.h b/drivers/char/sxboards.h
index 45636c9e9..2f0f5428e 100644
--- a/drivers/char/sxboards.h
+++ b/drivers/char/sxboards.h
@@ -159,6 +159,7 @@
#define SI2_EISA_OFF 0x42
#define SI2_EISA_VAL 0x01
+#define SI2_EISA_WINDOW_LEN 0x10000
/*****************************************************************************
*********************************** **********************************
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index ed504dcfe..e1e504b79 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1979,6 +1979,7 @@ static void initialize_tty_struct(struct tty_struct *tty)
tty->tq_hangup.routine = do_tty_hangup;
tty->tq_hangup.data = tty;
sema_init(&tty->atomic_read, 1);
+ spin_lock_init(&tty->read_lock);
INIT_LIST_HEAD(&tty->tty_files);
}
@@ -2319,6 +2320,9 @@ void __init tty_init(void)
#ifdef CONFIG_SX
sx_init();
#endif
+#ifdef CONFIG_RIO
+ rio_init();
+#endif
#ifdef CONFIG_8xx
rs_8xx_init();
#endif /* CONFIG_8xx */
diff --git a/drivers/char/videodev.c b/drivers/char/videodev.c
index f0b1aaf4d..0a4e65c57 100644
--- a/drivers/char/videodev.c
+++ b/drivers/char/videodev.c
@@ -24,10 +24,9 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/videodev.h>
+#include <linux/init.h>
-#if LINUX_VERSION_CODE >= 0x020100
#include <asm/uaccess.h>
-#endif
#include <asm/system.h>
#include <linux/kmod.h>
@@ -174,20 +173,11 @@ static int video_release(struct inode *inode, struct file *file)
* image ?
*/
-#if LINUX_VERSION_CODE >= 0x020100
static long long video_lseek(struct file * file,
long long offset, int origin)
{
return -ESPIPE;
}
-#else
-static long long video_lseek(struct inode *inode, struct file * file,
- long long offset, int origin)
-{
- return -ESPIPE;
-}
-#endif
-
static int video_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
@@ -210,16 +200,9 @@ static int video_ioctl(struct inode *inode, struct file *file,
*/
-#if LINUX_VERSION_CODE >= 0x020100
int video_mmap(struct file *file, struct vm_area_struct *vma)
{
struct video_device *vfl=video_device[MINOR(file->f_dentry->d_inode->i_rdev)];
-#else
-static int video_mmap(struct inode * ino, struct file * file,
- struct vm_area_struct * vma)
-{
- struct video_device *vfl=video_device[MINOR(ino->i_rdev)];
-#endif
if(vfl->mmap)
return vfl->mmap(vfl, (char *)vma->vm_start,
(unsigned long)(vma->vm_end-vma->vm_start));
@@ -228,8 +211,28 @@ static int video_mmap(struct inode * ino, struct file * file,
extern struct file_operations video_fops;
-/*
- * Video For Linux device drivers request registration here.
+/**
+ * video_register_device - register video4linux devices
+ * @vfd: Video device structure we want to register
+ * @type: type of device to register
+ * FIXME: needs a semaphore on 2.3.x
+ *
+ * The registration code assigns minor numbers based on the type
+ * requested. -ENFILE is returned in all the device slots for this
+ * catetory are full. If not then the minor field is set and the
+ * driver initialize function is called (if non NULL).
+ *
+ * Zero is returned on success.
+ *
+ * Valid types are
+ *
+ * VFL_TYPE_GRABBER - A frame grabber
+ *
+ * VFL_TYPE_VTX - A teletext device
+ *
+ * VFL_TYPE_VBI - Vertical blank data (undecoded)
+ *
+ * VFL_TYPE_RADIO - A radio card
*/
int video_register_device(struct video_device *vfd, int type)
@@ -288,10 +291,14 @@ int video_register_device(struct video_device *vfd, int type)
}
}
sprintf (name, "v4l/%s%d", name_base, i - base);
+ /*
+ * Start the device root only. Anything else
+ * has serious privacy issues.
+ */
vfd->devfs_handle =
devfs_register (NULL, name, 0, DEVFS_FL_DEFAULT,
VIDEO_MAJOR, vfd->minor,
- S_IFCHR | S_IRUGO | S_IWUGO, 0, 0,
+ S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
&video_fops, NULL);
return 0;
}
@@ -299,8 +306,12 @@ int video_register_device(struct video_device *vfd, int type)
return -ENFILE;
}
-/*
- * Unregister an unused video for linux device
+/**
+ * video_unregister_device - unregister a video4linux device
+ * @vfd: the device to unregister
+ *
+ * This unregisters the passed device and deassigns the minor
+ * number. Future open calls will be met with errors.
*/
void video_unregister_device(struct video_device *vfd)
@@ -322,16 +333,14 @@ static struct file_operations video_fops=
mmap: video_mmap,
open: video_open,
release: video_release,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
poll: video_poll,
-#endif
};
/*
* Initialise video for linux
*/
-int videodev_init(void)
+int __init videodev_init(void)
{
struct video_init *vfli = video_init_list;
@@ -365,15 +374,10 @@ void cleanup_module(void)
devfs_unregister_chrdev(VIDEO_MAJOR, "video_capture");
}
-
-
-
-
-
-
#endif
-#if LINUX_VERSION_CODE >= 0x020100
EXPORT_SYMBOL(video_register_device);
EXPORT_SYMBOL(video_unregister_device);
-#endif
+
+MODULE_AUTHOR("Alan Cox");
+MODULE_DESCRIPTION("Device registrar for Video4Linux drivers");