patch-2.1.43 linux/drivers/char/psaux.c

Next file: linux/drivers/char/rtc.c
Previous file: linux/drivers/char/pc_keyb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.42/linux/drivers/char/psaux.c linux/drivers/char/psaux.c
@@ -28,6 +28,8 @@
  *
  * Fixed keyboard lockups at open time
  * 3-Jul-96, 22-Aug-96 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
+ *
+ * Cleanup by Martin Mares, 01-Jun-97 (now uses the new PC kbd include)
  */
 
 /* Uncomment the following line if your mouse needs initialization. */
@@ -54,66 +56,15 @@
 
 #include <linux/config.h>
 
-#define PSMOUSE_MINOR      1            /* minor device # for this mouse */
+#include "pc_keyb.h"
 
-/* aux controller ports */
-#define AUX_INPUT_PORT	0x60		/* Aux device output buffer */
-#define AUX_OUTPUT_PORT	0x60		/* Aux device input buffer */
-#define AUX_COMMAND	0x64		/* Aux device command buffer */
-#define AUX_STATUS	0x64		/* Aux device status reg */
-
-/* aux controller status bits */
-#define AUX_OBUF_FULL	0x21		/* output buffer (from device) full */
-#define AUX_IBUF_FULL	0x02		/* input buffer (to device) full */
-
-/* aux controller commands */
-#define AUX_CMD_WRITE	0x60		/* value to write to controller */
-#define AUX_MAGIC_WRITE	0xd4		/* value to send aux device data */
-
-#define AUX_INTS_ON	0x47		/* enable controller interrupts */
-#define AUX_INTS_OFF	0x65		/* disable controller interrupts */
-
-#define AUX_DISABLE	0xa7		/* disable aux */
-#define AUX_ENABLE	0xa8		/* enable aux */
-
-/* aux device commands */
-#define AUX_SET_RES	0xe8		/* set resolution */
-#define AUX_SET_SCALE11	0xe6		/* set 1:1 scaling */
-#define AUX_SET_SCALE21	0xe7		/* set 2:1 scaling */
-#define AUX_GET_SCALE	0xe9		/* get scaling factor */
-#define AUX_SET_STREAM	0xea		/* set stream mode */
-#define AUX_SET_SAMPLE	0xf3		/* set sample rate */
-#define AUX_ENABLE_DEV	0xf4		/* enable aux device */
-#define AUX_DISABLE_DEV	0xf5		/* disable aux device */
-#define AUX_RESET	0xff		/* reset aux device */
+/*
+ *	Generic declarations for both PS2 and 82C710
+ */
 
-#define MAX_RETRIES	60		/* some aux operations take long time*/
-#if defined(__alpha__) && !defined(CONFIG_PCI)
-# define AUX_IRQ	9		/* Jensen is odd indeed */
-#else
-# define AUX_IRQ	12
-#endif
+#define PSMOUSE_MINOR      1	       		/* Minor device # for this mouse */
 #define AUX_BUF_SIZE	2048
 
