Source-Changes-HG archive

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

[src/trunk]: src/sys Import STI wscons(4) driver from OpenBSD and add new dri...



details:   https://anonhg.NetBSD.org/src/rev/429d494ac79e
branches:  trunk
changeset: 569617:429d494ac79e
user:      jkunz <jkunz%NetBSD.org@localhost>
date:      Thu Aug 26 16:48:06 2004 +0000

description:
Import STI wscons(4) driver from OpenBSD and add new driver for PS/2
keyboard / mouse pots of LASI.

diffstat:

 sys/arch/hp700/conf/GENERIC     |   42 +-
 sys/arch/hp700/conf/files.hp700 |   12 +-
 sys/arch/hp700/dev/sti_sgc.c    |  254 +++++++----
 sys/arch/hp700/gsc/gsckbc.c     |  314 ++++++++++++++
 sys/arch/hp700/include/types.h  |    3 +-
 sys/arch/hppa/hppa/support.S    |   18 +-
 sys/arch/hppa/include/cpufunc.h |    7 +-
 sys/arch/hppa/include/reg.h     |   14 +-
 sys/conf/files                  |    6 +-
 sys/dev/ic/sti.c                |  855 ++++++++++++++++++++++++++++++++++++++++
 sys/dev/ic/stireg.h             |  606 ++++++++++++++++++++++++++++
 sys/dev/ic/stivar.h             |   82 +++
 sys/dev/wscons/wsconsio.h       |    3 +-
 13 files changed, 2092 insertions(+), 124 deletions(-)

diffs (truncated from 2464 to 300 lines):

diff -r e73bbefdbfc7 -r 429d494ac79e sys/arch/hp700/conf/GENERIC
--- a/sys/arch/hp700/conf/GENERIC       Thu Aug 26 14:33:01 2004 +0000
+++ b/sys/arch/hp700/conf/GENERIC       Thu Aug 26 16:48:06 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.29 2004/07/29 19:10:23 jkunz Exp $
+# $NetBSD: GENERIC,v 1.30 2004/08/26 16:48:06 jkunz Exp $
 #
 # GENERIC machine description file
 # 
@@ -23,7 +23,7 @@
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 options        SYSCTL_INCLUDE_DESCR    # Include sysctl descriptions in kernel
 
-#ident                 "GENERIC-$Revision: 1.29 $"
+#ident                 "GENERIC-$Revision: 1.30 $"
 
 maxusers       32              # estimated number of users
 
@@ -163,12 +163,21 @@
 # wscons options
 #
 # builtin terminal emulations
-options        WSEMUL_DUMB
 #options       WSEMUL_SUN              # sun terminal emulation
 options        WSEMUL_VT100            # VT100 / VT220 emulation
-# different kernel output - see dev/wscons/wsdisplayvar.h
+# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
+options        WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
+#options       WS_DEFAULT_FG=WSCOL_WHITE
+#options       WS_DEFAULT_BG=WSCOL_BLACK
+#options       WS_DEFAULT_COLATTR=""
+#options       WS_DEFAULT_MONOATTR=""
 options        WS_KERNEL_FG=WSCOL_GREEN
 #options       WS_KERNEL_BG=WSCOL_BLACK
+#options       WS_KERNEL_COLATTR=""
+#options       WS_KERNEL_MONOATTR=""
+# customization of console border color
+options        WSDISPLAY_CUSTOM_BORDER # border customization from wsconsctl(8)
+#options       WSDISPLAY_BORDER_COLOR=WSCOL_BLUE       # default color
 # compatibility to other console drivers
 options        WSDISPLAY_COMPAT_PCVT           # emulate some ioctls
 options        WSDISPLAY_COMPAT_SYSCONS        # emulate some ioctls
@@ -182,6 +191,16 @@
 options        PCDISPLAY_SOFTCURSOR
 # modify the screen type of the console; defaults to "80x25"
 #options       VGA_CONSOLE_SCREENTYPE="\"80x24\""
+# work around a hardware bug that loaded fonts don't work; found on ATI cards
+#options       VGA_CONSOLE_ATI_BROKEN_FONTSEL
+# the following enables some functions to get mouse console support.
+# if you want a really secure system, it may be better not to enable them,
+# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
+#options       WSDISPLAY_CHARFUNCS             # mouse console support
+# console scrolling support.
+#options       WSDISPLAY_SCROLLSUPPORT
+# enable VGA raster mode capable of displaying multilingual text on console
+#options       VGA_RASTERCONSOLE
 
 # Kernel root file system and dump configuration.
 config         netbsd  root on ? type ?
@@ -253,17 +272,14 @@
 #hms*          at hil? code 1  # mice & trackballs
 
 # wscons
