Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Refactor kbd and mouse drivers so that they can use diff...



details:   https://anonhg.NetBSD.org/src/rev/57673f21c3d2
branches:  trunk
changeset: 537619:57673f21c3d2
user:      uwe <uwe%NetBSD.org@localhost>
date:      Thu Oct 03 16:13:24 2002 +0000

description:
Refactor kbd and mouse drivers so that they can use different middle
layers.  Common middle layer shared by kbd_zs and sunkbd is moved into
the new file.  Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).

diffstat:

 sys/arch/sparc/conf/files.sparc     |   72 ++-
 sys/arch/sparc64/conf/files.sparc64 |   19 +-
 sys/arch/sun2/conf/files.sun2       |   17 +-
 sys/arch/sun3/conf/files.sun3       |    3 +-
 sys/dev/sun/fb.c                    |    6 +-
 sys/dev/sun/files.sun               |   58 +-
 sys/dev/sun/kbd.c                   |  915 ++++++++++-------------------------
 sys/dev/sun/kbd_reg.h               |    5 +-
 sys/dev/sun/kbd_xlate.h             |    7 +-
 sys/dev/sun/kbd_zs.c                |   62 +-
 sys/dev/sun/kbdsun.c                |  595 +++++++++++++++++++++++
 sys/dev/sun/kbdsunvar.h             |  106 ++++
 sys/dev/sun/kbdvar.h                |  170 +----
 sys/dev/sun/sunkbd.c                |   50 +-
 sys/dev/sun/sunms.c                 |    6 +-
 15 files changed, 1194 insertions(+), 897 deletions(-)

diffs (truncated from 2770 to 300 lines):

diff -r 1a8c23d7428d -r 57673f21c3d2 sys/arch/sparc/conf/files.sparc
--- a/sys/arch/sparc/conf/files.sparc   Thu Oct 03 15:58:56 2002 +0000
+++ b/sys/arch/sparc/conf/files.sparc   Thu Oct 03 16:13:24 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sparc,v 1.117 2002/09/06 13:18:43 gehenna Exp $
+#      $NetBSD: files.sparc,v 1.118 2002/10/03 16:13:24 uwe Exp $
 
 # @(#)files.sparc      8.1 (Berkeley) 7/19/93
 # sparc-specific configuration info
@@ -127,6 +127,12 @@
 file   arch/sparc/dev/zs.c                     zs needs-count
 file   dev/ic/z8530sc.c                        zs
 
+define zstty {}
+device zstty: tty
+attach zstty at zs
+file dev/ic/z8530tty.c                         zstty needs-flag
+file arch/sparc/dev/zs_kgdb.c                  kgdb
+
 device fdc {}
 attach fdc at mainbus with fdc_mainbus
 attach fdc at obio with fdc_obio
@@ -151,31 +157,51 @@
 include "dev/pcmcia/files.pcmcia"
 include "dev/ata/files.ata"
 
+
 #
-# Console (zs) related stuff
+# Console related stuff
 #
 
-device zstty: tty
-attach zstty at zs
-file dev/ic/z8530tty.c                 zstty needs-flag
-file arch/sparc/dev/zs_kgdb.c          kgdb
+file   arch/sparc/dev/kd.c                             # console
 
-define zsevent
-#file dev/sun/event.c                  zsevent
+attach pckbc at obio with pckbc_obio
+attach pckbc at ebus with pckbc_ebus
+file   arch/sparc/dev/pckbc_js.c       pckbc_obio | pckbc_ebus
 
-device kbd: zsevent
+
+# sun keyboard at a serial port
 attach kbd at zs with kbd_zs
-file dev/sun/kbd_zs.c                  kbd_zs
-file dev/sun/kbd.c                     kbd needs-flag
-file dev/sun/kbd_tables.c              kbd
-file dev/sun/sunkbd.c                  kbd
-file arch/sparc/dev/kd.c
+file dev/sun/kbd_zs.c                  kbd_zs          # kbd lower layer
+
+# sun keyboard at a tty line discipline
+# only used by sparc64, but we can test-compile it here (pretend kbd_zs)
+attach kbd at zstty with kbd_tty
+file   dev/sun/sunkbd.c                kbd_tty         # kbd lower layer
+
+# shared middle layer for serial keyboard
+file   dev/sun/kbdsun.c                kbd_zs | kbd_tty # kbd middle layer
+
+# PC/AT keyboard at 8042 (pckbc) for Mr.Coffee
+attach kbd at pckbc with kbd_pckbc
+file   arch/sparc/dev/kbd_pckbc.c      kbd_pckbc       # kbd mid/lower layers
+
 
-device ms: zsevent
+# sun (mouse systems) mouse at a serial port
 attach ms at zs with ms_zs
