diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-07-29 14:18:58 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-07-29 14:18:58 +0000 |
commit | c11c824cade1312eaf5ad0179468c582be542193 (patch) | |
tree | fab658906e119a4f2075f360816947011a7f69bf /sys | |
parent | df64243c7389def8720641bd40115be93404b59b (diff) |
Rewrite glass console detection and initialization code, it's simpler and
will not allocate frame buffer resources at probe time. A few buglets fixed
while doing so.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/vax/conf/files.vax | 3 | ||||
-rw-r--r-- | sys/arch/vax/vax/conf.c | 70 | ||||
-rw-r--r-- | sys/arch/vax/vax/wscons_machdep.c | 134 | ||||
-rw-r--r-- | sys/arch/vax/vsa/gpx.c | 86 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcg.c | 123 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcspx.c | 98 | ||||
-rw-r--r-- | sys/arch/vax/vsa/smg.c | 68 |
7 files changed, 339 insertions, 243 deletions
diff --git a/sys/arch/vax/conf/files.vax b/sys/arch/vax/conf/files.vax index 3eebda21fb4..ceca8eeea07 100644 --- a/sys/arch/vax/conf/files.vax +++ b/sys/arch/vax/conf/files.vax @@ -1,4 +1,4 @@ -# $OpenBSD: files.vax,v 1.38 2006/07/24 22:19:54 miod Exp $ +# $OpenBSD: files.vax,v 1.39 2006/07/29 14:18:55 miod Exp $ # $NetBSD: files.vax,v 1.60 1999/08/27 20:04:32 ragge Exp $ # # new style config file for vax architecture @@ -368,6 +368,7 @@ file arch/vax/vax/db_machdep.c ddb file arch/vax/vax/db_disasm.c ddb file arch/vax/vax/opcodes.c file arch/vax/uba/uba_dma.c uba +file arch/vax/vax/wscons_machdep.c wsdisplay | wskbd # builtin NCR53C95 SCSI Controller on VAXstation 4000 VLC/60/9x device asc: scsi, ncr53c9x diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c index fc31ed502f0..e405cb82dd6 100644 --- a/sys/arch/vax/vax/conf.c +++ b/sys/arch/vax/vax/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.46 2006/07/28 21:07:05 miod Exp $ */ +/* $OpenBSD: conf.c,v 1.47 2006/07/29 14:18:57 miod Exp $ */ /* $NetBSD: conf.c,v 1.44 1999/10/27 16:38:54 ragge Exp $ */ /*- @@ -142,48 +142,15 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); */ #include <dev/cons.h> -#include "wskbd.h" -#include "gpx.h" -#include "lcg.h" -#include "lcspx.h" -#include "smg.h" -#if NGPX > 0 || NLCG > 0 || NLCSPX > 0 || NSMG > 0 -#if NWSKBD > 0 -#define gpxcngetc wskbd_cngetc -#define lcgcngetc wskbd_cngetc -#define lcspxcngetc wskbd_cngetc -#define smgcngetc wskbd_cngetc -#else -static int -dummycngetc(dev_t dev) -{ - return 0; -} -#define gpxcngetc dummycngetc -#define lcgcngetc dummycngetc -#define lcspxcngetc dummycngetc -#define smgcngetc dummycngetc -#endif /* NWSKBD > 0 */ -#endif /* NGPX > 0 || NLCG > 0 || NLCSPX > 0 || NSMG > 0 */ - -#define gpxcnputc wsdisplay_cnputc -#define lcgcnputc wsdisplay_cnputc -#define lcspxcnputc wsdisplay_cnputc -#define smgcnputc wsdisplay_cnputc -#define gpxcnpollc nullcnpollc -#define lcgcnpollc nullcnpollc -#define lcspxcnpollc nullcnpollc -#define smgcnpollc nullcnpollc - -cons_decl(gen); cons_decl(dz); +cons_decl(gen); cons_decl(qd); -cons_decl(gpx); -cons_decl(lcg); -cons_decl(lcspx); -cons_decl(smg); -#include "qv.h" +cons_decl(ws); + #include "qd.h" +#include "qv.h" +#include "wsdisplay.h" +#include "wskbd.h" struct consdev constab[]={ #if VAX8600 || VAX8200 || VAX780 || VAX750 || VAX650 || VAX630 || VAX660 || \ @@ -204,17 +171,8 @@ struct consdev constab[]={ cons_init(qd), #endif #endif -#if NGPX - cons_init(gpx), -#endif -#if NLCG - cons_init(lcg), -#endif -#if NLCSPX - cons_init(lcspx), -#endif -#if NSMG - cons_init(smg), +#if NWSDISPLAY > 0 || NWSKBD > 0 + cons_init(ws), #endif #ifdef notyet @@ -437,7 +395,7 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 47 */ cdev_notdef(), /* 48 */ cdev_systrace_init(NSYSTRACE,systrace), /* 49: system call tracing */ - cdev_ksyms_init(NKSYMS,ksyms), /* 50: Kernel symbols device */ + cdev_ksyms_init(NKSYMS,ksyms), /* 50: Kernel symbols device */ cdev_cnstore_init(NCRX,crx), /* 51: Console RX50 at 8200 */ cdev_notdef(), /* 52: was: KDB50/RA?? */ cdev_fd_init(1,filedesc), /* 53: file descriptor pseudo-device */ @@ -454,15 +412,15 @@ struct cdevsw cdevsw[] = cdev_scanner_init(NSS,ss), /* 64: SCSI scanner */ cdev_uk_init(NUK,uk), /* 65: SCSI unknown */ cdev_tty_init(NDL,dl), /* 66: DL11 */ - cdev_random_init(1,random), /* 67: random data source */ + cdev_random_init(1,random), /* 67: random data source */ cdev_wsdisplay_init(NWSDISPLAY, wsdisplay), /* 68: workstation console */ cdev_notdef(), /* 69 */ cdev_notdef(), /* 70 */ cdev_disk_init(NRY,ry), /* 71: VS floppy */ - cdev_notdef(), /* 72: was: SCSI bus */ + cdev_notdef(), /* 72: was: SCSI bus */ cdev_disk_init(NRAID,raid), /* 73: RAIDframe disk driver */ #ifdef XFS - cdev_xfs_init(NXFS,xfs_dev), /* 74: xfs communication device */ + cdev_xfs_init(NXFS,xfs_dev), /* 74: xfs communication device */ #else cdev_notdef(), /* 74 */ #endif @@ -584,7 +542,7 @@ iszerodev(dev) return (major(dev) == 3 && minor(dev) == 12); } -int getmajor(void *); /* XXX used by dz_ibus and smg, die die die */ +int getmajor(void *); /* XXX used by dz_ibus and wscons, die die die */ int getmajor(void *ptr) diff --git a/sys/arch/vax/vax/wscons_machdep.c b/sys/arch/vax/vax/wscons_machdep.c new file mode 100644 index 00000000000..80f84d8f235 --- /dev/null +++ b/sys/arch/vax/vax/wscons_machdep.c @@ -0,0 +1,134 @@ +/* $OpenBSD: wscons_machdep.c,v 1.1 2006/07/29 14:18:57 miod Exp $ */ +/* + * Copyright (c) 2006 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice, this permission notice, and the disclaimer below + * appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/device.h> +#include <sys/systm.h> +#include <sys/malloc.h> +#include <sys/conf.h> +#include <sys/kernel.h> + +#include <machine/vsbus.h> +#include <machine/scb.h> +#include <machine/sid.h> +#include <machine/cpu.h> + +#include "wsdisplay.h" +#include "wskbd.h" + +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsdisplayvar.h> +#include <dev/wscons/wskbdvar.h> + +#include "dzkbd.h" + +#include <vax/qbus/dzreg.h> +#include <vax/qbus/dzvar.h> +#include <vax/dec/dzkbdvar.h> + +#include "gpx.h" +#include "lcg.h" +#include "lcspx.h" +#include "smg.h" + +void (*wsfbcninit)(void) = NULL; + +#define FRAMEBUFFER_PROTOS(fb) \ +extern int fb##cnprobe(void); \ +extern void fb##cninit(void); + +#define FRAMEBUFFER_PROBE(fb) \ +do { \ + if (fb##cnprobe()) { \ + wsfbcninit = fb##cninit; \ + goto found; \ + } \ +} while (0) + +FRAMEBUFFER_PROTOS(gpx); +FRAMEBUFFER_PROTOS(lcg); +FRAMEBUFFER_PROTOS(lcspx); +FRAMEBUFFER_PROTOS(smg); + +#include <dev/cons.h> +cons_decl(ws); + +void +wscnprobe(struct consdev *cp) +{ + extern int getmajor(void *); /* conf.c */ + int major; + + major = getmajor(wsdisplayopen); + if (major < 0) + return; + +#if NGPX > 0 + FRAMEBUFFER_PROBE(gpx); +#endif +#if NLCG > 0 + FRAMEBUFFER_PROBE(lcg); +#endif +#if NLCSPX > 0 + FRAMEBUFFER_PROBE(lcspx); +#endif +#if NSMG > 0 + FRAMEBUFFER_PROBE(smg); +#endif + return; + +found: + cp->cn_pri = CN_INTERNAL; + cp->cn_dev = makedev(major, 0); +} + +void +wscninit(struct consdev *cp) +{ + (*wsfbcninit)(); + +#if NDZKBD > 0 + dzkbd_cnattach(0); /* Connect keyboard and screen together */ +#endif +} + +void +wscnputc(dev_t dev, int c) +{ +#if NWSDISPLAY > 0 + wsdisplay_cnputc(dev, c); +#endif +} + +int +wscngetc(dev_t dev) +{ +#if NWSKBD > 0 + return (wskbd_cngetc(dev)); +#else + return (0); +#endif +} + +void +wscnpollc(dev_t dev, int on) +{ +#if NWSKBD > 0 + wskbd_cnpollc(dev, on); +#endif +} diff --git a/sys/arch/vax/vsa/gpx.c b/sys/arch/vax/vsa/gpx.c index e823ab47635..4b4aaca699c 100644 --- a/sys/arch/vax/vsa/gpx.c +++ b/sys/arch/vax/vsa/gpx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpx.c,v 1.1 2006/07/28 21:07:05 miod Exp $ */ +/* $OpenBSD: gpx.c,v 1.2 2006/07/29 14:18:57 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -94,8 +94,9 @@ #include <machine/scb.h> #include <machine/vsbus.h> +#include <uvm/uvm_extern.h> + #include <dev/wscons/wsconsio.h> -#include <dev/wscons/wscons_callbacks.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> #include <dev/wsfont/wsfont.h> @@ -1028,27 +1029,13 @@ gpx_fillrect(struct gpx_screen *ss, int x, int y, int dx, int dy, long attr, * Console support code */ -#include <dev/cons.h> -cons_decl(gpx); - -#include "dzkbd.h" - -#include <vax/qbus/dzreg.h> -#include <vax/qbus/dzvar.h> -#include <vax/dec/dzkbdvar.h> +int gpxcnprobe(void); +void gpxcninit(void); -/* - * Called very early to setup the glass tty as console. - * Because it's called before the VM system is initialized, virtual memory - * for the framebuffer can be stolen directly without disturbing anything. - */ -void -gpxcnprobe(cndev) - struct consdev *cndev; +int +gpxcnprobe() { - struct gpx_screen *ss = &gpx_consscr; extern vaddr_t virtual_avail; - extern int getmajor(void *); /* conf.c */ vaddr_t tmp; int depth; @@ -1056,58 +1043,61 @@ gpxcnprobe(cndev) case VAX_BTYP_410: case VAX_BTYP_420: case VAX_BTYP_43: - /* not present on microvaxes */ - if ((vax_confdata & KA420_CFG_MULTU) != 0) - break; + if ((vax_confdata & (KA420_CFG_L3CON | KA420_CFG_MULTU)) != 0) + break; /* doesn't use graphics console */ if ((vax_confdata & KA420_CFG_VIDOPT) == 0) - break; /* doesn't use graphics console */ + break; /* no color option */ /* Check for a recognized color depth */ tmp = virtual_avail; ioaccess(tmp, GPXADDR + GPX_READBACK_OFFSET, 1); depth = (*(u_int16_t *)tmp) & 0x00f0; - if (depth != 0x00f0 && depth != 0x0080) - break; - - ss->ss_depth = depth == 0x00f0 ? 4 : 8; + if (depth == 0x00f0 || depth == 0x0080) + return (1); - ss->ss_adder = (struct adder *)virtual_avail; - virtual_avail += VAX_NBPG; - ioaccess((vaddr_t)ss->ss_adder, GPXADDR + GPX_ADDER_OFFSET, 1); - - ss->ss_vdac = (void *)virtual_avail; - virtual_avail += VAX_NBPG; - ioaccess((vaddr_t)ss->ss_vdac, GPXADDR + GPX_VDAC_OFFSET, 1); - - cndev->cn_pri = CN_INTERNAL; - cndev->cn_dev = makedev(getmajor(wsdisplayopen), 0); break; default: break; } + + return (0); } +/* + * Called very early to setup the glass tty as console. + * Because it's called before the VM system is initialized, virtual memory + * for the framebuffer can be stolen directly without disturbing anything. + */ void -gpxcninit(struct consdev *cndev) +gpxcninit() { struct gpx_screen *ss = &gpx_consscr; + extern vaddr_t virtual_avail; + vaddr_t tmp; long defattr; struct rasops_info *ri; - extern void lkccninit(struct consdev *); - extern int lkccngetc(dev_t); - extern int dz_vsbus_lk201_cnattach(int); - /* mappings have been done in gpxcnprobe() */ + tmp = virtual_avail; + ioaccess(tmp, GPXADDR + GPX_READBACK_OFFSET, 1); + ss->ss_depth = ((*(u_int16_t *)tmp) & 0x00f0) == 0x00f0 ? 4 : 8; + + ss->ss_adder = (struct adder *)virtual_avail; + virtual_avail += VAX_NBPG; + ioaccess((vaddr_t)ss->ss_adder, GPXADDR + GPX_ADDER_OFFSET, 1); + + ss->ss_vdac = (void *)virtual_avail; + virtual_avail += VAX_NBPG; + ioaccess((vaddr_t)ss->ss_vdac, GPXADDR + GPX_VDAC_OFFSET, 1); + + virtual_avail = round_page(virtual_avail); + + /* this had better not fail as we can't recover there */ if (gpx_setup_screen(ss) != 0) - return; + panic(__func__); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&gpx_stdscreen, ri, 0, 0, defattr); - -#if NDZKBD > 0 - dzkbd_cnattach(0); /* Connect keyboard and screen together */ -#endif } diff --git a/sys/arch/vax/vsa/lcg.c b/sys/arch/vax/vsa/lcg.c index 278f5af11ef..27e882b0ee5 100644 --- a/sys/arch/vax/vsa/lcg.c +++ b/sys/arch/vax/vsa/lcg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcg.c,v 1.2 2006/07/24 22:18:09 miod Exp $ */ +/* $OpenBSD: lcg.c,v 1.3 2006/07/29 14:18:57 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -56,8 +56,9 @@ #include <machine/sid.h> #include <machine/cpu.h> +#include <uvm/uvm_extern.h> + #include <dev/wscons/wsconsio.h> -#include <dev/wscons/wscons_callbacks.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> @@ -375,12 +376,13 @@ lcg_setup_screen(struct lcg_screen *ss) if (rasops_init(ri, 160, 160) != 0) return (-1); - lcg_resetcmap(ss); if (ss->ss_depth < 8) { ri->ri_ops.alloc_attr = lcg_alloc_attr; ri->ri_caps &= ~WSSCREEN_HILIT; } + lcg_resetcmap(ss); + lcg_stdscreen.ncols = ri->ri_cols; lcg_stdscreen.nrows = ri->ri_rows; lcg_stdscreen.textops = &ri->ri_ops; @@ -565,29 +567,20 @@ lcg_resetcmap(struct lcg_screen *ss) lcg_write_reg(ss, LCG_REG_LUT_CONSOLE_SEL, 0); } -#include <dev/cons.h> -cons_decl(lcg); - -#include "dzkbd.h" - -#include <vax/qbus/dzreg.h> -#include <vax/qbus/dzvar.h> -#include <vax/dec/dzkbdvar.h> - - /* - * Called very early to setup the glass tty as console. - * Because it's called before the VM system is initialized, virtual memory - * for the framebuffer can be stolen directly without disturbing anything. + * Console support code */ -void -lcgcnprobe(cndev) - struct consdev *cndev; + +int lcgcnprobe(void); +void lcgcninit(void); + +int +lcgcnprobe() { - struct lcg_screen *ss = &lcg_consscr; extern vaddr_t virtual_avail; - extern int getmajor(void *); /* conf.c */ + u_int32_t cfg; vaddr_t tmp; + volatile u_int8_t *ch; switch (vax_boardtype) { case VAX_BTYP_46: @@ -596,60 +589,78 @@ lcgcnprobe(cndev) break; /* doesn't use graphics console */ tmp = virtual_avail; - ioaccess(tmp, LCG_CONFIG_ADDR, 1); - ss->ss_cfg = *(volatile u_int32_t *)tmp; + ioaccess(tmp, vax_trunc_page(LCG_CONFIG_ADDR), 1); + cfg = *(volatile u_int32_t *) + (tmp + (LCG_CONFIG_ADDR & VAX_PGOFSET)); - ss->ss_depth = lcg_probe_screen(ss->ss_cfg, - &ss->ss_width, &ss->ss_height); - if (ss->ss_depth == 0) + if (lcg_probe_screen(cfg, NULL, NULL) == 0) break; /* unsupported configuration */ - ss->ss_fbsize = - roundup(ss->ss_width * ss->ss_height, VAX_NBPG); - - ss->ss_addr = (caddr_t)virtual_avail; - virtual_avail += ss->ss_fbsize; - ioaccess((vaddr_t)ss->ss_addr, LCG_FB_ADDR, - ss->ss_fbsize / VAX_NBPG); - - ss->ss_reg = virtual_avail; - virtual_avail += LCG_REG_SIZE; - ioaccess(ss->ss_reg, LCG_REG_ADDR, - LCG_REG_SIZE / VAX_NBPG); - - ss->ss_lut = (u_int8_t *)virtual_avail; - virtual_avail += LCG_LUT_SIZE; - ioaccess((vaddr_t)ss->ss_lut, LCG_LUT_ADDR, - LCG_LUT_SIZE / VAX_NBPG); + /* + * Check for video memory. + * We can not use badaddr() on these models. + */ + ioaccess(tmp, LCG_FB_ADDR, 1); + ch = (volatile u_int8_t *)tmp; + *ch = 0x01; + if ((*ch & 0x01) == 0) + break; + *ch = 0x00; + if ((*ch & 0x01) != 0) + break; - cndev->cn_pri = CN_INTERNAL; - cndev->cn_dev = makedev(getmajor(wsdisplayopen), 0); - break; + return (1); default: break; } + + return (0); } +/* + * Called very early to setup the glass tty as console. + * Because it's called before the VM system is initialized, virtual memory + * for the framebuffer can be stolen directly without disturbing anything. + */ void -lcgcninit(struct consdev *cndev) +lcgcninit() { struct lcg_screen *ss = &lcg_consscr; + extern vaddr_t virtual_avail; + vaddr_t tmp; long defattr; struct rasops_info *ri; - extern void lkccninit(struct consdev *); - extern int lkccngetc(dev_t); - extern int dz_vsbus_lk201_cnattach(int); - /* mappings have been done in lcgcnprobe() */ + tmp = virtual_avail; + ioaccess(tmp, vax_trunc_page(LCG_CONFIG_ADDR), 1); + ss->ss_cfg = *(volatile u_int32_t *) + (tmp + (LCG_CONFIG_ADDR & VAX_PGOFSET)); + + ss->ss_depth = lcg_probe_screen(ss->ss_cfg, + &ss->ss_width, &ss->ss_height); + + ss->ss_fbsize = roundup(ss->ss_width * ss->ss_height, PAGE_SIZE); + + ss->ss_addr = (caddr_t)virtual_avail; + virtual_avail += ss->ss_fbsize; + ioaccess((vaddr_t)ss->ss_addr, LCG_FB_ADDR, ss->ss_fbsize / VAX_NBPG); + + ss->ss_reg = virtual_avail; + virtual_avail += LCG_REG_SIZE; + ioaccess(ss->ss_reg, LCG_REG_ADDR, LCG_REG_SIZE / VAX_NBPG); + + ss->ss_lut = (u_int8_t *)virtual_avail; + virtual_avail += LCG_LUT_SIZE; + ioaccess((vaddr_t)ss->ss_lut, LCG_LUT_ADDR, LCG_LUT_SIZE / VAX_NBPG); + + virtual_avail = round_page(virtual_avail); + + /* this had better not fail as we can't recover there */ if (lcg_setup_screen(ss) != 0) - return; + panic(__func__); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&lcg_stdscreen, ri, 0, 0, defattr); - -#if NDZKBD > 0 - dzkbd_cnattach(0); /* Connect keyboard and screen together */ -#endif } diff --git a/sys/arch/vax/vsa/lcspx.c b/sys/arch/vax/vsa/lcspx.c index be61cebe19f..2cf336da39f 100644 --- a/sys/arch/vax/vsa/lcspx.c +++ b/sys/arch/vax/vsa/lcspx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcspx.c,v 1.1 2006/07/24 22:19:54 miod Exp $ */ +/* $OpenBSD: lcspx.c,v 1.2 2006/07/29 14:18:57 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -58,8 +58,9 @@ #include <machine/sid.h> #include <machine/cpu.h> +#include <uvm/uvm_extern.h> + #include <dev/wscons/wsconsio.h> -#include <dev/wscons/wscons_callbacks.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> @@ -383,75 +384,80 @@ lcspx_resetcmap(struct lcspx_screen *ss) } } -#include <dev/cons.h> -cons_decl(lcspx); - -#include "dzkbd.h" - -#include <vax/qbus/dzreg.h> -#include <vax/qbus/dzvar.h> -#include <vax/dec/dzkbdvar.h> - - /* - * Called very early to setup the glass tty as console. - * Because it's called before the VM system is initialized, virtual memory - * for the framebuffer can be stolen directly without disturbing anything. + * Console support code */ -void -lcspxcnprobe(cndev) - struct consdev *cndev; + +int lcspxcnprobe(void); +void lcspxcninit(void); + +int +lcspxcnprobe() { - struct lcspx_screen *ss = &lcspx_consscr; extern vaddr_t virtual_avail; - extern int getmajor(void *); /* conf.c */ - int i; + vaddr_t tmp; + volatile u_int8_t *ch; switch (vax_boardtype) { case VAX_BTYP_49: if ((vax_confdata & 8) != 0) break; /* doesn't use graphics console */ - ss->ss_addr = (caddr_t)virtual_avail; - virtual_avail += LCSPX_FBSIZE; - ioaccess((vaddr_t)ss->ss_addr, LCSPX_FB_ADDR, - LCSPX_FBSIZE / VAX_NBPG); - - for (i = 0; i < 4; i++) { - ss->ss_ramdac[i] = (volatile u_int8_t *)virtual_avail; - virtual_avail += VAX_NBPG; - ioaccess((vaddr_t)ss->ss_ramdac[i], - LCSPX_RAMDAC_ADDR + i * LCSPX_RAMDAC_INTERLEAVE, 1); - } - - cndev->cn_pri = CN_INTERNAL; - cndev->cn_dev = makedev(getmajor(wsdisplayopen), 0); - break; + /* + * Check for video memory. + * We can not use badaddr() on these models. + */ + tmp = virtual_avail; + ch = (volatile u_int8_t *)tmp; + ioaccess(tmp, LCSPX_FB_ADDR, 1); + *ch = 0x01; + if ((*ch & 0x01) == 0) + break; + *ch = 0x00; + if ((*ch & 0x01) != 0) + break; + + return (1); default: break; } + + return (0); } +/* + * Called very early to setup the glass tty as console. + * Because it's called before the VM system is initialized, virtual memory + * for the framebuffer can be stolen directly without disturbing anything. + */ void -lcspxcninit(struct consdev *cndev) +lcspxcninit() { struct lcspx_screen *ss = &lcspx_consscr; + extern vaddr_t virtual_avail; + int i; long defattr; struct rasops_info *ri; - extern void lkccninit(struct consdev *); - extern int lkccngetc(dev_t); - extern int dz_vsbus_lk201_cnattach(int); - /* mappings have been done in lcspxcnprobe() */ + ss->ss_addr = (caddr_t)virtual_avail; + virtual_avail += LCSPX_FBSIZE; + ioaccess((vaddr_t)ss->ss_addr, LCSPX_FB_ADDR, LCSPX_FBSIZE / VAX_NBPG); + + for (i = 0; i < 4; i++) { + ss->ss_ramdac[i] = (volatile u_int8_t *)virtual_avail; + virtual_avail += VAX_NBPG; + ioaccess((vaddr_t)ss->ss_ramdac[i], + LCSPX_RAMDAC_ADDR + i * LCSPX_RAMDAC_INTERLEAVE, 1); + } + + virtual_avail = round_page(virtual_avail); + + /* this had better not fail as we can't recover there */ if (lcspx_setup_screen(ss) != 0) - return; + panic(__func__); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&lcspx_stdscreen, ri, 0, 0, defattr); - -#if NDZKBD > 0 - dzkbd_cnattach(0); /* Connect keyboard and screen together */ -#endif } diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c index c1468ce410d..bc3007365b0 100644 --- a/sys/arch/vax/vsa/smg.c +++ b/sys/arch/vax/vsa/smg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smg.c,v 1.11 2006/07/28 21:06:00 miod Exp $ */ +/* $OpenBSD: smg.c,v 1.12 2006/07/29 14:18:57 miod Exp $ */ /* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat @@ -67,6 +67,8 @@ #include <machine/cpu.h> #include <machine/ka420.h> +#include <uvm/uvm_extern.h> + #include <dev/ic/dc503reg.h> #include <vax/qbus/dzreg.h> @@ -74,7 +76,6 @@ #include <vax/dec/dzkbdvar.h> #include <dev/wscons/wsconsio.h> -#include <dev/wscons/wscons_callbacks.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> #include <dev/wsfont/wsfont.h> @@ -545,22 +546,16 @@ smg_updatecursor(struct smg_screen *ss, u_int which) ss->ss_cursor->cmdr = ss->ss_curcmd; } -#include <dev/cons.h> -cons_decl(smg); - /* - * Called very early to setup the glass tty as console. - * Because it's called before the VM system is initialized, virtual memory - * for the framebuffer can be stolen directly without disturbing anything. + * Console support code */ -void -smgcnprobe(cndev) - struct consdev *cndev; -{ - struct smg_screen *ss = &smg_consscr; - extern vaddr_t virtual_avail; - extern int getmajor(void *); /* conf.c */ +int smgcnprobe(void); +void smgcninit(void); + +int +smgcnprobe() +{ switch (vax_boardtype) { case VAX_BTYP_410: case VAX_BTYP_420: @@ -568,42 +563,43 @@ smgcnprobe(cndev) if ((vax_confdata & (KA420_CFG_L3CON | KA420_CFG_MULTU)) != 0) break; /* doesn't use graphics console */ - ss->ss_addr = (caddr_t)virtual_avail; - virtual_avail += SMSIZE; - ioaccess((vaddr_t)ss->ss_addr, SMADDR, SMSIZE / VAX_NBPG); - - ss->ss_cursor = (struct dc503reg *)virtual_avail; - virtual_avail += PAGE_SIZE; /* VAX_NBPG */ - ioaccess((vaddr_t)ss->ss_cursor, KA420_CUR_BASE, 1); - - cndev->cn_pri = CN_INTERNAL; - cndev->cn_dev = makedev(getmajor(wsdisplayopen), 0); - break; + return (1); default: break; } + + return (0); } +/* + * Called very early to setup the glass tty as console. + * Because it's called before the VM system is initialized, virtual memory + * for the framebuffer can be stolen directly without disturbing anything. + */ void -smgcninit(struct consdev *cndev) +smgcninit() { struct smg_screen *ss = &smg_consscr; + extern vaddr_t virtual_avail; long defattr; struct rasops_info *ri; - extern void lkccninit(struct consdev *); - extern int lkccngetc(dev_t); - extern int dz_vsbus_lk201_cnattach(int); - /* ss_addr and ss_cursor initialized in smgcnprobe() */ + ss->ss_addr = (caddr_t)virtual_avail; + virtual_avail += SMSIZE; + ioaccess((vaddr_t)ss->ss_addr, SMADDR, SMSIZE / VAX_NBPG); + + ss->ss_cursor = (struct dc503reg *)virtual_avail; + virtual_avail += VAX_NBPG; + ioaccess((vaddr_t)ss->ss_cursor, KA420_CUR_BASE, 1); + + virtual_avail = round_page(virtual_avail); + + /* this had better not fail as we can't recover there */ if (smg_setup_screen(ss) != 0) - return; + panic(__func__); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&smg_stdscreen, ri, 0, 0, defattr); - -#if NDZKBD > 0 - dzkbd_cnattach(0); /* Connect keyboard and screen together */ -#endif } |