patch-2.1.51 linux/include/asm-mips/keyboard.h

Next file: linux/include/asm-mips/ng1.h
Previous file: linux/include/asm-mips/jazzdma.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.50/linux/include/asm-mips/keyboard.h linux/include/asm-mips/keyboard.h
@@ -5,9 +5,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * This file is a mess.  Put on your peril sensitive glasses.
- *
- * $Id: keyboard.h,v 1.4 1997/06/16 00:31:46 ralf Exp $
+ * $Id: keyboard.h,v 1.5 1997/08/08 20:22:31 miguel Exp $
  */
 #ifndef __ASM_MIPS_KEYBOARD_H
 #define __ASM_MIPS_KEYBOARD_H
@@ -17,6 +15,7 @@
 #include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
+#include <asm/bootinfo.h>
 
 extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
 extern int pckbd_getkeycode(unsigned int scancode);
@@ -26,6 +25,7 @@
 extern char pckbd_unexpected_up(unsigned char keycode);
 extern void pckbd_leds(unsigned char leds);
 extern void pckbd_init_hw(void);
+extern unsigned char pckbd_sysrq_xlate[128];
 
 #define kbd_setkeycode		pckbd_setkeycode
 #define kbd_getkeycode		pckbd_getkeycode
@@ -34,204 +34,76 @@
 #define kbd_unexpected_up	pckbd_unexpected_up
 #define kbd_leds		pckbd_leds
 #define kbd_init_hw		pckbd_init_hw
+#define kbd_sysrq_xlate         pckbd_sysrq_xlate
 
-/*
- * The default IO slowdown is doing 'inb()'s from 0x61, which should be
- * safe. But as that is the keyboard controller chip address, we do our
- * slowdowns here by doing short jumps: the keyboard controller should
- * be able to keep up
- */
-#define REALLY_SLOW_IO
-#define SLOW_IO_BY_JUMPING
-#include <asm/io.h>
-
-/*
- * keyboard controller registers
- */
-#define KBD_STATUS_REG      (unsigned int) 0x64
-#define KBD_CNTL_REG        (unsigned int) 0x64
-#define KBD_DATA_REG        (unsigned int) 0x60
+#define SYSRQ_KEY 0x54
 
-#ifdef CONFIG_SGI
-#include <asm/segment.h>
-#include <asm/sgihpc.h>
-#endif
-#include <asm/bootinfo.h>
-#include <asm/jazz.h>
-
-#ifdef CONFIG_SGI
-#define KEYBOARD_IRQ 20
-#else
-/* Not true for Jazz machines, we cheat a bit for 'em. */
-#define KEYBOARD_IRQ 1
-#endif
+#define INIT_KBD	/* full initialization for the keyboard controller. */
 
-#ifdef CONFIG_SGI
-#define DISABLE_KBD_DURING_INTERRUPTS 1
-#else
-#define DISABLE_KBD_DURING_INTERRUPTS 0
-#endif
+/* Some stoneage hardware needs delays after some operations.  */
+#define kbd_pause() do { } while(0)
 
-#ifndef CONFIG_SGI
-#define KBD_REPORT_ERR
-#endif
-#define KBD_REPORT_UNKN
-/* #define KBD_IS_FOCUS_9000 */
+/* Pointers to keyboard hardware access and init functions.  */
+unsigned char (*kbd_read_input)(void);
+void (*kbd_write_output)(unsigned char val);
+void (*kbd_write_command)(unsigned char val);
+unsigned char (*kbd_read_status)(void);
 
-int (*kbd_inb_p)(unsigned short port);
-int (*kbd_inb)(unsigned short port);
-void (*kbd_outb_p)(unsigned char data, unsigned short port);
-void (*kbd_outb)(unsigned char data, unsigned short port);
+void (*keyboard_setup)(void);
 
 #ifdef CONFIG_MIPS_JAZZ
-#define INIT_KBD	/* full initialization for the keyboard controller. */
 
-static volatile keyboard_hardware *jazz_kh;
+/* Not true for Jazz machines, we cheat a bit for 'em. */
+#define KEYBOARD_IRQ 1
+
+/*
+ * No PS/2 style mouse support for Jazz machines
+ */
 
-static int
-jazz_kbd_inb_p(unsigned short port)
-{
-	int result;
-
-	if(port == KBD_DATA_REG)
-		result = jazz_kh->data;
-	else /* Must be KBD_STATUS_REG */
-		result = jazz_kh->command;
-	inb(0x80);
-
-	return result;
-}
-
-static int
-jazz_kbd_inb(unsigned short port)
-{
-	int result;
-
-	if(port == KBD_DATA_REG)
-		result = jazz_kh->data;
-	else /* Must be KBD_STATUS_REG */
-		result = jazz_kh->command;
-
-	return result;
-}
-
-static void
-jazz_kbd_outb_p(unsigned char data, unsigned short port)
-{
-	if(port == KBD_DATA_REG)
-		jazz_kh->data = data;
-	else if(port == KBD_CNTL_REG)
-		jazz_kh->command = data;
-	inb(0x80);
-}
-
-static void
-jazz_kbd_outb(unsigned char data, unsigned short port)
-{
-	if(port == KBD_DATA_REG)
-		jazz_kh->data = data;
-	else if(port == KBD_CNTL_REG)
-		jazz_kh->command = data;
-}
 #endif /* CONFIG_MIPS_JAZZ */
 
 #ifdef CONFIG_SGI
