Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sbus Added:



details:   https://anonhg.NetBSD.org/src/rev/758de5b06f58
branches:  trunk
changeset: 580933:758de5b06f58
user:      macallan <macallan%NetBSD.org@localhost>
date:      Mon May 16 14:43:23 2005 +0000

description:
Added:
- wscons support
- acceleration
- virtual consoles
- colour
- made cg3 emulation optional for native XFree driver

diffstat:

 sys/dev/sbus/files.sbus |     4 +-
 sys/dev/sbus/p9100.c    |  1071 +++++++++++++++++++++++++++++++++++++++++++---
 sys/dev/sbus/p9100reg.h |   168 +++++++
 3 files changed, 1167 insertions(+), 76 deletions(-)

diffs (truncated from 1440 to 300 lines):

diff -r 732d65629bf0 -r 758de5b06f58 sys/dev/sbus/files.sbus
--- a/sys/dev/sbus/files.sbus   Mon May 16 14:29:11 2005 +0000
+++ b/sys/dev/sbus/files.sbus   Mon May 16 14:43:23 2005 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sbus,v 1.20 2005/02/27 00:27:48 perry Exp $
+#      $NetBSD: files.sbus,v 1.21 2005/05/16 14:43:23 macallan Exp $
 #
 # Config file and device description for machine-independent SBUS code.
 # Included by ports that need it.
@@ -121,6 +121,6 @@
 file   dev/sbus/zx.c                   zx
 
 # Tadpole 3GX/3GS (P9100 -- P Nine One Zero Zero -> pnozz)
-device pnozz: fb, bt_dac, rasops8, rasops16, rasops32
+device pnozz: fb, bt_dac, rasops8, rasops16, rasops32, wsemuldisplaydev
 attach pnozz at sbus
 file   dev/sbus/p9100.c                pnozz needs-flag
diff -r 732d65629bf0 -r 758de5b06f58 sys/dev/sbus/p9100.c
--- a/sys/dev/sbus/p9100.c      Mon May 16 14:29:11 2005 +0000
+++ b/sys/dev/sbus/p9100.c      Mon May 16 14:43:23 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: p9100.c,v 1.20 2005/02/27 00:27:48 perry Exp $ */
+/*     $NetBSD: p9100.c,v 1.21 2005/05/16 14:43:23 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.20 2005/02/27 00:27:48 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.21 2005/05/16 14:43:23 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -64,12 +64,18 @@
 #include <dev/sun/fbvar.h>
 #include <dev/sun/btreg.h>
 #include <dev/sun/btvar.h>
-#if 0
+
 #include <dev/sbus/p9100reg.h>
-#endif
 
 #include <dev/sbus/sbusvar.h>
 
+/*#include <dev/wscons/wsdisplayvar.h>*/
+#include <dev/wscons/wsconsio.h>
+#include <dev/wsfont/wsfont.h>
+#include <dev/rasops/rasops.h>
+
+#include "opt_wsemul.h"
+
 #include "tctrl.h"
 #if NTCTRL > 0
 #include <machine/tctrl.h>
@@ -96,24 +102,66 @@
        bus_space_handle_t sc_fb_memh;  /*   bus space handle */
 
        uint32_t sc_junk;
+       uint32_t sc_mono_width; /* for setup_mono */
+       
+       uint32_t sc_width;
+       uint32_t sc_height;     /* panel width / height */
+       uint32_t sc_stride;
+       uint32_t sc_depth;
+       union   bt_cmap sc_cmap;        /* Brooktree color map */
 
-       union   bt_cmap sc_cmap;        /* Brooktree color map */
+#ifdef PNOZZ_SOFT_PUTCHAR
+       void (*putchar)(void *c, int row, int col, u_int uc, long attr);
+#endif
+       int sc_mode;
+       uint32_t sc_bg;
+       void (*switchcb)(void *, int, int);
+       void *switchcbarg;
+       struct callout switch_callout;
+       LIST_HEAD(, p9100_screen) screens;
+       struct p9100_screen *active, *wanted;
+       const struct wsscreen_descr *currenttype;
+
 };
 
