Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pmax Change the way fb devices are configured and a...



details:   https://anonhg.NetBSD.org/src/rev/1df49c4d0308
branches:  trunk
changeset: 474905:1df49c4d0308
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Jul 25 22:50:28 1999 +0000

description:
Change the way fb devices are configured and attached:
- 'struct fbsoftc' created, which points to a 'struct fbinfo'
- 'struct fbinfo' for each device is allocated with fballoc()

This means:
- Console device doesn't get different 'struct fbinfo' at attach
- Console device doesn't get initialized twice
- Color rcons now works
- The current Xserver MUST BE REBUILT.

diffstat:

 sys/arch/pmax/dev/cfb.c         |   84 +++++-------------------
 sys/arch/pmax/dev/fb.c          |  132 +++++++++++++++++++++------------------
 sys/arch/pmax/dev/fb_usrreq.c   |   67 ++++++++++---------
 sys/arch/pmax/dev/findcons.c    |   30 +++++++-
 sys/arch/pmax/dev/mfb.c         |   63 ++++--------------
 sys/arch/pmax/dev/pm.c          |   23 +------
 sys/arch/pmax/dev/pm_ds.c       |   47 ++++++-------
 sys/arch/pmax/dev/pmvar.h       |    4 +-
 sys/arch/pmax/dev/px.c          |   12 +-
 sys/arch/pmax/dev/qvss_compat.c |    4 +-
 sys/arch/pmax/dev/sfb.c         |   44 +++---------
 sys/arch/pmax/dev/xcfb.c        |   41 ++++-------
 sys/arch/pmax/include/fbvar.h   |   17 ++--
 sys/arch/pmax/tc/tc_subr.c      |   10 ++-
 14 files changed, 242 insertions(+), 336 deletions(-)

diffs (truncated from 1234 to 300 lines):

diff -r 6cd32381e3c4 -r 1df49c4d0308 sys/arch/pmax/dev/cfb.c
--- a/sys/arch/pmax/dev/cfb.c   Sun Jul 25 21:59:13 1999 +0000
+++ b/sys/arch/pmax/dev/cfb.c   Sun Jul 25 22:50:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cfb.c,v 1.32 1999/04/24 08:01:02 simonb Exp $  */
+/*     $NetBSD: cfb.c,v 1.33 1999/07/25 22:50:28 ad Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -114,14 +114,6 @@
 struct pmax_fbtty cfbfb;
 struct fbinfo  cfbfi;  /*XXX*/ /* should be softc */
 
-
-/*
- * Forward references.
- */
-
-#define CMAP_BITS      (3 * 256)               /* 256 entries, 3 bytes per. */
-static u_char cmap_bits [CMAP_BITS];           /* colormap for console... */
-
 /*
  * Method table for standard framebuffer operations on a CFB.
  * The  CFB uses a Brooktree bt479 ramdac.
@@ -138,8 +130,6 @@
 };
 
 int cfbinit __P((struct fbinfo *fi, caddr_t cfbaddr, int unit, int silent));
-extern void fbScreenInit __P((struct fbinfo *fi));
-
 
 #define        CFB_OFFSET_VRAM         0x0             /* from module's base */
 #define CFB_OFFSET_BT459       0x200000        /* Bt459 registers */
@@ -159,7 +149,7 @@
 int cfb_intr __P((void *sc));
 
 struct cfattach cfb_ca = {
-       sizeof(struct fbinfo), cfbmatch, cfbattach
+       sizeof(struct fbsoftc), cfbmatch, cfbattach
 };
 
 int
@@ -196,15 +186,13 @@
        struct tc_attach_args *ta = aux;
        caddr_t base =  (caddr_t)(ta->ta_addr);
        int unit = self->dv_unit;
-       struct fbinfo *fi = (struct fbinfo *) self;
+       struct fbinfo *fi;
+       
+       /* Allocate a struct fbinfo and point the softc at it */
+       if (fballoc(base, &fi) == 0 && !cfbinit(fi, base, unit, 0))
+                       return;
 