-/* 82C710 definitions */
-
-#define QP_DATA         0x310		/* Data Port I/O Address */
-#define QP_STATUS       0x311		/* Status Port I/O Address */
-
-#define QP_DEV_IDLE     0x01		/* Device Idle */
-#define QP_RX_FULL      0x02		/* Device Char received */
-#define QP_TX_IDLE      0x04		/* Device XMIT Idle */
-#define QP_RESET        0x08		/* Device Reset */
-#define QP_INTS_ON      0x10		/* Device Interrupt On */
-#define QP_ERROR_FLAG   0x20		/* Device Error */
-#define QP_CLEAR        0x40		/* Device Clear */
-#define QP_ENABLE       0x80		/* Device Enable */
-
-#define QP_IRQ          12
-
-extern unsigned char aux_device_present;
-extern unsigned char kbd_read_mask;	/* from keyboard.c */
-
 struct aux_queue {
 	unsigned long head;
 	unsigned long tail;
@@ -126,20 +77,84 @@
 static int aux_ready = 0;
 static int aux_count = 0;
 static int aux_present = 0;
-static int poll_aux_status(void);
-static int poll_aux_status_nosleep(void);
-static int fasync_aux(struct inode *inode, struct file *filp, int on);
 
-#ifdef CONFIG_82C710_MOUSE
-static int qp_present = 0;
-static int qp_count = 0;
-static int qp_data = QP_DATA;
-static int qp_status = QP_STATUS;
+/*
+ *	Shared subroutines
+ */
 
-static int poll_qp_status(void);
-static int probe_qp(void);
+static unsigned int get_from_queue(void)
+{
+	unsigned int result;
+	unsigned long flags;
+
+	save_flags(flags);
+	cli();
+	result = queue->buf[queue->tail];
+	queue->tail = (queue->tail + 1) & (AUX_BUF_SIZE-1);
+	restore_flags(flags);
+	return result;
+}
+
+
+static inline int queue_empty(void)
+{
+	return queue->head == queue->tail;
+}
+
+static int fasync_aux(struct inode *inode, struct file *filp, int on)
+{
+	int retval;
+
+	retval = fasync_helper(inode, filp, on, &queue->fasync);
+	if (retval < 0)
+		return retval;
+	return 0;
+}
+
+/*
+ *	PS/2 Aux Device
+ */
+
+#define AUX_INTS_OFF (KBD_MODE_KCC | KBD_MODE_DISABLE_MOUSE | KBD_MODE_SYS | KBD_MODE_KBD_INT)
+#define AUX_INTS_ON  (KBD_MODE_KCC | KBD_MODE_SYS | KBD_MODE_MOUSE_INT | KBD_MODE_KBD_INT)
+
+#define MAX_RETRIES	60		/* some aux operations take long time*/
+#if defined(__alpha__) && !defined(CONFIG_PCI)
+# define AUX_IRQ	9		/* Jensen is odd indeed */
+#else
+# define AUX_IRQ	12
 #endif
 
+/*
+ *	Status polling
+ */
+
+static int poll_aux_status(void)
+{
+	int retries=0;
+
+	while ((inb(KBD_STATUS_REG) & (KBD_STAT_IBF | KBD_STAT_OBF)) && retries < MAX_RETRIES) {
+ 		if ((inb_p(KBD_STATUS_REG) & AUX_STAT_OBF) == AUX_STAT_OBF)
+			inb_p(KBD_DATA_REG);
+		current->state = TASK_INTERRUPTIBLE;
+		current->timeout = jiffies + (5*HZ + 99) / 100;
+		schedule();
+		retries++;
+	}
+	return !(retries==MAX_RETRIES);
+}
+
+static int poll_aux_status_nosleep(void)
+{
+	int retries = 0;
+
+	while ((inb(KBD_STATUS_REG) & (KBD_STAT_IBF | KBD_STAT_OBF)) && retries < 1000000) {
+ 		if ((inb_p(KBD_STATUS_REG) & AUX_STAT_OBF) == AUX_STAT_OBF)
+			inb_p(KBD_DATA_REG);
+		retries++;
+	}
+	return !(retries == 1000000);
+}
 
 /*
  * Write to aux device
@@ -148,28 +163,32 @@
 static void aux_write_dev(int val)
 {
 	poll_aux_status();
-	outb_p(AUX_MAGIC_WRITE,AUX_COMMAND);	/* write magic cookie */
+	outb_p(KBD_CCMD_WRITE_MOUSE, KBD_CNTL_REG);	    /* Write magic cookie */
 	poll_aux_status();
-	outb_p(val,AUX_OUTPUT_PORT);		/* write data */
+	outb_p(val, KBD_DATA_REG);			    /* Write data */
+}
+
+__initfunc(static void aux_write_dev_nosleep(int val))
+{
+	poll_aux_status_nosleep();
+	outb_p(KBD_CCMD_WRITE_MOUSE, KBD_CNTL_REG);
+	poll_aux_status_nosleep();
+	outb_p(val, KBD_DATA_REG);
 }
 
 /*
  * Write to device & handle returned ack
  */