-/* The Tadpole 3GX Technical Reference Manual lies.  The ramdac registers
- * are map in 4 byte increments, not 8.
- */
-#define        SCRN_RPNT_CTL_1 0x0138  /* Screen Respaint Timing Control 1 */
-#define        VIDEO_ENABLED   0x00000020
-#define        PWRUP_CNFG      0x0194  /* Power Up Configuration */
-#define        DAC_CMAP_WRIDX  0x0200  /* IBM RGB528 Palette Address (Write) */
-#define        DAC_CMAP_DATA   0x0204  /* IBM RGB528 Palette Data */
-#define        DAC_PXL_MASK    0x0208  /* IBM RGB528 Pixel Mask */
-#define        DAC_CMAP_RDIDX  0x020c  /* IBM RGB528 Palette Address (Read) */
-#define        DAC_INDX_LO     0x0210  /* IBM RGB528 Index Low */
-#define        DAC_INDX_HI     0x0214  /* IBM RGB528 Index High */
-#define        DAC_INDX_DATA   0x0218  /* IBM RGB528 Index Data (Indexed Registers) */
-#define        DAC_INDX_CTL    0x021c  /* IBM RGB528 Index Control */
+struct p9100_screen {
+       struct rasops_info ri;
+       LIST_ENTRY(p9100_screen) next;
+       struct p9100_softc *sc;
+       const struct wsscreen_descr *type;
+       int active;
+       u_int16_t *chars;
+       long *attrs;
+       int dispoffset;
+       int mindispoffset;
+       int maxdispoffset;
+
+       int cursoron;
+       int cursorcol;
+       int cursorrow;
+       int cursordrawn;
+};
+
+static struct p9100_screen p9100_console_screen;
+
+extern const u_char rasops_cmap[768];
+
+struct wsscreen_descr p9100_defscreendesc = {
+       "default",
+       0, 0,
+       NULL,
+       8, 16,
+       WSSCREEN_WSCOLORS,
+};
+
+const struct wsscreen_descr *_p9100_scrlist[] = {
+       &p9100_defscreendesc,
+       /* XXX other formats, graphics screen? */
+};
+
+struct wsscreen_list p9100_screenlist = {
+       sizeof(_p9100_scrlist) / sizeof(struct wsscreen_descr *), _p9100_scrlist
+};
 
 /* autoconfiguration driver */
 static int     p9100_sbus_match(struct device *, struct cfdata *, void *);
@@ -142,15 +190,70 @@
        p9100mmap, nokqfilter
 };
 
-static void p9100loadcmap(struct p9100_softc *, int, int);
-static void p9100_set_video(struct p9100_softc *, int);
-static int p9100_get_video(struct p9100_softc *);
+static void    p9100loadcmap(struct p9100_softc *, int, int);
+static void    p9100_set_video(struct p9100_softc *, int);
+static int     p9100_get_video(struct p9100_softc *);
 static uint32_t p9100_ctl_read_4(struct p9100_softc *, bus_size_t);
-static void p9100_ctl_write_4(struct p9100_softc *, bus_size_t, uint32_t);
-#if 0
-static uint8_t p9100_ramdac_read(struct p9100_softc *, bus_size_t);
-#endif
-static void p9100_ramdac_write(struct p9100_softc *, bus_size_t, uint8_t);
+static void    p9100_ctl_write_4(struct p9100_softc *, bus_size_t, uint32_t);
+uint8_t                p9100_ramdac_read(struct p9100_softc *, bus_size_t);
+void           p9100_ramdac_write(struct p9100_softc *, bus_size_t, uint8_t);
+
+static void    p9100_sync(struct p9100_softc *);
+void           p9100_bitblt(struct p9100_softc *, int, int, int, int, int, int,                    uint32_t);  /* coordinates, rasop */
+void           p9100_rectfill(struct p9100_softc *, int, int, int, int, 
+                   uint32_t);  /* coordinates, colour */
+static void    p9100_init_engine(struct p9100_softc *);
+void           p9100_setup_mono(struct p9100_softc *, int, int, int, int, 
+                   uint32_t, uint32_t); 
+void           p9100_feed_line(struct p9100_softc *, int, uint8_t *);
+static void    p9100_set_color_reg(struct p9100_softc *, int, int32_t);
+
+void   p9100_cursor(void *, int, int, int);
+int    p9100_mapchar(void *, int, u_int *);
+void   p9100_putchar(void *, int, int, u_int, long);
+void   p9100_copycols(void *, int, int, int, int);
+void   p9100_erasecols(void *, int, int, int, long);
+void   p9100_copyrows(void *, int, int, int);
+void   p9100_eraserows(void *, int, int, long);
+int    p9100_allocattr(void *, int, int, int, long *);
+
+void   p9100_scroll(void *, void *, int);
+
+int    p9100_putcmap(struct p9100_softc *, struct wsdisplay_cmap *);
+int    p9100_getcmap(struct p9100_softc *, struct wsdisplay_cmap *);
+int    p9100_ioctl(void *, u_long, caddr_t, int, struct proc *);
+paddr_t        p9100_mmap(void *, off_t, int);
+int    p9100_alloc_screen(void *, const struct wsscreen_descr *, void **, 
+           int *, int *, long *);
+void   p9100_free_screen(void *, void *);
+int    p9100_show_screen(void *, void *, int, void (*)(void *, int, int),
+           void *);
+void   p9100_switch_screen(struct p9100_softc *);
+void   p9100_restore_screen(struct p9100_screen *, 
+           const struct wsscreen_descr *, u_int16_t *);
+void   p9100_clearscreen(struct p9100_softc *);
+               
+int    p9100_load_font(void *, void *, struct wsdisplay_font *);
+
+void   p9100_init_screen(struct p9100_softc *, struct p9100_screen *, int, 
+           long *);
+
+int    p9100_intr(void *);
+
+struct wsdisplay_accessops p9100_accessops = {
+       p9100_ioctl,
+       p9100_mmap,
+       p9100_alloc_screen,
+       p9100_free_screen,
+       p9100_show_screen,
+       NULL,   /* load_font */
+       NULL,   /* polls */
+       NULL,   /* getwschar */
+       NULL,   /* putwschar */
+       NULL,   /* scroll */
+       NULL,   /* getborder */
+       NULL    /* setborder */
+};
 
 /*
  * Match a p9100.
@@ -175,13 +278,19 @@
        struct fbdevice *fb = &sc->sc_fb;
        int isconsole;
        int node;
-       int i;
+       int i, j;
+
+#if NWSDISPLAY > 0
+       struct wsemuldisplaydev_attach_args aa;
+       struct rasops_info *ri;
+       unsigned long defattr;
+#endif
 
        /* Remember cookies for p9100_mmap() */
        sc->sc_bustag = sa->sa_bustag;
        sc->sc_ctl_paddr = sbus_bus_addr(sa->sa_bustag,
                sa->sa_reg[0].oa_space, sa->sa_reg[0].oa_base);