-#ifdef notyet
-       /* if this is the console, it's already configured. */
-       if (ca->ca_slotpri == cons_slot)
-               return; /* XXX patch up softc pointer */
-#endif
-
-       if (!cfbinit(fi, base, unit, 0))
+       if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL)
                return;
 
        /*
@@ -214,6 +202,7 @@
         * interrupt handler, which interrupts during vertical-retrace.
         */
        tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, cfb_intr, fi);
+       fbconnect("PMAG-BA", fi, 0);
        printf("\n");
 }
 
@@ -230,21 +219,6 @@
        int unit;
        int silent;
 {
-       /*
-        * If this device is being intialized as the console, malloc()
-        * is not yet up and we must use statically-allocated space.
-        */
-       if (fi == NULL) {
-               fi = &cfbfi;    /* XXX */
-               fi->fi_cmap_bits = (caddr_t)cmap_bits;
-       }
-       else {
-               fi->fi_cmap_bits = malloc(CMAP_BITS, M_DEVBUF, M_NOWAIT);
-               if (fi->fi_cmap_bits == NULL) {
-                       printf("cfb%d: no memory for cmap\n", unit);
-                       return (0);
-               }
-       }
 
        /* check for no frame buffer */
        if (badaddr(cfbaddr, 4)) {
@@ -252,8 +226,6 @@
                return (0);
        }
 
-       /* XXX  fi should be a pointer to a field in the softc */
-
        /* Fill in main frame buffer info struct. */
        fi->fi_unit = unit;
        fi->fi_pixels = (caddr_t)(cfbaddr + CFB_OFFSET_VRAM);
@@ -273,17 +245,11 @@
        fi->fi_type.fb_cmsize = 256;
        fi->fi_type.fb_size = CFB_FB_SIZE;
 
-
-       /*
-        * Reset the chip.   (Initializes colormap for us as a
-        * "helpful"  side-effect.)
-        */
+       /* Reset the chip */
        if (!bt459init(fi)) {
                printf("cfb%d: vdac init failed.\n", unit);
                return (0);
        }
-       /*cfbInitColorMap();*/  /* done by bt459init() */
-
 
        /*
         * qvss/pm-style mmap()ed event queue compatibility glue
@@ -299,33 +265,19 @@
        /* This is glass-tty state but it's in the shared structure. Ick. */
        fi->fi_fbu->scrInfo.max_row = 56;
        fi->fi_fbu->scrInfo.max_col = 80;
-
        init_pmaxfbu(fi);
 
-       /*
-        * Initialize old-style pmax glass-tty screen info.
-        */
+       /* Initialize old-style pmax glass-tty screen info. */
        fi->fi_glasstty = &cfbfb;
 
-
-       /*
-        * Initialize the color map, the screen, and the mouse.
-        */
+       /* Initialize the color map, the screen, and the mouse. */
        if (tb_kbdmouseconfig(fi)) {
                printf(" (mouse/keyboard config failed)");
                return (0);
        }
 
-
-       /*
-        * Connect to the raster-console pseudo-driver
-        */
+       /* Connect to the raster-console pseudo-driver */
        fbconnect("PMAG-BA", fi, silent);
-
-
-#ifdef fpinitialized
-       fp->initialized = 1;
-#endif
        return (1);
 }
 
@@ -344,12 +296,14 @@
 cfb_intr(sc)
        void *sc;
 {
-       struct fbinfo *fi = (struct fbinfo *)sc;
-       char *slot_addr = (((char *)fi->fi_base) - CFB_OFFSET_VRAM);
+       struct fbinfo *fi;
+       caddr_t slot_addr;
 
+       fi = (struct fbinfo *)sc;
+       slot_addr = (((caddr_t)fi->fi_base) - CFB_OFFSET_VRAM);
+       
        /* reset vertical-retrace interrupt by writing a dont-care */
-       *(int*) (slot_addr+CFB_OFFSET_IREQ) = 0;
-
+       *(int*) (slot_addr + CFB_OFFSET_IREQ) = 0;
        return (0);
 }
 