-#pckbc*                at gsc?                 # pc keyboard controller
-#pckbd*                at pckbc?               # PC keyboard
-#pms*          at pckbc?               # PS/2 mouse for wsmouse
-#vga*          at pci? dev ? function ?
-#wsdisplay*    at sti?
-#wsdisplay*    at vga? console ?
-#wsdisplay*    at pcdisplay? console ?
-#wskbd*                at pckbd? console ?
+gsckbc*                at gsc?                 # pc keyboard controller
+pckbd*         at gsckbc?              # PC keyboard
+pms*           at gsckbc?              # PS/2 mouse for wsmouse
+wskbd*         at pckbd? console ?
+wsmouse*       at pms? mux 0
 #wskbd*                at hkbd? console ?
-#wsmouse*      at pms? mux 0
 #wsmouse*      at hms? mux 0
+wsdisplay*     at sti?
 
 # Serial Devices
 
diff -r e73bbefdbfc7 -r 429d494ac79e sys/arch/hp700/conf/files.hp700
--- a/sys/arch/hp700/conf/files.hp700   Thu Aug 26 14:33:01 2004 +0000
+++ b/sys/arch/hp700/conf/files.hp700   Thu Aug 26 16:48:06 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hp700,v 1.11 2004/07/29 19:10:23 jkunz Exp $
+#      $NetBSD: files.hp700,v 1.12 2004/08/26 16:48:06 jkunz Exp $
 #
 #      $OpenBSD: files.hp700,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -19,6 +19,7 @@
 include "dev/wsfont/files.wsfont"
 
 include "dev/pckbport/files.pckbport"
+
 #
 # Machine-independent SCSI drivers
 #
@@ -125,9 +126,9 @@
 attach com at dino with com_dino
 file   arch/hp700/dev/com_dino.c       com_dino
 
-device sti: wsemuldisplaydev
 attach sti at mainbus with sti_sgc
-file   arch/hp700/dev/sti_sgc.c                sti_sgc
+attach sti at phantomas with sti_phantomas
+file   arch/hp700/dev/sti_sgc.c                sti_sgc | sti_phantomas
 
 ###
 
@@ -180,8 +181,9 @@
 attach hil at gsc
 file   arch/hp700/gsc/hil.c            hil
 
-attach pckbc at gsc with pckbc_gsc
-file   arch/hp700/gsc/pckbc_gsc.c      pckbc_gsc
+device gsckbc: pckbport
+attach gsckbc at gsc
+file   arch/hp700/gsc/gsckbc.c         gsckbc
 
 # PSB 2160-N based 8bit mono audio (705, 710, 745i/*, 747i/*)
 device aone: audiobus, mulaw, auconv
diff -r e73bbefdbfc7 -r 429d494ac79e sys/arch/hp700/dev/sti_sgc.c
--- a/sys/arch/hp700/dev/sti_sgc.c      Thu Aug 26 14:33:01 2004 +0000
+++ b/sys/arch/hp700/dev/sti_sgc.c      Thu Aug 26 16:48:06 2004 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: sti_sgc.c,v 1.6 2003/11/23 17:09:29 chs Exp $  */
+/*     $NetBSD: sti_sgc.c,v 1.7 2004/08/26 16:48:06 jkunz Exp $        */
 
-/*     $OpenBSD: sti_sgc.c,v 1.6 2001/09/11 20:05:24 miod Exp $        */
+/*     $OpenBSD: sti_sgc.c,v 1.21 2003/12/22 23:39:06 mickey Exp $     */
 
 /*
- * Copyright (c) 2000 Michael Shalayeff
+ * Copyright (c) 2000-2003 Michael Shalayeff
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.6 2003/11/23 17:09:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.7 2004/08/26 16:48:06 jkunz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -58,99 +58,161 @@
 #include <dev/ic/stireg.h>
 #include <dev/ic/stivar.h>
 
+#include <hp700/dev/cpudevs.h>
 #include <hp700/hp700/machdep.h>
-#include <hp700/dev/cpudevs.h>
+
+#define        STI_ROMSIZE     (sizeof(struct sti_dd) * 4)
+#define        STI_ID_FDDI     0x280b31af      /* Medusa FDDI ROM id */
 
-#define        STI_MEMSIZE     0x1000000
-#define        STI_ROMSIZE     0x0004000
+/* gecko optional graphics */
+#define        STI_GOPT1_REV   0x17
+#define        STI_GOPT2_REV   0x70
 
-int  sti_sgc_probe(struct device *, struct cfdata *, void *);
+/* internal EG */
+#define        STI_INEG_REV    0x60
+#define        STI_INEG_PROM   0xf0011000
+
+int sti_sgc_probe(struct device *, struct cfdata *, void *);
 void sti_sgc_attach(struct device *, struct device *, void *);
 