-       sc->sc_ctl_psize = (bus_size_t)sa->sa_reg[0].oa_size;
+       sc->sc_ctl_psize = 0x8000;/*(bus_size_t)sa->sa_reg[0].oa_size;*/
 
        sc->sc_cmd_paddr = sbus_bus_addr(sa->sa_bustag,
                sa->sa_reg[1].oa_space, sa->sa_reg[1].oa_base);
@@ -194,13 +303,28 @@
        fb->fb_driver = &p9100fbdriver;
        fb->fb_device = &sc->sc_dev;
        fb->fb_flags = sc->sc_dev.dv_cfdata->cf_flags & FB_USERMASK;
+#ifdef PNOZZ_EMUL_CG3
        fb->fb_type.fb_type = FBTYPE_SUN3COLOR;
+#else
+       fb->fb_type.fb_type = FBTYPE_P9100;
+#endif
        fb->fb_pixels = NULL;
+       
+       sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
+#ifdef PNOZZ_SOFT_PUTCHAR
+       sc->putchar = NULL;
+#endif
+
+       LIST_INIT(&sc->screens);
+       sc->active = NULL;
+       sc->currenttype = &p9100_defscreendesc;
+       callout_init(&sc->switch_callout);
 
        node = sa->sa_node;
        isconsole = fb_is_console(node);
        if (!isconsole) {
-               printf("\n%s: fatal error: PROM didn't configure device: not console\n", self->dv_xname);
+               printf("\n%s: fatal error: PROM didn't configure device\n", 
+                   self->dv_xname);
                return;
        }
 
@@ -213,21 +337,16 @@
        if (sbus_bus_map(sc->sc_bustag,
                         sa->sa_reg[0].oa_space,
                         sa->sa_reg[0].oa_base,
-                        sc->sc_ctl_psize,
+                        /* 
+                         * XXX for some reason the SBus resources don't cover 
+                         * all registers, so we just map what we need 
+                         */
+                        /*sc->sc_ctl_psize*/ 0x8000,
                         BUS_SPACE_MAP_LINEAR, &sc->sc_ctl_memh) != 0) {
                printf("%s: cannot map control registers\n", self->dv_xname);
                return;
        }
 
-       if (sbus_bus_map(sc->sc_bustag,
-                        sa->sa_reg[1].oa_space,
-                        sa->sa_reg[1].oa_base,
-                        sc->sc_cmd_psize,
-                        BUS_SPACE_MAP_LINEAR, &sc->sc_cmd_memh) != 0) {
-               printf("%s: cannot map command registers\n", self->dv_xname);
-               return;
-       }
-
        if (sa->sa_npromvaddrs != 0)
                fb->fb_pixels = (caddr_t)sa->sa_promvaddrs[0];
 
@@ -255,21 +374,42 @@
                panic("pnozz: can't determine screen depth (0x%02x)", i);
            }
        }



Home | Main Index | Thread Index | Old Index