diff -r 6cd32381e3c4 -r 1df49c4d0308 sys/arch/pmax/dev/fb.c
--- a/sys/arch/pmax/dev/fb.c    Sun Jul 25 21:59:13 1999 +0000
+++ b/sys/arch/pmax/dev/fb.c    Sun Jul 25 22:50:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fb.c,v 1.25 1999/04/26 23:26:11 ad Exp $       */
+/*     $NetBSD: fb.c,v 1.26 1999/07/25 22:50:28 ad Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -76,6 +76,7 @@
 #include <sys/proc.h>
 #include <sys/mman.h>
 #include <sys/syslog.h>
+#include <sys/malloc.h>
 
 #include <vm/vm.h>
 #include <miscfs/specfs/specdev.h>
@@ -165,16 +166,16 @@
 #include <sys/device.h>
 #include "fb.h"
 
+struct fbdev {
+       struct  fbinfo fd_info;
+       caddr_t fd_base;
+} static fbdevs[NFB];
 
-static struct {
-       struct fbinfo *cd_devs[NFB];
-       int cd_ndevs;
-} fbcd =   { {NULL}, 0} ;
+static u_int   fbndevs;                /* number of devices */
+static u_char  cmap_bits[768];         /* colormap for console */
 
 void fbattach __P((int n));
 
-
-
 /*
  * attach routine: required for pseudo-device
  */
@@ -182,50 +183,24 @@
 fbattach(n)
        int n;
 {
-       /* allocate space  for n framebuffers... */
+
 }
 
 /*
  * Connect a framebuffer, described by a struct fbinfo, to the
- * raster-console pseudo-device subsystem. )This would be done
+ * raster-console pseudo-device subsystem. (This would be done
  * with BStreams, if only we had them.)
  */
 void
-fbconnect (name, info, silent)
+fbconnect (name, info, console)
        char *name;
        struct fbinfo *info;
-       int silent;
+       int console;
 {
-       int fbix;
-       static int first = 1;
-
-#ifndef FBDRIVER_DOES_ATTACH
-       /*
-        * See if we've already configured this frame buffer;
-        * if not, find an "fb" pseudo-device entry for it.
-        */
-       for (fbix = 0; fbix < fbcd.cd_ndevs; fbix++)
-               if ((fbcd.cd_devs [fbix]->fi_type.fb_boardtype
-                    == info -> fi_type.fb_boardtype)
-                   && fbcd.cd_devs [fbix]->fi_unit == info -> fi_unit)
-                       break;
-
-       if (fbix >= fbcd.cd_ndevs) {
-               if (fbcd.cd_ndevs >= NFB) {
-                       printf("fb: more frame buffers probed than configured!\n");
-                       return;
-               }
-
-               fbix = fbcd.cd_ndevs++;
-               fbcd.cd_devs [fbix] = info;
-       } else
-               info = fbcd.cd_devs [fbix];
-#endif /* FBDRIVER_DOES_ATTACH */
-
        /*
         * If this is the first frame buffer we've seen, pass it to rcons.
         */
-       if (first) {
+       if (console) {
                extern dev_t cn_in_dev; /* XXX rcons hackery */
 
                /* Only the first fb gets 4.4bsd/pmax style event ringbuffer */
@@ -234,22 +209,67 @@
                /*XXX*/ cn_in_dev = cn_tab->cn_dev; /*XXX*/ /* FIXME */
                rcons_connect (info);
 #endif  /* NRASTERCONSOLE */
-               first = 0;
-       }
-
-       if (!silent)
-               printf (": (%dx%dx%d)%s",
-                       info -> fi_type.fb_width,
-                       info -> fi_type.fb_height,
-                       info -> fi_type.fb_depth,
-                       (fbix != 0 ? ""
-                        : ((cn_tab -> cn_pri == CN_REMOTE)
-                           ? " (rcons)" : " (console)")));
-       return;
+       } else 
+               printf(": %dx%dx%d%s", info->fi_type.fb_width, 
+                   info->fi_type.fb_height, info->fi_type.fb_depth, 
+                   (console ? " (console)" : ""));
 }
 
 
-#include "fb_usrreq.c" /* old pm-compatblie driver that supports X11R5 */
+/*
+ * Allocate a 'struct fbinfo' for a new fb device. Return zero on success 



Home | Main Index | Thread Index | Old Index