-CFATTACH_DECL(sti_sgc, sizeof(struct sti_softc),
-    sti_sgc_probe, sti_sgc_attach, NULL, NULL);
+CFATTACH_DECL(sti_sgc, sizeof(struct sti_softc), sti_sgc_probe, sti_sgc_attach,
+    NULL, NULL);
+
+CFATTACH_DECL(sti_phantomas, sizeof(struct sti_softc), sti_sgc_probe, 
+    sti_sgc_attach, NULL, NULL);
+
+
+paddr_t sti_sgc_getrom(int, struct confargs *);
+
+
+/*
+ * Locate STI ROM.
+ * On some machines it may not be part of the HPA space.
+ */
+paddr_t
+sti_sgc_getrom(int unit, struct confargs *ca)
+{
+       paddr_t rom;
+       int pagezero_cookie;
+
+       pagezero_cookie = hp700_pagezero_map();
+       rom = PAGE0->pd_resv2[1];
+
+       if (unit) {
+               if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC &&
+                   (ca->ca_type.iodc_revision == STI_GOPT1_REV ||
+                    ca->ca_type.iodc_revision == STI_GOPT2_REV))
+                       /* these two share the onboard's prom */ ;
+               else
+                       rom = 0;
+       }
+
+       if (rom < HPPA_IOBEGIN) {
+               if (unit == 0 &&
+                   ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC &&
+                   ca->ca_type.iodc_revision == STI_INEG_REV)
+                       rom = STI_INEG_PROM;
+               else
+                       rom = ca->ca_hpa;
+       }
+
+       hp700_pagezero_unmap(pagezero_cookie);
+       return (rom);
+}
 
 int
-sti_sgc_probe(struct device *parent, struct cfdata *match, void *aux)
+sti_sgc_probe(struct device *parent, struct cfdata *cf, void *aux)
 {
        struct confargs *ca = aux;
-       bus_space_handle_t ioh, romh;
-       u_int rom;
+       bus_space_handle_t romh;
+       paddr_t rom;
+       u_int32_t id, romend;
        u_char devtype;
-       int rv = 0, romh_is_subregion;
-       int pagezero_cookie;
+       int rv = 0, romunmapped = 0;
 
-       if (ca->ca_type.iodc_type != HPPA_TYPE_FIO ||
-           (ca->ca_type.iodc_sv_model != HPPA_FIO_GSGC &&
-            ca->ca_type.iodc_sv_model != HPPA_FIO_SGC))
+       if (ca->ca_type.iodc_type != HPPA_TYPE_FIO)
+               return (0);
+
+       /* these need futher checking for the graphics id */
+       if (ca->ca_type.iodc_sv_model != HPPA_FIO_GSGC &&
+           ca->ca_type.iodc_sv_model != HPPA_FIO_SGC)
                return 0;
 
-       if ((rv = bus_space_map(ca->ca_iot, ca->ca_hpa, STI_MEMSIZE, 0, &ioh))) {
+       rom = sti_sgc_getrom(cf->cf_unit, ca);
 #ifdef STIDEBUG
-               printf("st: cannot map io space (%d)\n", rv);
-#endif
-               return 0;
-       }
-
-       /*
-        * Locate STI ROM.
-        * On some machines it may not be part of the HPA space.
-        */
-       pagezero_cookie = hp700_pagezero_map();
-       if (PAGE0->pd_resv2[1] < HPPA_IOBEGIN) {
-               rom = ca->ca_hpa;
-       } else
-               rom = PAGE0->pd_resv2[1];
-       hp700_pagezero_unmap(pagezero_cookie);
-
-#ifdef STIDEBUG
-       printf ("sti: hpa=%x, rom=%x\n", ca->ca_hpa, rom);
+       printf ("sti: hpa=%x, rom=%x\n", (uint)ca->ca_hpa, (uint)rom);
 #endif
 
-       /*
-        * Map the ROM.
-        */
-       if (ca->ca_hpa <= rom &&
-           (rom + STI_ROMSIZE) <= (ca->ca_hpa + STI_MEMSIZE)) {
-               romh_is_subregion = TRUE;
-               rv = bus_space_subregion(ca->ca_iot, ioh,
-                       rom - ca->ca_hpa, STI_ROMSIZE, &romh);
-       } else {
-               romh_is_subregion = FALSE;
-               rv = bus_space_map(ca->ca_iot, rom, STI_ROMSIZE, 0, &romh);
-       }
-       if (rv) {
+       /* if it does not map, probably part of the lasi space */
+       if ((rv = bus_space_map(ca->ca_iot, rom, STI_ROMSIZE, 0, &romh))) {
 #ifdef STIDEBUG
                printf ("sti: cannot map rom space (%d)\n", rv);
 #endif
-               bus_space_unmap(ca->ca_iot, ioh,  STI_MEMSIZE);
-               return 0;
+               if ((rom & HPPA_IOBEGIN) == HPPA_IOBEGIN) {
+                       romh = rom;
+                       romunmapped++;
+               } else {
+                       /* in this case nobody has no freaking idea */
+                       return 0;
+               }
        }
 



Home | Main Index | Thread Index | Old Index