KNF and space/TAB cleanup.
This commit is contained in:
parent
1e6d7bcb87
commit
a8c7515f5f
116
sys/dev/ic/vga.c
116
sys/dev/ic/vga.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga.c,v 1.65 2003/01/20 07:28:26 simonb Exp $ */
|
||||
/* $NetBSD: vga.c,v 1.66 2003/01/27 14:46:10 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.65 2003/01/20 07:28:26 simonb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.66 2003/01/27 14:46:10 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -55,12 +55,16 @@ __KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.65 2003/01/20 07:28:26 simonb Exp $");
|
||||
#include "opt_wsdisplay_compat.h"
|
||||
|
||||
static struct wsdisplay_font _vga_builtinfont = {
|
||||
"builtin",
|
||||
0, 256,
|
||||
WSDISPLAY_FONTENC_IBM,
|
||||
8, 16, 1,
|
||||
WSDISPLAY_FONTORDER_L2R, 0,
|
||||
0
|
||||
"builtin", /* typeface name */
|
||||
0, /* firstchar */
|
||||
256, /* numbers */
|
||||
WSDISPLAY_FONTENC_IBM, /* encoding */
|
||||
8, /* width */
|
||||
16, /* height */
|
||||
1, /* stride */
|
||||
WSDISPLAY_FONTORDER_L2R, /* bit order */
|
||||
0, /* byte order */
|
||||
NULL /* data */
|
||||
};
|
||||
|
||||
struct egavga_font {
|
||||
@ -291,25 +295,25 @@ egavga_getfont(struct vga_config *vc, struct vgascreen *scr, char *name,
|
||||
|
||||
TAILQ_FOREACH(f, &vc->vc_fontlist, next) {
|
||||
if (wsfont_matches(f->wsfont, name,
|
||||
8, scr->pcs.type->fontheight, 0) &&
|
||||
8, scr->pcs.type->fontheight, 0) &&
|
||||
(!primary || vga_valid_primary_font(f))) {
|
||||
#ifdef VGAFONTDEBUG
|
||||
if (scr != &vga_console_screen || vga_console_attached)
|
||||
printf("vga_getfont: %s already present\n",
|
||||
name ? name : "<default>");
|
||||
name ? name : "<default>");
|
||||
#endif
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
cookie = wsfont_find(name, 8, scr->pcs.type->fontheight, 0,
|
||||
WSDISPLAY_FONTORDER_L2R, 0);
|
||||
WSDISPLAY_FONTORDER_L2R, 0);
|
||||
/* XXX obey "primary" */
|
||||
if (cookie == -1) {
|
||||
#ifdef VGAFONTDEBUG
|
||||
if (scr != &vga_console_screen || vga_console_attached)
|
||||
printf("vga_getfont: %s not found\n",
|
||||
name ? name : "<default>");
|
||||
name ? name : "<default>");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
@ -387,10 +391,10 @@ vga_selectfont(struct vga_config *vc, struct vgascreen *scr, char *name1,
|
||||
#ifdef VGAFONTDEBUG
|
||||
if (scr != &vga_console_screen || vga_console_attached) {
|
||||
printf("vga (%s): font1=%s (slot %d)", type->name,
|
||||
f1->wsfont->name, f1->slot);
|
||||
f1->wsfont->name, f1->slot);
|
||||
if (f2)
|
||||
printf(", font2=%s (slot %d)",
|
||||
f2->wsfont->name, f2->slot);
|
||||
f2->wsfont->name, f2->slot);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
@ -457,7 +461,7 @@ vga_init_screen(struct vga_config *vc, struct vgascreen *scr,
|
||||
* DEC firmware uses a blue background.
|
||||
*/
|
||||
res = vga_allocattr(scr, WSCOL_WHITE, WSCOL_BLUE,
|
||||
WSATTR_WSCOLORS, attrp);
|
||||
WSATTR_WSCOLORS, attrp);
|
||||
else
|
||||
#endif
|
||||
res = vga_allocattr(scr, 0, 0, 0, attrp);
|
||||
@ -490,32 +494,30 @@ vga_init(struct vga_config *vc, bus_space_tag_t iot, bus_space_tag_t memt)
|
||||
u_int8_t mor;
|
||||
int i;
|
||||
|
||||
vh->vh_iot = iot;
|
||||
vh->vh_memt = memt;
|
||||
vh->vh_iot = iot;
|
||||
vh->vh_memt = memt;
|
||||
|
||||
if (bus_space_map(vh->vh_iot, 0x3c0, 0x10, 0, &vh->vh_ioh_vga))
|
||||
panic("vga_init: couldn't map vga io");
|
||||
if (bus_space_map(vh->vh_iot, 0x3c0, 0x10, 0, &vh->vh_ioh_vga))
|
||||
panic("vga_init: couldn't map vga io");
|
||||
|
||||
/* read "misc output register" */
|
||||
mor = bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, 0xc);
|
||||
vh->vh_mono = !(mor & 1);
|
||||
|
||||
if (bus_space_map(vh->vh_iot, (vh->vh_mono ? 0x3b0 : 0x3d0), 0x10, 0,
|
||||
&vh->vh_ioh_6845))
|
||||
panic("vga_init: couldn't map 6845 io");
|
||||
&vh->vh_ioh_6845))
|
||||
panic("vga_init: couldn't map 6845 io");
|
||||
|
||||
if (bus_space_map(vh->vh_memt, 0xa0000, 0x20000, 0, &vh->vh_allmemh))
|
||||
panic("vga_init: couldn't map memory");
|
||||
if (bus_space_map(vh->vh_memt, 0xa0000, 0x20000, 0, &vh->vh_allmemh))
|
||||
panic("vga_init: couldn't map memory");
|
||||
|
||||
if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh,
|
||||
(vh->vh_mono ? 0x10000 : 0x18000), 0x8000,
|
||||
&vh->vh_memh))
|
||||
panic("vga_init: mem subrange failed");
|
||||
if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh,
|
||||
(vh->vh_mono ? 0x10000 : 0x18000), 0x8000, &vh->vh_memh))
|
||||
panic("vga_init: mem subrange failed");
|
||||
|
||||
/* should only reserve the space (no need to map - save KVM) */
|
||||
vc->vc_biostag = memt;
|
||||
if (bus_space_map(vc->vc_biostag, 0xc0000, 0x8000, 0,
|
||||
&vc->vc_bioshdl))
|
||||
if (bus_space_map(vc->vc_biostag, 0xc0000, 0x8000, 0, &vc->vc_bioshdl))
|
||||
vc->vc_biosmapped = 0;
|
||||
else
|
||||
vc->vc_biosmapped = 1;
|
||||
@ -585,11 +587,11 @@ vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot,
|
||||
#define BUILTINFONTLOC (0)
|
||||
#endif
|
||||
vga_builtinfont.wsfont->data =
|
||||
malloc(256 * vga_builtinfont.wsfont->fontheight,
|
||||
M_DEVBUF, M_WAITOK);
|
||||
malloc(256 * vga_builtinfont.wsfont->fontheight,
|
||||
M_DEVBUF, M_WAITOK);
|
||||
vga_readoutchars(&vc->hdl, BUILTINFONTLOC, 0, 256,
|
||||
vga_builtinfont.wsfont->fontheight,
|
||||
vga_builtinfont.wsfont->data);
|
||||
vga_builtinfont.wsfont->fontheight,
|
||||
vga_builtinfont.wsfont->data);
|
||||
|
||||
vc->vc_type = type;
|
||||
vc->vc_funcs = vf;
|
||||
@ -603,7 +605,7 @@ vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot,
|
||||
aa.accessops = &vga_accessops;
|
||||
aa.accesscookie = vc;
|
||||
|
||||
config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
|
||||
config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
|
||||
}
|
||||
|
||||
int
|
||||
@ -619,7 +621,7 @@ vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
|
||||
vga_init(&vga_console_vc, iot, memt);
|
||||
#ifdef VGA_CONSOLE_SCREENTYPE
|
||||
scr = wsdisplay_screentype_pick(vga_console_vc.hdl.vh_mono ?
|
||||
&vga_screenlist_mono : &vga_screenlist, VGA_CONSOLE_SCREENTYPE);
|
||||
&vga_screenlist_mono : &vga_screenlist, VGA_CONSOLE_SCREENTYPE);
|
||||
if (!scr)
|
||||
panic("vga_cnattach: invalid screen type");
|
||||
#else
|
||||
@ -644,9 +646,8 @@ vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
|
||||
vga_init_screen(&vga_console_vc, &vga_console_screen, scr, 1, &defattr);
|
||||
|
||||
wsdisplay_cnattach(scr, &vga_console_screen,
|
||||
vga_console_screen.pcs.cursorcol,
|
||||
vga_console_screen.pcs.cursorrow,
|
||||
defattr);
|
||||
vga_console_screen.pcs.cursorcol,
|
||||
vga_console_screen.pcs.cursorrow, defattr);
|
||||
|
||||
vgaconsole = 1;
|
||||
vga_console_type = type;
|
||||
@ -712,8 +713,8 @@ vga_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
return EPASSTHROUGH;
|
||||
|
||||
case WSDISPLAYIO_GVIDEO:
|
||||
*(int *)data = (vga_get_video(vc) ? WSDISPLAYIO_VIDEO_ON :
|
||||
WSDISPLAYIO_VIDEO_OFF);
|
||||
*(int *)data = (vga_get_video(vc) ?
|
||||
WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF);
|
||||
return 0;
|
||||
|
||||
case WSDISPLAYIO_SVIDEO:
|
||||
@ -770,8 +771,8 @@ vga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
||||
* XXX We could be more clever and use video RAM.
|
||||
*/
|
||||
scr1->pcs.mem =
|
||||
malloc(scr1->pcs.type->ncols * scr1->pcs.type->nrows * 2,
|
||||
M_DEVBUF, M_WAITOK);
|
||||
malloc(scr1->pcs.type->ncols * scr1->pcs.type->nrows * 2,
|
||||
M_DEVBUF, M_WAITOK);
|
||||
}
|
||||
|
||||
scr = malloc(sizeof(struct vgascreen), M_DEVBUF, M_WAITOK);
|
||||
@ -779,7 +780,7 @@ vga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
||||
|
||||
if (vc->nscreens > 1) {
|
||||
scr->pcs.mem = malloc(type->ncols * type->nrows * 2,
|
||||
M_DEVBUF, M_WAITOK);
|
||||
M_DEVBUF, M_WAITOK);
|
||||
pcdisplay_eraserows(&scr->pcs, 0, type->nrows, *defattrp);
|
||||
}
|
||||
|
||||
@ -840,8 +841,7 @@ vga_usefont(struct vga_config *vc, struct egavga_font *f)
|
||||
|
||||
loadit:
|
||||
vga_loadchars(&vc->hdl, slot, f->wsfont->firstchar,
|
||||
f->wsfont->numchars, f->wsfont->fontheight,
|
||||
f->wsfont->data);
|
||||
f->wsfont->numchars, f->wsfont->fontheight, f->wsfont->data);
|
||||
f->slot = slot;
|
||||
vc->vc_fonts[slot] = f;
|
||||
|
||||
@ -931,8 +931,8 @@ vga_doswitch(struct vga_config *vc)
|
||||
|
||||
oldscr->pcs.active = 0;
|
||||
bus_space_read_region_2(vh->vh_memt, vh->vh_memh,
|
||||
oldscr->pcs.dispoffset, oldscr->pcs.mem,
|
||||
oldtype->ncols * oldtype->nrows);
|
||||
oldscr->pcs.dispoffset, oldscr->pcs.mem,
|
||||
oldtype->ncols * oldtype->nrows);
|
||||
}
|
||||
|
||||
if (vc->currenttype != type) {
|
||||
@ -950,14 +950,13 @@ vga_doswitch(struct vga_config *vc)
|
||||
}
|
||||
|
||||
bus_space_write_region_2(vh->vh_memt, vh->vh_memh,
|
||||
scr->pcs.dispoffset, scr->pcs.mem,
|
||||
type->ncols * type->nrows);
|
||||
scr->pcs.dispoffset, scr->pcs.mem, type->ncols * type->nrows);
|
||||
scr->pcs.active = 1;
|
||||
|
||||
vc->active = scr;
|
||||
|
||||
pcdisplay_cursor(&scr->pcs, scr->pcs.cursoron,
|
||||
scr->pcs.cursorrow, scr->pcs.cursorcol);
|
||||
scr->pcs.cursorrow, scr->pcs.cursorcol);
|
||||
|
||||
vc->wantedscreen = 0;
|
||||
if (vc->switchcb)
|
||||
@ -1047,15 +1046,14 @@ vga_copyrows(void *id, int srcrow, int dstrow, int nrows)
|
||||
scr->pcs.dispoffset += srcrow * ncols * 2;
|
||||
} else {
|
||||
bus_space_copy_region_2(memt, memh,
|
||||
scr->pcs.dispoffset + srcoff * 2,
|
||||
memh, scr->mindispoffset,
|
||||
nrows * ncols);
|
||||
scr->pcs.dispoffset + srcoff * 2,
|
||||
memh, scr->mindispoffset, nrows * ncols);
|
||||
scr->pcs.dispoffset = scr->mindispoffset;
|
||||
}
|
||||
vga_6845_write(&scr->cfg->hdl, startadrh,
|
||||
scr->pcs.dispoffset >> 9);
|
||||
scr->pcs.dispoffset >> 9);
|
||||
vga_6845_write(&scr->cfg->hdl, startadrl,
|
||||
scr->pcs.dispoffset >> 1);
|
||||
scr->pcs.dispoffset >> 1);
|
||||
#ifdef PCDISPLAY_SOFTCURSOR
|
||||
if (cursoron)
|
||||
pcdisplay_cursor(&scr->pcs, 1,
|
||||
@ -1063,13 +1061,13 @@ vga_copyrows(void *id, int srcrow, int dstrow, int nrows)
|
||||
#endif
|
||||
} else {
|
||||
bus_space_copy_region_2(memt, memh,
|
||||
scr->pcs.dispoffset + srcoff * 2,
|
||||
memh, scr->pcs.dispoffset + dstoff * 2,
|
||||
nrows * ncols);
|
||||
scr->pcs.dispoffset + srcoff * 2,
|
||||
memh, scr->pcs.dispoffset + dstoff * 2,
|
||||
nrows * ncols);
|
||||
}
|
||||
} else
|
||||
memcpy(&scr->pcs.mem[dstoff], &scr->pcs.mem[srcoff],
|
||||
nrows * ncols * 2);
|
||||
nrows * ncols * 2);
|
||||
}
|
||||
|
||||
#ifdef WSCONS_SUPPORT_PCVTFONTS
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga_common.c,v 1.1 2002/10/15 17:30:44 junyoung Exp $ */
|
||||
/* $NetBSD: vga_common.c,v 1.2 2003/01/27 14:46:10 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -83,12 +83,11 @@ vga_common_probe(bus_space_tag_t iot, bus_space_tag_t memt)
|
||||
/* reset state */
|
||||
(void) bus_space_read_1(iot, ioh_6845, 10);
|
||||
bus_space_write_1(iot, ioh_vga, VGA_ATC_INDEX,
|
||||
20 | 0x20); /* colselect | enable */
|
||||
20 | 0x20); /* colselect | enable */
|
||||
regval = bus_space_read_1(iot, ioh_vga, VGA_ATC_DATAR);
|
||||
/* toggle the implemented bits */
|
||||
bus_space_write_1(iot, ioh_vga, VGA_ATC_DATAW, regval ^ 0x0f);
|
||||
bus_space_write_1(iot, ioh_vga, VGA_ATC_INDEX,
|
||||
20 | 0x20);
|
||||
bus_space_write_1(iot, ioh_vga, VGA_ATC_INDEX, 20 | 0x20);
|
||||
/* read back */
|
||||
if (bus_space_read_1(iot, ioh_vga, VGA_ATC_DATAR) != (regval ^ 0x0f))
|
||||
goto bad;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga_raster.c,v 1.5 2002/11/28 07:02:20 junyoung Exp $ */
|
||||
/* $NetBSD: vga_raster.c,v 1.6 2003/01/27 14:46:11 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Bang Jun-Young
|
||||
@ -26,7 +26,7 @@
|
||||
* (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) 1995, 1996 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
@ -119,7 +119,7 @@ struct vgascreen {
|
||||
int active;
|
||||
struct vga_scrmem *mem;
|
||||
int encoding;
|
||||
|
||||
|
||||
int dispoffset;
|
||||
int mindispoffset;
|
||||
int maxdispoffset;
|
||||
@ -153,7 +153,7 @@ static struct videomode vga_console_modes[2] = {
|
||||
/* 640x480 for 80x30 mode */
|
||||
{
|
||||
25175, 640, 664, 760, 800, 480, 491, 493, 525, 0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static void vga_raster_init(struct vga_config *, bus_space_tag_t,
|
||||
@ -163,7 +163,7 @@ static void vga_raster_init_screen(struct vga_config *, struct vgascreen *,
|
||||
static void vga_raster_setup_font(struct vga_config *, struct vgascreen *);
|
||||
static void vga_setup_regs(struct videomode *, struct vga_moderegs *);
|
||||
static void vga_set_mode(struct vga_handle *, struct vga_moderegs *);
|
||||
static void vga_restore_screen(struct vgascreen *,
|
||||
static void vga_restore_screen(struct vgascreen *,
|
||||
const struct wsscreen_descr *, struct vga_scrmem *);
|
||||
static void vga_raster_cursor_init(struct vgascreen *, int);
|
||||
static void _vga_raster_putchar(void *, int, int, u_int, long,
|
||||
@ -269,12 +269,12 @@ const struct wsscreen_descr *_vga_scrlist[] = {
|
||||
&vga_25lscreen,
|
||||
&vga_30lscreen,
|
||||
&vga_40lscreen,
|
||||
&vga_50lscreen,
|
||||
&vga_50lscreen,
|
||||
}, *_vga_scrlist_mono[] = {
|
||||
&vga_25lscreen_mono,
|
||||
&vga_30lscreen_mono,
|
||||
&vga_40lscreen_mono,
|
||||
&vga_50lscreen_mono,
|
||||
&vga_50lscreen_mono,
|
||||
};
|
||||
|
||||
const struct wsscreen_list vga_screenlist = {
|
||||
@ -337,7 +337,7 @@ vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
|
||||
#else
|
||||
scr = vga_console_vc.currenttype;
|
||||
#endif
|
||||
vga_raster_init_screen(&vga_console_vc, &vga_console_screen, scr, 1,
|
||||
vga_raster_init_screen(&vga_console_vc, &vga_console_screen, scr, 1,
|
||||
&defattr);
|
||||
|
||||
vga_console_screen.active = 1;
|
||||
@ -360,26 +360,26 @@ vga_raster_init(struct vga_config *vc, bus_space_tag_t iot,
|
||||
u_int8_t mor;
|
||||
struct vga_raster_font *vf;
|
||||
|
||||
vh->vh_iot = iot;
|
||||
vh->vh_memt = memt;
|
||||
vh->vh_iot = iot;
|
||||
vh->vh_memt = memt;
|
||||
|
||||
if (bus_space_map(vh->vh_iot, 0x3c0, 0x10, 0, &vh->vh_ioh_vga))
|
||||
panic("vga_raster_init: couldn't map vga io");
|
||||
if (bus_space_map(vh->vh_iot, 0x3c0, 0x10, 0, &vh->vh_ioh_vga))
|
||||
panic("vga_raster_init: couldn't map vga io");
|
||||
|
||||
/* read "misc output register" */
|
||||
mor = bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, 0xc);
|
||||
vh->vh_mono = !(mor & 1);
|
||||
|
||||
if (bus_space_map(vh->vh_iot, (vh->vh_mono ? 0x3b0 : 0x3d0), 0x10, 0,
|
||||
&vh->vh_ioh_6845))
|
||||
panic("vga_raster_init: couldn't map 6845 io");
|
||||
&vh->vh_ioh_6845))
|
||||
panic("vga_raster_init: couldn't map 6845 io");
|
||||
|
||||
if (bus_space_map(vh->vh_memt, 0xa0000, 0x20000, 0, &vh->vh_allmemh))
|
||||
panic("vga_raster_init: couldn't map memory");
|
||||
if (bus_space_map(vh->vh_memt, 0xa0000, 0x20000, 0, &vh->vh_allmemh))
|
||||
panic("vga_raster_init: couldn't map memory");
|
||||
|
||||
if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh, 0, 0x10000,
|
||||
&vh->vh_memh))
|
||||
panic("vga_raster_init: mem subrange failed");
|
||||
if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh, 0, 0x10000,
|
||||
&vh->vh_memh))
|
||||
panic("vga_raster_init: mem subrange failed");
|
||||
|
||||
/* should only reserve the space (no need to map - save KVM) */
|
||||
vc->vc_biostag = memt;
|
||||
@ -409,7 +409,7 @@ vga_raster_init_screen(struct vga_config *vc, struct vgascreen *scr,
|
||||
int cpos;
|
||||
int res;
|
||||
struct vga_handle *vh;
|
||||
|
||||
|
||||
scr->cfg = vc;
|
||||
scr->hdl = &vc->hdl;
|
||||
scr->type = type;
|
||||
@ -442,21 +442,21 @@ vga_raster_init_screen(struct vga_config *vc, struct vgascreen *scr,
|
||||
|
||||
scr->mem = boot_scrmem;
|
||||
scr->active = 1;
|
||||
|
||||
|
||||
/* Save the current screen to memory. XXXBJY assume 80x25 */
|
||||
for (i = 0; i < 80 * 25; i++) {
|
||||
scr->mem[i].ch = bus_space_read_1(vh->vh_memt,
|
||||
scr->mem[i].ch = bus_space_read_1(vh->vh_memt,
|
||||
vh->vh_allmemh, 0x18000 + i * 2);
|
||||
scr->mem[i].attr = bus_space_read_1(vh->vh_memt,
|
||||
vh->vh_allmemh, 0x18000 + i * 2 + 1);
|
||||
scr->mem[i].attr = bus_space_read_1(vh->vh_memt,
|
||||
vh->vh_allmemh, 0x18000 + i * 2 + 1);
|
||||
scr->mem[i].enc = WSDISPLAY_FONTENC_IBM;
|
||||
}
|
||||
|
||||
vga_raster_setscreentype(vc, type);
|
||||
|
||||
/* Clear the entire screen. */
|
||||
/* Clear the entire screen. */
|
||||
vga_gdc_write(vh, mode, 0x02);
|
||||
bus_space_set_region_4(vh->vh_memt, vh->vh_allmemh, 0, 0,
|
||||
bus_space_set_region_4(vh->vh_memt, vh->vh_allmemh, 0, 0,
|
||||
0x4000);
|
||||
|
||||
vga_restore_screen(scr, type, scr->mem);
|
||||
@ -508,8 +508,7 @@ vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot,
|
||||
vc = &vga_console_vc;
|
||||
vga_console_attached = 1;
|
||||
} else {
|
||||
vc = malloc(sizeof(struct vga_config), M_DEVBUF,
|
||||
M_WAITOK);
|
||||
vc = malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK);
|
||||
vga_raster_init(vc, iot, memt);
|
||||
}
|
||||
|
||||
@ -524,7 +523,7 @@ vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot,
|
||||
aa.accessops = &vga_raster_accessops;
|
||||
aa.accesscookie = vc;
|
||||
|
||||
config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
|
||||
config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
|
||||
}
|
||||
|
||||
int
|
||||
@ -587,8 +586,8 @@ vga_raster_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
case WSDISPLAYIO_GVIDEO:
|
||||
#if 1
|
||||
*(int *)data = (vga_get_video(vc) ? WSDISPLAYIO_VIDEO_ON :
|
||||
WSDISPLAYIO_VIDEO_OFF);
|
||||
*(int *)data = (vga_get_video(vc) ?
|
||||
WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@ -616,7 +615,6 @@ vga_raster_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
return (EPASSTHROUGH);
|
||||
|
||||
return ((*vf->vf_ioctl)(v, cmd, data, flag, p));
|
||||
|
||||
}
|
||||
|
||||
static paddr_t
|
||||
@ -653,7 +651,7 @@ vga_raster_alloc_screen(void *v, const struct wsscreen_descr *type,
|
||||
vc->active = scr;
|
||||
vc->currenttype = type;
|
||||
} else {
|
||||
scr->mem = malloc(sizeof(struct vga_scrmem) *
|
||||
scr->mem = malloc(sizeof(struct vga_scrmem) *
|
||||
type->ncols * type->nrows, M_DEVBUF, M_WAITOK);
|
||||
vga_raster_eraserows(scr, 0, type->nrows, *defattrp);
|
||||
}
|
||||
@ -752,7 +750,7 @@ vga_switch_screen(struct vga_config *vc)
|
||||
vga_6845_write(vh, startadrl, scr->dispoffset);
|
||||
}
|
||||
|
||||
/* Clear the entire screen. */
|
||||
/* Clear the entire screen. */
|
||||
vga_gdc_write(vh, mode, 0x02);
|
||||
bus_space_set_region_4(vh->vh_memt, vh->vh_allmemh, 0, 0, 0x2000);
|
||||
|
||||
@ -789,8 +787,8 @@ vga_raster_setup_font(struct vga_config *vc, struct vgascreen *scr)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cookie = wsfont_find(0, 0, scr->type->fontheight, 0,
|
||||
|
||||
cookie = wsfont_find(NULL, 0, scr->type->fontheight, 0,
|
||||
WSDISPLAY_FONTORDER_L2R, 0);
|
||||
if (cookie == -1)
|
||||
return;
|
||||
@ -817,7 +815,7 @@ vga_setup_regs(struct videomode *mode, struct vga_moderegs *regs)
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Compute hsync and vsync polarity.
|
||||
*/
|
||||
@ -840,7 +838,7 @@ vga_setup_regs(struct videomode *mode, struct vga_moderegs *regs)
|
||||
else
|
||||
regs->miscout = 0x23;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Time sequencer
|
||||
*/
|
||||
@ -858,7 +856,7 @@ vga_setup_regs(struct videomode *mode, struct vga_moderegs *regs)
|
||||
regs->ts[4] = 0x06;
|
||||
else
|
||||
regs->ts[4] = 0x0e;
|
||||
|
||||
|
||||
/*
|
||||
* CRTC controller
|
||||
*/
|
||||
@ -868,7 +866,7 @@ vga_setup_regs(struct videomode *mode, struct vga_moderegs *regs)
|
||||
regs->crtc[3] = (((mode->hsync_end >> 3) - 1) & 0x1f) | 0x80;
|
||||
regs->crtc[4] = mode->hsync_start >> 3;
|
||||
regs->crtc[5] = ((((mode->hsync_end >> 3) - 1) & 0x20) << 2)
|
||||
| (((mode->hsync_end >> 3)) & 0x1f);
|
||||
| (((mode->hsync_end >> 3)) & 0x1f);
|
||||
regs->crtc[6] = (mode->vtotal - 2) & 0xff;
|
||||
regs->crtc[7] = (((mode->vtotal - 2) & 0x100) >> 8)
|
||||
| (((mode->vdisplay - 1) & 0x100) >> 7)
|
||||
@ -900,7 +898,7 @@ vga_setup_regs(struct videomode *mode, struct vga_moderegs *regs)
|
||||
else
|
||||
regs->crtc[23] = 0xc3;
|
||||
regs->crtc[24] = 0xff;
|
||||
|
||||
|
||||
/*
|
||||
* Graphics display controller
|
||||
*/
|
||||
@ -940,12 +938,12 @@ vga_set_mode(struct vga_handle *vh, struct vga_moderegs *regs)
|
||||
|
||||
/* Disable display. */
|
||||
vga_ts_write(vh, mode, vga_ts_read(vh, mode) | 0x20);
|
||||
|
||||
|
||||
/* Write misc output register. */
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_MISC_DATAW,
|
||||
regs->miscout);
|
||||
|
||||
/* Set synchronous reset. */
|
||||
/* Set synchronous reset. */
|
||||
vga_ts_write(vh, syncreset, 0x01);
|
||||
vga_ts_write(vh, mode, regs->ts[1] | 0x20);
|
||||
for (i = 2; i < VGA_TS_NREGS; i++)
|
||||
@ -956,19 +954,19 @@ vga_set_mode(struct vga_handle *vh, struct vga_moderegs *regs)
|
||||
/* Unprotect CRTC registers 0-7. */
|
||||
_vga_crtc_write(vh, 17, _vga_crtc_read(vh, 17) & 0x7f);
|
||||
/* Write CRTC registers. */
|
||||
for (i = 0; i < VGA_CRTC_NREGS; i++)
|
||||
for (i = 0; i < VGA_CRTC_NREGS; i++)
|
||||
_vga_crtc_write(vh, i, regs->crtc[i]);
|
||||
|
||||
/* Write graphics display registers. */
|
||||
|
||||
/* Write graphics display registers. */
|
||||
for (i = 0; i < VGA_GDC_NREGS; i++)
|
||||
_vga_gdc_write(vh, i, regs->gdc[i]);
|
||||
|
||||
/* Write attribute controller registers. */
|
||||
for (i = 0; i < VGA_ATC_NREGS; i++)
|
||||
|
||||
/* Write attribute controller registers. */
|
||||
for (i = 0; i < VGA_ATC_NREGS; i++)
|
||||
_vga_attr_write(vh, i, regs->atc[i]);
|
||||
|
||||
/* Enable display. */
|
||||
vga_ts_write(vh, mode, vga_ts_read(vh, mode) & 0xdf);
|
||||
vga_ts_write(vh, mode, vga_ts_read(vh, mode) & 0xdf);
|
||||
}
|
||||
|
||||
void
|
||||
@ -986,11 +984,11 @@ vga_raster_cursor_init(struct vgascreen *scr, int existing)
|
||||
*/
|
||||
memt = vh->vh_memt;
|
||||
memh = vh->vh_memh;
|
||||
off = (scr->cursorrow * scr->type->ncols + scr->cursorcol) +
|
||||
off = (scr->cursorrow * scr->type->ncols + scr->cursorcol) +
|
||||
scr->dispoffset / 8;
|
||||
|
||||
scr->cursortmp = scr->mem[off];
|
||||
vga_raster_putchar(scr, scr->cursorrow, scr->cursorcol,
|
||||
vga_raster_putchar(scr, scr->cursorrow, scr->cursorcol,
|
||||
scr->cursortmp.ch, scr->cursortmp.attr ^ 0x77);
|
||||
} else {
|
||||
scr->cursortmp.ch = 0;
|
||||
@ -998,7 +996,7 @@ vga_raster_cursor_init(struct vgascreen *scr, int existing)
|
||||
scr->cursortmp.second = 0;
|
||||
scr->cursortmp.enc = WSDISPLAY_FONTENC_IBM;
|
||||
}
|
||||
|
||||
|
||||
scr->cursoron = 1;
|
||||
}
|
||||
|
||||
@ -1013,19 +1011,19 @@ vga_raster_cursor(void *id, int on, int row, int col)
|
||||
off = scr->cursorrow * scr->type->ncols + scr->cursorcol;
|
||||
if (scr->active) {
|
||||
tmp = scr->encoding;
|
||||
scr->encoding = scr->cursortmp.enc;
|
||||
scr->encoding = scr->cursortmp.enc;
|
||||
if (scr->cursortmp.second)
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
scr->cursorcol - 1, scr->cursortmp.ch,
|
||||
scr->cursortmp.attr);
|
||||
else
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
scr->cursorcol, scr->cursortmp.ch,
|
||||
scr->cursortmp.attr);
|
||||
scr->cursortmp.attr);
|
||||
scr->encoding = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scr->cursorrow = row;
|
||||
scr->cursorcol = col;
|
||||
|
||||
@ -1038,13 +1036,13 @@ vga_raster_cursor(void *id, int on, int row, int col)
|
||||
tmp = scr->encoding;
|
||||
scr->encoding = scr->cursortmp.enc;
|
||||
if (scr->cursortmp.second)
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
scr->cursorcol - 1, scr->cursortmp.ch,
|
||||
scr->cursortmp.attr ^ 0x77);
|
||||
else
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
vga_raster_putchar(id, scr->cursorrow,
|
||||
scr->cursorcol, scr->cursortmp.ch,
|
||||
scr->cursortmp.attr ^ 0x77);
|
||||
scr->cursortmp.attr ^ 0x77);
|
||||
scr->encoding = tmp;
|
||||
}
|
||||
}
|
||||
@ -1053,13 +1051,13 @@ static int
|
||||
vga_raster_mapchar(void *id, int uni, u_int *index)
|
||||
{
|
||||
struct vgascreen *scr = id;
|
||||
|
||||
|
||||
if (scr->encoding == WSDISPLAY_FONTENC_IBM)
|
||||
return pcdisplay_mapchar(id, uni, index);
|
||||
else {
|
||||
*index = uni;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1069,9 +1067,9 @@ vga_raster_putchar(void *id, int row, int col, u_int c, long attr)
|
||||
int off;
|
||||
struct vga_raster_font *fs;
|
||||
u_int tmp_ch;
|
||||
|
||||
|
||||
off = row * scr->type->ncols + col;
|
||||
|
||||
|
||||
LIST_FOREACH(fs, &scr->fontset, next) {
|
||||
if ((scr->encoding == fs->font->encoding) &&
|
||||
(c >= fs->font->firstchar) &&
|
||||
@ -1079,7 +1077,7 @@ vga_raster_putchar(void *id, int row, int col, u_int c, long attr)
|
||||
(scr->type->fontheight == fs->font->fontheight)) {
|
||||
if (scr->active) {
|
||||
tmp_ch = c - fs->font->firstchar;
|
||||
_vga_raster_putchar(scr, row, col, tmp_ch,
|
||||
_vga_raster_putchar(scr, row, col, tmp_ch,
|
||||
attr, fs);
|
||||
}
|
||||
|
||||
@ -1087,7 +1085,7 @@ vga_raster_putchar(void *id, int row, int col, u_int c, long attr)
|
||||
scr->mem[off].attr = attr;
|
||||
scr->mem[off].second = 0;
|
||||
scr->mem[off].enc = fs->font->encoding;
|
||||
|
||||
|
||||
if (fs->font->stride == 2) {
|
||||
scr->mem[off + 1].ch = c;
|
||||
scr->mem[off + 1].attr = attr;
|
||||
@ -1095,17 +1093,19 @@ vga_raster_putchar(void *id, int row, int col, u_int c, long attr)
|
||||
scr->mem[off + 1].enc = fs->font->encoding;
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* No match found.
|
||||
* No match found.
|
||||
*/
|
||||
if (scr->active)
|
||||
/* Put a single width space character no matter what the
|
||||
actual width of the character is. */
|
||||
_vga_raster_putchar(scr, row, col, 0x20, attr,
|
||||
/*
|
||||
* Put a single width space character no matter what the
|
||||
* actual width of the character is.
|
||||
*/
|
||||
_vga_raster_putchar(scr, row, col, 0x20, attr,
|
||||
&vga_console_fontset_ascii);
|
||||
scr->mem[off].ch = c;
|
||||
scr->mem[off].attr = attr;
|
||||
@ -1135,7 +1135,7 @@ _vga_raster_putchar(void *id, int row, int col, u_int c, long attr,
|
||||
fgcolor = fgansitopc[attr & 0x0f];
|
||||
#else
|
||||
bgcolor = ((attr >> 4) & 0x0f);
|
||||
fgcolor = attr & 0x0f;
|
||||
fgcolor = attr & 0x0f;
|
||||
#endif
|
||||
|
||||
if (fs->font->stride == 1) {
|
||||
@ -1163,7 +1163,7 @@ _vga_raster_putchar(void *id, int row, int col, u_int c, long attr,
|
||||
vga_gdc_write(vh, mode, 0x02);
|
||||
for (i = 0; i < fheight; i++) {
|
||||
bus_space_write_1(memt, memh, rasoff, bgcolor);
|
||||
bus_space_write_1(memt, memh, rasoff + 1, bgcolor);
|
||||
bus_space_write_1(memt, memh, rasoff + 1, bgcolor);
|
||||
rasoff += scr->type->ncols;
|
||||
}
|
||||
|
||||
@ -1214,7 +1214,7 @@ vga_raster_copycols(void *id, int row, int srccol, int dstcol, int ncols)
|
||||
if (scr->active) {
|
||||
for (i = 0; i < fheight; i++) {
|
||||
bus_space_copy_region_1(memt, memh,
|
||||
rassrcoff + i * scr->type->ncols, memh,
|
||||
rassrcoff + i * scr->type->ncols, memh,
|
||||
rasdstoff + i * scr->type->ncols, ncols);
|
||||
}
|
||||
}
|
||||
@ -1227,7 +1227,7 @@ vga_raster_erasecols(void *id, int row, int startcol, int ncols, long fillattr)
|
||||
int i;
|
||||
|
||||
if (scr->active == 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
for (i = startcol; i < startcol + ncols; i++)
|
||||
vga_raster_putchar(id, row, i, ' ', fillattr);
|
||||
@ -1244,10 +1244,10 @@ vga_raster_copyrows(void *id, int srcrow, int dstrow, int nrows)
|
||||
bus_size_t srcoff, dstoff;
|
||||
bus_size_t rassrcoff, rasdstoff;
|
||||
int fheight;
|
||||
|
||||
|
||||
ncols = scr->type->ncols;
|
||||
fheight = scr->type->fontheight;
|
||||
|
||||
|
||||
srcoff = srcrow * ncols;
|
||||
dstoff = dstrow * ncols;
|
||||
rassrcoff = srcoff * fheight;
|
||||
@ -1268,7 +1268,7 @@ vga_raster_copyrows(void *id, int srcrow, int dstrow, int nrows)
|
||||
<= scr->maxdispoffset)
|
||||
scr->dispoffset += srcrow * ncols * fheight;
|
||||
else {
|
||||
bus_space_copy_region_1(memt, memh,
|
||||
bus_space_copy_region_1(memt, memh,
|
||||
scr->dispoffset + rassrcoff,
|
||||
memh, scr->mindispoffset,
|
||||
nrows * ncols * fheight);
|
||||
@ -1276,7 +1276,7 @@ vga_raster_copyrows(void *id, int srcrow, int dstrow, int nrows)
|
||||
}
|
||||
vga_6845_write(vh, startadrh, scr->dispoffset >> 8);
|
||||
vga_6845_write(vh, startadrl, scr->dispoffset);
|
||||
|
||||
|
||||
if (cursoron)
|
||||
/* Enable cursor. */
|
||||
vga_raster_cursor(scr, 1, scr->cursorrow,
|
||||
@ -1286,7 +1286,7 @@ vga_raster_copyrows(void *id, int srcrow, int dstrow, int nrows)
|
||||
scr->dispoffset + rassrcoff, memh,
|
||||
scr->dispoffset + rasdstoff,
|
||||
nrows * ncols * fheight);
|
||||
}
|
||||
}
|
||||
memcpy(&scr->mem[dstoff], &scr->mem[srcoff],
|
||||
nrows * ncols * sizeof(struct vga_scrmem));
|
||||
}
|
||||
@ -1302,7 +1302,7 @@ vga_raster_eraserows(void *id, int startrow, int nrows, long fillattr)
|
||||
bus_size_t rasoff, rascount;
|
||||
int i;
|
||||
|
||||
off = startrow * scr->type->ncols;
|
||||
off = startrow * scr->type->ncols;
|
||||
count = nrows * scr->type->ncols;
|
||||
rasoff = off * scr->type->fontheight;
|
||||
rascount = count * scr->type->fontheight;
|
||||
@ -1310,15 +1310,15 @@ vga_raster_eraserows(void *id, int startrow, int nrows, long fillattr)
|
||||
if (scr->active) {
|
||||
/* Paint background. */
|
||||
vga_gdc_write(vh, mode, 0x02);
|
||||
if (scr->type->ncols % 4 == 0)
|
||||
if (scr->type->ncols % 4 == 0)
|
||||
/* We can speed up I/O */
|
||||
for (i = rasoff; i < rasoff + rascount; i += 4)
|
||||
bus_space_write_4(memt, memh,
|
||||
bus_space_write_4(memt, memh,
|
||||
scr->dispoffset + i, fillattr >> 4);
|
||||
else
|
||||
else
|
||||
for (i = rasoff; i < rasoff + rascount; i += 2)
|
||||
bus_space_write_2(memt, memh,
|
||||
scr->dispoffset + i, fillattr >> 4);
|
||||
bus_space_write_2(memt, memh,
|
||||
scr->dispoffset + i, fillattr >> 4);
|
||||
}
|
||||
for (i = 0; i < count; i++) {
|
||||
scr->mem[off + i].ch = ' ';
|
||||
@ -1366,7 +1366,7 @@ vga_restore_screen(struct vgascreen *scr,
|
||||
{
|
||||
int i, j, off, tmp;
|
||||
|
||||
tmp = scr->encoding;
|
||||
tmp = scr->encoding;
|
||||
for (i = 0; i < type->nrows; i++) {
|
||||
for (j = 0; j < type->ncols; j++) {
|
||||
off = i * type->ncols + j;
|
||||
@ -1386,7 +1386,7 @@ vga_raster_setscreentype(struct vga_config *vc,
|
||||
{
|
||||
struct vga_handle *vh = &vc->hdl;
|
||||
struct vga_moderegs moderegs;
|
||||
|
||||
|
||||
vga_setup_regs((struct videomode *)type->modecookie, &moderegs);
|
||||
vga_set_mode(vh, &moderegs);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga_subr.c,v 1.11 2002/10/15 18:14:42 junyoung Exp $ */
|
||||
/* $NetBSD: vga_subr.c,v 1.12 2003/01/27 14:46:11 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_subr.c,v 1.11 2002/10/15 18:14:42 junyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_subr.c,v 1.12 2003/01/27 14:46:11 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -54,6 +54,7 @@ static void textram(struct vga_handle *);
|
||||
static void
|
||||
fontram(struct vga_handle *vh)
|
||||
{
|
||||
|
||||
/* program sequencer to access character generator */
|
||||
|
||||
vga_ts_write(vh, syncreset, 0x01); /* synchronous reset */
|
||||
@ -71,6 +72,7 @@ fontram(struct vga_handle *vh)
|
||||
static void
|
||||
textram(struct vga_handle *vh)
|
||||
{
|
||||
|
||||
/* program sequencer to access video ram */
|
||||
|
||||
vga_ts_write(vh, syncreset, 0x01); /* synchronous reset */
|
||||
@ -102,16 +104,15 @@ vga_loadchars(struct vga_handle *vh, int fontset, int first, int num, int lpc,
|
||||
for (i = 0; i < num; i++)
|
||||
for (j = 0; j < lpc; j++)
|
||||
bus_space_write_1(vh->vh_memt, vh->vh_allmemh,
|
||||
offset + (i << 5) + j,
|
||||
data[i * lpc + j]);
|
||||
offset + (i << 5) + j, data[i * lpc + j]);
|
||||
|
||||
textram(vh);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
vga_readoutchars(struct vga_handle *vh, int fontset, int first, int num, int lpc,
|
||||
char *data)
|
||||
vga_readoutchars(struct vga_handle *vh, int fontset, int first, int num,
|
||||
int lpc, char *data)
|
||||
{
|
||||
int offset, i, j, s;
|
||||
|
||||
@ -123,9 +124,8 @@ vga_readoutchars(struct vga_handle *vh, int fontset, int first, int num, int lpc
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
for (j = 0; j < lpc; j++)
|
||||
data[i * lpc + j] =
|
||||
bus_space_read_1(vh->vh_memt, vh->vh_allmemh,
|
||||
offset + (i << 5) + j);
|
||||
data[i * lpc + j] = bus_space_read_1(vh->vh_memt,
|
||||
vh->vh_allmemh, offset + (i << 5) + j);
|
||||
|
||||
textram(vh);
|
||||
splx(s);
|
||||
@ -140,10 +140,8 @@ vga_copyfont01(struct vga_handle *vh)
|
||||
s = splhigh();
|
||||
fontram(vh);
|
||||
|
||||
bus_space_copy_region_1(vh->vh_memt,
|
||||
vh->vh_allmemh, 0,
|
||||
vh->vh_allmemh, 1 << 13,
|
||||
1 << 13);
|
||||
bus_space_copy_region_1(vh->vh_memt, vh->vh_allmemh, 0,
|
||||
vh->vh_allmemh, 1 << 13, 1 << 13);
|
||||
|
||||
textram(vh);
|
||||
splx(s);
|
||||
@ -172,6 +170,7 @@ vga_setfontset(struct vga_handle *vh, int fontset1, int fontset2)
|
||||
void
|
||||
vga_setscreentype(struct vga_handle *vh, const struct wsscreen_descr *type)
|
||||
{
|
||||
|
||||
vga_6845_write(vh, maxrow, type->fontheight - 1);
|
||||
|
||||
/* lo byte */
|
||||
@ -201,14 +200,14 @@ vga_load_builtinfont(struct vga_handle *vh, u_int8_t *font, int firstchar,
|
||||
int numchars)
|
||||
{
|
||||
int i, s;
|
||||
|
||||
|
||||
s = splhigh();
|
||||
fontram(vh);
|
||||
|
||||
for (i = firstchar; i < firstchar + numchars; i++)
|
||||
bus_space_read_region_1(vh->vh_memt, vh->vh_allmemh, i * 32,
|
||||
font + i * 16, 16);
|
||||
|
||||
font + i * 16, 16);
|
||||
|
||||
textram(vh);
|
||||
splx(s);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vgavar.h,v 1.15 2002/10/15 18:14:42 junyoung Exp $ */
|
||||
/* $NetBSD: vgavar.h,v 1.16 2003/01/27 14:46:11 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -116,6 +116,7 @@ _vga_attr_read(struct vga_handle *vh, int reg)
|
||||
static inline void
|
||||
_vga_attr_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
{
|
||||
|
||||
/* reset state */
|
||||
(void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
|
||||
|
||||
@ -132,6 +133,7 @@ _vga_attr_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
static inline u_int8_t
|
||||
_vga_ts_read(struct vga_handle *vh, int reg)
|
||||
{
|
||||
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_INDEX, reg);
|
||||
return (bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_DATA));
|
||||
}
|
||||
@ -139,6 +141,7 @@ _vga_ts_read(struct vga_handle *vh, int reg)
|
||||
static inline void
|
||||
_vga_ts_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
{
|
||||
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_INDEX, reg);
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_DATA, val);
|
||||
}
|
||||
@ -146,6 +149,7 @@ _vga_ts_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
static inline u_int8_t
|
||||
_vga_gdc_read(struct vga_handle *vh, int reg)
|
||||
{
|
||||
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_INDEX, reg);
|
||||
return (bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_DATA));
|
||||
}
|
||||
@ -153,6 +157,7 @@ _vga_gdc_read(struct vga_handle *vh, int reg)
|
||||
static inline void
|
||||
_vga_gdc_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
{
|
||||
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_INDEX, reg);
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_DATA, val);
|
||||
}
|
||||
@ -160,6 +165,7 @@ _vga_gdc_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
static inline u_int8_t
|
||||
_vga_crtc_read(struct vga_handle *vh, int reg)
|
||||
{
|
||||
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_CRTC_INDEX, reg);
|
||||
return (bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_CRTC_DATA));
|
||||
}
|
||||
@ -167,6 +173,7 @@ _vga_crtc_read(struct vga_handle *vh, int reg)
|
||||
static inline void
|
||||
_vga_crtc_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
{
|
||||
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_CRTC_INDEX, reg);
|
||||
bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_CRTC_DATA, val);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user