Source-Changes-HG archive

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

[src/netbsd-6]: src/sys Pull up following revision(s) (requested by tsutsui i...



details:   https://anonhg.NetBSD.org/src/rev/cbe91e5478ef
branches:  netbsd-6
changeset: 776624:cbe91e5478ef
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed May 21 20:56:36 2014 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1058):
        sys/arch/hp300/conf/files.hp300: revision 1.88
        sys/arch/hp300/include/autoconf.h: revision 1.13
        sys/dev/ic/sti.c: revision 1.17
        sys/arch/hp300/dev/frodo.c: revision 1.31
        sys/arch/hp300/conf/GENERIC: revision 1.173
        sys/arch/hp300/hp300/machdep.c: revision 1.229
        sys/arch/hp300/dev/frodo.c: revision 1.32
        sys/arch/hp300/hp300/autoconf.c: revision 1.102
        sys/arch/hp300/dev/frodoreg.h: revision 1.5
        sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
        sys/arch/hp300/stand/common/itevar.h: revision 1.16
        sys/arch/hp300/hp300/autoconf.c: revision 1.105
        sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
        sys/arch/hp300/stand/common/apci.c: revision 1.12
        sys/arch/hp300/stand/common/apci.c: revision 1.13
        sys/arch/hp300/dev/dnkbd.c: revision 1.6
        sys/arch/hp300/dev/dnkbd.c: revision 1.7
        sys/arch/hp300/stand/inst/version: revision 1.12
        sys/arch/hp300/dev/com_frodo.c: revision 1.9
        sys/arch/hp300/stand/common/ite.c: revision 1.17
        sys/arch/hp300/conf/GENERIC: revision 1.181
        sys/arch/hp300/dev/sti_sgc.c: revision 1.1
        sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
        sys/arch/hp300/dev/sti_sgc.c: revision 1.2
        sys/dev/ic/stivar.h: revision 1.8
        sys/arch/hp300/dev/rtc.c: revision 1.21
        sys/arch/hp300/conf/INSTALL: revision 1.56
        sys/arch/hp300/conf/INSTALL: revision 1.58
        sys/arch/hp300/stand/uboot/version: revision 1.19
        sys/arch/hp300/stand/common/samachdep.h: revision 1.17
        sys/arch/hp300/stand/common/clock.c: revision 1.12
        sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
        sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
        sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2.  Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support.  From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300.  See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
     to copy and call ROM functions on the executable memory region, so
     it can be called before UVM and related initializations are complete.
     Probably it's time to consider about MI "deferred consinit()" API
     in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat.  Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)

diffstat:

 sys/arch/hp300/conf/GENERIC             |   13 +-
 sys/arch/hp300/conf/INSTALL             |   10 +-
 sys/arch/hp300/conf/files.hp300         |    9 +-
 sys/arch/hp300/dev/com_frodo.c          |   28 ++-
 sys/arch/hp300/dev/dnkbd.c              |   79 ++++--
 sys/arch/hp300/dev/frodo.c              |   10 +-
 sys/arch/hp300/dev/frodoreg.h           |    4 +-
 sys/arch/hp300/dev/mcclock_frodo.c      |  141 ++++++++++++
 sys/arch/hp300/dev/rtc.c                |    8 +-
 sys/arch/hp300/dev/sti_sgc.c            |  192 ++++++++++++++++
 sys/arch/hp300/dev/sti_sgcvar.h         |   27 ++
 sys/arch/hp300/hp300/autoconf.c         |   54 ++++-
 sys/arch/hp300/hp300/machdep.c          |    6 +-
 sys/arch/hp300/include/autoconf.h       |    3 +-
 sys/arch/hp300/stand/Makefile.buildboot |    3 +-
 sys/arch/hp300/stand/common/apci.c      |   23 +-
 sys/arch/hp300/stand/common/clock.c     |  105 ++++++--
 sys/arch/hp300/stand/common/dnkbd.c     |    8 +-
 sys/arch/hp300/stand/common/ite.c       |   57 ++++-
 sys/arch/hp300/stand/common/ite_sti.c   |  365 ++++++++++++++++++++++++++++++++
 sys/arch/hp300/stand/common/itevar.h    |   10 +-
 sys/arch/hp300/stand/common/samachdep.h |    6 +-
 sys/arch/hp300/stand/inst/version       |    3 +-
 sys/arch/hp300/stand/uboot/version      |    3 +-
 sys/dev/ic/sti.c                        |   44 +++-
 sys/dev/ic/stivar.h                     |    5 +-
 26 files changed, 1109 insertions(+), 107 deletions(-)

