Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev Map the ffb's DAC register space and ad...
details: https://anonhg.NetBSD.org/src/rev/ca15a16c6ce0
branches: trunk
changeset: 566841:ca15a16c6ce0
user: heas <heas%NetBSD.org@localhost>
date: Fri May 21 21:45:04 2004 +0000
description:
Map the ffb's DAC register space and add support for video "blanking"
(aka WSDISPLAYIO_{S,G}VIDEO).
diffstat:
sys/arch/sparc64/dev/ffb.c | 42 ++++++++++++++++++++++++++++++++++++-
sys/arch/sparc64/dev/ffb_mainbus.c | 29 +++++++++++++++++---------
sys/arch/sparc64/dev/ffbreg.h | 16 +++++++++++++-
sys/arch/sparc64/dev/ffbvar.h | 7 +++++-
4 files changed, 80 insertions(+), 14 deletions(-)
diffs (207 lines):
diff -r fd0c6e21f132 -r ca15a16c6ce0 sys/arch/sparc64/dev/ffb.c
--- a/sys/arch/sparc64/dev/ffb.c Fri May 21 21:18:57 2004 +0000
+++ b/sys/arch/sparc64/dev/ffb.c Fri May 21 21:45:04 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffb.c,v 1.6 2004/05/21 19:21:31 heas Exp $ */
+/* $NetBSD: ffb.c,v 1.7 2004/05/21 21:45:04 heas Exp $ */
/* $OpenBSD: creator.c,v 1.20 2002/07/30 19:48:15 jason Exp $ */
/*
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.6 2004/05/21 19:21:31 heas Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.7 2004/05/21 21:45:04 heas Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -75,6 +75,7 @@
int ffb_ioctl(void *, u_long, caddr_t, int, struct proc *);
int ffb_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
+static int ffb_blank(struct ffb_softc *, u_long, u_int *);
void ffb_free_screen(void *, void *);
int ffb_show_screen(void *, void *, int, void (*cb)(void *, int, int),
void *);
@@ -108,6 +109,7 @@
char *model;
int btype;
int maxrow, maxcol;
+ u_int blank = WSDISPLAYIO_VIDEO_ON;
char buf[6+1];
printf(":");
@@ -164,6 +166,8 @@
ffb_stdscreen.ncols = sc->sc_rasops.ri_cols;
ffb_stdscreen.textops = &sc->sc_rasops.ri_ops;
+ ffb_blank(sc, WSDISPLAYIO_SVIDEO, &blank);
+
if (sc->sc_console) {
int *ccolp, *crowp;
long defattr;
@@ -234,6 +238,8 @@
case WSDISPLAYIO_SVIDEO:
case WSDISPLAYIO_GVIDEO:
+ return(ffb_blank(sc, cmd, (u_int *)data));
+ break;
case WSDISPLAYIO_GCURPOS:
case WSDISPLAYIO_SCURPOS:
case WSDISPLAYIO_GCURMAX:
@@ -269,6 +275,38 @@
return (0);
}
+/* blank/unblank the screen */
+static int
+ffb_blank(struct ffb_softc *sc, u_long cmd, u_int *data)
+{
+ u_int val;
+
+ DAC_WRITE(sc, FFB_DAC_TYPE, FFB_DAC_GSBLANK);
+ val = DAC_READ(sc, FFB_DAC_VALUE);
+
+ switch (cmd) {
+ case WSDISPLAYIO_GVIDEO:
+ *data = val & 1;
+ return(0);
+ break;
+ case WSDISPLAYIO_SVIDEO:
+ if (*data == WSDISPLAYIO_VIDEO_OFF)
+ val &= ~1;
+ else if (*data == WSDISPLAYIO_VIDEO_ON)
+ val |= 1;
+ else
+ return(EINVAL);
+ break;
+ default:
+ return(EINVAL);
+ }
+
+ DAC_WRITE(sc, FFB_DAC_TYPE, FFB_DAC_GSBLANK);
+ DAC_WRITE(sc, FFB_DAC_VALUE, val);
+
+ return(0);
+}
+
void
ffb_free_screen(v, cookie)
void *v;
diff -r fd0c6e21f132 -r ca15a16c6ce0 sys/arch/sparc64/dev/ffb_mainbus.c
--- a/sys/arch/sparc64/dev/ffb_mainbus.c Fri May 21 21:18:57 2004 +0000
+++ b/sys/arch/sparc64/dev/ffb_mainbus.c Fri May 21 21:45:04 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffb_mainbus.c,v 1.3 2004/03/19 21:10:31 petrov Exp $ */
+/* $NetBSD: ffb_mainbus.c,v 1.4 2004/05/21 21:45:04 heas Exp $ */
/* $OpenBSD: creator_mainbus.c,v 1.4 2002/07/26 16:39:04 jason Exp $ */
/*
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffb_mainbus.c,v 1.3 2004/03/19 21:10:31 petrov Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffb_mainbus.c,v 1.4 2004/05/21 21:45:04 heas Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -104,7 +104,14 @@
if (bus_space_map(sc->sc_bt, ma->ma_reg[FFB_REG_FBC].ur_paddr,
ma->ma_reg[FFB_REG_FBC].ur_len, 0, &sc->sc_fbc_h)) {
printf(": failed to map fbc\n");
- goto fail;
+ goto unmap_dfb24;
+ }
+
+ if (bus_space_map(sc->sc_bt, ma->ma_reg[FFB_REG_DAC].ur_paddr,
+ ma->ma_reg[FFB_REG_DAC].ur_len, BUS_SPACE_MAP_LINEAR,
+ &sc->sc_dac_h)) {
+ printf(": failed to map dac\n");
+ goto unmap_fbc;
}
for (i = 0; i < nregs; i++) {
@@ -123,14 +130,16 @@
return;
-fail:
-#if 0
- if (sc->sc_fbc_h != 0)
- bus_space_unmap(sc->sc_bt, sc->sc_fbc_h,
+#if notyet
+unmap_dac:
+ bus_space_unmap(sc->sc_bt, sc->sc_dac_h,
+ ma->ma_reg[FFB_REG_DAC].ur_len);
+#endif
+unmap_fbc:
+ bus_space_unmap(sc->sc_bt, sc->sc_fbc_h,
ma->ma_reg[FFB_REG_FBC].ur_len);
-#endif
-/* if (sc->sc_pixel_h != 0) */
- bus_space_unmap(sc->sc_bt, sc->sc_pixel_h,
+unmap_dfb24:
+ bus_space_unmap(sc->sc_bt, sc->sc_pixel_h,
ma->ma_reg[FFB_REG_DFB24].ur_len);
fail1:
return;
diff -r fd0c6e21f132 -r ca15a16c6ce0 sys/arch/sparc64/dev/ffbreg.h
--- a/sys/arch/sparc64/dev/ffbreg.h Fri May 21 21:18:57 2004 +0000
+++ b/sys/arch/sparc64/dev/ffbreg.h Fri May 21 21:45:04 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffbreg.h,v 1.2 2004/05/20 01:50:43 heas Exp $ */
+/* $NetBSD: ffbreg.h,v 1.3 2004/05/21 21:45:04 heas Exp $ */
/* $OpenBSD: creatorreg.h,v 1.5 2002/07/29 06:21:45 jason Exp $ */
/*
@@ -58,6 +58,20 @@
#define FFB_DAC_TYPE2 0x8
#define FFB_DAC_VALUE2 0xc
+/* DAC "TYPE" commands */
+#define FFB_DAC_SCMAP 0x2000 /* set (load) cmap */
+#define FFB_DAC_GSBLANK 0x6000 /* get/set blanking */
+#define FFB_DAC_GVERS 0x8000 /* get DAC version */
+
+#define FFB_DAC_BLANK_OFF 0x1
+#define FFB_DAC_BLANK_HSYNC_DISABLE 0x4
+#define FFB_DAC_BLANK_VSYNC_DISABLE 0x8
+
+/* DAC "TYPE2" commands */
+#define FFB_DAC_CURSENAB 0x100 /* cursor enable */
+#define FFB_DAC_CURSECMAP 0x102 /* set cursor colormap */
+#define FFB_DAC_CURSEPOS 0x104 /* set cursor position */
+
#define FFB_FBC_ALPHA 0x00c
#define FFB_FBC_RED 0x010
#define FFB_FBC_GREEN 0x014
diff -r fd0c6e21f132 -r ca15a16c6ce0 sys/arch/sparc64/dev/ffbvar.h
--- a/sys/arch/sparc64/dev/ffbvar.h Fri May 21 21:18:57 2004 +0000
+++ b/sys/arch/sparc64/dev/ffbvar.h Fri May 21 21:45:04 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffbvar.h,v 1.1 2003/05/23 06:51:16 petrov Exp $ */
+/* $NetBSD: ffbvar.h,v 1.2 2004/05/21 21:45:04 heas Exp $ */
/* $OpenBSD: creatorvar.h,v 1.6 2002/07/30 19:48:15 jason Exp $ */
/*
@@ -42,6 +42,7 @@
struct device sc_dv;
bus_space_tag_t sc_bt;
bus_space_handle_t sc_pixel_h;
+ bus_space_handle_t sc_dac_h;
bus_space_handle_t sc_fbc_h;
bus_addr_t sc_addrs[FFB_NREGS];
bus_size_t sc_sizes[FFB_NREGS];
@@ -55,6 +56,10 @@
int32_t sc_fifo_cache, sc_fg_cache;
};
+#define DAC_WRITE(sc,r,v) \
+ bus_space_write_4((sc)->sc_bt, (sc)->sc_dac_h, (r), (v))
+#define DAC_READ(sc,r) \
+ bus_space_read_4((sc)->sc_bt, (sc)->sc_dac_h, (r))
#define FBC_WRITE(sc,r,v) \
bus_space_write_4((sc)->sc_bt, (sc)->sc_fbc_h, (r), (v))
#define FBC_READ(sc,r) \
Home |
Main Index |
Thread Index |
Old Index