-#if defined INITIALIZE_DEVICE
-static int aux_write_ack(int val)
-{
-	int retries = 0;
 
-	poll_aux_status_nosleep();
-	outb_p(AUX_MAGIC_WRITE,AUX_COMMAND);
-	poll_aux_status_nosleep();
-	outb_p(val,AUX_OUTPUT_PORT);
+#ifdef INITIALIZE_DEVICE
+__initfunc(static int aux_write_ack(int val))
+{
+	aux_write_dev_nosleep(val);
 	poll_aux_status_nosleep();
 
-	if ((inb(AUX_STATUS) & AUX_OBUF_FULL) == AUX_OBUF_FULL)
+	if ((inb(KBD_STATUS_REG) & AUX_STAT_OBF) == AUX_STAT_OBF)
 	{
-		return (inb(AUX_INPUT_PORT));
+		return (inb(KBD_DATA_REG));
 	}
 	return 0;
 }
@@ -182,33 +201,11 @@
 static void aux_write_cmd(int val)
 {
 	poll_aux_status();
-	outb_p(AUX_CMD_WRITE,AUX_COMMAND);
+	outb_p(KBD_CCMD_WRITE_MODE, KBD_CNTL_REG);
 	poll_aux_status();
-	outb_p(val,AUX_OUTPUT_PORT);
-}
-
-
-static unsigned int get_from_queue(void)
-{
-	unsigned int result;
-	unsigned long flags;
-
-	save_flags(flags);
-	cli();
-	result = queue->buf[queue->tail];
-	queue->tail = (queue->tail + 1) & (AUX_BUF_SIZE-1);
-	restore_flags(flags);
-	return result;
+	outb_p(val, KBD_DATA_REG);
 }
 
-
-static inline int queue_empty(void)
-{
-	return queue->head == queue->tail;
-}
-
-
-
 /*
  * Interrupt from the auxiliary device: a character
  * is waiting in the keyboard/aux controller.
@@ -219,10 +216,10 @@
 	int head = queue->head;
 	int maxhead = (queue->tail-1) & (AUX_BUF_SIZE-1);
 
-	if ((inb(AUX_STATUS) & AUX_OBUF_FULL) != AUX_OBUF_FULL)
+	if ((inb(KBD_STATUS_REG) & AUX_STAT_OBF) != AUX_STAT_OBF)
 		return;
 
-	add_mouse_randomness(queue->buf[head] = inb(AUX_INPUT_PORT));
+	add_mouse_randomness(queue->buf[head] = inb(KBD_DATA_REG));
 	if (head != maxhead) {
 		head++;
 		head &= AUX_BUF_SIZE-1;
@@ -234,31 +231,6 @@
 	wake_up_interruptible(&queue->proc_list);
 }
 
-/*
- * Interrupt handler for the 82C710 mouse port. A character
- * is waiting in the 82C710.
- */
-
-#ifdef CONFIG_82C710_MOUSE
-static void qp_interrupt(int cpl, void *dev_id, struct pt_regs * regs)
-{
-	int head = queue->head;
-	int maxhead = (queue->tail-1) & (AUX_BUF_SIZE-1);
-
-	add_mouse_randomness(queue->buf[head] = inb(qp_data));
-	if (head != maxhead) {
-		head++;
-		head &= AUX_BUF_SIZE-1;
-	}
-	queue->head = head;
-	aux_ready = 1;
-	if (queue->fasync)
-		kill_fasync(queue->fasync, SIGIO);
-	wake_up_interruptible(&queue->proc_list);
-}
-#endif
-
-
 static int release_aux(struct inode * inode, struct file * file)
 {
 	fasync_aux(inode, file, 0);
@@ -266,9 +238,9 @@
 		return 0;
 	/* disable kbd bh to avoid mixing of cmd bytes */
 	disable_bh(KEYBOARD_BH);
-	aux_write_cmd(AUX_INTS_OFF);		/* disable controller ints */
+	aux_write_cmd(AUX_INTS_OFF);			    /* Disable controller ints */
 	poll_aux_status();
-	outb_p(AUX_DISABLE,AUX_COMMAND);      	/* Disable Aux device */
+	outb_p(KBD_CCMD_MOUSE_DISABLE, KBD_CNTL_REG);	    /* Disable Aux device */
 	poll_aux_status();
 	/* reenable kbd bh */
 	enable_bh(KEYBOARD_BH);
@@ -281,36 +253,6 @@
 	return 0;
 }
 
-#ifdef CONFIG_82C710_MOUSE
-static int release_qp(struct inode * inode, struct file * file)
-{
-	unsigned char status;
-
-	fasync_aux(inode, file, 0);
-	if (!--qp_count) {
-		if (!poll_qp_status())
-			printk("Warning: Mouse device busy in release_qp()\n");
-		status = inb_p(qp_status);
-		outb_p(status & ~(QP_ENABLE|QP_INTS_ON), qp_status);
-		if (!poll_qp_status())
-			printk("Warning: Mouse device busy in release_qp()\n");
-		free_irq(QP_IRQ, NULL);
-		MOD_DEC_USE_COUNT;
-	}
-	return 0;
-}
-#endif
-
-static int fasync_aux(struct inode *inode, struct file *filp, int on)
-{
-	int retval;
-
-	retval = fasync_helper(inode, filp, on, &queue->fasync);
-	if (retval < 0)
-		return retval;
-	return 0;
-}
-
 /*
  * Install interrupt handler.
  * Enable auxiliary device.
@@ -339,9 +281,9 @@
 	/* disable kbd bh to avoid mixing of cmd bytes */
 	disable_bh(KEYBOARD_BH);
 	poll_aux_status();
-	outb_p(AUX_ENABLE,AUX_COMMAND);		/* Enable Aux */
-	aux_write_dev(AUX_ENABLE_DEV);		/* enable aux device */
-	aux_write_cmd(AUX_INTS_ON);		/* enable controller ints */
+	outb_p(KBD_CCMD_MOUSE_ENABLE, KBD_CNTL_REG);	    /* Enable Aux */
+	aux_write_dev(AUX_ENABLE_DEV);			    /* Enable aux device */
+	aux_write_cmd(AUX_INTS_ON);			    /* Enable controller ints */
 	poll_aux_status();
 	/* reenable kbd bh */
 	enable_bh(KEYBOARD_BH);
@@ -350,7 +292,112 @@
 	return 0;
 }
 
