summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-12-26 22:30:22 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-12-26 22:30:22 +0000
commit98d45c69fbaee89aabba35e59ac5ad66df90eab5 (patch)
tree158772ef675dbfc4b9381e2b9a5aa47ba1944376 /sys/arch/sparc/dev
parentbf3b6f2384dfb5783abe569c9796e049014076e7 (diff)
Move the logic responsible from deciding whether a frame buffer needs to be
cleared on attach, from the individual drivers to the common frame buffer code; the latter will decide based on the prom font metrics and the prom console window position, whenever possible. This removes the need for the console window position to be hardcoded in the p9100 driver, and will no longer require a screen clear on a vigra VS-12 in high resolution mode.
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r--sys/arch/sparc/dev/agten.c7
-rw-r--r--sys/arch/sparc/dev/bwtwo.c7
-rw-r--r--sys/arch/sparc/dev/cgeight.c7
-rw-r--r--sys/arch/sparc/dev/cgfour.c9
-rw-r--r--sys/arch/sparc/dev/cgfourteen.c4
-rw-r--r--sys/arch/sparc/dev/cgsix.c28
-rw-r--r--sys/arch/sparc/dev/cgthree.c23
-rw-r--r--sys/arch/sparc/dev/cgtwelve.c4
-rw-r--r--sys/arch/sparc/dev/cgtwo.c7
-rw-r--r--sys/arch/sparc/dev/fb.c161
-rw-r--r--sys/arch/sparc/dev/mgx.c13
-rw-r--r--sys/arch/sparc/dev/p9000.c28
-rw-r--r--sys/arch/sparc/dev/p9100.c46
-rw-r--r--sys/arch/sparc/dev/rfx.c7
-rw-r--r--sys/arch/sparc/dev/tcx.c19
-rw-r--r--sys/arch/sparc/dev/tvtwo.c15
-rw-r--r--sys/arch/sparc/dev/vigra.c40
-rw-r--r--sys/arch/sparc/dev/zx.c4
18 files changed, 216 insertions, 213 deletions
diff --git a/sys/arch/sparc/dev/agten.c b/sys/arch/sparc/dev/agten.c
index 07e8ab9b42e..252561062c8 100644
--- a/sys/arch/sparc/dev/agten.c
+++ b/sys/arch/sparc/dev/agten.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agten.c,v 1.11 2008/12/25 23:56:29 miod Exp $ */
+/* $OpenBSD: agten.c,v 1.12 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2002, 2003, Miodrag Vallat.
* All rights reserved.
@@ -204,12 +204,11 @@ agtenattach(struct device *parent, struct device *self, void *args)
sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_i128_fb;
sc->sc_sunfb.sf_ro.ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, agten_setcolor);
- if (isconsole) {
+ if (isconsole)
fbwscons_console_init(&sc->sc_sunfb, -1);
- }
fbwscons_attach(&sc->sc_sunfb, &agten_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/bwtwo.c b/sys/arch/sparc/dev/bwtwo.c
index b9cb9ddafb2..1a81df15709 100644
--- a/sys/arch/sparc/dev/bwtwo.c
+++ b/sys/arch/sparc/dev/bwtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwtwo.c,v 1.34 2006/12/03 16:38:12 miod Exp $ */
+/* $OpenBSD: bwtwo.c,v 1.35 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: bwtwo.c,v 1.33 1997/05/24 20:16:02 pk Exp $ */
/*
@@ -275,11 +275,10 @@ obp_name:
sc->sc_sunfb.sf_ro.ri_bits = mapiodev(ca->ca_ra.ra_reg,
sc->sc_pixeloffset, round_page(sc->sc_sunfb.sf_fbsize));
sc->sc_sunfb.sf_ro.ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
- if (isconsole) {
+ if (isconsole)
fbwscons_console_init(&sc->sc_sunfb, -1);
- }
fbwscons_attach(&sc->sc_sunfb, &bwtwo_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/cgeight.c b/sys/arch/sparc/dev/cgeight.c
index 4d2bcb4f19d..12613bf0d79 100644
--- a/sys/arch/sparc/dev/cgeight.c
+++ b/sys/arch/sparc/dev/cgeight.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgeight.c,v 1.28 2006/12/03 22:13:05 miod Exp $ */
+/* $OpenBSD: cgeight.c,v 1.29 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: cgeight.c,v 1.13 1997/05/24 20:16:04 pk Exp $ */
/*
@@ -192,13 +192,12 @@ cgeightattach(struct device *parent, struct device *self, void *args)
PFOUR_COLOR_OFF_OVERLAY, round_page(sc->sc_sunfb.sf_fbsize));
cgeight_reset(sc, WSDISPLAYIO_MODE_EMUL);
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
printf(": p4, %dx%d", sc->sc_sunfb.sf_width,
sc->sc_sunfb.sf_height);
- if (isconsole) {
+ fbwscons_init(&sc->sc_sunfb, isconsole);
+ if (isconsole)
fbwscons_console_init(&sc->sc_sunfb, -1);
- }
fbwscons_attach(&sc->sc_sunfb, &cgeight_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/cgfour.c b/sys/arch/sparc/dev/cgfour.c
index 46a8d6f4f28..ae5afdcb314 100644
--- a/sys/arch/sparc/dev/cgfour.c
+++ b/sys/arch/sparc/dev/cgfour.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgfour.c,v 1.27 2006/12/03 16:38:12 miod Exp $ */
+/* $OpenBSD: cgfour.c,v 1.28 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: cgfour.c,v 1.13 1997/05/24 20:16:06 pk Exp $ */
/*
@@ -193,14 +193,13 @@ cgfourattach(struct device *parent, struct device *self, void *args)
sc->sc_sunfb.sf_ro.ri_bits = mapiodev(ca->ca_ra.ra_reg,
PFOUR_COLOR_OFF_COLOR, round_page(sc->sc_sunfb.sf_fbsize));
sc->sc_sunfb.sf_ro.ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
- fbwscons_setcolormap(&sc->sc_sunfb, cgfour_setcolor);
printf(", %dx%d\n", sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
- if (isconsole) {
+ fbwscons_init(&sc->sc_sunfb, isconsole);
+ fbwscons_setcolormap(&sc->sc_sunfb, cgfour_setcolor);
+ if (isconsole)
fbwscons_console_init(&sc->sc_sunfb, -1);
- }
fbwscons_attach(&sc->sc_sunfb, &cgfour_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c
index 8eb5da0fa02..895b6cb9b0b 100644
--- a/sys/arch/sparc/dev/cgfourteen.c
+++ b/sys/arch/sparc/dev/cgfourteen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgfourteen.c,v 1.35 2007/03/13 19:40:48 miod Exp $ */
+/* $OpenBSD: cgfourteen.c,v 1.36 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */
/*
@@ -322,7 +322,7 @@ cgfourteenattach(struct device *parent, struct device *self, void *args)
cgfourteen_burner(sc, 1, 0);
sc->sc_sunfb.sf_ro.ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, cgfourteen_setcolor);
if (isconsole) {
diff --git a/sys/arch/sparc/dev/cgsix.c b/sys/arch/sparc/dev/cgsix.c
index db2c3ff7554..578aeae0a1b 100644
--- a/sys/arch/sparc/dev/cgsix.c
+++ b/sys/arch/sparc/dev/cgsix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgsix.c,v 1.39 2008/12/26 15:34:10 miod Exp $ */
+/* $OpenBSD: cgsix.c,v 1.40 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: cgsix.c,v 1.33 1997/08/07 19:12:30 pk Exp $ */
/*
@@ -274,19 +274,10 @@ cgsixattach(struct device *parent, struct device *self, void *args)
CGSIX_VID_OFFSET, round_page(sc->sc_sunfb.sf_fbsize));
sc->sc_sunfb.sf_ro.ri_hw = sc;
- /*
- * If the framebuffer width is under 1024x768, we will switch from the
- * PROM font to the more adequate 8x16 font here.
- * However, we need to adjust two things in this case:
- * - the display row should be overrided from the current PROM metrics,
- * to prevent us from overwriting the last few lines of text.
- * - if the 80x34 screen would make a large margin appear around it,
- * choose to clear the screen rather than keeping old prom output in
- * the margins.
- * XXX there should be a rasops "clear margins" feature
- */
- fbwscons_init(&sc->sc_sunfb, isconsole &&
- (sc->sc_sunfb.sf_width >= 1024) ? 0 : RI_CLEAR);
+ printf("%dx%d, rev %d\n", sc->sc_sunfb.sf_width,
+ sc->sc_sunfb.sf_height, fhcrev);
+
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, cgsix_setcolor);
/*
@@ -304,13 +295,8 @@ cgsixattach(struct device *parent, struct device *self, void *args)
cgsix_ras_init(sc);
}
- printf("%dx%d, rev %d\n", sc->sc_sunfb.sf_width,
- sc->sc_sunfb.sf_height, fhcrev);
-
- if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb,
- sc->sc_sunfb.sf_width >= 1024 ? -1 : 0);
- }
+ if (isconsole)
+ fbwscons_console_init(&sc->sc_sunfb, -1);
fbwscons_attach(&sc->sc_sunfb, &cgsix_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/cgthree.c b/sys/arch/sparc/dev/cgthree.c
index 9976f6a5100..1d6c746563f 100644
--- a/sys/arch/sparc/dev/cgthree.c
+++ b/sys/arch/sparc/dev/cgthree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgthree.c,v 1.34 2008/12/26 15:35:06 miod Exp $ */
+/* $OpenBSD: cgthree.c,v 1.35 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: cgthree.c,v 1.33 1997/05/24 20:16:11 pk Exp $ */
/*
@@ -245,26 +245,11 @@ cgthreeattach(struct device *parent, struct device *self, void *args)
printf("%dx%d\n", sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
- /*
- * If the framebuffer width is under 1024x768, which is the case for
- * some clones on laptops, as well as with the VS10-EK, switch from
- * the PROM font to the more adequate 8x16 font here.
- * However, we need to adjust two things in this case:
- * - the display row should be overrided from the current PROM metrics,
- * to prevent us from overwriting the last few lines of text.
- * - if the 80x34 screen would make a large margin appear around it,
- * choose to clear the screen rather than keeping old prom output in
- * the margins.
- * XXX there should be a rasops "clear margins" feature
- */
- fbwscons_init(&sc->sc_sunfb, isconsole &&
- (sc->sc_sunfb.sf_width >= 1024) ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, cgthree_setcolor);
- if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb,
- sc->sc_sunfb.sf_width >= 1024 ? -1 : 0);
- }
+ if (isconsole)
+ fbwscons_console_init(&sc->sc_sunfb, -1);
fbwscons_attach(&sc->sc_sunfb, &cgthree_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/cgtwelve.c b/sys/arch/sparc/dev/cgtwelve.c
index 1deddc5c919..a3f2c126800 100644
--- a/sys/arch/sparc/dev/cgtwelve.c
+++ b/sys/arch/sparc/dev/cgtwelve.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgtwelve.c,v 1.16 2007/03/13 19:40:48 miod Exp $ */
+/* $OpenBSD: cgtwelve.c,v 1.17 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2002, 2003 Miodrag Vallat. All rights reserved.
@@ -194,7 +194,7 @@ cgtwelveattach(struct device *parent, struct device *self, void *args)
sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_overlay;
sc->sc_sunfb.sf_ro.ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
if (isconsole) {
fbwscons_console_init(&sc->sc_sunfb, -1);
diff --git a/sys/arch/sparc/dev/cgtwo.c b/sys/arch/sparc/dev/cgtwo.c
index 74f1b415293..b0ba025de3e 100644
--- a/sys/arch/sparc/dev/cgtwo.c
+++ b/sys/arch/sparc/dev/cgtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgtwo.c,v 1.36 2006/12/03 16:40:06 miod Exp $ */
+/* $OpenBSD: cgtwo.c,v 1.37 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: cgtwo.c,v 1.22 1997/05/24 20:16:12 pk Exp $ */
/*
@@ -216,11 +216,12 @@ cgtwoattach(struct device *parent, struct device *self, void *args)
sc->sc_sunfb.sf_ro.ri_bits = mapiodev(&sc->sc_phys, CG2_PIXMAP_OFF,
round_page(sc->sc_sunfb.sf_fbsize));
sc->sc_sunfb.sf_ro.ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
- fbwscons_setcolormap(&sc->sc_sunfb, cgtwo_setcolor);
printf(": %dx%d\n", sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
+ fbwscons_setcolormap(&sc->sc_sunfb, cgtwo_setcolor);
+
if (isconsole) {
fbwscons_console_init(&sc->sc_sunfb, -1);
}
diff --git a/sys/arch/sparc/dev/fb.c b/sys/arch/sparc/dev/fb.c
index 988ef308055..92495f2d5ca 100644
--- a/sys/arch/sparc/dev/fb.c
+++ b/sys/arch/sparc/dev/fb.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: fb.c,v 1.43 2006/12/03 22:10:30 miod Exp $ */
+/* $OpenBSD: fb.c,v 1.44 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: fb.c,v 1.23 1997/07/07 23:30:22 pk Exp $ */
/*
- * Copyright (c) 2002, 2004 Miodrag Vallat.
+ * Copyright (c) 2002, 2004, 2008 Miodrag Vallat.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -82,6 +82,9 @@
#include <machine/eeprom.h>
#include <sparc/dev/pfourreg.h>
#endif
+#if defined(SUN4C) || defined(SUN4M)
+#include <machine/bsd_openprom.h>
+#endif
#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>
@@ -118,8 +121,10 @@ fb_unblank()
#if defined(SUN4C) || defined(SUN4M)
static int a2int(char *, int);
#endif
-static void fb_initwsd(struct sunfb *);
-static void fb_updatecursor(struct rasops_info *);
+int fb_get_console_metrics(int *, int *, int *, int *);
+void fb_initwsd(struct sunfb *);
+void fb_updatecursor(struct rasops_info *);
+
int fb_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
void fb_free_screen(void *, void *);
@@ -274,7 +279,7 @@ a2int(char *cp, int deflt)
#endif
/* setup the embedded wsscreen_descr structure from rasops settings */
-static void
+void
fb_initwsd(struct sunfb *sf)
{
strlcpy(sf->sf_wsd.name, "std", sizeof(sf->sf_wsd.name));
@@ -284,7 +289,7 @@ fb_initwsd(struct sunfb *sf)
sf->sf_wsd.textops = &sf->sf_ro.ri_ops;
}
-static void
+void
fb_updatecursor(struct rasops_info *ri)
{
struct sunfb *sf = (struct sunfb *)ri->ri_hw;
@@ -296,13 +301,15 @@ fb_updatecursor(struct rasops_info *ri)
}
void
-fbwscons_init(struct sunfb *sf, int flags)
+fbwscons_init(struct sunfb *sf, int isconsole)
{
struct rasops_info *ri = &sf->sf_ro;
- int cols, rows;
+ int cols, rows, fw, fh, wt, wl;
/* ri_hw and ri_bits must have already been setup by caller */
- ri->ri_flg = RI_CENTER | RI_FULLCLEAR | flags;
+ ri->ri_flg = RI_FULLCLEAR;
+ if (!isconsole)
+ ri->ri_flg |= RI_CLEAR;
ri->ri_depth = sf->sf_depth;
ri->ri_stride = sf->sf_linebytes;
ri->ri_width = sf->sf_width;
@@ -333,8 +340,82 @@ fbwscons_init(struct sunfb *sf, int flags)
}
#endif
+ /*
+ * If the framebuffer width is under 960 pixels, rasops will
+ * switch from the 12x22 font to the more adequate 8x16 font
+ * here.
+ * If we are the console device, we need to adjust two things:
+ * - the display row should be overrided from the current PROM
+ * metrics, since it will not match the PROM reality anymore.
+ * - the screen needs to be cleared.
+ *
+ * However, to accomodate laptops with specific small fonts,
+ * it is necessary to compare the resolution with the actual
+ * font metrics.
+ *
+ * Note that, on sun4 systems, no frame buffer supports display
+ * resolutions requiring a font switch, so it is safe to bypass
+ * this chunk.
+ */
+
+#if defined(SUN4C) || defined(SUN4M)
+ if (CPU_ISSUN4COR4M && isconsole) {
+ if (fb_get_console_metrics(&fw, &fh, &wt, &wl) != 0) {
+ /*
+ * Assume a 12x22 prom font and a centered
+ * 80x34 console window.
+ */
+ fw = 12; fh = 22;
+ ri->ri_flg |= RI_CENTER;
+
+ /*
+ * Since the console window might not be
+ * centered (e.g. on a 1280x1024 vigra
+ * VS-12 frame buffer), have rasops
+ * clear the margins even if the screen is
+ * not cleared.
+ */
+ ri->ri_flg |= RI_CLEARMARGINS;
+ }
+
+ if (ri->ri_wsfcookie != 0) {
+ /* driver handles font issues. do nothing. */
+ } else {
+ /*
+ * If the PROM uses a different font than the
+ * one we are expecting it to use, or if the
+ * display is shorter than 960 pixels wide,
+ * we'll force a screen clear.
+ */
+ if (fw != 12 || sf->sf_width < 12 * 80)
+ ri->ri_flg |= RI_CLEAR | RI_CENTER;
+ }
+ } else {
+ ri->ri_flg |= RI_CENTER;
+ }
+#endif
+
rasops_init(ri, rows, cols);
+#if defined(SUN4C) || defined(SUN4M)
+ /*
+ * If this is the console display and there is no font change,
+ * adjust our terminal window to the position of the PROM
+ * window - in case it is not exactly centered.
+ */
+ if ((ri->ri_flg & RI_CENTER) == 0) {
+ /* code above made sure wt and wl are initialized */
+ ri->ri_bits += wt * ri->ri_stride;
+ if (ri->ri_depth >= 8) /* for 15bpp to compute ok */
+ ri->ri_bits += wl * ri->ri_pelbytes;
+ else
+ ri->ri_bits += (wl * ri->ri_depth) >> 3;
+
+ ri->ri_xorigin = wl;
+ ri->ri_yorigin = wt;
+ }
+#endif
+
if (sf->sf_depth == 8) {
/*
* If we are running with an indexed palette, compensate
@@ -363,21 +444,26 @@ fbwscons_console_init(struct sunfb *sf, int row)
if (sf->sf_ccolp != NULL)
ri->ri_ccol = *sf->sf_ccolp;
- if (row < 0) {
- if (sf->sf_crowp != NULL)
- ri->ri_crow = *sf->sf_crowp;
- else
- /* assume last row */
- ri->ri_crow = ri->ri_rows - 1;
- } else {
+ if (ri->ri_flg & RI_CLEAR) {
/*
- * If we force the display row, this is because the screen
- * has been cleared or the font has been changed.
+ * If we have cleared the screen, this is because either
+ * we are not the console display, or the font has been
+ * changed.
* In this case, choose not to keep pointers to the PROM
* cursor position, as the values are likely to be inaccurate
* upon shutdown...
*/
sf->sf_crowp = sf->sf_ccolp = NULL;
+ row = 0;
+ }
+
+ if (row < 0) /* no override */ {
+ if (sf->sf_crowp != NULL)
+ ri->ri_crow = *sf->sf_crowp;
+ else
+ /* assume last row */
+ ri->ri_crow = ri->ri_rows - 1;
+ } else {
ri->ri_crow = row;
}
@@ -559,4 +645,43 @@ fb_pfour_burner(void *v, u_int enable, u_int flags)
#endif /* SUN4 */
+#if defined(SUN4C) || defined(SUN4M)
+int
+fb_get_console_metrics(int *fontwidth, int *fontheight, int *wtop, int *wleft)
+{
+ int *romwidth, *romheight, *windowtop, *windowleft;
+ char buf[200];
+
+ /*
+ * This code currently only works for PROM >= 2.9; see
+ * autoconf.c romgetcursoraddr() for details.
+ */
+ if (promvec->pv_romvec_vers < 2 || promvec->pv_printrev < 0x00020009)
+ return (1);
+
+ /*
+ * Get the PROM font metrics and address
+ */
+ if (snprintf(buf, sizeof buf, "stdout @ is my-self "
+ "addr char-height %lx ! addr char-width %lx ! "
+ "addr window-top %lx ! addr window-left %lx !",
+ (vaddr_t)&romheight, (vaddr_t)&romwidth,
+ (vaddr_t)&windowtop, (vaddr_t)&windowleft) >=
+ sizeof buf)
+ return (1);
+ romheight = romwidth = windowtop = windowleft = NULL;
+ rominterpret(buf);
+
+ if (romheight == NULL || romwidth == NULL || windowtop == NULL ||
+ windowleft == NULL || *romheight == 0 || *romwidth == 0)
+ return (1);
+
+ *fontwidth = *romwidth;
+ *fontheight = *romheight;
+ *wtop = *windowtop;
+ *wleft = *windowleft;
+ return (0);
+}
+#endif /* SUN4C || SUN4M */
+
#endif /* NWSDISPLAY */
diff --git a/sys/arch/sparc/dev/mgx.c b/sys/arch/sparc/dev/mgx.c
index 8159a33f42a..4584cac7c13 100644
--- a/sys/arch/sparc/dev/mgx.c
+++ b/sys/arch/sparc/dev/mgx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mgx.c,v 1.14 2008/04/15 20:23:54 miod Exp $ */
+/* $OpenBSD: mgx.c,v 1.15 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -255,14 +255,14 @@ mgxattach(struct device *parent, struct device *self, void *args)
0, round_page(sc->sc_sunfb.sf_fbsize));
sc->sc_sunfb.sf_ro.ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+ printf(", %dx%d\n",
+ sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
+
+ fbwscons_init(&sc->sc_sunfb, isconsole);
bzero(sc->sc_cmap, sizeof(sc->sc_cmap));
fbwscons_setcolormap(&sc->sc_sunfb, mgx_setcolor);
- printf(", %dx%d\n",
- sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
-
if (chipid != ID_AT24) {
printf("%s: unexpected engine id %04x\n",
self->dv_xname, chipid);
@@ -270,9 +270,8 @@ mgxattach(struct device *parent, struct device *self, void *args)
mgx_ras_init(sc, chipid);
- if (isconsole) {
+ if (isconsole)
fbwscons_console_init(&sc->sc_sunfb, -1);
- }
fbwscons_attach(&sc->sc_sunfb, &mgx_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/p9000.c b/sys/arch/sparc/dev/p9000.c
index 2cdfa22ea64..c20dfcca05b 100644
--- a/sys/arch/sparc/dev/p9000.c
+++ b/sys/arch/sparc/dev/p9000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p9000.c,v 1.21 2008/12/26 00:43:03 miod Exp $ */
+/* $OpenBSD: p9000.c,v 1.22 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -194,7 +194,7 @@ p9000attach(struct device *parent, struct device *self, void *args)
{
struct p9000_softc *sc = (struct p9000_softc *)self;
struct confargs *ca = args;
- int node, pri, row, isconsole, scr;
+ int node, pri, isconsole, scr;
struct device *btdev;
extern struct cfdriver btcham_cd;
@@ -255,19 +255,7 @@ p9000attach(struct device *parent, struct device *self, void *args)
sc->sc_ih.ih_arg = sc;
intr_establish(pri, &sc->sc_ih, IPL_FB, self->dv_xname);
- /*
- * If the framebuffer width is under 1024x768, we will switch from the
- * PROM font to the more adequate 8x16 font here.
- * However, we need to adjust two things in this case:
- * - the display row should be overrided from the current PROM metrics,
- * to prevent us from overwriting the last few lines of text.
- * - if the 80x34 screen would make a large margin appear around it,
- * choose to clear the screen rather than keeping old prom output in
- * the margins.
- * XXX there should be a rasops "clear margins" feature
- */
- fbwscons_init(&sc->sc_sunfb,
- isconsole && (sc->sc_sunfb.sf_width >= 1024) ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, p9000_setcolor);
/*
@@ -279,14 +267,8 @@ p9000attach(struct device *parent, struct device *self, void *args)
/* enable video */
p9000_burner(sc, 1, 0);
- if (isconsole) {
- if (sc->sc_sunfb.sf_width < 1024)
- row = 0; /* screen has been cleared above */
- else
- row = -1;
-
- fbwscons_console_init(&sc->sc_sunfb, row);
- }
+ if (isconsole)
+ fbwscons_console_init(&sc->sc_sunfb, -1);
fbwscons_attach(&sc->sc_sunfb, &p9000_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/p9100.c b/sys/arch/sparc/dev/p9100.c
index 2e6a67e4119..e2e5f12a55c 100644
--- a/sys/arch/sparc/dev/p9100.c
+++ b/sys/arch/sparc/dev/p9100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p9100.c,v 1.46 2008/12/26 00:42:19 miod Exp $ */
+/* $OpenBSD: p9100.c,v 1.47 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2003, 2005, 2006, 2008, Miodrag Vallat.
@@ -128,7 +128,7 @@ static __inline__
void p9100_loadcmap_deferred(struct p9100_softc *, u_int, u_int);
void p9100_loadcmap_immediate(struct p9100_softc *, u_int, u_int);
paddr_t p9100_mmap(void *, off_t, int);
-int p9100_pick_romfont(struct p9100_softc *);
+void p9100_pick_romfont(struct p9100_softc *);
void p9100_prom(void *);
void p9100_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
u_int p9100_read_ramdac(struct p9100_softc *, u_int);
@@ -274,7 +274,7 @@ p9100attach(struct device *parent, struct device *self, void *args)
struct confargs *ca = args;
struct romaux *ra = &ca->ca_ra;
int node, pri, scr;
- int isconsole, fontswitch = 0, clear = 0;
+ int isconsole;
pri = ca->ca_ra.ra_intr[0].int_pri;
printf(" pri %d", pri);
@@ -360,20 +360,10 @@ p9100attach(struct device *parent, struct device *self, void *args)
/*
* Try to get a copy of the PROM font.
*
- * If we can, we still need to adjust the visible portion of the
- * display, as the PROM output is offset two chars to the left.
- *
- * If we can't, we'll switch to the 8x16 font, and we'll need to adjust
- * two things:
- * - the display row should be overrided from the current PROM metrics,
- * to prevent us from overwriting the last few lines of text.
- * - if the 80x34 screen would make a large margin appear around it,
- * choose to clear the screen rather than keeping old prom output in
- * the margins.
- * XXX there should be a rasops "clear margins" feature
+ * If we can't, we'll clear the display and switch to the 8x16 font.
*/
if (isconsole)
- fontswitch = p9100_pick_romfont(sc);
+ p9100_pick_romfont(sc);
/*
* Register the external video control callback with tctrl; tctrl
@@ -386,13 +376,7 @@ p9100attach(struct device *parent, struct device *self, void *args)
p9100_external_video(sc, 1);
#endif
- if (isconsole == 0 || fontswitch)
- clear = 1;
- fbwscons_init(&sc->sc_sunfb, clear ? RI_CLEAR : 0);
- if (clear == 0) {
- ri->ri_bits -= 2 * ri->ri_xscale;
- ri->ri_xorigin -= 2 * ri->ri_xscale;
- }
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, p9100_setcolor);
/*
@@ -406,7 +390,7 @@ p9100attach(struct device *parent, struct device *self, void *args)
p9100_burner(sc, 1, 0);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, clear ? 0 : -1);
+ fbwscons_console_init(&sc->sc_sunfb, -1);
#if NTCTRL > 0
shutdownhook_establish(p9100_prom, sc);
#endif
@@ -955,7 +939,7 @@ struct wsdisplay_font p9100_romfont = {
NULL
};
-int
+void
p9100_pick_romfont(struct p9100_softc *sc)
{
struct rasops_info *ri = &sc->sc_sunfb.sf_ro;
@@ -968,7 +952,7 @@ p9100_pick_romfont(struct p9100_softc *sc)
* autoconf.c romgetcursoraddr() for details.
*/
if (promvec->pv_romvec_vers < 2 || promvec->pv_printrev < 0x00020009)
- return (1);
+ return;
/*
* Get the PROM font metrics and address
@@ -977,13 +961,13 @@ p9100_pick_romfont(struct p9100_softc *sc)
"addr char-height %lx ! addr char-width %lx ! addr font-base %lx !",
(vaddr_t)&romheight, (vaddr_t)&romwidth, (vaddr_t)&romaddr) >=
sizeof buf)
- return (1);
+ return;
romheight = romwidth = NULL;
rominterpret(buf);
if (romheight == NULL || romwidth == NULL || romaddr == NULL ||
*romheight == 0 || *romwidth == 0 || *romaddr == NULL)
- return (1);
+ return;
p9100_romfont.fontwidth = *romwidth;
p9100_romfont.fontheight = *romheight;
@@ -1000,19 +984,15 @@ p9100_pick_romfont(struct p9100_softc *sc)
*/
wsfont_init(); /* if not done before */
if (wsfont_add(&p9100_romfont, 0) != 0)
- return (1);
+ return;
/*
* Select this very font in our rasops structure
*/
ri->ri_wsfcookie = wsfont_find(ROMFONTNAME, 0, 0, 0);
if (wsfont_lock(ri->ri_wsfcookie, &ri->ri_font,
- WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R) <= 0) {
+ WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R) <= 0)
ri->ri_wsfcookie = 0;
- return (1);
- }
-
- return (0);
}
/*
diff --git a/sys/arch/sparc/dev/rfx.c b/sys/arch/sparc/dev/rfx.c
index 47a32290de6..76fa43ef24d 100644
--- a/sys/arch/sparc/dev/rfx.c
+++ b/sys/arch/sparc/dev/rfx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfx.c,v 1.13 2007/11/26 09:28:33 martynas Exp $ */
+/* $OpenBSD: rfx.c,v 1.14 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
@@ -281,14 +281,13 @@ rfxattach(struct device *parent, struct device *self, void *args)
if (!isconsole)
rfx_initialize(sc, &cf);
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
bzero(&sc->sc_cmap, sizeof(sc->sc_cmap));
fbwscons_setcolormap(&sc->sc_sunfb, rfx_setcolor);
- if (isconsole) {
+ if (isconsole)
fbwscons_console_init(&sc->sc_sunfb, -1);
- }
/* enable video */
rfx_burner(sc, 1, 0);
diff --git a/sys/arch/sparc/dev/tcx.c b/sys/arch/sparc/dev/tcx.c
index d61bf737d44..5cbf32027da 100644
--- a/sys/arch/sparc/dev/tcx.c
+++ b/sys/arch/sparc/dev/tcx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcx.c,v 1.42 2008/12/26 15:34:10 miod Exp $ */
+/* $OpenBSD: tcx.c,v 1.43 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: tcx.c,v 1.8 1997/07/29 09:58:14 fair Exp $ */
/*
@@ -282,19 +282,7 @@ tcxattach(struct device *parent, struct device *self, void *args)
sc->sc_sunfb.sf_ro.ri_hw = sc;
sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_dfb8;
- /*
- * If the framebuffer width is under 960 pixels, we will switch
- * from the PROM font to the more adequate 8x16 font here.
- * However, we need to adjust two things in this case:
- * - the display row should be overrided from the current PROM metrics,
- * to prevent us from overwriting the last few lines of text.
- * - if the 80x34 screen would make a large margin appear around it,
- * choose to clear the screen rather than keeping old prom output in
- * the margins.
- */
- fbwscons_init(&sc->sc_sunfb,
- isconsole && sc->sc_sunfb.sf_width >= 12 * 80 ? 0 : RI_CLEAR);
-
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, tcx_setcolor);
/*
@@ -307,8 +295,7 @@ tcxattach(struct device *parent, struct device *self, void *args)
intr_establish(pri, &sc->sc_ih, IPL_FB, self->dv_xname);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb,
- sc->sc_sunfb.sf_width >= 12 * 80 ? -1 : 0);
+ fbwscons_console_init(&sc->sc_sunfb, -1);
shutdownhook_establish(tcx_prom, sc);
}
diff --git a/sys/arch/sparc/dev/tvtwo.c b/sys/arch/sparc/dev/tvtwo.c
index 637d22ade2b..f355887fe43 100644
--- a/sys/arch/sparc/dev/tvtwo.c
+++ b/sys/arch/sparc/dev/tvtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tvtwo.c,v 1.16 2008/12/25 23:56:29 miod Exp $ */
+/* $OpenBSD: tvtwo.c,v 1.17 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2003, 2006, 2008, Miodrag Vallat.
@@ -268,18 +268,11 @@ tvtwoattach(struct device *parent, struct device *self, void *args)
sc->sc_sunfb.sf_ro.ri_hw = sc;
sc->sc_sunfb.sf_ro.ri_bits = (u_char *)sc->sc_m8;
- /*
- * If the framebuffer width is under 1024, we will switch from
- * the PROM font to the more adequate 8x16 font here.
- */
- fbwscons_init(&sc->sc_sunfb,
- isconsole && (width >= 1024) ? RI_CLEARMARGINS : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, tvtwo_setcolor);
- if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb,
- width >= 1024 ? -1 : 0);
- }
+ if (isconsole)
+ fbwscons_console_init(&sc->sc_sunfb, -1);
fbwscons_attach(&sc->sc_sunfb, &tvtwo_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/vigra.c b/sys/arch/sparc/dev/vigra.c
index 4240b83c250..d93fb9cc865 100644
--- a/sys/arch/sparc/dev/vigra.c
+++ b/sys/arch/sparc/dev/vigra.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vigra.c,v 1.17 2007/02/18 18:40:35 miod Exp $ */
+/* $OpenBSD: vigra.c,v 1.18 2008/12/26 22:30:21 miod Exp $ */
/*
* Copyright (c) 2002, 2003, Miodrag Vallat.
@@ -241,7 +241,7 @@ vigraattach(struct device *parent, struct device *self, void *args)
{
struct vigra_softc *sc = (struct vigra_softc *)self;
struct confargs *ca = args;
- int node, pri, row, isconsole = 0;
+ int node, pri, isconsole = 0;
char *nam;
pri = ca->ca_ra.ra_intr[0].int_pri;
@@ -287,41 +287,11 @@ vigraattach(struct device *parent, struct device *self, void *args)
printf(", %dx%d\n", sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
- /*
- * If the framebuffer width is under 1024x768, we will switch from the
- * PROM font to the more adequate 8x16 font here.
- * However, we need to adjust two things in this case:
- * - the display row should be overrided from the current PROM metrics,
- * to prevent us from overwriting the last few lines of text.
- * - if the 80x34 screen would make a large margin appear around it,
- * choose to clear the screen rather than keeping old prom output in
- * the margins.
- * XXX there should be a rasops "clear margins" feature
- *
- * Also, in 1280x1024 resolution, the PROM display is not centered
- * vertically (why? no other frame buffer does this in such a mode!),
- * so be lazy and clear the screen here too anyways...
- */
- fbwscons_init(&sc->sc_sunfb, isconsole && (sc->sc_sunfb.sf_width != 800
- && sc->sc_sunfb.sf_width != 1280) ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
fbwscons_setcolormap(&sc->sc_sunfb, vigra_setcolor);
- if (isconsole) {
- switch (sc->sc_sunfb.sf_width) {
- case 640:
- row = sc->sc_sunfb.sf_ro.ri_rows - 1;
- break;
- case 800:
- case 1280:
- row = 0; /* screen has been cleared above */
- break;
- default:
- row = -1;
- break;
- }
-
- fbwscons_console_init(&sc->sc_sunfb, row);
- }
+ if (isconsole)
+ fbwscons_console_init(&sc->sc_sunfb, -1);
fbwscons_attach(&sc->sc_sunfb, &vigra_accessops, isconsole);
}
diff --git a/sys/arch/sparc/dev/zx.c b/sys/arch/sparc/dev/zx.c
index 93e19d9d22b..89770094a8f 100644
--- a/sys/arch/sparc/dev/zx.c
+++ b/sys/arch/sparc/dev/zx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zx.c,v 1.21 2008/12/25 23:56:29 miod Exp $ */
+/* $OpenBSD: zx.c,v 1.22 2008/12/26 22:30:21 miod Exp $ */
/* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */
/*
@@ -247,7 +247,7 @@ zx_attach(struct device *parent, struct device *self, void *args)
ZX_OFF_SS0, round_page(sc->sc_sunfb.sf_fbsize));
ri->ri_hw = sc;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+ fbwscons_init(&sc->sc_sunfb, isconsole);
/*
* Watch out! rasops_init() invoked via fbwscons_init() did not