diffs (truncated from 1820 to 300 lines):

diff -r fa7b4ac4971a -r cbe91e5478ef sys/arch/hp300/conf/GENERIC
--- a/sys/arch/hp300/conf/GENERIC       Wed May 21 20:44:23 2014 +0000
+++ b/sys/arch/hp300/conf/GENERIC       Wed May 21 20:56:36 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.169 2011/12/18 05:49:27 dholland Exp $
+# $NetBSD: GENERIC,v 1.169.2.1 2014/05/21 20:56:36 bouyer Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.169 $"
+#ident                 "GENERIC-$Revision: 1.169.2.1 $"
 
 maxusers       32              # estimated number of users
 
@@ -195,7 +195,7 @@
 
 intio0         at mainbus0             # internal i/o space
 dio0           at mainbus0             # DIO/DIO-II bus
-#sgc0          at mainbus0             # SGC bus
+sgc0           at mainbus0             # SGC bus
 
 # Human Interface Loop devices
 hil0           at intio?               # HIL controller
@@ -216,6 +216,9 @@
 wsmouse*       at dnkbd? mux 0
 com*           at frodo? offset ?      # tty flavor
 
+# mc146818-like real time clock found on 425e
+mcclock0       at frodo? offset 0x80
+
 dvbox*         at intio?               # Davinci framebuffer
 dvbox*         at dio? scode ?
 wsdisplay*     at dvbox?
@@ -241,8 +244,8 @@
 gendiofb*      at dio? scode ?         # dumb framebuffer support for 362/382
 wsdisplay*     at gendiofb?
 
-#sti*          at sgc? slot ?          # SGC EVRX framebuffers
-#wsdisplay*    at sti?
+sti*           at sgc? slot ?          # SGC EVRX framebuffers
+wsdisplay*     at sti?
 
 com0           at dio0 scode 9         # DCA serial interfaces
 com*           at dio? scode ?
diff -r fa7b4ac4971a -r cbe91e5478ef sys/arch/hp300/conf/INSTALL
--- a/sys/arch/hp300/conf/INSTALL       Wed May 21 20:44:23 2014 +0000
+++ b/sys/arch/hp300/conf/INSTALL       Wed May 21 20:56:36 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.48.2.1 2014/05/21 20:44:23 bouyer Exp $
+# $NetBSD: INSTALL,v 1.48.2.2 2014/05/21 20:56:36 bouyer Exp $
 #
 # INSTALL machine description file
 #
@@ -136,7 +136,7 @@
 
 intio0         at mainbus0     # internal i/o space
 dio0           at mainbus0     # DIO/DIO-II bus
-#sgc0          at mainbus0     # SGC bus
+sgc0           at mainbus0     # SGC bus
 
 # Real-time clock (not optional)
 rtc*           at intio?
@@ -157,6 +157,9 @@
 #wskbd*                at dnkbd? mux 1
 com*           at frodo? offset ?      # tty flavor
 
+# mc146818-like real time clock found on 425e
+mcclock0       at frodo? offset 0x80
+
 # Davinci framebuffer
 dvbox*         at intio?
 dvbox*         at dio? scode ?
@@ -188,6 +191,9 @@
 gendiofb*      at dio? scode ?
 wsdisplay*     at gendiofb?
 
+sti*           at sgc? slot ?          # SGC EVRX framebuffers
+wsdisplay*     at sti?
+
 com*           at dio0 scode 9         # DCA serial interfaces
 com*           at dio? scode ?
 
diff -r fa7b4ac4971a -r cbe91e5478ef sys/arch/hp300/conf/files.hp300
--- a/sys/arch/hp300/conf/files.hp300   Wed May 21 20:44:23 2014 +0000
+++ b/sys/arch/hp300/conf/files.hp300   Wed May 21 20:56:36 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hp300,v 1.85 2011/06/12 03:35:40 rmind Exp $
+#      $NetBSD: files.hp300,v 1.85.8.1 2014/05/21 20:56:36 bouyer Exp $
 #
 # hp300-specific configuration info
 
@@ -85,6 +85,11 @@
 file   arch/hp300/dev/dnkbd.c                  dnkbd   needs-flag
 file   arch/hp300/dev/dnkbdmap.c               dnkbd
 