+/*
+ * Write to the aux device.
+ */
+
+static long write_aux(struct inode * inode, struct file * file,
+	const char * buffer, unsigned long count)
+{
+	int retval = 0;
+
+	if (count) {
+		int written = 0;
+
+		/* disable kbd bh to avoid mixing of cmd bytes */
+		disable_bh(KEYBOARD_BH);
+
+		do {
+			char c;
+			if (!poll_aux_status())
+				break;
+			outb_p(KBD_CCMD_WRITE_MOUSE, KBD_CNTL_REG);
+			if (!poll_aux_status())
+				break;
+			get_user(c, buffer++);
+			outb_p(c, KBD_DATA_REG);
+			written++;
+		} while (--count);
+		/* reenable kbd bh */
+		enable_bh(KEYBOARD_BH);
+		retval = -EIO;
+		if (written) {
+			retval = written;
+			inode->i_mtime = CURRENT_TIME;
+		}
+	}
+
+	return retval;
+}
+
+/*
+ *	82C710 Interface
+ */
+
 #ifdef CONFIG_82C710_MOUSE
+
+#define QP_DATA         0x310		/* Data Port I/O Address */
+#define QP_STATUS       0x311		/* Status Port I/O Address */
+
+#define QP_DEV_IDLE     0x01		/* Device Idle */
+#define QP_RX_FULL      0x02		/* Device Char received */
+#define QP_TX_IDLE      0x04		/* Device XMIT Idle */
+#define QP_RESET        0x08		/* Device Reset */
+#define QP_INTS_ON      0x10		/* Device Interrupt On */
+#define QP_ERROR_FLAG   0x20		/* Device Error */
+#define QP_CLEAR        0x40		/* Device Clear */
+#define QP_ENABLE       0x80		/* Device Enable */
+
+#define QP_IRQ          12
+
+static int qp_present = 0;
+static int qp_count = 0;
+static int qp_data = QP_DATA;
+static int qp_status = QP_STATUS;
+
+static int poll_qp_status(void);
+static int probe_qp(void);
+
+/*
+ * Interrupt handler for the 82C710 mouse port. A character
+ * is waiting in the 82C710.
+ */
+
+static void qp_interrupt(int cpl, void *dev_id, struct pt_regs * regs)
+{
+	int head = queue->head;
+	int maxhead = (queue->tail-1) & (AUX_BUF_SIZE-1);
+
+	add_mouse_randomness(queue->buf[head] = inb(qp_data));
+	if (head != maxhead) {
+		head++;
+		head &= AUX_BUF_SIZE-1;
+	}
+	queue->head = head;
+	aux_ready = 1;
+	if (queue->fasync)
+		kill_fasync(queue->fasync, SIGIO);
+	wake_up_interruptible(&queue->proc_list);
+}
+
+static int release_qp(struct inode * inode, struct file * file)
+{
+	unsigned char status;
+
+	fasync_aux(inode, file, 0);
+	if (!--qp_count) {
+		if (!poll_qp_status())
+			printk("Warning: Mouse device busy in release_qp()\n");
+		status = inb_p(qp_status);
+		outb_p(status & ~(QP_ENABLE|QP_INTS_ON), qp_status);
+		if (!poll_qp_status())
+			printk("Warning: Mouse device busy in release_qp()\n");
+		free_irq(QP_IRQ, NULL);
+		MOD_DEC_USE_COUNT;
+	}
+	return 0;
+}
+
 /*
  * Install interrupt handler.
  * Enable the device, enable interrupts. 
@@ -394,48 +441,7 @@
 	MOD_INC_USE_COUNT;
 	return 0;
 }
-#endif
-
-/*
- * Write to the aux device.
- */
-
-static long write_aux(struct inode * inode, struct file * file,
-	const char * buffer, unsigned long count)
-{
-	int retval = 0;
-
-	if (count) {
-		int written = 0;
-
-		/* disable kbd bh to avoid mixing of cmd bytes */
-		disable_bh(KEYBOARD_BH);
-
-		do {
-			char c;
-			if (!poll_aux_status())
-				break;
-			outb_p(AUX_MAGIC_WRITE,AUX_COMMAND);
-			if (!poll_aux_status())
-				break;
-			get_user(c, buffer++);
-			outb_p(c, AUX_OUTPUT_PORT);
-			written++;
-		} while (--count);
-		/* reenable kbd bh */
-		enable_bh(KEYBOARD_BH);
-		retval = -EIO;
-		if (written) {
-			retval = written;
-			inode->i_mtime = CURRENT_TIME;
-		}
-	}
-
-	return retval;
-}
-
 
