Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips add ioctl, mmap.



details:   https://anonhg.NetBSD.org/src/rev/467a22f693fb
branches:  trunk
changeset: 485659:467a22f693fb
user:      uch <uch%NetBSD.org@localhost>
date:      Tue May 02 17:50:51 2000 +0000

description:
add ioctl, mmap.
hpcfb directly attach to tx3912video and plumvideo. (no longer use bivideo)
XXX CLUT

diffstat:

 sys/arch/hpcmips/conf/TX3922        |    5 +-
 sys/arch/hpcmips/conf/files.hpcmips |    6 +-
 sys/arch/hpcmips/dev/plumvideo.c    |  257 +++++++++++++++++++++++++++++------
 sys/arch/hpcmips/dev/plumvideoreg.h |   36 ++--
 sys/arch/hpcmips/tx/tx3912video.c   |  223 ++++++++++++++++++++++++++-----
 5 files changed, 424 insertions(+), 103 deletions(-)

diffs (truncated from 768 to 300 lines):

diff -r b0205d228a4d -r 467a22f693fb sys/arch/hpcmips/conf/TX3922
--- a/sys/arch/hpcmips/conf/TX3922      Tue May 02 17:45:15 2000 +0000
+++ b/sys/arch/hpcmips/conf/TX3922      Tue May 02 17:50:51 2000 +0000
@@ -1,7 +1,7 @@
 #
 # Distribution kernel (TOSHIBA TX3922 based model) kernel config file
 #
-#      $NetBSD: TX3922,v 1.17 2000/04/27 19:38:24 uch Exp $
+#      $NetBSD: TX3922,v 1.18 2000/05/02 17:50:52 uch Exp $
 #
 include                "arch/hpcmips/conf/std.hpcmips"
 
@@ -217,8 +217,7 @@
 ukphy* at mii? phy ?                   # generic unknown PHYs
 
 # WS console uses SUN or VT100 terminal emulation
-bivideo*       at plumvideo?
-hpcfb*         at bivideo?
+hpcfb*         at plumvideo?
 wsdisplay*     at hpcfb?
 wskbd*         at skbd? mux 1
 btnmgr0                at mainbus0
diff -r b0205d228a4d -r 467a22f693fb sys/arch/hpcmips/conf/files.hpcmips
--- a/sys/arch/hpcmips/conf/files.hpcmips       Tue May 02 17:45:15 2000 +0000
+++ b/sys/arch/hpcmips/conf/files.hpcmips       Tue May 02 17:50:51 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hpcmips,v 1.29 2000/03/25 15:08:26 uch Exp $
+#      $NetBSD: files.hpcmips,v 1.30 2000/05/02 17:50:52 uch Exp $
 
 # maxpartitions must be first item in files.${ARCH}.
 maxpartitions 8
@@ -212,7 +212,7 @@
 attach tx39clock at txsim
 file arch/hpcmips/tx/tx39clock.c       tx39clock
 
-device tx3912video: mainbus    # XXX crazy XXX
+device tx3912video: hpcfbif
 attach tx3912video at txsim
 file arch/hpcmips/tx/tx3912video.c     tx3912video
 
@@ -298,7 +298,7 @@
 attach plumpower at plumif
 file arch/hpcmips/dev/plumpower.c      plumpower
 
-device plumvideo: mainbus      # XXX crazy XXX
+device plumvideo: hpcfbif
 attach plumvideo at plumif
 file arch/hpcmips/dev/plumvideo.c      plumvideo
 
diff -r b0205d228a4d -r 467a22f693fb sys/arch/hpcmips/dev/plumvideo.c
--- a/sys/arch/hpcmips/dev/plumvideo.c  Tue May 02 17:45:15 2000 +0000
+++ b/sys/arch/hpcmips/dev/plumvideo.c  Tue May 02 17:50:51 2000 +0000
@@ -1,32 +1,32 @@
-/*     $NetBSD: plumvideo.c,v 1.6 2000/04/03 03:35:37 sato Exp $ */
+/*     $NetBSD: plumvideo.c,v 1.7 2000/05/02 17:50:51 uch Exp $ */
 
