Add a support for gpx(4) color framebuffer found on VAXstation 3100.

Poted from OpenBSD/vax. Note smg(4) monochrome onboard framebuffer
driver is also changed attached only if gpx(4) is not installed
or flags 1 is specified in config files, as OpenBSD did.

Tested on my VAXstation 3100/m30 with and without 8bpp gpx(4).
Revied on port-vax@ and "Please go ahead!" from ragge@.
 https://mail-index.netbsd.org/port-vax/2023/01/thread1.html#004147

Worth to pullup to netbsd-10.
This commit is contained in:
tsutsui 2023-02-06 13:13:05 +00:00
parent caf73dab9c
commit 3fd8a3268a
8 changed files with 1482 additions and 45 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.216 2022/09/29 10:10:10 riastradh Exp $
# $NetBSD: GENERIC,v 1.217 2023/02/06 13:13:05 tsutsui Exp $
#
# GENERIC machine description file
#
@ -22,7 +22,7 @@ include "arch/vax/conf/std.vax"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC-$Revision: 1.216 $"
#ident "GENERIC-$Revision: 1.217 $"
# Here are all different supported CPU types listed.
#options VAX8800 # VAX 8500, 8530, 8550, 8700, 8800
@ -185,6 +185,7 @@ si1 at vsbus0 csr 0x200c0180 # VS2000/3100 SCSI-ctlr
asc0 at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
asc0 at vsbus0 csr 0x26000080 # VS4000/90 and 4000/10x SCSI-ctlr
smg0 at vsbus0 csr 0x200f0000 # Small monochrome display ctlr.
gpx0 at vsbus0 csr 0x3c000000 # VS3100 GPX display option
#clr0 at vsbus0 csr 0x30000000 # 4- or 8-bitplans color graphics
spx0 at vsbus0 csr 0x38000000 # Low Cost SPX on VS4000/90.
lcg0 at vsbus0 csr 0x21801000 # VS4000/60 (or VLC) graphics
@ -271,6 +272,7 @@ uk* at scsibus? target? lun?
# VAXstation graphics support
wsdisplay* at smg0
wsdisplay* at gpx0
wsdisplay* at spx0
wsdisplay* at lcg0
#wsdisplay* at clr0

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL,v 1.75 2020/01/20 18:38:21 thorpej Exp $
# $NetBSD: INSTALL,v 1.76 2023/02/06 13:13:05 tsutsui Exp $
#
# INSTALL kernel; all supported devices but nothing fancy.
#
@ -139,6 +139,7 @@ si1 at vsbus0 csr 0x200c0180 # VS2000/3100 SCSI-ctlr
asc0 at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
asc0 at vsbus0 csr 0x26000080 # VS4000/90 and 4000/10x SCSI-ctlr
smg0 at vsbus0 csr 0x200f0000 # Small monochrome display ctlr.
gpx0 at vsbus0 csr 0x3c000000 # VS3100 GPX display option
#clr0 at vsbus0 csr 0x30000000 # 4- or 8-bitplans color graphics
spx0 at vsbus0 csr 0x38000000 # Low Cost SPX on VS4000/90.
#lcg0 at vsbus0 csr 0x21801000 # VS4000/60 (or VLC) graphics
@ -217,6 +218,7 @@ cd* at scsibus? target? lun?
# VAXstation graphics support
wsdisplay* at smg0
wsdisplay* at gpx0
wsdisplay* at spx0
#wsdisplay* at lcg0
#wsdisplay* at clr0

View File

@ -1,4 +1,4 @@
# $NetBSD: VAX780,v 1.33 2022/08/07 02:52:30 simonb Exp $
# $NetBSD: VAX780,v 1.34 2023/02/06 13:13:05 tsutsui Exp $
#
# 11/780,750,730 machine description file
#
@ -171,6 +171,7 @@ ubi0 at mainbus0 # 11/730 direct unibus
#asc0 at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
#asc0 at vsbus0 csr 0x26000080 # VS4000/90 and 4000/10x SCSI-ctlr
#smg0 at vsbus0 csr 0x200f0000 # Small monochrome display ctlr.
#gpx0 at vsbus0 csr 0x3c000000 # VS3100 GPX display option
#clr0 at vsbus0 csr 0x30000000 # 4- or 8-bitplans color graphics
#spx0 at vsbus0 csr 0x38000000 # Low Cost SPX on VS4000/90.
#lcg0 at vsbus0 csr 0x21801000 # VS4000/60 (or VLC) graphics
@ -251,6 +252,7 @@ mt* at mscpbus? drive? # MSCP tape
# VAXstation graphics support
#wsdisplay* at smg0
#wsdisplay* at gpx0
#wsdisplay* at spx0
#wsdisplay* at lcg0
#wsdisplay* at clr0

View File