-#ifdef CONFIG_82C710_MOUSE
 /*
  * Write to the 82C710 mouse device.
  */
@@ -455,8 +461,64 @@
 	inode->i_mtime = CURRENT_TIME;
 	return count;
 }
+
+/*
+ * Wait for device to send output char and flush any input char.
+ */
+
+static int poll_qp_status(void)
+{
+	int retries=0;
+
+	while ((inb(qp_status)&(QP_RX_FULL|QP_TX_IDLE|QP_DEV_IDLE))
+		       != (QP_DEV_IDLE|QP_TX_IDLE)
+		       && retries < MAX_RETRIES) {
+
+		if (inb_p(qp_status)&(QP_RX_FULL))
+			inb_p(qp_data);
+		current->state = TASK_INTERRUPTIBLE;
+		current->timeout = jiffies + (5*HZ + 99) / 100;
+		schedule();
+		retries++;
+	}
+	return !(retries==MAX_RETRIES);
+}
+
+/*
+ * Function to read register in 82C710.
+ */
+
+static inline unsigned char read_710(unsigned char index)
+{
+	outb_p(index, 0x390);			/* Write index */
+	return inb_p(0x391);			/* Read the data */
+}
+
+/*
+ * See if we can find a 82C710 device. Read mouse address.
+ */
+
+__initfunc(static int probe_qp(void))
+{
+	outb_p(0x55, 0x2fa);			/* Any value except 9, ff or 36 */
+	outb_p(0xaa, 0x3fa);			/* Inverse of 55 */
+	outb_p(0x36, 0x3fa);			/* Address the chip */
+	outb_p(0xe4, 0x3fa);			/* 390/4; 390 = config address */
+	outb_p(0x1b, 0x2fa);			/* Inverse of e4 */
+	if (read_710(0x0f) != 0xe4)		/* Config address found? */
+	  return 0;				/* No: no 82C710 here */
+	qp_data = read_710(0x0d)*4;		/* Get mouse I/O address */
+	qp_status = qp_data+1;
+	outb_p(0x0f, 0x390);
+	outb_p(0x0f, 0x391);			/* Close config mode */
+	return 1;
+}
+
 #endif
 
