summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-01-08 20:35:22 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-01-08 20:35:22 +0000
commite36b0788688a5dd823dc99c40167de645deb9988 (patch)
treeb76483ceaf19b14b4d45bd4174333476cff56dc3 /sys/arch/mac68k
parent6bb26d48dbe7011c0629a2b80c35e931807ff3d3 (diff)
Remove unused grf_softc members; do not keep temporary data in grf_softc
either, instead keep it on the stack or directly in attachment structures. No functional change.
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r--sys/arch/mac68k/dev/grf_iv.c25
-rw-r--r--sys/arch/mac68k/dev/grf_mv.c33
-rw-r--r--sys/arch/mac68k/dev/grf_subr.c8
-rw-r--r--sys/arch/mac68k/dev/grfvar.h12
-rw-r--r--sys/arch/mac68k/dev/macfb.c6
5 files changed, 33 insertions, 51 deletions
diff --git a/sys/arch/mac68k/dev/grf_iv.c b/sys/arch/mac68k/dev/grf_iv.c
index 58220e594e2..5831644d764 100644
--- a/sys/arch/mac68k/dev/grf_iv.c
+++ b/sys/arch/mac68k/dev/grf_iv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_iv.c,v 1.32 2006/01/04 20:39:04 miod Exp $ */
+/* $OpenBSD: grf_iv.c,v 1.33 2006/01/08 20:35:21 miod Exp $ */
/* $NetBSD: grf_iv.c,v 1.17 1997/02/20 00:23:27 scottr Exp $ */
/*
@@ -210,7 +210,7 @@ grfiv_attach(parent, self, aux)
{
struct obio_attach_args *oa = (struct obio_attach_args *) aux;
struct grfbus_softc *sc;
- struct grfmode *gm;
+ struct grfmode gm;
u_long base, length;
u_int32_t vbase1, vbase2;
@@ -348,19 +348,14 @@ grfiv_attach(parent, self, aux)
mac68k_vidphys < (sc->sc_basepa + length))
videoaddr = sc->sc_handle.base + sc->sc_fbofs; /* XXX big ol' hack */
- gm = &(sc->curr_mode);
- gm->mode_id = 0;
- gm->psize = videobitdepth;
- gm->ptype = 0;
- gm->width = videosize & 0xffff;
- gm->height = (videosize >> 16) & 0xffff;
- gm->rowbytes = videorowbytes;
- gm->hres = 80; /* XXX Hack */
- gm->vres = 80; /* XXX Hack */
- gm->fbsize = gm->height * gm->rowbytes;
- gm->fbbase = (caddr_t)sc->sc_handle.base; /* XXX yet another hack */
- gm->fboff = sc->sc_fbofs;
+ gm.psize = videobitdepth;
+ gm.width = videosize & 0xffff;
+ gm.height = (videosize >> 16) & 0xffff;
+ gm.rowbytes = videorowbytes;
+ gm.fbsize = gm.height * gm.rowbytes;
+ gm.fbbase = (caddr_t)sc->sc_handle.base; /* XXX yet another hack */
+ gm.fboff = sc->sc_fbofs;
/* Perform common video attachment. */
- grf_establish(sc);
+ grf_establish(sc, &gm);
}
diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c
index b42a5ef83af..60538127af1 100644
--- a/sys/arch/mac68k/dev/grf_mv.c
+++ b/sys/arch/mac68k/dev/grf_mv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_mv.c,v 1.27 2006/01/04 20:39:05 miod Exp $ */
+/* $OpenBSD: grf_mv.c,v 1.28 2006/01/08 20:35:21 miod Exp $ */
/* $NetBSD: grf_nubus.c,v 1.62 2001/01/22 20:27:02 briggs Exp $ */
/*
@@ -137,10 +137,10 @@ grfmv_attach(parent, self, aux)
struct grfbus_softc *sc = (struct grfbus_softc *)self;
struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
struct image_data image_store, image;
- struct grfmode *gm;
+ struct grfmode gm;
char cardname[CARD_NAME_LEN];
nubus_dirent dirent;
- nubus_dir dir, mode_dir;
+ nubus_dir dir, mode_dir, board_dir;
int mode;
bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
@@ -165,10 +165,10 @@ bad:
return;
}
- nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
+ nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &board_dir);
if (nubus_find_rsrc(sc->sc_tag, sc->sc_regh,
- &sc->sc_slot, &sc->board_dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
+ &sc->sc_slot, &board_dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
if ((na->rsrcid != 128) ||
(nubus_find_rsrc(sc->sc_tag, sc->sc_regh,
&sc->sc_slot, &dir, 129, &dirent) <= 0))
@@ -176,7 +176,7 @@ bad:
mode = NUBUS_RSRC_FIRSTMODE;
if (nubus_find_rsrc(sc->sc_tag, sc->sc_regh,
- &sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) {
+ &sc->sc_slot, &board_dir, mode, &dirent) <= 0) {
printf(": probe failed to get board rsrc.\n");
goto bad;
}
@@ -199,18 +199,13 @@ bad:
load_image_data((caddr_t)&image_store, &image);
- gm = &sc->curr_mode;
- gm->mode_id = mode;
- gm->ptype = image.pixelType;
- gm->psize = image.pixelSize;
- gm->width = image.right - image.left;
- gm->height = image.bottom - image.top;
- gm->rowbytes = image.rowbytes;
- gm->hres = image.hRes;
- gm->vres = image.vRes;
- gm->fbsize = gm->height * gm->rowbytes;
- gm->fbbase = (caddr_t)(sc->sc_handle.base); /* XXX evil hack */
- gm->fboff = image.offset;
+ gm.psize = image.pixelSize;
+ gm.width = image.right - image.left;
+ gm.height = image.bottom - image.top;
+ gm.rowbytes = image.rowbytes;
+ gm.fbsize = gm.height * gm.rowbytes;
+ gm.fbbase = (caddr_t)(sc->sc_handle.base); /* XXX evil hack */
+ gm.fboff = image.offset;
strncpy(cardname, nubus_get_card_name(sc->sc_tag, sc->sc_regh,
&sc->sc_slot), CARD_NAME_LEN);
@@ -373,7 +368,7 @@ bad:
}
/* Perform common video attachment. */
- grf_establish(sc);
+ grf_establish(sc, &gm);
}
/* Interrupt handlers... */
diff --git a/sys/arch/mac68k/dev/grf_subr.c b/sys/arch/mac68k/dev/grf_subr.c
index ac35af1678e..f7cd849ed75 100644
--- a/sys/arch/mac68k/dev/grf_subr.c
+++ b/sys/arch/mac68k/dev/grf_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_subr.c,v 1.8 2006/01/04 20:39:05 miod Exp $ */
+/* $OpenBSD: grf_subr.c,v 1.9 2006/01/08 20:35:21 miod Exp $ */
/* $NetBSD: grf_subr.c,v 1.6 1997/02/20 00:23:28 scottr Exp $ */
/*-
@@ -47,10 +47,8 @@
#include <mac68k/dev/grfvar.h>
void
-grf_establish(sc)
- struct grfbus_softc *sc;
+grf_establish(struct grfbus_softc *sc, struct grfmode *gm)
{
- struct grfmode *gm = &sc->curr_mode;
struct grfbus_attach_args ga;
/* Print hardware characteristics. */
@@ -62,7 +60,7 @@ grf_establish(sc)
/* Attach grf semantics to the hardware. */
ga.ga_name = "grf";
- ga.ga_grfmode = gm;
+ bcopy(gm, &ga.ga_grfmode, sizeof(*gm));
ga.ga_phys = sc->sc_basepa;
(void)config_found(&sc->sc_dev, &ga, grfbusprint);
}
diff --git a/sys/arch/mac68k/dev/grfvar.h b/sys/arch/mac68k/dev/grfvar.h
index 0b6f2309891..e817914d859 100644
--- a/sys/arch/mac68k/dev/grfvar.h
+++ b/sys/arch/mac68k/dev/grfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: grfvar.h,v 1.18 2006/01/05 20:30:18 miod Exp $ */
+/* $OpenBSD: grfvar.h,v 1.19 2006/01/08 20:35:21 miod Exp $ */
/* $NetBSD: grfvar.h,v 1.11 1996/08/04 06:03:58 scottr Exp $ */
/* $NetBSD: grfioctl.h,v 1.5 1995/07/02 05:26:45 briggs Exp $ */
@@ -41,16 +41,12 @@
*/
struct grfmode {
- u_int8_t mode_id; /* Identifier for mode */
caddr_t fbbase; /* Base of page of frame buffer */
u_int32_t fbsize; /* Size of frame buffer */
u_int16_t fboff; /* Offset of frame buffer from base */
u_int16_t rowbytes; /* Screen rowbytes */
u_int16_t width; /* Screen width */
u_int16_t height; /* Screen height */
- u_int16_t hres; /* Horizontal resolution (dpi) */
- u_int16_t vres; /* Vertical resolution (dpi) */
- u_int16_t ptype; /* 0 = indexed, 0x10 = direct */
u_int16_t psize; /* Screen depth */
};
@@ -70,12 +66,10 @@ struct grfbus_softc {
bus_space_handle_t sc_handle;
bus_space_handle_t sc_regh;
- struct grfmode curr_mode; /* hardware desc(for ioctl) */
u_int32_t card_id; /* DrHW value for nubus cards */
bus_size_t cli_offset; /* Offset of byte to clear intr */
/* for cards where that's suff. */
u_int32_t cli_value; /* Value to write at cli_offset */
- nubus_dir board_dir; /* Nubus dir for curr board */
};
/*
@@ -83,7 +77,7 @@ struct grfbus_softc {
*/
struct grfbus_attach_args {
char *ga_name; /* name of semantics to attach */
- struct grfmode *ga_grfmode;
+ struct grfmode ga_grfmode;
bus_addr_t ga_phys;
};
@@ -117,5 +111,5 @@ struct image_data {
#define VID_PAGE_CNT 3
#define VID_DEV_TYPE 4
-void grf_establish(struct grfbus_softc *);
+void grf_establish(struct grfbus_softc *, struct grfmode *);
int grfbusprint(void *, const char *);
diff --git a/sys/arch/mac68k/dev/macfb.c b/sys/arch/mac68k/dev/macfb.c
index 1eeb4da5a22..4624cfe9762 100644
--- a/sys/arch/mac68k/dev/macfb.c
+++ b/sys/arch/mac68k/dev/macfb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macfb.c,v 1.4 2006/01/08 17:19:46 miod Exp $ */
+/* $OpenBSD: macfb.c,v 1.5 2006/01/08 20:35:21 miod Exp $ */
/* $NetBSD: macfb.c,v 1.11 2005/01/15 16:00:59 chs Exp $ */
/*
* Copyright (c) 1998 Matt DeBergalis
@@ -220,7 +220,7 @@ void
macfb_attach(struct device *parent, struct device *self, void *aux)
{
struct grfbus_attach_args *ga = aux;
- struct grfmode *gm = ga->ga_grfmode;
+ struct grfmode *gm = &ga->ga_grfmode;
struct macfb_softc *sc;
struct wsemuldisplaydev_attach_args waa;
struct wsscreen_descr *scrlist[1];
@@ -234,7 +234,7 @@ macfb_attach(struct device *parent, struct device *self, void *aux)
#endif
printf("\n");
- isconsole = macfb_is_console(ga->ga_phys + ga->ga_grfmode->fboff);
+ isconsole = macfb_is_console(ga->ga_phys + gm->fboff);
if (isconsole) {
sc->sc_dc = &macfb_console_dc;