@ -1,4 +1,4 @@
# $NetBSD: files.vax,v 1.125 2018/12/29 11:30:12 maxv Exp $
# $NetBSD: files.vax,v 1.126 2023/02/06 13:13:05 tsutsui Exp $
#
# new style config file for vax architecture
#
@ -149,7 +149,7 @@ attach cpu at xmi with cpu_xmi
attach mem at xmi with mem_xmi
attach dz at vsbus with dz_vsbus
file arch/vax/vsa/dz_vsbus.c dz_vsbus | smg
file arch/vax/vsa/dz_vsbus.c dz_vsbus | smg | gpx
attach lkkbd at dz with dzkbd
file dev/dec/dzkbd.c dzkbd needs-flag
@ -190,6 +190,11 @@ device smg: displaydev, wsemuldisplaydev
attach smg at vsbus
file arch/vax/vsa/smg.c smg needs-flag
# GPX framebuffer on VS3100.
device gpx: displaydev, wsemuldisplaydev, rasops8
attach gpx at vsbus
file arch/vax/vsa/gpx.c gpx needs-flag
# Monochrome QVSS framebuffer on qbus (VCB01)
device qv {}: displaydev, wsemuldisplaydev
attach qv at uba

View File

@ -1,4 +1,4 @@
/* $NetBSD: qdreg.h,v 1.6 2021/08/17 22:00:31 andvar Exp $ */
/* $NetBSD: qdreg.h,v 1.7 2023/02/06 13:13:05 tsutsui Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@ -172,10 +172,12 @@
/* VIPER logical function unit codes */
#define LF_ZEROS 0x0000
#define LF_NOT_D 0x0003
#define LF_D_XOR_S 0x0006
#define LF_SOURCE 0x000A
#define LF_D_OR_S 0x000E
#define LF_ONES 0x000F
#define LF_SOURCE 0x000a
#define LF_D 0x000c
#define LF_D_OR_S 0x000d
#define LF_ONES 0x000f
#define INV_M1_M2 0x0030
#define FULL_SRC_RESOLUTION 0X00C0 /* makes second pass like first pass */

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.68 2015/07/05 02:10:53 matt Exp $ */
/* $NetBSD: conf.c,v 1.69 2023/02/06 13:13:05 tsutsui Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.68 2015/07/05 02:10:53 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.69 2023/02/06 13:13:05 tsutsui Exp $");
#include "opt_cputype.h"
@ -45,12 +45,28 @@ __KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.68 2015/07/05 02:10:53 matt Exp $");
*/
#include <dev/cons.h>
#include "gpx.h"
#include "lcg.h"
#include "qv.h"
#include "smg.h"
#include "spx.h"
#include "wskbd.h"
#if NGPX > 0
#if NWSKBD > 0
#define gpxcngetc wskbd_cngetc
#else
static int
gpxcngetc(dev_t dev)
{
return 0;
}
#endif
#define gpxcnputc wsdisplay_cnputc
#define gpxcnpollc nullcnpollc
#endif /* NGPX > 0 */
#if NLCG > 0
#if NWSKBD > 0
#define lcgcngetc wskbd_cngetc
@ -110,6 +126,7 @@ spxcngetc(dev_t dev)
cons_decl(gen);
cons_decl(dz);
cons_decl(gpx);
cons_decl(qd);
cons_decl(lcg);
cons_decl(qv);
@ -133,6 +150,9 @@ struct consdev constab[]={
cons_init(qd),
#endif
#endif
#if NGPX
cons_init(gpx),
#endif
#if NLCG
cons_init(lcg),
#endif

1361
sys/arch/vax/vsa/gpx.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: smg.c,v 1.62 2023/01/13 19:45:45 tsutsui Exp $ */
/* $NetBSD: smg.c,v 1.63 2023/02/06 13:13:05 tsutsui Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -25,7 +25,11 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.62 2023/01/13 19:45:45 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.63 2023/02/06 13:13:05 tsutsui Exp $");
#include "opt_wsfont.h"
#include "dzkbd.h"
#include "wsdisplay.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -40,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.62 2023/01/13 19:45:45 tsutsui Exp $");
#include <machine/vsbus.h>
#include <machine/sid.h>
#include <machine/ka420.h>
#include <machine/scb.h>
#include <dev/cons.h>
@ -52,9 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.62 2023/01/13 19:45:45 tsutsui Exp $");
#include <dev/wscons/wscons_callbacks.h>
#include <dev/wsfont/wsfont.h>
#include "dzkbd.h"
#include "opt_wsfont.h"
/* Screen hardware defs */
#define SM_COLS 128 /* char width of screen */
#define SM_ROWS 57 /* rows of char on screen */
@ -187,34 +189,67 @@ static struct smg_screen *curscr;
static callout_t smg_cursor_ch;
int
smg_match(device_t parent, cfdata_t match, void *aux)
smg_match(device_t parent, cfdata_t cf, void *aux)
{
struct vsbus_attach_args * const va = aux;
volatile uint16_t *ccmd;
volatile uint16_t *cfgtst;
uint16_t tmp, tmp2;
if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_53)
switch (vax_boardtype) {
default:
return 0;
ccmd = (uint16_t *)va->va_addr;
cfgtst = (uint16_t *)vax_map_physmem(VS_CFGTST, 1);
/*
* Try to find the cursor chip by testing the flip-flop.
* If nonexistent, no glass tty.
*/
ccmd[0] = CUR_CMD_HSHI|CUR_CMD_FOPB;
DELAY(300000);
tmp = cfgtst[0];
ccmd[0] = CUR_CMD_TEST|CUR_CMD_HSHI;
DELAY(300000);
tmp2 = cfgtst[0];
vax_unmap_physmem((vaddr_t)cfgtst, 1);
case VAX_BTYP_410:
case VAX_BTYP_420:
case VAX_BTYP_43:
if (va->va_paddr != KA420_CUR_BASE)
return 0;
if (tmp2 != tmp)
return 20; /* Using periodic interrupt */
else
return 0;
/* not present on microvaxes */
if ((vax_confdata & KA420_CFG_MULTU) != 0)
return 0;
/*
* If the color option board is present, do not attach
* unless we are explicitely asked to via device flags.
*/
if ((vax_confdata & KA420_CFG_VIDOPT) != 0 &&
(cf->cf_flags & 1) == 0)
return 0;
break;
}
/* when already running as console, always fake things */
if ((vax_confdata & (KA420_CFG_L3CON | KA420_CFG_VIDOPT)) == 0
#if NWSDISPLAY > 0
&& cn_tab->cn_putc == wsdisplay_cnputc
#endif
) {
struct vsbus_softc *sc = device_private(parent);
sc->sc_mask = 0x08;
scb_fake(0x44, 0x15);
return 20;
} else {
/*
* Try to find the cursor chip by testing the flip-flop.
* If nonexistent, no glass tty.
*/
ccmd = (uint16_t *)va->va_addr;
cfgtst = (uint16_t *)vax_map_physmem(VS_CFGTST, 1);
ccmd[0] = CUR_CMD_HSHI|CUR_CMD_FOPB;
DELAY(300000);
tmp = cfgtst[0];
ccmd[0] = CUR_CMD_TEST|CUR_CMD_HSHI;
DELAY(300000);
tmp2 = cfgtst[0];
vax_unmap_physmem((vaddr_t)cfgtst, 1);
if (tmp2 != tmp)
return 20; /* Using periodic interrupt */
else
return 0;
}
}
void
@ -234,7 +269,13 @@ smg_attach(device_t parent, device_t self, void *aux)
if (curscr == NULL)
callout_init(&smg_cursor_ch, 0);
curscr = &smg_conscreen;
aa.console = (vax_confdata & (KA420_CFG_L3CON|KA420_CFG_MULTU)) == 0;
aa.console =
#if NWSDISPLAY > 0
(vax_confdata & (KA420_CFG_L3CON | KA420_CFG_VIDOPT)) == 0 &&
cn_tab->cn_putc == wsdisplay_cnputc;
#else
(vax_confdata & (KA420_CFG_L3CON | KA420_CFG_VIDOPT)) == 0;
#endif
aa.scrdata = &smg_screenlist;
aa.accessops = &smg_accessops;
@ -581,9 +622,15 @@ smgcninit(struct consdev *cndev)
{
int fcookie;
struct wsdisplay_font *console_font;
extern void lkccninit(struct consdev *);
extern int lkccngetc(dev_t);
extern vaddr_t virtual_avail;
extern int dz_vsbus_lk201_cnattach(int);
sm_addr = (void *)virtual_avail;
ioaccess((vaddr_t)sm_addr, SMADDR, (SMSIZE / VAX_NBPG));
virtual_avail += SMSIZE;
virtual_avail = round_page(virtual_avail);
/* Clear screen */
memset(sm_addr, 0, 128*864);
@ -618,7 +665,6 @@ smgcninit(struct consdev *cndev)
void
smgcnprobe(struct consdev *cndev)
{
extern vaddr_t virtual_avail;
extern const struct cdevsw wsdisplay_cdevsw;
switch (vax_boardtype) {
@ -628,12 +674,9 @@ smgcnprobe(struct consdev *cndev)
if ((vax_confdata & KA420_CFG_L3CON) ||
(vax_confdata & KA420_CFG_MULTU))
break; /* doesn't use graphics console */
sm_addr = (void *)virtual_avail;
virtual_avail += SMSIZE;
ioaccess((vaddr_t)sm_addr, SMADDR, (SMSIZE/VAX_NBPG));
cndev->cn_pri = CN_INTERNAL;
cndev->cn_dev = makedev(cdevsw_lookup_major(&wsdisplay_cdevsw),
0);
cndev->cn_dev =
makedev(cdevsw_lookup_major(&wsdisplay_cdevsw), 0);
break;
default: