- Minor coding modifications for VDAC register access.
- De-__P() this time. Tested valid with 4MAXINE.
This commit is contained in:
parent
38e4d9e7e1
commit
8dc9a144ab
201
sys/dev/tc/cfb.c
201
sys/dev/tc/cfb.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfb.c,v 1.43 2003/12/17 03:59:32 ad Exp $ */
|
||||
/* $NetBSD: cfb.c,v 1.44 2003/12/20 07:10:00 nisimura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.43 2003/12/17 03:59:32 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.44 2003/12/20 07:10:00 nisimura Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -84,17 +84,18 @@ __KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.43 2003/12/17 03:59:32 ad Exp $");
|
||||
* };
|
||||
*/
|
||||
|
||||
/* Bt459 hardware registers */
|
||||
#define bt_lo 0
|
||||
#define bt_hi 1
|
||||
#define bt_reg 2
|
||||
#define bt_cmap 3
|
||||
/* Bt459 hardware registers, memory-mapped in 32bit stride */
|
||||
#define bt_lo 0x0
|
||||
#define bt_hi 0x4
|
||||
#define bt_reg 0x8
|
||||
#define bt_cmap 0xc
|
||||
|
||||
#define REG(base, index) *((u_int32_t *)(base) + (index))
|
||||
#define SELECT(vdac, regno) do { \
|
||||
REG(vdac, bt_lo) = ((regno) & 0x00ff); \
|
||||
REG(vdac, bt_hi) = ((regno) & 0x0f00) >> 8; \
|
||||
tc_wmb(); \
|
||||
#define REGWRITE32(p,i,v) do { \
|
||||
*(volatile u_int32_t *)((p) + (i)) = (v); tc_wmb(); \
|
||||
} while (0)
|
||||
#define VDACSELECT(p,r) do { \
|
||||
REGWRITE32(p, bt_lo, 0xff & (r)); \
|
||||
REGWRITE32(p, bt_hi, 0x0f & ((r)>>8)); \
|
||||
} while (0)
|
||||
|
||||
struct hwcmap256 {
|
||||
@ -137,13 +138,13 @@ struct cfb_softc {
|
||||
#define CX_BT459_OFFSET 0x200000
|
||||
#define CX_OFFSET_IREQ 0x300000 /* Interrupt req. control */
|
||||
|
||||
static int cfbmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void cfbattach __P((struct device *, struct device *, void *));
|
||||
static int cfbmatch(struct device *, struct cfdata *, void *);
|
||||
static void cfbattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(cfb, sizeof(struct cfb_softc),
|
||||
cfbmatch, cfbattach, NULL, NULL);
|
||||
|
||||
static void cfb_common_init __P((struct rasops_info *));
|
||||
static void cfb_common_init(struct rasops_info *);
|
||||
static struct rasops_info cfb_console_ri;
|
||||
static tc_addr_t cfb_consaddr;
|
||||
|
||||
@ -162,14 +163,14 @@ static const struct wsscreen_list cfb_screenlist = {
|
||||
sizeof(_cfb_scrlist) / sizeof(struct wsscreen_descr *), _cfb_scrlist
|
||||
};
|
||||
|
||||
static int cfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
|
||||
static paddr_t cfbmmap __P((void *, off_t, int));
|
||||
static int cfbioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
static paddr_t cfbmmap(void *, off_t, int);
|
||||
|
||||
static int cfb_alloc_screen __P((void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *));
|
||||
static void cfb_free_screen __P((void *, void *));
|
||||
static int cfb_show_screen __P((void *, void *, int,
|
||||
void (*) (void *, int, int), void *));
|
||||
static int cfb_alloc_screen(void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *);
|
||||
static void cfb_free_screen(void *, void *);
|
||||
static int cfb_show_screen(void *, void *, int,
|
||||
void (*) (void *, int, int), void *);
|
||||
|
||||
static const struct wsdisplay_accessops cfb_accessops = {
|
||||
cfbioctl,
|
||||
@ -180,16 +181,16 @@ static const struct wsdisplay_accessops cfb_accessops = {
|
||||
0 /* load_font */
|
||||
};
|
||||
|
||||
int cfb_cnattach __P((tc_addr_t));
|
||||
static int cfbintr __P((void *));
|
||||
static void cfbhwinit __P((caddr_t));
|
||||
static void cfb_cmap_init __P((struct cfb_softc *));
|
||||
int cfb_cnattach(tc_addr_t);
|
||||
static int cfbintr(void *);
|
||||
static void cfbhwinit(caddr_t);
|
||||
static void cfb_cmap_init(struct cfb_softc *);
|
||||
|
||||
static int get_cmap __P((struct cfb_softc *, struct wsdisplay_cmap *));
|
||||
static int set_cmap __P((struct cfb_softc *, struct wsdisplay_cmap *));
|
||||
static int set_cursor __P((struct cfb_softc *, struct wsdisplay_cursor *));
|
||||
static int get_cursor __P((struct cfb_softc *, struct wsdisplay_cursor *));
|
||||
static void set_curpos __P((struct cfb_softc *, struct wsdisplay_curpos *));
|
||||
static int get_cmap(struct cfb_softc *, struct wsdisplay_cmap *);
|
||||
static int set_cmap(struct cfb_softc *, struct wsdisplay_cmap *);
|
||||
static int set_cursor(struct cfb_softc *, struct wsdisplay_cursor *);
|
||||
static int get_cursor(struct cfb_softc *, struct wsdisplay_cursor *);
|
||||
static void set_curpos(struct cfb_softc *, struct wsdisplay_curpos *);
|
||||
|
||||
/*
|
||||
* Compose 2 bit/pixel cursor image. Bit order will be reversed.
|
||||
@ -288,7 +289,7 @@ cfbattach(parent, self, aux)
|
||||
tc_intr_establish(parent, ta->ta_cookie, IPL_TTY, cfbintr, sc);
|
||||
|
||||
/* clear any pending interrupts */
|
||||
*(u_int8_t *)((caddr_t)ri->ri_hw + CX_OFFSET_IREQ) = 0;
|
||||
*(volatile u_int8_t *)((caddr_t)ri->ri_hw + CX_OFFSET_IREQ) = 0;
|
||||
|
||||
waa.console = console;
|
||||
waa.scrdata = &cfb_screenlist;
|
||||
@ -501,7 +502,7 @@ cfb_show_screen(v, cookie, waitok, cb, cbarg)
|
||||
void *v;
|
||||
void *cookie;
|
||||
int waitok;
|
||||
void (*cb) __P((void *, int, int));
|
||||
void (*cb)(void *, int, int);
|
||||
void *cbarg;
|
||||
{
|
||||
|
||||
@ -540,8 +541,8 @@ cfbintr(arg)
|
||||
vdac = base + CX_BT459_OFFSET;
|
||||
v = sc->sc_changed;
|
||||
if (v & WSDISPLAY_CURSOR_DOCUR) {
|
||||
SELECT(vdac, BT459_IREG_CCR);
|
||||
REG(vdac, bt_reg) = (sc->sc_curenb) ? 0xc0 : 0x00;
|
||||
VDACSELECT(vdac, BT459_IREG_CCR);
|
||||
REGWRITE32(vdac, bt_reg, (sc->sc_curenb) ? 0xc0 : 0x00);
|
||||
}
|
||||
if (v & (WSDISPLAY_CURSOR_DOPOS | WSDISPLAY_CURSOR_DOHOT)) {
|
||||
int x, y;
|
||||
@ -552,23 +553,23 @@ cfbintr(arg)
|
||||
x += sc->sc_cursor.cc_magic.x;
|
||||
y += sc->sc_cursor.cc_magic.y;
|
||||
|
||||
SELECT(vdac, BT459_IREG_CURSOR_X_LOW);
|
||||
REG(vdac, bt_reg) = x; tc_wmb();
|
||||
REG(vdac, bt_reg) = x >> 8; tc_wmb();
|
||||
REG(vdac, bt_reg) = y; tc_wmb();
|
||||
REG(vdac, bt_reg) = y >> 8; tc_wmb();
|
||||
VDACSELECT(vdac, BT459_IREG_CURSOR_X_LOW);
|
||||
REGWRITE32(vdac, bt_reg, x);
|
||||
REGWRITE32(vdac, bt_reg, x >> 8);
|
||||
REGWRITE32(vdac, bt_reg, y);
|
||||
REGWRITE32(vdac, bt_reg, y >> 8);
|
||||
}
|
||||
if (v & WSDISPLAY_CURSOR_DOCMAP) {
|
||||
u_int8_t *cp = sc->sc_cursor.cc_color;
|
||||
|
||||
SELECT(vdac, BT459_IREG_CCOLOR_2);
|
||||
REG(vdac, bt_reg) = cp[1]; tc_wmb();
|
||||
REG(vdac, bt_reg) = cp[3]; tc_wmb();
|
||||
REG(vdac, bt_reg) = cp[5]; tc_wmb();
|
||||
VDACSELECT(vdac, BT459_IREG_CCOLOR_2);
|
||||
REGWRITE32(vdac, bt_reg, cp[1]);
|
||||
REGWRITE32(vdac, bt_reg, cp[3]);
|
||||
REGWRITE32(vdac, bt_reg, cp[5]);
|
||||
|
||||
REG(vdac, bt_reg) = cp[0]; tc_wmb();
|
||||
REG(vdac, bt_reg) = cp[2]; tc_wmb();
|
||||
REG(vdac, bt_reg) = cp[4]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, cp[0]);
|
||||
REGWRITE32(vdac, bt_reg, cp[2]);
|
||||
REGWRITE32(vdac, bt_reg, cp[4]);
|
||||
}
|
||||
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
|
||||
u_int8_t *ip, *mp, img, msk;
|
||||
@ -579,29 +580,29 @@ cfbintr(arg)
|
||||
mp = (u_int8_t *)sc->sc_cursor.cc_mask;
|
||||
|
||||
bcnt = 0;
|
||||
SELECT(vdac, BT459_IREG_CRAM_BASE+0);
|
||||
VDACSELECT(vdac, BT459_IREG_CRAM_BASE+0);
|
||||
/* 64 pixel scan line is consisted with 16 byte cursor ram */
|
||||
while (bcnt < sc->sc_cursor.cc_size.y * 16) {
|
||||
/* pad right half 32 pixel when smaller than 33 */
|
||||
if ((bcnt & 0x8) && sc->sc_cursor.cc_size.x < 33) {
|
||||
REG(vdac, bt_reg) = 0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, 0);
|
||||
REGWRITE32(vdac, bt_reg, 0);
|
||||
}
|
||||
else {
|
||||
img = *ip++;
|
||||
msk = *mp++;
|
||||
img &= msk; /* cookie off image */
|
||||
u = (msk & 0x0f) << 4 | (img & 0x0f);
|
||||
REG(vdac, bt_reg) = shuffle[u]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, shuffle[u]);
|
||||
u = (msk & 0xf0) | (img & 0xf0) >> 4;
|
||||
REG(vdac, bt_reg) = shuffle[u]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, shuffle[u]);
|
||||
}
|
||||
bcnt += 2;
|
||||
}
|
||||
/* pad unoccupied scan lines */
|
||||
while (bcnt < CURSOR_MAX_SIZE * 16) {
|
||||
REG(vdac, bt_reg) = 0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, 0);
|
||||
REGWRITE32(vdac, bt_reg, 0);
|
||||
bcnt += 2;
|
||||
}
|
||||
}
|
||||
@ -609,11 +610,11 @@ cfbintr(arg)
|
||||
struct hwcmap256 *cm = &sc->sc_cmap;
|
||||
int index;
|
||||
|
||||
SELECT(vdac, 0);
|
||||
VDACSELECT(vdac, 0);
|
||||
for (index = 0; index < CMAP_SIZE; index++) {
|
||||
REG(vdac, bt_cmap) = cm->r[index]; tc_wmb();
|
||||
REG(vdac, bt_cmap) = cm->g[index]; tc_wmb();
|
||||
REG(vdac, bt_cmap) = cm->b[index]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, cm->r[index]);
|
||||
REGWRITE32(vdac, bt_cmap, cm->g[index]);
|
||||
REGWRITE32(vdac, bt_cmap, cm->b[index]);
|
||||
}
|
||||
}
|
||||
sc->sc_changed = 0;
|
||||
@ -628,65 +629,65 @@ cfbhwinit(cfbbase)
|
||||
const u_int8_t *p;
|
||||
int i;
|
||||
|
||||
SELECT(vdac, BT459_IREG_COMMAND_0);
|
||||
REG(vdac, bt_reg) = 0x40; /* CMD0 */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; /* CMD1 */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0xc0; /* CMD2 */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0xff; /* PRM */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0; /* 205 */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; /* PBM */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0; /* 207 */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; /* ORM */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; /* OBM */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; /* ILV */ tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; /* TEST */ tc_wmb();
|
||||
VDACSELECT(vdac, BT459_IREG_COMMAND_0);
|
||||
REGWRITE32(vdac, bt_reg, 0x40); /* CMD0 */
|
||||
REGWRITE32(vdac, bt_reg, 0x0); /* CMD1 */
|
||||
REGWRITE32(vdac, bt_reg, 0xc0); /* CMD2 */
|
||||
REGWRITE32(vdac, bt_reg, 0xff); /* PRM */
|
||||
REGWRITE32(vdac, bt_reg, 0); /* 205 */
|
||||
REGWRITE32(vdac, bt_reg, 0x0); /* PBM */
|
||||
REGWRITE32(vdac, bt_reg, 0); /* 207 */
|
||||
REGWRITE32(vdac, bt_reg, 0x0); /* ORM */
|
||||
REGWRITE32(vdac, bt_reg, 0x0); /* OBM */
|
||||
REGWRITE32(vdac, bt_reg, 0x0); /* ILV */
|
||||
REGWRITE32(vdac, bt_reg, 0x0); /* TEST */
|
||||
|
||||
SELECT(vdac, BT459_IREG_CCR);
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0x0; tc_wmb();
|
||||
VDACSELECT(vdac, BT459_IREG_CCR);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
REGWRITE32(vdac, bt_reg, 0x0);
|
||||
|
||||
/* build sane colormap */
|
||||
SELECT(vdac, 0);
|
||||
VDACSELECT(vdac, 0);
|
||||
p = rasops_cmap;
|
||||
for (i = 0; i < CMAP_SIZE; i++, p += 3) {
|
||||
REG(vdac, bt_cmap) = p[0]; tc_wmb();
|
||||
REG(vdac, bt_cmap) = p[1]; tc_wmb();
|
||||
REG(vdac, bt_cmap) = p[2]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, p[0]);
|
||||
REGWRITE32(vdac, bt_cmap, p[1]);
|
||||
REGWRITE32(vdac, bt_cmap, p[2]);
|
||||
}
|
||||
|
||||
/* clear out cursor image */
|
||||
SELECT(vdac, BT459_IREG_CRAM_BASE);
|
||||
VDACSELECT(vdac, BT459_IREG_CRAM_BASE);
|
||||
for (i = 0; i < 1024; i++)
|
||||
REG(vdac, bt_reg) = 0xff; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, 0xff);
|
||||
|
||||
/*
|
||||
* 2 bit/pixel cursor. Assign MSB for cursor mask and LSB for
|
||||
* cursor image. CCOLOR_2 for mask color, while CCOLOR_3 for
|
||||
* image color. CCOLOR_1 will be never used.
|
||||
*/
|
||||
SELECT(vdac, BT459_IREG_CCOLOR_1);
|
||||
REG(vdac, bt_reg) = 0xff; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0xff; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0xff; tc_wmb();
|
||||
VDACSELECT(vdac, BT459_IREG_CCOLOR_1);
|
||||
REGWRITE32(vdac, bt_reg, 0xff);
|
||||
REGWRITE32(vdac, bt_reg, 0xff);
|
||||
REGWRITE32(vdac, bt_reg, 0xff);
|
||||
|
||||
REG(vdac, bt_reg) = 0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, 0);
|
||||
REGWRITE32(vdac, bt_reg, 0);
|
||||
REGWRITE32(vdac, bt_reg, 0);
|
||||
|
||||
REG(vdac, bt_reg) = 0xff; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0xff; tc_wmb();
|
||||
REG(vdac, bt_reg) = 0xff; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, 0xff);
|
||||
REGWRITE32(vdac, bt_reg, 0xff);
|
||||
REGWRITE32(vdac, bt_reg, 0xff);
|
||||
}
|
||||
|
||||
static int
|
||||
|
184
sys/dev/tc/mfb.c
184
sys/dev/tc/mfb.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mfb.c,v 1.40 2003/12/17 03:59:33 ad Exp $ */
|
||||
/* $NetBSD: mfb.c,v 1.41 2003/12/20 07:10:00 nisimura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.40 2003/12/17 03:59:33 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.41 2003/12/20 07:10:00 nisimura Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -57,44 +57,40 @@ __KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.40 2003/12/17 03:59:33 ad Exp $");
|
||||
|
||||
#if defined(pmax)
|
||||
#define machine_btop(x) mips_btop(MIPS_KSEG1_TO_PHYS(x))
|
||||
|
||||
#define BYTE(base, index) *((u_int8_t *)(base) + ((index)<<2))
|
||||
#define HALF(base, index) *((u_int16_t *)(base) + ((index)<<1))
|
||||
#endif
|
||||
|
||||
#if defined(__alpha__) || defined(alpha)
|
||||
#if defined(alpha)
|
||||
#define machine_btop(x) alpha_btop(ALPHA_K0SEG_TO_PHYS(x))
|
||||
|
||||
#define BYTE(base, index) *((u_int32_t *)(base) + (index))
|
||||
#define HALF(base, index) *((u_int32_t *)(base) + (index))
|
||||
#endif
|
||||
|
||||
/* Bt455 hardware registers */
|
||||
#define bt_reg 0
|
||||
#define bt_cmap 1
|
||||
#define bt_clr 2
|
||||
#define bt_ovly 3
|
||||
/* Bt455 hardware registers, memory-mapped in 32bit stride */
|
||||
#define bt_reg 0x0
|
||||
#define bt_cmap 0x4
|
||||
#define bt_clr 0x8
|
||||
#define bt_ovly 0xc
|
||||
|
||||
/* Bt431 hardware registers */
|
||||
#define bt_lo 0
|
||||
#define bt_hi 1
|
||||
#define bt_ram 2
|
||||
#define bt_ctl 3
|
||||
/* Bt431 hardware registers, memory-mapped in 32bit stride */
|
||||
#define bt_lo 0x0
|
||||
#define bt_hi 0x4
|
||||
#define bt_ram 0x8
|
||||
#define bt_ctl 0xc
|
||||
|
||||
#define SELECT455(vdac, regno) do { \
|
||||
BYTE(vdac, bt_reg) = (regno); \
|
||||
BYTE(vdac, bt_clr) = 0; \
|
||||
tc_wmb(); \
|
||||
#define REGWRITE32(p,i,v) do { \
|
||||
*(volatile u_int32_t *)((p) + (i)) = (v); tc_wmb(); \
|
||||
} while (0)
|
||||
|
||||
#define SELECT455(p,r) do { \
|
||||
REGWRITE32((p), bt_reg, (r)); \
|
||||
REGWRITE32((p), bt_clr, 0); \
|
||||
} while (0)
|
||||
|
||||
#define TWIN(x) ((x)|((x) << 8))
|
||||
#define TWIN_LO(x) (twin = (x) & 0x00ff, twin << 8 | twin)
|
||||
#define TWIN_HI(x) (twin = (x) & 0xff00, twin | twin >> 8)
|
||||
|
||||
#define SELECT431(curs, regno) do { \
|
||||
HALF(curs, bt_lo) = TWIN(regno);\
|
||||
HALF(curs, bt_hi) = 0; \
|
||||
tc_wmb(); \
|
||||
#define SELECT431(p,r) do { \
|
||||
REGWRITE32((p), bt_lo, TWIN(r)); \
|
||||
REGWRITE32((p), bt_hi, 0); \
|
||||
} while (0)
|
||||
|
||||
struct hwcursor64 {
|
||||
@ -129,13 +125,13 @@ struct mfb_softc {
|
||||
#define MX_BT431_OFFSET 0x180000
|
||||
#define MX_IREQ_OFFSET 0x080000 /* Interrupt req. control */
|
||||
|
||||
static int mfbmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void mfbattach __P((struct device *, struct device *, void *));
|
||||
static int mfbmatch(struct device *, struct cfdata *, void *);
|
||||
static void mfbattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(mfb, sizeof(struct mfb_softc),
|
||||
mfbmatch, mfbattach, NULL, NULL);
|
||||
|
||||
static void mfb_common_init __P((struct rasops_info *));
|
||||
static void mfb_common_init(struct rasops_info *);
|
||||
static struct rasops_info mfb_console_ri;
|
||||
static tc_addr_t mfb_consaddr;
|
||||
|
||||
@ -154,14 +150,14 @@ static const struct wsscreen_list mfb_screenlist = {
|
||||
sizeof(_mfb_scrlist) / sizeof(struct wsscreen_descr *), _mfb_scrlist
|
||||
};
|
||||
|
||||
static int mfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
|
||||
static paddr_t mfbmmap __P((void *, off_t, int));
|
||||
static int mfbioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
static paddr_t mfbmmap(void *, off_t, int);
|
||||
|
||||
static int mfb_alloc_screen __P((void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *));
|
||||
static void mfb_free_screen __P((void *, void *));
|
||||
static int mfb_show_screen __P((void *, void *, int,
|
||||
void (*) (void *, int, int), void *));
|
||||
static int mfb_alloc_screen(void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *);
|
||||
static void mfb_free_screen(void *, void *);
|
||||
static int mfb_show_screen(void *, void *, int,
|
||||
void (*) (void *, int, int), void *);
|
||||
|
||||
static const struct wsdisplay_accessops mfb_accessops = {
|
||||
mfbioctl,
|
||||
@ -172,13 +168,13 @@ static const struct wsdisplay_accessops mfb_accessops = {
|
||||
0 /* load_font */
|
||||
};
|
||||
|
||||
int mfb_cnattach __P((tc_addr_t));
|
||||
static int mfbintr __P((void *));
|
||||
static void mfbhwinit __P((caddr_t));
|
||||
int mfb_cnattach(tc_addr_t);
|
||||
static int mfbintr(void *);
|
||||
static void mfbhwinit(caddr_t);
|
||||
|
||||
static int set_cursor __P((struct mfb_softc *, struct wsdisplay_cursor *));
|
||||
static int get_cursor __P((struct mfb_softc *, struct wsdisplay_cursor *));
|
||||
static void set_curpos __P((struct mfb_softc *, struct wsdisplay_curpos *));
|
||||
static int set_cursor(struct mfb_softc *, struct wsdisplay_cursor *);
|
||||
static int get_cursor(struct mfb_softc *, struct wsdisplay_cursor *);
|
||||
static void set_curpos(struct mfb_softc *, struct wsdisplay_curpos *);
|
||||
|
||||
/* bit order reverse */
|
||||
static const u_int8_t flip[256] = {
|
||||
@ -468,7 +464,7 @@ mfb_show_screen(v, cookie, waitok, cb, cbarg)
|
||||
void *v;
|
||||
void *cookie;
|
||||
int waitok;
|
||||
void (*cb) __P((void *, int, int));
|
||||
void (*cb)(void *, int, int);
|
||||
void *cbarg;
|
||||
{
|
||||
|
||||
@ -512,12 +508,15 @@ mfbintr(arg)
|
||||
curs = base + MX_BT431_OFFSET;
|
||||
v = sc->sc_changed;
|
||||
if (v & WSDISPLAY_CURSOR_DOCUR) {
|
||||
int onoff;
|
||||
|
||||
onoff = (sc->sc_curenb) ? 0x4444 : 0x0404;
|
||||
SELECT431(curs, BT431_REG_COMMAND);
|
||||
HALF(curs, bt_ctl) = (sc->sc_curenb) ? 0x4444 : 0x0404;
|
||||
REGWRITE32(curs, bt_ctl, onoff);
|
||||
}
|
||||
if (v & (WSDISPLAY_CURSOR_DOPOS | WSDISPLAY_CURSOR_DOHOT)) {
|
||||
int x, y;
|
||||
u_int16_t twin;
|
||||
u_int32_t twin;
|
||||
|
||||
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;
|
||||
@ -526,33 +525,33 @@ mfbintr(arg)
|
||||
y += sc->sc_cursor.cc_magic.y;
|
||||
|
||||
SELECT431(curs, BT431_REG_CURSOR_X_LOW);
|
||||
HALF(curs, bt_ctl) = TWIN_LO(x); tc_wmb();
|
||||
HALF(curs, bt_ctl) = TWIN_HI(x); tc_wmb();
|
||||
HALF(curs, bt_ctl) = TWIN_LO(y); tc_wmb();
|
||||
HALF(curs, bt_ctl) = TWIN_HI(y); tc_wmb();
|
||||
REGWRITE32(curs, bt_ctl, TWIN_LO(x));
|
||||
REGWRITE32(curs, bt_ctl, TWIN_HI(x));
|
||||
REGWRITE32(curs, bt_ctl, TWIN_LO(y));
|
||||
REGWRITE32(curs, bt_ctl, TWIN_HI(y));
|
||||
}
|
||||
if (v & WSDISPLAY_CURSOR_DOCMAP) {
|
||||
u_int8_t *cp = sc->sc_cursor.cc_color;
|
||||
|
||||
SELECT455(vdac, 8);
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = cp[1]; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, cp[1]);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = cp[1]; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, cp[1]);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
|
||||
BYTE(vdac, bt_ovly) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_ovly) = cp[0]; tc_wmb();
|
||||
BYTE(vdac, bt_ovly) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_ovly, 0);
|
||||
REGWRITE32(vdac, bt_ovly, cp[0]);
|
||||
REGWRITE32(vdac, bt_ovly, 0);
|
||||
}
|
||||
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
|
||||
u_int8_t *ip, *mp, img, msk;
|
||||
int bcnt;
|
||||
|
||||
ip = (u_int8_t *)sc->sc_cursor.cc_image;
|
||||
mp = (u_int8_t *)(sc->sc_cursor.cc_mask);
|
||||
mp = (u_int8_t *)sc->sc_cursor.cc_mask;
|
||||
bcnt = 0;
|
||||
SELECT431(curs, BT431_REG_CRAM_BASE);
|
||||
|
||||
@ -560,23 +559,22 @@ mfbintr(arg)
|
||||
while (bcnt < sc->sc_cursor.cc_size.y * 16) {
|
||||
/* pad right half 32 pixel when smaller than 33 */
|
||||
if ((bcnt & 0x8) && sc->sc_cursor.cc_size.x < 33) {
|
||||
HALF(curs, bt_ram) = 0;
|
||||
tc_wmb();
|
||||
REGWRITE32(curs, bt_ram, 0);
|
||||
}
|
||||
else {
|
||||
int half;
|
||||
|
||||
img = *ip++;
|
||||
msk = *mp++;
|
||||
img &= msk; /* cookie off image */
|
||||
HALF(curs, bt_ram)
|
||||
= (flip[msk] << 8) | flip[img];
|
||||
tc_wmb();
|
||||
half = (flip[msk] << 8) | flip[img];
|
||||
REGWRITE32(curs, bt_ram, half);
|
||||
}
|
||||
bcnt += 2;
|
||||
}
|
||||
/* pad unoccupied scan lines */
|
||||
while (bcnt < CURSOR_MAX_SIZE * 16) {
|
||||
HALF(curs, bt_ram) = 0;
|
||||
tc_wmb();
|
||||
REGWRITE32(curs, bt_ram, 0);
|
||||
bcnt += 2;
|
||||
}
|
||||
}
|
||||
@ -594,40 +592,40 @@ mfbhwinit(mfbbase)
|
||||
vdac = mfbbase + MX_BT455_OFFSET;
|
||||
curs = mfbbase + MX_BT431_OFFSET;
|
||||
SELECT431(curs, BT431_REG_COMMAND);
|
||||
HALF(curs, bt_ctl) = 0x0404; tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* YLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* YHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XWLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XWHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WYLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WYLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WWLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WWHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WHLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WHHI */ tc_wmb();
|
||||
REGWRITE32(curs, bt_ctl, 0x0404);
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* YLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* YHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XWLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XWHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WYLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WYLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WWLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WWHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WHLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WHHI */
|
||||
|
||||
/* 0: black, 1: white, 8,9: cursor mask, ovly: cursor image */
|
||||
SELECT455(vdac, 0);
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0xff; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, 0xff);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
for (i = 2; i < 16; i++) {
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
REGWRITE32(vdac, bt_cmap, 0);
|
||||
}
|
||||
BYTE(vdac, bt_ovly) = 0; tc_wmb();
|
||||
BYTE(vdac, bt_ovly) = 0xff; tc_wmb();
|
||||
BYTE(vdac, bt_ovly) = 0; tc_wmb();
|
||||
REGWRITE32(vdac, bt_ovly, 0);
|
||||
REGWRITE32(vdac, bt_ovly, 0xff);
|
||||
REGWRITE32(vdac, bt_ovly, 0);
|
||||
|
||||
SELECT431(curs, BT431_REG_CRAM_BASE);
|
||||
for (i = 0; i < 512; i++) {
|
||||
HALF(curs, bt_ram) = 0; tc_wmb();
|
||||
REGWRITE32(curs, bt_ram, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
233
sys/dev/tc/tfb.c
233
sys/dev/tc/tfb.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tfb.c,v 1.43 2003/12/17 03:59:33 ad Exp $ */
|
||||
/* $NetBSD: tfb.c,v 1.44 2003/12/20 07:10:01 nisimura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.43 2003/12/17 03:59:33 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.44 2003/12/20 07:10:01 nisimura Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -58,6 +58,11 @@ __KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.43 2003/12/17 03:59:33 ad Exp $");
|
||||
|
||||
#if defined(pmax)
|
||||
#define machine_btop(x) mips_btop(MIPS_KSEG1_TO_PHYS(x))
|
||||
#endif
|
||||
|
||||
#if defined(alpha)
|
||||
#define machine_btop(x) alpha_btop(ALPHA_K0SEG_TO_PHYS(x))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* struct bt463reg {
|
||||
@ -90,59 +95,32 @@ __KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.43 2003/12/17 03:59:33 ad Exp $");
|
||||
* };
|
||||
*/
|
||||
|
||||
#define BYTE(base, index) *((u_int8_t *)(base) + ((index)<<2))
|
||||
#define HALF(base, index) *((u_int16_t *)(base) + ((index)<<1))
|
||||
/* Bt463 hardware registers, memory-mapped in 32bit stride */
|
||||
#define bt_lo 0x0
|
||||
#define bt_hi 0x4
|
||||
#define bt_reg 0x8
|
||||
#define bt_cmap 0xc
|
||||
|
||||
#endif
|
||||
/* Bt431 hardware registers, memory-mapped in 32bit stride */
|
||||
#define bt_ram 0x8
|
||||
#define bt_ctl 0xc
|
||||
|
||||
#if defined(alpha)
|
||||
#define machine_btop(x) alpha_btop(ALPHA_K0SEG_TO_PHYS(x))
|
||||
#define REGWRITE32(p,i,v) do { \
|
||||
*(volatile u_int32_t *)((p) + (i)) = (v); tc_wmb(); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* struct bt463reg {
|
||||
* u_int32_t bt_lo;
|
||||
* u_int32_t bt_hi;
|
||||
* u_int32_t bt_reg;
|
||||
* u_int32_t bt_cmap;
|
||||
* };
|
||||
*
|
||||
* struct bt431reg {
|
||||
* u_int32_t bt_lo;
|
||||
* u_int32_t bt_hi;
|
||||
* u_int32_t bt_ram;
|
||||
* u_int32_t bt_ctl;
|
||||
* };
|
||||
*/
|
||||
|
||||
#define BYTE(base, index) *((u_int32_t *)(base) + (index))
|
||||
#define HALF(base, index) *((u_int32_t *)(base) + (index))
|
||||
|
||||
#endif
|
||||
|
||||
/* Bt463 hardware registers */
|
||||
#define bt_lo 0
|
||||
#define bt_hi 1
|
||||
#define bt_reg 2
|
||||
#define bt_cmap 3
|
||||
|
||||
/* Bt431 hardware registers */
|
||||
#define bt_ram 2
|
||||
#define bt_ctl 3
|
||||
|
||||
#define SELECT463(vdac, regno) do { \
|
||||
BYTE(vdac, bt_lo) = (regno) & 0x00ff; \
|
||||
BYTE(vdac, bt_hi) = ((regno)& 0xff00) >> 8; \
|
||||
tc_wmb(); \
|
||||
#define SELECT463(p,r) do { \
|
||||
REGWRITE32((p), bt_lo, 0xff & (r)); \
|
||||
REGWRITE32((p), bt_hi, 0xff & ((r)>>8)); \
|
||||
} while (0)
|
||||
|
||||
#define TWIN(x) ((x) | ((x) << 8))
|
||||
#define TWIN_LO(x) (twin = (x) & 0x00ff, (twin << 8) | twin)
|
||||
#define TWIN_HI(x) (twin = (x) & 0xff00, twin | (twin >> 8))
|
||||
|
||||
#define SELECT431(curs, regno) do { \
|
||||
HALF(curs, bt_lo) = TWIN(regno);\
|
||||
HALF(curs, bt_hi) = 0; \
|
||||
tc_wmb(); \
|
||||
#define SELECT431(p,r) do { \
|
||||
REGWRITE32((p), bt_lo, TWIN(r)); \
|
||||
REGWRITE32((p), bt_hi, 0); \
|
||||
} while (0)
|
||||
|
||||
struct hwcmap256 {
|
||||
@ -198,14 +176,14 @@ struct tfb_softc {
|
||||
#define TX_CTL_SEG_ENA 0x10
|
||||
#define TX_CTL_SEG 0x0f
|
||||
|
||||
static int tfbmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void tfbattach __P((struct device *, struct device *, void *));
|
||||
static int tfbmatch(struct device *, struct cfdata *, void *);
|
||||
static void tfbattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(tfb, sizeof(struct tfb_softc),
|
||||
tfbmatch, tfbattach, NULL, NULL);
|
||||
|
||||
static void tfb_common_init __P((struct rasops_info *));
|
||||
static void tfb_cmap_init __P((struct tfb_softc *));
|
||||
static void tfb_common_init(struct rasops_info *);
|
||||
static void tfb_cmap_init(struct tfb_softc *);
|
||||
static struct rasops_info tfb_console_ri;
|
||||
static tc_addr_t tfb_consaddr;
|
||||
|
||||
@ -224,14 +202,14 @@ static const struct wsscreen_list tfb_screenlist = {
|
||||
sizeof(_tfb_scrlist) / sizeof(struct wsscreen_descr *), _tfb_scrlist
|
||||
};
|
||||
|
||||
static int tfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
|
||||
static paddr_t tfbmmap __P((void *, off_t, int));
|
||||
static int tfbioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
static paddr_t tfbmmap(void *, off_t, int);
|
||||
|
||||
static int tfb_alloc_screen __P((void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *));
|
||||
static void tfb_free_screen __P((void *, void *));
|
||||
static int tfb_show_screen __P((void *, void *, int,
|
||||
void (*) (void *, int, int), void *));
|
||||
static int tfb_alloc_screen(void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *);
|
||||
static void tfb_free_screen(void *, void *);
|
||||
static int tfb_show_screen(void *, void *, int,
|
||||
void (*) (void *, int, int), void *);
|
||||
|
||||
static const struct wsdisplay_accessops tfb_accessops = {
|
||||
tfbioctl,
|
||||
@ -242,15 +220,15 @@ static const struct wsdisplay_accessops tfb_accessops = {
|
||||
0 /* load_font */
|
||||
};
|
||||
|
||||
int tfb_cnattach __P((tc_addr_t));
|
||||
static int tfbintr __P((void *));
|
||||
static void tfbhwinit __P((caddr_t));
|
||||
int tfb_cnattach(tc_addr_t);
|
||||
static int tfbintr(void *);
|
||||
static void tfbhwinit(caddr_t);
|
||||
|
||||
static int get_cmap __P((struct tfb_softc *, struct wsdisplay_cmap *));
|
||||
static int set_cmap __P((struct tfb_softc *, struct wsdisplay_cmap *));
|
||||
static int set_cursor __P((struct tfb_softc *, struct wsdisplay_cursor *));
|
||||
static int get_cursor __P((struct tfb_softc *, struct wsdisplay_cursor *));
|
||||
static void set_curpos __P((struct tfb_softc *, struct wsdisplay_curpos *));
|
||||
static int get_cmap(struct tfb_softc *, struct wsdisplay_cmap *);
|
||||
static int set_cmap(struct tfb_softc *, struct wsdisplay_cmap *);
|
||||
static int set_cursor(struct tfb_softc *, struct wsdisplay_cursor *);
|
||||
static int get_cursor(struct tfb_softc *, struct wsdisplay_cursor *);
|
||||
static void set_curpos(struct tfb_softc *, struct wsdisplay_curpos *);
|
||||
|
||||
/* bit order reverse */
|
||||
static const u_int8_t flip[256] = {
|
||||
@ -562,7 +540,7 @@ tfb_show_screen(v, cookie, waitok, cb, cbarg)
|
||||
void *v;
|
||||
void *cookie;
|
||||
int waitok;
|
||||
void (*cb) __P((void *, int, int));
|
||||
void (*cb)(void *, int, int);
|
||||
void *cbarg;
|
||||
{
|
||||
|
||||
@ -602,12 +580,15 @@ tfbintr(arg)
|
||||
curs = base + TX_BT431_OFFSET;
|
||||
v = sc->sc_changed;
|
||||
if (v & WSDISPLAY_CURSOR_DOCUR) {
|
||||
int onoff;
|
||||
|
||||
onoff = (sc->sc_curenb) ? 0x4444 : 0x0404;
|
||||
SELECT431(curs, BT431_REG_COMMAND);
|
||||
HALF(curs, bt_ctl) = (sc->sc_curenb) ? 0x4444 : 0x0404;
|
||||
REGWRITE32(curs, bt_ctl, onoff);
|
||||
}
|
||||
if (v & (WSDISPLAY_CURSOR_DOPOS | WSDISPLAY_CURSOR_DOHOT)) {
|
||||
int x, y;
|
||||
u_int16_t twin;
|
||||
u_int32_t twin;
|
||||
|
||||
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;
|
||||
@ -616,30 +597,30 @@ tfbintr(arg)
|
||||
y += sc->sc_cursor.cc_magic.y;
|
||||
|
||||
SELECT431(curs, BT431_REG_CURSOR_X_LOW);
|
||||
HALF(curs, bt_ctl) = TWIN_LO(x); tc_wmb();
|
||||
HALF(curs, bt_ctl) = TWIN_HI(x); tc_wmb();
|
||||
HALF(curs, bt_ctl) = TWIN_LO(y); tc_wmb();
|
||||
HALF(curs, bt_ctl) = TWIN_HI(y); tc_wmb();
|
||||
REGWRITE32(curs, bt_ctl, TWIN_LO(x));
|
||||
REGWRITE32(curs, bt_ctl, TWIN_HI(x));
|
||||
REGWRITE32(curs, bt_ctl, TWIN_LO(y));
|
||||
REGWRITE32(curs, bt_ctl, TWIN_HI(y));
|
||||
}
|
||||
if (v & WSDISPLAY_CURSOR_DOCMAP) {
|
||||
u_int8_t *cp = sc->sc_cursor.cc_color;
|
||||
|
||||
SELECT463(vdac, BT463_IREG_CURSOR_COLOR_0);
|
||||
BYTE(vdac, bt_reg) = cp[1]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[3]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[5]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, cp[1]);
|
||||
REGWRITE32(vdac, bt_reg, cp[3]);
|
||||
REGWRITE32(vdac, bt_reg, cp[5]);
|
||||
|
||||
BYTE(vdac, bt_reg) = cp[0]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[2]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[4]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, cp[0]);
|
||||
REGWRITE32(vdac, bt_reg, cp[2]);
|
||||
REGWRITE32(vdac, bt_reg, cp[4]);
|
||||
|
||||
BYTE(vdac, bt_reg) = cp[1]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[3]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[5]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, cp[1]);
|
||||
REGWRITE32(vdac, bt_reg, cp[3]);
|
||||
REGWRITE32(vdac, bt_reg, cp[5]);
|
||||
|
||||
BYTE(vdac, bt_reg) = cp[1]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[3]; tc_wmb();
|
||||
BYTE(vdac, bt_reg) = cp[5]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, cp[1]);
|
||||
REGWRITE32(vdac, bt_reg, cp[3]);
|
||||
REGWRITE32(vdac, bt_reg, cp[5]);
|
||||
}
|
||||
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
|
||||
u_int8_t *ip, *mp, img, msk;
|
||||
@ -654,23 +635,21 @@ tfbintr(arg)
|
||||
while (bcnt < sc->sc_cursor.cc_size.y * 16) {
|
||||
/* pad right half 32 pixel when smaller than 33 */
|
||||
if ((bcnt & 0x8) && sc->sc_cursor.cc_size.x < 33) {
|
||||
HALF(curs, bt_ram) = 0;
|
||||
tc_wmb();
|
||||
REGWRITE32(curs, bt_ram, 0);
|
||||
}
|
||||
else {
|
||||
int half;
|
||||
img = *ip++;
|
||||
msk = *mp++;
|
||||
img &= msk; /* cookie off image */
|
||||
HALF(curs, bt_ram)
|
||||
= (flip[img] << 8) | flip[msk];
|
||||
tc_wmb();
|
||||
half = (flip[img] << 8) | flip[msk];
|
||||
REGWRITE32(curs, bt_ram, half);
|
||||
}
|
||||
bcnt += 2;
|
||||
}
|
||||
/* pad unoccupied scan lines */
|
||||
while (bcnt < CURSOR_MAX_SIZE * 16) {
|
||||
HALF(curs, bt_ram) = 0;
|
||||
tc_wmb();
|
||||
REGWRITE32(curs, bt_ram, 0);
|
||||
bcnt += 2;
|
||||
}
|
||||
}
|
||||
@ -680,9 +659,9 @@ tfbintr(arg)
|
||||
|
||||
SELECT463(vdac, BT463_IREG_CPALETTE_RAM);
|
||||
for (index = 0; index < CMAP_SIZE; index++) {
|
||||
BYTE(vdac, bt_cmap) = cm->r[index];
|
||||
BYTE(vdac, bt_cmap) = cm->g[index];
|
||||
BYTE(vdac, bt_cmap) = cm->b[index];
|
||||
REGWRITE32(vdac, bt_cmap, cm->r[index]);
|
||||
REGWRITE32(vdac, bt_cmap, cm->g[index]);
|
||||
REGWRITE32(vdac, bt_cmap, cm->b[index]);
|
||||
}
|
||||
}
|
||||
sc->sc_changed = 0;
|
||||
@ -703,19 +682,19 @@ tfbhwinit(tfbbase)
|
||||
vdac = tfbbase + TX_BT463_OFFSET;
|
||||
curs = tfbbase + TX_BT431_OFFSET;
|
||||
SELECT463(vdac, BT463_IREG_COMMAND_0);
|
||||
BYTE(vdac, bt_reg) = 0x40; tc_wmb(); /* CMD 0 */
|
||||
BYTE(vdac, bt_reg) = 0x46; tc_wmb(); /* CMD 1 */
|
||||
BYTE(vdac, bt_reg) = 0xc0; tc_wmb(); /* CMD 2 */
|
||||
BYTE(vdac, bt_reg) = 0; tc_wmb(); /* !? 204 !? */
|
||||
BYTE(vdac, bt_reg) = 0xff; tc_wmb(); /* plane 0:7 */
|
||||
BYTE(vdac, bt_reg) = 0xff; tc_wmb(); /* plane 8:15 */
|
||||
BYTE(vdac, bt_reg) = 0xff; tc_wmb(); /* plane 16:23 */
|
||||
BYTE(vdac, bt_reg) = 0xff; tc_wmb(); /* plane 24:27 */
|
||||
BYTE(vdac, bt_reg) = 0x00; tc_wmb(); /* blink 0:7 */
|
||||
BYTE(vdac, bt_reg) = 0x00; tc_wmb(); /* blink 8:15 */
|
||||
BYTE(vdac, bt_reg) = 0x00; tc_wmb(); /* blink 16:23 */
|
||||
BYTE(vdac, bt_reg) = 0x00; tc_wmb(); /* blink 24:27 */
|
||||
BYTE(vdac, bt_reg) = 0x00; tc_wmb();
|
||||
REGWRITE32(vdac, bt_reg, 0x40); /* CMD 0 */
|
||||
REGWRITE32(vdac, bt_reg, 0x46); /* CMD 1 */
|
||||
REGWRITE32(vdac, bt_reg, 0xc0); /* CMD 2 */
|
||||
REGWRITE32(vdac, bt_reg, 0); /* !? 204 !? */
|
||||
REGWRITE32(vdac, bt_reg, 0xff); /* plane 0:7 */
|
||||
REGWRITE32(vdac, bt_reg, 0xff); /* plane 8:15 */
|
||||
REGWRITE32(vdac, bt_reg, 0xff); /* plane 16:23 */
|
||||
REGWRITE32(vdac, bt_reg, 0xff); /* plane 24:27 */
|
||||
REGWRITE32(vdac, bt_reg, 0x00); /* blink 0:7 */
|
||||
REGWRITE32(vdac, bt_reg, 0x00); /* blink 8:15 */
|
||||
REGWRITE32(vdac, bt_reg, 0x00); /* blink 16:23 */
|
||||
REGWRITE32(vdac, bt_reg, 0x00); /* blink 24:27 */
|
||||
REGWRITE32(vdac, bt_reg, 0x00);
|
||||
|
||||
#if 0 /* XXX ULTRIX does initialize 16 entry window type here XXX */
|
||||
{
|
||||
@ -735,37 +714,37 @@ tfbhwinit(tfbbase)
|
||||
SELECT463(vdac, BT463_IREG_CPALETTE_RAM);
|
||||
p = rasops_cmap;
|
||||
for (i = 0; i < 256; i++, p += 3) {
|
||||
BYTE(vdac, bt_cmap) = p[0]; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = p[1]; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = p[2]; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, p[0]);
|
||||
REGWRITE32(vdac, bt_cmap, p[1]);
|
||||
REGWRITE32(vdac, bt_cmap, p[2]);
|
||||
}
|
||||
|
||||
/* !? Eeeh !? */
|
||||
SELECT463(vdac, 0x0100 /* BT463_IREG_CURSOR_COLOR_0 */);
|
||||
for (i = 0; i < 256; i++) {
|
||||
BYTE(vdac, bt_cmap) = i; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = i; tc_wmb();
|
||||
BYTE(vdac, bt_cmap) = i; tc_wmb();
|
||||
REGWRITE32(vdac, bt_cmap, i);
|
||||
REGWRITE32(vdac, bt_cmap, i);
|
||||
REGWRITE32(vdac, bt_cmap, i);
|
||||
}
|
||||
|
||||
SELECT431(curs, BT431_REG_COMMAND);
|
||||
HALF(curs, bt_ctl) = 0x0404; tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* YLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* YHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XWLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* XWHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WYLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WYLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WWLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WWHI */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WHLO */ tc_wmb();
|
||||
HALF(curs, bt_ctl) = 0; /* WHHI */ tc_wmb();
|
||||
REGWRITE32(curs, bt_ctl, 0x0404);
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* YLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* YHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XWLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* XWHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WYLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WYLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WWLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WWHI */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WHLO */
|
||||
REGWRITE32(curs, bt_ctl, 0); /* WHHI */
|
||||
|
||||
SELECT431(curs, BT431_REG_CRAM_BASE);
|
||||
for (i = 0; i < 512; i++) {
|
||||
HALF(curs, bt_ram) = 0; tc_wmb();
|
||||
REGWRITE32(curs, bt_ram, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xcfb.c,v 1.35 2003/12/17 03:59:33 ad Exp $ */
|
||||
/* $NetBSD: xcfb.c,v 1.36 2003/12/20 07:10:01 nisimura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xcfb.c,v 1.35 2003/12/17 03:59:33 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xcfb.c,v 1.36 2003/12/20 07:10:01 nisimura Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -96,17 +96,17 @@ struct xcfb_softc {
|
||||
int sc_csr; /* software copy of IMS332 CSR A */
|
||||
};
|
||||
|
||||
static int xcfbmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void xcfbattach __P((struct device *, struct device *, void *));
|
||||
static int xcfbmatch(struct device *, struct cfdata *, void *);
|
||||
static void xcfbattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(xcfb, sizeof(struct xcfb_softc),
|
||||
xcfbmatch, xcfbattach, NULL, NULL);
|
||||
|
||||
static tc_addr_t xcfb_consaddr;
|
||||
static struct rasops_info xcfb_console_ri;
|
||||
static void xcfb_common_init __P((struct rasops_info *));
|
||||
static void xcfbhwinit __P((caddr_t));
|
||||
int xcfb_cnattach __P((void));
|
||||
static void xcfb_common_init(struct rasops_info *);
|
||||
static void xcfbhwinit(caddr_t);
|
||||
int xcfb_cnattach(void);
|
||||
|
||||
struct wsscreen_descr xcfb_stdscreen = {
|
||||
"std", 0, 0,
|
||||
@ -123,14 +123,14 @@ static const struct wsscreen_list xcfb_screenlist = {
|
||||
sizeof(_xcfb_scrlist) / sizeof(struct wsscreen_descr *), _xcfb_scrlist
|
||||
};
|
||||
|
||||
static int xcfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
|
||||
static paddr_t xcfbmmap __P((void *, off_t, int));
|
||||
static int xcfbioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
static paddr_t xcfbmmap(void *, off_t, int);
|
||||
|
||||
static int xcfb_alloc_screen __P((void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *));
|
||||
static void xcfb_free_screen __P((void *, void *));
|
||||
static int xcfb_show_screen __P((void *, void *, int,
|
||||
void (*) (void *, int, int), void *));
|
||||
static int xcfb_alloc_screen(void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *);
|
||||
static void xcfb_free_screen(void *, void *);
|
||||
static int xcfb_show_screen(void *, void *, int,
|
||||
void (*) (void *, int, int), void *);
|
||||
|
||||
static const struct wsdisplay_accessops xcfb_accessops = {
|
||||
xcfbioctl,
|
||||
@ -141,21 +141,21 @@ static const struct wsdisplay_accessops xcfb_accessops = {
|
||||
0 /* load_font */
|
||||
};
|
||||
|
||||
static int xcfbintr __P((void *));
|
||||
static void xcfb_screenblank __P((struct xcfb_softc *));
|
||||
static void xcfb_cmap_init __P((struct xcfb_softc *));
|
||||
static int set_cmap __P((struct xcfb_softc *, struct wsdisplay_cmap *));
|
||||
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 *));
|
||||
static void ims332_loadcmap __P((struct hwcmap256 *));
|
||||
static void ims332_set_curpos __P((struct xcfb_softc *));
|
||||
static void ims332_load_curcmap __P((struct xcfb_softc *));
|
||||
static void ims332_load_curshape __P((struct xcfb_softc *));
|
||||
static void ims332_write_reg __P((int, u_int32_t));
|
||||
static int xcfbintr(void *);
|
||||
static void xcfb_screenblank(struct xcfb_softc *);
|
||||
static void xcfb_cmap_init(struct xcfb_softc *);
|
||||
static int set_cmap(struct xcfb_softc *, struct wsdisplay_cmap *);
|
||||
static int get_cmap(struct xcfb_softc *, struct wsdisplay_cmap *);
|
||||
static int set_cursor(struct xcfb_softc *, struct wsdisplay_cursor *);
|
||||
static int get_cursor(struct xcfb_softc *, struct wsdisplay_cursor *);
|
||||
static void set_curpos(struct xcfb_softc *, struct wsdisplay_curpos *);
|
||||
static void ims332_loadcmap(struct hwcmap256 *);
|
||||
static void ims332_set_curpos(struct xcfb_softc *);
|
||||
static void ims332_load_curcmap(struct xcfb_softc *);
|
||||
static void ims332_load_curshape(struct xcfb_softc *);
|
||||
static void ims332_write_reg(int, u_int32_t);
|
||||
#if 0
|
||||
static u_int32_t ims332_read_reg __P((int));
|
||||
static u_int32_t ims332_read_reg(int);
|
||||
#endif
|
||||
|
||||
extern long ioasic_base; /* XXX */
|
||||
@ -345,10 +345,11 @@ static void
|
||||
xcfbhwinit(base)
|
||||
caddr_t base;
|
||||
{
|
||||
u_int32_t *csr, i;
|
||||
volatile u_int32_t *csr;
|
||||
u_int32_t i;
|
||||
const u_int8_t *p;
|
||||
|
||||
csr = (u_int32_t *)(base + IOASIC_CSR);
|
||||
csr = (volatile u_int32_t *)(base + IOASIC_CSR);
|
||||
i = *csr;
|
||||
i &= ~XINE_CSR_VDAC_ENABLE;
|
||||
*csr = i;
|
||||
@ -535,7 +536,7 @@ xcfb_show_screen(v, cookie, waitok, cb, cbarg)
|
||||
void *v;
|
||||
void *cookie;
|
||||
int waitok;
|
||||
void (*cb) __P((void *, int, int));
|
||||
void (*cb)(void *, int, int);
|
||||
void *cbarg;
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user