summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-11-29 22:07:42 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-11-29 22:07:42 +0000
commitcefdf5e62eae54a4c575c27947ca681a438ade33 (patch)
treef6057fe704b1e777395bda6ae431013303d9ffe7 /sys/arch/sparc/dev
parent0ade68e7821ecaff132d0ec95dd118093bff8605 (diff)
Move the struct wsscreen_descr from a per-driver global to a per-instance
field of the sunfb structure. This allows multiple instances of the same driver, but with different resolutions (such as a couple of vigra or a TGX cgsix and a TGX+ cgsix) to use distinct wsscreen_descr structures featuring different resolution information. Doing this allows more wsscreen_descr fiddling inside the sparc* fb api, and results in some code shrinkage (about 4KB on sparc GENERIC).
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r--sys/arch/sparc/dev/agten.c29
-rw-r--r--sys/arch/sparc/dev/bwtwo.c30
-rw-r--r--sys/arch/sparc/dev/cgeight.c30
-rw-r--r--sys/arch/sparc/dev/cgfour.c30
-rw-r--r--sys/arch/sparc/dev/cgfourteen.c30
-rw-r--r--sys/arch/sparc/dev/cgsix.c28
-rw-r--r--sys/arch/sparc/dev/cgthree.c29
-rw-r--r--sys/arch/sparc/dev/cgtwelve.c30
-rw-r--r--sys/arch/sparc/dev/cgtwo.c30
-rw-r--r--sys/arch/sparc/dev/fb.c60
-rw-r--r--sys/arch/sparc/dev/mgx.c30
-rw-r--r--sys/arch/sparc/dev/p9000.c30
-rw-r--r--sys/arch/sparc/dev/p9100.c30
-rw-r--r--sys/arch/sparc/dev/rfx.c30
-rw-r--r--sys/arch/sparc/dev/tcx.c29
-rw-r--r--sys/arch/sparc/dev/tvtwo.c30
-rw-r--r--sys/arch/sparc/dev/vigra.c32
-rw-r--r--sys/arch/sparc/dev/zx.c30
18 files changed, 100 insertions, 467 deletions
diff --git a/sys/arch/sparc/dev/agten.c b/sys/arch/sparc/dev/agten.c
index ac7afb65780..675a3578da3 100644
--- a/sys/arch/sparc/dev/agten.c
+++ b/sys/arch/sparc/dev/agten.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agten.c,v 1.5 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: agten.c,v 1.6 2004/11/29 22:07:36 miod Exp $ */
/*
* Copyright (c) 2002, 2003, Miodrag Vallat.
* All rights reserved.
@@ -105,18 +105,6 @@ struct agten_softc {
int sc_nscreens;
};
-struct wsscreen_descr agten_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *agten_scrlist[] = {
- &agten_stdscreen,
-};
-
-struct wsscreen_list agten_screenlist = {
- sizeof(agten_scrlist) / sizeof(struct wsscreen_descr *), agten_scrlist
-};
-
int agten_ioctl(void *, u_long, caddr_t, int, struct proc *);
int agten_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -172,7 +160,6 @@ agtenattach(struct device *parent, struct device *self, void *args)
{
struct agten_softc *sc = (struct agten_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node, isconsole;
char *nam;
@@ -227,23 +214,13 @@ agtenattach(struct device *parent, struct device *self, void *args)
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
fbwscons_setcolormap(&sc->sc_sunfb, agten_setcolor);
- agten_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- agten_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- agten_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- agten_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &agten_stdscreen, -1,
- NULL);
+ fbwscons_console_init(&sc->sc_sunfb, -1, NULL);
}
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
- waa.console = isconsole;
- waa.scrdata = &agten_screenlist;
- waa.accessops = &agten_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &agten_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/bwtwo.c b/sys/arch/sparc/dev/bwtwo.c
index 893142220a2..98cc95679bc 100644
--- a/sys/arch/sparc/dev/bwtwo.c
+++ b/sys/arch/sparc/dev/bwtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwtwo.c,v 1.27 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: bwtwo.c,v 1.28 2004/11/29 22:07:36 miod Exp $ */
/* $NetBSD: bwtwo.c,v 1.33 1997/05/24 20:16:02 pk Exp $ */
/*
@@ -93,19 +93,6 @@ struct bwtwo_softc {
int sc_nscreens;
};
-struct wsscreen_descr bwtwo_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *bwtwo_scrlist[] = {
- &bwtwo_stdscreen,
-};
-
-struct wsscreen_list bwtwo_screenlist = {
- sizeof(bwtwo_scrlist) / sizeof(struct wsscreen_descr *),
- bwtwo_scrlist
-};
-
int bwtwo_ioctl(void *, u_long, caddr_t, int, struct proc *);
int bwtwo_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -208,7 +195,6 @@ bwtwoattach(parent, self, args)
{
struct bwtwo_softc *sc = (struct bwtwo_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node = ca->ca_ra.ra_node;
int isconsole = 0;
int sbus = 1;
@@ -308,14 +294,8 @@ obp_name:
sc->sc_sunfb.sf_ro.ri_hw = sc;
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
- bwtwo_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- bwtwo_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- bwtwo_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- bwtwo_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &bwtwo_stdscreen, -1,
- bwtwo_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, bwtwo_burner);
}
#if defined(SUN4C) || defined(SUN4M)
@@ -323,11 +303,7 @@ obp_name:
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
#endif
- waa.console = isconsole;
- waa.scrdata = &bwtwo_screenlist;
- waa.accessops = &bwtwo_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &bwtwo_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/cgeight.c b/sys/arch/sparc/dev/cgeight.c
index 13eba516700..b46207911da 100644
--- a/sys/arch/sparc/dev/cgeight.c
+++ b/sys/arch/sparc/dev/cgeight.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgeight.c,v 1.21 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: cgeight.c,v 1.22 2004/11/29 22:07:36 miod Exp $ */
/* $NetBSD: cgeight.c,v 1.13 1997/05/24 20:16:04 pk Exp $ */
/*
@@ -88,19 +88,6 @@ struct cgeight_softc {
int sc_nscreens;
};
-struct wsscreen_descr cgeight_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *cgeight_scrlist[] = {
- &cgeight_stdscreen,
-};
-
-struct wsscreen_list cgeight_screenlist = {
- sizeof(cgeight_scrlist) /sizeof(struct wsscreen_descr *),
- cgeight_scrlist
-};
-
int cgeight_ioctl(void *, u_long, caddr_t, int, struct proc *);
int cgeight_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -184,7 +171,6 @@ cgeightattach(parent, self, args)
{
struct cgeight_softc *sc = (struct cgeight_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node = 0, i;
volatile struct bt_regs *bt;
int isconsole = 0;
@@ -229,24 +215,14 @@ cgeightattach(parent, self, args)
PFOUR_COLOR_OFF_OVERLAY, round_page(sc->sc_sunfb.sf_fbsize));
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
- cgeight_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- cgeight_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- cgeight_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- cgeight_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
printf(": cgeight/p4, %dx%d", sc->sc_sunfb.sf_width,
sc->sc_sunfb.sf_height);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &cgeight_stdscreen, -1,
- cgeight_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, cgeight_burner);
}
- waa.console = isconsole;
- waa.scrdata = &cgeight_screenlist;
- waa.accessops = &cgeight_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &cgeight_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/cgfour.c b/sys/arch/sparc/dev/cgfour.c
index fcad25130ac..e1e13cf87f9 100644
--- a/sys/arch/sparc/dev/cgfour.c
+++ b/sys/arch/sparc/dev/cgfour.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgfour.c,v 1.21 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: cgfour.c,v 1.22 2004/11/29 22:07:36 miod Exp $ */
/* $NetBSD: cgfour.c,v 1.13 1997/05/24 20:16:06 pk Exp $ */
/*
@@ -88,19 +88,6 @@ struct cgfour_softc {
int sc_nscreens;
};
-struct wsscreen_descr cgfour_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *cgfour_scrlist[] = {
- &cgfour_stdscreen,
-};
-
-struct wsscreen_list cgfour_screenlist = {
- sizeof(cgfour_scrlist) / sizeof(struct wsscreen_descr *),
- cgfour_scrlist
-};
-
int cgfour_ioctl(void *, u_long, caddr_t, int, struct proc *);
int cgfour_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -181,7 +168,6 @@ cgfourattach(parent, self, args)
{
struct cgfour_softc *sc = (struct cgfour_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node = 0, i;
volatile struct bt_regs *bt;
int isconsole = 0;
@@ -240,23 +226,13 @@ cgfourattach(parent, self, args)
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
fbwscons_setcolormap(&sc->sc_sunfb, cgfour_setcolor);
- cgfour_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- cgfour_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- cgfour_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- cgfour_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
printf(", %dx%d\n", sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &cgfour_stdscreen, -1,
- cgfour_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, cgfour_burner);
}
- waa.console = isconsole;
- waa.scrdata = &cgfour_screenlist;
- waa.accessops = &cgfour_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &cgfour_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c
index 56073f72045..705d905a92d 100644
--- a/sys/arch/sparc/dev/cgfourteen.c
+++ b/sys/arch/sparc/dev/cgfourteen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgfourteen.c,v 1.26 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: cgfourteen.c,v 1.27 2004/11/29 22:07:36 miod Exp $ */
/* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */
/*
@@ -137,19 +137,6 @@ struct cgfourteen_softc {
int sc_nscreens;
};
-struct wsscreen_descr cgfourteen_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *cgfourteen_scrlist[] = {
- &cgfourteen_stdscreen,
-};
-
-struct wsscreen_list cgfourteen_screenlist = {
- sizeof(cgfourteen_scrlist) / sizeof(struct wsscreen_descr *),
- cgfourteen_scrlist
-};
-
int cgfourteen_ioctl(void *, u_long, caddr_t, int, struct proc *);
int cgfourteen_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -234,7 +221,6 @@ cgfourteenattach(parent, self, args)
{
struct cgfourteen_softc *sc = (struct cgfourteen_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node, i;
u_int32_t *lut;
int isconsole = 0;
@@ -330,22 +316,12 @@ cgfourteenattach(parent, self, args)
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
fbwscons_setcolormap(&sc->sc_sunfb, cgfourteen_setcolor);
- cgfourteen_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- cgfourteen_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- cgfourteen_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- cgfourteen_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &cgfourteen_stdscreen,
- -1, cgfourteen_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, cgfourteen_burner);
shutdownhook_establish(cgfourteen_prom, sc);
}
- waa.console = isconsole;
- waa.scrdata = &cgfourteen_screenlist;
- waa.accessops = &cgfourteen_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &cgfourteen_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/cgsix.c b/sys/arch/sparc/dev/cgsix.c
index 1f32129a0c8..962799e3cb0 100644
--- a/sys/arch/sparc/dev/cgsix.c
+++ b/sys/arch/sparc/dev/cgsix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgsix.c,v 1.29 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: cgsix.c,v 1.30 2004/11/29 22:07:36 miod Exp $ */
/* $NetBSD: cgsix.c,v 1.33 1997/08/07 19:12:30 pk Exp $ */
/*
@@ -124,18 +124,6 @@ struct cgsix_softc {
int sc_nscreens;
};
-struct wsscreen_descr cgsix_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *cgsix_scrlist[] = {
- &cgsix_stdscreen,
-};
-
-struct wsscreen_list cgsix_screenlist = {
- sizeof(cgsix_scrlist) / sizeof(struct wsscreen_descr *), cgsix_scrlist
-};
-
int cgsix_ioctl(void *, u_long, caddr_t, int, struct proc *);
int cgsix_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -238,7 +226,6 @@ cgsixattach(parent, self, args)
{
struct cgsix_softc *sc = (struct cgsix_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node = 0, i;
volatile struct bt_regs *bt;
int isconsole = 0, sbus = 1;
@@ -368,16 +355,11 @@ cgsixattach(parent, self, args)
cgsix_ras_init(sc);
}
- cgsix_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- cgsix_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- cgsix_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- cgsix_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
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, &cgsix_stdscreen,
+ fbwscons_console_init(&sc->sc_sunfb,
sc->sc_sunfb.sf_width >= 1024 ? -1 : 0, cgsix_burner);
}
@@ -386,11 +368,7 @@ cgsixattach(parent, self, args)
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
#endif
- waa.console = isconsole;
- waa.scrdata = &cgsix_screenlist;
- waa.accessops = &cgsix_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &cgsix_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/cgthree.c b/sys/arch/sparc/dev/cgthree.c
index 6f077420d4c..b49e79cf254 100644
--- a/sys/arch/sparc/dev/cgthree.c
+++ b/sys/arch/sparc/dev/cgthree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgthree.c,v 1.25 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: cgthree.c,v 1.26 2004/11/29 22:07:36 miod Exp $ */
/* $NetBSD: cgthree.c,v 1.33 1997/05/24 20:16:11 pk Exp $ */
/*
@@ -116,19 +116,6 @@ struct cgthree_softc {
int sc_nscreens;
};
-struct wsscreen_descr cgthree_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *cgthree_scrlist[] = {
- &cgthree_stdscreen,
-};
-
-struct wsscreen_list cgthree_screenlist = {
- sizeof(cgthree_scrlist) / sizeof(struct wsscreen_descr *),
- cgthree_scrlist
-};
-
int cgthree_ioctl(void *, u_long, caddr_t, int, struct proc *);
int cgthree_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -220,7 +207,6 @@ cgthreeattach(parent, self, args)
{
struct cgthree_softc *sc = (struct cgthree_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node = 0, isrdi = 0, i;
volatile struct bt_regs *bt;
int isconsole = 0, sbus = 1;
@@ -323,13 +309,8 @@ cgthreeattach(parent, self, args)
(sc->sc_sunfb.sf_width >= 1024) ? 0 : RI_CLEAR);
fbwscons_setcolormap(&sc->sc_sunfb, cgthree_setcolor);
- cgthree_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- cgthree_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- cgthree_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- cgthree_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &cgthree_stdscreen,
+ fbwscons_console_init(&sc->sc_sunfb,
sc->sc_sunfb.sf_width >= 1024 ? -1 : 0, cgthree_burner);
}
@@ -338,11 +319,7 @@ cgthreeattach(parent, self, args)
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
#endif
- waa.console = isconsole;
- waa.scrdata = &cgthree_screenlist;
- waa.accessops = &cgthree_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &cgthree_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/cgtwelve.c b/sys/arch/sparc/dev/cgtwelve.c
index c5af1e984ed..fdb70c13124 100644
--- a/sys/arch/sparc/dev/cgtwelve.c
+++ b/sys/arch/sparc/dev/cgtwelve.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgtwelve.c,v 1.9 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: cgtwelve.c,v 1.10 2004/11/29 22:07:36 miod Exp $ */
/*
* Copyright (c) 2002, 2003 Miodrag Vallat. All rights reserved.
@@ -90,19 +90,6 @@ struct cgtwelve_softc {
int sc_nscreens;
};
-struct wsscreen_descr cgtwelve_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *cgtwelve_scrlist[] = {
- &cgtwelve_stdscreen,
-};
-
-struct wsscreen_list cgtwelve_screenlist = {
- sizeof(cgtwelve_scrlist) / sizeof(struct wsscreen_descr *),
- cgtwelve_scrlist
-};
-
int cgtwelve_ioctl(void *, u_long, caddr_t, int, struct proc *);
int cgtwelve_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -168,7 +155,6 @@ cgtwelveattach(parent, self, args)
{
struct cgtwelve_softc *sc = (struct cgtwelve_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node;
int isconsole = 0;
char *ps;
@@ -228,14 +214,8 @@ cgtwelveattach(parent, self, args)
sc->sc_sunfb.sf_ro.ri_hw = sc;
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
- cgtwelve_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- cgtwelve_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- cgtwelve_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- cgtwelve_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb,
- &cgtwelve_stdscreen, -1, NULL);
+ fbwscons_console_init(&sc->sc_sunfb, -1, NULL);
shutdownhook_establish(cgtwelve_prom, sc);
}
@@ -248,11 +228,7 @@ cgtwelveattach(parent, self, args)
printf(", microcode rev. %s", ps);
printf("\n");
- waa.console = isconsole;
- waa.scrdata = &cgtwelve_screenlist;
- waa.accessops = &cgtwelve_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &cgtwelve_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/cgtwo.c b/sys/arch/sparc/dev/cgtwo.c
index 2ea3dc1943c..5ad1e7c383e 100644
--- a/sys/arch/sparc/dev/cgtwo.c
+++ b/sys/arch/sparc/dev/cgtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgtwo.c,v 1.29 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: cgtwo.c,v 1.30 2004/11/29 22:07:36 miod Exp $ */
/* $NetBSD: cgtwo.c,v 1.22 1997/05/24 20:16:12 pk Exp $ */
/*
@@ -113,19 +113,6 @@ struct cgtwo_softc {
int sc_nscreens;
};
-struct wsscreen_descr cgtwo_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *cgtwo_scrlist[] = {
- &cgtwo_stdscreen,
-};
-
-struct wsscreen_list cgtwo_screenlist = {
- sizeof(cgtwo_scrlist) / sizeof(struct wsscreen_descr *),
- cgtwo_scrlist
-};
-
int cgtwo_ioctl(void *, u_long, caddr_t, int, struct proc *);
int cgtwo_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -198,7 +185,6 @@ cgtwoattach(parent, self, args)
{
struct cgtwo_softc *sc = (struct cgtwo_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node = 0;
int isconsole = 0;
char *nam = NULL;
@@ -255,23 +241,13 @@ cgtwoattach(parent, self, args)
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
fbwscons_setcolormap(&sc->sc_sunfb, cgtwo_setcolor);
- cgtwo_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- cgtwo_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- cgtwo_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- cgtwo_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
printf(", %dx%d\n", sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &cgtwo_stdscreen, -1,
- cgtwo_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, cgtwo_burner);
}
- waa.console = isconsole;
- waa.scrdata = &cgtwo_screenlist;
- waa.accessops = &cgtwo_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &cgtwo_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/fb.c b/sys/arch/sparc/dev/fb.c
index 243b1930f8f..bf110c2af7f 100644
--- a/sys/arch/sparc/dev/fb.c
+++ b/sys/arch/sparc/dev/fb.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: fb.c,v 1.28 2004/02/29 21:24:36 miod Exp $ */
+/* $OpenBSD: fb.c,v 1.29 2004/11/29 22:07:37 miod Exp $ */
/* $NetBSD: fb.c,v 1.23 1997/07/07 23:30:22 pk Exp $ */
/*
- * Copyright (c) 2002 Miodrag Vallat
+ * Copyright (c) 2002, 2004 Miodrag Vallat.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -90,6 +90,9 @@
#include "wsdisplay.h"
+static int a2int(char *, int);
+static void fb_initwsd(struct sunfb *);
+
/*
* emergency unblank code
* XXX should be somewhat moved to wscons MI code
@@ -281,9 +284,7 @@ obpsize:
sf->sf_fbsize = sf->sf_height * sf->sf_linebytes;
}
-int a2int(char *, int);
-
-int
+static int
a2int(char *cp, int deflt)
{
int i = 0;
@@ -295,6 +296,17 @@ a2int(char *cp, int deflt)
return (i);
}
+/* setup the embedded wsscreen_descr structure from rasops settings */
+static void
+fb_initwsd(struct sunfb *sf)
+{
+ strlcpy(sf->sf_wsd.name, "std", sizeof(sf->sf_wsd.name));
+ sf->sf_wsd.capabilities = sf->sf_ro.ri_caps;
+ sf->sf_wsd.nrows = sf->sf_ro.ri_rows;
+ sf->sf_wsd.ncols = sf->sf_ro.ri_cols;
+ sf->sf_wsd.textops = &sf->sf_ro.ri_ops;
+}
+
void
fbwscons_init(struct sunfb *sf, int flags)
{
@@ -336,7 +348,7 @@ fbwscons_init(struct sunfb *sf, int flags)
}
void
-fbwscons_console_init(struct sunfb *sf, struct wsscreen_descr *wsc, int row,
+fbwscons_console_init(struct sunfb *sf, int row,
void (*burner)(void *, u_int, u_int))
{
long defattr;
@@ -368,10 +380,10 @@ fbwscons_console_init(struct sunfb *sf, struct wsscreen_descr *wsc, int row,
* Scale back rows and columns if the font would not otherwise
* fit on this display. Without this we would panic later.
*/
- if (sf->sf_ro.ri_crow >= wsc->nrows)
- sf->sf_ro.ri_crow = wsc->nrows - 1;
- if (sf->sf_ro.ri_ccol >= wsc->ncols)
- sf->sf_ro.ri_ccol = wsc->ncols - 1;
+ if (sf->sf_ro.ri_crow >= sf->sf_ro.ri_rows)
+ sf->sf_ro.ri_crow = sf->sf_ro.ri_rows - 1;
+ if (sf->sf_ro.ri_ccol >= sf->sf_ro.ri_cols)
+ sf->sf_ro.ri_ccol = sf->sf_ro.ri_cols - 1;
/*
* Select appropriate color settings to mimic a
@@ -384,7 +396,7 @@ fbwscons_console_init(struct sunfb *sf, struct wsscreen_descr *wsc, int row,
wskernel_fg = 255;
}
- if (ISSET(wsc->capabilities, WSSCREEN_WSCOLORS) &&
+ if (ISSET(sf->sf_ro.ri_caps, WSSCREEN_WSCOLORS) &&
sf->sf_depth == 8) {
sf->sf_ro.ri_ops.alloc_attr(&sf->sf_ro,
WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, &defattr);
@@ -392,7 +404,8 @@ fbwscons_console_init(struct sunfb *sf, struct wsscreen_descr *wsc, int row,
sf->sf_ro.ri_ops.alloc_attr(&sf->sf_ro, 0, 0, 0, &defattr);
}
- wsdisplay_cnattach(wsc, &sf->sf_ro,
+ fb_initwsd(sf);
+ wsdisplay_cnattach(&sf->sf_wsd, &sf->sf_ro,
sf->sf_ro.ri_ccol, sf->sf_ro.ri_crow, defattr);
/* remember screen burner routine */
@@ -424,6 +437,29 @@ fbwscons_setcolormap(struct sunfb *sf,
}
}
+void
+fbwscons_attach(struct sunfb *sf, struct wsdisplay_accessops *op, int isconsole)
+{
+ struct wsemuldisplaydev_attach_args waa;
+ struct wsscreen_descr *scrlist[1];
+ struct wsscreen_list screenlist;
+
+ if (isconsole == 0) {
+ /* done in wsdisplay_cnattach() earlier if console */
+ fb_initwsd(sf);
+ }
+
+ scrlist[0] = &sf->sf_wsd;
+ screenlist.nscreens = 1;
+ screenlist.screens = (const struct wsscreen_descr **)scrlist;
+
+ waa.console = isconsole;
+ waa.scrdata = &screenlist;
+ waa.accessops = op;
+ waa.accesscookie = sf;
+ config_found(&sf->sf_dev, &waa, wsemuldisplaydevprint);
+}
+
#if defined(SUN4)
/*
* Support routines for pfour framebuffers.
diff --git a/sys/arch/sparc/dev/mgx.c b/sys/arch/sparc/dev/mgx.c
index c76ac76d465..04b78bd303f 100644
--- a/sys/arch/sparc/dev/mgx.c
+++ b/sys/arch/sparc/dev/mgx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mgx.c,v 1.5 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: mgx.c,v 1.6 2004/11/29 22:07:37 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -89,19 +89,6 @@ struct mgx_softc {
int sc_nscreens;
};
-struct wsscreen_descr mgx_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *mgx_scrlist[] = {
- &mgx_stdscreen,
-};
-
-struct wsscreen_list mgx_screenlist = {
- sizeof(mgx_scrlist) / sizeof(struct wsscreen_descr *),
- mgx_scrlist
-};
-
int mgx_ioctl(void *, u_long, caddr_t, int, struct proc *);
int mgx_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -164,7 +151,6 @@ mgxattach(struct device *parent, struct device *self, void *args)
{
struct mgx_softc *sc = (struct mgx_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node, fbsize;
int isconsole;
@@ -209,26 +195,16 @@ mgxattach(struct device *parent, struct device *self, void *args)
bzero(sc->sc_cmap, sizeof(sc->sc_cmap));
fbwscons_setcolormap(&sc->sc_sunfb, mgx_setcolor);
- mgx_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- mgx_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- mgx_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- mgx_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
printf(", %dx%d\n",
sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb,
- &mgx_stdscreen, -1, mgx_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, mgx_burner);
}
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
- waa.console = isconsole;
- waa.scrdata = &mgx_screenlist;
- waa.accessops = &mgx_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ 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 9aecf26c0db..a61fe87e483 100644
--- a/sys/arch/sparc/dev/p9000.c
+++ b/sys/arch/sparc/dev/p9000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p9000.c,v 1.9 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: p9000.c,v 1.10 2004/11/29 22:07:37 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -80,19 +80,6 @@ struct p9000_softc {
u_int32_t sc_junk; /* throwaway value */
};
-struct wsscreen_descr p9000_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *p9000_scrlist[] = {
- &p9000_stdscreen,
-};
-
-struct wsscreen_list p9000_screenlist = {
- sizeof(p9000_scrlist) / sizeof(struct wsscreen_descr *),
- p9000_scrlist
-};
-
int p9000_ioctl(void *, u_long, caddr_t, int, struct proc *);
int p9000_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -204,7 +191,6 @@ p9000attach(struct device *parent, struct device *self, void *args)
{
struct p9000_softc *sc = (struct p9000_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node, row, isconsole, scr;
struct device *btdev;
extern struct cfdriver btcham_cd;
@@ -284,11 +270,6 @@ p9000attach(struct device *parent, struct device *self, void *args)
*/
p9000_ras_init(sc);
- p9000_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- p9000_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- p9000_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- p9000_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
/* enable video */
@@ -300,15 +281,10 @@ p9000attach(struct device *parent, struct device *self, void *args)
else
row = -1;
- fbwscons_console_init(&sc->sc_sunfb, &p9000_stdscreen, row,
- p9000_burner);
+ fbwscons_console_init(&sc->sc_sunfb, row, p9000_burner);
}
- waa.console = isconsole;
- waa.scrdata = &p9000_screenlist;
- waa.accessops = &p9000_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &p9000_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/p9100.c b/sys/arch/sparc/dev/p9100.c
index 43119858420..1f58ccf3baf 100644
--- a/sys/arch/sparc/dev/p9100.c
+++ b/sys/arch/sparc/dev/p9100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p9100.c,v 1.30 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: p9100.c,v 1.31 2004/11/29 22:07:37 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -80,19 +80,6 @@ struct p9100_softc {
u_int32_t sc_junk; /* throwaway value */
};
-struct wsscreen_descr p9100_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *p9100_scrlist[] = {
- &p9100_stdscreen,
-};
-
-struct wsscreen_list p9100_screenlist = {
- sizeof(p9100_scrlist) / sizeof(struct wsscreen_descr *),
- p9100_scrlist
-};
-
int p9100_ioctl(void *, u_long, caddr_t, int, struct proc *);
int p9100_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -245,7 +232,6 @@ p9100attach(struct device *parent, struct device *self, void *args)
{
struct p9100_softc *sc = (struct p9100_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node, row, scr;
int isconsole, fb_depth;
@@ -327,11 +313,6 @@ p9100attach(struct device *parent, struct device *self, void *args)
if (sc->sc_sunfb.sf_depth == 8)
p9100_ras_init(sc);
- p9100_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- p9100_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- p9100_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- p9100_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
/* enable video */
@@ -343,15 +324,10 @@ p9100attach(struct device *parent, struct device *self, void *args)
else
row = -1;
- fbwscons_console_init(&sc->sc_sunfb, &p9100_stdscreen, row,
- p9100_burner);
+ fbwscons_console_init(&sc->sc_sunfb, row, p9100_burner);
}
- waa.console = isconsole;
- waa.scrdata = &p9100_screenlist;
- waa.accessops = &p9100_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &p9100_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/rfx.c b/sys/arch/sparc/dev/rfx.c
index f8baca6bf71..36cc92ea6e1 100644
--- a/sys/arch/sparc/dev/rfx.c
+++ b/sys/arch/sparc/dev/rfx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfx.c,v 1.5 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: rfx.c,v 1.6 2004/11/29 22:07:37 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
@@ -118,19 +118,6 @@ struct rfx_softc {
int sc_nscreens;
};
-struct wsscreen_descr rfx_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *rfx_scrlist[] = {
- &rfx_stdscreen,
-};
-
-struct wsscreen_list rfx_screenlist = {
- sizeof(rfx_scrlist) / sizeof(struct wsscreen_descr *),
- rfx_scrlist
-};
-
int rfx_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
void rfx_burner(void *, u_int, u_int);
@@ -216,7 +203,6 @@ rfxattach(struct device *parent, struct device *self, void *args)
struct confargs *ca = args;
const char *device = ca->ca_ra.ra_name;
struct rfx_config cf;
- struct wsemuldisplaydev_attach_args waa;
int node, cflen, isconsole = 0;
/* skip vendor name (could be CWARE, VITec, ...) */
@@ -302,14 +288,8 @@ rfxattach(struct device *parent, struct device *self, void *args)
bzero(&sc->sc_cmap, sizeof(sc->sc_cmap));
fbwscons_setcolormap(&sc->sc_sunfb, rfx_setcolor);
- rfx_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- rfx_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- rfx_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- rfx_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &rfx_stdscreen, -1,
- rfx_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, rfx_burner);
}
/* enable video */
@@ -317,11 +297,7 @@ rfxattach(struct device *parent, struct device *self, void *args)
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
- waa.console = isconsole;
- waa.scrdata = &rfx_screenlist;
- waa.accessops = &rfx_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &rfx_accessops, isconsole);
}
/*
diff --git a/sys/arch/sparc/dev/tcx.c b/sys/arch/sparc/dev/tcx.c
index d4ab0ccc8e7..e7c004e3524 100644
--- a/sys/arch/sparc/dev/tcx.c
+++ b/sys/arch/sparc/dev/tcx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcx.c,v 1.20 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: tcx.c,v 1.21 2004/11/29 22:07:37 miod Exp $ */
/* $NetBSD: tcx.c,v 1.8 1997/07/29 09:58:14 fair Exp $ */
/*
@@ -110,18 +110,6 @@ struct tcx_softc {
int sc_nscreens;
};
-struct wsscreen_descr tcx_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *tcx_scrlist[] = {
- &tcx_stdscreen,
-};
-
-struct wsscreen_list tcx_screenlist = {
- sizeof(tcx_scrlist) / sizeof(struct wsscreen_descr *), tcx_scrlist
-};
-
int tcx_ioctl(void *, u_long, caddr_t, int, struct proc *);
int tcx_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -204,7 +192,6 @@ tcxattach(parent, self, args)
{
struct tcx_softc *sc = (struct tcx_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node = 0, i;
volatile struct bt_regs *bt;
int isconsole = 0;
@@ -266,19 +253,13 @@ tcxattach(parent, self, args)
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
fbwscons_setcolormap(&sc->sc_sunfb, tcx_setcolor);
- tcx_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- tcx_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- tcx_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- tcx_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
sc->sc_ih.ih_fun = tcx_intr;
sc->sc_ih.ih_arg = sc;
intr_establish(ca->ca_ra.ra_intr[0].int_pri, &sc->sc_ih, IPL_FB,
self->dv_xname);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb, &tcx_stdscreen, -1,
- tcx_burner);
+ fbwscons_console_init(&sc->sc_sunfb, -1, tcx_burner);
shutdownhook_establish(tcx_prom, sc);
}
@@ -291,11 +272,7 @@ tcxattach(parent, self, args)
(sc->sc_thc->thc_config & THC_CFG_SENSE) >> THC_CFG_SENSE_SHIFT
);
- waa.console = isconsole;
- waa.scrdata = &tcx_screenlist;
- waa.accessops = &tcx_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &tcx_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/tvtwo.c b/sys/arch/sparc/dev/tvtwo.c
index ef140851476..dd285920315 100644
--- a/sys/arch/sparc/dev/tvtwo.c
+++ b/sys/arch/sparc/dev/tvtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tvtwo.c,v 1.3 2003/06/28 17:05:33 miod Exp $ */
+/* $OpenBSD: tvtwo.c,v 1.4 2004/11/29 22:07:37 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -122,19 +122,6 @@ struct tvtwo_softc {
int sc_nscreens;
};
-struct wsscreen_descr tvtwo_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *tvtwo_scrlist[] = {
- &tvtwo_stdscreen,
-};
-
-struct wsscreen_list tvtwo_screenlist = {
- sizeof(tvtwo_scrlist) / sizeof(struct wsscreen_descr *),
- tvtwo_scrlist
-};
-
int tvtwo_ioctl(void *, u_long, caddr_t, int, struct proc *);
int tvtwo_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -200,7 +187,6 @@ tvtwoattach(struct device *parent, struct device *self, void *args)
{
struct tvtwo_softc *sc = (struct tvtwo_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node, width, height, freqcode;
int isconsole;
char *freqstring;
@@ -248,26 +234,16 @@ tvtwoattach(struct device *parent, struct device *self, void *args)
sc->sc_sunfb.sf_ro.ri_hw = sc;
fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
- tvtwo_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- tvtwo_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- tvtwo_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- tvtwo_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
printf("%s: %dx%d\n", self->dv_xname,
sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height);
if (isconsole) {
- fbwscons_console_init(&sc->sc_sunfb,
- &tvtwo_stdscreen, -1, NULL);
+ fbwscons_console_init(&sc->sc_sunfb, -1, NULL);
}
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
- waa.console = isconsole;
- waa.scrdata = &tvtwo_screenlist;
- waa.accessops = &tvtwo_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &tvtwo_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/vigra.c b/sys/arch/sparc/dev/vigra.c
index c346c6aac98..45cf21aad94 100644
--- a/sys/arch/sparc/dev/vigra.c
+++ b/sys/arch/sparc/dev/vigra.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vigra.c,v 1.10 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: vigra.c,v 1.11 2004/11/29 22:07:37 miod Exp $ */
/*
* Copyright (c) 2002, 2003, Miodrag Vallat.
@@ -184,19 +184,6 @@ struct vigra_softc {
int sc_nscreens;
};
-struct wsscreen_descr vigra_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *vigra_scrlist[] = {
- &vigra_stdscreen,
-};
-
-struct wsscreen_list vigra_screenlist = {
- sizeof(vigra_scrlist) / sizeof(struct wsscreen_descr *),
- vigra_scrlist
-};
-
int vigra_ioctl(void *, u_long, caddr_t, int, struct proc *);
int vigra_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -261,7 +248,6 @@ vigraattach(struct device *parent, struct device *self, void *args)
{
struct vigra_softc *sc = (struct vigra_softc *)self;
struct confargs *ca = args;
- struct wsemuldisplaydev_attach_args waa;
int node, row, isconsole = 0;
char *nam;
@@ -325,15 +311,10 @@ vigraattach(struct device *parent, struct device *self, void *args)
&& sc->sc_sunfb.sf_width != 1280) ? 0 : RI_CLEAR);
fbwscons_setcolormap(&sc->sc_sunfb, vigra_setcolor);
- vigra_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps;
- vigra_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows;
- vigra_stdscreen.ncols = sc->sc_sunfb.sf_ro.ri_cols;
- vigra_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops;
-
if (isconsole) {
switch (sc->sc_sunfb.sf_width) {
case 640:
- row = vigra_stdscreen.nrows - 1;
+ row = sc->sc_sunfb.sf_ro.ri_rows - 1;
break;
case 800:
case 1280:
@@ -344,17 +325,12 @@ vigraattach(struct device *parent, struct device *self, void *args)
break;
}
- fbwscons_console_init(&sc->sc_sunfb, &vigra_stdscreen, row,
- vigra_burner);
+ fbwscons_console_init(&sc->sc_sunfb, row, vigra_burner);
}
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
- waa.console = isconsole;
- waa.scrdata = &vigra_screenlist;
- waa.accessops = &vigra_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &vigra_accessops, isconsole);
}
int
diff --git a/sys/arch/sparc/dev/zx.c b/sys/arch/sparc/dev/zx.c
index 362f34a502d..8f5a3e3c5ab 100644
--- a/sys/arch/sparc/dev/zx.c
+++ b/sys/arch/sparc/dev/zx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zx.c,v 1.7 2004/07/26 13:26:38 miod Exp $ */
+/* $OpenBSD: zx.c,v 1.8 2004/11/29 22:07:37 miod Exp $ */
/* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */
/*
@@ -126,19 +126,6 @@ struct zx_softc {
int sc_nscreens;
};
-struct wsscreen_descr zx_stdscreen = {
- "std"
-};
-
-const struct wsscreen_descr *zx_scrlist[] = {
- &zx_stdscreen
-};
-
-struct wsscreen_list zx_screenlist = {
- sizeof(zx_scrlist) / sizeof(struct wsscreen_descr *),
- zx_scrlist
-};
-
int zx_ioctl(void *, u_long, caddr_t, int, struct proc *);
int zx_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
@@ -216,7 +203,6 @@ zx_attach(struct device *parent, struct device *self, void *args)
struct zx_softc *sc = (struct zx_softc *)self;
struct confargs *ca = args;
struct rasops_info *ri;
- struct wsemuldisplaydev_attach_args waa;
int node, isconsole = 0;
const char *nam;
@@ -290,15 +276,9 @@ zx_attach(struct device *parent, struct device *self, void *args)
ri->ri_ops.putchar = zx_putchar;
ri->ri_do_cursor = zx_do_cursor;
- zx_stdscreen.capabilities = ri->ri_caps;
- zx_stdscreen.nrows = ri->ri_rows;
- zx_stdscreen.ncols = ri->ri_cols;
- zx_stdscreen.textops = &ri->ri_ops;
-
if (isconsole) {
/* zx_reset() below will clear screen, so restart at 1st row */
- fbwscons_console_init(&sc->sc_sunfb, &zx_stdscreen, 0,
- zx_burner);
+ fbwscons_console_init(&sc->sc_sunfb, 0, zx_burner);
}
/* reset cursor & frame buffer controls */
@@ -309,11 +289,7 @@ zx_attach(struct device *parent, struct device *self, void *args)
sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev);
- waa.console = isconsole;
- waa.scrdata = &zx_screenlist;
- waa.accessops = &zx_accessops;
- waa.accesscookie = sc;
- config_found(self, &waa, wsemuldisplaydevprint);
+ fbwscons_attach(&sc->sc_sunfb, &zx_accessops, isconsole);
}
int