diff options
| author | phx <phx@NetBSD.org> | 2011-12-15 14:25:12 +0000 |
|---|---|---|
| committer | phx <phx@NetBSD.org> | 2011-12-15 14:25:12 +0000 |
| commit | de2e89deeedfe4788c0da95068620c22ea4cbb8e (patch) | |
| tree | bba031493be6189266b0f960bcf8b9ad06299fce | |
| parent | 05ead0ff6fff11aa9f8f221727a747575b8d703c (diff) | |
Amiga wscons/Xorg support, first phase.
Implemented wscons for CV64 and CV64/3D. Other graphics cards drivers are
prepared for it, but will not be attempted before Xorg is not running.
The wscons support is disabled by default. A GENERIC kernel should behave
like always. Use WSCONS to try out a kernel with wscons support.
Done by rkujawa@ and phx@.
| -rw-r--r-- | sbin/wsconsctl/util.c | 3 | ||||
| -rw-r--r-- | sys/arch/amiga/amiga/conf.c | 13 | ||||
| -rw-r--r-- | sys/arch/amiga/amiga/machdep.c | 9 | ||||
| -rw-r--r-- | sys/arch/amiga/conf/DRACO | 8 | ||||
| -rw-r--r-- | sys/arch/amiga/conf/GENERIC | 12 | ||||
| -rw-r--r-- | sys/arch/amiga/conf/GENERIC.in | 35 | ||||
| -rw-r--r-- | sys/arch/amiga/conf/INSTALL | 12 | ||||
| -rw-r--r-- | sys/arch/amiga/conf/WSCONS | 16 | ||||
| -rw-r--r-- | sys/arch/amiga/conf/files.amiga | 8 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/amidisplaycc.c | 6 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf.c | 445 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_cc.c | 7 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_cl.c | 11 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_cv.c | 271 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_cv3d.c | 276 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_cv3dreg.h | 8 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_cvreg.h | 10 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_et.c | 11 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_rh.c | 9 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_rt.c | 7 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grf_ul.c | 9 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grfvar.h | 57 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/grfws.h | 73 | ||||
| -rw-r--r-- | sys/arch/amiga/dev/ite.c | 9 | ||||
| -rw-r--r-- | sys/dev/wscons/wsconsio.h | 3 |
25 files changed, 1194 insertions, 134 deletions
diff --git a/sbin/wsconsctl/util.c b/sbin/wsconsctl/util.c index 3b31a14fe0f..bb9e9a944f3 100644 --- a/sbin/wsconsctl/util.c +++ b/sbin/wsconsctl/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.29 2011/02/06 21:38:09 pooka Exp $ */ +/* $NetBSD: util.c,v 1.30 2011/12/15 14:25:12 phx Exp $ */ /*- * Copyright (c) 1998, 2006 The NetBSD Foundation, Inc. @@ -126,6 +126,7 @@ static struct nameint dpytype_tab[] = { { WSDISPLAY_TYPE_TVRX, "hp-tiger" }, { WSDISPLAY_TYPE_HYPERION, "hp-hyperion" }, { WSDISPLAY_TYPE_AMIGACC, "amiga-cc" }, + { WSDISPLAY_TYPE_GRF, "grf" }, { WSDISPLAY_TYPE_SUN24, "sun24" }, { WSDISPLAY_TYPE_NEWPORT, "sgi-newport" }, { WSDISPLAY_TYPE_GR2, "sgi-gr2" }, diff --git a/sys/arch/amiga/amiga/conf.c b/sys/arch/amiga/amiga/conf.c index a0def14b9da..7da7776ee79 100644 --- a/sys/arch/amiga/amiga/conf.c +++ b/sys/arch/amiga/amiga/conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.72 2005/12/11 12:16:26 christos Exp $ */ +/* $NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.72 2005/12/11 12:16:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.72 2005/12/11 12:16:26 christos Exp $"); #include "ser.h" #include "ite.h" #include "amidisplaycc.h" +#include "wsdisplay.h" /* * This entire table could be autoconfig()ed but that would mean that @@ -50,14 +51,18 @@ __KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.72 2005/12/11 12:16:26 christos Exp $"); * known algorithm unless we see a pressing need otherwise. */ cons_decl(ser); -cons_decl(ite); +cons_decl(grf); cons_decl(amidisplaycc_); +cons_decl(ite); struct consdev constab[] = { #if NSER > 0 cons_init(ser), #endif -#if NAMIDISPLAYCC>0 +#if NWSDISPLAY > 0 + { dev_init(grf,cnprobe), dev_init(grf,cninit) }, +#endif +#if NAMIDISPLAYCC > 0 cons_init(amidisplaycc_), #endif #if NITE > 0 diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index 0f1d0f6ed9b..cd6d19b72f0 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.236 2011/12/12 19:03:08 mrg Exp $ */ +/* $NetBSD: machdep.c,v 1.237 2011/12/15 14:25:12 phx Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -48,7 +48,7 @@ #include "opt_m68k_arch.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.236 2011/12/12 19:03:08 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.237 2011/12/15 14:25:12 phx Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -107,6 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.236 2011/12/12 19:03:08 mrg Exp $"); #include <amiga/amiga/cia.h> #include <amiga/amiga/cc.h> #include <amiga/amiga/memlist.h> +#include <amiga/amiga/device.h> #include "fd.h" #include "ser.h" @@ -182,6 +183,10 @@ consinit(void) } else #endif custom_chips_init(); + + /* preconfigure graphics cards */ + config_console(); + /* * Initialize the console before we print anything out. */ diff --git a/sys/arch/amiga/conf/DRACO b/sys/arch/amiga/conf/DRACO index 91d513df561..f6708f51bb6 100644 --- a/sys/arch/amiga/conf/DRACO +++ b/sys/arch/amiga/conf/DRACO @@ -1,9 +1,9 @@ -# $NetBSD: DRACO,v 1.145 2011/11/22 21:24:55 tls Exp $ +# $NetBSD: DRACO,v 1.146 2011/12/15 14:25:12 phx Exp $ # # This file was automatically created. # Changes will be lost when make is run in this directory. # -# Created from: # NetBSD: GENERIC.in,v 1.86 2011/10/30 11:16:05 rkujawa Exp $ +# Created from: # NetBSD: GENERIC.in,v 1.87 2011/11/22 21:24:56 tls Exp $ # ## # GENERIC machine description file @@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.145 $" +#ident "GENERIC-$Revision: 1.146 $" maxusers 8 @@ -270,12 +270,10 @@ lpt* at iobl? port ? # IOBlix parallel ports # Don't enable wskbd if you use ite. # # XXX in std.amiga: kbd0 at mainbus0 - #wskbd0 at kbd0 console ? - #wsmouse* at ms? # diff --git a/sys/arch/amiga/conf/GENERIC b/sys/arch/amiga/conf/GENERIC index 5766cf2ab2b..584673d0ce9 100644 --- a/sys/arch/amiga/conf/GENERIC +++ b/sys/arch/amiga/conf/GENERIC @@ -1,9 +1,9 @@ -# $NetBSD: GENERIC,v 1.275 2011/11/22 21:24:56 tls Exp $ +# $NetBSD: GENERIC,v 1.276 2011/12/15 14:25:12 phx Exp $ # # This file was automatically created. # Changes will be lost when make is run in this directory. # -# Created from: # NetBSD: GENERIC.in,v 1.86 2011/10/30 11:16:05 rkujawa Exp $ +# Created from: # NetBSD: GENERIC.in,v 1.87 2011/11/22 21:24:56 tls Exp $ # ## # GENERIC machine description file @@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.275 $" +#ident "GENERIC-$Revision: 1.276 $" maxusers 8 @@ -265,7 +265,6 @@ options KFONT_CONS_ISO8859_1 # wscons aware interface to amiga custom chips. # If you enable it enable also wskbd. # - #amidisplaycc0 at mainbus0 # wscons interface to custom chips #wsdisplay0 at amidisplaycc0 console ? #options WSEMUL_VT100 @@ -298,6 +297,9 @@ ite5 at grf5 # terminal emulators for grfs ite6 at grf6 # terminal emulators for grfs ite7 at grf7 # terminal emulators for grfs +#wsdisplay* at grf5 console ? # wsdisplay on top of grf (CV64) +#wsdisplay* at grf7 console ? # wsdisplay on top of grf (CV64/3D) + msc0 at zbus0 # A2232 MSC multiport serial. mfc0 at zbus0 # MultiFaceCard I/O board mfcs0 at mfc0 unit 0 # MFC serial @@ -327,7 +329,6 @@ lpt* at iobl? port ? # IOBlix parallel ports # Don't enable wskbd if you use ite. # # XXX in std.amiga: kbd0 at mainbus0 - #wskbd0 at kbd0 console ? @@ -345,7 +346,6 @@ a2kbbc0 at mainbus0 # A2000 battery backed clock aucc* at mainbus0 # Amiga CC audio audio* at aucc? - #wsmouse* at ms? # diff --git a/sys/arch/amiga/conf/GENERIC.in b/sys/arch/amiga/conf/GENERIC.in index 069f102869b..571cd897c14 100644 --- a/sys/arch/amiga/conf/GENERIC.in +++ b/sys/arch/amiga/conf/GENERIC.in @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC.in,v 1.87 2011/11/22 21:24:56 tls Exp $ +# $NetBSD: GENERIC.in,v 1.88 2011/12/15 14:25:12 phx Exp $ # ## # GENERIC machine description file @@ -29,7 +29,6 @@ m4_divert(-1) # make DRACO extracts the DRACO configuration file. # make GENERIC extracts the GENERIC configuration file. # make INSTALL extracts the INSTALL configuration file. -# make WSCONS extracts the WSCONS configuration file. # # commit them, too. # @@ -46,10 +45,6 @@ m4_ifelse(M4_Target, `AMIGA', `', `m4_define(`DRACO_CONFIGURATION', `')') # m4_ifelse(M4_Target, `DRACO', `', `m4_define(`AMIGA_CONFIGURATION', `')') -# If building WSCONS, uncomment various options -# -m4_ifdef(`WSCONS_CONFIGURATION', `m4_define(`WSOFF', `wson')', `m4_define(`WSOFF', `wsoff')') - m4_divert(0)m4_dnl @@ -57,7 +52,7 @@ include "arch/amiga/conf/std.amiga" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.87 $" +#ident "GENERIC-$Revision: 1.88 $" m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl makeoptions COPTS="-Os" @@ -326,22 +321,13 @@ m4_ifdef(`AMIGA_CONFIGURATION', `m4_dnl # wscons aware interface to amiga custom chips. # If you enable it enable also wskbd. # -m4_ifdef(`WSCONS_CONFIGURATION', `m4_dnl -amidisplaycc0 at mainbus0 # wscons interface to custom chips -wsdisplay0 at amidisplaycc0 console ? -options WSEMUL_VT100 -options FONT_VT220L8x10 -options FONT_VT220ISO8x16 -', ` #amidisplaycc0 at mainbus0 # wscons interface to custom chips #wsdisplay0 at amidisplaycc0 console ? #options WSEMUL_VT100 #options FONT_VT220L8x10 #options FONT_VT220ISO8x16 ')m4_dnl -')m4_dnl -m4_ifdef(`WSCONS_CONFIGURATION', `', `m4_dnl m4_ifdef(`AMIGA_CONFIGURATION', `m4_dnl grfcc0 at mainbus0 # custom chips grfrt0 at zbus0 # retina II @@ -376,7 +362,9 @@ ite4 at grf4 # terminal emulators for grfs ite5 at grf5 # terminal emulators for grfs ite6 at grf6 # terminal emulators for grfs ite7 at grf7 # terminal emulators for grfs -')m4_dnl + +#wsdisplay* at grf5 console ? # wsdisplay on top of grf (CV64) +#wsdisplay* at grf7 console ? # wsdisplay on top of grf (CV64/3D) ')m4_dnl msc0 at zbus0 # A2232 MSC multiport serial. @@ -408,11 +396,7 @@ lpt* at iobl? port ? # IOBlix parallel ports # Don't enable wskbd if you use ite. # # XXX in std.amiga: kbd0 at mainbus0 -m4_ifdef(`WSCONS_CONFIGURATION', `m4_dnl -wskbd0 at kbd0 console ? -', ` #wskbd0 at kbd0 console ? -')m4_dnl m4_ifdef(`AMIGA_CONFIGURATION', `m4_dnl @@ -433,11 +417,7 @@ audio* at aucc? ')m4_dnl ')m4_dnl -m4_ifdef(`WSCONS_CONFIGURATION', `m4_dnl -wsmouse* at ms? -', ` #wsmouse* at ms? -')m4_dnl m4_ifdef(`DRACO_CONFIGURATION', `m4_dnl # @@ -656,13 +636,8 @@ pseudo-device pty # pseudo-terminals ')m4_dnl pseudo-device clockctl # user control of clock subsystem -m4_ifdef(`WSCONS_CONFIGURATION', `m4_dnl -pseudo-device wsfont # wsfont(4) dynamic font loading support -pseudo-device wsmux # mouse & keyboard multiplexor -', `m4_dnl #pseudo-device wsfont # wsfont(4) dynamic font loading support #pseudo-device wsmux # mouse & keyboard multiplexor -')m4_dnl pseudo-device vnd # vnode pseudo-disks #options VND_COMPRESSION # compressed vnd(4) diff --git a/sys/arch/amiga/conf/INSTALL b/sys/arch/amiga/conf/INSTALL index 6bda3982186..51fae690b3b 100644 --- a/sys/arch/amiga/conf/INSTALL +++ b/sys/arch/amiga/conf/INSTALL @@ -1,9 +1,9 @@ -# $NetBSD: INSTALL,v 1.97 2011/11/22 21:24:57 tls Exp $ +# $NetBSD: INSTALL,v 1.98 2011/12/15 14:25:12 phx Exp $ # # This file was automatically created. # Changes will be lost when make is run in this directory. # -# Created from: # NetBSD: GENERIC.in,v 1.86 2011/10/30 11:16:05 rkujawa Exp $ +# Created from: # NetBSD: GENERIC.in,v 1.87 2011/11/22 21:24:56 tls Exp $ # ## # GENERIC machine description file @@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.97 $" +#ident "GENERIC-$Revision: 1.98 $" makeoptions COPTS="-Os" @@ -219,7 +219,6 @@ options KFONT_CONS_ISO8859_1 # wscons aware interface to amiga custom chips. # If you enable it enable also wskbd. # - #amidisplaycc0 at mainbus0 # wscons interface to custom chips #wsdisplay0 at amidisplaycc0 console ? #options WSEMUL_VT100 @@ -252,6 +251,9 @@ ite5 at grf5 # terminal emulators for grfs ite6 at grf6 # terminal emulators for grfs ite7 at grf7 # terminal emulators for grfs +#wsdisplay* at grf5 console ? # wsdisplay on top of grf (CV64) +#wsdisplay* at grf7 console ? # wsdisplay on top of grf (CV64/3D) + msc0 at zbus0 # A2232 MSC multiport serial. mfc0 at zbus0 # MultiFaceCard I/O board mfcs0 at mfc0 unit 0 # MFC serial @@ -281,7 +283,6 @@ lpt* at iobl? port ? # IOBlix parallel ports # Don't enable wskbd if you use ite. # # XXX in std.amiga: kbd0 at mainbus0 - #wskbd0 at kbd0 console ? @@ -297,7 +298,6 @@ fd* at fdc0 unit ? # floppy disks on the later a34kbbc0 at mainbus0 # A3000/A4000 battery backed clock a2kbbc0 at mainbus0 # A2000 battery backed clock - #wsmouse* at ms? # diff --git a/sys/arch/amiga/conf/WSCONS b/sys/arch/amiga/conf/WSCONS index 47d754316ee..cf4dca52d9f 100644 --- a/sys/arch/amiga/conf/WSCONS +++ b/sys/arch/amiga/conf/WSCONS @@ -1,4 +1,4 @@ -# $NetBSD: WSCONS,v 1.62 2007/10/17 19:53:14 garbled Exp $ +# $NetBSD: WSCONS,v 1.63 2011/12/15 14:25:12 phx Exp $ # GENERIC with wscons(4) # @@ -21,18 +21,24 @@ no grfrt0 at zbus0 no grfrh0 at zbus0 no grfcl* at zbus0 no grful0 at zbus0 -no grfcv0 at zbus0 no grfet* at zbus0 -no grfcv3d0 at zbus0 +#no grfcv0 at zbus0 +#no grfcv3d0 at zbus0 +# Disable grf(4) devices for non-wsdisplay drivers. no grf0 at grfcc0 no grf1 at grfrt0 no grf2 at grfrh0 no grf3 at grfcl? no grf4 at grful0 -no grf5 at grfcv0 no grf6 at grfet? -no grf7 at grfcv3d0 +#no grf5 at grfcv0 +#no grf7 at grfcv3d0 + +wsdisplay* at grf5 console ? # wsdisplay on top of grf (CV64) +wsdisplay* at grf7 console ? # wsdisplay on top of grf (CV64/3D) + +# Disable ite(4) for all drivers. no ite0 at grf0 no ite1 at grf1 no ite2 at grf2 diff --git a/sys/arch/amiga/conf/files.amiga b/sys/arch/amiga/conf/files.amiga index 9e4518be96a..2efee2a81e3 100644 --- a/sys/arch/amiga/conf/files.amiga +++ b/sys/arch/amiga/conf/files.amiga @@ -1,4 +1,4 @@ -# $NetBSD: files.amiga,v 1.149 2011/10/27 22:12:23 rkujawa Exp $ +# $NetBSD: files.amiga,v 1.150 2011/12/15 14:25:12 phx Exp $ # maxpartitions must be first item in files.${ARCH}.newconf maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL! @@ -130,7 +130,7 @@ file arch/amiga/dev/fd.c fd needs-flag # graphic devices define grfbus {} -device grf {} +device grf {}: wsemuldisplaydev, vcons attach grf at grfbus file arch/amiga/dev/grf.c grf needs-count @@ -140,11 +140,11 @@ file arch/amiga/dev/ite.c ite needs-flag file arch/amiga/dev/kbdmap.c ite file arch/amiga/dev/kf_custom.c kfont_custom file arch/amiga/dev/kf_iso8859_1_8x8.c kfont_cons_iso8859_1 & - ( ite | amidisplaycc ) + ( ite | wsdisplay) file arch/amiga/dev/kf_iso8859_1_8x11.c kfont_cons_iso8859_1 & kfont_8x11 file arch/amiga/dev/kf_iso8859_2_8x8.c kfont_cons_iso8859_2 & - ( ite | amidisplaycc ) + ( ite | wsdisplay ) file arch/amiga/dev/kf_iso8859_2_8x11.c kfont_cons_iso8859_2 & kfont_8x11 diff --git a/sys/arch/amiga/dev/amidisplaycc.c b/sys/arch/amiga/dev/amidisplaycc.c index 1acc179d605..0f764ce20cb 100644 --- a/sys/arch/amiga/dev/amidisplaycc.c +++ b/sys/arch/amiga/dev/amidisplaycc.c @@ -1,4 +1,4 @@ -/* $NetBSD: amidisplaycc.c,v 1.23 2011/07/17 20:54:36 joerg Exp $ */ +/* $NetBSD: amidisplaycc.c,v 1.24 2011/12/15 14:25:13 phx Exp $ */ /*- * Copyright (c) 2000 Jukka Andberg. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.23 2011/07/17 20:54:36 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.24 2011/12/15 14:25:13 phx Exp $"); /* * wscons interface to amiga custom chips. Contains the necessary functions @@ -377,8 +377,6 @@ amidisplaycc_cninit(struct consdev * cd) /* * This will do the basic stuff we also need. */ - config_console(); - grfcc_probe(); #if NVIEW>0 diff --git a/sys/arch/amiga/dev/grf.c b/sys/arch/amiga/dev/grf.c index afec04c41f6..a1ba8e60ac9 100644 --- a/sys/arch/amiga/dev/grf.c +++ b/sys/arch/amiga/dev/grf.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf.c,v 1.56 2011/06/30 20:09:19 wiz Exp $ */ +/* $NetBSD: grf.c,v 1.57 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.56 2011/06/30 20:09:19 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.57 2011/12/15 14:25:13 phx Exp $"); /* * Graphics display driver for the Amiga @@ -47,6 +47,11 @@ __KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.56 2011/06/30 20:09:19 wiz Exp $"); * Hardware access is through the grf_softc->g_mode routine. */ +#include "view.h" +#include "grf.h" +#include "kbd.h" +#include "wsdisplay.h" + #include <sys/param.h> #include <sys/proc.h> #include <sys/ioctl.h> @@ -56,20 +61,29 @@ __KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.56 2011/06/30 20:09:19 wiz Exp $"); #include <sys/systm.h> #include <sys/vnode.h> #include <sys/mman.h> +#include <sys/bus.h> +#include <sys/kauth.h> + #include <machine/cpu.h> + +#include <dev/cons.h> #include <dev/sun/fbio.h> +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsdisplayvar.h> +#include <dev/rasops/rasops.h> +#include <dev/wscons/wsdisplay_vconsvar.h> + #include <amiga/amiga/color.h> /* DEBUG */ #include <amiga/amiga/device.h> #include <amiga/dev/grfioctl.h> +#include <amiga/dev/grfws.h> #include <amiga/dev/grfvar.h> #include <amiga/dev/itevar.h> +#include <amiga/dev/kbdvar.h> #include <amiga/dev/viewioctl.h> #include <sys/conf.h> -#include "view.h" -#include "grf.h" - #if NGRF > 0 #include "ite.h" #if NITE == 0 @@ -85,6 +99,9 @@ int grfsinfo(dev_t, struct grfdyninfo *); void grfattach(device_t, device_t, void *); int grfmatch(device_t, cfdata_t, void *); int grfprint(void *, const char *); +#ifdef DEBUG +void grfdebug(struct grf_softc *, const char *, ...); +#endif /* * pointers to grf drivers device structs */ @@ -108,6 +125,17 @@ const struct cdevsw grf_cdevsw = { */ static cfdata_t cfdata; +#if NWSDISPLAY > 0 +static struct vcons_screen console_vcons; + +static void grf_init_screen(void *, struct vcons_screen *, int, long *); +static struct rasops_info *grf_setup_rasops(struct grf_softc *, + struct vcons_screen *); +static paddr_t grf_wsmmap_md(off_t off); + +cons_decl(grf); +#endif + /* * match if the unit of grf matches its perspective * low level board driver. @@ -123,13 +151,17 @@ grfmatch(device_t pdp, cfdata_t cfp, void *auxp) } /* - * attach.. plug pointer in and print some info. - * then try and attach an ite to us. note: dp is NULL - * durring console init. + * Attach.. plug pointer in and print some info. + * Then try and attach a wsdisplay or ite to us. + * Note: dp is NULL durring console init. */ void grfattach(device_t pdp, device_t dp, void *auxp) { +#if NWSDISPLAY > 0 + struct wsemuldisplaydev_attach_args wa; + long defattr; +#endif struct grf_softc *gp; int maj; @@ -149,12 +181,35 @@ grfattach(device_t pdp, device_t dp, void *auxp) printf(" monochrome\n"); else printf(" colors %d\n", gp->g_display.gd_colors); +#if NWSDISPLAY > 0 + vcons_init(&gp->g_vd, gp, gp->g_screens[0], gp->g_accessops); + gp->g_vd.init_screen = grf_init_screen; + if (gp->g_flags & GF_CONSOLE) { + console_vcons.scr_flags |= VCONS_SCREEN_IS_STATIC; + vcons_init_screen(&gp->g_vd, + &console_vcons, 1, &defattr); + gp->g_screens[0]->textops = + &console_vcons.scr_ri.ri_ops; + wsdisplay_cnattach(gp->g_screens[0], + &console_vcons.scr_ri, 0, 0, defattr); + vcons_replay_msgbuf(&console_vcons); + } + + /* attach wsdisplay */ + wa.console = (gp->g_flags & GF_CONSOLE) != 0; + wa.scrdata = &gp->g_screenlist; + wa.accessops = gp->g_accessops; + wa.accesscookie = &gp->g_vd; + config_found(dp, &wa, wsemuldisplaydevprint); +#endif /* NWSDISPLAY > 0 */ } +#if NWSDISPLAY == 0 /* * try and attach an ite */ amiga_config_found(cfdata, dp, gp, grfprint); +#endif } int @@ -372,4 +427,378 @@ grfsinfo(dev_t dev, struct grfdyninfo *dyninfo) return(error); } +#if NWSDISPLAY > 0 +void +grfcnprobe(struct consdev *cd) +{ + struct grf_softc *gp; + int unit; + + /* + * Find the first working grf device for being console. + * Ignore unit 0 (grfcc), which should use amidisplaycc instead. + */ + for (unit = 1; unit < NGRF; unit++) { + gp = grfsp[unit]; + if (gp != NULL && (gp->g_flags & GF_ALIVE)) { + cd->cn_pri = CN_INTERNAL; + cd->cn_dev = NODEV; /* initialized later by wscons */ + return; + } + } + + /* no grf console alive */ + cd->cn_pri = CN_DEAD; +} + +void +grfcninit(struct consdev *cd) +{ + struct grf_softc *gp; + struct rasops_info *ri; + long defattr; + int unit; + + /* find console grf and set up wsdisplay for it */ + for (unit = 1; unit < NGRF; unit++) { + gp = grfsp[unit]; + if (gp != NULL && (gp->g_flags & GF_ALIVE)) { + gp->g_flags |= GF_CONSOLE; /* we are console! */ + gp->g_screens[0]->ncols = gp->g_display.gd_fbwidth / + gp->g_screens[0]->fontwidth; + gp->g_screens[0]->nrows = gp->g_display.gd_fbheight / + gp->g_screens[0]->fontheight; + + ri = grf_setup_rasops(gp, &console_vcons); + console_vcons.scr_cookie = gp; + defattr = 0; /* XXX */ + + wsdisplay_preattach(gp->g_screens[0], ri, 0, 0, + defattr); +#if NKBD > 0 + /* tell kbd device it is used as console keyboard */ + kbd_cnattach(); +#endif + return; + } + } + panic("grfcninit: lost console"); +} + +static void +grf_init_screen(void *cookie, struct vcons_screen *scr, int existing, + long *defattr) +{ + struct grf_softc *gp; + struct rasops_info *ri; + + gp = cookie; + ri = grf_setup_rasops(gp, scr); +} + +static struct rasops_info * +grf_setup_rasops(struct grf_softc *gp, struct vcons_screen *scr) +{ + struct rasops_info *ri; + int i; + + ri = &scr->scr_ri; + scr->scr_flags |= VCONS_DONT_READ; + memset(ri, 0, sizeof(struct rasops_info)); + + ri->ri_rows = gp->g_screens[0]->nrows; + ri->ri_cols = gp->g_screens[0]->ncols; + ri->ri_hw = scr; + ri->ri_ops.cursor = gp->g_emulops->cursor; + ri->ri_ops.mapchar = gp->g_emulops->mapchar; + ri->ri_ops.copyrows = gp->g_emulops->copyrows; + ri->ri_ops.eraserows = gp->g_emulops->eraserows; + ri->ri_ops.copycols = gp->g_emulops->copycols; + ri->ri_ops.erasecols = gp->g_emulops->erasecols; + ri->ri_ops.putchar = gp->g_emulops->putchar; + ri->ri_ops.allocattr = gp->g_emulops->allocattr; + + /* multiplication table for row-offsets */ + for (i = 0; i < ri->ri_rows; i++) + gp->g_rowoffset[i] = i * ri->ri_cols; + + return ri; +} + +paddr_t +grf_wsmmap(void *v, void *vs, off_t off, int prot) +{ + struct vcons_data *vd; + struct grf_softc *gp; + struct grfinfo *gi; + + vd = v; + gp = vd->cookie; + gi = &gp->g_display; + + /* Normal fb mapping */ + if (off < gi->gd_fbsize) + return grf_wsmmap_md(((bus_addr_t)gp->g_fbkva) + off); + + if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER, + NULL) != 0) { + aprint_normal("%s: permission to mmap denied.\n", + device_xname(&gp->g_device)); + return -1; + } + + if ((off >= (bus_addr_t)gp->g_fbkva ) && + (off < ( (bus_addr_t)gp->g_fbkva + (size_t)gi->gd_fbsize))) + return grf_wsmmap_md(off); + + /* Handle register mapping */ + if ((off >= (bus_addr_t)gi->gd_regaddr) && + (off < ((bus_addr_t)gi->gd_regaddr + (size_t)gi->gd_regsize))) + return grf_wsmmap_md(off); + + return -1; +} + +static paddr_t +grf_wsmmap_md(off_t off) +{ +#if defined(__m68k__) + return (paddr_t) m68k_btop(off); +#else + return -1; /* FIXME */ +#endif +} + +int +grf_wsioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) +{ + struct vcons_data *vd; + struct grf_softc *gp; + + vd = v; + gp = vd->cookie; + + switch (cmd) { + /* XXX: check if ptr to implementation is not null */ + case WSDISPLAYIO_GINFO: + return gp->g_wsioctl->ginfo(gp, data); + case WSDISPLAYIO_SMODE: + return gp->g_wsioctl->smode(gp, data); + case WSDISPLAYIO_GMODE: + return gp->g_wsioctl->gmode(gp, data); + case WSDISPLAYIO_GTYPE: + return gp->g_wsioctl->gtype(gp, data); + case WSDISPLAYIO_SVIDEO: + return gp->g_wsioctl->svideo(gp, data); + case WSDISPLAYIO_GVIDEO: + return gp->g_wsioctl->gvideo(gp, data); + case WSDISPLAYIO_GETCMAP: + return gp->g_wsioctl->getcmap(gp, data); + case WSDISPLAYIO_PUTCMAP: + return gp->g_wsioctl->putcmap(gp, data); + } + + return EPASSTHROUGH; +} + +/* wsdisplay_accessops ioctls */ + +int +grf_wsaogetcmap(void *c, void *data) +{ + u_int index, count; + struct grf_softc *gp; + struct wsdisplay_cmap *cm; + + cm = (struct wsdisplay_cmap*) data; + gp = c; + index = 0; + count = 0; + + if (gp->g_wsmode == WSDISPLAYIO_MODE_EMUL) + return EINVAL; + + if (index >= 255 || count > 256 || index + count > 256) + return EINVAL; + + /* + * TODO: copyout values for r, g, b. This function should be + * driver-specific... + */ + + return 0; +} + +int +grf_wsaoputcmap(void *c, void *data) +{ + /* + * We probably couldn't care less about color map in MODE_EMUL, + * I don't know about X11 yet. Also, these ioctls could be used by + * fullscreen console programs (think wsdisplay picture viewer, or + * the wsimgshow tool written by Yasushi Oshima). + */ + struct grf_softc *gp; + + gp = c; + + if (gp->g_wsmode == WSDISPLAYIO_MODE_EMUL) + return EINVAL; + /* ... */ + + return 0; +} + +int +grf_wsaosvideo(void *c, void *data) +{ +#if 0 + struct grf_softc *gp; + dev_t dev; + int rv; + + gp = c; + dev = (dev_t) &gp->g_grfdev; + + if (*(u_int *)data == WSDISPLAYIO_VIDEO_OFF) { + if ((gp->g_flags & GF_GRFON) == 0) + rv = 0; + else { + gp->g_flags &= ~GF_GRFON; + rv = gp->g_mode(gp, (dev & GRFOVDEV) ? + GM_GRFOVOFF : GM_GRFOFF, NULL, 0, 0); + } + + } else { + if ((gp->g_flags & GF_GRFON)) + rv = 0; + else + gp->g_flags |= GF_GRFON; + rv = gp->g_mode(gp, (dev & GRFOVDEV) ? + GM_GRFOVON : GM_GRFON, NULL, 0, 0); + } + + return rv; +#endif + return 0; +} + +int +grf_wsaogvideo(void *c, void *data) +{ + struct grf_softc *gp; + + gp = c; + + if(gp->g_flags & GF_GRFON) + *(u_int *)data = WSDISPLAYIO_VIDEO_ON; + else + *(u_int *)data = WSDISPLAYIO_VIDEO_OFF; + + return 0; +} + +int +grf_wsaogtype(void *c, void *data) +{ + struct grf_softc *gp; + + gp = c; + + *(u_int *)data = WSDISPLAY_TYPE_GRF; + return 0; +} + +int +grf_wsaogmode(void *c, void *data) +{ + struct grf_softc *gp; + + gp = c; + + *(u_int *)data = gp->g_wsmode; + return 0; +} + +int +grf_wsaosmode(void *c, void *data) +{ + /* XXX: should provide hw-dependent impl of this in grf_xxx driver? */ + struct grf_softc *gp; + + gp = c; + + if ((*(int*) data) != gp->g_wsmode) { + gp->g_wsmode = (*(int*) data); + if ((*(int*) data) == WSDISPLAYIO_MODE_EMUL) { + //vcons_redraw_screen( active vcons screen ); + } + } + return 0; +} + +int +grf_wsaoginfo(void *c, void *data) +{ + struct wsdisplay_fbinfo *fbinfo; + struct grf_softc *gp; + struct grfinfo *gi; + + gp = c; + + fbinfo = (struct wsdisplay_fbinfo *)data; + gi = &gp->g_display; + + /* + * TODO: better sanity checking, it is possible that + * wsdisplay is initialized, but no screen is opened + * (for example, device is not used). + */ + + /* + * We shold return truth about current mode here because + * X11 wsfb driver denepds on this! + */ + fbinfo->height = gi->gd_fbheight; + fbinfo->width = gi->gd_fbwidth; + fbinfo->depth = gi->gd_planes; + fbinfo->cmsize = gi->gd_colors; + + return 0; +} + +#endif /* NWSDISPLAY > 0 */ + +#ifdef DEBUG +void +grfdebug(struct grf_softc *gp, const char *fmt, ...) +{ + static int ccol = 0, crow = 1; + volatile char *cp; + char buf[256]; + va_list ap; + int ncols; + char *bp; + + va_start(ap, fmt); + vsnprintf(buf, 256, fmt, ap); + va_end(ap); + + cp = gp->g_fbkva; + ncols = gp->g_display.gd_fbwidth / 8; + cp += (crow * ncols + ccol) << 2; + for (bp = buf; *bp != '\0'; bp++) { + if (*bp == '\n') { + ccol = 0; + crow++; + continue; + } + *cp++ = *bp; + *cp = 0x0a; + cp += 3; + ccol++; + } +} +#endif /* DEBUG */ + #endif /* NGRF > 0 */ diff --git a/sys/arch/amiga/dev/grf_cc.c b/sys/arch/amiga/dev/grf_cc.c index 06ac86bcd88..73f5db26e6d 100644 --- a/sys/arch/amiga/dev/grf_cc.c +++ b/sys/arch/amiga/dev/grf_cc.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_cc.c,v 1.39 2010/12/20 00:25:25 matt Exp $ */ +/* $NetBSD: grf_cc.c,v 1.40 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -31,9 +31,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1.39 2010/12/20 00:25:25 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1.40 2011/12/15 14:25:13 phx Exp $"); #include "grfcc.h" +#include "ite.h" #if NGRFCC > 0 /* * currently this is a backward compat hack that interface to @@ -134,8 +135,10 @@ grfccattach(struct device *pdp, struct device *dp, void *auxp) gp->g_unit = GRF_CC_UNIT; gp->g_flags = GF_ALIVE; gp->g_mode = cc_mode; +#if NITE > 0 gp->g_conpri = grfcc_cnprobe(); grfcc_iteinit(gp); +#endif grf_cc_on(gp); } if (dp != NULL) diff --git a/sys/arch/amiga/dev/grf_cl.c b/sys/arch/amiga/dev/grf_cl.c index 0e8041556b1..6dabbb1eb51 100644 --- a/sys/arch/amiga/dev/grf_cl.c +++ b/sys/arch/amiga/dev/grf_cl.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_cl.c,v 1.45 2009/10/26 19:16:54 cegger Exp $ */ +/* $NetBSD: grf_cl.c,v 1.46 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1997 Klaus Burkert @@ -36,9 +36,10 @@ #include "opt_amigacons.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.45 2009/10/26 19:16:54 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.46 2011/12/15 14:25:13 phx Exp $"); #include "grfcl.h" +#include "ite.h" #if NGRFCL > 0 /* @@ -366,13 +367,17 @@ grfclattach(struct device *pdp, struct device *dp, void *auxp) gp->g_unit = GRF_CL5426_UNIT; gp->g_mode = cl_mode; +#if NITE > 0 gp->g_conpri = grfcl_cnprobe(); +#endif gp->g_flags = GF_ALIVE; /* wakeup the board */ cl_boardinit(gp); #ifdef CL5426CONSOLE +#if NITE > 0 grfcl_iteinit(gp); +#endif (void) cl_load_mon(gp, &clconsole_mode); #endif @@ -1027,7 +1032,9 @@ cl_setmonitor(struct grf_softc *gp, struct grfvideo_mode *gv) clconsole_mode.cols = gv->disp_width / clconsole_mode.fx; if (!(gp->g_flags & GF_GRFON)) cl_load_mon(gp, &clconsole_mode); +#if NITE > 0 ite_reinit(gp->g_itedev); +#endif return (0); } #endif diff --git a/sys/arch/amiga/dev/grf_cv.c b/sys/arch/amiga/dev/grf_cv.c index 4562a856771..2d26f3ce5b5 100644 --- a/sys/arch/amiga/dev/grf_cv.c +++ b/sys/arch/amiga/dev/grf_cv.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_cv.c,v 1.52 2011/06/30 20:09:19 wiz Exp $ */ +/* $NetBSD: grf_cv.c,v 1.53 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1995 Michael Teske @@ -33,9 +33,11 @@ #include "opt_amigacons.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.52 2011/06/30 20:09:19 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.53 2011/12/15 14:25:13 phx Exp $"); #include "grfcv.h" +#include "ite.h" +#include "wsdisplay.h" #if NGRFCV > 0 /* @@ -58,12 +60,22 @@ __KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.52 2011/06/30 20:09:19 wiz Exp $"); #include <sys/malloc.h> #include <sys/systm.h> #include <sys/syslog.h> + #include <machine/cpu.h> + #include <dev/cons.h> +#if NWSDISPLAY > 0 +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsdisplayvar.h> +#include <dev/rasops/rasops.h> +#include <dev/wscons/wsdisplay_vconsvar.h> +#endif + #include <amiga/dev/itevar.h> #include <amiga/amiga/device.h> #include <amiga/amiga/isr.h> #include <amiga/dev/grfioctl.h> +#include <amiga/dev/grfws.h> #include <amiga/dev/grfvar.h> #include <amiga/dev/grf_cvreg.h> #include <amiga/dev/zbusvar.h> @@ -256,6 +268,54 @@ long cv_memclk = 55000000; long cv_memclk = 50000000; #endif +#if NWSDISPLAY > 0 +/* wsdisplay acessops, emulops */ +static void cv_wscursor(void *, int, int, int); +static void cv_wsputchar(void *, int, int, u_int, long); +static void cv_wscopycols(void *, int, int, int, int); +static void cv_wserasecols(void *, int, int, int, long); +static void cv_wscopyrows(void *, int, int, int); +static void cv_wseraserows(void *, int, int, long); +static int cv_wsallocattr(void *, int, int, int, long *); +static int cv_wsmapchar(void *, int, unsigned int *); + +static struct wsdisplay_accessops cv_accessops = { + .ioctl = grf_wsioctl, + .mmap = grf_wsmmap +}; + +static struct wsdisplay_emulops cv_textops = { + .cursor = cv_wscursor, + .mapchar = cv_wsmapchar, + .putchar = cv_wsputchar, + .copycols = cv_wscopycols, + .erasecols = cv_wserasecols, + .copyrows = cv_wscopyrows, + .eraserows = cv_wseraserows, + .allocattr = cv_wsallocattr +}; + +static struct ws_ao_ioctl cv_wsioctl = { + grf_wsaoginfo, + grf_wsaogetcmap, + grf_wsaoputcmap, + grf_wsaogvideo, + grf_wsaosvideo, + grf_wsaogmode, + grf_wsaosmode, + grf_wsaogtype +}; + +static struct wsscreen_descr cv_screen = { + .name = "default", + .textops = &cv_textops, + .fontwidth = 8, + .fontheight = S3FONTY, + .capabilities = WSSCREEN_HILIT | WSSCREEN_BLINK | + WSSCREEN_REVERSE | WSSCREEN_UNDERLINE +}; +#endif /* NWSDISPLAY > 0 */ + /* standard driver stuff */ CFATTACH_DECL(grfcv, sizeof(struct grf_cv_softc), grfcvmatch, grfcvattach, NULL, NULL); @@ -458,7 +518,9 @@ grfcvattach(struct device *pdp, struct device *dp, void *auxp) gp->g_unit = GRF_CV64_UNIT; gp->g_mode = cv_mode; +#if NITE > 0 gp->g_conpri = grfcv_cnprobe(); +#endif gp->g_flags = GF_ALIVE; /* add Interrupt Handler */ @@ -471,7 +533,15 @@ grfcvattach(struct device *pdp, struct device *dp, void *auxp) cv_boardinit(gp); #ifdef CV64CONSOLE +#if NWSDISPLAY > 0 + gp->g_accessops = &cv_accessops; + gp->g_emulops = &cv_textops; + gp->g_defaultscreen = cv_screen; + gp->g_screens[0] = &gp->g_defaultscreen; + gp->g_wsioctl = &cv_wsioctl; +#else grfcv_iteinit(gp); +#endif (void)cv_load_mon(gp, &cvconsole_mode); #endif } @@ -592,7 +662,7 @@ cv_boardinit(struct grf_softc *gp) cv_write_port(0x8008, (volatile char*)ba - 0x02000000); test = RCrt(ba, CRT_ID_SYSTEM_CONFIG); - test = test | 0x01; /* enable enhaced register access */ + test = test | 0x01; /* enable enhanced register access */ test = test & 0xEF; /* clear bit 4, 0 wait state */ WCrt(ba, CRT_ID_SYSTEM_CONFIG, test); @@ -903,8 +973,10 @@ cv_mode(register struct grf_softc *gp, u_long cmd, void *arg, u_long a2, cvscreen(1, (volatile char *)gp->g_regkva - 0x02000000); #else cv_load_mon(gp, &cvconsole_mode); +#if NITE > 0 ite_reinit(gp->g_itedev); #endif +#endif /* CV64CONSOLE */ return (0); case GM_GRFCONFIG: @@ -1005,7 +1077,9 @@ cv_setmonitor(struct grf_softc *gp, struct grfvideo_mode *gv) cvconsole_mode.cols = gv->disp_width / cvconsole_mode.fx; if (!(gp->g_flags & GF_GRFON)) cv_load_mon(gp, &cvconsole_mode); +#if NITE > 0 ite_reinit(gp->g_itedev); +#endif return (0); } #endif @@ -2180,4 +2254,195 @@ cv_getspritemax (struct grf_softc *gp, struct grf_position *pos) #endif /* !CV_NO_HARDWARE_CURSOR */ +#if NWSDISPLAY > 0 + +static void +cv_wscursor(void *c, int on, int row, int col) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile void *ba; + int offs; + + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + ba = gp->g_regkva; + + if ((ri->ri_flg & RI_CURSOR) && !on) { + /* cursor was visible, but we want to remove it */ + /*WCrt(ba, CRT_ID_CURSOR_START, | 0x20);*/ + ri->ri_flg &= ~RI_CURSOR; + } + + ri->ri_crow = row; + ri->ri_ccol = col; + + if (on) { + /* move cursor to new location */ + if (!(ri->ri_flg & RI_CURSOR)) { + /*WCrt(ba, CRT_ID_CURSOR_START, | 0x20);*/ + ri->ri_flg |= RI_CURSOR; + } + offs = gp->g_rowoffset[row] + col; + WCrt(ba, CRT_ID_CURSOR_LOC_LOW, offs & 0xff); + WCrt(ba, CRT_ID_CURSOR_LOC_HIGH, offs >> 8); + } +} + +static void cv_wsputchar(void *c, int row, int col, u_int ch, long attr) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile unsigned char *cp; + + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + cp = gp->g_fbkva; + cp += (gp->g_rowoffset[row] + col) << 2; + *cp++ = ch; + *cp = attr; +} + +static void +cv_wscopycols(void *c, int row, int srccol, int dstcol, int ncols) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *src, *dst; + + KASSERT(ncols > 0); + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + src = dst = gp->g_fbkva; + src += (gp->g_rowoffset[row] + srccol) << 1; + dst += (gp->g_rowoffset[row] + dstcol) << 1; + if (src < dst) { + /* need to copy backwards */ + src += (ncols - 1) << 1; + dst += (ncols - 1) << 1; + while (ncols--) { + *dst = *src; + src -= 2; + dst -= 2; + } + } else + while (ncols--) { + *dst = *src; + src += 2; + dst += 2; + } +} + +static void +cv_wserasecols(void *c, int row, int startcol, int ncols, long fillattr) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *cp; + uint16_t val; + + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + cp = gp->g_fbkva; + val = 0x2000 | fillattr; + cp += (gp->g_rowoffset[row] + startcol) << 1; + while (ncols--) { + *cp = val; + cp += 2; + } +} + +static void +cv_wscopyrows(void *c, int srcrow, int dstrow, int nrows) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *src, *dst; + int n; + + KASSERT(nrows > 0); + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + src = dst = gp->g_fbkva; + n = ri->ri_cols * nrows; + if (src < dst) { + /* need to copy backwards */ + src += gp->g_rowoffset[srcrow + nrows] << 1; + dst += gp->g_rowoffset[dstrow + nrows] << 1; + while (n--) { + src -= 2; + dst -= 2; + *dst = *src; + } + } else { + src += gp->g_rowoffset[srcrow] << 1; + dst += gp->g_rowoffset[dstrow] << 1; + while (n--) { + *dst = *src; + src += 2; + dst += 2; + } + } +} + +static void +cv_wseraserows(void *c, int row, int nrows, long fillattr) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *cp; + int n; + uint16_t val; + + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + cp = gp->g_fbkva; + val = 0x2000 | fillattr; + cp += gp->g_rowoffset[row] << 1; + n = ri->ri_cols * nrows; + while (n--) { + *cp = val; + cp += 2; + } +} + +static int +cv_wsallocattr(void *c, int fg, int bg, int flg, long *attr) +{ + + /* XXX color support? */ + *attr = (flg & WSATTR_REVERSE) ? 0x70 : 0x07; + if (flg & WSATTR_UNDERLINE) *attr = 0x01; + if (flg & WSATTR_HILIT) *attr |= 0x08; + if (flg & WSATTR_BLINK) *attr |= 0x80; + return 0; +} + +/* our font does not support unicode extensions */ +static int +cv_wsmapchar(void *c, int ch, unsigned int *cp) +{ + + if (ch > 0 && ch < 256) { + *cp = ch; + return 5; + } + *cp = ' '; + return 0; +} + +#endif /* NWSDISPLAY > 0 */ + #endif /* NGRFCV */ diff --git a/sys/arch/amiga/dev/grf_cv3d.c b/sys/arch/amiga/dev/grf_cv3d.c index 77749004a28..5c601252860 100644 --- a/sys/arch/amiga/dev/grf_cv3d.c +++ b/sys/arch/amiga/dev/grf_cv3d.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_cv3d.c,v 1.25 2009/10/26 19:16:54 cegger Exp $ */ +/* $NetBSD: grf_cv3d.c,v 1.26 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1995 Michael Teske @@ -33,8 +33,10 @@ #include "opt_amigacons.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.25 2009/10/26 19:16:54 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.26 2011/12/15 14:25:13 phx Exp $"); +#include "ite.h" +#include "wsdisplay.h" #include "grfcv3d.h" #if NGRFCV3D > 0 @@ -81,15 +83,28 @@ Note: IO Regbase is needed fo wakeup of the board otherwise use #include <sys/device.h> #include <sys/malloc.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kauth.h> #include <machine/cpu.h> #include <dev/cons.h> + +#if NWSDISPLAY > 0 +#include <dev/wscons/wsdisplayvar.h> +#include <dev/wscons/wsconsio.h> +#include <dev/wsfont/wsfont.h> +#include <dev/rasops/rasops.h> +#include <dev/wscons/wsdisplay_vconsvar.h> +#endif + #include <amiga/dev/itevar.h> #include <amiga/amiga/device.h> #include <amiga/dev/grfioctl.h> +#include <amiga/dev/grfws.h> #include <amiga/dev/grfvar.h> #include <amiga/dev/grf_cv3dreg.h> #include <amiga/dev/zbusvar.h> + /* * finish all bus operations, flush pipelines */ @@ -130,6 +145,7 @@ int cv3d_setspriteinfo(struct grf_softc *,struct grf_spriteinfo *); int cv3d_getspritemax(struct grf_softc *,struct grf_position *); #endif /* CV3D_HARDWARE_CURSOR */ + /* Graphics display definitions. * These are filled by 'grfconfig' using GRFIOCSETMON. */ @@ -272,6 +288,54 @@ static volatile void *cv3d_special_register_base; */ long cv3d_memclk = 55000000; +#if NWSDISPLAY > 0 +/* wsdisplay accessops, emulops */ +static void cv3d_wscursor(void *, int, int, int); +static void cv3d_wsputchar(void *, int, int, u_int, long); +static void cv3d_wscopycols(void *, int, int, int, int); +static void cv3d_wserasecols(void *, int, int, int, long); +static void cv3d_wscopyrows(void *, int, int, int); +static void cv3d_wseraserows(void *, int, int, long); +static int cv3d_wsallocattr(void *, int, int, int, long *); +static int cv3d_wsmapchar(void *, int, unsigned int *); + +struct wsdisplay_accessops cv3d_accessops = { + .ioctl = grf_wsioctl, + .mmap = grf_wsmmap +}; + +static struct wsdisplay_emulops cv3d_textops = { + .cursor = cv3d_wscursor, + .mapchar = cv3d_wsmapchar, + .putchar = cv3d_wsputchar, + .copycols = cv3d_wscopycols, + .copyrows = cv3d_wscopyrows, + .erasecols = cv3d_wserasecols, + .eraserows = cv3d_wseraserows, + .allocattr = cv3d_wsallocattr +}; + +static struct ws_ao_ioctl cv3d_wsioctl = { + grf_wsaoginfo, + grf_wsaogetcmap, + grf_wsaoputcmap, + grf_wsaogvideo, + grf_wsaosvideo, + grf_wsaogmode, + grf_wsaosmode, + grf_wsaogtype +}; + +static struct wsscreen_descr cv3d_screen = { + .name = "default", + .textops = &cv3d_textops, + .fontwidth = 8, + .fontheight = S3FONTY, + .capabilities = WSSCREEN_HILIT | WSSCREEN_REVERSE | + WSSCREEN_BLINK | WSSCREEN_UNDERLINE +}; +#endif /* NWSDISPLAY > 0 */ + /* standard driver stuff */ CFATTACH_DECL(grfcv3d, sizeof(struct grf_softc), grfcv3dmatch, grfcv3dattach, NULL, NULL); @@ -418,15 +482,25 @@ grfcv3dattach(struct device *pdp, struct device *dp, void *auxp) gp->g_unit = GRF_CV3D_UNIT; gp->g_mode = cv3d_mode; +#if NITE > 0 gp->g_conpri = grfcv3d_cnprobe(); +#endif gp->g_flags = GF_ALIVE; /* wakeup the board */ cv3d_boardinit(gp); #ifdef CV3DCONSOLE +#if NWSDISPLAY > 0 + gp->g_accessops = &cv3d_accessops; + gp->g_emulops = &cv3d_textops; + gp->g_defaultscreen = cv3d_screen; + gp->g_screens[0] = &gp->g_defaultscreen; + gp->g_wsioctl = &cv3d_wsioctl; +#else grfcv3d_iteinit(gp); - (void)cv3d_load_mon(gp, &cv3dconsole_mode); +#endif /* NWSDISPLAY > 0 */ + (void)cv3d_load_mon(gp, &cv3dconsole_mode); #endif } @@ -828,8 +902,10 @@ cv3d_mode(register struct grf_softc *gp, u_long cmd, void *arg, u_long a2, cv3dscreen(1, cv3d_vcode_switch_base); #else cv3d_load_mon(gp, &cv3dconsole_mode); +#if NITE > 0 ite_reinit(gp->g_itedev); #endif +#endif return (0); case GM_GRFCONFIG: @@ -930,7 +1006,9 @@ cv3d_setmonitor(struct grf_softc *gp, struct grfvideo_mode *gv) cv3dconsole_mode.cols = gv->disp_width / cv3dconsole_mode.fx; if (!(gp->g_flags & GF_GRFON)) cv3d_load_mon(gp, &cv3dconsole_mode); +#if NITE > 0 ite_reinit(gp->g_itedev); +#endif return (0); } #endif @@ -2044,4 +2122,196 @@ cv3d_getspritemax(struct grf_softc *gp, struct grf_position *pos) #endif /* CV3D_HARDWARE_CURSOR */ +#if NWSDISPLAY > 0 + +static void +cv3d_wscursor(void *c, int on, int row, int col) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile void *ba; + int offs; + + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + ba = gp->g_regkva; + + if ((ri->ri_flg & RI_CURSOR) && !on) { + /* cursor was visible, but we want to remove it */ + /*WCrt(ba, CRT_ID_CURSOR_START, | 0x20);*/ + ri->ri_flg &= ~RI_CURSOR; + } + + ri->ri_crow = row; + ri->ri_ccol = col; + + if (on) { + /* move cursor to new location */ + if (!(ri->ri_flg & RI_CURSOR)) { + /*WCrt(ba, CRT_ID_CURSOR_START, | 0x20);*/ + ri->ri_flg |= RI_CURSOR; + } + offs = gp->g_rowoffset[row] + col; + WCrt(ba, CRT_ID_CURSOR_LOC_LOW, offs & 0xff); + WCrt(ba, CRT_ID_CURSOR_LOC_HIGH, offs >> 8); + } +} + +static void +cv3d_wsputchar(void *cookie, int row, int col, u_int ch, long attr) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile unsigned char *cp; + + ri = cookie; + scr = ri->ri_hw; + gp = scr->scr_cookie; + cp = gp->g_fbkva; + cp += (gp->g_rowoffset[row] + col) << 2; + *cp++ = ch; + *cp = attr; +} + +static void +cv3d_wscopycols(void *c, int row, int srccol, int dstcol, int ncols) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *src, *dst; + + KASSERT(ncols > 0); + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + src = dst = gp->g_fbkva; + src += (gp->g_rowoffset[row] + srccol) << 1; + dst += (gp->g_rowoffset[row] + dstcol) << 1; + if (src < dst) { + /* need to copy backwards */ + src += (ncols - 1) << 1; + dst += (ncols - 1) << 1; + while (ncols--) { + *dst = *src; + src -= 2; + dst -= 2; + } + } else + while (ncols--) { + *dst = *src; + src += 2; + dst += 2; + } +} + +static void +cv3d_wserasecols(void *c, int row, int startcol, int ncols, long fillattr) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *cp; + uint16_t val; + + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + cp = gp->g_fbkva; + val = 0x2000 | fillattr; + cp += (gp->g_rowoffset[row] + startcol) << 1; + while (ncols--) { + *cp = val; + cp += 2; + } +} + +static void +cv3d_wscopyrows(void *c, int srcrow, int dstrow, int nrows) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *src, *dst; + int n; + + KASSERT(nrows > 0); + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + src = dst = gp->g_fbkva; + n = ri->ri_cols * nrows; + if (src < dst) { + /* need to copy backwards */ + src += gp->g_rowoffset[srcrow + nrows] << 1; + dst += gp->g_rowoffset[dstrow + nrows] << 1; + while (n--) { + src -= 2; + dst -= 2; + *dst = *src; + } + } else { + src += gp->g_rowoffset[srcrow] << 1; + dst += gp->g_rowoffset[dstrow] << 1; + while (n--) { + *dst = *src; + src += 2; + dst += 2; + } + } +} + +static void +cv3d_wseraserows(void *c, int row, int nrows, long fillattr) +{ + struct rasops_info *ri; + struct vcons_screen *scr; + struct grf_softc *gp; + volatile uint16_t *cp; + int n; + uint16_t val; + + ri = c; + scr = ri->ri_hw; + gp = scr->scr_cookie; + cp = gp->g_fbkva; + val = 0x2000 | fillattr; + cp += gp->g_rowoffset[row] << 1; + n = ri->ri_cols * nrows; + while (n--) { + *cp = val; + cp += 2; + } +} + +/* our font does not support unicode extensions */ +static int +cv3d_wsmapchar(void *c, int ch, unsigned int *cp) +{ + + if (ch > 0 && ch < 256) { + *cp = ch; + return 5; + } + *cp = ' '; + return 0; +} + +static int +cv3d_wsallocattr(void *c, int fg, int bg, int flg, long *attr) +{ + + /* XXX color support? */ + *attr = (flg & WSATTR_REVERSE) ? 0x70 : 0x07; + if (flg & WSATTR_UNDERLINE) *attr = 0x01; + if (flg & WSATTR_HILIT) *attr |= 0x08; + if (flg & WSATTR_BLINK) *attr |= 0x80; + return 0; +} + +#endif /* NWSDISPLAY > 0 */ + #endif /* NGRFCV3D */ diff --git a/sys/arch/amiga/dev/grf_cv3dreg.h b/sys/arch/amiga/dev/grf_cv3dreg.h index 7aa42ea1ee8..876ded8bb73 100644 --- a/sys/arch/amiga/dev/grf_cv3dreg.h +++ b/sys/arch/amiga/dev/grf_cv3dreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: grf_cv3dreg.h,v 1.9 2007/03/05 19:48:19 he Exp $ */ +/* $NetBSD: grf_cv3dreg.h,v 1.10 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1995 Michael Teske @@ -35,7 +35,7 @@ #define _GRF_CV3DREG_H /* - * This is derived from ciruss driver source + * This is derived from Cirrus driver source. */ /* Extension to grfvideo_mode to support text modes. @@ -55,10 +55,6 @@ struct grfcv3dtext_mode { unsigned short fdend; }; -/* maximum console size */ -#define MAXROWS 200 -#define MAXCOLS 200 - /* read VGA register */ #define vgar(ba, reg) \ *(((volatile char *)ba)+(reg ^ 3)) diff --git a/sys/arch/amiga/dev/grf_cvreg.h b/sys/arch/amiga/dev/grf_cvreg.h index be7c0ab50dd..9298bc3dfb2 100644 --- a/sys/arch/amiga/dev/grf_cvreg.h +++ b/sys/arch/amiga/dev/grf_cvreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: grf_cvreg.h,v 1.17 2011/05/21 14:49:35 christos Exp $ */ +/* $NetBSD: grf_cvreg.h,v 1.18 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1995 Michael Teske @@ -37,7 +37,7 @@ #include <machine/cpu.h> /* - * This is derived from ciruss driver source + * This is derived from Cirrus driver source */ /* Extension to grfvideo_mode to support text modes. @@ -57,10 +57,6 @@ struct grfcvtext_mode { unsigned short fdend; }; -/* maximum console size */ -#define MAXROWS 200 -#define MAXCOLS 200 - /* read VGA register */ #define vgar(ba, reg) \ @@ -443,4 +439,4 @@ RGfx(ba, idx) } #endif -#endif /* _GRF_RHREG_H */ +#endif /* _GRF_CVREG_H */ diff --git a/sys/arch/amiga/dev/grf_et.c b/sys/arch/amiga/dev/grf_et.c index 87c666ea75b..e81834e7093 100644 --- a/sys/arch/amiga/dev/grf_et.c +++ b/sys/arch/amiga/dev/grf_et.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_et.c,v 1.28 2009/10/26 19:16:54 cegger Exp $ */ +/* $NetBSD: grf_et.c,v 1.29 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1997 Klaus Burkert @@ -37,9 +37,10 @@ #include "opt_amigacons.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.28 2009/10/26 19:16:54 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.29 2011/12/15 14:25:13 phx Exp $"); #include "grfet.h" +#include "ite.h" #if NGRFET > 0 /* @@ -300,14 +301,18 @@ grfetattach(struct device *pdp, struct device *dp, void *auxp) gp->g_unit = GRF_ET4000_UNIT; gp->g_mode = et_mode; +#if NITE > 0 gp->g_conpri = grfet_cnprobe(); +#endif gp->g_flags = GF_ALIVE; /* wakeup the board */ et_boardinit(gp); #ifdef TSENGCONSOLE +#if NITE > 0 grfet_iteinit(gp); +#endif (void) et_load_mon(gp, &etconsole_mode); #endif } @@ -804,7 +809,9 @@ et_setmonitor(struct grf_softc *gp, struct grfvideo_mode *gv) etconsole_mode.cols = gv->disp_width / etconsole_mode.fx; if (!(gp->g_flags & GF_GRFON)) et_load_mon(gp, &etconsole_mode); +#if NITE > 0 ite_reinit(gp->g_itedev); +#endif return (0); } #endif diff --git a/sys/arch/amiga/dev/grf_rh.c b/sys/arch/amiga/dev/grf_rh.c index fb6c6bdc8e6..439272db524 100644 --- a/sys/arch/amiga/dev/grf_rh.c +++ b/sys/arch/amiga/dev/grf_rh.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_rh.c,v 1.53 2009/10/26 19:16:54 cegger Exp $ */ +/* $NetBSD: grf_rh.c,v 1.54 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1994 Markus Wild @@ -34,9 +34,10 @@ #include "opt_retina.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.53 2009/10/26 19:16:54 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.54 2011/12/15 14:25:13 phx Exp $"); #include "grfrh.h" +#include "ite.h" #if NGRFRH > 0 /* @@ -1598,9 +1599,11 @@ grfrhattach(struct device *pdp, struct device *dp, void *auxp) gp->g_fbkva = (volatile char *)zap->va + LM_OFFSET; gp->g_unit = GRF_RETINAIII_UNIT; gp->g_mode = rh_mode; - gp->g_conpri = grfrh_cnprobe(); gp->g_flags = GF_ALIVE; +#if NITE > 0 + gp->g_conpri = grfrh_cnprobe(); grfrh_iteinit(gp); +#endif (void)rh_load_mon(gp, current_mon); } if (dp != NULL) diff --git a/sys/arch/amiga/dev/grf_rt.c b/sys/arch/amiga/dev/grf_rt.c index b79f7b5fec5..744f94f046c 100644 --- a/sys/arch/amiga/dev/grf_rt.c +++ b/sys/arch/amiga/dev/grf_rt.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_rt.c,v 1.54 2009/10/26 19:16:54 cegger Exp $ */ +/* $NetBSD: grf_rt.c,v 1.55 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1993 Markus Wild @@ -33,9 +33,10 @@ #include "opt_amigacons.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_rt.c,v 1.54 2009/10/26 19:16:54 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_rt.c,v 1.55 2011/12/15 14:25:13 phx Exp $"); #include "grfrt.h" +#include "ite.h" #if NGRFRT > 0 /* Graphics routines for the Retina board, @@ -864,8 +865,10 @@ grfrtattach(struct device *pdp, struct device *dp, void *auxp) gp->g_unit = GRF_RETINAII_UNIT; gp->g_flags = GF_ALIVE; gp->g_mode = rt_mode; +#if NITE > 0 gp->g_conpri = grfrt_cnprobe(); grfrt_iteinit(gp); +#endif (void)rt_load_mon(gp, current_mon); } if (dp != NULL) diff --git a/sys/arch/amiga/dev/grf_ul.c b/sys/arch/amiga/dev/grf_ul.c index 92ce382bc0f..81dd212793f 100644 --- a/sys/arch/amiga/dev/grf_ul.c +++ b/sys/arch/amiga/dev/grf_ul.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_ul.c,v 1.46 2009/10/26 19:16:54 cegger Exp $ */ +/* $NetBSD: grf_ul.c,v 1.47 2011/12/15 14:25:13 phx Exp $ */ #define UL_DEBUG /*- @@ -33,9 +33,10 @@ #include "opt_amigacons.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: grf_ul.c,v 1.46 2009/10/26 19:16:54 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_ul.c,v 1.47 2011/12/15 14:25:13 phx Exp $"); #include "grful.h" +#include "ite.h" #if NGRFUL > 0 /* Graphics routines for the University of Lowell A2410 board, @@ -529,7 +530,9 @@ grfulattach(struct device *pdp, struct device *dp, void *auxp) gp->g_unit = GRF_ULOWELL_UNIT; gp->g_flags = GF_ALIVE; gp->g_mode = ul_mode; +#if NITE > 0 gp->g_conpri = grful_cnprobe(); +#endif gp->g_data = NULL; gup->gus_isr.isr_ipl = 2; @@ -539,7 +542,9 @@ grfulattach(struct device *pdp, struct device *dp, void *auxp) (void)ul_load_code(gp); (void)ul_load_mon(gp, current_mon); +#if NITE > 0 grful_iteinit(gp); +#endif } if (dp != NULL) printf("\n"); diff --git a/sys/arch/amiga/dev/grfvar.h b/sys/arch/amiga/dev/grfvar.h index 2e0c825e403..9319195acfb 100644 --- a/sys/arch/amiga/dev/grfvar.h +++ b/sys/arch/amiga/dev/grfvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: grfvar.h,v 1.22 2011/02/08 20:20:08 rmind Exp $ */ +/* $NetBSD: grfvar.h,v 1.23 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -41,30 +41,48 @@ struct ite_softc; #ifdef _KERNEL +/* maximum console size */ +#define MAXROWS 200 +#define MAXCOLS 200 + /* * this struct is owned by the driver (grfcc, grfrt) * and is passed to grf when grf is configed. The ite also * uses it... */ struct grf_softc { - struct device g_device; /* config sets this up. */ - struct grfinfo g_display; /* hardware description (for ioctl) */ - volatile void *g_regkva; /* KVA of registers */ - volatile void *g_fbkva; /* KVA of framebuffer */ - int g_flags; /* software flags */ - int g_unit; /* grf unit we want/have */ - dev_t g_itedev; /* ite device number */ - dev_t g_grfdev; /* grf device number */ - void *g_data; /* device dependent data */ - int (*g_mode)(struct grf_softc *, u_long, void *, u_long, int); - int g_conpri; /* priority of ite as console */ - void (*g_iteinit)(struct ite_softc *); - void (*g_itedeinit)(struct ite_softc *); - void (*g_iteclear)(struct ite_softc *, int, int, int, int); - void (*g_iteputc)(struct ite_softc *, int, int, int, int); - void (*g_itecursor)(struct ite_softc *, int); - void (*g_itescroll)(struct ite_softc *, int, int, int, int); - int g_blank; /* shadow copy of blank value */ + struct device g_device; /* config sets this up. */ + struct grfinfo g_display; /* hardware description (for ioctl) */ + volatile void *g_regkva; /* KVA of registers */ + volatile void *g_fbkva; /* KVA of framebuffer */ + int g_flags; /* software flags */ + int g_unit; /* grf unit we want/have */ + dev_t g_itedev; /* ite device number */ + dev_t g_grfdev; /* grf device number */ + void *g_data; /* device dependent data */ + int g_blank; /* shadow copy of blank value */ + int (*g_mode)(struct grf_softc *, u_long, void *, + u_long, int); +#if NWSDISPLAY > 0 + struct wsdisplay_accessops *g_accessops; + struct wsdisplay_emulops *g_emulops; + struct wsscreen_descr g_defaultscreen; + struct wsscreen_descr *g_screens[1]; + struct wsscreen_list g_screenlist; + struct vcons_data g_vd; + struct ws_ao_ioctl *g_wsioctl; + uint16_t g_rowoffset[MAXROWS]; /* speed up putchar-multiplication */ + int g_wsmode; /* current wsdisplay mode */ + +#else + int g_conpri; /* priority of ite as console */ + void (*g_iteinit)(struct ite_softc *); + void (*g_itedeinit)(struct ite_softc *); + void (*g_iteclear)(struct ite_softc *, int, int, int, int); + void (*g_iteputc)(struct ite_softc *, int, int, int, int); + void (*g_itecursor)(struct ite_softc *, int); + void (*g_itescroll)(struct ite_softc *, int, int, int, int); +#endif /* NWSDISPLAY */ }; #endif /* _KERNEL */ @@ -74,6 +92,7 @@ struct grf_softc { #define GF_EXCLUDE 0x04 #define GF_WANTED 0x08 #define GF_GRFON 0x10 +#define GF_CONSOLE 0x20 /* software ids defined in grfioctl.h */ diff --git a/sys/arch/amiga/dev/grfws.h b/sys/arch/amiga/dev/grfws.h new file mode 100644 index 00000000000..17c44f73c72 --- /dev/null +++ b/sys/arch/amiga/dev/grfws.h @@ -0,0 +1,73 @@ +/* $NetBSD: grfws.h,v 1.1 2011/12/15 14:25:13 phx Exp $ */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Frank Wille and Radoslaw Kujawa. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _AMIGA_GRFWS_H_ +#if NWSDISPLAY > 0 + +/* + * Structure holding pointers to hw-dependent implementations of access op. + * This struct should be filled during driver initialization and later used + * in wsdisplay part of grf.c. + */ +struct ws_ao_ioctl { + int (*ginfo)(void *, void *); + int (*getcmap)(void *, void *); + int (*putcmap)(void *, void *); + int (*gvideo)(void *, void *); + int (*svideo)(void *, void *); + int (*gmode)(void *, void *); + int (*smode)(void *, void *); + int (*gtype)(void *, void *); +}; + +/* + * Generic wsdisplay access ops that should be used from most grf drivers + * (if running in wscons mode, not ite). + * + * Implementation in grf.c. + */ +paddr_t grf_wsmmap(void *, void *, off_t, int); +int grf_wsioctl(void *, void *, u_long, void *, int, struct lwp *); + +/* + * Generic access ops ioctls. + */ +int grf_wsaoginfo(void *, void *); +int grf_wsaogetcmap(void *, void *); +int grf_wsaoputcmap(void *, void *); +int grf_wsaogvideo(void *, void *); +int grf_wsaosvideo(void *, void *); +int grf_wsaogmode(void *, void *); +int grf_wsaosmode(void *, void *); +int grf_wsaogtype(void *, void *); + +#endif /* NWSDISPLAY > 0 */ +#endif /* _AMIGA_GRFWS_H_ */ diff --git a/sys/arch/amiga/dev/ite.c b/sys/arch/amiga/dev/ite.c index f7e671d967a..8dbe0ed9330 100644 --- a/sys/arch/amiga/dev/ite.c +++ b/sys/arch/amiga/dev/ite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.92 2011/04/24 16:26:52 rmind Exp $ */ +/* $NetBSD: ite.c,v 1.93 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -46,7 +46,7 @@ #include "opt_ddb.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.92 2011/04/24 16:26:52 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.93 2011/12/15 14:25:13 phx Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -254,11 +254,6 @@ void itecnprobe(struct consdev *cd) { /* - * bring graphics layer up. - */ - config_console(); - - /* * return priority of the best ite (already picked from attach) * or CN_DEAD. */ diff --git a/sys/dev/wscons/wsconsio.h b/sys/dev/wscons/wsconsio.h index 7dcc513cd3d..e7c2e33204b 100644 --- a/sys/dev/wscons/wsconsio.h +++ b/sys/dev/wscons/wsconsio.h @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.100 2011/07/21 10:33:17 tsutsui Exp $ */ +/* $NetBSD: wsconsio.h,v 1.101 2011/12/15 14:25:13 phx Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -324,6 +324,7 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_DL 49 /* DisplayLink DL-1x0/DL-1x5 */ #define WSDISPLAY_TYPE_XVR1000 50 /* Sun XVR-1000 */ #define WSDISPLAY_TYPE_LUNA 51 /* OMRON SX-9100 LUNA */ +#define WSDISPLAY_TYPE_GRF 52 /* wsdisplay on top of grf(4) */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo { |
