Source-Changes-HG archive

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

[src/trunk]: src Add wscons drivers for the DEC PixelStamp graphics accelerat...



details:   https://anonhg.NetBSD.org/src/rev/cfa81b3ade79
branches:  trunk
changeset: 500712:cfa81b3ade79
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Dec 17 13:52:03 2000 +0000

description:
Add wscons drivers for the DEC PixelStamp graphics accelerators.

diffstat:

 distrib/sets/lists/comp/mi |     4 +-
 sys/dev/tc/Makefile        |     6 +-
 sys/dev/tc/files.tc        |    16 +-
 sys/dev/tc/px.c            |   285 ++++++++
 sys/dev/tc/pxg.c           |   398 ++++++++++++
 sys/dev/tc/stic.c          |  1445 ++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/tc/sticreg.h       |   244 +++++++
 sys/dev/tc/sticvar.h       |   153 ++++
 8 files changed, 2546 insertions(+), 5 deletions(-)

diffs (truncated from 2611 to 300 lines):

diff -r 3adb8df9b990 -r cfa81b3ade79 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Sun Dec 17 12:04:30 2000 +0000
+++ b/distrib/sets/lists/comp/mi        Sun Dec 17 13:52:03 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.285 2000/12/15 01:28:39 thorpej Exp $
+#      $NetBSD: mi,v 1.286 2000/12/17 13:52:04 ad Exp $
 ./sys                  comp-sysutil-root
 ./usr/bin/addr2line    comp-miscutil-bin
 ./usr/bin/ar           comp-util-bin
@@ -354,6 +354,8 @@
 ./usr/include/dev/tc/ioasicreg.h               comp-c-include
 ./usr/include/dev/tc/ioasicvar.h               comp-c-include
 ./usr/include/dev/tc/sfbreg.h          comp-c-include
+./usr/include/dev/tc/sticreg.h         comp-c-include
+./usr/include/dev/tc/sticvar.h         comp-c-include
 ./usr/include/dev/tc/tcdevs.h          comp-c-include
 ./usr/include/dev/tc/tcdevs_data.h             comp-c-include
 ./usr/include/dev/tc/tcdsreg.h         comp-c-include
diff -r 3adb8df9b990 -r cfa81b3ade79 sys/dev/tc/Makefile
--- a/sys/dev/tc/Makefile       Sun Dec 17 12:04:30 2000 +0000
+++ b/sys/dev/tc/Makefile       Sun Dec 17 13:52:03 2000 +0000
@@ -1,11 +1,11 @@
-#      $NetBSD: Makefile,v 1.6 2000/07/04 02:31:21 nisimura Exp $
+#      $NetBSD: Makefile,v 1.7 2000/12/17 13:52:03 ad Exp $
 
 # use 'make -f Makefile.tcdevs' to make tcdevs.h and tcdevs_data.h
 
 INCSDIR= /usr/include/dev/tc
 
 INCS=  ascvar.h if_levar.h ioasicreg.h ioasicvar.h sfbreg.h \
-       tcdevs.h tcdevs_data.h tcdsreg.h tcdsvar.h tcreg.h \
-       tcvar.h
+       sticreg.h sticvar.h tcdevs.h tcdevs_data.h tcdsreg.h tcdsvar.h \
+       tcreg.h tcvar.h
 
 .include <bsd.kinc.mk>
diff -r 3adb8df9b990 -r cfa81b3ade79 sys/dev/tc/files.tc
--- a/sys/dev/tc/files.tc       Sun Dec 17 12:04:30 2000 +0000
+++ b/sys/dev/tc/files.tc       Sun Dec 17 13:52:03 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.tc,v 1.19 2000/11/24 05:02:26 nisimura Exp $
+#      $NetBSD: files.tc,v 1.20 2000/12/17 13:52:03 ad Exp $
 #
 # Config file and device description for machine-independent
 # TURBOchannel code.  Included by ports that need it.
