summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/pcdisplay_subr.c3
-rw-r--r--sys/dev/ic/vga.c35
-rw-r--r--sys/dev/ic/vgareg.h20
3 files changed, 37 insertions, 21 deletions
diff --git a/sys/dev/ic/pcdisplay_subr.c b/sys/dev/ic/pcdisplay_subr.c
index 52833fb2f37..3b294330d31 100644
--- a/sys/dev/ic/pcdisplay_subr.c
+++ b/sys/dev/ic/pcdisplay_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcdisplay_subr.c,v 1.2 2001/02/02 20:25:39 aaron Exp $ */
+/* $OpenBSD: pcdisplay_subr.c,v 1.3 2001/03/14 02:49:22 mickey Exp $ */
/* $NetBSD: pcdisplay_subr.c,v 1.16 2000/06/08 07:01:19 cgd Exp $ */
/*
@@ -37,6 +37,7 @@
#include <dev/ic/mc6845reg.h>
#include <dev/ic/pcdisplayvar.h>
+#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
void
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c
index e7d55f77799..f4aa8088384 100644
--- a/sys/dev/ic/vga.c
+++ b/sys/dev/ic/vga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga.c,v 1.18 2001/02/28 16:48:28 mickey Exp $ */
+/* $OpenBSD: vga.c,v 1.19 2001/03/14 02:49:22 mickey Exp $ */
/* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */
/*
@@ -53,7 +53,7 @@
#endif
static struct vgafont {
- char name[16];
+ char name[WSFONT_NAME_SIZE];
int height;
int encoding;
#ifdef notyet
@@ -113,7 +113,7 @@ static struct vgascreen vga_console_screen;
static struct vga_config vga_console_vc;
int vga_selectfont __P((struct vga_config *, struct vgascreen *,
- char *, char *));
+ const char *, const char *));
void vga_init_screen __P((struct vga_config *, struct vgascreen *,
const struct wsscreen_descr *,
int, long *));
@@ -341,7 +341,7 @@ int
vga_selectfont(vc, scr, name1, name2)
struct vga_config *vc;
struct vgascreen *scr;
- char *name1, *name2; /* NULL: take first found */
+ const char *name1, *name2; /* NULL: take first found */
{
const struct wsscreen_descr *type = scr->pcs.type;
struct vgafont *f1, *f2;
@@ -355,13 +355,15 @@ vga_selectfont(vc, scr, name1, name2)
continue;
if (!f1 &&
vga_valid_primary_font(f) &&
- (!name1 || !strcmp(name1, f->name))) {
+ (!name1 || !*name1 ||
+ !strncmp(name1, f->name, WSFONT_NAME_SIZE))) {
f1 = f;
continue;
}
if (!f2 &&
VGA_SCREEN_CANTWOFONTS(type) &&
- (!name2 || !strcmp(name2, f->name))) {
+ (!name2 || !*name2 ||
+ !strncmp(name2, f->name, WSFONT_NAME_SIZE))) {
f2 = f;
continue;
}
@@ -371,7 +373,7 @@ vga_selectfont(vc, scr, name1, name2)
* The request fails if no primary font was found,
* or if a second font was requested but not found.
*/
- if (f1 && (!name2 || f2)) {
+ if (f1 && (!name2 || !*name2 || f2)) {
#ifdef VGAFONTDEBUG
if (scr != &vga_console_screen || vga_console_attached) {
printf("vga (%s): font1=%s (slot %d)", type->name,
@@ -866,13 +868,20 @@ vga_load_font(v, cookie, data)
}
#endif
- for (slot = 0; slot < 8; slot++)
- if (!vc->vc_fonts[slot])
- break;
- if (slot == 8)
+ if (data->index < 0) {
+ for (slot = 0; slot < 8; slot++)
+ if (!vc->vc_fonts[slot])
+ break;
+ } else
+ slot = data->index;
+
+ if (slot >= 8)
return (ENOSPC);
- f = malloc(sizeof(struct vgafont), M_DEVBUF, M_WAITOK);
+ if (!vc->vc_fonts[slot])
+ f = malloc(sizeof(struct vgafont), M_DEVBUF, M_WAITOK);
+ if (!f)
+ return (ENOMEM);
strncpy(f->name, data->name, sizeof(f->name));
f->height = data->fontheight;
f->encoding = data->encoding;
@@ -887,6 +896,8 @@ vga_load_font(v, cookie, data)
vga_loadchars(&vc->hdl, slot, 0, 256, f->height, data->data);
f->slot = slot;
vc->vc_fonts[slot] = f;
+ data->cookie = f;
+ data->index = slot;
return (0);
}
diff --git a/sys/dev/ic/vgareg.h b/sys/dev/ic/vgareg.h
index 216b22ebdb5..931fa9e1940 100644
--- a/sys/dev/ic/vgareg.h
+++ b/sys/dev/ic/vgareg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgareg.h,v 1.1 2000/11/15 20:17:38 aaron Exp $ */
+/* $OpenBSD: vgareg.h,v 1.2 2001/03/14 02:49:22 mickey Exp $ */
/* $NetBSD: vgareg.h,v 1.2 1998/05/28 16:48:41 drochner Exp $ */
/*
@@ -33,25 +33,29 @@
*
*/
+#pragma pack(1)
+
struct reg_vgaattr { /* indexed via port 0x3c0 */
- char palette[16];
- char mode, overscan, colplen, horpixpan;
- char colreset, misc;
+ u_int8_t palette[16];
+ u_int8_t mode, overscan, colplen, horpixpan;
+ u_int8_t colreset, misc;
};
#define VGA_ATC_INDEX 0
#define VGA_ATC_DATAW 0
#define VGA_ATC_DATAR 1
struct reg_vgats { /* indexed via port 0x3c4 */
- char syncreset, mode, wrplmask, fontsel, memmode;
+ u_int8_t syncreset, mode, wrplmask, fontsel, memmode;
};
#define VGA_TS_INDEX 4
#define VGA_TS_DATA 5
struct reg_vgagdc { /* indexed via port 0x3ce */
- char setres, ensetres, colorcomp, rotfunc;
- char rdplanesel, mode, misc, colorcare;
- char bitmask;
+ u_int8_t setres, ensetres, colorcomp, rotfunc;
+ u_int8_t rdplanesel, mode, misc, colorcare;
+ u_int8_t bitmask;
};
#define VGA_GDC_INDEX 0xe
#define VGA_GDC_DATA 0xf
+
+#pragma pack()