Module Name: src
Committed By: martin
Date: Wed Jul 25 21:30:35 UTC 2012
Modified Files:
src/sys/arch/luna68k/conf [netbsd-6]: GENERIC INSTALL
src/sys/arch/luna68k/dev [netbsd-6]: lunafb.c lunaws.c omrasops.c
src/sys/arch/luna68k/luna68k [netbsd-6]: locore.s
Added Files:
src/sys/arch/luna68k/dev [netbsd-6]: omrasopsvar.h
Removed Files:
src/sys/arch/luna68k/dev [netbsd-6]: omron_rfont.h
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/arch/luna68k/conf/INSTALL
cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.23 -r1.23.8.1 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/luna68k/dev/omrasopsvar.h
cvs rdiff -u -r1.1 -r0 src/sys/arch/luna68k/dev/omron_rfont.h
cvs rdiff -u -r1.47 -r1.47.2.1 src/sys/arch/luna68k/luna68k/locore.s
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.97 src/sys/arch/luna68k/conf/GENERIC:1.97.2.1
--- src/sys/arch/luna68k/conf/GENERIC:1.97 Sun Dec 18 05:49:29 2011
+++ src/sys/arch/luna68k/conf/GENERIC Wed Jul 25 21:30:34 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.97 2011/12/18 05:49:29 dholland Exp $
+# $NetBSD: GENERIC,v 1.97.2.1 2012/07/25 21:30:34 martin Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@ include "arch/luna68k/conf/std.luna68k"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.97 $"
+#ident "GENERIC-$Revision: 1.97.2.1 $"
maxusers 8
@@ -138,6 +138,7 @@ options NFS_BOOT_DHCP # superset of BOO
# WS console uses SUN or VT100 terminal emulation
options WSEMUL_VT100
+options FONT_OMRON12x20
config netbsd root on ? type ?
Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.4 src/sys/arch/luna68k/conf/INSTALL:1.4.2.1
--- src/sys/arch/luna68k/conf/INSTALL:1.4 Sun Dec 18 05:49:29 2011
+++ src/sys/arch/luna68k/conf/INSTALL Wed Jul 25 21:30:34 2012
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.4 2011/12/18 05:49:29 dholland Exp $
+# $NetBSD: INSTALL,v 1.4.2.1 2012/07/25 21:30:34 martin Exp $
#
# config for installation ramdisk kernel
#
@@ -124,6 +124,7 @@ options NFS_BOOT_DHCP # superset of BOO
# WS console uses SUN or VT100 terminal emulation
options WSEMUL_VT100
+options FONT_OMRON12x20
config netbsd root on ? type ?
Index: src/sys/arch/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.25 src/sys/arch/luna68k/dev/lunafb.c:1.25.8.1
--- src/sys/arch/luna68k/dev/lunafb.c:1.25 Wed Jul 27 14:17:54 2011
+++ src/sys/arch/luna68k/dev/lunafb.c Wed Jul 25 21:30:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.25 2011/07/27 14:17:54 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.25.8.1 2012/07/25 21:30:35 martin Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.25 2011/07/27 14:17:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.25.8.1 2012/07/25 21:30:35 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -47,14 +47,15 @@ __KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1
#include <uvm/uvm_extern.h>
-#include <dev/rcons/raster.h>
#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wscons_raster.h>
#include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
#include <machine/cpu.h>
#include <machine/autoconf.h>
+#include <arch/luna68k/dev/omrasopsvar.h>
+
#include "ioconf.h"
struct bt454 {
@@ -88,8 +89,7 @@ struct om_hwdevconfig {
int dc_rowbytes; /* bytes in a FB scan line */
int dc_cmsize; /* colormap size */
vaddr_t dc_videobase; /* base of flat frame buffer */
- struct raster dc_raster; /* raster description */
- struct rcons dc_rcons; /* raster blitter control info */
+ struct rasops_info dc_ri; /* raster blitter variables */
};
struct hwcmap {
@@ -112,13 +112,8 @@ static int omsetcmap(struct omfb_softc
static struct om_hwdevconfig omfb_console_dc;
static void omfb_getdevconfig(paddr_t, struct om_hwdevconfig *);
-extern struct wsdisplay_emulops omfb_emulops;
-
static struct wsscreen_descr omfb_stdscreen = {
- "std", 0, 0,
- &omfb_emulops,
- 0, 0,
- 0
+ .name = "std"
};
static const struct wsscreen_descr *_omfb_scrlist[] = {
@@ -187,7 +182,7 @@ omfbattach(device_t parent, device_t sel
sc->nscreens = 1;
} else {
sc->sc_dc = malloc(sizeof(struct om_hwdevconfig),
- M_DEVBUF, M_WAITOK);
+ M_DEVBUF, M_WAITOK | M_ZERO);
omfb_getdevconfig(OMFB_FB_WADDR, sc->sc_dc);
}
aprint_normal(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
@@ -209,11 +204,12 @@ omfbattach(device_t parent, device_t sel
omfb_cnattach(void)
{
struct om_hwdevconfig *dc = &omfb_console_dc;
+ struct rasops_info *ri = &dc->dc_ri;
long defattr;
omfb_getdevconfig(OMFB_FB_WADDR, dc);
- (*omfb_emulops.allocattr)(&dc->dc_rcons, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&omfb_stdscreen, &dc->dc_rcons, 0, 0, defattr);
+ (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&omfb_stdscreen, ri, 0, 0, defattr);
omfb_console = 1;
return 0;
}
@@ -350,8 +346,7 @@ static void
omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
{
int bpp, i;
- struct raster *rap;
- struct rcons *rcp;
+ struct rasops_info *ri;
union {
struct { short h, v; } p;
uint32_t u;
@@ -415,7 +410,7 @@ omfb_getdevconfig(paddr_t paddr, struct
}
}
- /* adjust h/v orgin on screen */
+ /* adjust h/v origin on screen */
rfcnt.p.h = 7;
rfcnt.p.v = -27;
/* single write of 0x007ffe6 */
@@ -424,28 +419,29 @@ omfb_getdevconfig(paddr_t paddr, struct
/* clear the screen */
*(volatile uint32_t *)OMFB_PLANEMASK = 0xff;
((volatile uint32_t *)OMFB_ROPFUNC)[5] = ~0; /* ROP copy */
- for (i = 0; i < dc->dc_ht * dc->dc_rowbytes/sizeof(uint32_t); i++)
+ for (i = 0; i < dc->dc_ht * dc->dc_rowbytes / sizeof(uint32_t); i++)
*((volatile uint32_t *)dc->dc_videobase + i) = 0;
*(volatile uint32_t *)OMFB_PLANEMASK = 0x01;
/* initialize the raster */
- rap = &dc->dc_raster;
- rap->width = dc->dc_wid;
- rap->height = dc->dc_ht;
- rap->depth = dc->dc_depth;
- rap->linelongs = dc->dc_rowbytes / sizeof(uint32_t);
- rap->pixels = (uint32_t *)dc->dc_videobase;
-
- /* initialize the raster console blitter */
- rcp = &dc->dc_rcons;
- rcp->rc_sp = rap;
- rcp->rc_crow = rcp->rc_ccol = -1;
- rcp->rc_crowp = &rcp->rc_crow;
- rcp->rc_ccolp = &rcp->rc_ccol;
- rcons_init(rcp, 34, 80);
-
- omfb_stdscreen.nrows = dc->dc_rcons.rc_maxrow;
- omfb_stdscreen.ncols = dc->dc_rcons.rc_maxcol;
+ ri = &dc->dc_ri;
+ ri->ri_width = dc->dc_wid;
+ ri->ri_height = dc->dc_ht;
+ ri->ri_depth = 1; /* since planes are independently addressed */
+ ri->ri_stride = dc->dc_rowbytes;
+ ri->ri_bits = (void *)dc->dc_videobase;
+ ri->ri_flg = RI_CENTER;
+ if (dc == &omfb_console_dc)
+ ri->ri_flg |= RI_NO_AUTO;
+ ri->ri_hw = dc;
+
+ omrasops_init(ri, 34, 80);
+
+ omfb_stdscreen.nrows = ri->ri_rows;
+ omfb_stdscreen.ncols = ri->ri_cols;
+ omfb_stdscreen.textops = &ri->ri_ops;
+ omfb_stdscreen.fontwidth = ri->ri_font->fontwidth;
+ omfb_stdscreen.fontheight = ri->ri_font->fontheight;
}
static int
@@ -453,16 +449,15 @@ omfb_alloc_screen(void *v, const struct
int *curxp, int *curyp, long *attrp)
{
struct omfb_softc *sc = v;
- long defattr;
+ struct rasops_info *ri = &sc->sc_dc->dc_ri;
if (sc->nscreens > 0)
return ENOMEM;
- *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
+ *cookiep = ri;
*curxp = 0;
*curyp = 0;
- (*omfb_emulops.allocattr)(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
- *attrp = defattr;
+ (*ri->ri_ops.allocattr)(ri, 0, 0, 0, attrp);
sc->nscreens++;
return 0;
}
Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.23 src/sys/arch/luna68k/dev/lunaws.c:1.23.8.1
--- src/sys/arch/luna68k/dev/lunaws.c:1.23 Wed Jul 27 14:17:54 2011
+++ src/sys/arch/luna68k/dev/lunaws.c Wed Jul 25 21:30:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.23 2011/07/27 14:17:54 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.23.8.1 2012/07/25 21:30:35 martin Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.23 2011/07/27 14:17:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.23.8.1 2012/07/25 21:30:35 martin Exp $");
#include "wsmouse.h"
@@ -228,7 +228,7 @@ wsintr(int chan)
#endif
} while ((rr = getsiocsr(sio)) & RR_RXRDY);
}
- if (rr && RR_TXRDY)
+ if (rr & RR_TXRDY)
sio->sio_cmd = WR0_RSTPEND;
/* not capable of transmit, yet */
}
Index: src/sys/arch/luna68k/dev/omrasops.c
diff -u src/sys/arch/luna68k/dev/omrasops.c:1.11 src/sys/arch/luna68k/dev/omrasops.c:1.11.8.1
--- src/sys/arch/luna68k/dev/omrasops.c:1.11 Wed Jul 27 14:17:54 2011
+++ src/sys/arch/luna68k/dev/omrasops.c Wed Jul 25 21:30:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.11 2011/07/27 14:17:54 tsutsui Exp $ */
+/* $NetBSD: omrasops.c,v 1.11.8.1 2012/07/25 21:30:35 martin Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,33 +31,26 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.11 2011/07/27 14:17:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.11.8.1 2012/07/25 21:30:35 martin Exp $");
/*
* Designed speficically for 'm68k bitorder';
* - most significant byte is stored at lower address,
* - most significant bit is displayed at left most on screen.
- * Implementation relys on;
+ * Implementation relies on;
* - every memory references is done in aligned 32bit chunk,
* - font glyphs are stored in 32bit padded.
*/
-#define USE_OMRONFONT
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <dev/rcons/raster.h>
-#include <dev/wscons/wscons_raster.h>
-#ifndef USE_OMRONFONT
-#include <dev/wscons/wscons_rfont.h>
-#else
-#include <arch/luna68k/dev/omron_rfont.h>
-#endif
+#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
-void rcons_init(struct rcons *, int, int);
+#include <arch/luna68k/dev/omrasopsvar.h>
/* wscons emulator operations */
static void om_cursor(void *, int, int, int);
@@ -69,17 +62,6 @@ static void om_erasecols(void *, int, in
static void om_eraserows(void *, int, int, long);
static int om_allocattr(void *, int, int, int, long *);
-struct wsdisplay_emulops omfb_emulops = {
- om_cursor,
- om_mapchar,
- om_putchar,
- om_copycols,
- om_erasecols,
- om_copyrows,
- om_eraserows,
- om_allocattr
-};
-
#define ALL1BITS (~0U)
#define ALL0BITS (0U)
#define BLITWIDTH (32)
@@ -95,33 +77,36 @@ struct wsdisplay_emulops omfb_emulops =
static void
om_putchar(void *cookie, int row, int startcol, u_int uc, long attr)
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
uint8_t *p;
int scanspan, startx, height, width, align, y;
uint32_t lmask, rmask, glyph, inverse;
- uint32_t *g;
+ int i;
+ uint8_t *fb;
- scanspan = rap->linelongs * 4;
- y = rc->rc_yorigin + rc->rc_font->height * row;
- startx = rc->rc_xorigin + rc->rc_font->width * startcol;
- height = rc->rc_font->height;
- g = rc->rc_font->chars[uc].r->pixels;
+ scanspan = ri->ri_stride;
+ y = ri->ri_font->fontheight * row;
+ startx = ri->ri_font->fontwidth * startcol;
+ height = ri->ri_font->fontheight;
+ fb = (uint8_t *)ri->ri_font->data +
+ (uc - ri->ri_font->firstchar) * ri->ri_fontscale;
inverse = (attr != 0) ? ALL1BITS : ALL0BITS;
- p = (uint8_t *)rap->pixels + y * scanspan + ((startx / 32) * 4);
+ p = (uint8_t *)ri->ri_bits + y * scanspan + ((startx / 32) * 4);
align = startx & ALIGNMASK;
- width = rc->rc_font->width + align;
+ width = ri->ri_font->fontwidth + align;
lmask = ALL1BITS >> align;
rmask = ALL1BITS << (-width & ALIGNMASK);
if (width <= BLITWIDTH) {
lmask &= rmask;
while (height > 0) {
- glyph = *g;
+ glyph = 0;
+ for (i = ri->ri_font->stride; i != 0; i--)
+ glyph = (glyph << 8) | *fb++;
+ glyph <<= (4 - ri->ri_font->stride) * NBBY;
glyph = (glyph >> align) ^ inverse;
W(p) = (R(p) & ~lmask) | (glyph & lmask);
p += scanspan;
- g += 1;
height--;
}
} else {
@@ -129,7 +114,10 @@ om_putchar(void *cookie, int row, int st
uint32_t lhalf, rhalf;
while (height > 0) {
- glyph = *g;
+ glyph = 0;
+ for (i = ri->ri_font->stride; i != 0; i--)
+ glyph = (glyph << 8) | *fb++;
+ glyph <<= (4 - ri->ri_font->stride) * NBBY;
lhalf = (glyph >> align) ^ inverse;
W(p) = (R(p) & ~lmask) | (lhalf & lmask);
p += BYTESDONE;
@@ -137,7 +125,6 @@ om_putchar(void *cookie, int row, int st
W(p) = (rhalf & rmask) | (R(p) & ~rmask);
p = (q += scanspan);
- g += 1;
height--;
}
}
@@ -146,20 +133,20 @@ om_putchar(void *cookie, int row, int st
static void
om_erasecols(void *cookie, int row, int startcol, int ncols, long attr)
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
- uint8_t *p;
- int scanspan, startx, height, width, align, w, y;
- uint32_t lmask, rmask, fill;
-
- scanspan = rap->linelongs * 4;
- y = rc->rc_yorigin + rc->rc_font->height * row;
- startx = rc->rc_xorigin + rc->rc_font->width * startcol;
- height = rc->rc_font->height;
- w = rc->rc_font->width * ncols;
+ struct rasops_info *ri = cookie;
+ uint8_t *p;
+ int scanspan, startx, height, width, align, w, y;
+ uint32_t lmask, rmask, fill;
+
+ scanspan = ri->ri_stride;;
+ fill = (attr != 0) ? ALL1BITS : ALL0BITS;
+ y = ri->ri_font->fontheight * row;
+ startx = ri->ri_font->fontwidth * startcol;
+ height = ri->ri_font->fontheight;
+ w = ri->ri_font->fontwidth * ncols;
fill = (attr != 0) ? ALL1BITS : ALL0BITS;
- p = (uint8_t *)rap->pixels + y * scanspan + ((startx / 32) * 4);
+ p = (uint8_t *)ri->ri_bits + y * scanspan + ((startx / 32) * 4);
align = startx & ALIGNMASK;
width = w + align;
lmask = ALL1BITS >> align;
@@ -195,22 +182,20 @@ om_erasecols(void *cookie, int row, int
static void
om_eraserows(void *cookie, int startrow, int nrows, long attr)
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
uint8_t *p, *q;
int scanspan, starty, height, width, w;
uint32_t rmask, fill;
- scanspan = rap->linelongs * 4;
- starty = rc->rc_yorigin + rc->rc_font->height * startrow;
- height = rc->rc_font->height * nrows;
- w = rc->rc_font->width * rc->rc_maxcol;
- fill = (attr == 1) ? ALL1BITS : ALL0BITS;
+ scanspan = ri->ri_stride;
+ starty = ri->ri_font->fontheight * startrow;
+ height = ri->ri_font->fontheight * nrows;
+ w = ri->ri_emuwidth;
+ fill = (attr != 0) ? ALL1BITS : ALL0BITS;
- p = (uint8_t *)rap->pixels + starty * scanspan;
- p += (rc->rc_xorigin / 32) * 4;
+ p = (uint8_t *)ri->ri_bits + starty * scanspan;
width = w;
- rmask = ALL1BITS << (-width & ALIGNMASK);
+ rmask = ALL1BITS << (-width & ALIGNMASK);
q = p;
while (height > 0) {
W(p) = fill; /* always aligned */
@@ -231,24 +216,22 @@ om_eraserows(void *cookie, int startrow,
static void
om_copyrows(void *cookie, int srcrow, int dstrow, int nrows)
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
- uint8_t *p, *q;
+ struct rasops_info *ri = cookie;
+ uint8_t *p, *q;
int scanspan, offset, srcy, height, width, w;
- uint32_t rmask;
-
- scanspan = rap->linelongs * 4;
- height = rc->rc_font->height * nrows;
- offset = (dstrow - srcrow) * scanspan * rc->rc_font->height;
- srcy = rc->rc_yorigin + rc->rc_font->height * srcrow;
+ uint32_t rmask;
+
+ scanspan = ri->ri_stride;
+ height = ri->ri_font->fontheight * nrows;
+ offset = (dstrow - srcrow) * scanspan * ri->ri_font->fontheight;
+ srcy = ri->ri_font->fontheight * srcrow;
if (srcrow < dstrow && srcrow + nrows > dstrow) {
scanspan = -scanspan;
srcy += height;
}
- p = (uint8_t *)rap->pixels + srcy * (rap->linelongs * 4);
- p += (rc->rc_xorigin / 32) * 4;
- w = rc->rc_font->width * rc->rc_maxcol;
+ p = (uint8_t *)ri->ri_bits + srcy * ri->ri_stride;
+ w = ri->ri_emuwidth;
width = w;
rmask = ALL1BITS << (-width & ALIGNMASK);
q = p;
@@ -272,26 +255,25 @@ om_copyrows(void *cookie, int srcrow, in
static void
om_copycols(void *cookie, int startrow, int srccol, int dstcol, int ncols)
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
uint8_t *sp, *dp, *basep;
int scanspan, height, width, align, shift, w, y, srcx, dstx;
uint32_t lmask, rmask;
- scanspan = rap->linelongs * 4;
- y = rc->rc_yorigin + rc->rc_font->height * startrow;
- srcx = rc->rc_xorigin + rc->rc_font->width * srccol;
- dstx = rc->rc_xorigin + rc->rc_font->width * dstcol;
- height = rc->rc_font->height;
- w = rc->rc_font->width * ncols;
- basep = (uint8_t *)rap->pixels + y * scanspan;
+ scanspan = ri->ri_stride;
+ y = ri->ri_font->fontheight * startrow;
+ srcx = ri->ri_font->fontwidth * srccol;
+ dstx = ri->ri_font->fontwidth * dstcol;
+ height = ri->ri_font->fontheight;
+ w = ri->ri_font->fontwidth * ncols;
+ basep = (uint8_t *)ri->ri_bits + y * scanspan;
align = shift = srcx & ALIGNMASK;
width = w + align;
align = dstx & ALIGNMASK;
lmask = ALL1BITS >> align;
rmask = ALL1BITS << (-(w + align) & ALIGNMASK);
- shift = align - shift;
+ shift = align - shift;
sp = basep + (srcx / 32) * 4;
dp = basep + (dstx / 32) * 4;
@@ -370,11 +352,22 @@ om_copycols(void *cookie, int startrow,
static int
om_mapchar(void *cookie, int c, u_int *cp)
{
+ struct rasops_info *ri = cookie;
+ struct wsdisplay_font *wf = ri->ri_font;
- if (c < 128) {
- *cp = c;
- return 5;
+ if (wf->encoding != WSDISPLAY_FONTENC_ISO) {
+ c = wsfont_map_unichar(wf, c);
+
+ if (c < 0)
+ goto fail;
}
+ if (c < wf->firstchar || c >= (wf->firstchar + wf->numchars))
+ goto fail;
+
+ *cp = c;
+ return 5;
+
+ fail:
*cp = ' ';
return 0;
}
@@ -385,33 +378,32 @@ om_mapchar(void *cookie, int c, u_int *c
static void
om_cursor(void *cookie, int on, int row, int col)
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
uint8_t *p;
int scanspan, startx, height, width, align, y;
uint32_t lmask, rmask, image;
if (!on) {
/* make sure it's on */
- if ((rc->rc_bits & RC_CURSOR) == 0)
+ if ((ri->ri_flg & RI_CURSOR) == 0)
return;
- row = *rc->rc_crowp;
- col = *rc->rc_ccolp;
+ row = ri->ri_crow;
+ col = ri->ri_ccol;
} else {
/* unpaint the old copy. */
- *rc->rc_crowp = row;
- *rc->rc_ccolp = col;
+ ri->ri_crow = row;
+ ri->ri_ccol = col;
}
- scanspan = rap->linelongs * 4;
- y = rc->rc_yorigin + rc->rc_font->height * row;
- startx = rc->rc_xorigin + rc->rc_font->width * col;
- height = rc->rc_font->height;
+ scanspan = ri->ri_stride;
+ y = ri->ri_font->fontheight * row;
+ startx = ri->ri_font->fontwidth * col;
+ height = ri->ri_font->fontheight;
- p = (uint8_t *)rap->pixels + y * scanspan + ((startx / 32) * 4);
+ p = (uint8_t *)ri->ri_bits + y * scanspan + ((startx / 32) * 4);
align = startx & ALIGNMASK;
- width = rc->rc_font->width + align;
+ width = ri->ri_font->fontwidth + align;
lmask = ALL1BITS >> align;
rmask = ALL1BITS << (-width & ALIGNMASK);
if (width <= BLITWIDTH) {
@@ -436,7 +428,7 @@ om_cursor(void *cookie, int on, int row,
height--;
}
}
- rc->rc_bits ^= RC_CURSOR;
+ ri->ri_flg ^= RI_CURSOR;
}
/*
@@ -447,7 +439,7 @@ om_allocattr(void *id, int fg, int bg, i
{
if (flags & (WSATTR_HILIT | WSATTR_BLINK |
- WSATTR_UNDERLINE | WSATTR_WSCOLORS))
+ WSATTR_UNDERLINE | WSATTR_WSCOLORS))
return EINVAL;
if (flags & WSATTR_REVERSE)
*attrp = 1;
@@ -456,42 +448,92 @@ om_allocattr(void *id, int fg, int bg, i
return 0;
}
-void
-rcons_init(struct rcons *rc, int mrow, int mcol)
+/*
+ * Init subset of rasops(9) for omrasops.
+ */
+int
+omrasops_init(struct rasops_info *ri, int wantrows, int wantcols)
{
- struct raster *rp = rc->rc_sp;
- int i;
+ int wsfcookie, bpp;
-#ifdef USE_OMRONFONT
- rc->rc_font = &omron20; /* 12x22 monospacing font */
-#else
- rc->rc_font = &gallant19; /* 12x22 monospacing font */
-#endif
-
- /* Get distance to top and bottom of font from font origin */
- rc->rc_font_ascent = -(rc->rc_font->chars)['a'].homey;
-
- i = rp->height / rc->rc_font->height;
- rc->rc_maxrow = min(i, mrow);
-
- i = rp->width / rc->rc_font->width;
- rc->rc_maxcol = min(i, mcol);
-
- /* Center emulator screen (but align x origin to 32 bits) */
- rc->rc_xorigin =
- ((rp->width - rc->rc_maxcol * rc->rc_font->width) / 2) & ~ALIGNMASK;
- rc->rc_yorigin =
- (rp->height - rc->rc_maxrow * rc->rc_font->height) / 2;
-#if 0
- /* Raster width used for row copies */
- rc->rc_raswidth = rc->rc_maxcol * rc->rc_font->width;
- if (rc->rc_raswidth & ALIGNMASK) {
- /* Pad to 32 bits */
- i = (rc->rc_raswidth + ALIGNMASK) & ~ALIGNMASK;
- /* Make sure width isn't too wide */
- if (rc->rc_xorigin + i <= rp->width)
- rc->rc_raswidth = i;
- }
-#endif
- rc->rc_bits = 0;
+ if (wantrows == 0)
+ wantrows = 34;
+ if (wantrows < 10)
+ wantrows = 10;
+ if (wantcols == 0)
+ wantcols = 80;
+ if (wantcols < 20)
+ wantcols = 20;
+
+ /* Use default font */
+ wsfont_init();
+ wsfcookie = wsfont_find(NULL, 0, 0, 0, WSDISPLAY_FONTORDER_L2R,
+ WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP);
+ if (wsfcookie < 0)
+ panic("%s: no font available", __func__);
+ if (wsfont_lock(wsfcookie, &ri->ri_font))
+ panic("%s: unable to lock font", __func__);
+ ri->ri_wsfcookie = wsfcookie;
+
+ KASSERT(ri->ri_font->fontwidth > 4 && ri->ri_font->fontwidth <= 32);
+
+ bpp = ri->ri_depth;
+
+ /* Now constrain what they get */
+ ri->ri_emuwidth = ri->ri_font->fontwidth * wantcols;
+ ri->ri_emuheight = ri->ri_font->fontheight * wantrows;
+ if (ri->ri_emuwidth > ri->ri_width)
+ ri->ri_emuwidth = ri->ri_width;
+ if (ri->ri_emuheight > ri->ri_height)
+ ri->ri_emuheight = ri->ri_height;
+
+ /* Reduce width until aligned on a 32-bit boundary */
+ while ((ri->ri_emuwidth * bpp & 31) != 0)
+ ri->ri_emuwidth--;
+
+ ri->ri_cols = ri->ri_emuwidth / ri->ri_font->fontwidth;
+ ri->ri_rows = ri->ri_emuheight / ri->ri_font->fontheight;
+ ri->ri_emustride = ri->ri_emuwidth * bpp >> 3;
+ ri->ri_delta = ri->ri_stride - ri->ri_emustride;
+ ri->ri_ccol = 0;
+ ri->ri_crow = 0;
+ ri->ri_pelbytes = bpp >> 3;
+
+ ri->ri_xscale = (ri->ri_font->fontwidth * bpp) >> 3;
+ ri->ri_yscale = ri->ri_font->fontheight * ri->ri_stride;
+ ri->ri_fontscale = ri->ri_font->fontheight * ri->ri_font->stride;
+
+ /* Clear the entire display */
+ if ((ri->ri_flg & RI_CLEAR) != 0)
+ memset(ri->ri_bits, 0, ri->ri_stride * ri->ri_height);
+
+ /* Now centre our window if needs be */
+ ri->ri_origbits = ri->ri_bits;
+
+ if ((ri->ri_flg & RI_CENTER) != 0) {
+ ri->ri_bits += (((ri->ri_width * bpp >> 3) -
+ ri->ri_emustride) >> 1) & ~3;
+ ri->ri_bits += ((ri->ri_height - ri->ri_emuheight) >> 1) *
+ ri->ri_stride;
+ ri->ri_yorigin = (int)(ri->ri_bits - ri->ri_origbits)
+ / ri->ri_stride;
+ ri->ri_xorigin = (((int)(ri->ri_bits - ri->ri_origbits)
+ % ri->ri_stride) * 8 / bpp);
+ } else
+ ri->ri_xorigin = ri->ri_yorigin = 0;
+
+ /* fill our own emulops */
+ ri->ri_ops.cursor = om_cursor;
+ ri->ri_ops.mapchar = om_mapchar;
+ ri->ri_ops.putchar = om_putchar;
+ ri->ri_ops.copycols = om_copycols;
+ ri->ri_ops.erasecols = om_erasecols;
+ ri->ri_ops.copyrows = om_copyrows;
+ ri->ri_ops.eraserows = om_eraserows;
+ ri->ri_ops.allocattr = om_allocattr;
+ ri->ri_caps = WSSCREEN_REVERSE;
+
+ ri->ri_flg |= RI_CFGDONE;
+
+ return 0;
}
Index: src/sys/arch/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.47 src/sys/arch/luna68k/luna68k/locore.s:1.47.2.1
--- src/sys/arch/luna68k/luna68k/locore.s:1.47 Thu Dec 22 15:33:30 2011
+++ src/sys/arch/luna68k/luna68k/locore.s Wed Jul 25 21:30:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.47 2011/12/22 15:33:30 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.47.2.1 2012/07/25 21:30:35 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -1062,7 +1062,9 @@ GLOBAL(doadump)
* and return to monitor.
*/
ENTRY_NOPROFILE(doboot)
- movw #PSL_HIGHIPL,%sr | no interrupts
+ movw #PSL_HIGHIPL,%sr | no interrupts
+ movl _C_LABEL(boothowto),%d7 | load howto
+ movl %sp@(4),%d2 | arg
#if defined(M68040)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jeq Lnocache5 | yes, skip
@@ -1085,18 +1087,9 @@ Lnocache5:
.long 0x4e7b0807 | movc %d0,%srp
#endif /* M68040 */
Lbootcommon:
- movl _C_LABEL(boothowto),%d0 | load howto
- movl %sp@(4),%d2 | arg
lea _ASM_LABEL(tmpstk),%sp | physical SP in case of NMI
movl #0,%d3
movc %d3,%vbr | monitor %vbr
-#if 0
- andl #0,%d0 | mask off
- tstl %d0 |
- bne Lsboot | sboot?
- tstl %d2
- beq Ldoreset
-#endif
movl #0x41000000,%a0 | base = (int **)0x4100.0000
movl %a0@,%d0 | *((int *)base[0])
Added files:
Index: src/sys/arch/luna68k/dev/omrasopsvar.h
diff -u /dev/null src/sys/arch/luna68k/dev/omrasopsvar.h:1.1.2.2
--- /dev/null Wed Jul 25 21:30:35 2012
+++ src/sys/arch/luna68k/dev/omrasopsvar.h Wed Jul 25 21:30:35 2012
@@ -0,0 +1,29 @@
+/* $NetBSD: omrasopsvar.h,v 1.1.2.2 2012/07/25 21:30:35 martin Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+int omrasops_init(struct rasops_info *, int, int);