-#define INIT_KBD	/* full initialization for the keyboard controller. */
 
-static volatile struct hpc_keyb *sgi_kh;
+#define DISABLE_KBD_DURING_INTERRUPTS 1
+
+#define KEYBOARD_IRQ 20
+
+/*
+ * Machine specific bits for the PS/2 driver.
+ * Aux device and keyboard share the interrupt on the Indy.
+ */
+
+#define ps2_request_irq() 0
+#define ps2_free_irq(void) do { } while(0);
 
-static int
-sgi_kbd_inb(unsigned short port)
-{
-	int result;
-
-	if(port == KBD_DATA_REG)
-		result = sgi_kh->data;
-	else /* Must be KBD_STATUS_REG */
-		result = sgi_kh->command;
-
-	return result;
-}
-
-static void
-sgi_kbd_outb(unsigned char data, unsigned short port)
-{
-	if(port == KBD_DATA_REG)
-		sgi_kh->data = data;
-	else if(port == KBD_CNTL_REG)
-		sgi_kh->command = data;
-}
 #endif /* CONFIG_SGI */
 
+#if defined(CONFIG_ACER_PICA_61) || defined(CONFIG_SNI_RM200_PCI) \
+    || defined(CONFIG_DESKSTATION_RPC44) || defined(CONFIG_DESKSTATION_TYNE)
+#define CONF_KEYBOARD_USES_IO_PORTS
+#endif
+
+#ifdef CONF_KEYBOARD_USES_IO_PORTS
 /*
  * Most other MIPS machines access the keyboard controller via
- * ordinary I/O ports.
+ * memory mapped I/O ports.
  */
-static int
-port_kbd_inb_p(unsigned short port)
-{
-	return inb_p(port);
-}
-
-static int
-port_kbd_inb(unsigned short port)
-{
-	return inb(port);
-}
-
-static void
-port_kbd_outb_p(unsigned char data, unsigned short port)
-{
-	return outb_p(data, port);
-}
-
-static void
-port_kbd_outb(unsigned char data, unsigned short port)
-{
-	return outb(data, port);
-}
+#include <asm/io.h>
 
-extern __inline__ void keyboard_setup(void)
-{
-#ifdef CONFIG_MIPS_JAZZ
-        if (mips_machgroup == MACH_GROUP_JAZZ) {
-		jazz_kh = (void *) JAZZ_KEYBOARD_ADDRESS;
-		kbd_inb_p = jazz_kbd_inb_p;
-		kbd_inb = jazz_kbd_inb;
-		kbd_outb_p = jazz_kbd_outb_p;
-		kbd_outb = jazz_kbd_outb;
-		/*
-		 * Enable keyboard interrupts.
-		 */
-		*((volatile u16 *)JAZZ_IO_IRQ_ENABLE) |= JAZZ_IE_KEYBOARD;
-		set_cp0_status(IE_IRQ1, IE_IRQ1);
-	} else
-#endif
-	if (mips_machgroup == MACH_GROUP_ARC ||	/* this is for Deskstation */
-	    (mips_machgroup == MACH_GROUP_SNI_RM
-	     && mips_machtype == MACH_SNI_RM200_PCI)) {
-		/*
-		 * These machines address their keyboard via the normal
-		 * port address range.
-		 *
-		 * Also enable Scan Mode 2.
-		 */
-		kbd_inb_p = port_kbd_inb_p;
-		kbd_inb = port_kbd_inb;
-		kbd_outb_p = port_kbd_outb_p;
-		kbd_outb = port_kbd_outb;
-		request_region(0x60,16,"keyboard");
-	}
-#ifdef CONFIG_SGI
-	if (mips_machgroup == MACH_GROUP_SGI) {
-		sgi_kh = (struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64);
-		kbd_inb_p = sgi_kbd_inb;
-		kbd_inb = sgi_kbd_inb;
-		kbd_outb_p = sgi_kbd_outb;
-		kbd_outb = sgi_kbd_outb;
-	}
-#endif
-}
+#define KEYBOARD_IRQ 1
+
+/*
+ * Machine specific bits for the PS/2 driver
+ */
+
+#define AUX_IRQ 12
+
+#define ps2_request_irq()						\
+	request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
+
+#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
+
+#endif /* CONF_KEYBOARD_USES_IO_PORTS */
 
 #endif /* __KERNEL */
 #endif /* __ASM_MIPS_KEYBOARD_H */

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