-file dev/sun/ms_zs.c                   ms_zs
-file dev/sun/ms.c                      ms needs-flag
-file dev/sun/sunms.c                   ms
+file   dev/sun/ms_zs.c                 ms_zs           # mouse lower layer
+
+# sun (mouse systems) mouse at a tty line discipline
+# only used by sparc64, but we can test-compile it here (pretend ms_zs)
+attach ms at zstty with ms_tty
+file   dev/sun/sunms.c                 ms_tty          # mouse lower layer
+
+# XXX: middle layer for sun (mouse systems) serial mice consists of
+# just one function in dev/sun/ms.c (upper layer).  Split it out?
+
+# PS/2 mouse at 8042 (pckbc) for Mr.Coffee
+attach ms at pckbc with ms_pckbc
+file   arch/sparc/dev/ms_pckbc.c       ms_pckbc        # lower/middle layers
+
 
 #
 # Machine-independent SCSI drivers
@@ -282,11 +308,15 @@
 file   arch/sparc/sparc/db_trace.c     ddb
 file   arch/sparc/sparc/db_disasm.c    ddb
 
+
 #
-# Raster Console
+# Raster Console / WS Console
 #
-include "dev/rcons/files.rcons"
-include "dev/wsfont/files.wsfont"
+include "dev/wscons/files.wscons"      # includes rcons as well
+include "dev/wsfont/files.wsfont"      # both rcons and wscons need it
+
+include "dev/pckbc/files.pckbc"
+
 
 #
 # Compatibility modules
diff -r 1a8c23d7428d -r 57673f21c3d2 sys/arch/sparc64/conf/files.sparc64
--- a/sys/arch/sparc64/conf/files.sparc64       Thu Oct 03 15:58:56 2002 +0000
+++ b/sys/arch/sparc64/conf/files.sparc64       Thu Oct 03 16:13:24 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sparc64,v 1.67 2002/09/29 04:12:02 chs Exp $
+#      $NetBSD: files.sparc64,v 1.68 2002/10/03 16:13:24 uwe Exp $
 
 # @(#)files.sparc64    8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -137,21 +137,18 @@
 attach sabtty at sab
 # file arch/sparc64/dev/sabtty.c       sabtty needs-flag
 
-device kbd
+file arch/sparc64/dev/kd.c             kbd
+
 attach kbd at zs with kbd_zs
-attach kbd at zstty, com
+attach kbd at zstty, com with kbd_tty
 file dev/sun/kbd_zs.c                  kbd_zs
-file dev/sun/kbd.c                     kbd needs-flag
-file dev/sun/kbd_tables.c              kbd
-file arch/sparc64/dev/kd.c             kbd
-file dev/sun/sunkbd.c                  kbd needs-flag
+file dev/sun/sunkbd.c                  kbd_tty
+file dev/sun/kbdsun.c                  kbd_zs | kbd_tty
 
-device ms
 attach ms at zs with ms_zs
-attach ms at zstty, com
+attach ms at zstty, com with ms_tty
 file dev/sun/ms_zs.c                   ms_zs
-file dev/sun/ms.c                      ms needs-flag
-file dev/sun/sunms.c                   ms needs-flag
+file dev/sun/sunms.c                   ms_tty
 
 #
 # Machine-independent SCSI drivers
diff -r 1a8c23d7428d -r 57673f21c3d2 sys/arch/sun2/conf/files.sun2
--- a/sys/arch/sun2/conf/files.sun2     Thu Oct 03 15:58:56 2002 +0000
+++ b/sys/arch/sun2/conf/files.sun2     Thu Oct 03 16:13:24 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sun2,v 1.8 2002/09/06 13:18:43 gehenna Exp $
+#      $NetBSD: files.sun2,v 1.9 2002/10/03 16:13:25 uwe Exp $
 
 #
 # sun2-specific configuration info
@@ -142,17 +142,14 @@
 attach pcons at mainbus
 file   arch/sun2/dev/pcons.c           pcons needs-flag
 
-device kbd
-attach kbd at zstty
-file dev/sun/kbd.c                     kbd needs-flag
-file dev/sun/kbd_tables.c              kbd
 file arch/sun2/dev/kd.c                        kbd
-file dev/sun/sunkbd.c                  kbd needs-flag
 
-device ms
-attach ms at zstty
-file dev/sun/ms.c                      ms needs-flag
-file dev/sun/sunms.c                   ms needs-flag
+attach kbd at zstty with kbd_tty
+file dev/sun/kbdsun.c                  kbd_tty
+file dev/sun/sunkbd.c                  kbd_tty
+
+attach ms at zstty with ms_tty
+file dev/sun/sunms.c                   ms_tty
 
 # Memory Disk for boot tape
 file dev/md_root.c                     memory_disk_hooks