+/*
+ *	Generic part continues...
+ */
 
 /*
  * Put bytes from input queue to buffer.
@@ -497,7 +559,6 @@
 	return 0;
 }
 
-
 static unsigned int aux_poll(struct file *file, poll_table * wait)
 {
 	poll_wait(&queue->proc_list, wait);
@@ -506,7 +567,6 @@
 	return 0;
 }
 
-
 struct file_operations psaux_fops = {
 	NULL,		/* seek */
 	read_aux,
@@ -521,7 +581,6 @@
 	fasync_aux,
 };
 
-
 /*
  * Initialize driver. First check for a 82C710 chip; if found
  * forget about the Aux port and use the *_qp functions.
@@ -548,7 +607,7 @@
 		printk(KERN_INFO "PS/2 auxiliary pointing device detected -- driver installed.\n");
 	 	aux_present = 1;
 #ifdef CONFIG_VT
-		kbd_read_mask = AUX_OBUF_FULL;
+		kbd_read_mask = AUX_STAT_OBF;
 #endif
 	} else {
 		return -EIO;
@@ -559,8 +618,8 @@
 	queue->head = queue->tail = 0;
 	queue->proc_list = NULL;
 	if (!qp_found) {
-#if defined INITIALIZE_DEVICE
-		outb_p(AUX_ENABLE,AUX_COMMAND);		/* Enable Aux */
+#ifdef INITIALIZE_DEVICE
+		outb_p(KBD_CCMD_MOUSE_ENABLE, KBD_CNTL_REG); /* Enable Aux */
 		aux_write_ack(AUX_SET_SAMPLE);
 		aux_write_ack(100);			/* 100 samples/sec */
 		aux_write_ack(AUX_SET_RES);
@@ -568,11 +627,8 @@
 		aux_write_ack(AUX_SET_SCALE21);		/* 2:1 scaling */
 		poll_aux_status_nosleep();
 #endif /* INITIALIZE_DEVICE */