+# An mc146818-like calendar on 425e
+device mcclock: mc146818
+attach mcclock at frodo with mcclock_frodo
+file   arch/hp300/dev/mcclock_frodo.c          mcclock_frodo
+
 #
 # Frame buffer devices on Internal I/O and the DIO bus
 #
@@ -187,7 +192,7 @@
 #
 
 attach sti at sgc with sti_sgc
-file   arch/hp300/dev/sti_sgc.c        sti_sgc
+file   arch/hp300/dev/sti_sgc.c        sti_sgc needs-flag
 
 # Memory Disk for ramdisk
 file   dev/md_root.c                   memory_disk_hooks
diff -r fa7b4ac4971a -r cbe91e5478ef sys/arch/hp300/dev/com_frodo.c
--- a/sys/arch/hp300/dev/com_frodo.c    Wed May 21 20:44:23 2014 +0000
+++ b/sys/arch/hp300/dev/com_frodo.c    Wed May 21 20:56:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com_frodo.c,v 1.8 2008/04/28 20:23:19 martin Exp $     */
+/*     $NetBSD: com_frodo.c,v 1.8.40.1 2014/05/21 20:56:36 bouyer Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com_frodo.c,v 1.8 2008/04/28 20:23:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_frodo.c,v 1.8.40.1 2014/05/21 20:56:36 bouyer Exp $");
+
+#include "sti_sgc.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -155,10 +157,32 @@
 {
        bus_space_tag_t iot = &comcntag;
        bus_space_handle_t ioh;
+       volatile uint8_t *frodoregs;
 
        if (machineid != HP_425 || mmuid != MMUID_425_E)
                return 1;
 
+       /*
+        * Check the service switch. On the 425e, this is a physical
+        * switch, unlike other frodo-based machines, so we can use it
+        * as a serial vs internal video selector, since the PROM can not
+        * be configured for serial console.
+        */
+       frodoregs = (volatile uint8_t *)IIOV(INTIOBASE + FRODO_BASE);
+       if (badaddr(__UNVOLATILE(frodoregs)) != 0) {
+               /* 425e but no frodo chip found? */
+               return 1;
+       }
+
+       /*
+        * if sti(4) is not configured, we need serial console anyway
+        * and no need to check the service switch.
+        */
+#if NSTI_SGC > 0
+       if (ISSET(frodoregs[FRODO_IISR], FRODO_IISR_SERVICE))
+               return 1;
+#endif
+
        frodo_init_bus_space(iot);
 
        if (bus_space_map(iot, addr, INTIO_DEVSIZE, BUS_SPACE_MAP_LINEAR, &ioh))
diff -r fa7b4ac4971a -r cbe91e5478ef sys/arch/hp300/dev/dnkbd.c
--- a/sys/arch/hp300/dev/dnkbd.c        Wed May 21 20:44:23 2014 +0000
+++ b/sys/arch/hp300/dev/dnkbd.c        Wed May 21 20:56:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dnkbd.c,v 1.5 2011/02/18 19:15:43 tsutsui Exp $        */
+/*     $NetBSD: dnkbd.c,v 1.5.14.1 2014/05/21 20:56:36 bouyer Exp $    */
 /*     $OpenBSD: dnkbd.c,v 1.17 2009/07/23 21:05:56 blambert Exp $     */
 
 /*
@@ -29,6 +29,42 @@
 
 /*
  * Driver for the Apollo Domain keyboard and mouse.
+ *
+ * Random notes on the Apollo keyboard :
+ *
+ * - Powers up in 'cooked' mode, where the alpha keys generate ascii rather
+ *   than make/break codes.  Other keys seem to behave OK though.
+ *
+ * - Alt L/R keys generate two-byte sequence :
+ *             make     break
+ *       L    0xfe,2   0xfe,3
+ *       R    0xfe,0   0xfe,1
+ *
+ * - Mouse activity shows up inline in 4-byte packets introduced with 0xdf.
+ *   Byte 1 is   1MRL0000    where M, R, L are the mouse buttons, and 0 is
+ *                           down, 1 is up.
+ *   Byte 2 is 2's complement X movement, +ve to the right.
+ *   Byte 3 is 2's complement Y movement, +ve is up.
+ *
+ * - Keyboard recognises commands sent to it, all preceded by 0xff.  Commands
+ *   are echoed once sent completely.
+ *
+ *   0x00      go to cooked mode.
+ *   0x01      go to 'raw' (scancode) mode.
+ *   0x12,0x21 status report as <id1>\r<id2>\r<model>\r followed by 0xff 
+ *             and then the cooked/raw status.
+ *   0x21,0x81 beep on
+ *   0x21,0x82 beep off
+ *
+ * Some version examples :
+ *
+ * <3-@> <1-0> <SD-03687-MS>   Apollo p/n 007121 REV 00 ('old-style' US layout)
+ * <3-@> <2-0> <SD-03683-MS>   Apollo p/n 007121 REV 01 ('old-style' US layout)
+ * <3-@> <2-0> <SD-03980-MS>   Apollo 3500? keyboard.
+ * <3-@> <X-X> <RX-60857-HW>   HP p/n A1630-82001 R2
+ *                                 ('new-style' off 425t, US layout),
+ *                             also Apollo p/n 014555-002
+ *                                 ('new-style' off DN5500, US layout).
  */
 
 #include "opt_wsdisplay_compat.h"