-/*
- * Copyright (c) 1999, 2000, by UCHIYAMA Yasushi
- * All rights reserved.
+/*-
+ * Copyright (c) 1999, 2000 UCHIYAMA Yasushi.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
- * 2. The name of the developer may NOT be used to endorse or promote products
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #include "opt_tx39_debug.h"
-#include "hpcfb.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,13 +45,9 @@
 
 #include <machine/bootinfo.h>
 
-#if NHPCFB > 0
 #include <dev/wscons/wsconsio.h>
 #include <arch/hpcmips/dev/hpcfbvar.h>
 #include <arch/hpcmips/dev/hpcfbio.h>
-#include <arch/hpcmips/dev/bivideovar.h>
-#endif
-#include <machine/autoconf.h> /* XXX */
 
 #ifdef PLUMVIDEODEBUG
 int    plumvideo_debug = 1;
@@ -64,23 +60,33 @@
 
 int    plumvideo_match __P((struct device*, struct cfdata*, void*));
 void   plumvideo_attach __P((struct device*, struct device*, void*));
-int    plumvideo_print __P((void*, const char*));
 
 struct plumvideo_softc {
-       struct  device          sc_dev;
-       plum_chipset_tag_t      sc_pc;
-       bus_space_tag_t         sc_regt;
-       bus_space_handle_t      sc_regh;
-       bus_space_tag_t         sc_iot;
-       bus_space_handle_t      sc_ioh;
+       struct device sc_dev;
+       plum_chipset_tag_t sc_pc;
+       bus_space_tag_t sc_regt;
+       bus_space_handle_t sc_regh;
+       bus_space_tag_t sc_iot;
+       bus_space_handle_t sc_ioh;
+
+       int sc_width;
+       int sc_height;
+       int sc_depth;
+
+       struct hpcfb_fbconf     sc_fbconf;
+       struct hpcfb_dspconf    sc_dspconf;
 };
 
+void   plumvideo_hpcfbinit __P((struct plumvideo_softc *));
+int    plumvideo_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
+int    plumvideo_mmap __P((void *, off_t, int));
+
 struct cfattach plumvideo_ca = {
        sizeof(struct plumvideo_softc), plumvideo_match, plumvideo_attach
 };
 