@@ -59,6 +59,20 @@
 #attach xcfb at tc
 #file  dev/tc/xcfb.c                   xcfb needs-flag
 
+# STIC (stamp interface chip) for PX and PXG
+#define        stic
+#file  dev/tc/stic.c                   stic
+
+# PX PMAG-C
+#device        px: wsemuldisplaydev, stic
+#attach        px at tc
+#file  dev/tc/px.c                     px needs-flag
+
+# PXG PMAG-D, PMAG-E, PMAG-F
+#device        pxg: wsemuldisplaydev, stic
+#attach        pxg at tc
+#file  dev/tc/pxg.c                    pxg needs-flag
+
 # TCDS dual channel SCSI
 #device        tcds { chip = -1 }
 #attach        tcds at tc
diff -r 3adb8df9b990 -r cfa81b3ade79 sys/dev/tc/px.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/tc/px.c   Sun Dec 17 13:52:03 2000 +0000
@@ -0,0 +1,285 @@
+/*     $NetBSD: px.c,v 1.4 2000/12/17 13:52:03 ad Exp $        */
+
+/*-
+ * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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. 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Driver for DEC PixelStamp graphics adapters (PMAG-C).
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/callout.h>
+
+#include <uvm/uvm_extern.h>
+
+#if defined(pmax)
+#include <mips/cpuregs.h>
+#elif defined(alpha)
+#include <alpha/alpha_cpu.h>
+#endif
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+#include <machine/bus.h>
+
+#include <dev/cons.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <dev/ic/bt459reg.h>
+
+#include <dev/tc/tcvar.h>
+#include <dev/tc/sticreg.h>
+#include <dev/tc/sticvar.h>
+
+#define        PX_STIC_POLL_OFFSET     0x000000        /* STIC DMA poll space */
+#define        PX_STAMP_OFFSET         0x0c0000        /* pixelstamp space on STIC */
+#define        PX_STIC_OFFSET          0x180000        /* STIC registers */
+#define        PX_VDAC_OFFSET          0x200000        /* VDAC registers (bt459) */
+#define        PX_VDAC_RESET_OFFSET    0x300000        /* VDAC reset register */
+#define        PX_ROM_OFFSET           0x300000        /* ROM code */
+
+#define        PX_BUF_SIZE             (STIC_PACKET_SIZE*2 + STIC_IMGBUF_SIZE*2)
+#define        PX_BUF_ALIGN            32768
+
+static void    px_attach(struct device *, struct device *, void *);
+static void    px_init(struct stic_info *, int);
+static int     px_match(struct device *, struct cfdata *, void *);
+
+static int     px_intr(void *);
+static u_int32_t       *px_pbuf_get(struct stic_info *);
+static int     px_pbuf_post(struct stic_info *, u_int32_t *);
+
+void   px_cnattach(tc_addr_t);
+
+struct px_softc {
+       struct  device px_dv;
+       struct  stic_info *px_si;
+};
+
+struct cfattach px_ca = {
+       sizeof(struct px_softc), px_match, px_attach
+};
+
+static int
+px_match(struct device *parent, struct cfdata *match, void *aux)
+{
+       struct tc_attach_args *ta;
+
+       ta = aux;
+
+       return (strncmp("PMAG-CA ", ta->ta_modname, TC_ROM_LLEN) == 0);
+}
+
+static void
+px_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct stic_info *si;
+       struct tc_attach_args *ta;
+       struct px_softc *px;
+       int console;
+
+       px = (struct px_softc *)self;
+       ta = (struct tc_attach_args *)aux;
+
+       if (ta->ta_addr == stic_consinfo.si_slotbase) {
+               si = &stic_consinfo;
+               console = 1;
+       } else {
+               if (stic_consinfo.si_slotbase == NULL)
+                       si = &stic_consinfo;
+               else {
+                       si = malloc(sizeof(*si), M_DEVBUF, M_NOWAIT);
+                       memset(si, 0, sizeof(*si));
+               }
+               si->si_slotbase = ta->ta_addr;
+               px_init(si, 0);
+               console = 0;
+       }
+
+       px->px_si = si;
+       tc_intr_establish(parent, ta->ta_cookie, IPL_TTY, px_intr, si);
+
+       printf(": 2DA, 8 plane, %dx%d stamp\n", si->si_stampw, si->si_stamph);
+
+       stic_attach(self, si, console);
+}
+
+void
+px_cnattach(tc_addr_t addr)
+{
+       struct stic_info *si;
+
+       si = &stic_consinfo;
+       si->si_slotbase = addr;
+       px_init(si, 1);
+       stic_cnattach(si);
+}
+
+static void
+px_init(struct stic_info *si, int bootstrap)
+{
+       struct pglist pglist;
+       caddr_t kva;
+       paddr_t bpa;
+
+       /*
+        * Allocate memory for the packet buffers.  It must be located below
+        * 8MB, since the STIC can't access outside that region.  Also, due
+        * to the holes in STIC address space, each buffer mustn't cross a
+        * 32kB boundary.
+        */
+       if (bootstrap) {
+               /* 
+                * UVM won't be initalised at this point, so grab memory
+                * directly from vm_physmem[].
+                */
+               kva = (caddr_t)pmap_steal_memory(PX_BUF_SIZE + PX_BUF_ALIGN,
+                   NULL, NULL);
+               bpa = (STIC_KSEG_TO_PHYS(kva) + PX_BUF_ALIGN - 1) &
+                   ~(PX_BUF_ALIGN - 1);
+               if (bpa + PX_BUF_SIZE > 8192*1024)
+                       panic("px_init: allocation out of bounds");
+       } else {
+               TAILQ_INIT(&pglist);
+               if (uvm_pglistalloc(PX_BUF_SIZE, 0, 8192*1024, PX_BUF_ALIGN, 
+                   PX_BUF_ALIGN, &pglist, 1, 0) != 0)
+                       panic("px_init: allocation failure");
+               bpa = TAILQ_FIRST(&pglist)->phys_addr;
+       }
+
+       kva = (caddr_t)TC_PHYS_TO_UNCACHED(si->si_slotbase);
+
+       si->si_slotkva = (u_int32_t *)kva;
+       si->si_vdac = (u_int32_t *)(kva + PX_VDAC_OFFSET);
+       si->si_vdac_reset = (u_int32_t *)(kva + PX_VDAC_RESET_OFFSET);
+       si->si_stic = (volatile struct stic_regs *)(kva + PX_STIC_OFFSET);
+       si->si_stamp = (u_int32_t *)(kva + PX_STAMP_OFFSET);
+       si->si_buf = (u_int32_t *)TC_PHYS_TO_UNCACHED(bpa);
+       si->si_buf_phys =  bpa;
+       si->si_buf_size = PX_BUF_SIZE;
+       si->si_disptype = WSDISPLAY_TYPE_PX;
+       si->si_depth = 8;
+
+       si->si_pbuf_get = px_pbuf_get;
+       si->si_pbuf_post = px_pbuf_post;
+
+       memset(si->si_buf, 0, PX_BUF_SIZE);
+
+       stic_init(si);
+}
+
+static int
+px_intr(void *cookie)
+{
+       volatile struct stic_regs *sr;
+       struct stic_info *si;
+       int state;
+
+       si = cookie;
+       sr = si->si_stic;
+       state = sr->sr_ipdvint;
+
+       if ((state & STIC_INT_V) != 0) {
+               sr->sr_ipdvint = 
+                   STIC_INT_V_WE | (sr->sr_ipdvint & STIC_INT_V_EN);
+               tc_wmb();
+               stic_flush(si);
+       }
+
+       if ((state & STIC_INT_P) != 0) {
+               sr->sr_ipdvint = 
+                   STIC_INT_P_WE | (sr->sr_ipdvint & STIC_INT_P_EN);



Home | Main Index | Thread Index | Old Index