@@ -210,6 +246,8 @@
 
 typedef enum { EVENT_NONE, EVENT_KEYBOARD, EVENT_MOUSE } dnevent;
 
+#define APCIBRD(x)     (500000 / (x))
+
 static void    dnevent_kbd(struct dnkbd_softc *, int);
 static void    dnevent_kbd_internal(struct dnkbd_softc *, int);
 static void    dnevent_mouse(struct dnkbd_softc *, uint8_t *);
@@ -225,8 +263,6 @@
 static void    dnkbd_rawrepeat(void *);
 #endif
 static int     dnkbd_send(struct dnkbd_softc *, const uint8_t *, size_t);
-static int     dnsubmatch_kbd(device_t, cfdata_t, const int *, void *);
-static int     dnsubmatch_mouse(device_t, cfdata_t, const int *, void *);
 
 int
 dnkbd_match(device_t parent, cfdata_t cf, void *aux)
@@ -287,13 +323,15 @@
 {
        bus_space_tag_t bst;
        bus_space_handle_t bsh;
+       u_int divisor;
 
        bst = sc->sc_bst;
        bsh = sc->sc_bsh;
 
+       divisor = APCIBRD(rate);
        bus_space_write_1(bst, bsh, com_lctl, LCR_DLAB);
-       bus_space_write_1(bst, bsh, com_dlbl, rate & 0xff);
-       bus_space_write_1(bst, bsh, com_dlbh, (rate >> 8) & 0xff);
+       bus_space_write_1(bst, bsh, com_dlbl, divisor & 0xff);
+       bus_space_write_1(bst, bsh, com_dlbh, (divisor >> 8) & 0xff);
        bus_space_write_1(bst, bsh, com_lctl, lctl);
        bus_space_write_1(bst, bsh, com_ier, IER_ERXRDY | IER_ETXRDY);
        bus_space_write_1(bst, bsh, com_fifo,
@@ -301,6 +339,7 @@
        bus_space_write_1(bst, bsh, com_mcr, MCR_DTR | MCR_RTS);
 
        delay(100);
+       (void)bus_space_read_1(bst, bsh, com_iir);
 }
 
 void
@@ -347,43 +386,21 @@
                sc->sc_flags = SF_PLUGGED;
        }
 
-       sc->sc_wskbddev = config_found_sm_loc(sc->sc_dev, "dnkbd", NULL, &ka,
-           wskbddevprint, dnsubmatch_kbd);
+       sc->sc_wskbddev =
+           config_found_ia(sc->sc_dev, "wskbddev", &ka, wskbddevprint);
 
 #if NWSMOUSE > 0
        ma.accessops = &dnmouse_accessops;
        ma.accesscookie = sc;
 
-       sc->sc_wsmousedev = config_found_sm_loc(sc->sc_dev, "dnkbd", NULL, &ma,
-           wsmousedevprint, dnsubmatch_mouse);
+       sc->sc_wsmousedev =
+           config_found_ia(sc->sc_dev, "wsmousedev", &ma, wsmousedevprint);
 #endif
 
        SET(sc->sc_flags, SF_ATTACHED);
 }
 
 int
-dnsubmatch_kbd(device_t parent, cfdata_t cf, const int *locs, void *aux)
-{
-
-       if (strcmp(cf->cf_name, wskbd_cd.cd_name) != 0)
-               return 0;
-
-       return config_match(parent, cf, aux);
-}
-
-#if NWSMOUSE > 0
-int
-dnsubmatch_mouse(device_t parent, cfdata_t cf, const int *locs, void *aux)



Home | Main Index | Thread Index | Old Index