-struct fb_attach_args {
-       const char *fba_name;
+struct hpcfb_accessops plumvideo_ha = {
+       plumvideo_ioctl, plumvideo_mmap
 };
 
 int    plumvideo_init __P((struct plumvideo_softc*));
@@ -108,12 +114,14 @@
 {
        struct plum_attach_args *pa = aux;
        struct plumvideo_softc *sc = (void*)self;
-       struct mainbus_attach_args ma; /* XXX */
+       struct hpcfb_attach_args ha;
+       int console;
 
        sc->sc_pc       = pa->pa_pc;
        sc->sc_regt     = pa->pa_regt;
        sc->sc_iot      = pa->pa_iot;
 
+       printf(": ");
        /*
         * map register area
         */
@@ -166,23 +174,90 @@
        if (plumvideo_debug)
                plumvideo_dump(sc);
 #endif
+       /* Attach frame buffer device */
+       plumvideo_hpcfbinit(sc);
 
-#if NHPCFB > 0
-       if(!cn_tab && hpcfb_cnattach(0, 0, 0, 0)) {
+       console = cn_tab ? 0 : 1;
+       if(console && hpcfb_cnattach(&sc->sc_fbconf) != 0) {
                panic("plumvideo_attach: can't init fb console");
        }
-       /* Attach frame buffer device */
-       ma.ma_name = "bivideo"; /* XXX */
-       config_found(self, &ma, plumvideo_print);
-#endif
+
+       ha.ha_console = console;
+       ha.ha_accessops = &plumvideo_ha;
+       ha.ha_accessctx = sc;
+       ha.ha_curfbconf = 0;
+       ha.ha_nfbconf = 1;
+       ha.ha_fbconflist = &sc->sc_fbconf;
+       ha.ha_curdspconf = 0;
+       ha.ha_ndspconf = 1;
+       ha.ha_dspconflist = &sc->sc_dspconf;
+
+       config_found(self, &ha, hpcfbprint);
 }
 
-int
-plumvideo_print(aux, pnp)
-       void *aux;
-       const char *pnp;
-{ 
-       return pnp ? QUIET : UNCONF;
+void
+plumvideo_hpcfbinit(sc)
+       struct plumvideo_softc *sc;
+{
+       struct hpcfb_fbconf *fb = &sc->sc_fbconf;
+       vaddr_t fbvaddr = (vaddr_t)sc->sc_ioh;
+       
+       memset(fb, 0, sizeof(struct hpcfb_fbconf));
+       
+       fb->hf_conf_index       = 0;    /* configuration index          */
+       fb->hf_nconfs           = 1;    /* how many configurations      */
+       strcpy(fb->hf_name, "PLUM built-in video");
+                                       /* frame buffer name            */
+       strcpy(fb->hf_conf_name, "LCD");
+                                       /* configuration name           */
+       fb->hf_height           = sc->sc_height;
+       fb->hf_width            = sc->sc_width;
+       fb->hf_baseaddr         = mips_ptob(mips_btop(fbvaddr));
+       fb->hf_offset           = (u_long)fbvaddr - fb->hf_baseaddr;
+                                       /* frame buffer start offset    */
+       fb->hf_bytes_per_line   = (sc->sc_width * sc->sc_depth) / NBBY;
+       fb->hf_nplanes          = 1;
+       fb->hf_bytes_per_plane  = sc->sc_height * fb->hf_bytes_per_line;
+
+       fb->hf_access_flags |= HPCFB_ACCESS_BYTE;
+       fb->hf_access_flags |= HPCFB_ACCESS_WORD;
+       fb->hf_access_flags |= HPCFB_ACCESS_DWORD;
+
+       fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
+       switch (sc->sc_depth) {
+       default:
+               panic("plumvideo_hpcfbinit: not supported color depth\n");
+               /* NOTREACHED */
+       case 16:
+               fb->hf_class = HPCFB_CLASS_RGBCOLOR;
+               fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
+               fb->hf_pack_width = 16;
+               fb->hf_pixels_per_pack = 1;
+               fb->hf_pixel_width = 16;
+
+               fb->hf_class_data_length = sizeof(struct hf_rgb_tag);
+               fb->hf_u.hf_rgb.hf_flags = 0;   /* reserved for future use */
+
+               fb->hf_u.hf_rgb.hf_red_width = 5;
+               fb->hf_u.hf_rgb.hf_red_shift = 11;
+               fb->hf_u.hf_rgb.hf_green_width = 6;
+               fb->hf_u.hf_rgb.hf_green_shift = 5;
+               fb->hf_u.hf_rgb.hf_blue_width = 5;
+               fb->hf_u.hf_rgb.hf_blue_shift = 0;
+               fb->hf_u.hf_rgb.hf_alpha_width = 0;
+               fb->hf_u.hf_rgb.hf_alpha_shift = 0;
+               break;
+
+       case 8:
+               fb->hf_class = HPCFB_CLASS_INDEXCOLOR;
+               fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
+               fb->hf_pack_width = 8;
+               fb->hf_pixels_per_pack = 1;
+               fb->hf_pixel_width = 8;
+               fb->hf_class_data_length = sizeof(struct hf_indexed_tag);
+               fb->hf_u.hf_indexed.hf_flags = 0; /* reserved for future use */
+               break;
+       }
 }
 
 int
@@ -215,6 +290,9 @@
                bpp = 8;
                break;
        }
+       sc->sc_depth = bpp;
+       sc->sc_width = bootinfo->fb_width;
+       sc->sc_height = bootinfo->fb_height;
 
        /*
         * set line byte length to bootinfo and LCD controller.
@@ -267,6 +345,97 @@
        return (0);
 }
 
+int
+plumvideo_ioctl(v, cmd, data, flag, p)
+       void *v;
+       u_long cmd;
+       caddr_t data;
+       int flag;
+       struct proc *p;



Home | Main Index | Thread Index | Old Index