-		outb_p(AUX_DISABLE,AUX_COMMAND);   /* Disable Aux device */
-		poll_aux_status_nosleep();
-		outb_p(AUX_CMD_WRITE,AUX_COMMAND);
-		poll_aux_status_nosleep();             /* Disable interrupts */
-		outb_p(AUX_INTS_OFF, AUX_OUTPUT_PORT); /*  on the controller */
+		outb_p(KBD_CCMD_MOUSE_DISABLE, KBD_CNTL_REG); /* Disable Aux device */
+		aux_write_dev_nosleep(AUX_INTS_OFF);	    /* Disable controller interrupts */
 	}
 	return 0;
 }
@@ -580,93 +636,12 @@
 #ifdef MODULE
 int init_module(void)
 {
-	return psaux_init(); /*?? Bjorn */
+	return psaux_init();
 }
 
 void cleanup_module(void)
 {
 	misc_deregister(&psaux_mouse);
 	kfree(queue);
-}
-#endif
-
-static int poll_aux_status(void)
-{
-	int retries=0;
-
-	while ((inb(AUX_STATUS)&0x03) && retries < MAX_RETRIES) {
- 		if ((inb_p(AUX_STATUS) & AUX_OBUF_FULL) == AUX_OBUF_FULL)
-			inb_p(AUX_INPUT_PORT);
-		current->state = TASK_INTERRUPTIBLE;
-		current->timeout = jiffies + (5*HZ + 99) / 100;
-		schedule();
-		retries++;
-	}
-	return !(retries==MAX_RETRIES);
-}
-
-static int poll_aux_status_nosleep(void)
-{
-	int retries = 0;
-
-	while ((inb(AUX_STATUS)&0x03) && retries < 1000000) {
- 		if ((inb_p(AUX_STATUS) & AUX_OBUF_FULL) == AUX_OBUF_FULL)
-			inb_p(AUX_INPUT_PORT);
-		retries++;
-	}
-	return !(retries == 1000000);
-}
-
-#ifdef CONFIG_82C710_MOUSE
-/*
- * Wait for device to send output char and flush any input char.
- */
-
-static int poll_qp_status(void)
-{
-	int retries=0;
-
-	while ((inb(qp_status)&(QP_RX_FULL|QP_TX_IDLE|QP_DEV_IDLE))
-		       != (QP_DEV_IDLE|QP_TX_IDLE)
-		       && retries < MAX_RETRIES) {
-
-		if (inb_p(qp_status)&(QP_RX_FULL))
-			inb_p(qp_data);
-		current->state = TASK_INTERRUPTIBLE;
-		current->timeout = jiffies + (5*HZ + 99) / 100;
-		schedule();
-		retries++;
-	}
-	return !(retries==MAX_RETRIES);
-}
-
-/*
- * Function to read register in 82C710.
- */
-
-static inline unsigned char read_710(unsigned char index)
-{
-	outb_p(index, 0x390);			/* Write index */
-	return inb_p(0x391);			/* Read the data */
-}
-
-/*
- * See if we can find a 82C710 device. Read mouse address.
- */
-
-__initfunc(static int probe_qp(void))
-{
-	outb_p(0x55, 0x2fa);			/* Any value except 9, ff or 36 */
-	outb_p(0xaa, 0x3fa);			/* Inverse of 55 */
-	outb_p(0x36, 0x3fa);			/* Address the chip */
-	outb_p(0xe4, 0x3fa);			/* 390/4; 390 = config address */
-	outb_p(0x1b, 0x2fa);			/* Inverse of e4 */
-	if (read_710(0x0f) != 0xe4)		/* Config address found? */
-	  return 0;				/* No: no 82C710 here */
-	qp_data = read_710(0x0d)*4;		/* Get mouse I/O address */
-	qp_status = qp_data+1;
-	outb_p(0x0f, 0x390);
-	outb_p(0x0f, 0x391);			/* Close config mode */
-	return 1;
 }
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov