summaryrefslogtreecommitdiff
path: root/sys/dev/tc
diff options
context:
space:
mode:
authornisimura <nisimura@NetBSD.org>1999-05-07 08:00:30 +0000
committernisimura <nisimura@NetBSD.org>1999-05-07 08:00:30 +0000
commit1d082ddc15291c607dc4e4ee4da22cfdc51ae528 (patch)
treeafc14fb2efddf1d8de2d5f1b62ced29cafa16111 /sys/dev/tc
parent4ce0e8e16f5fd1bc2b9efa10e807e116371b83ba (diff)
- Sweep abit preparing for code merge to have common 'vdacops' across
various graphics cards.
Diffstat (limited to 'sys/dev/tc')
-rw-r--r--sys/dev/tc/cfb.c38
-rw-r--r--sys/dev/tc/mfb.c22
-rw-r--r--sys/dev/tc/sfb.c37
-rw-r--r--sys/dev/tc/tfb.c38
-rw-r--r--sys/dev/tc/xcfb.c21
5 files changed, 85 insertions, 71 deletions
diff --git a/sys/dev/tc/cfb.c b/sys/dev/tc/cfb.c
index 82c1469d7a8..07c627e4bb1 100644
--- a/sys/dev/tc/cfb.c
+++ b/sys/dev/tc/cfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cfb.c,v 1.10 1999/03/29 07:22:02 nisimura Exp $ */
+/* $NetBSD: cfb.c,v 1.11 1999/05/07 08:00:30 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.10 1999/03/29 07:22:02 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.11 1999/05/07 08:00:30 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -108,17 +108,18 @@ struct fb_devconfig {
int dc_blanked; /* currently has video disabled */
};
-struct hwcmap {
+struct hwcmap256 {
#define CMAP_SIZE 256 /* 256 R/G/B entries */
u_int8_t r[CMAP_SIZE];
u_int8_t g[CMAP_SIZE];
u_int8_t b[CMAP_SIZE];
};
-struct hwcursor {
+struct hwcursor64 {
struct wsdisplay_curpos cc_pos;
struct wsdisplay_curpos cc_hot;
struct wsdisplay_curpos cc_size;
+ struct wsdisplay_curpos cc_magic;
#define CURSOR_MAX_SIZE 64
u_int8_t cc_color[6];
u_int64_t cc_image[64 + 64];
@@ -127,8 +128,8 @@ struct hwcursor {
struct cfb_softc {
struct device sc_dev;
struct fb_devconfig *sc_dc; /* device configuration */
- struct hwcmap sc_cmap; /* software copy of colormap */
- struct hwcursor sc_cursor; /* software copy of cursor */
+ struct hwcmap256 sc_cmap; /* software copy of colormap */
+ struct hwcursor64 sc_cursor; /* software copy of cursor */
int sc_curenb; /* cursor sprite enabled */
int sc_changed; /* need update of colormap */
#define DATA_ENB_CHANGED 0x01 /* cursor enable changed */
@@ -137,10 +138,10 @@ struct cfb_softc {
#define DATA_CMAP_CHANGED 0x08 /* colormap changed */
#define DATA_ALL_CHANGED 0x0f
int nscreens;
- short magic_x, magic_y; /* CX cursor location offset */
+};
+
#define CX_MAGIC_X 220
#define CX_MAGIC_Y 35
-};
#define CX_FB_OFFSET 0x000000
#define CX_FB_SIZE 0x100000
@@ -330,8 +331,8 @@ cfbattach(parent, self, aux)
struct cfb_softc *sc = (struct cfb_softc *)self;
struct tc_attach_args *ta = aux;
struct wsemuldisplaydev_attach_args waa;
- struct hwcmap *cm;
- int console, i;
+ struct hwcmap256 *cm;
+ int console;
console = (ta->ta_addr == cfb_consaddr);
if (console) {
@@ -347,12 +348,11 @@ cfbattach(parent, self, aux)
sc->sc_dc->dc_depth);
cm = &sc->sc_cmap;
- cm->r[0] = cm->g[0] = cm->b[0] = 0;
- for (i = 1; i < CMAP_SIZE; i++) {
- cm->r[i] = cm->g[i] = cm->b[i] = 0xff;
- }
- sc->magic_x = CX_MAGIC_X;
- sc->magic_y = CX_MAGIC_Y;
+ memset(cm, 255, sizeof(struct hwcmap256)); /* XXX */
+ cm->r[0] = cm->g[0] = cm->b[0] = 0; /* XXX */
+
+ sc->sc_cursor.cc_magic.x = CX_MAGIC_X;
+ sc->sc_cursor.cc_magic.y = CX_MAGIC_Y;
/* Establish an interrupt handler, and clear any pending interrupts */
tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, cfbintr, sc);
@@ -576,7 +576,7 @@ cfbintr(arg)
}
}
if (v & DATA_CMAP_CHANGED) {
- struct hwcmap *cm = &sc->sc_cmap;
+ struct hwcmap256 *cm = &sc->sc_cmap;
int index;
BT459_SELECT(vdac, 0);
@@ -802,7 +802,9 @@ bt459_set_curpos(sc)
x = sc->sc_cursor.cc_pos.x - sc->sc_cursor.cc_hot.x;
y = sc->sc_cursor.cc_pos.y - sc->sc_cursor.cc_hot.y;
- x += sc->magic_x; y += sc->magic_y; /* magic offset of CX coordinate */
+
+ x += sc->sc_cursor.cc_magic.x;
+ y += sc->sc_cursor.cc_magic.y;
s = spltty();
diff --git a/sys/dev/tc/mfb.c b/sys/dev/tc/mfb.c
index 97bd293928d..60b6ba72874 100644
--- a/sys/dev/tc/mfb.c
+++ b/sys/dev/tc/mfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mfb.c,v 1.10 1999/03/29 07:22:02 nisimura Exp $ */
+/* $NetBSD: mfb.c,v 1.11 1999/05/07 08:00:31 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.10 1999/03/29 07:22:02 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.11 1999/05/07 08:00:31 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -132,10 +132,11 @@ struct fb_devconfig {
int dc_blanked; /* currently has video disabled */
};
-struct hwcursor {
+struct hwcursor64 {
struct wsdisplay_curpos cc_pos;
struct wsdisplay_curpos cc_hot;
struct wsdisplay_curpos cc_size;
+ struct wsdisplay_curpos cc_magic;
#define CURSOR_MAX_SIZE 64
u_int8_t cc_color[6];
u_int64_t cc_image[64 + 64];
@@ -144,7 +145,7 @@ struct hwcursor {
struct mfb_softc {
struct device sc_dev;
struct fb_devconfig *sc_dc; /* device configuration */
- struct hwcursor sc_cursor; /* software copy of cursor */
+ struct hwcursor64 sc_cursor; /* software copy of cursor */
int sc_curenb; /* cursor sprite enabled */
int sc_changed; /* need update of colormap */
#define DATA_ENB_CHANGED 0x01 /* cursor enable changed */
@@ -153,10 +154,10 @@ struct mfb_softc {
#define DATA_CMAP_CHANGED 0x08 /* colormap changed */
#define DATA_ALL_CHANGED 0x0f
int nscreens;
- short magic_x, magic_y; /* MX cursor location offset */
+};
+
#define MX_MAGIC_X 360
#define MX_MAGIC_Y 36
-};
#define MX_FB_OFFSET 0x200000
#define MX_FB_SIZE 0x40000
@@ -365,8 +366,9 @@ mfbattach(parent, self, aux)
}
printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
sc->sc_dc->dc_depth);
- sc->magic_x = MX_MAGIC_X;
- sc->magic_y = MX_MAGIC_Y;
+
+ sc->sc_cursor.cc_magic.x = MX_MAGIC_X;
+ sc->sc_cursor.cc_magic.y = MX_MAGIC_Y;
tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, mfbintr, sc);
@@ -711,7 +713,9 @@ bt431_set_curpos(sc)
x = sc->sc_cursor.cc_pos.x - sc->sc_cursor.cc_hot.x;
y = sc->sc_cursor.cc_pos.y - sc->sc_cursor.cc_hot.y;
- x += sc->magic_x; y += sc->magic_y; /* magic offset of MX coordinate */
+
+ x += sc->sc_cursor.cc_magic.x;
+ y += sc->sc_cursor.cc_magic.y;
s = spltty();
diff --git a/sys/dev/tc/sfb.c b/sys/dev/tc/sfb.c
index 13dbc4934c6..798cea1bda8 100644
--- a/sys/dev/tc/sfb.c
+++ b/sys/dev/tc/sfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sfb.c,v 1.14 1999/03/29 07:22:02 nisimura Exp $ */
+/* $NetBSD: sfb.c,v 1.15 1999/05/07 08:00:31 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.14 1999/03/29 07:22:02 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.15 1999/05/07 08:00:31 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -106,17 +106,18 @@ struct fb_devconfig {
int dc_blanked; /* currently has video disabled */
};
-struct hwcmap {
+struct hwcmap256 {
#define CMAP_SIZE 256 /* 256 R/G/B entries */
u_int8_t r[CMAP_SIZE];
u_int8_t g[CMAP_SIZE];
u_int8_t b[CMAP_SIZE];
};
-struct hwcursor {
+struct hwcursor64 {
struct wsdisplay_curpos cc_pos;
struct wsdisplay_curpos cc_hot;
struct wsdisplay_curpos cc_size;
+ struct wsdisplay_curpos cc_magic;
#define CURSOR_MAX_SIZE 64
u_int8_t cc_color[6];
u_int64_t cc_image[64 + 64];
@@ -125,8 +126,8 @@ struct hwcursor {
struct sfb_softc {
struct device sc_dev;
struct fb_devconfig *sc_dc; /* device configuration */
- struct hwcmap sc_cmap; /* software copy of colormap */
- struct hwcursor sc_cursor; /* software copy of cursor */
+ struct hwcmap256 sc_cmap; /* software copy of colormap */
+ struct hwcursor64 sc_cursor; /* software copy of cursor */
int sc_curenb; /* cursor sprite enabled */
int sc_changed; /* need update of colormap */
#define DATA_ENB_CHANGED 0x01 /* cursor enable changed */
@@ -135,10 +136,10 @@ struct sfb_softc {
#define DATA_CMAP_CHANGED 0x08 /* colormap changed */
#define DATA_ALL_CHANGED 0x0f
int nscreens;
- short magic_x, magic_y; /* HX cursor location offset */
+};
+
#define HX_MAGIC_X 368
#define HX_MAGIC_Y 38
-};
int sfbmatch __P((struct device *, struct cfdata *, void *));
void sfbattach __P((struct device *, struct device *, void *));
@@ -342,9 +343,9 @@ sfbattach(parent, self, aux)
struct sfb_softc *sc = (struct sfb_softc *)self;
struct tc_attach_args *ta = aux;
struct wsemuldisplaydev_attach_args waa;
- struct hwcmap *cm;
+ struct hwcmap256 *cm;
caddr_t sfbasic;
- int console, i;
+ int console;
console = (ta->ta_addr == sfb_consaddr);
if (console) {
@@ -360,11 +361,11 @@ sfbattach(parent, self, aux)
sc->sc_dc->dc_depth);
cm = &sc->sc_cmap;
- cm->r[0] = cm->g[0] = cm->b[0] = 0;
- for (i = 1; i < CMAP_SIZE; i++) {
- cm->r[i] = cm->g[i] = cm->b[i] = 0xff;
- }
- sc->magic_x = HX_MAGIC_X; sc->magic_y = HX_MAGIC_Y;
+ memset(cm, 255, sizeof(struct hwcmap256)); /* XXX */
+ cm->r[0] = cm->g[0] = cm->b[0] = 0; /* XXX */
+
+ sc->sc_cursor.cc_magic.x = HX_MAGIC_X;
+ sc->sc_cursor.cc_magic.y = HX_MAGIC_Y;
tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, sfbintr, sc);
@@ -593,7 +594,7 @@ sfbintr(arg)
}
}
if (v & DATA_CMAP_CHANGED) {
- struct hwcmap *cm = &sc->sc_cmap;
+ struct hwcmap256 *cm = &sc->sc_cmap;
int index;
BT459_SELECT(vdac, 0);
@@ -828,7 +829,9 @@ bt459_set_curpos(sc)
x = sc->sc_cursor.cc_pos.x - sc->sc_cursor.cc_hot.x;
y = sc->sc_cursor.cc_pos.y - sc->sc_cursor.cc_hot.y;
- x += sc->magic_x; y += sc->magic_y; /* magic offset of HX coordinate */
+
+ x += sc->sc_cursor.cc_magic.x;
+ y += sc->sc_cursor.cc_magic.y;
s = spltty();
diff --git a/sys/dev/tc/tfb.c b/sys/dev/tc/tfb.c
index 1da2983ea26..81750490318 100644
--- a/sys/dev/tc/tfb.c
+++ b/sys/dev/tc/tfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tfb.c,v 1.11 1999/03/29 07:22:02 nisimura Exp $ */
+/* $NetBSD: tfb.c,v 1.12 1999/05/07 08:00:31 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.11 1999/03/29 07:22:02 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.12 1999/05/07 08:00:31 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -129,17 +129,18 @@ struct fb_devconfig {
int dc_blanked; /* currently has video disabled */
};
-struct hwcmap {
+struct hwcmap256 {
#define CMAP_SIZE 256 /* R/G/B entries */
u_int8_t r[CMAP_SIZE];
u_int8_t g[CMAP_SIZE];
u_int8_t b[CMAP_SIZE];
};
-struct hwcursor {
+struct hwcursor64 {
struct wsdisplay_curpos cc_pos;
struct wsdisplay_curpos cc_hot;
struct wsdisplay_curpos cc_size;
+ struct wsdisplay_curpos cc_magic;
#define CURSOR_MAX_SIZE 64
u_int8_t cc_color[6];
u_int64_t cc_image[64 + 64];
@@ -148,8 +149,8 @@ struct hwcursor {
struct tfb_softc {
struct device sc_dev;
struct fb_devconfig *sc_dc; /* device configuration */
- struct hwcmap sc_cmap; /* software copy of colormap */
- struct hwcursor sc_cursor; /* software copy of cursor */
+ struct hwcmap256 sc_cmap; /* software copy of colormap */
+ struct hwcursor64 sc_cursor; /* software copy of cursor */
int sc_curenb; /* cursor sprite enabled */
int sc_changed; /* need update of colormap */
#define DATA_ENB_CHANGED 0x01 /* cursor enable changed */
@@ -158,10 +159,10 @@ struct tfb_softc {
#define DATA_CMAP_CHANGED 0x08 /* colormap changed */
#define DATA_ALL_CHANGED 0x0f
int nscreens;
- short magic_x, magic_y; /* TX cursor location offset */
+};
+
#define TX_MAGIC_X 220
#define TX_MAGIC_Y 35
-};
#define TX_BT463_OFFSET 0x040000
#define TX_BT431_OFFSET 0x040010
@@ -369,8 +370,8 @@ tfbattach(parent, self, aux)
struct tfb_softc *sc = (struct tfb_softc *)self;
struct tc_attach_args *ta = aux;
struct wsemuldisplaydev_attach_args waa;
- struct hwcmap *cm;
- int console, i;
+ struct hwcmap256 *cm;
+ int console;
console = (ta->ta_addr == tfb_consaddr);
if (console) {
@@ -386,13 +387,14 @@ tfbattach(parent, self, aux)
sc->sc_dc->dc_depth);
cm = &sc->sc_cmap;
- cm->r[0] = cm->g[0] = cm->b[0] = 0;
- for (i = 1; i < CMAP_SIZE; i++) {
- cm->r[i] = cm->g[i] = cm->b[i] = 0xff;
- }
- sc->magic_x = TX_MAGIC_X; sc->magic_y = TX_MAGIC_Y;
+ memset(cm, 255, sizeof(struct hwcmap256)); /* XXX */
+ cm->r[0] = cm->g[0] = cm->b[0] = 0; /* XXX */
+
+ sc->sc_cursor.cc_magic.x = TX_MAGIC_X;
+ sc->sc_cursor.cc_magic.y = TX_MAGIC_Y;
tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, tfbintr, sc);
+
*(u_int8_t *)(sc->sc_dc->dc_vaddr + TX_CONTROL) &= ~0x40;
*(u_int8_t *)(sc->sc_dc->dc_vaddr + TX_CONTROL) |= 0x40;
@@ -621,7 +623,7 @@ tfbintr(arg)
}
}
if (v & DATA_CMAP_CHANGED) {
- struct hwcmap *cm = &sc->sc_cmap;
+ struct hwcmap256 *cm = &sc->sc_cmap;
int index;
BT463_SELECT(vdac, BT463_IREG_CPALETTE_RAM);
@@ -835,7 +837,9 @@ bt431_set_curpos(sc)
x = sc->sc_cursor.cc_pos.x - sc->sc_cursor.cc_hot.x;
y = sc->sc_cursor.cc_pos.y - sc->sc_cursor.cc_hot.y;
- x += sc->magic_x; y += sc->magic_y; /* magic offset of TX coordinate */
+
+ x += sc->sc_cursor.cc_magic.x;
+ y += sc->sc_cursor.cc_magic.y;
s = spltty();
diff --git a/sys/dev/tc/xcfb.c b/sys/dev/tc/xcfb.c
index 12163a7d0e3..0361b6fcf84 100644
--- a/sys/dev/tc/xcfb.c
+++ b/sys/dev/tc/xcfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xcfb.c,v 1.10 1999/04/30 09:43:23 nisimura Exp $ */
+/* $NetBSD: xcfb.c,v 1.11 1999/05/07 08:00:31 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: xcfb.c,v 1.10 1999/04/30 09:43:23 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xcfb.c,v 1.11 1999/05/07 08:00:31 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,17 +71,18 @@ struct fb_devconfig {
int dc_blanked; /* currently has video disabled */
};
-struct hwcmap {
+struct hwcmap256 {
#define CMAP_SIZE 256 /* 256 R/G/B entries */
u_int8_t r[CMAP_SIZE];
u_int8_t g[CMAP_SIZE];
u_int8_t b[CMAP_SIZE];
};
-struct hwcursor {
+struct hwcursor64 {
struct wsdisplay_curpos cc_pos;
struct wsdisplay_curpos cc_hot;
struct wsdisplay_curpos cc_size;
+ struct wsdisplay_curpos cc_magic; /* not used by PMAG-DV */
#define CURSOR_MAX_SIZE 64
u_int8_t cc_color[6];
u_int64_t cc_image[64 + 64];
@@ -97,8 +98,8 @@ struct hwcursor {
struct xcfb_softc {
struct device sc_dev;
struct fb_devconfig *sc_dc; /* device configuration */
- struct hwcmap sc_cmap; /* software copy of colormap */
- struct hwcursor sc_cursor; /* software copy of cursor */
+ struct hwcmap256 sc_cmap; /* software copy of colormap */
+ struct hwcursor64 sc_cursor; /* software copy of cursor */
/* XXX MAXINE can take PMAG-DV virtical retrace interrupt XXX */
int nscreens;
/* cursor coordiate is located at upper-left corner */
@@ -171,7 +172,7 @@ static int get_cmap __P((struct xcfb_softc *, struct wsdisplay_cmap *));
static int set_cursor __P((struct xcfb_softc *, struct wsdisplay_cursor *));
static int get_cursor __P((struct xcfb_softc *, struct wsdisplay_cursor *));
static void set_curpos __P((struct xcfb_softc *, struct wsdisplay_curpos *));
-void ims332_loadcmap __P((struct hwcmap *));
+void ims332_loadcmap __P((struct hwcmap256 *));
void ims332_set_cursor __P((struct xcfb_softc *));
void ims332_set_curpos __P((struct xcfb_softc *));
void ims332_load_curcmap __P((struct xcfb_softc *));
@@ -291,7 +292,7 @@ xcfbattach(parent, self, aux)
struct xcfb_softc *sc = (struct xcfb_softc *)self;
struct tc_attach_args *ta = aux;
struct wsemuldisplaydev_attach_args waa;
- struct hwcmap *cm;
+ struct hwcmap256 *cm;
int console;
console = (ta->ta_addr == xcfb_consaddr);
@@ -308,7 +309,7 @@ xcfbattach(parent, self, aux)
sc->sc_dc->dc_depth);
cm = &sc->sc_cmap;
- memset(cm, 255, sizeof(struct hwcmap)); /* XXX */
+ memset(cm, 255, sizeof(struct hwcmap256)); /* XXX */
cm->r[0] = cm->g[0] = cm->b[0] = 0; /* XXX */
sc->sc_csr = IMS332_BPP_8 | IMS332_CSR_A_VTG_ENABLE;
@@ -672,7 +673,7 @@ set_curpos(sc, curpos)
void
ims332_loadcmap(cm)
- struct hwcmap *cm;
+ struct hwcmap256 *cm;
{
int i;
u_int32_t rgb;