diff -r 1a8c23d7428d -r 57673f21c3d2 sys/arch/sun3/conf/files.sun3
--- a/sys/arch/sun3/conf/files.sun3     Thu Oct 03 15:58:56 2002 +0000
+++ b/sys/arch/sun3/conf/files.sun3     Thu Oct 03 16:13:24 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sun3,v 1.63 2002/09/06 13:18:43 gehenna Exp $
+#      $NetBSD: files.sun3,v 1.64 2002/10/03 16:13:25 uwe Exp $
 
 #
 # sun3-specific configuration info
@@ -240,6 +240,7 @@
 device kbd: zsevent
 attach kbd at zsc with kbd_zs
 file dev/sun/kbd_zs.c                  kbd_zs
+file dev/sun/kbdsun.c                  kbd_zs
 file dev/sun/kbd.c                     kbd needs-flag
 file dev/sun/kbd_tables.c              kbd
 file arch/sun3/dev/kd.c                kbd
diff -r 1a8c23d7428d -r 57673f21c3d2 sys/dev/sun/fb.c
--- a/sys/dev/sun/fb.c  Thu Oct 03 15:58:56 2002 +0000
+++ b/sys/dev/sun/fb.c  Thu Oct 03 16:13:24 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fb.c,v 1.8 2002/09/06 13:18:43 gehenna Exp $ */
+/*     $NetBSD: fb.c,v 1.9 2002/10/03 16:13:25 uwe Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.8 2002/09/06 13:18:43 gehenna Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.9 2002/10/03 16:13:25 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -363,7 +363,7 @@
        int on;
 {
 #if NKBD > 0
-       (void)kbd_docmd(on?KBD_CMD_BELL:KBD_CMD_NOBELL, 0);
+       kbd_bell(on);
 #endif
 }
 
diff -r 1a8c23d7428d -r 57673f21c3d2 sys/dev/sun/files.sun
--- a/sys/dev/sun/files.sun     Thu Oct 03 15:58:56 2002 +0000
+++ b/sys/dev/sun/files.sun     Thu Oct 03 16:13:24 2002 +0000
@@ -1,9 +1,53 @@
-# $NetBSD: files.sun,v 1.4 2000/09/21 23:40:47 eeh Exp $
+# $NetBSD: files.sun,v 1.5 2002/10/03 16:13:25 uwe Exp $
 #
 # Configuration file for devices found on Sun machines.
 #
 
-file   dev/sun/event.c
+
+#
+# Sun keyboard and mouse drivers
+#
+
+define firm_events
+file   dev/sun/event.c                 firm_events
+
+
+# upper layer of sun kbd driver
+# examples for lower and middle layers follows.  cannot move them here
+# because zs/zstty attachments are slightly different on each sun port.
+device kbd: firm_events
+file   dev/sun/kbd.c                   kbd needs-flag
+file   dev/sun/kbd_tables.c            kbd
+
+# e.g. - lower layer: sun keyboard at zs
+#attach kbd at zs with kbd_zs
+#file  dev/sun/kbd_zs.c                kbd_zs
+
+# e.g. - lower layer: sun keyboard at a line discipline
+#attach kbd at zstty, com with kbd_tty
+#file  dev/sun/sunkbd.c                kbd_tty
+
+# e.g. - middle layer: serial attachment of sun keyboard
+#file  dev/sun/kbdsun.c                kbd_zs | kbd_tty
+
+
+# upper layer of sun ms driver
+# XXX: middle layer for sun serial mice (split out?)
+device ms: firm_events
+file   dev/sun/ms.c                    ms needs-flag
+
+# e.g. - lower layer: sun (mouse systems) mouse at zs
+#attach ms at zs with ms_zs
+#file  dev/sun/ms_zs.c                 ms_zs
+
+# e.g. - lower layer: sun (mouse systems) mouse at a line discipline
+#attach ms at zstty, com with ms_tty
+#file  dev/sun/sunms.c                 ms_tty
+
+# XXX: middle layer for sun (mouse systems) serial mice consists of
+# just one function in dev/sun/ms.c.  It probably should be split out
+# for consistency into a separate middle-layer file.
+
 
 
 #
@@ -29,15 +73,7 @@
 file   dev/sun/bwtwo.c                 bwtwo needs-flag
 
 device cgthree: bt_dac, fb, rasops8
-file   dev/sun/cgthree.c       cgthree needs-flag
+file   dev/sun/cgthree.c               cgthree needs-flag
 
 device cgsix: bt_dac, fb, rasops8, pfour
 file   dev/sun/cgsix.c                 cgsix needs-flag
-
-#device sunkbd
-#file  dev/sun/sunkbd.c                sunkbd needs-flag
-#file  dev/sun/kbd.c                   sunkbd
-
-#device sunms
-#file  dev/sun/sunms.c                 sunms needs-flag



Home | Main Index | Thread Index | Old Index