summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-06-17 17:35:44 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-06-17 17:35:44 +0000
commitb37ecf5b03678191a26dd176cde8980b08eb766a (patch)
tree2658214e501950d9851b7692e92c5ca8cbf26810 /sys/arch/sparc64
parent715335a33b88e081090522d8f3f0a6aca95e87de (diff)
Extend the sunfb structure to take care of the PROM cursor position
pointers, and adapt creator to the fb api. ok jason@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/dev/creator.c111
-rw-r--r--sys/arch/sparc64/dev/creator_mainbus.c3
-rw-r--r--sys/arch/sparc64/dev/creator_upa.c3
-rw-r--r--sys/arch/sparc64/dev/creatorvar.h7
-rw-r--r--sys/arch/sparc64/dev/fb.c20
-rw-r--r--sys/arch/sparc64/include/fbvar.h4
6 files changed, 54 insertions, 94 deletions
diff --git a/sys/arch/sparc64/dev/creator.c b/sys/arch/sparc64/dev/creator.c
index be4eecdef6f..2d06d94bc2d 100644
--- a/sys/arch/sparc64/dev/creator.c
+++ b/sys/arch/sparc64/dev/creator.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: creator.c,v 1.25 2003/06/02 20:02:49 jason Exp $ */
+/* $OpenBSD: creator.c,v 1.26 2003/06/17 17:35:40 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -42,17 +42,13 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wscons_raster.h>
#include <dev/rasops/rasops.h>
+#include <machine/fbvar.h>
#include <sparc64/dev/creatorreg.h>
#include <sparc64/dev/creatorvar.h>
struct wsscreen_descr creator_stdscreen = {
"std",
- 0, 0, /* will be filled in -- XXX shouldn't, it's global. */
- 0,
- 0, 0,
- WSSCREEN_UNDERLINE | WSSCREEN_HILIT |
- WSSCREEN_REVERSE | WSSCREEN_WSCOLORS
};
const struct wsscreen_descr *creator_scrlist[] = {
@@ -72,7 +68,6 @@ void creator_free_screen(void *, void *);
int creator_show_screen(void *, void *, int, void (*cb)(void *, int, int),
void *);
paddr_t creator_mmap(void *, off_t, int);
-static int a2int(char *, int);
void creator_ras_fifo_wait(struct creator_softc *, int);
void creator_ras_wait(struct creator_softc *);
void creator_ras_init(struct creator_softc *);
@@ -82,7 +77,6 @@ void creator_ras_eraserows(void *, int, int, long int);
void creator_ras_updatecursor(struct rasops_info *);
void creator_ras_fill(struct creator_softc *);
void creator_ras_setfg(struct creator_softc *, int32_t);
-void creator_ras_updatecursor(struct rasops_info *);
int creator_setcursor(struct creator_softc *, struct wsdisplay_cursor *);
int creator_updatecursor(struct creator_softc *, u_int);
void creator_curs_enable(struct creator_softc *, u_int);
@@ -139,66 +133,40 @@ creator_attach(struct creator_softc *sc)
if (sc->sc_type == FFB_AFB)
sc->sc_dacrev = 10;
- sc->sc_depth = 24;
- sc->sc_linebytes = 8192;
- sc->sc_height = getpropint(sc->sc_node, "height", 0);
- sc->sc_width = getpropint(sc->sc_node, "width", 0);
+ fb_setsize(&sc->sc_sunfb, 32, 1152, 900, sc->sc_node, 0);
+ /* linesize has a fixed value, compensate */
+ sc->sc_sunfb.sf_linebytes = 8192;
+ sc->sc_sunfb.sf_fbsize = sc->sc_sunfb.sf_height * 8192;
- sc->sc_rasops.ri_depth = 32;
- sc->sc_rasops.ri_stride = sc->sc_linebytes;
- sc->sc_rasops.ri_flg = RI_CENTER;
- sc->sc_rasops.ri_bits = (void *)bus_space_vaddr(sc->sc_bt,
+ sc->sc_sunfb.sf_ro.ri_bits = (void *)bus_space_vaddr(sc->sc_bt,
sc->sc_pixel_h);
-
- sc->sc_rasops.ri_width = sc->sc_width;
- sc->sc_rasops.ri_height = sc->sc_height;
- sc->sc_rasops.ri_hw = sc;
-
- rasops_init(&sc->sc_rasops,
- a2int(getpropstring(optionsnode, "screen-#rows"), 34),
- a2int(getpropstring(optionsnode, "screen-#columns"), 80));
-
- if ((sc->sc_dv.dv_cfdata->cf_flags & CREATOR_CFFLAG_NOACCEL) == 0) {
- sc->sc_rasops.ri_hw = sc;
- sc->sc_rasops.ri_ops.eraserows = creator_ras_eraserows;
- sc->sc_rasops.ri_ops.erasecols = creator_ras_erasecols;
- sc->sc_rasops.ri_ops.copyrows = creator_ras_copyrows;
+ sc->sc_sunfb.sf_ro.ri_hw = sc;
+ fbwscons_init(&sc->sc_sunfb, sc->sc_console ? 0 : RI_CLEAR);
+
+ if ((sc->sc_sunfb.sf_dev.dv_cfdata->cf_flags & CREATOR_CFFLAG_NOACCEL)
+ == 0) {
+ sc->sc_sunfb.sf_ro.ri_ops.eraserows = creator_ras_eraserows;
+ sc->sc_sunfb.sf_ro.ri_ops.erasecols = creator_ras_erasecols;
+ sc->sc_sunfb.sf_ro.ri_ops.copyrows = creator_ras_copyrows;
creator_ras_init(sc);
}
- creator_stdscreen.nrows = sc->sc_rasops.ri_rows;
- creator_stdscreen.ncols = sc->sc_rasops.ri_cols;
- creator_stdscreen.textops = &sc->sc_rasops.ri_ops;
+ creator_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
+ creator_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
+ creator_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
+ creator_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
if (sc->sc_console) {
- long defattr;
-
- if (romgetcursoraddr(&sc->sc_crowp, &sc->sc_ccolp))
- sc->sc_ccolp = sc->sc_crowp = NULL;
- if (sc->sc_ccolp != NULL)
- sc->sc_rasops.ri_ccol = *sc->sc_ccolp;
- if (sc->sc_crowp != NULL)
- sc->sc_rasops.ri_crow = *sc->sc_crowp;
-
- /* fix color choice */
- wscol_white = 0;
- wscol_black = 255;
- wskernel_bg = 0;
- wskernel_fg = 255;
-
- sc->sc_rasops.ri_ops.alloc_attr(&sc->sc_rasops,
- 0, 0, 0, &defattr);
- sc->sc_rasops.ri_updatecursor = creator_ras_updatecursor;
-
- wsdisplay_cnattach(&creator_stdscreen, &sc->sc_rasops,
- sc->sc_rasops.ri_ccol, sc->sc_rasops.ri_crow, defattr);
+ sc->sc_sunfb.sf_ro.ri_updatecursor = creator_ras_updatecursor;
+ fbwscons_console_init(&sc->sc_sunfb, &creator_stdscreen, -1,
+ NULL);
}
waa.console = sc->sc_console;
waa.scrdata = &creator_screenlist;
waa.accessops = &creator_accessops;
waa.accesscookie = sc;
- config_found(&sc->sc_dv, &waa, wsemuldisplaydevprint);
+ config_found(&sc->sc_sunfb.sf_dev, &waa, wsemuldisplaydevprint);
}
int
@@ -225,13 +193,13 @@ creator_ioctl(v, cmd, data, flags, p)
break;
case WSDISPLAYIO_GINFO:
wdf = (void *)data;
- wdf->height = sc->sc_height;
- wdf->width = sc->sc_width;
+ wdf->height = sc->sc_sunfb.sf_height;
+ wdf->width = sc->sc_sunfb.sf_width;
wdf->depth = 32;
- wdf->cmsize = 256; /* XXX */
+ wdf->cmsize = 0;
break;
case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = sc->sc_linebytes;
+ *(u_int *)data = sc->sc_sunfb.sf_linebytes;
break;
case WSDISPLAYIO_GCURSOR:
curs = (struct wsdisplay_cursor *)data;
@@ -429,10 +397,11 @@ creator_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
if (sc->sc_nscreens > 0)
return (ENOMEM);
- *cookiep = &sc->sc_rasops;
+ *cookiep = &sc->sc_sunfb.sf_ro;
*curyp = 0;
*curxp = 0;
- sc->sc_rasops.ri_ops.alloc_attr(&sc->sc_rasops, 0, 0, 0, attrp);
+ sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro,
+ 0, 0, 0, attrp);
sc->sc_nscreens++;
return (0);
}
@@ -547,18 +516,6 @@ creator_mmap(vsc, off, prot)
return (-1);
}
-static int
-a2int(char *cp, int deflt)
-{
- int i = 0;
-
- if (*cp == '\0')
- return (deflt);
- while (*cp != '\0')
- i = i * 10 + *cp++ - '0';
- return (i);
-}
-
void
creator_ras_fifo_wait(sc, n)
struct creator_softc *sc;
@@ -749,8 +706,8 @@ creator_ras_updatecursor(ri)
{
struct creator_softc *sc = ri->ri_hw;
- if (sc->sc_crowp != NULL)
- *sc->sc_crowp = ri->ri_crow;
- if (sc->sc_ccolp != NULL)
- *sc->sc_ccolp = ri->ri_ccol;
+ if (sc->sc_sunfb.sf_crowp != NULL)
+ *sc->sc_sunfb.sf_crowp = ri->ri_crow;
+ if (sc->sc_sunfb.sf_ccolp != NULL)
+ *sc->sc_sunfb.sf_ccolp = ri->ri_ccol;
}
diff --git a/sys/arch/sparc64/dev/creator_mainbus.c b/sys/arch/sparc64/dev/creator_mainbus.c
index 157756d4f42..5457895b50a 100644
--- a/sys/arch/sparc64/dev/creator_mainbus.c
+++ b/sys/arch/sparc64/dev/creator_mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: creator_mainbus.c,v 1.7 2003/06/02 20:24:09 jason Exp $ */
+/* $OpenBSD: creator_mainbus.c,v 1.8 2003/06/17 17:35:40 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net),
@@ -43,6 +43,7 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wscons_raster.h>
#include <dev/rasops/rasops.h>
+#include <machine/fbvar.h>
#include <sparc64/dev/creatorreg.h>
#include <sparc64/dev/creatorvar.h>
diff --git a/sys/arch/sparc64/dev/creator_upa.c b/sys/arch/sparc64/dev/creator_upa.c
index 54adb512479..aae2b90550f 100644
--- a/sys/arch/sparc64/dev/creator_upa.c
+++ b/sys/arch/sparc64/dev/creator_upa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: creator_upa.c,v 1.6 2003/06/02 20:02:49 jason Exp $ */
+/* $OpenBSD: creator_upa.c,v 1.7 2003/06/17 17:35:40 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -42,6 +42,7 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wscons_raster.h>
#include <dev/rasops/rasops.h>
+#include <machine/fbvar.h>
#include <sparc64/dev/creatorreg.h>
#include <sparc64/dev/creatorvar.h>
diff --git a/sys/arch/sparc64/dev/creatorvar.h b/sys/arch/sparc64/dev/creatorvar.h
index 92736e3f9e0..fd9791a1f29 100644
--- a/sys/arch/sparc64/dev/creatorvar.h
+++ b/sys/arch/sparc64/dev/creatorvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: creatorvar.h,v 1.9 2003/06/02 20:02:49 jason Exp $ */
+/* $OpenBSD: creatorvar.h,v 1.10 2003/06/17 17:35:40 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net),
@@ -34,22 +34,19 @@
#define CREATOR_CFFLAG_NOACCEL 0x1
struct creator_softc {
- struct device sc_dv;
+ struct sunfb sc_sunfb;
bus_space_tag_t sc_bt;
bus_space_handle_t sc_pixel_h;
bus_space_handle_t sc_fbc_h;
bus_space_handle_t sc_dac_h;
bus_addr_t sc_addrs[FFB_NREGS];
bus_size_t sc_sizes[FFB_NREGS];
- int sc_height, sc_width, sc_linebytes, sc_depth;
int sc_nscreens, sc_nreg;
int sc_console;
int sc_node;
int sc_type;
u_int sc_mode;
- struct rasops_info sc_rasops;
int32_t sc_fifo_cache, sc_fg_cache;
- int *sc_crowp, *sc_ccolp;
u_int32_t sc_dacrev;
u_int sc_curs_enabled, sc_curs_fg, sc_curs_bg;
struct wsdisplay_curpos sc_curs_pos, sc_curs_hot, sc_curs_size;
diff --git a/sys/arch/sparc64/dev/fb.c b/sys/arch/sparc64/dev/fb.c
index ff4962027fa..c3a16df3b7c 100644
--- a/sys/arch/sparc64/dev/fb.c
+++ b/sys/arch/sparc64/dev/fb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fb.c,v 1.1 2003/06/16 20:46:10 miod Exp $ */
+/* $OpenBSD: fb.c,v 1.2 2003/06/17 17:35:40 miod Exp $ */
/* $NetBSD: fb.c,v 1.23 1997/07/07 23:30:22 pk Exp $ */
/*
@@ -166,21 +166,23 @@ fbwscons_console_init(struct sunfb *sf, struct wsscreen_descr *wsc, int row,
void (*burner)(void *, u_int, u_int))
{
long defattr;
- int *ccolp, *crowp;
- if (romgetcursoraddr(&crowp, &ccolp))
- ccolp = crowp = NULL;
- if (ccolp != NULL)
- sf->sf_ro.ri_ccol = *ccolp;
+ if (romgetcursoraddr(&sf->sf_crowp, &sf->sf_ccolp))
+ sf->sf_ccolp = sf->sf_crowp = NULL;
+ if (sf->sf_ccolp != NULL)
+ sf->sf_ro.ri_ccol = *sf->sf_ccolp;
if (row < 0) {
- if (crowp != NULL)
- sf->sf_ro.ri_crow = *crowp;
+ if (sf->sf_crowp != NULL)
+ sf->sf_ro.ri_crow = *sf->sf_crowp;
else
/* assume last row */
sf->sf_ro.ri_crow = sf->sf_ro.ri_rows - 1;
- } else
+ } else {
sf->sf_ro.ri_crow = row;
+ if (sf->sf_crowp != NULL)
+ *sf->sf_crowp = row;
+ }
/*
* Scale back rows and columns if the font would not otherwise
diff --git a/sys/arch/sparc64/include/fbvar.h b/sys/arch/sparc64/include/fbvar.h
index 2431726858c..fcb8466f594 100644
--- a/sys/arch/sparc64/include/fbvar.h
+++ b/sys/arch/sparc64/include/fbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fbvar.h,v 1.1 2003/06/16 20:46:13 miod Exp $ */
+/* $OpenBSD: fbvar.h,v 1.2 2003/06/17 17:35:43 miod Exp $ */
/* $NetBSD: fbvar.h,v 1.9 1997/07/07 23:31:30 pk Exp $ */
/*
@@ -55,6 +55,8 @@ struct sunfb {
int sf_fbsize; /* sf_height * sf_linebytes */
+ int *sf_crowp, *sf_ccolp; /* PROM cursor position */
+
struct rasops_info sf_ro;
};