diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-04-14 21:05:45 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-04-14 21:05:45 +0000 |
commit | 60325da4a39fcd16651706a8a0c66591a318b441 (patch) | |
tree | 1d543eaedd5d4774dc8ab948dc78df4fad0a3ebe /sys | |
parent | c259092bfb66e5bf36cf1f84ac4f6a168d0adaba (diff) |
Minimal support for the HP98705 ``Tigershark'' TurboVRX frame buffer
(using an overlay plane only for now). Bootblocks, text console and X11
are supported.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hp300/conf/GENERIC | 6 | ||||
-rw-r--r-- | sys/arch/hp300/conf/RAMDISK | 6 | ||||
-rw-r--r-- | sys/arch/hp300/conf/files.hp300 | 12 | ||||
-rw-r--r-- | sys/arch/hp300/dev/diofb_mono.c | 312 | ||||
-rw-r--r-- | sys/arch/hp300/dev/diofbvar.h | 6 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hyper.c | 240 | ||||
-rw-r--r-- | sys/arch/hp300/dev/tvrx.c | 207 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/wscons_machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/hp300/stand/common/Makefile | 6 | ||||
-rw-r--r-- | sys/arch/hp300/stand/common/ite.c | 6 | ||||
-rw-r--r-- | sys/arch/hp300/stand/common/ite_tvrx.c | 84 | ||||
-rw-r--r-- | sys/arch/hp300/stand/common/version.c | 6 | ||||
-rw-r--r-- | sys/arch/hp300/stand/include/itevar.h | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wsconsio.h | 3 |
14 files changed, 657 insertions, 257 deletions
diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC index 721f4aff770..6bcd80b3e28 100644 --- a/sys/arch/hp300/conf/GENERIC +++ b/sys/arch/hp300/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.44 2006/02/14 18:11:03 miod Exp $ +# $OpenBSD: GENERIC,v 1.45 2006/04/14 21:05:43 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -95,6 +95,10 @@ topcat* at intio? topcat* at dio? wsdisplay* at topcat? +# TurboVRX framebuffer +tvrx* at dio? +wsdisplay* at tvrx? + # SGC framebuffers sti* at sgc? wsdisplay* at sti? diff --git a/sys/arch/hp300/conf/RAMDISK b/sys/arch/hp300/conf/RAMDISK index a6f5b6840d0..c7eaf33865e 100644 --- a/sys/arch/hp300/conf/RAMDISK +++ b/sys/arch/hp300/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.26 2005/09/27 22:05:36 miod Exp $ +# $OpenBSD: RAMDISK,v 1.27 2006/04/14 21:05:43 miod Exp $ # # Ram disk kernel. # @@ -105,6 +105,10 @@ topcat* at intio? topcat* at dio? wsdisplay* at topcat? +# TurboVRX framebuffer +tvrx* at dio? +wsdisplay* at tvrx? + # SGC framebuffers sti* at sgc? wsdisplay* at sti? diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300 index 49d21f4f876..706a27379b4 100644 --- a/sys/arch/hp300/conf/files.hp300 +++ b/sys/arch/hp300/conf/files.hp300 @@ -1,4 +1,4 @@ -# $OpenBSD: files.hp300,v 1.30 2005/12/31 19:30:14 miod Exp $ +# $OpenBSD: files.hp300,v 1.31 2006/04/14 21:05:43 miod Exp $ # $NetBSD: files.hp300,v 1.28 1997/05/12 08:23:28 thorpej Exp $ # # hp300-specific configuration info @@ -70,7 +70,9 @@ file arch/hp300/hp300/wscons_machdep.c wsdisplay # Frame buffer devices # define diofb -file arch/hp300/dev/diofb.c diofb +define diofb_mono +file arch/hp300/dev/diofb.c diofb | diofb_mono +file arch/hp300/dev/diofb_mono.c diofb_mono device dvbox: wsemuldisplaydev, diofb, rasops8 attach dvbox at intio with dvbox_intio @@ -82,7 +84,7 @@ attach gbox at intio with gbox_intio attach gbox at dio with gbox_dio file arch/hp300/dev/gbox.c gbox needs-flag -device hyper: wsemuldisplaydev, diofb, rasops1 +device hyper: wsemuldisplaydev, diofb_mono, rasops1 attach hyper at dio file arch/hp300/dev/hyper.c hyper needs-flag @@ -96,6 +98,10 @@ attach topcat at intio with topcat_intio attach topcat at dio with topcat_dio file arch/hp300/dev/topcat.c topcat needs-flag +device tvrx: wsemuldisplaydev, diofb_mono, rasops1 +attach tvrx at dio +file arch/hp300/dev/tvrx.c tvrx needs-flag + # # Other devices on the DIO bus # diff --git a/sys/arch/hp300/dev/diofb_mono.c b/sys/arch/hp300/dev/diofb_mono.c new file mode 100644 index 00000000000..50630815c9a --- /dev/null +++ b/sys/arch/hp300/dev/diofb_mono.c @@ -0,0 +1,312 @@ +/* $OpenBSD: diofb_mono.c,v 1.1 2006/04/14 21:05:43 miod Exp $ */ + +/* + * Copyright (c) 2005, Miodrag Vallat. + * 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 AUTHOR ``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 AUTHOR 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. + * + */ +/* + * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. + * Copyright (c) 1991 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Mark Davies of the Department of Computer + * Science, Victoria University of Wellington, New Zealand. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$ + * + * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94 + */ + +/* + * Graphics routines for real 1bpp frame buffers (i.e. pixels not being + * byte-addressed) + */ + +#include <sys/param.h> +#include <sys/systm.h> + +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsdisplayvar.h> +#include <dev/rasops/rasops.h> + +#include <hp300/dev/diofbreg.h> +#include <hp300/dev/diofbvar.h> + +#include <hp300/dev/maskbits.h> + +/* NOTE: + * the first element in starttab could be 0xffffffff. making it 0 + * lets us deal with a full first word in the middle loop, rather + * than having to do the multiple reads and masks that we'd + * have to do if we thought it was partial. + */ +const int starttab[32] = { + 0x00000000, + 0x7FFFFFFF, + 0x3FFFFFFF, + 0x1FFFFFFF, + 0x0FFFFFFF, + 0x07FFFFFF, + 0x03FFFFFF, + 0x01FFFFFF, + 0x00FFFFFF, + 0x007FFFFF, + 0x003FFFFF, + 0x001FFFFF, + 0x000FFFFF, + 0x0007FFFF, + 0x0003FFFF, + 0x0001FFFF, + 0x0000FFFF, + 0x00007FFF, + 0x00003FFF, + 0x00001FFF, + 0x00000FFF, + 0x000007FF, + 0x000003FF, + 0x000001FF, + 0x000000FF, + 0x0000007F, + 0x0000003F, + 0x0000001F, + 0x0000000F, + 0x00000007, + 0x00000003, + 0x00000001 +}; + +const int endtab[32] = { + 0x00000000, + 0x80000000, + 0xC0000000, + 0xE0000000, + 0xF0000000, + 0xF8000000, + 0xFC000000, + 0xFE000000, + 0xFF000000, + 0xFF800000, + 0xFFC00000, + 0xFFE00000, + 0xFFF00000, + 0xFFF80000, + 0xFFFC0000, + 0xFFFE0000, + 0xFFFF0000, + 0xFFFF8000, + 0xFFFFC000, + 0xFFFFE000, + 0xFFFFF000, + 0xFFFFF800, + 0xFFFFFC00, + 0xFFFFFE00, + 0xFFFFFF00, + 0xFFFFFF80, + 0xFFFFFFC0, + 0xFFFFFFE0, + 0xFFFFFFF0, + 0xFFFFFFF8, + 0xFFFFFFFC, + 0xFFFFFFFE +}; + +void +diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, + u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop) +{ + int width; /* add to get to same position in next line */ + + unsigned int *psrcLine, *pdstLine; + /* pointers to line with current src and dst */ + unsigned int *psrc; /* pointer to current src longword */ + unsigned int *pdst; /* pointer to current dst longword */ + + /* following used for looping through a line */ + unsigned int startmask, endmask; /* masks for writing ends of dst */ + int nlMiddle; /* whole longwords in dst */ + int nl; /* temp copy of nlMiddle */ + unsigned int tmpSrc; + /* place to store full source word */ + int xoffSrc; /* offset (>= 0, < 32) from which to + fetch whole longwords fetched in src */ + int nstart; /* number of ragged bits at start of dst */ + int nend; /* number of ragged bits at end of dst */ + int srcStartOver; /* pulling nstart bits from src + overflows into the next word? */ + + width = fb->fbwidth >> 5; + + if (sy < dy) { /* start at last scanline of rectangle */ + psrcLine = ((u_int *)fb->fbkva) + ((sy + cy - 1) * width); + pdstLine = ((u_int *)fb->fbkva) + ((dy + cy - 1) * width); + width = -width; + } else { /* start at first scanline */ + psrcLine = ((u_int *)fb->fbkva) + (sy * width); + pdstLine = ((u_int *)fb->fbkva) + (dy * width); + } + + /* x direction doesn't matter for < 1 longword */ + if (cx <= 32) { + int srcBit, dstBit; /* bit offset of src and dst */ + + pdstLine += (dx >> 5); + psrcLine += (sx >> 5); + psrc = psrcLine; + pdst = pdstLine; + + srcBit = sx & 0x1f; + dstBit = dx & 0x1f; + + while (cy--) { + getandputrop(psrc, srcBit, dstBit, cx, pdst, rop); + pdst += width; + psrc += width; + } + } else { + maskbits(dx, cx, startmask, endmask, nlMiddle); + if (startmask) + nstart = 32 - (dx & 0x1f); + else + nstart = 0; + if (endmask) + nend = (dx + cx) & 0x1f; + else + nend = 0; + + xoffSrc = ((sx & 0x1f) + nstart) & 0x1f; + srcStartOver = ((sx & 0x1f) + nstart) > 31; + + if (sx >= dx) { /* move left to right */ + pdstLine += (dx >> 5); + psrcLine += (sx >> 5); + + while (cy--) { + psrc = psrcLine; + pdst = pdstLine; + + if (startmask) { + getandputrop(psrc, (sx & 0x1f), + (dx & 0x1f), nstart, pdst, rop); + pdst++; + if (srcStartOver) + psrc++; + } + + /* special case for aligned operations */ + if (xoffSrc == 0) { + nl = nlMiddle; + while (nl--) { + DoRop(*pdst, rop, *psrc++, + *pdst); + pdst++; + } + } else { + nl = nlMiddle + 1; + while (--nl) { + getunalignedword(psrc, xoffSrc, + tmpSrc); + DoRop(*pdst, rop, tmpSrc, + *pdst); + pdst++; + psrc++; + } + } + + if (endmask) { + getandputrop0(psrc, xoffSrc, nend, + pdst, rop); + } + + pdstLine += width; + psrcLine += width; + } + } else { /* move right to left */ + pdstLine += ((dx + cx) >> 5); + psrcLine += ((sx + cx) >> 5); + /* + * If fetch of last partial bits from source crosses + * a longword boundary, start at the previous longword + */ + if (xoffSrc + nend >= 32) + --psrcLine; + + while (cy--) { + psrc = psrcLine; + pdst = pdstLine; + + if (endmask) { + getandputrop0(psrc, xoffSrc, nend, + pdst, rop); + } + + nl = nlMiddle + 1; + while (--nl) { + --psrc; + --pdst; + getunalignedword(psrc, xoffSrc, tmpSrc); + DoRop(*pdst, rop, tmpSrc, *pdst); + } + + if (startmask) { + if (srcStartOver) + --psrc; + --pdst; + getandputrop(psrc, (sx & 0x1f), + (dx & 0x1f), nstart, pdst, rop); + } + + pdstLine += width; + psrcLine += width; + } + } + } +} diff --git a/sys/arch/hp300/dev/diofbvar.h b/sys/arch/hp300/dev/diofbvar.h index e7a37ee1f38..99b9b950388 100644 --- a/sys/arch/hp300/dev/diofbvar.h +++ b/sys/arch/hp300/dev/diofbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diofbvar.h,v 1.7 2006/03/12 22:52:59 miod Exp $ */ +/* $OpenBSD: diofbvar.h,v 1.8 2006/04/14 21:05:43 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -123,12 +123,16 @@ paddr_t diofb_mmap(void *, off_t, int); int diofb_show_screen(void *, void *, int, void (*)(void *, int, int), void *); +void diofb_mono_windowmove(struct diofb *, u_int16_t, u_int16_t, + u_int16_t, u_int16_t, u_int16_t, u_int16_t, int); + /* Console support */ void dvboxcninit(void); void gboxcninit(void); void hypercninit(void); void rboxcninit(void); void topcatcninit(void); +void tvrxcninit(void); extern struct diofb diofb_cn; /* struct diofb for console device */ #endif diff --git a/sys/arch/hp300/dev/hyper.c b/sys/arch/hp300/dev/hyper.c index 712a115cea4..06fe98c6a42 100644 --- a/sys/arch/hp300/dev/hyper.c +++ b/sys/arch/hp300/dev/hyper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hyper.c,v 1.14 2005/12/31 18:13:41 miod Exp $ */ +/* $OpenBSD: hyper.c,v 1.15 2006/04/14 21:05:43 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -112,8 +112,6 @@ struct cfdriver hyper_cd = { }; int hyper_reset(struct diofb *, int, struct diofbreg *); -void hyper_windowmove(struct diofb *, u_int16_t, u_int16_t, - u_int16_t, u_int16_t, u_int16_t, u_int16_t, int); int hyper_ioctl(void *, u_long, caddr_t, int, struct proc *); void hyper_burner(void *, u_int, u_int); @@ -185,7 +183,7 @@ hyper_reset(struct diofb *fb, int scode, struct diofbreg *fbr) if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0) return (rc); - fb->bmv = hyper_windowmove; + fb->bmv = diofb_mono_windowmove; fb->ri.ri_depth = 1; /* do not fake a 8bpp frame buffer */ diofb_fbsetup(fb); @@ -248,240 +246,6 @@ hyper_burner(void *v, u_int on, u_int flags) } /* - * Display routines - */ - -#include <hp300/dev/maskbits.h> - -/* NOTE: - * the first element in starttab could be 0xffffffff. making it 0 - * lets us deal with a full first word in the middle loop, rather - * than having to do the multiple reads and masks that we'd - * have to do if we thought it was partial. - */ -const int starttab[32] = { - 0x00000000, - 0x7FFFFFFF, - 0x3FFFFFFF, - 0x1FFFFFFF, - 0x0FFFFFFF, - 0x07FFFFFF, - 0x03FFFFFF, - 0x01FFFFFF, - 0x00FFFFFF, - 0x007FFFFF, - 0x003FFFFF, - 0x001FFFFF, - 0x000FFFFF, - 0x0007FFFF, - 0x0003FFFF, - 0x0001FFFF, - 0x0000FFFF, - 0x00007FFF, - 0x00003FFF, - 0x00001FFF, - 0x00000FFF, - 0x000007FF, - 0x000003FF, - 0x000001FF, - 0x000000FF, - 0x0000007F, - 0x0000003F, - 0x0000001F, - 0x0000000F, - 0x00000007, - 0x00000003, - 0x00000001 -}; - -const int endtab[32] = { - 0x00000000, - 0x80000000, - 0xC0000000, - 0xE0000000, - 0xF0000000, - 0xF8000000, - 0xFC000000, - 0xFE000000, - 0xFF000000, - 0xFF800000, - 0xFFC00000, - 0xFFE00000, - 0xFFF00000, - 0xFFF80000, - 0xFFFC0000, - 0xFFFE0000, - 0xFFFF0000, - 0xFFFF8000, - 0xFFFFC000, - 0xFFFFE000, - 0xFFFFF000, - 0xFFFFF800, - 0xFFFFFC00, - 0xFFFFFE00, - 0xFFFFFF00, - 0xFFFFFF80, - 0xFFFFFFC0, - 0xFFFFFFE0, - 0xFFFFFFF0, - 0xFFFFFFF8, - 0xFFFFFFFC, - 0xFFFFFFFE -}; - -void -hyper_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, - u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop) -{ - int width; /* add to get to same position in next line */ - - unsigned int *psrcLine, *pdstLine; - /* pointers to line with current src and dst */ - unsigned int *psrc; /* pointer to current src longword */ - unsigned int *pdst; /* pointer to current dst longword */ - - /* following used for looping through a line */ - unsigned int startmask, endmask; /* masks for writing ends of dst */ - int nlMiddle; /* whole longwords in dst */ - int nl; /* temp copy of nlMiddle */ - unsigned int tmpSrc; - /* place to store full source word */ - int xoffSrc; /* offset (>= 0, < 32) from which to - fetch whole longwords fetched in src */ - int nstart; /* number of ragged bits at start of dst */ - int nend; /* number of ragged bits at end of dst */ - int srcStartOver; /* pulling nstart bits from src - overflows into the next word? */ - - width = fb->fbwidth >> 5; - - if (sy < dy) { /* start at last scanline of rectangle */ - psrcLine = ((u_int *)fb->fbkva) + ((sy + cy - 1) * width); - pdstLine = ((u_int *)fb->fbkva) + ((dy + cy - 1) * width); - width = -width; - } else { /* start at first scanline */ - psrcLine = ((u_int *)fb->fbkva) + (sy * width); - pdstLine = ((u_int *)fb->fbkva) + (dy * width); - } - - /* x direction doesn't matter for < 1 longword */ - if (cx <= 32) { - int srcBit, dstBit; /* bit offset of src and dst */ - - pdstLine += (dx >> 5); - psrcLine += (sx >> 5); - psrc = psrcLine; - pdst = pdstLine; - - srcBit = sx & 0x1f; - dstBit = dx & 0x1f; - - while (cy--) { - getandputrop(psrc, srcBit, dstBit, cx, pdst, rop); - pdst += width; - psrc += width; - } - } else { - maskbits(dx, cx, startmask, endmask, nlMiddle); - if (startmask) - nstart = 32 - (dx & 0x1f); - else - nstart = 0; - if (endmask) - nend = (dx + cx) & 0x1f; - else - nend = 0; - - xoffSrc = ((sx & 0x1f) + nstart) & 0x1f; - srcStartOver = ((sx & 0x1f) + nstart) > 31; - - if (sx >= dx) { /* move left to right */ - pdstLine += (dx >> 5); - psrcLine += (sx >> 5); - - while (cy--) { - psrc = psrcLine; - pdst = pdstLine; - - if (startmask) { - getandputrop(psrc, (sx & 0x1f), - (dx & 0x1f), nstart, pdst, rop); - pdst++; - if (srcStartOver) - psrc++; - } - - /* special case for aligned operations */ - if (xoffSrc == 0) { - nl = nlMiddle; - while (nl--) { - DoRop(*pdst, rop, *psrc++, - *pdst); - pdst++; - } - } else { - nl = nlMiddle + 1; - while (--nl) { - getunalignedword(psrc, xoffSrc, - tmpSrc); - DoRop(*pdst, rop, tmpSrc, - *pdst); - pdst++; - psrc++; - } - } - - if (endmask) { - getandputrop0(psrc, xoffSrc, nend, - pdst, rop); - } - - pdstLine += width; - psrcLine += width; - } - } else { /* move right to left */ - pdstLine += ((dx + cx) >> 5); - psrcLine += ((sx + cx) >> 5); - /* - * If fetch of last partial bits from source crosses - * a longword boundary, start at the previous longword - */ - if (xoffSrc + nend >= 32) - --psrcLine; - - while (cy--) { - psrc = psrcLine; - pdst = pdstLine; - - if (endmask) { - getandputrop0(psrc, xoffSrc, nend, - pdst, rop); - } - - nl = nlMiddle + 1; - while (--nl) { - --psrc; - --pdst; - getunalignedword(psrc, xoffSrc, tmpSrc); - DoRop(*pdst, rop, tmpSrc, *pdst); - } - - if (startmask) { - if (srcStartOver) - --psrc; - --pdst; - getandputrop(psrc, (sx & 0x1f), - (dx & 0x1f), nstart, pdst, rop); - } - - pdstLine += width; - psrcLine += width; - } - } - } -} - -/* * Hyperion console support */ diff --git a/sys/arch/hp300/dev/tvrx.c b/sys/arch/hp300/dev/tvrx.c new file mode 100644 index 00000000000..0c65745917c --- /dev/null +++ b/sys/arch/hp300/dev/tvrx.c @@ -0,0 +1,207 @@ +/* $OpenBSD: tvrx.c,v 1.1 2006/04/14 21:05:43 miod Exp $ */ + +/* + * Copyright (c) 2006, Miodrag Vallat. + * 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 AUTHOR ``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 AUTHOR 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. + * + */ + +/* + * Graphics routines for the TurboVRX frame buffer + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/conf.h> +#include <sys/device.h> +#include <sys/proc.h> +#include <sys/ioctl.h> + +#include <machine/autoconf.h> +#include <machine/bus.h> +#include <machine/cpu.h> + +#include <hp300/dev/dioreg.h> +#include <hp300/dev/diovar.h> +#include <hp300/dev/diodevs.h> + +#include <dev/cons.h> + +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsdisplayvar.h> +#include <dev/rasops/rasops.h> + +#include <hp300/dev/diofbreg.h> +#include <hp300/dev/diofbvar.h> + +struct tvrx_softc { + struct device sc_dev; + struct diofb *sc_fb; + struct diofb sc_fb_store; + int sc_scode; +}; + +int tvrx_match(struct device *, void *, void *); +void tvrx_attach(struct device *, struct device *, void *); + +struct cfattach tvrx_ca = { + sizeof(struct tvrx_softc), tvrx_match, tvrx_attach +}; + +struct cfdriver tvrx_cd = { + NULL, "tvrx", DV_DULL +}; + +int tvrx_reset(struct diofb *, int, struct diofbreg *); + +int tvrx_ioctl(void *, u_long, caddr_t, int, struct proc *); + +struct wsdisplay_accessops tvrx_accessops = { + tvrx_ioctl, + diofb_mmap, + diofb_alloc_screen, + diofb_free_screen, + diofb_show_screen, + NULL, /* load_font */ + NULL, /* scrollback */ + NULL, /* getchar */ + NULL /* burner */ +}; + +/* + * Attachment glue + */ + +int +tvrx_match(struct device *parent, void *match, void *aux) +{ + struct dio_attach_args *da = aux; + + if (da->da_id != DIO_DEVICE_ID_FRAMEBUFFER || + da->da_secid != DIO_DEVICE_SECID_TIGERSHARK) + return (0); + + return (1); +} + +void +tvrx_attach(struct device *parent, struct device *self, void *aux) +{ + struct tvrx_softc *sc = (struct tvrx_softc *)self; + struct dio_attach_args *da = aux; + struct diofbreg *fbr; + + sc->sc_scode = da->da_scode; + if (sc->sc_scode == conscode) { + fbr = (struct diofbreg *)conaddr; /* already mapped */ + sc->sc_fb = &diofb_cn; + } else { + sc->sc_fb = &sc->sc_fb_store; + fbr = (struct diofbreg *) + iomap(dio_scodetopa(sc->sc_scode), da->da_size); + if (fbr == NULL || + tvrx_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) { + printf(": can't map framebuffer\n"); + return; + } + } + + diofb_end_attach(sc, &tvrx_accessops, sc->sc_fb, + sc->sc_scode == conscode, NULL); +} + +/* + * Initialize hardware and display routines. + */ +int +tvrx_reset(struct diofb *fb, int scode, struct diofbreg *fbr) +{ + int rc; + + if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0) + return (rc); + + /* + * We rely on the PROM to initialize the frame buffer in the mode + * we expect it: cleared, overlay plane enabled and accessible + * at the beginning of the video memory. + * + * This is NOT the mode we would end up by simply resetting the + * board. + */ + + fb->ri.ri_depth = 1; + fb->bmv = diofb_mono_windowmove; + diofb_fbsetup(fb); + + return (0); +} + +int +tvrx_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) +{ + struct diofb *fb = v; + struct wsdisplay_fbinfo *wdf; + + switch (cmd) { + case WSDISPLAYIO_GTYPE: + *(u_int *)data = WSDISPLAY_TYPE_TVRX; + break; + case WSDISPLAYIO_SMODE: + fb->mapmode = *(u_int *)data; + break; + case WSDISPLAYIO_GINFO: + wdf = (void *)data; + wdf->width = fb->ri.ri_width; + wdf->height = fb->ri.ri_height; + wdf->depth = fb->ri.ri_depth; + wdf->cmsize = 0; + break; + case WSDISPLAYIO_LINEBYTES: + *(u_int *)data = fb->ri.ri_stride; + break; + case WSDISPLAYIO_GETCMAP: + case WSDISPLAYIO_PUTCMAP: + break; /* until color support is implemented */ + case WSDISPLAYIO_GVIDEO: + case WSDISPLAYIO_SVIDEO: + /* unsupported */ + return (-1); + default: + return (-1); + } + + return (0); +} + +/* + * Console support + */ + +void +tvrxcninit() +{ + tvrx_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr); + diofb_cnattach(&diofb_cn); +} diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c index b0f17e17042..ea700592f65 100644 --- a/sys/arch/hp300/hp300/wscons_machdep.c +++ b/sys/arch/hp300/hp300/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.6 2006/01/01 11:59:39 miod Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.7 2006/04/14 21:05:44 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -79,7 +79,8 @@ #include "hyper.h" #include "rbox.h" #include "topcat.h" -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 +#include "tvrx.h" +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 #include <hp300/dev/dioreg.h> #include <hp300/dev/diovar.h> #include <hp300/dev/diofbreg.h> @@ -105,7 +106,7 @@ cons_decl(ws); void (*wsfbcninit)(void) = NULL; -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 int dio_fbidentify(struct diofbreg *); /* @@ -144,6 +145,11 @@ dio_fbidentify(struct diofbreg *fbr) wsfbcninit = topcatcninit; return (1); #endif +#if NTVRX > 0 + case GID_TIGER: + wsfbcninit = tvrxcninit; + return (1); +#endif default: break; } @@ -167,7 +173,7 @@ wscnprobe(struct consdev *cp) int maj, tmpconscode; vsize_t mapsize; vaddr_t va; -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 paddr_t pa; u_int scode, sctop; struct diofbreg *fbr; @@ -196,7 +202,7 @@ wscnprobe(struct consdev *cp) } #endif -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 /* * Scan the DIO bus. */ diff --git a/sys/arch/hp300/stand/common/Makefile b/sys/arch/hp300/stand/common/Makefile index e7016d178b2..59fd5c9d82c 100644 --- a/sys/arch/hp300/stand/common/Makefile +++ b/sys/arch/hp300/stand/common/Makefile @@ -1,12 +1,12 @@ -# $OpenBSD: Makefile,v 1.4 1999/08/16 09:43:08 downsj Exp $ +# $OpenBSD: Makefile,v 1.5 2006/04/14 21:05:44 miod Exp $ LIB= common NOMAN= noman SRCS= apci.c autoconf.c cons.c ct.c dca.c dcm.c dnkbd.c \ - fhpib.c hd.c hil.c hpib.c if_le.c ite.c ite_dv.c ite_gb.c ite_rb.c \ - ite_subr.c ite_tc.c ite_hy.c kbd.c kbdconf.c machdep.c \ + fhpib.c hd.c hil.c hpib.c if_le.c ite.c ite_dv.c ite_gb.c ite_hy.c \ + ite_rb.c ite_subr.c ite_tc.c ite_tvrx.c kbd.c kbdconf.c machdep.c \ nhpib.c prf.c scsi.c sd.c version.c CFLAGS= -O2 -msoft-float -I${.CURDIR}/../include \ diff --git a/sys/arch/hp300/stand/common/ite.c b/sys/arch/hp300/stand/common/ite.c index 26b1e737ab1..a2d5fd43f0f 100644 --- a/sys/arch/hp300/stand/common/ite.c +++ b/sys/arch/hp300/stand/common/ite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ite.c,v 1.5 2005/04/22 00:42:16 miod Exp $ */ +/* $OpenBSD: ite.c,v 1.6 2006/04/14 21:05:44 miod Exp $ */ /* $NetBSD: ite.c,v 1.12 1997/01/30 10:32:55 thorpej Exp $ */ /* @@ -90,6 +90,10 @@ struct itesw itesw[] = { { GID_HYPERION, hyper_init, ite_deinit_noop, hyper_clear, hyper_putc, hyper_cursor, hyper_scroll, ite_readbyte, ite_writeglyph }, + + { GID_TIGER, + tvrx_init, ite_deinit_noop, hyper_clear, hyper_putc, + hyper_cursor, hyper_scroll, ite_readbyte, ite_writeglyph }, }; int nitesw = sizeof(itesw) / sizeof(itesw[0]); diff --git a/sys/arch/hp300/stand/common/ite_tvrx.c b/sys/arch/hp300/stand/common/ite_tvrx.c new file mode 100644 index 00000000000..06bf87f9328 --- /dev/null +++ b/sys/arch/hp300/stand/common/ite_tvrx.c @@ -0,0 +1,84 @@ +/* $OpenBSD: ite_tvrx.c,v 1.1 2006/04/14 21:05:44 miod Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Mark Davies of the Department of Computer + * Science, Victoria University of Wellington, New Zealand. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: ite_hy.c 1.1 92/01/22$ + * + * @(#)ite_hy.c 8.1 (Berkeley) 6/10/93 + */ + +#include "samachdep.h" + +#ifdef ITECONSOLE +#include <sys/param.h> + +#include "itevar.h" +#include "itereg.h" + +#undef charX +#define charX(ip,c) \ + (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx) + +/* this reuses most of the hyperion code */ +void hyper_ite_fontinit(struct ite_data *); +void hyper_windowmove(struct ite_data *, int, int, int, int, + int, int, int); + +void +tvrx_init(ip) + register struct ite_data *ip; +{ + int width; + + ite_fontinfo(ip); + width = ((ip->ftwidth + 7) / 8) * 8; + ip->cpl = (ip->fbwidth - ip->dwidth) / width; + ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight; + + /* + * Clear the framebuffer on all planes. + */ + hyper_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR); + + hyper_ite_fontinit(ip); + + /* + * Stash the inverted cursor. + */ + hyper_windowmove(ip, charY(ip, ' '), charX(ip, ' '), + ip->cblanky, ip->cblankx, ip->ftheight, + ip->ftwidth, RR_COPYINVERTED); +} +#endif diff --git a/sys/arch/hp300/stand/common/version.c b/sys/arch/hp300/stand/common/version.c index cbad9c2aa50..94a6d150842 100644 --- a/sys/arch/hp300/stand/common/version.c +++ b/sys/arch/hp300/stand/common/version.c @@ -1,4 +1,4 @@ -/* $OpenBSD: version.c,v 1.6 2005/12/31 17:59:47 miod Exp $ */ +/* $OpenBSD: version.c,v 1.7 2006/04/14 21:05:44 miod Exp $ */ /* * Record major changes in the boot code here, and increment the version @@ -22,6 +22,8 @@ * * 2.7 Minor syncs with the kernel (recognize more models * and use the same logic to pick the console on 425e). + * + * 2.8 TurboVRX frame buffer support. */ -const char version[] = "2.7"; +const char version[] = "2.8"; diff --git a/sys/arch/hp300/stand/include/itevar.h b/sys/arch/hp300/stand/include/itevar.h index e0300db0eb1..a86de824cc3 100644 --- a/sys/arch/hp300/stand/include/itevar.h +++ b/sys/arch/hp300/stand/include/itevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: itevar.h,v 1.3 2003/06/02 23:27:46 millert Exp $ */ +/* $OpenBSD: itevar.h,v 1.4 2006/04/14 21:05:44 miod Exp $ */ /* $NetBSD: itevar.h,v 1.1 1996/03/03 04:23:42 thorpej Exp $ */ /* @@ -226,3 +226,5 @@ void hyper_clear(struct ite_data *, int, int, int, int); void hyper_putc(struct ite_data *, int, int, int, int); void hyper_cursor(struct ite_data *, int); void hyper_scroll(struct ite_data *, int, int, int, int); + +void tvrx_init(struct ite_data *); diff --git a/sys/dev/wscons/wsconsio.h b/sys/dev/wscons/wsconsio.h index 1f8a6632986..099ac48eb85 100644 --- a/sys/dev/wscons/wsconsio.h +++ b/sys/dev/wscons/wsconsio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsio.h,v 1.38 2006/02/14 18:52:17 miod Exp $ */ +/* $OpenBSD: wsconsio.h,v 1.39 2006/04/14 21:05:44 miod Exp $ */ /* $NetBSD: wsconsio.h,v 1.74 2005/04/28 07:15:44 martin Exp $ */ /* @@ -288,6 +288,7 @@ struct wsmouse_calibcoords { #define WSDISPLAY_TYPE_PXALCD 48 /* PXALCD (Zaurus) */ #define WSDISPLAY_TYPE_MAC68K 49 /* Generic mac68k framebuffer */ #define WSDISPLAY_TYPE_SUNLEO 50 /* Sun ZX/Leo */ +#define WSDISPLAY_TYPE_TVRX 51 /* HP TurboVRX */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo { |